Commit f942dabe authored by hongguangwu's avatar hongguangwu

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

parents 1f0a60ad 05ea5991
......@@ -22,7 +22,8 @@ import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.time.LocalDate;
import javax.validation.constraints.Max;
import java.util.Date;
/**
* 员工学历信息表
......@@ -46,12 +47,14 @@ public class TEmpEducation extends BaseEntity {
/**
* 员工ID
*/
@Max(value = 20)
@Schema(description = "员工ID")
private String empId;
/**
* 员工姓名
*/
@Max(value = 20)
@Schema(description = "员工姓名")
private String empName;
......@@ -64,6 +67,7 @@ public class TEmpEducation extends BaseEntity {
/**
* 身份证号
*/
@Max(value = 20)
@Schema(description = "身份证号")
private String empIdcard;
......@@ -71,11 +75,12 @@ public class TEmpEducation extends BaseEntity {
* 入学时间
*/
@Schema(description = "入学时间")
private LocalDate entryDate;
private Date entryDate;
/**
* 学历名称
*/
@Max(value = 50)
@Schema(description = "学历名称")
private String educationName;
......@@ -83,11 +88,12 @@ public class TEmpEducation extends BaseEntity {
* 结业日期
*/
@Schema(description = "结业日期")
private LocalDate gradutionDate;
private Date gradutionDate;
/**
* 学校名称
*/
@Max(value = 50)
@Schema(description = "学校名称")
private String school;
......@@ -112,6 +118,7 @@ public class TEmpEducation extends BaseEntity {
/**
* 院系名称
*/
@Max(value = 50)
@Schema(description = "院系名称")
private String collageSystem;
......@@ -131,18 +138,21 @@ public class TEmpEducation extends BaseEntity {
/**
* 证书名称
*/
@Max(value = 50)
@Schema(description = "证书名称")
private String certificationName;
/**
* 备注
*/
@Max(value = 200)
@Schema(description = "备注")
private String remark;
/**
* 专业
*/
@Max(value = 50)
@Schema(description = "专业")
private String major;
......
......@@ -30,6 +30,7 @@ import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;
import java.util.Set;
......@@ -217,13 +218,13 @@ public class TEmployeeInfo extends BaseEntity {
* 入学时间
*/
@Schema(description = "入学时间")
private LocalDate admissionDate;
private Date admissionDate;
/**
* 毕业时间
*/
@Schema(description = "毕业时间")
private LocalDate gradutionDate;
private Date gradutionDate;
/**
* 备注
......
package com.yifu.cloud.plus.v1.yifu.archives.vo;
import cn.hutool.core.date.DateTime;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmpProfessionalQualification;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
......
package com.yifu.cloud.plus.v1.yifu.archives.vo;
import cn.hutool.core.date.DateTime;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmpDisabilityInfo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
......
package com.yifu.cloud.plus.v1.yifu.archives.vo;
import cn.hutool.core.date.DateTime;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmpEducation;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
......
......@@ -26,7 +26,7 @@ public class EmpDisabilityExcelVO extends RowIndex implements Serializable {
/**
* 员工姓名
*/
@ExcelAttribute(name = "员工姓名",errorInfo = "员工姓名不可为空",maxLength = 20)
@ExcelAttribute(name = "员工姓名",isNotEmpty = true, errorInfo = "员工姓名不可为空",maxLength = 20)
@NotNull(message = "员工姓名不能为空")
@ExcelProperty(value ="员工姓名")
private String empName;
......@@ -34,7 +34,7 @@ public class EmpDisabilityExcelVO extends RowIndex implements Serializable {
/**
* 员工身份证
*/
@ExcelAttribute(name = "身份证号",errorInfo = "员工身份证不能为空",maxLength = 20)
@ExcelAttribute(name = "身份证号",isNotEmpty = true, errorInfo = "员工身份证不能为空",maxLength = 20)
@NotNull(message = "员工身份证不能为空")
@ExcelProperty(value ="身份证号")
private String empIdcard;
......@@ -42,7 +42,7 @@ public class EmpDisabilityExcelVO extends RowIndex implements Serializable {
/**
* 伤残病名称
*/
@ExcelAttribute(name = "伤残病名称",errorInfo = "伤残病名称不能为空",maxLength = 50)
@ExcelAttribute(name = "伤残病名称",isNotEmpty = true, errorInfo = "伤残病名称不能为空",maxLength = 50)
@NotNull(message = "伤残病名称不能为空")
@ExcelProperty(value ="伤残病名称")
private String disabilityName;
......@@ -57,7 +57,7 @@ public class EmpDisabilityExcelVO extends RowIndex implements Serializable {
/**
* 伤残等级
*/
@ExcelAttribute(name = "伤残等级",errorInfo = "伤残等级不能为空",isDataId = true, dataType = "disability_grade")
@ExcelAttribute(name = "伤残等级",isNotEmpty = true, errorInfo = "伤残等级不能为空",isDataId = true, dataType = "disability_grade")
@NotNull(message = "伤残等级不能为空")
@ExcelProperty(value ="伤残等级")
private String disabilityLevel;
......@@ -65,7 +65,7 @@ public class EmpDisabilityExcelVO extends RowIndex implements Serializable {
/**
* 伤残开始日期
*/
@ExcelAttribute(name = "伤残开始日期",errorInfo = "伤残开始日期不能为空",isDate = true)
@ExcelAttribute(name = "伤残开始日期",isNotEmpty = true, errorInfo = "伤残开始日期不能为空",isDate = true)
@NotNull(message = "伤残开始日期不能为空")
@Past
@DateTimeFormat("YYYY-MM-dd")
......@@ -75,7 +75,7 @@ public class EmpDisabilityExcelVO extends RowIndex implements Serializable {
/**
* 伤残结束日期
*/
@ExcelAttribute(name = "伤残结束日期",errorInfo = "伤残结束日期不能为空",isDate = true)
@ExcelAttribute(name = "伤残结束日期",isNotEmpty = true, errorInfo = "伤残结束日期不能为空",isDate = true)
@NotNull(message = "伤残结束日期不能为空")
@Past
@DateTimeFormat("YYYY-MM-dd")
......@@ -85,7 +85,7 @@ public class EmpDisabilityExcelVO extends RowIndex implements Serializable {
/**
* 是否工伤标识0是/1否
*/
@ExcelAttribute(name = "是否工伤",errorInfo = "是否工伤不可为空",readConverterExp = "0:是,1:否")
@ExcelAttribute(name = "是否工伤",isNotEmpty = true, errorInfo = "是否工伤不可为空",readConverterExp = "0=是,1=否")
@NotNull(message = "是否工伤标识(0是/1否)不能为空")
@ExcelProperty(value ="是否工伤")
private String injuryIdentification;
......
......@@ -79,7 +79,7 @@ public class EmpEducationExcelVO extends RowIndex implements Serializable {
/**
* 最高学历标识0是/1否
*/
@ExcelAttribute(name = "最高学历",errorInfo = "最高学历不可为空",readConverterExp = "是:0,否:1")
@ExcelAttribute(name = "最高学历",errorInfo = "最高学历不可为空",readConverterExp = "0=是,1=否")
@NotNull(message = "最高学历标识不可为空")
@ExcelProperty(value ="最高学历")
private String highIdentification;
......
......@@ -20,15 +20,15 @@ public class EmpEducationUpdateExcelVo extends RowIndex{
* @Author fxj
* @Description 主键
**/
@ExcelAttribute(name = "主键",errorInfo = "主键不可为空")
@NotNull(message = "主键不可为空")
@ExcelProperty(value ="主键")
@ExcelAttribute(name = "唯一标识", isNotEmpty = true,errorInfo = "唯一标识不可为空")
@NotNull(message = "唯一标识不可为空")
@ExcelProperty(value ="唯一标识")
private String id;
/**
* 学校名称
*/
@ExcelAttribute(name = "学校",errorInfo = "学校不可为空")
@ExcelAttribute(name = "学校", isNotEmpty = true,errorInfo = "学校不可为空")
@NotNull(message = "学校不可为空")
@ExcelProperty(value ="学校")
private String school;
......@@ -44,7 +44,7 @@ public class EmpEducationUpdateExcelVo extends RowIndex{
/**
* 专业
*/
@ExcelAttribute(name = "专业",errorInfo = "专业不可为空")
@ExcelAttribute(name = "专业", isNotEmpty = true,errorInfo = "专业不可为空")
@NotNull(message = "专业不可为空")
@ExcelProperty(value ="专业")
private String major;
......@@ -52,7 +52,7 @@ public class EmpEducationUpdateExcelVo extends RowIndex{
/**
* 学历名称
*/
@ExcelAttribute(name = "学历",errorInfo = "学历不可为空")
@ExcelAttribute(name = "学历", isNotEmpty = true,errorInfo = "学历不可为空", isDataId = true, dataType = "education")
@NotNull(message = "学历不可为空")
@ExcelProperty(value ="学历")
private String educationName;
......@@ -60,14 +60,14 @@ public class EmpEducationUpdateExcelVo extends RowIndex{
/**
* 学历类型:全日制、自考、函授等
*/
@ExcelAttribute(name = "学历类型")
@ExcelAttribute(name = "学历类型", isDataId = true, dataType = "education_type")
@ExcelProperty(value ="学历类型")
private String type;
/**
* 最高学历标识0是/1否
*/
@ExcelAttribute(name = "最高学历",errorInfo = "最高学历标识不可为空",readConverterExp = "0:是,1:否")
@ExcelAttribute(name = "最高学历", isNotEmpty = true,errorInfo = "最高学历标识不可为空",readConverterExp = "0=是,1=否")
@NotNull(message = "最高学历标识不可为空")
@ExcelProperty(value ="最高学历")
private String highIdentification;
......@@ -75,25 +75,25 @@ public class EmpEducationUpdateExcelVo extends RowIndex{
/**
* 学制类型:四年、三年、五年、二年
*/
@ExcelAttribute(name = "学制类型")
@ExcelAttribute(name = "学制类型", isDataId = true, dataType = "education_system")
@ExcelProperty(value ="学制类型")
private String educationSystem;
/**
* 入学时间
*/
@ExcelAttribute(name = "入学时间",errorInfo = "入学时间不可为空",isDate = true)
@ExcelAttribute(name = "入学时间", isNotEmpty = true,errorInfo = "入学时间不可为空",isDate = true)
@NotNull(message = "入学时间不可为空")
@DateTimeFormat("YYYY-MM-dd")
@DateTimeFormat("yyyy-MM-dd")
@ExcelProperty(value ="入学时间")
private Date entryDate;
/**
* 结业日期
*/
@ExcelAttribute(name = "毕业时间",errorInfo = "毕业时间不可为空",isDate = true)
@ExcelAttribute(name = "毕业时间", isNotEmpty = true,errorInfo = "毕业时间不可为空",isDate = true)
@NotNull(message = "毕业时间不可为空")
@DateTimeFormat("YYYY-MM-dd")
@DateTimeFormat("yyyy-MM-dd")
@ExcelProperty(value ="毕业时间")
private Date gradutionDate;
......
......@@ -25,14 +25,14 @@ public class EmpWorkRecordExcelVO extends RowIndex implements Serializable {
/**
* 员工姓名
*/
@ExcelAttribute(name = "员工姓名",errorInfo = "员工姓名不可为空",maxLength = 20)
@ExcelAttribute(name = "员工姓名",isNotEmpty = true,errorInfo = "员工姓名不可为空",maxLength = 20)
@NotNull(message = "员工姓名不可为空")
@ExcelProperty(value ="员工姓名")
private String empName;
/**
* 员工身份证
*/
@ExcelAttribute(name = "身份证号",errorInfo = "员工身份证不可为空",maxLength = 20)
@ExcelAttribute(name = "身份证号",isNotEmpty = true,errorInfo = "员工身份证不可为空",maxLength = 20)
@NotNull(message = "员工身份证不可为空")
@ExcelProperty(value ="身份证号")
private String empIdcard;
......@@ -40,7 +40,7 @@ public class EmpWorkRecordExcelVO extends RowIndex implements Serializable {
/**
* 工作单位
*/
@ExcelAttribute(name = "工作单位",errorInfo = "工作单位不可为空",maxLength = 100)
@ExcelAttribute(name = "工作单位",isNotEmpty = true,errorInfo = "工作单位不可为空",maxLength = 100)
@NotNull(message = "工作单位不可为空")
@ExcelProperty(value ="工作单位")
private String workUnit;
......@@ -48,7 +48,7 @@ public class EmpWorkRecordExcelVO extends RowIndex implements Serializable {
/**
* 工作部门
*/
@ExcelAttribute(name = "工作部门",errorInfo = "工作部门不可为空",maxLength = 100)
@ExcelAttribute(name = "工作部门",isNotEmpty = true,errorInfo = "工作部门不可为空",maxLength = 100)
@NotNull(message = "工作部门不可为空")
@ExcelProperty(value ="工作部门")
private String workDepart;
......@@ -70,7 +70,7 @@ public class EmpWorkRecordExcelVO extends RowIndex implements Serializable {
/**
* 是否在岗:0是/1否
*/
@ExcelAttribute(name = "在职状态",errorInfo = "在职状态不可为空",isDataId = true,readConverterExp = "0:是,1:否")
@ExcelAttribute(name = "在职状态",isNotEmpty = true,errorInfo = "在职状态不可为空",isDataId = true,readConverterExp = "0=在职,1=离职")
@NotNull(message = "是否在岗不可为空")
@ExcelProperty(value ="在职状态")
private String workingStatus;
......
......@@ -19,7 +19,6 @@ 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;
......
......@@ -18,6 +18,7 @@ package com.yifu.cloud.plus.v1.yifu.archives.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import javax.validation.constraints.Past;
......@@ -309,10 +310,22 @@ public class EmployeeProjectExportVO{
private Integer contractStatus;
/**
* 业务类型
* 业务类型一级分类
*/
@ExcelProperty(value ="业务类型")
private String businessType;
@ExcelProperty(value ="业务类型一级分类")
private String businessPrimaryType;
/**
* 业务类型二级分类
*/
@ExcelProperty(value ="业务类型二级分类")
private String businessSecondType;
/**
* 业务类型三级分类
*/
@ExcelProperty(value ="业务类型三级分类")
private String businessThirdType;
/**
* 商险状态(字典)
......
......@@ -24,6 +24,7 @@ import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.time.LocalDate;
import java.util.Date;
/**
* 项目档案表excel对应的实体
......@@ -189,13 +190,13 @@ public class EmployeeVO implements Serializable {
* 入学时间
*/
@ExcelProperty(value = "入学时间")
private LocalDate admissionDate;
private Date admissionDate;
/**
* 毕业时间
*/
@ExcelProperty(value = "毕业时间")
private LocalDate gradutionDate;
private Date gradutionDate;
/**
* 备注
......
package com.yifu.cloud.plus.v1.yifu.archives.vo;
import cn.hutool.core.date.DateTime;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmpFamily;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
......
package com.yifu.cloud.plus.v1.yifu.archives.vo;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* @Author fxj
* @Date 2022/6/27
* @Description
* @Version 1.0
*/
@Data
public class TCertRecordVo implements Serializable {
/**
* 员工ID
*/
@ExcelAttribute(name = "员工ID" )
@Schema(description ="员工ID")
private String empId;
/**
* 员工姓名
*/
@ExcelAttribute(name = "员工姓名" )
@Schema(description ="员工姓名")
private String empName;
/**
* 员工身份证
*/
@ExcelAttribute(name = "员工身份证" )
@Schema(description ="员工身份证")
private String empIdcard;
/**
* 项目名称
*/
@ExcelAttribute(name = "项目名称" )
@Schema(description ="项目名称")
private String projectName;
/**
* 项目编码
*/
@ExcelAttribute(name = "项目编码" )
@Schema(description ="项目编码")
private String projectCode;
/**
* 岗位
*/
@ExcelAttribute(name = "岗位" )
@Schema(description ="岗位")
private String post;
/**
* 合同开始时间
*/
@ExcelAttribute(name = "合同开始时间" )
@Schema(description ="合同开始时间")
private LocalDateTime contractStart;
/**
* 合同截止时间
*/
@ExcelAttribute(name = "合同截止时间" )
@Schema(description ="合同截止时间")
private LocalDateTime contractEnd;
/**
* 开具当天时间
*/
@ExcelAttribute(name = "开具当天时间" )
@Schema(description ="开具当天时间")
private LocalDateTime openCurTime;
/**
* 印章名称
*/
@ExcelAttribute(name = "印章名称" )
@Schema(description ="印章名称")
private String seal;
/**
* 创建者
*/
@ExcelAttribute(name = "创建者" )
@Schema(description ="创建者")
private String createBy;
/**
* 更新人
*/
@ExcelAttribute(name = "更新人" )
@Schema(description ="更新人")
private String updateBy;
/**
* 创建人姓名
*/
@ExcelAttribute(name = "创建人姓名" )
@Schema(description ="创建人姓名")
private String createName;
/**
* 创建时间
*/
@ExcelAttribute(name = "创建时间" )
@Schema(description ="创建时间")
private LocalDateTime createTime;
/**
* 更新时间
*/
@ExcelAttribute(name = "更新时间" )
@Schema(description ="更新时间")
private LocalDateTime updateTime;
/**
* 证明类型:0 在职 1 离职2劳动合同解除 3调档函4.代缴证明
*/
@ExcelAttribute(name = "证明类型:0 在职 1 离职2劳动合同解除 3调档函4.代缴证明" )
@Schema(description ="证明类型:0 在职 1 离职2劳动合同解除 3调档函4.代缴证明")
private String type;
/**
* 离职时间
*/
@ExcelAttribute(name = "离职时间" )
@Schema(description ="离职时间")
private LocalDateTime leaveTime;
/**
* 派减原因
*/
@ExcelAttribute(name = "派减原因" )
@Schema(description ="派减原因")
private String leaveReason;
/**
* 性别:0男 1女
*/
@ExcelAttribute(name = "性别:0男 1女" )
@Schema(description ="性别:0男 1女")
private String sex;
/**
* 入职时间(来我单位时间)
*/
@ExcelAttribute(name = "入职时间(来我单位时间)" )
@Schema(description ="入职时间(来我单位时间)")
private LocalDateTime entryTime;
/**
* 签订合同时间-第一次
*/
@ExcelAttribute(name = "签订合同时间-第一次" )
@Schema(description ="签订合同时间-第一次")
private LocalDateTime firstContractTime;
/**
* 开具人
*/
@ExcelAttribute(name = "开具人" )
@Schema(description ="开具人")
private String opener;
/**
* 开具时间
*/
@ExcelAttribute(name = "开具时间" )
@Schema(description ="开具时间")
private LocalDateTime openTime;
/**
* 介绍单位
*/
@ExcelAttribute(name = "介绍单位" )
@Schema(description ="介绍单位")
private String introductionUnit;
/**
* 参保时间
*/
@ExcelAttribute(name = "参保时间" )
@Schema(description ="参保时间")
private LocalDateTime socialTime;
}
package com.yifu.cloud.plus.v1.yifu.archives.vo;
import cn.hutool.core.date.DateTime;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmpWorkRecording;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
......
......@@ -2,6 +2,7 @@ package com.yifu.cloud.plus.v1.yifu.archives.controller;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TAttaInfo;
import com.yifu.cloud.plus.v1.yifu.archives.service.FileUploadService;
import com.yifu.cloud.plus.v1.yifu.archives.service.TAttaInfoService;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.OSSUtil;
......@@ -17,7 +18,6 @@ import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
import java.net.URL;
import java.time.LocalDateTime;
import java.util.List;
/**
......@@ -36,6 +36,9 @@ public class FileUploadController {
@Autowired
private TAttaInfoService tAttaInfoService;
@Autowired
private FileUploadService fileUploadService;
/**
* @Author fxj
* @Description
......@@ -52,60 +55,12 @@ public class FileUploadController {
/*@ApiImplicitParams({
@ApiImplicitParam(name = "file", value = "Form文件上传", required = true, dataType = "__file", paramType = "form"),
@ApiImplicitParam(name = "filePath", value = "文件上传路径", required = false, dataType = "String", paramType = "form"),
@ApiImplicitParam(name = "type", value = "关系类型(0客户附件1联系人附件2跟进记录附件3合同附件4合同归档附件5报价单6招标信息7业务评估)", required = true, dataType = "int", paramType = "form"),
@ApiImplicitParam(name = "type", value = "关系类型(0客户附件1联系人附件2跟进记录附件3合同附件4合同归档附件5报价单6招标信息7业务评估8电子档案)", required = true, dataType = "int", paramType = "form"),
@ApiImplicitParam(name = "domain", value = "实体id(传入就插入对应关系,用于编辑)", required = false, paramType = "form")
})*/
@PostMapping(value = "/ossUploadFile")
public R<FileVo> uploadImg(@RequestBody MultipartFile file, String filePath, Integer type, String domain) throws IOException {
if (null == file) {
return R.failed("文件删除异常,请重新上传!");
}
String fileName = file.getOriginalFilename();
if (Common.isEmpty(fileName)) {
return R.failed("文件名不能为空!");
}
if (fileName.length() > 100) {
return R.failed("文件名不能超过100个字符!");
}
//filePath不传默认存储空间的根目录
//jpg,jpeg,png,bmp
String key = "";
if (Common.isNotNull(filePath)) {
key = filePath + "/" + System.currentTimeMillis() + fileName;
} else {
key = System.currentTimeMillis() + fileName;
}
if (!Common.checkFile(key)) {
return R.failed("非法上传类型!");
}
boolean flag = ossUtil.uploadFileByStream(file.getInputStream(), key, null);
FileVo fileVo;
TAttaInfo attaInfo;
URL url;
if (flag) {
log.info("文件:" + fileName + "上传至存储空间" + ossUtil.getBucketName() + "成功!");
attaInfo = initUnitAttaForInsert(fileName, key, file.getSize());
attaInfo.setRelationType(String.valueOf(type));
try {
attaInfo.setDomainId(domain);
attaInfo = tAttaInfoService.add(attaInfo);
} catch (Exception e) {
log.error("OSS文件上传接口异常:" + e.getMessage());
ossUtil.deleteObject(null, key);
return R.failed("fail:" + e.getMessage());
}
//有实体id则插入关系,用于编辑
if (Common.isNotNull(domain)) {
url = ossUtil.getObjectUrl(null, attaInfo.getAttaSrc());
fileVo = new FileVo(attaInfo.getId(), attaInfo.getAttaName(), url.toString());
return R.ok(fileVo, "success");
}
url = ossUtil.getObjectUrl(null, attaInfo.getAttaSrc());
fileVo = new FileVo(attaInfo.getId(), attaInfo.getAttaName(), url.toString());
return R.ok(fileVo, "success");
} else {
return R.failed("fail:上传失败");
}
return fileUploadService.uploadImg(file,filePath,type,domain);
}
......@@ -137,32 +92,6 @@ public class FileUploadController {
return R.ok(null,"删除失败!");
}
/**
* 对象初始化
* @param fileName
* @param key
* @param fileSize
* @return
*/
private TAttaInfo initUnitAttaForInsert(String fileName, String key, long fileSize) {
TAttaInfo unitAtta = new TAttaInfo();
char slash = '/';
char point = '.';
if (fileName.lastIndexOf(slash) >= 0) {
unitAtta.setAttaName(fileName.substring(fileName.lastIndexOf(slash)));
} else {
unitAtta.setAttaName(fileName);
}
unitAtta.setAttaSize(fileSize);
unitAtta.setAttaSrc(key);
if (key.lastIndexOf(point) >= 0) {
unitAtta.setAttaType(key.substring(key.lastIndexOf(point)));
}
unitAtta.setCreateTime(LocalDateTime.now());
return unitAtta;
}
/**
* 获取附件下载地址
*
......
......@@ -22,6 +22,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TCertRecord;
import com.yifu.cloud.plus.v1.yifu.archives.service.TCertRecordService;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TCertRecordVo;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog;
import io.swagger.v3.oas.annotations.Operation;
......@@ -86,6 +87,16 @@ public class TCertRecordController {
return R.ok(tCertRecordService.getById(id));
}
/**
* 通过员工ID查询证明开具记录相关信息
* @param id 项目档案ID
* @return R
*/
@GetMapping("/getCertRecordInfo" )
public R<TCertRecordVo> getCertRecordInfo(@RequestParam(value = "id" ) String id) {
return tCertRecordService.getCertRecordInfo(id);
}
/**
* 新增证明开具记录表
* @param tCertRecord 证明开具记录表
......
......@@ -17,13 +17,9 @@
package com.yifu.cloud.plus.v1.yifu.archives.controller;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TElecEmployeeInfo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeInfo;
import com.yifu.cloud.plus.v1.yifu.archives.service.TElecEmployeeInfoService;
import com.yifu.cloud.plus.v1.yifu.archives.service.TEmployeeInfoService;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog;
import io.swagger.v3.oas.annotations.Operation;
......@@ -50,8 +46,6 @@ public class TElecEmployeeInfoController {
private final TElecEmployeeInfoService tElecEmployeeInfoService;
private final TEmployeeInfoService tEmployeeInfoService;
/**
* 分页查询
* @param page 分页对象
......@@ -126,12 +120,7 @@ public class TElecEmployeeInfoController {
@SysLog("通过身份证号查询人员档案" )
@PostMapping("/getEmpInfo" )
public R getEmpInfoByCard(@RequestParam String idCard) {
TEmployeeInfo tEmployeeInfo = tEmployeeInfoService.getOne((Wrappers.<TEmployeeInfo>query().lambda()
.eq(TEmployeeInfo::getEmpIdcard,idCard)));
if (Common.isNotNull(tEmployeeInfo)) {
return R.ok(tEmployeeInfo);
}
return R.failed("未找到身份证号对应的档案信息");
return R.ok(tElecEmployeeInfoService.getEmpInfoByCard(idCard));
}
/**
......@@ -142,7 +131,7 @@ public class TElecEmployeeInfoController {
@PostMapping("/importZip")
@Operation(summary = "批量导入电子档案", description = "批量导入电子档案")
@SysLog("批量导入电子档案" )
public R<Boolean> importZip(@RequestParam("file") MultipartFile file) {
public R<Boolean> importZip(@RequestBody MultipartFile file) {
return this.tElecEmployeeInfoService.importZip(file);
}
}
......@@ -17,32 +17,24 @@
package com.yifu.cloud.plus.v1.yifu.archives.controller;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.read.listener.ReadListener;
import com.alibaba.excel.read.metadata.holder.ReadRowHolder;
import com.alibaba.excel.util.ListUtils;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmpDisabilityInfo;
import com.yifu.cloud.plus.v1.yifu.archives.service.TEmpDisabilityInfoService;
import com.yifu.cloud.plus.v1.yifu.archives.vo.DisabilitySearchVo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmpDisabilityExcelVO;
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.ErrorMessage;
import com.yifu.cloud.plus.v1.yifu.common.core.util.ExcelUtil;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
import lombok.extern.log4j.Log4j2;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.util.ArrayList;
import java.util.List;
......@@ -120,7 +112,7 @@ public class TEmpDisabilityInfoController {
@PutMapping
@PreAuthorize("@pms.hasPermission('archives_tempdisabilityinfo_edit')" )
public R<Boolean> updateById(@RequestBody TEmpDisabilityInfo tEmpDisabilityInfo) {
return R.ok(tEmpDisabilityInfoService.updateById(tEmpDisabilityInfo));
return tEmpDisabilityInfoService.updateByIdDiy(tEmpDisabilityInfo);
}
/**
......@@ -158,66 +150,13 @@ public class TEmpDisabilityInfoController {
* @Author fxj
* @Date 2019-08-16
**/
@SneakyThrows
@Operation(description = "批量新增员工伤残信息 hasPermission('archives_tempdisabilityinfo_importListAdd')")
@SysLog("批量新增员工伤残信息")
@PostMapping("/importListAdd")
@PreAuthorize("@pms.hasPermission('archives_tempdisabilityinfo_importListAdd')")
public R<List<ErrorMessage>> importListAdd(@RequestBody MultipartFile file){
List<ErrorMessage> errorMessageList = new ArrayList<>();
ExcelUtil<EmpDisabilityExcelVO> util1 = new ExcelUtil<>(EmpDisabilityExcelVO.class);;
// 写法2:
// 匿名内部类 不用额外写一个DemoDataListener
// 这里 需要指定读用哪个class去读,然后读取第一个sheet 文件流会自动关闭
try {
EasyExcel.read(file.getInputStream(), EmpDisabilityExcelVO.class, new ReadListener<EmpDisabilityExcelVO>() {
/**
* 单次缓存的数据量
*/
public static final int BATCH_COUNT = CommonConstants.BATCH_COUNT;
/**
*临时存储
*/
private List<EmpDisabilityExcelVO> cachedDataList = ListUtils.newArrayListWithExpectedSize(BATCH_COUNT);
@Override
public void invoke(EmpDisabilityExcelVO data, AnalysisContext context) {
ReadRowHolder readRowHolder = context.readRowHolder();
Integer rowIndex = readRowHolder.getRowIndex();
data.setRowIndex(rowIndex+1);
ErrorMessage errorMessage = util1.checkEntity(data, data.getRowIndex());
if (Common.isNotNull(errorMessage)){
errorMessageList.add(errorMessage);
}else {
cachedDataList.add(data);
}
if (cachedDataList.size() >= BATCH_COUNT) {
saveData();
// 存储完成清理 list
cachedDataList = ListUtils.newArrayListWithExpectedSize(BATCH_COUNT);
}
}
@Override
public void doAfterAllAnalysed(AnalysisContext context) {
saveData();
}
/**
* 加上存储数据库
*/
private void saveData() {
log.info("{}条数据,开始存储数据库!", cachedDataList.size());
tEmpDisabilityInfoService.importTmpDisability(cachedDataList,errorMessageList);
log.info("存储数据库成功!");
}
}).sheet().doRead();
}catch (Exception e){
log.error(CommonConstants.IMPORT_DATA_ANALYSIS_ERROR,e);
return R.failed(CommonConstants.IMPORT_DATA_ANALYSIS_ERROR);
}
return R.ok(errorMessageList);
return tEmpDisabilityInfoService.importTmpDisabilityDiy(file.getInputStream());
}
}
......@@ -17,32 +17,25 @@
package com.yifu.cloud.plus.v1.yifu.archives.controller;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.read.listener.ReadListener;
import com.alibaba.excel.read.metadata.holder.ReadRowHolder;
import com.alibaba.excel.util.ListUtils;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmpEducation;
import com.yifu.cloud.plus.v1.yifu.archives.service.TEmpEducationService;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EducationSearchVo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmpEducationUpdateExcelVo;
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.ErrorMessage;
import com.yifu.cloud.plus.v1.yifu.common.core.util.ExcelUtil;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
import lombok.extern.log4j.Log4j2;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.util.ArrayList;
import java.util.List;
......@@ -159,66 +152,13 @@ public class TEmpEducationController {
* @Author fxj
* @Date 2019-08-16
**/
@SneakyThrows
@Operation(description = "批量新增员工学历信息 hasPermission('archives_education_importListAdd')")
@SysLog("批量新增员工学历信息")
@PostMapping("/importListAdd")
@PreAuthorize("@pms.hasPermission('archives_education_importListAdd')")
public R<List<ErrorMessage>> importListAdd(@RequestBody MultipartFile file) {
List<ErrorMessage> errorMessageList = new ArrayList<>();
ExcelUtil<EmpEducationUpdateExcelVo> util1 = new ExcelUtil<>(EmpEducationUpdateExcelVo.class);;
// 写法2:
// 匿名内部类 不用额外写一个DemoDataListener
// 这里 需要指定读用哪个class去读,然后读取第一个sheet 文件流会自动关闭
try {
EasyExcel.read(file.getInputStream(), EmpEducationUpdateExcelVo.class, new ReadListener<EmpEducationUpdateExcelVo>() {
/**
* 单次缓存的数据量
*/
public static final int BATCH_COUNT = CommonConstants.BATCH_COUNT;
/**
*临时存储
*/
private List<EmpEducationUpdateExcelVo> cachedDataList = ListUtils.newArrayListWithExpectedSize(BATCH_COUNT);
@Override
public void invoke(EmpEducationUpdateExcelVo data, AnalysisContext context) {
ReadRowHolder readRowHolder = context.readRowHolder();
Integer rowIndex = readRowHolder.getRowIndex();
data.setRowIndex(rowIndex+1);
ErrorMessage errorMessage = util1.checkEntity(data, data.getRowIndex());
if (Common.isNotNull(errorMessage)){
errorMessageList.add(errorMessage);
}else {
cachedDataList.add(data);
}
if (cachedDataList.size() >= BATCH_COUNT) {
saveData();
// 存储完成清理 list
cachedDataList = ListUtils.newArrayListWithExpectedSize(BATCH_COUNT);
}
}
@Override
public void doAfterAllAnalysed(AnalysisContext context) {
saveData();
}
/**
* 加上存储数据库
*/
private void saveData() {
log.info("{}条数据,开始存储数据库!", cachedDataList.size());
tEmpEducationService.importEmpEducationUpdate(cachedDataList,errorMessageList);
log.info("存储数据库成功!");
}
}).sheet().doRead();
}catch (Exception e){
log.error(CommonConstants.IMPORT_DATA_ANALYSIS_ERROR,e);
return R.failed(CommonConstants.IMPORT_DATA_ANALYSIS_ERROR);
}
return R.ok(errorMessageList);
return tEmpEducationService.importEmpEducationDiy(file.getInputStream());
}
/**
......@@ -229,64 +169,12 @@ public class TEmpEducationController {
* @Author fxj
* @Date 2019-08-16
**/
@SneakyThrows
@Operation(description = "批量更新员工学历信息 hasPermission('archives_education_importListUpdate')")
@SysLog("批量更新员工学历信息")
@PostMapping("/importListUpate")
@PreAuthorize("@pms.hasPermission('archives_education_importListUpdate')")
public R<List<ErrorMessage>> importListUpate(@RequestBody MultipartFile file) {
List<ErrorMessage> errorMessageList = new ArrayList<>();
ExcelUtil<EmpEducationUpdateExcelVo> util1 = new ExcelUtil<>(EmpEducationUpdateExcelVo.class);;
// 写法2:
// 匿名内部类 不用额外写一个DemoDataListener
// 这里 需要指定读用哪个class去读,然后读取第一个sheet 文件流会自动关闭
try {
EasyExcel.read(file.getInputStream(), EmpEducationUpdateExcelVo.class, new ReadListener<EmpEducationUpdateExcelVo>() {
/**
* 单次缓存的数据量
*/
public static final int BATCH_COUNT = CommonConstants.BATCH_COUNT;
/**
*临时存储
*/
private List<EmpEducationUpdateExcelVo> cachedDataList = ListUtils.newArrayListWithExpectedSize(BATCH_COUNT);
@Override
public void invoke(EmpEducationUpdateExcelVo data, AnalysisContext context) {
ReadRowHolder readRowHolder = context.readRowHolder();
Integer rowIndex = readRowHolder.getRowIndex();
data.setRowIndex(rowIndex+1);
ErrorMessage errorMessage = util1.checkEntity(data, data.getRowIndex());
if (Common.isNotNull(errorMessage)){
errorMessageList.add(errorMessage);
}else {
cachedDataList.add(data);
}
if (cachedDataList.size() >= BATCH_COUNT) {
saveData();
// 存储完成清理 list
cachedDataList = ListUtils.newArrayListWithExpectedSize(BATCH_COUNT);
}
}
@Override
public void doAfterAllAnalysed(AnalysisContext context) {
saveData();
}
/**
* 加上存储数据库
*/
private void saveData() {
log.info("{}条数据,开始存储数据库!", cachedDataList.size());
tEmpEducationService.importEmpEducationUpdate(cachedDataList,errorMessageList);
log.info("存储数据库成功!");
}
}).sheet().doRead();
}catch (Exception e){
log.error(CommonConstants.IMPORT_DATA_ANALYSIS_ERROR,e);
return R.failed(CommonConstants.IMPORT_DATA_ANALYSIS_ERROR);
}
return R.ok(errorMessageList);
return tEmpEducationService.importEmpEducationUpdateDiy(file.getInputStream());
}
}
......@@ -17,32 +17,25 @@
package com.yifu.cloud.plus.v1.yifu.archives.controller;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.read.listener.ReadListener;
import com.alibaba.excel.read.metadata.holder.ReadRowHolder;
import com.alibaba.excel.util.ListUtils;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmpFamily;
import com.yifu.cloud.plus.v1.yifu.archives.service.TEmpFamilyService;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmpFamilyExcelVO;
import com.yifu.cloud.plus.v1.yifu.archives.vo.FamilySearchVO;
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.ErrorMessage;
import com.yifu.cloud.plus.v1.yifu.common.core.util.ExcelUtil;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
import lombok.extern.log4j.Log4j2;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.util.ArrayList;
import java.util.List;
......@@ -183,63 +176,12 @@ public class TEmpFamilyController {
* @Author fxj
* @Date 2019-08-16
**/
@SneakyThrows
@Operation(description = "批量新增员工家庭信息 hasPermission('archives-family-batch-import')")
@SysLog("批量新增员工家庭信息")
@PostMapping("/importListAdd")
@PreAuthorize("@pms.hasPermission('archives-family-batch-import')")
public R<List<ErrorMessage>> importListAdd(@RequestBody MultipartFile file){
List<ErrorMessage> errorMessageList = new ArrayList<>();
ExcelUtil<EmpFamilyExcelVO> util1 = new ExcelUtil<>(EmpFamilyExcelVO.class);;
// 写法2:
// 匿名内部类 不用额外写一个DemoDataListener
// 这里 需要指定读用哪个class去读,然后读取第一个sheet 文件流会自动关闭
try {
EasyExcel.read(file.getInputStream(), EmpFamilyExcelVO.class, new ReadListener<EmpFamilyExcelVO>() {
/**
* 单次缓存的数据量
*/
public static final int BATCH_COUNT = CommonConstants.BATCH_COUNT;
/**
*临时存储
*/
private List<EmpFamilyExcelVO> cachedDataList = ListUtils.newArrayListWithExpectedSize(BATCH_COUNT);
@Override
public void invoke(EmpFamilyExcelVO data, AnalysisContext context) {
ReadRowHolder readRowHolder = context.readRowHolder();
Integer rowIndex = readRowHolder.getRowIndex();
data.setRowIndex(rowIndex+1);
ErrorMessage errorMessage = util1.checkEntity(data, data.getRowIndex());
if (Common.isNotNull(errorMessage)){
errorMessageList.add(errorMessage);
}else {
cachedDataList.add(data);
}
if (cachedDataList.size() >= BATCH_COUNT) {
saveData();
// 存储完成清理 list
cachedDataList = ListUtils.newArrayListWithExpectedSize(BATCH_COUNT);
}
}
@Override
public void doAfterAllAnalysed(AnalysisContext context) {
saveData();
}
/**
* 加上存储数据库
*/
private void saveData() {
log.info("{}条数据,开始存储数据库!", cachedDataList.size());
tEmpFamilyService.importEmpFamily(cachedDataList,errorMessageList);
log.info("存储数据库成功!");
}
}).sheet().doRead();
}catch (Exception e){
log.error(CommonConstants.IMPORT_DATA_ANALYSIS_ERROR,e);
return R.failed(CommonConstants.IMPORT_DATA_ANALYSIS_ERROR);
}
return R.ok(errorMessageList);
return tEmpFamilyService.importEmpFamilyDiy(file.getInputStream());
}
}
......@@ -17,32 +17,24 @@
package com.yifu.cloud.plus.v1.yifu.archives.controller;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.read.listener.ReadListener;
import com.alibaba.excel.read.metadata.holder.ReadRowHolder;
import com.alibaba.excel.util.ListUtils;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmpProfessionalQualification;
import com.yifu.cloud.plus.v1.yifu.archives.service.TEmpProfessionalQualificationService;
import com.yifu.cloud.plus.v1.yifu.archives.vo.CertifySearchVo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmpCertificateExcelVO;
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.ErrorMessage;
import com.yifu.cloud.plus.v1.yifu.common.core.util.ExcelUtil;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
import lombok.extern.log4j.Log4j2;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.util.ArrayList;
import java.util.List;
......@@ -155,63 +147,12 @@ public class TEmpProfessionalQualificationController {
* @Author fxj
* @Date 2019-08-16
**/
@SneakyThrows
@Operation(description = "批量新增员工证书信息 hasPermission('archives-professionalqualification-batch-import')")
@SysLog("批量新增员工证书信息")
@PostMapping("/importListAdd")
@PreAuthorize("@pms.hasPermission('archives-professionalqualification-batch-import')")
public R<List<ErrorMessage>> importListAdd(@RequestBody MultipartFile file) {
List<ErrorMessage> errorMessageList = new ArrayList<>();
ExcelUtil<EmpCertificateExcelVO> util1 = new ExcelUtil<>(EmpCertificateExcelVO.class);;
// 写法2:
// 匿名内部类 不用额外写一个DemoDataListener
// 这里 需要指定读用哪个class去读,然后读取第一个sheet 文件流会自动关闭
try {
EasyExcel.read(file.getInputStream(), EmpCertificateExcelVO.class, new ReadListener<EmpCertificateExcelVO>() {
/**
* 单次缓存的数据量
*/
public static final int BATCH_COUNT = CommonConstants.BATCH_COUNT;
/**
*临时存储
*/
private List<EmpCertificateExcelVO> cachedDataList = ListUtils.newArrayListWithExpectedSize(BATCH_COUNT);
@Override
public void invoke(EmpCertificateExcelVO data, AnalysisContext context) {
ReadRowHolder readRowHolder = context.readRowHolder();
Integer rowIndex = readRowHolder.getRowIndex();
data.setRowIndex(rowIndex+1);
ErrorMessage errorMessage = util1.checkEntity(data, data.getRowIndex());
if (Common.isNotNull(errorMessage)){
errorMessageList.add(errorMessage);
}else {
cachedDataList.add(data);
}
if (cachedDataList.size() >= BATCH_COUNT) {
saveData();
// 存储完成清理 list
cachedDataList = ListUtils.newArrayListWithExpectedSize(BATCH_COUNT);
}
}
@Override
public void doAfterAllAnalysed(AnalysisContext context) {
saveData();
}
/**
* 加上存储数据库
*/
private void saveData() {
log.info("{}条数据,开始存储数据库!", cachedDataList.size());
qualificationService.importEmpCertificate(cachedDataList,errorMessageList);
log.info("存储数据库成功!");
}
}).sheet().doRead();
}catch (Exception e){
log.error(CommonConstants.IMPORT_DATA_ANALYSIS_ERROR,e);
return R.failed(CommonConstants.IMPORT_DATA_ANALYSIS_ERROR);
}
return R.ok(errorMessageList);
return qualificationService.importEmpCertificateDiy(file.getInputStream());
}
}
......@@ -17,32 +17,25 @@
package com.yifu.cloud.plus.v1.yifu.archives.controller;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.read.listener.ReadListener;
import com.alibaba.excel.read.metadata.holder.ReadRowHolder;
import com.alibaba.excel.util.ListUtils;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmpWorkRecording;
import com.yifu.cloud.plus.v1.yifu.archives.service.TEmpWorkRecordingService;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmpWorkRecordExcelVO;
import com.yifu.cloud.plus.v1.yifu.archives.vo.WorkRecordSearchVO;
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.ErrorMessage;
import com.yifu.cloud.plus.v1.yifu.common.core.util.ExcelUtil;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
import lombok.extern.log4j.Log4j2;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.util.ArrayList;
import java.util.List;
......@@ -156,65 +149,12 @@ public class TEmpWorkRecordingController {
* @Author fxj
* @Date 2019-08-16
**/
@SneakyThrows
@Operation(description = "批量新增员工工作信息 hasPermission('archives_tempworkrecording_importListAdd')")
@SysLog("批量新增员工工作信息")
@PostMapping("/importListAdd")
@PreAuthorize("@pms.hasPermission('archives_tempworkrecording_importListAdd')")
public R<List<ErrorMessage>> importListAdd(@RequestBody MultipartFile file) {
List<com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage> errorMessageList = new ArrayList<>();
ExcelUtil<EmpWorkRecordExcelVO> util1 = new ExcelUtil<>(EmpWorkRecordExcelVO.class);;
// 写法2:
// 匿名内部类 不用额外写一个DemoDataListener
// 这里 需要指定读用哪个class去读,然后读取第一个sheet 文件流会自动关闭
try {
EasyExcel.read(file.getInputStream(), EmpWorkRecordExcelVO.class, new ReadListener<EmpWorkRecordExcelVO>() {
/**
* 单次缓存的数据量
*/
public static final int BATCH_COUNT = CommonConstants.BATCH_COUNT;
/**
*临时存储
*/
private List<EmpWorkRecordExcelVO> cachedDataList = ListUtils.newArrayListWithExpectedSize(BATCH_COUNT);
@Override
public void invoke(EmpWorkRecordExcelVO data, AnalysisContext context) {
ReadRowHolder readRowHolder = context.readRowHolder();
Integer rowIndex = readRowHolder.getRowIndex();
data.setRowIndex(rowIndex+1);
com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage errorMessage = util1.checkEntity(data, data.getRowIndex());
if (Common.isNotNull(errorMessage)){
errorMessageList.add(errorMessage);
}else {
cachedDataList.add(data);
}
if (cachedDataList.size() >= BATCH_COUNT) {
saveData();
// 存储完成清理 list
cachedDataList = ListUtils.newArrayListWithExpectedSize(BATCH_COUNT);
}
}
@Override
public void doAfterAllAnalysed(AnalysisContext context) {
saveData();
}
/**
* 加上存储数据库
*/
private void saveData() {
log.info("{}条数据,开始存储数据库!", cachedDataList.size());
tEmpWorkRecordingService.importEmpWorkRecord(cachedDataList,errorMessageList);
log.info("存储数据库成功!");
}
}).sheet().doRead();
}catch (Exception e){
log.error(CommonConstants.IMPORT_DATA_ANALYSIS_ERROR,e);
return R.failed(CommonConstants.IMPORT_DATA_ANALYSIS_ERROR);
}
return R.ok(errorMessageList);
return tEmpWorkRecordingService.importEmpWorkRecordDiy(file.getInputStream());
}
}
......@@ -230,8 +230,8 @@ public class TEmployeeProjectController {
* @Date 2022-06-21
**/
@PostMapping("/export")
public void export(HttpServletResponse response, EmployeeProjectExportVO projectDTO, @RequestParam(name = "idstr", required = false)String idstr,
@RequestBody List<String> exportFields) {
public void export(HttpServletResponse response, @RequestParam(name = "idstr", required = false)String idstr,
@RequestBody List<String> exportFields, EmployeeProjectExportVO projectDTO) {
tEmployeeProjectService.listExportProject(response,projectDTO,idstr,exportFields);
}
......
package com.yifu.cloud.plus.v1.yifu.archives.service;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.FileVo;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
/**
* 文件上传
*
* @author pwang
* @date 2022-07-27 16:16:07
*/
public interface FileUploadService {
R<FileVo> uploadImg(MultipartFile file, String filePath, Integer type, String domain) throws IOException;
}
......@@ -19,6 +19,8 @@ package com.yifu.cloud.plus.v1.yifu.archives.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TCertRecord;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TCertRecordVo;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
/**
* 证明开具记录表
......@@ -28,4 +30,5 @@ import com.yifu.cloud.plus.v1.yifu.archives.entity.TCertRecord;
*/
public interface TCertRecordService extends IService<TCertRecord> {
R<TCertRecordVo> getCertRecordInfo(String id);
}
......@@ -42,4 +42,14 @@ public interface TElecEmployeeInfoService extends IService<TElecEmployeeInfo> {
* @date: 2022/6/24
*/
R<Boolean> importZip(MultipartFile file);
/**
* @description: 通过身份证号查询人员档案
* @param idCard 身份证号
* @return: R
* @author: huyc
* @date: 2022/6/27
*/
R getEmpInfoByCard(String idCard);
}
......@@ -26,6 +26,7 @@ import com.yifu.cloud.plus.v1.yifu.archives.vo.EmpDisabilityExcelVO;
import com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import java.io.InputStream;
import java.util.List;
/**
......@@ -43,4 +44,8 @@ public interface TEmpDisabilityInfoService extends IService<TEmpDisabilityInfo>
IPage<TEmpDisabilityInfo> pageDiy(Page page, DisabilitySearchVo searchVo);
List<TEmpDisabilityInfo> getTEmpDisabilityInfoNoPage(DisabilitySearchVo searchVo);
R<Boolean> updateByIdDiy(TEmpDisabilityInfo tEmpDisabilityInfo);
R<List<ErrorMessage>> importTmpDisabilityDiy(InputStream inputStream);
}
......@@ -27,6 +27,7 @@ import com.yifu.cloud.plus.v1.yifu.archives.vo.EmpEducationUpdateExcelVo;
import com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import java.io.InputStream;
import java.util.List;
/**
......@@ -50,4 +51,9 @@ public interface TEmpEducationService extends IService<TEmpEducation> {
IPage<TEmpEducation> pageDiy(Page page, EducationSearchVo tEmpEducation);
List<TEmpEducation> getTEmpEducationNoPage(EducationSearchVo searchVo);
R<List<ErrorMessage>> importEmpEducationDiy(InputStream inputStream);
R<List<ErrorMessage>> importEmpEducationUpdateDiy(InputStream inputStream);
}
......@@ -26,6 +26,7 @@ import com.yifu.cloud.plus.v1.yifu.archives.vo.FamilySearchVO;
import com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import java.io.InputStream;
import java.util.List;
/**
......@@ -45,4 +46,6 @@ public interface TEmpFamilyService extends IService<TEmpFamily> {
IPage<TEmpFamily> pageDiy(Page page, FamilySearchVO tEmpFamily);
List<TEmpFamily> getTEmpFamilyNoPage(FamilySearchVO family);
R<List<ErrorMessage>> importEmpFamilyDiy(InputStream fileInputStream);
}
......@@ -26,6 +26,7 @@ import com.yifu.cloud.plus.v1.yifu.archives.vo.EmpCertificateExcelVO;
import com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import java.io.InputStream;
import java.util.List;
/**
......@@ -43,4 +44,6 @@ public interface TEmpProfessionalQualificationService extends IService<TEmpProfe
List<TEmpProfessionalQualification> getDataNoPage(CertifySearchVo searchVo);
IPage<TEmpProfessionalQualification> pageDiy(Page page, CertifySearchVo searchVo);
R<List<ErrorMessage>> importEmpCertificateDiy(InputStream inputStream);
}
......@@ -26,6 +26,7 @@ import com.yifu.cloud.plus.v1.yifu.archives.vo.WorkRecordSearchVO;
import com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import java.io.InputStream;
import java.util.List;
/**
......@@ -45,4 +46,6 @@ public interface TEmpWorkRecordingService extends IService<TEmpWorkRecording> {
IPage<TEmpWorkRecording> pageDiy(Page page, WorkRecordSearchVO tEmpWorkRecording);
List<TEmpWorkRecording> getTEmpWorkRecordingNoPage(WorkRecordSearchVO searchVo);
R<List<ErrorMessage>> importEmpWorkRecordDiy(InputStream inputStream);
}
package com.yifu.cloud.plus.v1.yifu.archives.service.impl;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TAttaInfo;
import com.yifu.cloud.plus.v1.yifu.archives.service.FileUploadService;
import com.yifu.cloud.plus.v1.yifu.archives.service.TAttaInfoService;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.OSSUtil;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.FileVo;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
import java.net.URL;
import java.time.LocalDateTime;
@Service
@RequiredArgsConstructor
@Slf4j
public class FileUploadServiceImpl implements FileUploadService {
private final OSSUtil ossUtil;
private final TAttaInfoService tAttaInfoService;
@Override
public R<FileVo> uploadImg(MultipartFile file, String filePath, Integer type, String domain) throws IOException {
if (null == file) {
return R.failed("文件删除异常,请重新上传!");
}
String fileName = file.getOriginalFilename();
if (Common.isEmpty(fileName)) {
return R.failed("文件名不能为空!");
}
if (fileName.length() > 100) {
return R.failed("文件名不能超过100个字符!");
}
//filePath不传默认存储空间的根目录
//jpg,jpeg,png,bmp
String key = "";
if (Common.isNotNull(filePath)) {
key = filePath + "/" + System.currentTimeMillis() + fileName;
} else {
key = System.currentTimeMillis() + fileName;
}
if (!Common.checkFile(key)) {
return R.failed("非法上传类型!");
}
boolean flag = ossUtil.uploadFileByStream(file.getInputStream(), key, null);
FileVo fileVo;
TAttaInfo attaInfo;
URL url;
if (flag) {
log.info("文件:" + fileName + "上传至存储空间" + ossUtil.getBucketName() + "成功!");
attaInfo = initUnitAttaForInsert(fileName, key, file.getSize());
attaInfo.setRelationType(String.valueOf(type));
try {
attaInfo.setDomainId(domain);
attaInfo = tAttaInfoService.add(attaInfo);
} catch (Exception e) {
log.error("OSS文件上传接口异常:" + e.getMessage());
ossUtil.deleteObject(null, key);
return R.failed("fail:" + e.getMessage());
}
//有实体id则插入关系,用于编辑
if (Common.isNotNull(domain)) {
url = ossUtil.getObjectUrl(null, attaInfo.getAttaSrc());
fileVo = new FileVo(attaInfo.getId(), attaInfo.getAttaName(), url.toString());
return R.ok(fileVo, "success");
}
url = ossUtil.getObjectUrl(null, attaInfo.getAttaSrc());
fileVo = new FileVo(attaInfo.getId(), attaInfo.getAttaName(), url.toString());
return R.ok(fileVo, "success");
} else {
return R.failed("fail:上传失败");
}
}
/**
* 对象初始化
* @param fileName
* @param key
* @param fileSize
* @return
*/
private TAttaInfo initUnitAttaForInsert(String fileName, String key, long fileSize) {
TAttaInfo unitAtta = new TAttaInfo();
char slash = '/';
char point = '.';
if (fileName.lastIndexOf(slash) >= 0) {
unitAtta.setAttaName(fileName.substring(fileName.lastIndexOf(slash)));
} else {
unitAtta.setAttaName(fileName);
}
unitAtta.setAttaSize(fileSize);
unitAtta.setAttaSrc(key);
if (key.lastIndexOf(point) >= 0) {
unitAtta.setAttaType(key.substring(key.lastIndexOf(point)));
}
unitAtta.setCreateTime(LocalDateTime.now());
return unitAtta;
}
}
......@@ -18,8 +18,17 @@ package com.yifu.cloud.plus.v1.yifu.archives.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TCertRecord;
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.mapper.TCertRecordMapper;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmployeeInfoMapper;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmployeeProjectMapper;
import com.yifu.cloud.plus.v1.yifu.archives.service.TCertRecordService;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TCertRecordVo;
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 lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
/**
......@@ -28,7 +37,46 @@ import org.springframework.stereotype.Service;
* @author fxj
* @date 2022-06-25 11:05:11
*/
@RequiredArgsConstructor
@Service
public class TCertRecordServiceImpl extends ServiceImpl<TCertRecordMapper, TCertRecord> implements TCertRecordService {
private final TEmployeeProjectMapper projectMapper;
private final TEmployeeInfoMapper employeeInfoMapper;
@Override
public R<TCertRecordVo> getCertRecordInfo(String id) {
TEmployeeProject project = projectMapper.selectById(id);
if (!Common.isNotNull(project)){
return R.failed(CommonConstants.PARAM_IS_NOT_ERROR);
}
TEmployeeInfo employeeInfo = employeeInfoMapper.selectById(project.getEmpId());
if (!Common.isNotNull(employeeInfo)){
return R.failed(CommonConstants.PARAM_IS_NOT_ERROR);
}
TCertRecordVo vo = new TCertRecordVo();
vo.setEmpIdcard(project.getEmpIdcard());
vo.setEmpId(project.getEmpId());
vo.setEmpName(project.getEmpName());
vo.setPost(project.getPost());
vo.setProjectName(project.getDeptName());
vo.setProjectCode(project.getDeptNo());
// TODO 最新合同时间
vo.setContractStart(null);
vo.setContractEnd(null);
// TODO 派减离职时间和原因
vo.setLeaveTime(employeeInfo.getLeaveTime());
vo.setLeaveReason(employeeInfo.getLeaveReason());
// TODO 第一次合同开始截止时间
vo.setEntryTime(employeeInfo.getCreateTime());
vo.setFirstContractTime(null);
vo.setSex(employeeInfo.getEmpSex());
vo.setIntroductionUnit(CommonConstants.EMPTY_STRING);
vo.setSeal("安徽皖信人力资源管理有限公司");
// TODO 参保时间
vo.setSocialTime(null);
return R.ok(vo);
}
}
......@@ -20,7 +20,10 @@ import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.pig4cloud.plugin.excel.vo.ErrorMessage;
import com.yifu.cloud.plus.v1.yifu.archives.entity.*;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TCustomerInfo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmpChangeInfo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeProject;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TSettleDomain;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmpChangeInfoMapper;
import com.yifu.cloud.plus.v1.yifu.archives.service.TCustomerInfoService;
import com.yifu.cloud.plus.v1.yifu.archives.service.TEmpChangeInfoService;
......
......@@ -18,6 +18,11 @@ package com.yifu.cloud.plus.v1.yifu.archives.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.ArrayUtil;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.read.listener.ReadListener;
import com.alibaba.excel.read.metadata.holder.ReadRowHolder;
import com.alibaba.excel.util.ListUtils;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
......@@ -33,14 +38,14 @@ import com.yifu.cloud.plus.v1.yifu.archives.vo.DisabilitySearchVo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmpDisabilityExcelVO;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
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.ErrorMessage;
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.*;
import com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity;
import lombok.RequiredArgsConstructor;
import lombok.extern.log4j.Log4j2;
import org.springframework.stereotype.Service;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
/**
......@@ -49,6 +54,7 @@ import java.util.List;
* @author fxj
* @date 2022-06-18 09:39:46
*/
@Log4j2
@RequiredArgsConstructor
@Service
public class TEmpDisabilityInfoServiceImpl extends ServiceImpl<TEmpDisabilityInfoMapper, TEmpDisabilityInfo> implements TEmpDisabilityInfoService {
......@@ -115,6 +121,14 @@ public class TEmpDisabilityInfoServiceImpl extends ServiceImpl<TEmpDisabilityInf
}
@Override
public R<Boolean> saveDiy(TEmpDisabilityInfo tEmpDisabilityInfo) {
TEmpDisabilityInfo exist = baseMapper.selectOne(Wrappers.<TEmpDisabilityInfo>query().lambda()
.eq(TEmpDisabilityInfo::getEmpIdcard,tEmpDisabilityInfo.getEmpIdcard())
.eq(TEmpDisabilityInfo::getDisabilityName,tEmpDisabilityInfo.getDisabilityName())
.eq(TEmpDisabilityInfo::getDeleteFlag,CommonConstants.ZERO_STRING)
.last(CommonConstants.LAST_ONE_SQL));
if (Common.isNotNull(exist)){
return R.failed(MsgUtils.getMessage(ErrorCodes.ARCHIVES_EMP_DISABILITY_NAME_EXISTING));
}
tEmpDisabilityInfo.setDeleteFlag(CommonConstants.ZERO_STRING);
int res = baseMapper.insert(tEmpDisabilityInfo);
if (res > CommonConstants.ZERO_INT){
......@@ -147,6 +161,80 @@ public class TEmpDisabilityInfoServiceImpl extends ServiceImpl<TEmpDisabilityInf
return baseMapper.selectList(wrapper);
}
@Override
public R<Boolean> updateByIdDiy(TEmpDisabilityInfo tEmpDisabilityInfo) {
TEmpDisabilityInfo exist = baseMapper.selectOne(Wrappers.<TEmpDisabilityInfo>query().lambda()
.eq(TEmpDisabilityInfo::getEmpIdcard,tEmpDisabilityInfo.getEmpIdcard())
.ne(TEmpDisabilityInfo::getId,tEmpDisabilityInfo.getId())
.eq(TEmpDisabilityInfo::getDisabilityName,tEmpDisabilityInfo.getDisabilityName())
.eq(TEmpDisabilityInfo::getDeleteFlag,CommonConstants.ZERO_STRING)
.last(CommonConstants.LAST_ONE_SQL));
if (Common.isNotNull(exist)){
R.failed(MsgUtils.getMessage(ErrorCodes.ARCHIVES_EMP_DISABILITY_NAME_EXISTING));
}
baseMapper.updateById(tEmpDisabilityInfo);
return R.ok();
}
@Override
public R<List<ErrorMessage>> importTmpDisabilityDiy(InputStream inputStream) {
List<ErrorMessage> errorMessageList = new ArrayList<>();
ExcelUtil<EmpDisabilityExcelVO> util1 = new ExcelUtil<>(EmpDisabilityExcelVO.class);;
// 写法2:
// 匿名内部类 不用额外写一个DemoDataListener
// 这里 需要指定读用哪个class去读,然后读取第一个sheet 文件流会自动关闭
try {
EasyExcel.read(inputStream, EmpDisabilityExcelVO.class, new ReadListener<EmpDisabilityExcelVO>() {
/**
* 单次缓存的数据量
*/
public static final int BATCH_COUNT = CommonConstants.BATCH_COUNT;
/**
*临时存储
*/
private List<EmpDisabilityExcelVO> cachedDataList = ListUtils.newArrayListWithExpectedSize(BATCH_COUNT);
@Override
public void invoke(EmpDisabilityExcelVO data, AnalysisContext context) {
ReadRowHolder readRowHolder = context.readRowHolder();
Integer rowIndex = readRowHolder.getRowIndex();
data.setRowIndex(rowIndex+1);
ErrorMessage errorMessage = util1.checkEntity(data, data.getRowIndex());
if (Common.isNotNull(errorMessage)){
errorMessageList.add(errorMessage);
}else {
cachedDataList.add(data);
}
if (cachedDataList.size() >= BATCH_COUNT) {
saveData();
// 存储完成清理 list
cachedDataList = ListUtils.newArrayListWithExpectedSize(BATCH_COUNT);
}
}
@Override
public void doAfterAllAnalysed(AnalysisContext context) {
saveData();
}
/**
* 加上存储数据库
*/
private void saveData() {
log.info("{}条数据,开始存储数据库!", cachedDataList.size());
importTmpDisability(cachedDataList,errorMessageList);
log.info("存储数据库成功!");
}
}).sheet().doRead();
}catch (Exception e){
log.error(CommonConstants.IMPORT_DATA_ANALYSIS_ERROR,e);
return R.failed(CommonConstants.IMPORT_DATA_ANALYSIS_ERROR);
}
return R.ok(errorMessageList);
}
private LambdaQueryWrapper buildQueryWrapper(DisabilitySearchVo entity){
LambdaQueryWrapper<TEmpDisabilityInfo> wrapper = Wrappers.lambdaQuery();
wrapper.eq(TEmpDisabilityInfo::getDeleteFlag,CommonConstants.ZERO_STRING);
......
......@@ -18,6 +18,11 @@ package com.yifu.cloud.plus.v1.yifu.archives.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.ArrayUtil;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.read.listener.ReadListener;
import com.alibaba.excel.read.metadata.holder.ReadRowHolder;
import com.alibaba.excel.util.ListUtils;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
......@@ -35,15 +40,15 @@ import com.yifu.cloud.plus.v1.yifu.archives.vo.EmpEducationUpdateExcelVo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmpEducationUpdateVO;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
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.ErrorMessage;
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.*;
import com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity;
import lombok.RequiredArgsConstructor;
import lombok.extern.log4j.Log4j2;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
/**
......@@ -52,6 +57,7 @@ import java.util.List;
* @author fxj
* @date 2022-06-18 09:39:46
*/
@Log4j2
@RequiredArgsConstructor
@Service
public class TEmpEducationServiceImpl extends ServiceImpl<TEmpEducationMapper, TEmpEducation> implements TEmpEducationService {
......@@ -157,30 +163,46 @@ public class TEmpEducationServiceImpl extends ServiceImpl<TEmpEducationMapper, T
@Override
public void importEmpEducationUpdate(List<EmpEducationUpdateExcelVo> excelVOList, List<ErrorMessage> errorMessageList) {
List<TEmpEducation> list = this.list();
TEmployeeInfo emp;
TEmpEducation temp;
TEmpEducation exist;
ErrorMessage errorMsg;
// 执行数据插入操作 组装
for (int i = 0; i < excelVOList.size(); i++) {
// 已有验证报错直接下一个
EmpEducationUpdateExcelVo excel = excelVOList.get(i);
temp = baseMapper.selectOne(Wrappers.<TEmpEducation>query().lambda()
.eq(TEmpEducation::getId,excel.getId())
.last(CommonConstants.LAST_ONE_SQL));
if (Common.isEmpty(temp)){
errorMessageList.add(new ErrorMessage(excel.getRowIndex(),CommonConstants.PARAM_IS_NOT_ERROR));
continue;
}
exist = baseMapper.selectOne(Wrappers.<TEmpEducation>query().lambda()
.ne(TEmpEducation::getId,excel.getId())
.eq(TEmpEducation::getEmpIdcard,temp.getEmpIdcard())
.eq(TEmpEducation::getEducationName,excel.getEducationName())
.eq(TEmpEducation::getDeleteFlag,CommonConstants.ZERO_STRING)
.last(CommonConstants.LAST_ONE_SQL));
if (Common.isNotNull(exist)){
errorMessageList.add(new ErrorMessage(excel.getRowIndex(),MsgUtils.getMessage(ErrorCodes.ARCHIVES_EMP_EDUCATION_EXISTING)));
continue;
}
// 数据合法情况
updateExcel(excel);
updateExcel(excel,temp);
errorMessageList.add(new ErrorMessage(excel.getRowIndex(),CommonConstants.UPDATE_SUCCESS));
}
}
private void updateExcel(EmpEducationUpdateExcelVo excel) {
private void updateExcel(EmpEducationUpdateExcelVo excel, TEmpEducation temp) {
TEmpEducation update = new TEmpEducation();
BeanUtil.copyProperties(excel, update);
if (Common.isNotNull(temp)){
update.setEmpId(temp.getEmpId());
update.setEmpIdcard(temp.getEmpIdcard());
update.setEmpName(temp.getEmpName());
update.setEmpCode(temp.getEmpCode());
}
// 更新档案学历信息
updateEducationOfEmp(update);
this.updateById(update);
......@@ -213,6 +235,8 @@ public class TEmpEducationServiceImpl extends ServiceImpl<TEmpEducationMapper, T
updateVo.setIsCollege(CommonConstants.ONE_INT);
}
employeeInfoMapper.updateEducationOfEmp(updateVo);
// 所有学历更新为非最高学历
baseMapper.updateHighIdentification(education.getEmpIdcard());
}
}
......@@ -277,6 +301,123 @@ public class TEmpEducationServiceImpl extends ServiceImpl<TEmpEducationMapper, T
}
return baseMapper.selectList(wrapper);
}
@Override
public R<List<ErrorMessage>> importEmpEducationDiy(InputStream inputStream) {
List<ErrorMessage> errorMessageList = new ArrayList<>();
ExcelUtil<EmpEducationExcelVO> util1 = new ExcelUtil<>(EmpEducationExcelVO.class);;
// 写法2:
// 匿名内部类 不用额外写一个DemoDataListener
// 这里 需要指定读用哪个class去读,然后读取第一个sheet 文件流会自动关闭
try {
EasyExcel.read(inputStream, EmpEducationExcelVO.class, new ReadListener<EmpEducationExcelVO>() {
/**
* 单次缓存的数据量
*/
public static final int BATCH_COUNT = CommonConstants.BATCH_COUNT;
/**
*临时存储
*/
private List<EmpEducationExcelVO> cachedDataList = ListUtils.newArrayListWithExpectedSize(BATCH_COUNT);
@Override
public void invoke(EmpEducationExcelVO data, AnalysisContext context) {
ReadRowHolder readRowHolder = context.readRowHolder();
Integer rowIndex = readRowHolder.getRowIndex();
data.setRowIndex(rowIndex+1);
ErrorMessage errorMessage = util1.checkEntity(data, data.getRowIndex());
if (Common.isNotNull(errorMessage)){
errorMessageList.add(errorMessage);
}else {
cachedDataList.add(data);
}
if (cachedDataList.size() >= BATCH_COUNT) {
saveData();
// 存储完成清理 list
cachedDataList = ListUtils.newArrayListWithExpectedSize(BATCH_COUNT);
}
}
@Override
public void doAfterAllAnalysed(AnalysisContext context) {
saveData();
}
/**
* 加上存储数据库
*/
private void saveData() {
log.info("{}条数据,开始存储数据库!", cachedDataList.size());
importEmpEducation(cachedDataList,errorMessageList);
log.info("存储数据库成功!");
}
}).sheet().doRead();
}catch (Exception e){
log.error(CommonConstants.IMPORT_DATA_ANALYSIS_ERROR,e);
return R.failed(CommonConstants.IMPORT_DATA_ANALYSIS_ERROR);
}
return R.ok(errorMessageList);
}
@Override
public R<List<ErrorMessage>> importEmpEducationUpdateDiy(InputStream inputStream) {
List<ErrorMessage> errorMessageList = new ArrayList<>();
ExcelUtil<EmpEducationUpdateExcelVo> util1 = new ExcelUtil<>(EmpEducationUpdateExcelVo.class);;
// 写法2:
// 匿名内部类 不用额外写一个DemoDataListener
// 这里 需要指定读用哪个class去读,然后读取第一个sheet 文件流会自动关闭
try {
EasyExcel.read(inputStream, EmpEducationUpdateExcelVo.class, new ReadListener<EmpEducationUpdateExcelVo>() {
/**
* 单次缓存的数据量
*/
public static final int BATCH_COUNT = CommonConstants.BATCH_COUNT;
/**
*临时存储
*/
private List<EmpEducationUpdateExcelVo> cachedDataList = ListUtils.newArrayListWithExpectedSize(BATCH_COUNT);
@Override
public void invoke(EmpEducationUpdateExcelVo data, AnalysisContext context) {
ReadRowHolder readRowHolder = context.readRowHolder();
Integer rowIndex = readRowHolder.getRowIndex();
data.setRowIndex(rowIndex+1);
ErrorMessage errorMessage = util1.checkEntity(data, data.getRowIndex());
if (Common.isNotNull(errorMessage)){
errorMessageList.add(errorMessage);
}else {
cachedDataList.add(data);
}
if (cachedDataList.size() >= BATCH_COUNT) {
saveData();
// 存储完成清理 list
cachedDataList = ListUtils.newArrayListWithExpectedSize(BATCH_COUNT);
}
}
@Override
public void doAfterAllAnalysed(AnalysisContext context) {
saveData();
}
/**
* 加上存储数据库
*/
private void saveData() {
log.info("{}条数据,开始存储数据库!", cachedDataList.size());
importEmpEducationUpdate(cachedDataList,errorMessageList);
log.info("存储数据库成功!");
}
}).sheet().doRead();
}catch (Exception e){
log.error(CommonConstants.IMPORT_DATA_ANALYSIS_ERROR,e);
return R.failed(CommonConstants.IMPORT_DATA_ANALYSIS_ERROR);
}
return R.ok(errorMessageList);
}
private LambdaQueryWrapper buildQueryWrapper(EducationSearchVo entity){
LambdaQueryWrapper<TEmpEducation> wrapper = Wrappers.lambdaQuery();
wrapper.eq(TEmpEducation::getDeleteFlag,CommonConstants.ZERO_STRING);
......
......@@ -19,6 +19,11 @@ package com.yifu.cloud.plus.v1.yifu.archives.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.read.listener.ReadListener;
import com.alibaba.excel.read.metadata.holder.ReadRowHolder;
import com.alibaba.excel.util.ListUtils;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
......@@ -35,15 +40,15 @@ import com.yifu.cloud.plus.v1.yifu.archives.vo.EmpFamilyExcelVO;
import com.yifu.cloud.plus.v1.yifu.archives.vo.FamilySearchVO;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
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.ErrorMessage;
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.*;
import com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity;
import lombok.RequiredArgsConstructor;
import lombok.extern.log4j.Log4j2;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
/**
......@@ -52,6 +57,7 @@ import java.util.List;
* @author fxj
* @date 2022-06-18 09:39:46
*/
@Log4j2
@RequiredArgsConstructor
@Service
public class TEmpFamilyServiceImpl extends ServiceImpl<TEmpFamilyMapper, TEmpFamily> implements TEmpFamilyService {
......@@ -161,6 +167,63 @@ public class TEmpFamilyServiceImpl extends ServiceImpl<TEmpFamilyMapper, TEmpFam
return baseMapper.selectList(wrapper);
}
@Override
public R<List<ErrorMessage>> importEmpFamilyDiy(InputStream fileInputStream) {
List<ErrorMessage> errorMessageList = new ArrayList<>();
ExcelUtil<EmpFamilyExcelVO> util1 = new ExcelUtil<>(EmpFamilyExcelVO.class);;
// 写法2:
// 匿名内部类 不用额外写一个DemoDataListener
// 这里 需要指定读用哪个class去读,然后读取第一个sheet 文件流会自动关闭
try {
EasyExcel.read(fileInputStream, EmpFamilyExcelVO.class, new ReadListener<EmpFamilyExcelVO>() {
/**
* 单次缓存的数据量
*/
public static final int BATCH_COUNT = CommonConstants.BATCH_COUNT;
/**
*临时存储
*/
private List<EmpFamilyExcelVO> cachedDataList = ListUtils.newArrayListWithExpectedSize(BATCH_COUNT);
@Override
public void invoke(EmpFamilyExcelVO data, AnalysisContext context) {
ReadRowHolder readRowHolder = context.readRowHolder();
Integer rowIndex = readRowHolder.getRowIndex();
data.setRowIndex(rowIndex+1);
ErrorMessage errorMessage = util1.checkEntity(data, data.getRowIndex());
if (Common.isNotNull(errorMessage)){
errorMessageList.add(errorMessage);
}else {
cachedDataList.add(data);
}
if (cachedDataList.size() >= BATCH_COUNT) {
saveData();
// 存储完成清理 list
cachedDataList = ListUtils.newArrayListWithExpectedSize(BATCH_COUNT);
}
}
@Override
public void doAfterAllAnalysed(AnalysisContext context) {
saveData();
}
/**
* 加上存储数据库
*/
private void saveData() {
log.info("{}条数据,开始存储数据库!", cachedDataList.size());
importEmpFamily(cachedDataList,errorMessageList);
log.info("存储数据库成功!");
}
}).sheet().doRead();
}catch (Exception e){
log.error(CommonConstants.IMPORT_DATA_ANALYSIS_ERROR,e);
return R.failed(CommonConstants.IMPORT_DATA_ANALYSIS_ERROR);
}
return R.ok(errorMessageList);
}
private LambdaQueryWrapper buildQueryWrapper(FamilySearchVO entity){
LambdaQueryWrapper<TEmpFamily> wrapper = Wrappers.lambdaQuery();
wrapper.eq(TEmpFamily::getDeleteFlag,CommonConstants.ZERO_STRING);
......
......@@ -18,6 +18,11 @@ package com.yifu.cloud.plus.v1.yifu.archives.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.ArrayUtil;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.read.listener.ReadListener;
import com.alibaba.excel.read.metadata.holder.ReadRowHolder;
import com.alibaba.excel.util.ListUtils;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
......@@ -33,14 +38,14 @@ import com.yifu.cloud.plus.v1.yifu.archives.vo.CertifySearchVo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmpCertificateExcelVO;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
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.ErrorMessage;
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.*;
import com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity;
import lombok.RequiredArgsConstructor;
import lombok.extern.log4j.Log4j2;
import org.springframework.stereotype.Service;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
/**
......@@ -49,6 +54,7 @@ import java.util.List;
* @author fxj
* @date 2022-06-18 09:39:46
*/
@Log4j2
@RequiredArgsConstructor
@Service
public class TEmpProfessionalQualificationServiceImpl extends ServiceImpl<TEmpProfessionalQualificationMapper, TEmpProfessionalQualification> implements TEmpProfessionalQualificationService {
......@@ -151,6 +157,64 @@ public class TEmpProfessionalQualificationServiceImpl extends ServiceImpl<TEmpPr
wrapper.orderByDesc(BaseEntity::getCreateTime);
return baseMapper.selectPage(page,wrapper);
}
@Override
public R<List<ErrorMessage>> importEmpCertificateDiy(InputStream inputStream) {
List<ErrorMessage> errorMessageList = new ArrayList<>();
ExcelUtil<EmpCertificateExcelVO> util1 = new ExcelUtil<>(EmpCertificateExcelVO.class);;
// 写法2:
// 匿名内部类 不用额外写一个DemoDataListener
// 这里 需要指定读用哪个class去读,然后读取第一个sheet 文件流会自动关闭
try {
EasyExcel.read(inputStream, EmpCertificateExcelVO.class, new ReadListener<EmpCertificateExcelVO>() {
/**
* 单次缓存的数据量
*/
public static final int BATCH_COUNT = CommonConstants.BATCH_COUNT;
/**
*临时存储
*/
private List<EmpCertificateExcelVO> cachedDataList = ListUtils.newArrayListWithExpectedSize(BATCH_COUNT);
@Override
public void invoke(EmpCertificateExcelVO data, AnalysisContext context) {
ReadRowHolder readRowHolder = context.readRowHolder();
Integer rowIndex = readRowHolder.getRowIndex();
data.setRowIndex(rowIndex+1);
ErrorMessage errorMessage = util1.checkEntity(data, data.getRowIndex());
if (Common.isNotNull(errorMessage)){
errorMessageList.add(errorMessage);
}else {
cachedDataList.add(data);
}
if (cachedDataList.size() >= BATCH_COUNT) {
saveData();
// 存储完成清理 list
cachedDataList = ListUtils.newArrayListWithExpectedSize(BATCH_COUNT);
}
}
@Override
public void doAfterAllAnalysed(AnalysisContext context) {
saveData();
}
/**
* 加上存储数据库
*/
private void saveData() {
log.info("{}条数据,开始存储数据库!", cachedDataList.size());
importEmpCertificate(cachedDataList,errorMessageList);
log.info("存储数据库成功!");
}
}).sheet().doRead();
}catch (Exception e){
log.error(CommonConstants.IMPORT_DATA_ANALYSIS_ERROR,e);
return R.failed(CommonConstants.IMPORT_DATA_ANALYSIS_ERROR);
}
return R.ok(errorMessageList);
}
private LambdaQueryWrapper buildQueryWrapper(CertifySearchVo entity){
LambdaQueryWrapper<TEmpProfessionalQualification> wrapper = Wrappers.lambdaQuery();
wrapper.eq(TEmpProfessionalQualification::getDeleteFlag,CommonConstants.ZERO_STRING);
......
......@@ -19,6 +19,11 @@ package com.yifu.cloud.plus.v1.yifu.archives.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.read.listener.ReadListener;
import com.alibaba.excel.read.metadata.holder.ReadRowHolder;
import com.alibaba.excel.util.ListUtils;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
......@@ -34,14 +39,14 @@ import com.yifu.cloud.plus.v1.yifu.archives.vo.EmpWorkRecordExcelVO;
import com.yifu.cloud.plus.v1.yifu.archives.vo.WorkRecordSearchVO;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
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.ErrorMessage;
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.*;
import com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity;
import lombok.RequiredArgsConstructor;
import lombok.extern.log4j.Log4j2;
import org.springframework.stereotype.Service;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
/**
......@@ -50,6 +55,7 @@ import java.util.List;
* @author fxj
* @date 2022-06-18 09:39:46
*/
@Log4j2
@RequiredArgsConstructor
@Service
public class TEmpWorkRecordingServiceImpl extends ServiceImpl<TEmpWorkRecordingMapper, TEmpWorkRecording> implements TEmpWorkRecordingService {
......@@ -185,6 +191,64 @@ public class TEmpWorkRecordingServiceImpl extends ServiceImpl<TEmpWorkRecordingM
return baseMapper.selectList(wrapper);
}
@Override
public R<List<ErrorMessage>> importEmpWorkRecordDiy(InputStream inputStream) {
List<com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage> errorMessageList = new ArrayList<>();
ExcelUtil<EmpWorkRecordExcelVO> util1 = new ExcelUtil<>(EmpWorkRecordExcelVO.class);;
// 写法2:
// 匿名内部类 不用额外写一个DemoDataListener
// 这里 需要指定读用哪个class去读,然后读取第一个sheet 文件流会自动关闭
try {
EasyExcel.read(inputStream, EmpWorkRecordExcelVO.class, new ReadListener<EmpWorkRecordExcelVO>() {
/**
* 单次缓存的数据量
*/
public static final int BATCH_COUNT = CommonConstants.BATCH_COUNT;
/**
*临时存储
*/
private List<EmpWorkRecordExcelVO> cachedDataList = ListUtils.newArrayListWithExpectedSize(BATCH_COUNT);
@Override
public void invoke(EmpWorkRecordExcelVO data, AnalysisContext context) {
ReadRowHolder readRowHolder = context.readRowHolder();
Integer rowIndex = readRowHolder.getRowIndex();
data.setRowIndex(rowIndex+1);
ErrorMessage errorMessage = util1.checkEntity(data, data.getRowIndex());
if (Common.isNotNull(errorMessage)){
errorMessageList.add(errorMessage);
}else {
cachedDataList.add(data);
}
if (cachedDataList.size() >= BATCH_COUNT) {
saveData();
// 存储完成清理 list
cachedDataList = ListUtils.newArrayListWithExpectedSize(BATCH_COUNT);
}
}
@Override
public void doAfterAllAnalysed(AnalysisContext context) {
saveData();
}
/**
* 加上存储数据库
*/
private void saveData() {
log.info("{}条数据,开始存储数据库!", cachedDataList.size());
importEmpWorkRecord(cachedDataList,errorMessageList);
log.info("存储数据库成功!");
}
}).sheet().doRead();
}catch (Exception e){
log.error(CommonConstants.IMPORT_DATA_ANALYSIS_ERROR,e);
return R.failed(CommonConstants.IMPORT_DATA_ANALYSIS_ERROR);
}
return R.ok(errorMessageList);
}
private LambdaQueryWrapper buildQueryWrapper(WorkRecordSearchVO entity){
LambdaQueryWrapper<TEmpWorkRecording> wrapper = Wrappers.lambdaQuery();
wrapper.eq(TEmpWorkRecording::getDeleteFlag,CommonConstants.ZERO_STRING);
......
......@@ -572,6 +572,13 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
//获取记录
list = gettEmpProInfoExportVos(idstr, projectDTO);
if (Common.isNotNull(list)){
ExcelUtil<EmployeeProjectExportVO> util = new ExcelUtil<>(EmployeeProjectExportVO.class);
for (EmployeeProjectExportVO vo:list){
util.convertEntity(vo,null,null,null);
}
}
ServletOutputStream out = null;
try {
if (list.size()>0) {
......@@ -580,7 +587,7 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
response.setCharacterEncoding("utf-8");
response.setHeader("Content-Disposition", "attachment;filename*=utf-8'zh_cn'" + URLEncoder.encode(fileName , "UTF-8"));
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭
EasyExcel.write(fileName, EmployeeProjectExportVO.class).includeColumnFiledNames(includeColumnFiledNames).sheet("项目档案")
EasyExcel.write(out, EmployeeProjectExportVO.class).includeColumnFiledNames(includeColumnFiledNames).sheet("项目档案")
.doWrite(list);
out.flush();
}
......
......@@ -88,7 +88,9 @@
<result property="unitNo" column="UNIT_NO"/>
<result property="deptName" column="DEPT_NAME"/>
<result property="deptNo" column="DEPT_NO"/>
<result property="businessType" column="BUSINESS_TYPE"/>
<result property="businessPrimaryType" column="BUSINESS_PRIMARY_TYPE"/>
<result property="businessSecondType" column="BUSINESS_SECOND_TYPE"/>
<result property="businessThirdType" column="BUSINESS_THIRD_TYPE"/>
<result property="contractType" column="CONTRACT_TYPE"/>
<result property="workingHours" column="WORKING_HOURS"/>
<result property="post" column="POST"/>
......@@ -175,7 +177,9 @@
a.UNIT_NO,
a.DEPT_NAME,
a.DEPT_NO,
concat(a.BUSINESS_PRIMARY_TYPE,'/',BUSINESS_SECOND_TYPE,'/',a.BUSINESS_THIRD_TYPE) AS BUSINESS_TYPE,
a.BUSINESS_PRIMARY_TYPE,
a.BUSINESS_SECOND_TYPE,
a.BUSINESS_THIRD_TYPE,
a.CONTRACT_TYPE,
a.WORKING_HOURS,
a.POST,
......@@ -462,9 +466,9 @@
<if test="tEmployeeProject.fileTown != null">
AND b.FILE_TOWN = #{tEmployeeProject.fileTown}
</if>
<if test="tEmployeeInfo.idList != null">
<if test="tEmployeeProject.idList != null">
AND a.id in
<foreach item="idStr" index="index" collection="tEmployeeInfo.idList" open="(" separator="," close=")">
<foreach item="idStr" index="index" collection="tEmployeeProject.idList" open="(" separator="," close=")">
#{idStr}
</foreach>
</if>
......
......@@ -255,4 +255,5 @@ public interface CommonConstants {
String IMPORT_DATA_ANALYSIS_ERROR = "数据导入解析异常,请检查表数据格式";
String CREATE_TIME = "create_time";
String ID = "ID";
String PARAM_IS_NOT_ERROR = "传参异常,请检查参数";
}
......@@ -153,7 +153,7 @@ public @interface ExcelAttribute {
* 日期格式化字符串
* @return
*/
public abstract String dateFormat() default "YYYY-MM-dd";
public abstract String dateFormat() default "yyyy-MM-dd";
/**
* 日期格式化字符串
......
......@@ -39,14 +39,14 @@ sys.role.update.error.code.exist="\u5DF2\u5B58\u5728\u5BF9\u5E94\u6807\u8BC6\u76
sys.role.delete.existing.user=\u8BE5\u89D2\u8272\u4E0B\u8FD8\u6709\u5173\u8054\u7684\u7528\u6237\uFF0C\u8BF7\u5148\u5C06\u7528\u6237\u8F6C\u79FB\u5230\u5176\u4ED6\u89D2\u8272!
archives.emp.disability.name.existing=\u5DF2\u5B58\u5728\u5BF9\u5E94\u4F24\u6B8B\u75C5\u540D\u79F0\u7684\u6570\u636E
archives.emp.disability.name.existing=\u8BE5\u5458\u5DE5\u5DF2\u5B58\u5728\u5BF9\u5E94\u4F24\u6B8B\u75C5\u540D\u79F0\u7684\u6570\u636E
archives.emp.family.name.existing=\u5DF2\u5B58\u5728\u5BF9\u5E94\u8EAB\u4EFD\u8BC1\u7684\u5BB6\u5EAD\u6210\u5458\u4FE1\u606F
archives.emp.family.name.existing=\u8BE5\u5458\u5DE5\u5DF2\u5B58\u5728\u5BF9\u5E94\u8EAB\u4EFD\u8BC1\u7684\u5BB6\u5EAD\u6210\u5458\u4FE1\u606F
archives.emp.not.exist=\u65E0\u5BF9\u5E94\u8EAB\u4EFD\u8BC1\u7684\u5458\u5DE5\u4FE1\u606F
archives.emp.reduced=\u5458\u5DE5\u5DF2\u51CF\u6863
archives.emp.work.record.existing=\u5DF2\u5B58\u5728\u5BF9\u5E94\u8EAB\u4EFD\u8BC1\u7684\u5DE5\u4F5C\u8BB0\u5F55\u4FE1\u606F
archives.emp.education.existing=\u5DF2\u5B58\u5728\u8BE5\u5458\u5DE5\u5BF9\u5E94\u5B66\u5386\u540D\u79F0\u7684\u5B66\u5386\u4FE1\u606F
archives.emp.work.record.existing=\u8BE5\u5458\u5DE5\u5DF2\u5B58\u5728\u5BF9\u5E94\u8EAB\u4EFD\u8BC1\u7684\u5DE5\u4F5C\u8BB0\u5F55\u4FE1\u606F
archives.emp.education.existing=\u8BE5\u5458\u5DE5\u5DF2\u5B58\u5728\u8BE5\u5458\u5DE5\u5BF9\u5E94\u5B66\u5386\u540D\u79F0\u7684\u5B66\u5386\u4FE1\u606F
param.not.empty=\u53C2\u6570\u4E0D\u53EF\u4E3A\u7A7A
......
......@@ -311,7 +311,7 @@ public class DictController {
* @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")
@PostMapping("/inner/getDictToLable")
public R<Map<String, Map<String, String>>> getDictToLable() {
return sysDictItemService.getDictToLable();
}
......
......@@ -11,6 +11,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -46,10 +47,23 @@ public class DictItemRedisInit {
log.info("区域数据加入缓存初始化开始...");
List<SysArea> allAreas = sysAreaService.getAllArea();
if (Common.isNotNull(allAreas)){
Map<String,SysArea> areaMap = new HashMap<>();
for (SysArea area:allAreas){
redisUtil.set("area_" + area.getId()
+ CommonConstants.DOWN_LINE_STRING
+(Common.isEmpty(area.getParentId())?"0":area.getParentId()),area.getId());
+(Common.isEmpty(area.getParentId())?"0":area.getParentId()),area.getAreaName());
areaMap.put(area.getId().toString(),area);
}
SysArea temp;
for (SysArea area:allAreas){
if (Common.isNotNull(area.getParentId()) && area.getParentId().intValue() > 0){
temp = areaMap.get(area.getParentId());
redisUtil.set("area_" + area.getAreaName()
+ CommonConstants.DOWN_LINE_STRING
+(Common.isNotNull(temp)?temp.getAreaName():""),area.getId());
}else {
redisUtil.set("area_" + area.getAreaName(),area.getId());
}
}
}
log.info("区域数据加入缓存初始化结束...");
......
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