Commit d485a2ef authored by fangxinjiang's avatar fangxinjiang

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

parents cd960e54 4fd48bde
...@@ -311,28 +311,28 @@ public class TEmployeeInfo extends BaseEntity { ...@@ -311,28 +311,28 @@ public class TEmployeeInfo extends BaseEntity {
/** /**
* 减档操作人姓名 * 减档操作人姓名
*/ */
@Schema(description = "离职操作姓名") @Schema(description = "减档人")
@TableField(updateStrategy = FieldStrategy.IGNORED) @TableField(updateStrategy = FieldStrategy.IGNORED)
private String leaveUserName; private String leaveUserName;
/** /**
* 离职时间 * 离职时间
*/ */
@Schema(description = "离职时间") @Schema(description = "减档时间")
@TableField(updateStrategy = FieldStrategy.IGNORED) @TableField(updateStrategy = FieldStrategy.IGNORED)
private Date leaveTime; private Date leaveTime;
/** /**
* 离职原因 * 离职原因
*/ */
@Schema(description = "离职原因") @Schema(description = "减档原因")
@TableField(updateStrategy = FieldStrategy.IGNORED) @TableField(updateStrategy = FieldStrategy.IGNORED)
private String leaveReason; private String leaveReason;
/** /**
* 离职备注 * 离职备注
*/ */
@Schema(description = "离职备注") @Schema(description = "减档备注")
@TableField(updateStrategy = FieldStrategy.IGNORED) @TableField(updateStrategy = FieldStrategy.IGNORED)
private String leaveRemark; private String leaveRemark;
......
...@@ -189,7 +189,7 @@ public class EmployeeExportVO extends BaseEntity { ...@@ -189,7 +189,7 @@ public class EmployeeExportVO extends BaseEntity {
@ExcelProperty(value = "近3个月发薪") @ExcelProperty(value = "近3个月发薪")
private String salaryStatus; private String salaryStatus;
@ExcelProperty(value = "减档操作人") @ExcelProperty(value = "减档人")
private String leaveUserName; private String leaveUserName;
@ExcelProperty(value = "减档时间") @ExcelProperty(value = "减档时间")
......
...@@ -215,6 +215,7 @@ public class EmployeeVO extends RowIndex implements Serializable { ...@@ -215,6 +215,7 @@ public class EmployeeVO extends RowIndex implements Serializable {
* 通信地址 * 通信地址
*/ */
@Schema(description = "通信地址") @Schema(description = "通信地址")
@ExcelProperty(value = "通信地址")
private String contactAddress; private String contactAddress;
} }
...@@ -78,7 +78,7 @@ public class EmployeeXProjectVO extends RowIndex implements Serializable { ...@@ -78,7 +78,7 @@ public class EmployeeXProjectVO extends RowIndex implements Serializable {
* 是否同步减档(0否;1是) * 是否同步减档(0否;1是)
*/ */
@ExcelProperty(value ="是否同步减档") @ExcelProperty(value ="是否同步减档")
@NotNull(message = "是否同步减档不能为空") // @NotNull(message = "是否同步减档不能为空")
@ExcelAttribute(name = "是否同步减档",isNotEmpty = true, errorInfo = "是否同步减档不能为空",maxLength = 1) // @ExcelAttribute(name = "是否同步减档",isNotEmpty = true, errorInfo = "是否同步减档不能为空",maxLength = 1)
private String isLeaveEmployee; private String isLeaveEmployee;
} }
...@@ -28,6 +28,8 @@ public class EmployeeConstants { ...@@ -28,6 +28,8 @@ public class EmployeeConstants {
public static final String ID_CITY_MUST = "更新户籍县,户籍市必填"; public static final String ID_CITY_MUST = "更新户籍县,户籍市必填";
public static final String FILE_ROVINCE_MUST = "更新档案市,档案省必填"; public static final String FILE_ROVINCE_MUST = "更新档案市,档案省必填";
public static final String FILE_CITY_MUST = "更新档案县,档案市必填"; public static final String FILE_CITY_MUST = "更新档案县,档案市必填";
public static final String DEPT_NO_ERROR = "项目编码错误";
public static final String DEPT_NO_EXIST = "根据项目编码未找到项目";
/** /**
* 无数据可更新 * 无数据可更新
......
...@@ -129,7 +129,7 @@ public class TElecEmployeeInfoController { ...@@ -129,7 +129,7 @@ public class TElecEmployeeInfoController {
@PostMapping("/importZip") @PostMapping("/importZip")
@Operation(summary = "批量导入电子档案", description = "批量导入电子档案") @Operation(summary = "批量导入电子档案", description = "批量导入电子档案")
@SysLog("批量导入电子档案" ) @SysLog("批量导入电子档案" )
public R<Boolean> importZip(@RequestBody MultipartFile file) { public R importZip(@RequestBody MultipartFile file) {
return this.tElecEmployeeInfoService.importZip(file); return this.tElecEmployeeInfoService.importZip(file);
} }
} }
...@@ -41,7 +41,7 @@ public interface TElecEmployeeInfoService extends IService<TElecEmployeeInfo> { ...@@ -41,7 +41,7 @@ public interface TElecEmployeeInfoService extends IService<TElecEmployeeInfo> {
* @author: huyc * @author: huyc
* @date: 2022/6/24 * @date: 2022/6/24
*/ */
R<Boolean> importZip(MultipartFile file); R importZip(MultipartFile file);
/** /**
* @description: 通过身份证号查询人员档案 * @description: 通过身份证号查询人员档案
......
...@@ -42,14 +42,49 @@ import java.util.Map; ...@@ -42,14 +42,49 @@ import java.util.Map;
*/ */
public interface TEmployeeProjectService extends IService<TEmployeeProject> { public interface TEmployeeProjectService extends IService<TEmployeeProject> {
/**
* @param tEmployeeProject
* @Description: 新增项目档案校验
* @Author: huyc
* @Date: 2022/6/21 10:30
* @return: R
**/
R addCheck(TEmployeeProject tEmployeeProject); R addCheck(TEmployeeProject tEmployeeProject);
/**
* @param jsonObject
* @Description: 复档复项相关操作
* @Author: huyc
* @Date: 2022/6/21 10:30
* @return: R
**/
R reEmpInfo(JSONObject jsonObject); R reEmpInfo(JSONObject jsonObject);
/**
* @param tEmployeeProject
* @Description: 新增项目档案表
* @Author: huyc
* @Date: 2022/6/21 10:30
* @return: R
**/
R saveEmp(TEmployeeProject tEmployeeProject); R saveEmp(TEmployeeProject tEmployeeProject);
/**
* @param tEmployeeProject
* @Description: 修改项目档案表
* @Author: huyc
* @Date: 2022/6/21 10:30
* @return: R
**/
R updateProject(TEmployeeProject tEmployeeProject); R updateProject(TEmployeeProject tEmployeeProject);
/**
* @param id
* @Description: 通过id删除项目档案
* @Author: huyc
* @Date: 2022/6/21 10:30
* @return: R
**/
R removeProjectInfo(String id); R removeProjectInfo(String id);
/** /**
......
...@@ -41,11 +41,11 @@ import org.apache.commons.fileupload.FileItemFactory; ...@@ -41,11 +41,11 @@ import org.apache.commons.fileupload.FileItemFactory;
import org.apache.commons.fileupload.disk.DiskFileItemFactory; import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.ResourceUtils;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.commons.CommonsMultipartFile; import org.springframework.web.multipart.commons.CommonsMultipartFile;
import java.io.*; import java.io.*;
import java.util.Arrays;
import java.util.Enumeration; import java.util.Enumeration;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -90,10 +90,10 @@ public class TElecEmployeeInfoServiceImpl extends ServiceImpl<TElecEmployeeInfoM ...@@ -90,10 +90,10 @@ public class TElecEmployeeInfoServiceImpl extends ServiceImpl<TElecEmployeeInfoM
* @date: 2022/6/27 * @date: 2022/6/27
*/ */
@Override @Override
public R<Boolean> importZip(MultipartFile zipFile){ public R importZip(MultipartFile zipFile){
try { try {
String pathName = ResourceUtils.getURL("classpath:").getPath() + "unloap/"; String pathName = System.getProperty("java.io.tmpdir");
String dec = ResourceUtils.getURL("classpath:").getPath() + "unloap/"; String dec = System.getProperty("java.io.tmpdir");
File file1 = new File(pathName); File file1 = new File(pathName);
//如果文件夹不存在 创建文件夹 //如果文件夹不存在 创建文件夹
if (!file1.exists()) { if (!file1.exists()) {
...@@ -107,9 +107,7 @@ public class TElecEmployeeInfoServiceImpl extends ServiceImpl<TElecEmployeeInfoM ...@@ -107,9 +107,7 @@ public class TElecEmployeeInfoServiceImpl extends ServiceImpl<TElecEmployeeInfoM
File file = new File(pathName); File file = new File(pathName);
zipFile.transferTo(file); zipFile.transferTo(file);
// 获取解压出来的文件名 不带后缀 // 获取解压出来的文件名 不带后缀
unZip(file, dec); return unZip(file, dec);
//解析完成删除本次解析中生成的文件 删除此目录下的所有文件
deleteFolder(dec);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
...@@ -121,6 +119,9 @@ public class TElecEmployeeInfoServiceImpl extends ServiceImpl<TElecEmployeeInfoM ...@@ -121,6 +119,9 @@ public class TElecEmployeeInfoServiceImpl extends ServiceImpl<TElecEmployeeInfoM
TEmployeeInfo tEmployeeInfo = tEmployeeInfoService.getOne((Wrappers.<TEmployeeInfo>query().lambda() TEmployeeInfo tEmployeeInfo = tEmployeeInfoService.getOne((Wrappers.<TEmployeeInfo>query().lambda()
.eq(TEmployeeInfo::getEmpIdcard,idCard)).eq(TEmployeeInfo::getDeleteFlag,CommonConstants.ZERO_STRING)); .eq(TEmployeeInfo::getEmpIdcard,idCard)).eq(TEmployeeInfo::getDeleteFlag,CommonConstants.ZERO_STRING));
if (Common.isNotNull(tEmployeeInfo)) { if (Common.isNotNull(tEmployeeInfo)) {
if (CommonConstants.ONE_INT == tEmployeeInfo.getFileStatus()) {
return R.failed("身份证号对应的档案为已减档");
}
return R.ok(tEmployeeInfo); return R.ok(tEmployeeInfo);
} }
return R.failed("未找到身份证号对应的档案信息"); return R.failed("未找到身份证号对应的档案信息");
...@@ -196,18 +197,18 @@ public class TElecEmployeeInfoServiceImpl extends ServiceImpl<TElecEmployeeInfoM ...@@ -196,18 +197,18 @@ public class TElecEmployeeInfoServiceImpl extends ServiceImpl<TElecEmployeeInfoM
fos.write(buf, 0, len); fos.write(buf, 0, len);
} }
R<FileVo> fileVo =fileUploadService.uploadImg(fileCovertMultipartFile(targetFile),"", CommonConstants.EIGHT_INT,"");
if (empInfo.length() > empInfo.lastIndexOf("/") + 1) { if (empInfo.length() > empInfo.lastIndexOf("/") + 1) {
String idCard = empInfo.substring(0,empInfo.indexOf("/")); String idCard = empInfo.substring(0,empInfo.indexOf("/"));
String dataType = empInfo.substring(empInfo.indexOf("/") +1,empInfo.lastIndexOf("/")); String dataType = empInfo.substring(empInfo.indexOf("/") +1,empInfo.lastIndexOf("/"));
String empName = ""; String empName = "";
TEmployeeInfo tEmployeeInfo = tEmployeeInfoService.getOne((Wrappers.<TEmployeeInfo>query().lambda() TEmployeeInfo tEmployeeInfo = tEmployeeInfoService.getOne((Wrappers.<TEmployeeInfo>query().lambda()
.eq(TEmployeeInfo::getEmpIdcard,idCard))); .eq(TEmployeeInfo::getEmpIdcard,idCard)).eq(TEmployeeInfo::getFileStatus,CommonConstants.ZERO_INT)
.eq(TEmployeeInfo::getDeleteFlag,CommonConstants.ZERO_STRING));
if (Common.isNotNull(tEmployeeInfo)) { if (Common.isNotNull(tEmployeeInfo)) {
empName = tEmployeeInfo.getEmpName(); empName = tEmployeeInfo.getEmpName();
}else {
return R.failed("未找到身份证对应的档案信息,身份证号:" + idCard);
} }
String attachInfo = empInfo.substring(empInfo.lastIndexOf("/")+1,empInfo.length());
TElecEmployeeInfo tElecEmployeeInfo = new TElecEmployeeInfo(); TElecEmployeeInfo tElecEmployeeInfo = new TElecEmployeeInfo();
tElecEmployeeInfo.setEmpIdcard(idCard); tElecEmployeeInfo.setEmpIdcard(idCard);
tElecEmployeeInfo.setEmpName(empName); tElecEmployeeInfo.setEmpName(empName);
...@@ -215,7 +216,14 @@ public class TElecEmployeeInfoServiceImpl extends ServiceImpl<TElecEmployeeInfoM ...@@ -215,7 +216,14 @@ public class TElecEmployeeInfoServiceImpl extends ServiceImpl<TElecEmployeeInfoM
tElecEmployeeInfo.setDataType(elecTypeMap.get(dataType)); tElecEmployeeInfo.setDataType(elecTypeMap.get(dataType));
} }
this.save(tElecEmployeeInfo); this.save(tElecEmployeeInfo);
//文件上传并保存附件信息
R<FileVo> fileVo =fileUploadService.uploadImg(fileCovertMultipartFile(targetFile),"", CommonConstants.EIGHT_INT,"");
String id = fileVo.getData().getUid();
attaInfoMapper.updateDomainId(tElecEmployeeInfo.getId(), Arrays.asList(id));
} }
//解析完成删除本次解析中生成的文件 删除此目录下的所有文件
deleteFolder(destDirPath);
// 关流顺序,先打开的后关闭 // 关流顺序,先打开的后关闭
fos.close(); fos.close();
is.close(); is.close();
......
...@@ -24,6 +24,7 @@ import com.alibaba.excel.read.listener.ReadListener; ...@@ -24,6 +24,7 @@ import com.alibaba.excel.read.listener.ReadListener;
import com.alibaba.excel.read.metadata.holder.ReadRowHolder; import com.alibaba.excel.read.metadata.holder.ReadRowHolder;
import com.alibaba.excel.util.ListUtils; import com.alibaba.excel.util.ListUtils;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.pig4cloud.plugin.excel.vo.ErrorMessage; import com.pig4cloud.plugin.excel.vo.ErrorMessage;
...@@ -33,11 +34,9 @@ import com.yifu.cloud.plus.v1.yifu.archives.constants.EmployeeConstants; ...@@ -33,11 +34,9 @@ import com.yifu.cloud.plus.v1.yifu.archives.constants.EmployeeConstants;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmpEducation; import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmpEducation;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeInfo; 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.entity.TEmployeeProject;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TSettleDomain;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmployeeInfoMapper; import com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmployeeInfoMapper;
import com.yifu.cloud.plus.v1.yifu.archives.service.TEmpEducationService; import com.yifu.cloud.plus.v1.yifu.archives.service.*;
import com.yifu.cloud.plus.v1.yifu.archives.service.TEmployeeInfoService;
import com.yifu.cloud.plus.v1.yifu.archives.service.TEmployeeLogService;
import com.yifu.cloud.plus.v1.yifu.archives.service.TEmployeeProjectService;
import com.yifu.cloud.plus.v1.yifu.archives.vo.*; import com.yifu.cloud.plus.v1.yifu.archives.vo.*;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CacheConstants; import com.yifu.cloud.plus.v1.yifu.common.core.constant.CacheConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants; import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
...@@ -86,6 +85,7 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T ...@@ -86,6 +85,7 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
private final DaprUpmsProperties daprUpmsProperties; private final DaprUpmsProperties daprUpmsProperties;
private final TEmployeeLogService tEmployeeLogService; private final TEmployeeLogService tEmployeeLogService;
private final TEmpEducationService tEmpEducationService; private final TEmpEducationService tEmpEducationService;
private final TSettleDomainService tSettleDomainService;
@Override @Override
public IPage<TEmployeeInfo> getPage(Page<TEmployeeInfo> page, TEmployeeInfo employeeInfo, String sql) { public IPage<TEmployeeInfo> getPage(Page<TEmployeeInfo> page, TEmployeeInfo employeeInfo, String sql) {
...@@ -778,7 +778,11 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T ...@@ -778,7 +778,11 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
log.error(CommonConstants.IMPORT_DATA_ANALYSIS_ERROR, e); log.error(CommonConstants.IMPORT_DATA_ANALYSIS_ERROR, e);
return R.failed(CommonConstants.IMPORT_DATA_ANALYSIS_ERROR); return R.failed(CommonConstants.IMPORT_DATA_ANALYSIS_ERROR);
} }
return R.ok(errorMessageList); if (errorMessageList.isEmpty()) {
return R.ok();
} else {
return R.failed(errorMessageList);
}
} }
...@@ -786,21 +790,26 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T ...@@ -786,21 +790,26 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
if (excelVOList == null || excelVOList.isEmpty()) { if (excelVOList == null || excelVOList.isEmpty()) {
return R.failed(CommonConstants.DATA_CAN_NOT_EMPTY); return R.failed(CommonConstants.DATA_CAN_NOT_EMPTY);
} }
Set<String> errorMsg;
YifuUser user = SecurityUtils.getUser(); YifuUser user = SecurityUtils.getUser();
if (user == null || Common.isEmpty(user.getId())) { if (user == null || Common.isEmpty(user.getId())) {
return R.failed("请登录!"); errorMsg = new HashSet<>();
errorMsg.add(CommonConstants.PLEASE_LOG_IN);
errorMessageList.add(new ErrorMessage(2L, errorMsg));
return R.failed(errorMessageList);
} }
Map<Long, ErrorMessage> errorMsgMap = new HashMap<>(); Map<Long, ErrorMessage> errorMsgMap = new HashMap<>();
if (Common.isNotNull(errorMessageList)) { if (Common.isNotNull(errorMessageList)) {
errorMessageList.stream().forEach(errorMessage -> errorMsgMap.put(errorMessage.getLineNum(), errorMessage)); errorMessageList.stream().forEach(errorMessage -> errorMsgMap.put(errorMessage.getLineNum(), errorMessage));
} }
// 获取身份证、手机号列表,批量查询档案 // 获取身份证、手机号列表,批量查询档案
List<String> idCardList = new ArrayList<>(); List<String> idCardList = new ArrayList<>();
List<String> phoneList = new ArrayList<>(); List<String> phoneList = new ArrayList<>();
Map<String, Integer> idCardMap = new HashMap<>(); Map<String, Integer> idCardMap = new HashMap<>();
String idCard; String idCard;
// 个性化校验逻辑 // 个性化校验逻辑
Set<String> errorMsg; List<String> deptNoList = new ArrayList<>();
for (int i = 0; i < excelVOList.size(); i++) { for (int i = 0; i < excelVOList.size(); i++) {
errorMsg = new HashSet<>(); errorMsg = new HashSet<>();
// 判空 // 判空
...@@ -822,12 +831,34 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T ...@@ -822,12 +831,34 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
if (Common.isNotNull(excelVOList.get(i).getEmpPhone())) { if (Common.isNotNull(excelVOList.get(i).getEmpPhone())) {
phoneList.add(excelVOList.get(i).getEmpPhone()); phoneList.add(excelVOList.get(i).getEmpPhone());
} }
if (Common.isNotNull(excelVOList.get(i).getDeptNo())) {
deptNoList.add(excelVOList.get(i).getDeptNo());
}
// 数据合法情况 // 数据合法情况
if (!CollUtil.isEmpty(errorMsg)) { if (!CollUtil.isEmpty(errorMsg)) {
// 数据不合法 // 数据不合法
errorMessageList.add(new ErrorMessage((i + 2L), errorMsg)); errorMessageList.add(new ErrorMessage((i + 2L), errorMsg));
} }
} }
List<TSettleDomain> deptList = tSettleDomainService.list(Wrappers.<TSettleDomain>query().lambda()
.eq(TSettleDomain::getDeleteFlag, CommonConstants.STATUS_NORMAL)
.eq(TSettleDomain::getStopFlag, CommonConstants.STATUS_NORMAL)
.in(TSettleDomain::getDepartNo, deptNoList)
);
Map<String, Integer> deptMap = new HashMap<>();
if (deptList == null || deptList.isEmpty()) {
errorMsg = new HashSet<>();
errorMsg.add(EmployeeConstants.DEPT_NO_EXIST);
errorMessageList.add(new ErrorMessage(2L, errorMsg));
return R.failed(errorMessageList);
} else {
for (TSettleDomain dept : deptList) {
deptMap.put(dept.getDepartNo(), CommonConstants.ONE_INT);
}
}
// 查找档案库 // 查找档案库
Map<String, TEmployeeInfo> existEmpMap = new HashMap<>(); Map<String, TEmployeeInfo> existEmpMap = new HashMap<>();
Map<String, TEmployeeInfo> existPhoneMap = new HashMap<>(); Map<String, TEmployeeInfo> existPhoneMap = new HashMap<>();
...@@ -901,6 +932,10 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T ...@@ -901,6 +932,10 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
saveEmp = new TEmployeeInfo(); saveEmp = new TEmployeeInfo();
errorMsg = new HashSet<>(); errorMsg = new HashSet<>();
excel = excelVOList.get(i); excel = excelVOList.get(i);
if (deptMap.get(excel.getDeptNo()) == null) {
errorMsg.add(EmployeeConstants.DEPT_NO_ERROR);
}
existEmp = existEmpMap.get(excel.getEmpIdcard()); existEmp = existEmpMap.get(excel.getEmpIdcard());
// 档案存在 // 档案存在
if (existEmp != null) { if (existEmp != null) {
...@@ -1317,16 +1352,27 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T ...@@ -1317,16 +1352,27 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
log.error(CommonConstants.IMPORT_DATA_ANALYSIS_ERROR, e); log.error(CommonConstants.IMPORT_DATA_ANALYSIS_ERROR, e);
return R.failed(CommonConstants.IMPORT_DATA_ANALYSIS_ERROR); return R.failed(CommonConstants.IMPORT_DATA_ANALYSIS_ERROR);
} }
return R.ok(errorMessageList); if (errorMessageList.isEmpty()) {
return R.ok();
} else {
return R.failed(errorMessageList);
}
} }
private R<List<ErrorMessage>> batchUpdateCore(List<EmployeeVO> excelVOList, List<ErrorMessage> errorMessageList) { private R<List<ErrorMessage>> batchUpdateCore(List<EmployeeVO> excelVOList, List<ErrorMessage> errorMessageList) {
YifuUser user = SecurityUtils.getUser(); YifuUser user = SecurityUtils.getUser();
Set<String> errorMsg;
if (user == null || Common.isEmpty(user.getId())) { if (user == null || Common.isEmpty(user.getId())) {
return R.failed("请登录!"); errorMsg = new HashSet<>();
errorMsg.add(CommonConstants.PLEASE_LOG_IN);
errorMessageList.add(new ErrorMessage(2L, errorMsg));
return R.failed(errorMessageList);
} }
if (excelVOList == null || excelVOList.isEmpty()) { if (excelVOList == null || excelVOList.isEmpty()) {
return R.failed(CommonConstants.DATA_CAN_NOT_EMPTY); errorMsg = new HashSet<>();
errorMsg.add(CommonConstants.DATA_CAN_NOT_EMPTY);
errorMessageList.add(new ErrorMessage(2L, errorMsg));
return R.failed(errorMessageList);
} }
// 通用校验获取失败的数据 // 通用校验获取失败的数据
Map<Long, ErrorMessage> errorMsgMap = new HashMap<>(); Map<Long, ErrorMessage> errorMsgMap = new HashMap<>();
...@@ -1374,7 +1420,6 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T ...@@ -1374,7 +1420,6 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
} }
// 个性化校验逻辑 // 个性化校验逻辑
Set<String> errorMsg;
EmployeeVO excel; EmployeeVO excel;
// 需要保存的档案信息 // 需要保存的档案信息
TEmployeeInfo saveEmp; TEmployeeInfo saveEmp;
...@@ -1832,10 +1877,14 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T ...@@ -1832,10 +1877,14 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
if (list != null && !list.isEmpty()) { if (list != null && !list.isEmpty()) {
ServletOutputStream out = null; ServletOutputStream out = null;
try { try {
ExcelUtil<EmployeeExportVO> util = new ExcelUtil<>(EmployeeExportVO.class);
for (EmployeeExportVO vo : list) {
util.convertEntity(vo, null, null, null);
}
out = response.getOutputStream(); out = response.getOutputStream();
response.setContentType("multipart/form-data"); response.setContentType("multipart/form-data");
response.setCharacterEncoding("utf-8"); response.setCharacterEncoding("utf-8");
response.setHeader("Content-Disposition", "attachment;filename*=utf-8'zh_cn'" + URLEncoder.encode(fileName, "UTF-8")); response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(fileName, "UTF-8"));
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭 // 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭
EasyExcel.write(out, EmployeeExportVO.class).includeColumnFiledNames(employeeInfo.getExportFields()) EasyExcel.write(out, EmployeeExportVO.class).includeColumnFiledNames(employeeInfo.getExportFields())
.sheet("离职档案").doWrite(list); .sheet("离职档案").doWrite(list);
......
...@@ -7,12 +7,15 @@ import com.yifu.cloud.plus.v1.yifu.archives.service.TEmployeeInfoService; ...@@ -7,12 +7,15 @@ import com.yifu.cloud.plus.v1.yifu.archives.service.TEmployeeInfoService;
import com.yifu.cloud.plus.v1.yifu.archives.service.TEmployeeLogService; import com.yifu.cloud.plus.v1.yifu.archives.service.TEmployeeLogService;
import com.yifu.cloud.plus.v1.yifu.archives.service.TEmployeeProjectService; import com.yifu.cloud.plus.v1.yifu.archives.service.TEmployeeProjectService;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants; import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async; import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.List; import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
/** /**
* 主要执行人员档案的员工类型同步更新 * 主要执行人员档案的员工类型同步更新
...@@ -50,15 +53,18 @@ public class DoJointTask { ...@@ -50,15 +53,18 @@ public class DoJointTask {
.eq(TEmployeeProject::getEmpIdcard, tEmployeeInfo.getEmpIdcard()) .eq(TEmployeeProject::getEmpIdcard, tEmployeeInfo.getEmpIdcard())
.eq(TEmployeeProject::getDeleteFlag, CommonConstants.STATUS_NORMAL) .eq(TEmployeeProject::getDeleteFlag, CommonConstants.STATUS_NORMAL)
.eq(TEmployeeProject::getProjectStatus, CommonConstants.ZERO_INT)); .eq(TEmployeeProject::getProjectStatus, CommonConstants.ZERO_INT));
for (TEmployeeProject tEmployeeProject:list) { if (Common.isNotNull(list)) {
if (CommonConstants.ZERO_STRING.equals(tEmployeeProject.getEmpNatrue())) { Set<String> empNatrue = list.stream().map(TEmployeeProject::getEmpNatrue).collect(Collectors.toSet());
if (empNatrue.stream().anyMatch(e -> e.equals(CommonConstants.ZERO_STRING))) {
tEmployeeInfo.setEmpNatrue(CommonConstants.ZERO_STRING); tEmployeeInfo.setEmpNatrue(CommonConstants.ZERO_STRING);
break; } else if (empNatrue.stream().anyMatch(e -> e.equals(CommonConstants.ONE_STRING))) {
} else if (CommonConstants.ONE_STRING.equals(tEmployeeProject.getEmpNatrue()) && !CommonConstants.ZERO_STRING.equals(tEmployeeInfo.getEmpNatrue())) {
tEmployeeInfo.setEmpNatrue(CommonConstants.ONE_STRING); tEmployeeInfo.setEmpNatrue(CommonConstants.ONE_STRING);
break; } else {
tEmployeeInfo.setEmpNatrue(CommonConstants.TWO_STRING);
} }
tEmployeeInfo.setEmpNatrue(CommonConstants.TWO_STRING); tEmployeeInfo.setProjectNum(list.size());
} else {
tEmployeeInfo.setProjectNum(CommonConstants.ZERO_INT);
} }
tEmployeeInfoService.updateById(tEmployeeInfo); tEmployeeInfoService.updateById(tEmployeeInfo);
tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[0] tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[0]
......
...@@ -16,11 +16,23 @@ spring: ...@@ -16,11 +16,23 @@ spring:
password: yf_zsk password: yf_zsk
#url: jdbc:mysql://127.0.0.1:3306/yifu_upms?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowMultiQueries=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true #url: jdbc:mysql://127.0.0.1:3306/yifu_upms?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowMultiQueries=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
url: jdbc:mysql://192.168.1.65:22306/mvp_archives?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowMultiQueries=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true url: jdbc:mysql://192.168.1.65:22306/mvp_archives?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowMultiQueries=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
servlet:
multipart:
location: /data/tmp/
#法大大生产环境
#fdd:
# app-id: FA05480470
# app-key: GTYGFVFOYUYP3ONRHY91EK8IEAK5L9E7
# server-url: https://openapi.fadada.com/api/v3/
# connect-timeout: 10000
# read-timeout: 10000
# hrms-url: http://2349f6a315.wicp.vip:39468/v1.0/invoke/yifu-archives/method
#法大大沙箱环境配置
fdd: fdd:
app-id: FA05480470 appId: FA38847543
app-key: GTYGFVFOYUYP3ONRHY91EK8IEAK5L9E7 appKey: HOQBDZAEMEILJM6WU9LY0OPFHNFAMVTQ
server-url: https://openapi.fadada.com/api/v3/ serverUrl: https://sandboxapi.fadada.com/api/v3/
connect-timeout: 10000 connectTimeout: 10000
read-timeout: 10000 readTimeout: 10000
hrms-url: http://2349f6a315.wicp.vip:39468/v1.0/invoke/yifu-archives/method/fdd/notifyUrl hrmsUrl: http://2349f6a315.wicp.vip:39468/v1.0/invoke/yifu-archives/method
\ No newline at end of file \ No newline at end of file
...@@ -549,6 +549,7 @@ ...@@ -549,6 +549,7 @@
,GROUP_CONCAT(DISTINCT b.unit_no) UNIT_NO ,GROUP_CONCAT(DISTINCT b.unit_no) UNIT_NO
,a.LEAVE_TIME ,a.LEAVE_TIME
,a.LEAVE_USER ,a.LEAVE_USER
,a.LEAVE_USER_NAME
,a.LEAVE_REASON ,a.LEAVE_REASON
from t_employee_info a from t_employee_info a
left join t_employee_project b on a.id = b.EMP_ID left join t_employee_project b on a.id = b.EMP_ID
......
...@@ -76,6 +76,7 @@ public class DateUtil { ...@@ -76,6 +76,7 @@ public class DateUtil {
* yyyyMMddHHmmss * yyyyMMddHHmmss
*/ */
public static final String DATE_PATTERN = "yyyyMMddHHmmss"; public static final String DATE_PATTERN = "yyyyMMddHHmmss";
public static final String EXPORT_PATTERN = "yyyyMMdd-HHmmss";
protected static final float normalizedJulian(float jd) { protected static final float normalizedJulian(float jd) {
...@@ -1407,7 +1408,7 @@ public class DateUtil { ...@@ -1407,7 +1408,7 @@ public class DateUtil {
* @return: java.lang.String * @return: java.lang.String
**/ **/
public static String getThisTime(){ public static String getThisTime(){
SimpleDateFormat sf = new SimpleDateFormat(DateUtil.DATE_PATTERN); SimpleDateFormat sf = new SimpleDateFormat(DateUtil.EXPORT_PATTERN);
return sf.format(new Date()); return sf.format(new Date());
} }
......
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