Commit b3aad3fc authored by fangxinjiang's avatar fangxinjiang

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

parents 45a39c46 230c1140
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package com.yifu.cloud.plus.v1.yifu.archives.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.format.DateTimeFormat;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttributeConstants;
import lombok.Data;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Past;
import java.io.Serializable;
import java.util.Date;
/**
* 项目档案表excel对应的实体
*
* @author huyc
* @date 2022-06-20 17:54:40
*/
@Data
@ColumnWidth(30)
public class EmployeeProjectUpdateVO extends RowIndex implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 员工类型(字典值,0外包1派遣2代理)
*/
@ExcelProperty(value ="员工类型")
@ExcelAttribute(name = "员工类型",maxLength = 2,isDataId = true,dataType = ExcelAttributeConstants.EMP_NATRUE)
private String empNatrue;
/**
* 员工姓名
*/
@ExcelAttribute(name = "员工姓名",maxLength = 20)
@ExcelProperty(value ="员工姓名")
private String empName;
/**
* 身份证号码
*/
@NotNull(message = "身份证号不能为空")
@ExcelAttribute(name = "身份证号",isNotEmpty = true, errorInfo = "身份证号不能为空",maxLength = 20)
@ExcelProperty(value ="身份证号")
private String empIdcard;
/**
* 开户行
*/
@ExcelAttribute(name = "开户行")
@ExcelProperty(value ="开户行")
private String bankName;
/**
* 支行
*/
@ExcelAttribute(name = "支行")
@ExcelProperty(value ="支行")
private String bankSubName;
/**
* 银行卡号
*/
@ExcelAttribute(name ="银行卡号")
@ExcelProperty(value ="银行卡号")
private String bankNo;
/**
* 项目编码
*/
@NotNull(message = "项目编码不能为空")
@ExcelProperty(value ="项目编码")
@ExcelAttribute(name = "项目编码",isNotEmpty = true, errorInfo = "项目编码不能为空",maxLength = 20)
private String deptNo;
/**
* 合同类型(字典值)
*/
@ExcelAttribute(name = "合同类型",maxLength = 10,isDataId = true,dataType = ExcelAttributeConstants.PERSONNEL_TYPE)
@ExcelProperty(value ="合同类型")
private String contractType;
/**
* 工时制
*/
@ExcelAttribute(name = "工时制",maxLength = 10,isDataId = true,dataType = ExcelAttributeConstants.WORKING_HOURS)
@ExcelProperty(value ="工时制")
private String workingHours;
/**
* 就职岗位
*/
@ExcelAttribute(name = "就职岗位",maxLength = 20)
@ExcelProperty(value ="就职岗位")
private String post;
/**
* 入职日期
*/
@ExcelAttribute(name = "入职日期",maxLength = 4)
@ExcelProperty(value ="入职日期")
@Past
@DateTimeFormat("yyyy-MM-dd")
private Date enjoinDate;
/**
* 试用期(单位月)
*/
@ExcelAttribute(name = "试用期",maxLength = 4)
@ExcelProperty(value ="试用期")
private String tryPeriod;
}
......@@ -102,9 +102,8 @@ public class EmployeeProjectVO extends RowIndex implements Serializable {
/**
* 工时制
*/
@NotNull(message = "工时制不能为空")
@ExcelProperty(value ="工时制")
@ExcelAttribute(name = "工时制",isNotEmpty = true, errorInfo = "工时制不能为空",maxLength = 10,isDataId = true,dataType = ExcelAttributeConstants.WORKING_HOURS)
@ExcelAttribute(name = "工时制",maxLength = 10,isDataId = true,dataType = ExcelAttributeConstants.WORKING_HOURS)
private String workingHours;
/**
......@@ -119,7 +118,6 @@ public class EmployeeProjectVO extends RowIndex implements Serializable {
* 入职日期
*/
@ExcelProperty(value ="入职日期")
@NotNull(message = "入职日期不能为空")
@Past
@DateTimeFormat("yyyy-MM-dd")
private Date enjoinDate;
......@@ -128,8 +126,7 @@ public class EmployeeProjectVO extends RowIndex implements Serializable {
* 试用期(单位月)
*/
@ExcelProperty(value ="试用期")
@NotNull(message = "试用期不能为空")
@ExcelAttribute(name = "试用期",isNotEmpty = true, errorInfo = "试用期不能为空",maxLength = 4)
@ExcelAttribute(name = "试用期",maxLength = 4)
private String tryPeriod;
}
......@@ -123,7 +123,7 @@ public class TEmpChangeInfoServiceImpl extends ServiceImpl<TEmpChangeInfoMapper,
errorMsg.add("第" + (i + 2) + "行划转起始月长度不能超过6位");
errorMsgMap.put((i + 2L), new ErrorMessage("第" + (i + 2) + "行划转起始月长度不能超过6位"));
}
if (!PATTERN.matcher(excel.getChangeStartMonth()).matches()) {
if (!Common.isEmpty(excel.getChangeStartMonth()) && !PATTERN.matcher(excel.getChangeStartMonth()).matches()) {
errorMsg.add("第" + (i + 2) + "行划转起始月格式错误");
errorMsgMap.put((i + 2L), new ErrorMessage("第" + (i + 2) + "行划转起始月格式错误"));
}
......@@ -131,9 +131,11 @@ public class TEmpChangeInfoServiceImpl extends ServiceImpl<TEmpChangeInfoMapper,
if (Common.isEmpty(excel.getChangeStartMonth())) {
errorMsg.add("第" + (i + 2) + "行划转起始月不能为空");
errorMsgMap.put((i + 2L), new ErrorMessage("第" + (i + 2) + "行划转起始月不能为空"));
} else if (Integer.parseInt(excel.getChangeStartMonth()) > Integer.parseInt(DateUtil.getThisMonth())) {
errorMsg.add("第" + (i + 2) + "行划转起始月要小于等于当前月");
errorMsgMap.put((i + 2L), new ErrorMessage("第" + (i + 2) + "行划转起始月要小于等于当前月"));
} else if (PATTERN.matcher(excel.getChangeStartMonth()).matches()) {
if (Integer.parseInt(excel.getChangeStartMonth()) > Integer.parseInt(DateUtil.getThisMonth())) {
errorMsg.add("第" + (i + 2) + "行划转起始月要小于等于当前月");
errorMsgMap.put((i + 2L), new ErrorMessage("第" + (i + 2) + "行划转起始月要小于等于当前月"));
}
}
}
......
......@@ -39,6 +39,7 @@ import com.yifu.cloud.plus.v1.yifu.archives.service.TEmployeeLogService;
import com.yifu.cloud.plus.v1.yifu.archives.service.TEmployeeProjectService;
import com.yifu.cloud.plus.v1.yifu.archives.service.TSettleDomainService;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeProjectExportVO;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeProjectUpdateVO;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeProjectVO;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeXProjectVO;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
......@@ -48,6 +49,7 @@ import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import lombok.RequiredArgsConstructor;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.BindingResult;
......@@ -455,14 +457,14 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
if (excel.getEmpNatrue().equals(CommonConstants.ZERO_STRING) || excel.getEmpNatrue().equals(CommonConstants.ONE_STRING)) {
if (excel.getContractType().equals(CommonConstants.ONE_STRING)) {
if (Common.isEmpty(excel.getWorkingHours())) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), "第" + (excel.getRowIndex()) + "工时制不能为空!"));
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), "工时制不能为空!"));
}
}
if (Common.isEmpty(excel.getEnjoinDate())) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), "第" + (excel.getRowIndex()) + "入职日期不能为空!"));
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), "入职日期不能为空!"));
}
if (Common.isEmpty(excel.getTryPeriod())) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), "第" + (excel.getRowIndex()) + "试用期不能为空!"));
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), "试用期不能为空!"));
}
}
if (idCardMap.get(idCard.concat(deptNo)) != null) {
......@@ -564,13 +566,13 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
@Transactional
public R<List<ErrorMessage>> importEmpProjectUpdate(InputStream inputStream) {
List<ErrorMessage> errorMessageList = new ArrayList<>();
ExcelUtil<EmployeeProjectVO> util1 = new ExcelUtil<>(EmployeeProjectVO.class);
ExcelUtil<EmployeeProjectUpdateVO> util1 = new ExcelUtil<>(EmployeeProjectUpdateVO.class);
;
// 写法2:
// 匿名内部类 不用额外写一个DemoDataListener
// 这里 需要指定读用哪个class去读,然后读取第一个sheet 文件流会自动关闭
try {
EasyExcel.read(inputStream, EmployeeProjectVO.class, new ReadListener<EmployeeProjectVO>() {
EasyExcel.read(inputStream, EmployeeProjectUpdateVO.class, new ReadListener<EmployeeProjectUpdateVO>() {
/**
* 单次缓存的数据量
*/
......@@ -578,10 +580,10 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
/**
*临时存储
*/
private List<EmployeeProjectVO> cachedDataList = ListUtils.newArrayListWithExpectedSize(BATCH_COUNT);
private List<EmployeeProjectUpdateVO> cachedDataList = ListUtils.newArrayListWithExpectedSize(BATCH_COUNT);
@Override
public void invoke(EmployeeProjectVO data, AnalysisContext context) {
public void invoke(EmployeeProjectUpdateVO data, AnalysisContext context) {
ReadRowHolder readRowHolder = context.readRowHolder();
Integer rowIndex = readRowHolder.getRowIndex();
data.setRowIndex(rowIndex + 1);
......@@ -624,7 +626,7 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
* @Description 批量更新项目档案信息
* @Date 19:25 2022/6/21
**/
public void importEmpProjectUpdate(List<EmployeeProjectVO> excelVOList, List<ErrorMessage> errorMessageList) {
public void importEmpProjectUpdate(List<EmployeeProjectUpdateVO> excelVOList, List<ErrorMessage> errorMessageList) {
// 通用校验获取失败的数据
Map<Long, ErrorMessage> errorMsgMap = new HashMap<>();
......@@ -637,7 +639,7 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
if (Common.isNotNull(errorMsgMap.get(i + 2))) {
continue;
}
EmployeeProjectVO excel = excelVOList.get(i);
EmployeeProjectUpdateVO excel = excelVOList.get(i);
String checkCount = excel.getEmpIdcard().concat(excel.getDeptNo());
if (Common.isNotNull(checkCountMap.get(checkCount))) {
......@@ -656,7 +658,8 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
// 数据合法情况
if (CollUtil.isEmpty(errorMessageList)) {
updateExcelPro(excel, updateList, tEmployeeProject);
updateExcelProj(excel, updateList, tEmployeeProject);
if (!excel.getEmpNatrue().equals(tEmployeeProject.getEmpNatrue())) {
TEmployeeInfo tEmployeeInfo = tEmployeeInfoMapper.selectOne(Wrappers.<TEmployeeInfo>query().lambda()
.eq(TEmployeeInfo::getEmpIdcard, excel.getEmpIdcard())
......@@ -908,6 +911,19 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[1], "", tEmployeeProject.getId(), tEmployeeProjectOld, tEmployeeProject);
}
/**
* 更新项目档案
*/
private void updateExcelProj(EmployeeProjectUpdateVO excel, List<TEmployeeProject> proupdateList, TEmployeeProject tEmployeeProject) {
BeanUtil.copyProperties(excel, tEmployeeProject);
YifuUser user = SecurityUtils.getUser();
tEmployeeProject.setUpdateBy(user.getId());
proupdateList.add(tEmployeeProject);
// 记录变更日志
TEmployeeProject tEmployeeProjectOld = this.getById(tEmployeeProject.getId());
tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[1], "", tEmployeeProject.getId(), tEmployeeProjectOld, tEmployeeProject);
}
@Override
public List<TEmployeeProject> getListByEmpId(String empId, int projectStatus) {
TEmployeeProject project = new TEmployeeProject();
......
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