Commit a3f4b018 authored by hongguangwu's avatar hongguangwu

Merge remote-tracking branch 'origin/MVP1.6.10' into MVP1.6.10

parents 0725bacf e89a3cb9
......@@ -80,4 +80,15 @@ public class TAttaInfo extends BaseEntity {
@Schema(description = "地址URL")
@TableField(exist = false)
private String attaUrl;
/**
* 附件变更类型:0 增加 1 减少。 档案编辑附件时需要告知后端是增加还是减少
*/
@TableField(exist = false)
private String handleType;
/**
* 其他分租名称
*/
@TableField(exist = false)
private String groupName;
}
......@@ -77,5 +77,10 @@ public class TEmpOtherFile {
// 附件
@TableField(exist = false)
private List<TAttaInfo> attaList;
/**
* 档案编辑其他附件分租信息处理类型 0 新增 1 更新 2 删除
*/
@TableField(exist = false)
private String handleType;
}
......@@ -561,4 +561,10 @@ public class TEmployeeInfo extends BaseEntity {
@ExcelAttribute(name = "是否有职业资格证书",isNotEmpty = true,isDataId = true, readConverterExp = "0=是,1=否")
@Schema(description ="是否有职业资格证书:0 是 1 否")
private String haveQualification;
/**
* 其他附件--C段二维码扫码数据
*/
@TableField(exist = false)
private List<TEmpOtherFile> otherFiles;
}
......@@ -34,4 +34,18 @@ public class TCompleteMonitorInfoVo implements Serializable {
@Schema(description = "人员档案id")
private String empInfoId;
@Schema(description = "项目编码")
private String deptNo;
/**
* 开始时间(查询专用)
*/
@Schema(description = "进项目时间开始")
private LocalDateTime inTimeStart;
/**
* 截止时间(查询专用)
*/
@Schema(description = "进项目时间结束")
private LocalDateTime inTimeEnd;
}
......@@ -70,13 +70,13 @@ public class TCompleteMonitorController {
/**
* 查询人员明细
* @param page 分页对象
* @param deptNo 查询人员明细
* @param completeMonitorInfoVo
* @return
*/
@Operation(description = "根据项目查询人员明细")
@GetMapping("/empPage")
public R<IPage<TCompleteMonitorInfoVo>> getMonitorEmpInfoListPage(Page<TCompleteMonitorInfoVo> page, String deptNo) {
return new R<>(tCompleteMonitorService.getMonitorEmpInfoListPage(page,deptNo));
public R<IPage<TCompleteMonitorInfoVo>> getMonitorEmpInfoListPage(Page<TCompleteMonitorInfoVo> page, TCompleteMonitorInfoVo completeMonitorInfoVo) {
return new R<>(tCompleteMonitorService.getMonitorEmpInfoListPage(page,completeMonitorInfoVo));
}
/**
......
......@@ -142,7 +142,7 @@ public class TEmployeeInfoController {
@Operation(summary = "通过id查询", description = "通过id查询")
@GetMapping("/{id}")
public R<TEmployeeInfo> getById(@PathVariable("id") String id) {
return R.ok(tEmployeeInfoService.getById(id));
return tEmployeeInfoService.getByIdAssociate(id);
}
/**
......@@ -531,4 +531,18 @@ public class TEmployeeInfoController {
tEmployeeInfoService.updateEmployeeAgeTask();
}
/**
* @Author fxj
* @Description 人员档案附件信息导出
* @Date 15:15 2024/9/10
* @Param
* @return
**/
@Operation(summary = "导出人员档案附件信息ZIP包", description = "导出人员档案附件信息ZIP包")
@SysLog("导出人员档案附件信息ZIP包")
@PostMapping("/exportEmployeeFile/{id}")
public void exportEmployeeFile(@PathVariable("id") String id, HttpServletResponse response) throws Exception{
tEmployeeInfoService.exportEmployeeFile(id, response);
}
}
......@@ -60,10 +60,10 @@ public interface TCompleteMonitorMapper extends BaseMapper<TCompleteMonitor> {
/**
* 查询人员明细
* @param deptNo 项目编码
* @param completeMonitorInfoVo
* @return
*/
IPage<TCompleteMonitorInfoVo> getMonitorEmpInfoList(Page<TCompleteMonitorInfoVo> page,@Param("deptNo") String deptNo);
IPage<TCompleteMonitorInfoVo> getMonitorEmpInfoList(Page<TCompleteMonitorInfoVo> page,@Param("completeMonitorInfoVo") TCompleteMonitorInfoVo completeMonitorInfoVo);
/**
* 获取所有监控数据
......
......@@ -55,10 +55,10 @@ public interface TCompleteMonitorService extends IService<TCompleteMonitor> {
/**
* 档案完整度监控简单分页查询
* @param deptNo 项目编码
* @param completeMonitorInfoVo
* @return
*/
IPage<TCompleteMonitorInfoVo> getMonitorEmpInfoListPage(Page<TCompleteMonitorInfoVo> page, String deptNo);
IPage<TCompleteMonitorInfoVo> getMonitorEmpInfoListPage(Page<TCompleteMonitorInfoVo> page, TCompleteMonitorInfoVo completeMonitorInfoVo);
// 导出全量
void exportAll(HttpServletResponse response, TCompleteMonitorSearchVo searchVo);
......
......@@ -92,13 +92,13 @@ public interface TEmployeeInfoService extends IService<TEmployeeInfo> {
R<String> addNewEmployee(TEmployeeInfo employeeInfo);
/**
* @param employeeInfo
* @param tEmployeeInfo
* @Description: 更新档案信息
* @Author: hgw
* @Date: 2022/6/21 19:29
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.Boolean>
**/
R<Boolean> updateEmployee(TEmployeeInfo employeeInfo);
R<Boolean> updateEmployee(TEmployeeInfo tEmployeeInfo);
/**
* @param id
......@@ -256,4 +256,8 @@ public interface TEmployeeInfoService extends IService<TEmployeeInfo> {
void updateEmployeeAgeTask();
IPage<TEmployeeInfo> getPageAsso(Page<TEmployeeInfo> page, TEmployeeInfo tEmployeeInfo);
R<TEmployeeInfo> getByIdAssociate(String id);
void exportEmployeeFile(String id, HttpServletResponse response) throws Exception;
}
......@@ -180,12 +180,12 @@ public class TCompleteMonitorServiceImpl extends ServiceImpl<TCompleteMonitorMap
/**
* 档案完整度监控简单分页查询
* @param deptNo 项目编码
* @param completeMonitorInfoVo
* @return
*/
@Override
public IPage<TCompleteMonitorInfoVo> getMonitorEmpInfoListPage(Page<TCompleteMonitorInfoVo> page, String deptNo){
return baseMapper.getMonitorEmpInfoList(page,deptNo);
public IPage<TCompleteMonitorInfoVo> getMonitorEmpInfoListPage(Page<TCompleteMonitorInfoVo> page, TCompleteMonitorInfoVo completeMonitorInfoVo){
return baseMapper.getMonitorEmpInfoList(page,completeMonitorInfoVo);
}
@Override
......
......@@ -51,10 +51,20 @@ import com.yifu.cloud.plus.v1.yifu.common.dapr.util.HttpDaprUtil;
import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import lombok.RequiredArgsConstructor;
import lombok.extern.log4j.Log4j2;
import org.apache.commons.compress.archivers.zip.ZipArchiveEntry;
import org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream;
import org.apache.http.HttpEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.cache.Cache;
import org.springframework.cache.CacheManager;
import org.springframework.cache.support.SimpleValueWrapper;
import org.springframework.http.HttpHeaders;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
......@@ -62,6 +72,7 @@ import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.net.URLEncoder;
import java.time.LocalDateTime;
import java.util.*;
......@@ -91,7 +102,14 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
private final TEmployeeContractInfoService contractServicer;
private final TEmpOtherFileService otherFileService;
private final TAttaInfoService attaInfoService;
private final TEmpOtherFileService empOtherFileService;
@Autowired
private OSSUtil ossUtil;
@Override
public IPage<TEmployeeInfo> getPage(Page<TEmployeeInfo> page, TEmployeeInfo employeeInfo) {
......@@ -176,6 +194,7 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
@Override
public R<Boolean> updateEmployee(TEmployeeInfo employeeInfo) {
YifuUser user = SecurityUtils.getUser();
if (user == null || Common.isEmpty(user.getId())) {
return R.failed(CommonConstants.PLEASE_LOG_IN);
......@@ -187,6 +206,8 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
if (old == null || Common.isEmpty(old.getId())) {
return R.failed("根据id未找到档案!" + employeeInfo.getId());
}
// 获取历史附件信息 fxj 2024-09-09
getAttaInfo(old);
// 校验手机号:
if (Common.isEmpty(employeeInfo.getEmpPhone())) {
......@@ -227,11 +248,73 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
TEmpEducation education = new TEmpEducation();
this.doUpdateEducationCore(education, employeeInfo);
// 更新附件信息 fxj 2024-09-09
updateOtherAtta(employeeInfo);
// 获取最新附件信息 fxj 2024-09-09
getAttaInfo(employeeInfo);
// 记录变更日志
tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[0], old.getId(), "", old, employeeInfo);
return R.ok(this.updateById(employeeInfo));
}
private void updateOtherAtta(TEmployeeInfo employeeInfo) {
List<TEmpOtherFile> otherFileList = employeeInfo.getOtherFiles();
if (Common.isNotNull(otherFileList)){
List<TAttaInfo> attaInfos = new ArrayList<>();
for (TEmpOtherFile otherFile:otherFileList){
//处理新增或删除其他附件分租的逻辑
handleOtherFile(otherFile);
if (Common.isNotNull(otherFile.getAttaList())){
attaInfos.addAll(otherFile.getAttaList());
}
}
if (Common.isNotNull(attaInfos)){
List<String> deleteIds = new ArrayList<>();
List<TAttaInfo> adds = new ArrayList<>();
for (TAttaInfo attaInfo:attaInfos){
if (CommonConstants.ZERO_STRING.equals(attaInfo.getHandleType())){
adds.add(attaInfo);
}
if (CommonConstants.ONE_STRING.equals(attaInfo.getHandleType())){
deleteIds.add(attaInfo.getId());
}
}
if (Common.isNotNull(deleteIds)){
attaInfoService.removeBatchByIds(deleteIds);
}
if (Common.isNotNull(adds)){
attaInfoService.saveBatch(adds);
}
}
}
}
private void handleOtherFile(TEmpOtherFile otherFile) {
// 新增时先增加 empOtherFile
if (CommonConstants.ZERO_STRING.equals(otherFile.getHandleType())){
empOtherFileService.save(otherFile);
if (Common.isNotNull(otherFile.getAttaList())){
for (TAttaInfo info: otherFile.getAttaList()){
info.setDomainId(otherFile.getId());
}
}
// 删除时
}else if (CommonConstants.TWO_STRING.equals(otherFile.getHandleType())){
empOtherFileService.removeById(otherFile.getId());
}
}
private void getAttaInfo(TEmployeeInfo emp) {
List<TEmpOtherFile> otherFiles = otherFileService.getListByEmpId(emp.getId());
if (Common.isEmpty(otherFiles)){
for (TEmpOtherFile file:otherFiles){
file.setAttaList(attaInfoService.list(Wrappers.<TAttaInfo>query().lambda().eq(TAttaInfo::getDomainId,file.getId())));
}
}
emp.setOtherFiles(otherFiles);
}
@Override
public R<String> deleteEmployee(String id) {
TEmployeeInfo employee = this.getById(id);
......@@ -2617,4 +2700,136 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
public IPage<TEmployeeInfo> getPageAsso(Page<TEmployeeInfo> page, TEmployeeInfo employeeInfo) {
return baseMapper.getPageAsso(page, employeeInfo);
}
@Override
public R<TEmployeeInfo> getByIdAssociate(String id) {
if (Common.isEmpty(id)){
return R.failed(CommonConstants.PARAM_INFO_ERROR);
}
TEmployeeInfo employeeInfo = baseMapper.selectById(id);
if (Common.isEmpty(employeeInfo)){
return R.failed(CommonConstants.NO_DATA_TO_HANDLE);
}
getAttaInfo(employeeInfo);
return R.ok(employeeInfo);
}
/**
* @Author fxj
* @Description 获取人员档案附件信息下载ZIP
* @Date 11:13 2024/9/10
* @Param
* @return
**/
@Override
public void exportEmployeeFile(String id, HttpServletResponse response) throws Exception{
if (Common.isEmpty(id)){
throw new RuntimeException(CommonConstants.PARAM_IS_NOT_ERROR);
}
TEmployeeInfo emp = baseMapper.selectById(id);
if (Common.isEmpty(emp)){
throw new RuntimeException(CommonConstants.NO_DATA_TO_HANDLE);
}
List<TAttaInfo> handles = new ArrayList<>();
HttpGet httpGet;
//初始化导出 response
response.setContentType("application/octet-stream");
response.setHeader("content-type","application/octet-stream");
response.setHeader(HttpHeaders.CONTENT_DISPOSITION,"attachment; filename="+URLEncoder.encode(emp.getEmpName()+emp.getEmpIdcard(),"UTF-8")+".zip");
ZipArchiveOutputStream zipOutput = new ZipArchiveOutputStream(response.getOutputStream());
CloseableHttpClient httpClient = HttpClients.createDefault();
// 获取人员档案所有的附件信息
getFilesInfo(id, handles);
// 处理附件 压缩并下载
if (Common.isNotNull(handles)){
try {
CloseableHttpResponse response1;
HttpEntity entity;
byte[] data;
HashMap<String,Integer> groupNameMap = new HashMap<>();
ZipArchiveEntry entry;
for (TAttaInfo fileAtta:handles){
httpGet = new HttpGet(fileAtta.getAttaUrl());
response1 = httpClient.execute(httpGet);
entity = response1.getEntity();
data = EntityUtils.toByteArray(entity);
entry = new ZipArchiveEntry(initFileName(fileAtta,groupNameMap));
zipOutput.putArchiveEntry(entry);
zipOutput.write(data);
zipOutput.closeArchiveEntry();
}
zipOutput.finish();
} catch (Exception e) {
e.printStackTrace();
}
}
}
private void getFilesInfo(String id, List<TAttaInfo> handles) {
List<TAttaInfo> attas;
URL url;
// 获取其他附件
List<TEmpOtherFile> otherFiles = otherFileService.list(Wrappers.<TEmpOtherFile>query().lambda().eq(TEmpOtherFile::getEmpId, id));
if (Common.isNotNull(otherFiles)){
try {
for (TEmpOtherFile otherFile:otherFiles){
attas = attaInfoService.list(Wrappers.<TAttaInfo>query().lambda().eq(TAttaInfo::getDomainId,otherFile.getId()));
if (Common.isNotNull(attas)){
for (TAttaInfo atta:attas){
url = ossUtil.getObjectUrl(null, atta.getAttaSrc());
atta.setAttaUrl(url.toString().replace("http","https"));
atta.setGroupName(otherFile.getAttaName());
handles.add(atta);
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
// 获取其他附件以外的附件如身份证正反面
attas = attaInfoService.list(Wrappers.<TAttaInfo>query().lambda().eq(TAttaInfo::getDomainId, id));
if (Common.isNotNull(attas)) {
for (TAttaInfo atta:attas){
if (CommonConstants.TWENTY_THREE_STRING.equals(atta.getRelationType())){
continue;
}
url = ossUtil.getObjectUrl(null, atta.getAttaSrc());
atta.setAttaUrl(url.toString().replace("http","https"));
handles.add(atta);
}
}
}
private String initFileName(TAttaInfo fileAtta,HashMap<String,Integer> groupNameMap ) {
/**
* 关系类型(0客户附件1联系人附件2跟进记录附件3合同附件4合同归档附件5报价单6招投标7业务评估8二维码9身份证 10 户口本
* ;21(预入职申明签名);22(预入职确认签名);23(预入职pdf文件);0(最高教育经历);2(执业资格证书);24 身份证国徽
* 25 户口本本人页26学信27预入职其他附件
*/
if (CommonConstants.NINE_STRING.equals(fileAtta.getRelationType())){
return "身份证1"+fileAtta.getAttaType();
}else if (CommonConstants.TWENTY_FOUR_STRING.equals(fileAtta.getRelationType())){
return "身份证2"+fileAtta.getAttaType();
}else if (CommonConstants.TWENTY_ONE_STRING.equals(fileAtta.getRelationType())){
return "签名1"+fileAtta.getAttaType();
}else if (CommonConstants.TWENTY_TWO_STRING.equals(fileAtta.getRelationType())){
return "签名2"+fileAtta.getAttaType();
}else if (CommonConstants.TEN_STRING.equals(fileAtta.getRelationType())){
return "户口本1"+fileAtta.getAttaType();
}else if (CommonConstants.TWENTY_FIVE_STRING.equals(fileAtta.getRelationType())){
return "户口本2"+fileAtta.getAttaType();
}else if (CommonConstants.TWENTY_SEVEN_STRING.equals(fileAtta.getRelationType())){
if (Common.isNotNull(fileAtta.getGroupName())){
if (Common.isNotNull(groupNameMap.get(fileAtta.getGroupName()))){
groupNameMap.put(fileAtta.getGroupName(),groupNameMap.get(fileAtta.getGroupName())+1);
}else {
groupNameMap.put(fileAtta.getGroupName(),1);
}
return fileAtta.getGroupName() + groupNameMap.get(fileAtta.getGroupName())+fileAtta.getAttaType();
}
return fileAtta.getGroupName()+fileAtta.getAttaType();
}else {
return fileAtta.getAttaName();
}
}
}
......@@ -1447,7 +1447,7 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
employee.setEmpPhone(vo.getMobile());
}
if(Common.isEmpty(vo.getFlag())){
employee.setIsCollege(CommonConstants.ONE_INT);
employee.setIsCollege(CommonConstants.ZERO_INT);
if (Common.isNotNull(vo.getHighEducation())) {
employee.setHignEducation(vo.getHighEducation());
if ("5".equals(employee.getHignEducation())
......
......@@ -150,7 +150,27 @@
from
t_employee_project a
left join t_employee_info b on a.EMP_ID = b.id
where a.DELETE_FLAG = '0' and a.project_status = 0 and a.dept_no = #{deptNo} order by a.CREATE_TIME desc
where a.DELETE_FLAG = '0'
and a.project_status = 0
<if test="completeMonitorInfoVo.deptNo != null and completeMonitorInfoVo.deptNo.trim() != ''">
and a.dept_no = #{completeMonitorInfoVo.deptNo}
</if>
<if test="completeMonitorInfoVo.empName != null and completeMonitorInfoVo.empName.trim() != ''">
and a.EMP_NAME = #{completeMonitorInfoVo.empName}
</if>
<if test="completeMonitorInfoVo.phone != null and completeMonitorInfoVo.phone.trim() != ''">
and a.EMP_PHONE = #{completeMonitorInfoVo.phone}
</if>
<if test="completeMonitorInfoVo.isComplete != null and completeMonitorInfoVo.isComplete.trim() != ''">
and a.IS_COMPLETE = #{completeMonitorInfoVo.isComplete}
</if>
<if test="completeMonitorInfoVo.inTimeStart != null">
AND a.CREATE_TIME <![CDATA[ >= ]]> #{completeMonitorInfoVo.inTimeStart}
</if>
<if test="completeMonitorInfoVo.inTimeEnd != null">
AND a.CREATE_TIME <![CDATA[ <= ]]> #{completeMonitorInfoVo.inTimeEnd}
</if>
order by a.CREATE_TIME desc
</select>
<!--生成数据封装-->
......
......@@ -1201,7 +1201,7 @@
<if test="tEmployeeInfo.major != null">MAJOR=#{tEmployeeInfo.major},</if>
<if test="tEmployeeInfo.gradutionDate != null">GRADUTION_DATE=#{tEmployeeInfo.gradutionDate},</if>
<if test="tEmployeeInfo.contactAddress != null">CONTACT_ADDRESS=#{tEmployeeInfo.contactAddress},</if>
<if test="tEmployeeInfo.isCollege != null">IS_COLLEGE='1',</if>
<if test="tEmployeeInfo.isCollege != null">IS_COLLEGE=#{tEmployeeInfo.isCollege},</if>
<if test="tEmployeeInfo.fileProvince != null">a.FILE_PROVINCE=#{tEmployeeInfo.fileProvince},</if>
<if test="tEmployeeInfo.fileCity != null">a.FILE_CITY=#{tEmployeeInfo.fileCity},</if>
<if test="tEmployeeInfo.fileCity != null">
......
......@@ -146,6 +146,16 @@ public interface CommonConstants {
String SIXTEEN_STRING = "16";
String TWENTY_TWO_STRING = "22";
String TWENTY_THREE_STRING = "23";
String TWENTY_FOUR_STRING = "24";
String TWENTY_FIVE_STRING = "25";
String TWENTY_SEVEN_STRING = "27";
public static final String DEFAULT_PASSWORD = "123456";
/**
......@@ -507,7 +517,7 @@ public interface CommonConstants {
public static final String TWENTY_STRING = "20";
public static final int TWENTY_ONE_STRING = 21;
public static final String TWENTY_ONE_STRING = "21";
public static final String ERROR_MSG_PRFIX = "error=";
......
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