Commit 15ffb2a3 authored by fangxinjiang's avatar fangxinjiang

BUG修复

parent 36383adc
......@@ -21,7 +21,9 @@ import com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.Max;
import java.util.Date;
/**
......@@ -46,12 +48,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 +68,7 @@ public class TEmpEducation extends BaseEntity {
/**
* 身份证号
*/
@Max(value = 20)
@Schema(description = "身份证号")
private String empIdcard;
......@@ -76,6 +81,7 @@ public class TEmpEducation extends BaseEntity {
/**
* 学历名称
*/
@Max(value = 50)
@Schema(description = "学历名称")
private String educationName;
......@@ -88,6 +94,7 @@ public class TEmpEducation extends BaseEntity {
/**
* 学校名称
*/
@Max(value = 50)
@Schema(description = "学校名称")
private String school;
......@@ -112,6 +119,7 @@ public class TEmpEducation extends BaseEntity {
/**
* 院系名称
*/
@Max(value = 50)
@Schema(description = "院系名称")
private String collageSystem;
......@@ -131,18 +139,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;
......
......@@ -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;
......
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;
}
......@@ -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 证明开具记录表
......
......@@ -120,7 +120,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);
}
/**
......
......@@ -268,7 +268,6 @@ public class TEmpEducationController {
}
}
@Override
public void doAfterAllAnalysed(AnalysisContext context) {
saveData();
......
......@@ -183,7 +183,7 @@ public class TEmpWorkRecordingController {
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());
ErrorMessage errorMessage = util1.checkEntity(data, data.getRowIndex());
if (Common.isNotNull(errorMessage)){
errorMessageList.add(errorMessage);
}else {
......
......@@ -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);
}
......@@ -43,4 +43,6 @@ public interface TEmpDisabilityInfoService extends IService<TEmpDisabilityInfo>
IPage<TEmpDisabilityInfo> pageDiy(Page page, DisabilitySearchVo searchVo);
List<TEmpDisabilityInfo> getTEmpDisabilityInfoNoPage(DisabilitySearchVo searchVo);
R<Boolean> updateByIdDiy(TEmpDisabilityInfo tEmpDisabilityInfo);
}
......@@ -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);
}
}
......@@ -115,6 +115,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 +155,21 @@ 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();
}
private LambdaQueryWrapper buildQueryWrapper(DisabilitySearchVo entity){
LambdaQueryWrapper<TEmpDisabilityInfo> wrapper = Wrappers.lambdaQuery();
wrapper.eq(TEmpDisabilityInfo::getDeleteFlag,CommonConstants.ZERO_STRING);
......
......@@ -157,30 +157,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 +229,8 @@ public class TEmpEducationServiceImpl extends ServiceImpl<TEmpEducationMapper, T
updateVo.setIsCollege(CommonConstants.ONE_INT);
}
employeeInfoMapper.updateEducationOfEmp(updateVo);
// 所有学历更新为非最高学历
baseMapper.updateHighIdentification(education.getEmpIdcard());
}
}
......
......@@ -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 = "传参异常,请检查参数";
}
......@@ -13,10 +13,7 @@ import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
/**
* @Author fxj
......@@ -41,6 +38,147 @@ public class ExcelUtil <T> implements Serializable {
}
private Field[] fields;
public void convertEntity(T vo, String[] exportFields, Map<String,String> diyDicMap, String dateFormat) {
// 得到所有定义字段
Field[] allFields = clazz.getDeclaredFields();
List<Field> fields = new ArrayList<Field>();
Class<?> superClazz = clazz.getSuperclass();
// 得到所有field并存放到一个list中
for (Field field : allFields) {
if (field.isAnnotationPresent(ExcelAttribute.class)) {
fields.add(field);
}
}
if (superClazz != null) {
Field[] superFields = superClazz.getDeclaredFields();
for (Field field : superFields) {
if (field.isAnnotationPresent(ExcelAttribute.class)) {
fields.add(field);
}
}
}
fields = getFiledsByParamFiled(fields, exportFields);
ExcelAttribute attr = null;
Field field;
//分割符
String divider;
for (int j = 0; j < fields.size(); j++) {
// 获得field
field = fields.get(j);
// 设置实体类私有属性可访问
field.setAccessible(true);
attr = field.getAnnotation(ExcelAttribute.class);
if (attr.isExport()) {
// 如果数据存在就填入,不存在填入空格
Class<?> classType = field.getType();
String value = null;
Date date;
try {
if (field.get(vo) != null && (classType.isAssignableFrom(Date.class) || classType.isAssignableFrom(LocalDateTime.class) || classType.isAssignableFrom(LocalDate.class))) {
if (Common.isNotNull(attr.dateFormatExport())) {
date = DateUtil.stringToDate2(String.valueOf(field.get(vo)), attr.dateFormatExport());
if (classType.isAssignableFrom(LocalDateTime.class)){
value = LocalDateTimeUtils.formatTime((LocalDateTime)field.get(vo),attr.dateFormatExport());
}else {
value = DateUtil.dateToString(date, attr.dateFormatExport());
}
} else {
date = DateUtil.stringToDate2(String.valueOf(field.get(vo)), !Common.isNotNull(dateFormat) ? DateUtil.ISO_EXPANDED_DATE_FORMAT : dateFormat);
if (classType.isAssignableFrom(LocalDateTime.class)){
value = LocalDateTimeUtils.formatTime((LocalDateTime)field.get(vo),!Common.isNotNull(dateFormat) ? DateUtil.ISO_EXPANDED_DATE_FORMAT : dateFormat);
}else {
value = cn.hutool.core.date.DateUtil.format(date, !Common.isNotNull(dateFormat) ? DateUtil.ISO_EXPANDED_DATE_FORMAT : dateFormat);
}
}
}
//如果有默认字典数据直接取值
if (Common.isNotNull(attr.readConverterExp())) {
value = convertByExp(field.get(vo) == null ? "" : String.valueOf(field.get(vo)), attr.readConverterExp());
} else if (attr.isDataId()) {
//加入分割符逻辑
divider = attr.divider();
if(!"".equals(divider) && field.get(vo) != null) {
//如果是字典数据ID或区域ID 去dicMap(包含了区域) 取值 取不到返回空
value = getLableById(attr, diyDicMap, field.get(vo) == null ? "" : String.valueOf(field.get(vo)));
}
}
field.set(vo, value);
}catch (Exception e){
log.error("字典数据解析异常");
}
}
}
}
/**
* 通过标志_字典ID的方式去dicMap 取值
*
* @param attr
* @param dicMap 字典值 key: 类型标识_ID value:实际要导出的内容
* @param value 对应字段的ID值
* @return
* @Author fxj
* @Date 2019-08-06
**/
private String getLableById(ExcelAttribute attr, Map<String, String> dicMap, String value) {
String tempValue = null;
if (null != dicMap && dicMap.size() > 0 && Common.isNotNull(value)) {
if (Common.isNotNull(attr.dataType())) {
tempValue = dicMap.get(attr.dataType() + CommonConstants.DOWN_LINE_STRING + value);
if (Common.isEmpty(tempValue)){
tempValue = dicMap.get(attr.dataType() + CommonConstants.DOWN_LINE_STRING +"id"+CommonConstants.DOWN_LINE_STRING + value);
}
} else {
tempValue = dicMap.get(value);
}
}
// 默认字典获取不到 去 缓存获取
if (Common.isEmpty(tempValue)){
Map<String,String> dicObj = (Map<String, String>) RedisUtil.redis.opsForValue().get(attr.dataType());
boolean flag = true;
for (Map.Entry<String,String> entry:dicObj.entrySet()){
if (Common.isNotNull(entry.getKey()) && entry.getKey().equals(value.trim())){
tempValue = entry.getValue();
break;
}
}
}
return tempValue;
}
/**
* 返回传参对应的fileds
*
* @param fields
* @param paramFields
* @return
* @Author fxj
* @Date 2019-08-05
**/
private List<Field> getFiledsByParamFiled(List<Field> fields, String[] paramFields) {
List<Field> fieldsTemp = new ArrayList<Field>();
List<String> attrName = new ArrayList();//存中文名 wangan修改
if (null != paramFields && paramFields.length > 0) {
ExcelAttribute attr;
Field field;
for (int j = 0; j < paramFields.length; j++) {
for (int i = 0; i < fields.size(); i++) {
field = fields.get(i);
attr = field.getAnnotation(ExcelAttribute.class);
//如果有同样的中文名数据字段,后面不再添加。 wangan修改
if (!attrName.contains(attr.name())) {
if (attr.name().equals(paramFields[j])) {
fieldsTemp.add(field);
attrName.add(attr.name());
break;
}
}
}
}
} else {
return fields;
}
return fieldsTemp;
}
public ErrorMessage checkEntity(T data , Integer rowNum) {
if (!Common.isNotNull(fields)){
return null;
......@@ -85,7 +223,7 @@ public class ExcelUtil <T> implements Serializable {
//如果是需要从字典表取值数据的话在这里处理即可
if (Common.isNotNull(attr.readConverterExp())) {
tempStr = reverseByExp( c, attr.readConverterExp());
c = reverseByExp( c, attr.readConverterExp());
} else if (attr.isDataId()) {
if (Common.isNotNull(attr.dataType())) {
//非区域字段处理 TODO
......@@ -124,7 +262,8 @@ public class ExcelUtil <T> implements Serializable {
}
}
continue;
} else {
}
if (Common.isNotNull(tempStr)){
c = tempStr;
}
}
......@@ -194,7 +333,7 @@ public class ExcelUtil <T> implements Serializable {
return errorMessageHashMap.get(rowNum);
}
/**
* 例如:解析值 0=男,1=女,2=未知
* 例如:解析值 0=男,1=女,2=未知 传参 男解析为 0
*
* @param propertyValue 参数值
* @param converterExp 翻译注解
......@@ -202,6 +341,46 @@ public class ExcelUtil <T> implements Serializable {
* @throws Exception
*/
public static String reverseByExp(String propertyValue, String converterExp) throws Exception {
try {
String[] convertSource = converterExp.split(",");
if(propertyValue.contains(",")){
String[] valueSource = propertyValue.split(",");
propertyValue = "";
for(String value:valueSource){
for (String item : convertSource) {
String[] itemArray = item.split("=");
if (itemArray[1].equals(value)) {
propertyValue += itemArray[0] + ",";
break;
}
}
}
if(propertyValue.endsWith(",")){
propertyValue = propertyValue.substring(CommonConstants.dingleDigitIntArray[0],propertyValue.length()-1);
}
}else{
for (String item : convertSource) {
String[] itemArray = item.split("=");
if (itemArray[1].equals(propertyValue)) {
return itemArray[0];
}
}
}
} catch (Exception e) {
throw e;
}
return propertyValue;
}
/**
* 例如:解析值 0=男,1=女,2=未知 传参 0解析为 男
*
* @param propertyValue 参数值
* @param converterExp 翻译注解
* @return 解析后值
* @throws Exception
*/
public static String convertByExp(String propertyValue, String converterExp) throws Exception {
try {
String[] convertSource = converterExp.split(",");
if(propertyValue.contains(",")){
......
......@@ -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
......
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