Commit 5b0899d4 authored by fangxinjiang's avatar fangxinjiang

预入职下载-fxj

parent 7ad6ca9e
...@@ -529,9 +529,9 @@ public class TSettleDomain extends BaseEntity { ...@@ -529,9 +529,9 @@ public class TSettleDomain extends BaseEntity {
private String secondIndicatorBelong ; private String secondIndicatorBelong ;
/** /**
* 是否含险金 fxj 2025-01-10 v1.7.5 * 是否含风险 fxj 2025-01-10 v1.7.5
*/ */
@Schema(description = "是否含险金",name = "hasContainRisks") @Schema(description = "是否含风险",name = "hasContainRisks")
private String hasContainRisks; private String hasContainRisks;
/** /**
* 事业部条线 fxj 2025-01-10 v1.7.5 * 事业部条线 fxj 2025-01-10 v1.7.5
......
package com.yifu.cloud.plus.v1.yifu.archives.vo;
import com.baomidou.mybatisplus.annotation.TableField;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TAttaInfo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
/**
* @Author fxj
* @Description 附件信息表
* @Date 11:07 2022/6/22
**/
@Data
public class TAttaInfoVo extends TAttaInfo {
private static final long serialVersionUID = 1L;
/**
* 其他分租名称
*/
@TableField(exist = false)
private String groupName;
/**
* 姓名
*/
@Schema(description = "姓名")
private String empName;
/**
* 身份证
*/
@Schema(description = "身份证")
private String empIdcard;
}
...@@ -449,9 +449,9 @@ public class TSettleDomainEkpVo implements Serializable { ...@@ -449,9 +449,9 @@ public class TSettleDomainEkpVo implements Serializable {
private String secondIndicatorBelong ; private String secondIndicatorBelong ;
/** /**
* 是否含险金 * 是否含风险
*/ */
@Schema(description = "是否含险金",name = "hasContainRisks") @Schema(description = "是否含风险",name = "hasContainRisks")
private String hasContainRisks; private String hasContainRisks;
/** /**
* 事业部条线 * 事业部条线
......
...@@ -322,5 +322,38 @@ public class TPreEmpMainController { ...@@ -322,5 +322,38 @@ public class TPreEmpMainController {
} }
return tPreEmpMainService.checkCode(empPhone, verifyCode); return tPreEmpMainService.checkCode(empPhone, verifyCode);
} }
/**
* @Author fxj
* @Description 预入职C端签名图盘打包下载
* @Date 14:07 2025/1/10
* @Param
* @return
**/
@Operation(summary = "预入职C端签名图盘打包下载ZIP包", description = "预入职C端签名图盘打包下载ZIP包")
@SysLog("预入职C端签名图盘打包下载ZIP包")
@GetMapping("/preEmpExport")
public void preEmpExport(@RequestParam(value = "departNo",required = true) String departNo,
@RequestParam(value ="departName",required = true) String departName,
@RequestParam(value ="startDate",required = true) String startDate,
@RequestParam(value ="endDate",required = true) String endDate,
HttpServletResponse response) throws Exception{
tPreEmpMainService.exportEmpsFile(departName,departNo,startDate,endDate, response);
}
/**
* @Author fxj
* @Description 预入职C端签名图盘打包下载 count
* @Date 14:07 2025/1/10
* @Param
* @return
**/
@Operation(summary = "预入职C端签名图盘打包下载ZIP包count", description = "预入职C端签名图盘打包下载ZIP包count")
@SysLog("预入职C端签名图盘打包下载ZIP包count")
@GetMapping("/preEmpCount")
public R preEmpCount(@RequestParam(value ="departNo",required = true) String departNo,
@RequestParam(value ="startDate",required = true) String startDate,
@RequestParam(value ="endDate",required = true) String endDate,
HttpServletResponse response) throws Exception{
return tPreEmpMainService.preEmpCount(departNo,startDate,endDate);
}
} }
...@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; ...@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TAttaInfo; import com.yifu.cloud.plus.v1.yifu.archives.entity.TAttaInfo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TAttaInfoVo;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
...@@ -51,4 +52,7 @@ public interface TAttaInfoMapper extends BaseMapper<TAttaInfo> { ...@@ -51,4 +52,7 @@ public interface TAttaInfoMapper extends BaseMapper<TAttaInfo> {
// 删除学历与职业资格之外的附件 // 删除学历与职业资格之外的附件
void deleteByDomainIdAndOther(@Param("domainId") String domainId); void deleteByDomainIdAndOther(@Param("domainId") String domainId);
List<TAttaInfoVo> getAttInfoByParam(@Param("departNo")String departNo, @Param("startDate")String startDate, @Param("endDate")String endDate);
int getAttInfoCountByParam(@Param("departNo")String departNo, @Param("startDate")String startDate, @Param("endDate")String endDate);
} }
...@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage; ...@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TAttaInfo; import com.yifu.cloud.plus.v1.yifu.archives.entity.TAttaInfo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TAttaInfoVo;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R; import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import java.time.LocalDateTime; import java.time.LocalDateTime;
...@@ -83,4 +84,7 @@ public interface TAttaInfoService extends IService<TAttaInfo> { ...@@ -83,4 +84,7 @@ public interface TAttaInfoService extends IService<TAttaInfo> {
void deleteByDomainIdAndType(String domainId, int relationType); void deleteByDomainIdAndType(String domainId, int relationType);
List<TAttaInfoVo> getAttInfoByParam(String departNo, String startDate, String endDate);
int getAttInfoCountByParam(String departNo, String startDate, String endDate);
} }
...@@ -131,4 +131,7 @@ public interface TPreEmpMainService extends IService<TPreEmpMain> { ...@@ -131,4 +131,7 @@ public interface TPreEmpMainService extends IService<TPreEmpMain> {
*/ */
R<String> checkCode(String empPhone, String verifyCode); R<String> checkCode(String empPhone, String verifyCode);
void exportEmpsFile(String departName,String departNo, String startDate, String endDate, HttpServletResponse response);
R preEmpCount(String departNo, String startDate, String endDate);
} }
...@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; ...@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TAttaInfo; import com.yifu.cloud.plus.v1.yifu.archives.entity.TAttaInfo;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.TAttaInfoMapper; import com.yifu.cloud.plus.v1.yifu.archives.mapper.TAttaInfoMapper;
import com.yifu.cloud.plus.v1.yifu.archives.service.TAttaInfoService; import com.yifu.cloud.plus.v1.yifu.archives.service.TAttaInfoService;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TAttaInfoVo;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common; 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.OSSUtil;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R; import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
...@@ -154,4 +155,13 @@ public class TAttaInfoServiceImpl extends ServiceImpl<TAttaInfoMapper, TAttaInfo ...@@ -154,4 +155,13 @@ public class TAttaInfoServiceImpl extends ServiceImpl<TAttaInfoMapper, TAttaInfo
} }
} }
@Override
public List<TAttaInfoVo> getAttInfoByParam(String departNo, String startDate, String endDate) {
return baseMapper.getAttInfoByParam(departNo,startDate,endDate);
}
@Override
public int getAttInfoCountByParam(String departNo, String startDate, String endDate) {
return baseMapper.getAttInfoCountByParam(departNo,startDate,endDate);
}
} }
...@@ -61,8 +61,17 @@ import com.yifu.cloud.plus.v1.yifu.salary.vo.ListStringVo; ...@@ -61,8 +61,17 @@ import com.yifu.cloud.plus.v1.yifu.salary.vo.ListStringVo;
import com.yifu.cloud.plus.v1.yifu.salary.vo.TBankNameMapVo; import com.yifu.cloud.plus.v1.yifu.salary.vo.TBankNameMapVo;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.log4j.Log4j2; import lombok.extern.log4j.Log4j2;
import org.apache.commons.compress.archivers.zip.ZipArchiveEntry;
import org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream;
import org.apache.commons.compress.utils.Lists; import org.apache.commons.compress.utils.Lists;
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.boot.context.properties.EnableConfigurationProperties; import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.http.HttpHeaders;
import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.AuthorityUtils; import org.springframework.security.core.authority.AuthorityUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -164,6 +173,8 @@ public class TPreEmpMainServiceImpl extends ServiceImpl<TPreEmpMainMapper, TPreE ...@@ -164,6 +173,8 @@ public class TPreEmpMainServiceImpl extends ServiceImpl<TPreEmpMainMapper, TPreE
private final AtomicInteger preImportAtomicInteger = new AtomicInteger(0); private final AtomicInteger preImportAtomicInteger = new AtomicInteger(0);
private final AtomicInteger preExportAtomicInteger = new AtomicInteger(0); private final AtomicInteger preExportAtomicInteger = new AtomicInteger(0);
private final AtomicInteger zipAtomicInteger = new AtomicInteger(0);
/** /**
* 预入职-主表简单分页查询 * 预入职-主表简单分页查询
* *
...@@ -4282,6 +4293,118 @@ public class TPreEmpMainServiceImpl extends ServiceImpl<TPreEmpMainMapper, TPreE ...@@ -4282,6 +4293,118 @@ public class TPreEmpMainServiceImpl extends ServiceImpl<TPreEmpMainMapper, TPreE
redisUtil.remove(phoneCodeKey); redisUtil.remove(phoneCodeKey);
return R.ok("验证码通过"); return R.ok("验证码通过");
}
@Override
public R preEmpCount(String departNo, String startDate, String endDate){
if (Common.isEmpty(departNo)
|| Common.isEmpty(startDate)
|| Common.isEmpty(endDate)
|| DateUtil.isDate(startDate)
|| DateUtil.isDate(endDate)) {
return R.failed(CommonConstants.PARAM_IS_NOT_ERROR);
}
return R.ok(tAttaInfoService.getAttInfoCountByParam(departNo,startDate,endDate));
}
/**
* @Author fxj
* @Description 预入职C端签名图盘打包下载
* @Date 14:07 2025/1/10
* @Param
* @return
**/
@Override
public void exportEmpsFile(String departName,String departNo, String startDate, String endDate, HttpServletResponse response) {
if (zipAtomicInteger.incrementAndGet() <= 1) {
try {
extracted(departName, departNo, startDate, endDate, response);
} catch (Exception e) {
log.error("导出异常:", e);
} finally {
zipAtomicInteger.decrementAndGet();
}
} else {
// 前面做了+1(atomicInteger.incrementAndGet())这里也要-1
zipAtomicInteger.decrementAndGet();
log.error("预入职签名文件导出超出阈值:" + ResultConstants.FILE_DOWN_LOAD_DATA);
exportError(response, ResultConstants.FILE_DOWN_LOAD_DATA);
}
} }
private void extracted(String departName, String departNo, String startDate, String endDate, HttpServletResponse response) {
if (Common.isEmpty(departNo)
|| Common.isEmpty(startDate)
|| Common.isEmpty(endDate)
|| DateUtil.isDate(startDate)
|| DateUtil.isDate(endDate)) {
throw new RuntimeException(CommonConstants.PARAM_IS_NOT_ERROR);
}
List<TAttaInfoVo> handles = tAttaInfoService.getAttInfoByParam(departNo, startDate, endDate);
if (Common.isEmpty(handles)) {
throw new RuntimeException(CommonConstants.NO_DATA_TO_HANDLE);
}
// 判断文件大小 超出100M 104,857,600 直接提示重新筛选条件
long size = 0;
if (Common.isNotNull(handles)){
for (TAttaInfoVo vo:handles){
size = size + vo.getAttaSize();
}
if (size > 104857600){
exportError(response, CommonConstants.DATA_TOO_LARGER_FOR_DOWN);
}
}
HttpGet httpGet;
try {
//初始化导出 response
response.setContentType("application/octet-stream");
response.setHeader("content-type", "application/octet-stream");
response.setHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=" + URLEncoder.encode(departName + departNo, "UTF-8") + ".zip");
ZipArchiveOutputStream zipOutput = null;
zipOutput = new ZipArchiveOutputStream(response.getOutputStream());
CloseableHttpClient httpClient = HttpClients.createDefault();
// 获取人员档案所有的附件信息
getFilesInfo(handles);
// 处理附件 压缩并下载
if (Common.isNotNull(handles)) {
try {
CloseableHttpResponse response1;
HttpEntity entity;
byte[] data;
ZipArchiveEntry entry;
for (TAttaInfoVo fileAtta : handles) {
if (Common.isNotNull(fileAtta.getAttaUrl())){
httpGet = new HttpGet(fileAtta.getAttaUrl());
response1 = httpClient.execute(httpGet);
entity = response1.getEntity();
data = EntityUtils.toByteArray(entity);
entry = new ZipArchiveEntry(fileAtta.getEmpName() + fileAtta.getEmpIdcard() + ".png");
zipOutput.putArchiveEntry(entry);
zipOutput.write(data);
zipOutput.closeArchiveEntry();
}
}
zipOutput.finish();
} catch (Exception e) {
e.printStackTrace();
}
}
} catch (IOException e) {
e.printStackTrace();
}
}
private void getFilesInfo(List<TAttaInfoVo> handles) {
URL url;
// 获取其他附件以外的附件如身份证正反面
if (Common.isNotNull(handles)) {
for (TAttaInfoVo atta : handles) {
if (CommonConstants.TWENTY_THREE_STRING.equals(atta.getRelationType())) {
url = ossUtil.getObjectUrl(null, atta.getAttaSrc());
atta.setAttaUrl(url.toString().replace("http", "https"));
}
}
}
}
} }
...@@ -134,5 +134,32 @@ ...@@ -134,5 +134,32 @@
<delete id="deleteByDomainIdAndOther"> <delete id="deleteByDomainIdAndOther">
delete from t_atta_info where domain_id=#{domainId} and relation_type not in ('0','2','26','27') delete from t_atta_info where domain_id=#{domainId} and relation_type not in ('0','2','26','27')
</delete> </delete>
<select id="getAttInfoByParam" resultType="com.yifu.cloud.plus.v1.yifu.archives.vo.TAttaInfoVo">
SELECT
b.id,
b.atta_name,
b.atta_src,
b.atta_size,
b.atta_type,
b.create_by,
b.create_time,
b.relation_type,
b.domain_id, a.EMP_NAME,a.EMP_IDCARD
from (select id,EMP_NAME,EMP_IDCARD from t_pre_emp_main where `STATUS`='4' and SOUR_TYPE='0'
and DEPT_NO=#{departNo}
and AUDIT_TIME >= #{startDate}
and AUDIT_TIME <![CDATA[ <= ]]> #{endDate}) a
LEFT JOIN (select * from t_atta_info where RELATION_TYPE ='23' GROUP BY DOMAIN_ID ) b on a.id=b.DOMAIN_ID
where b.DOMAIN_ID is not null LIMIT 100
</select>
<select id="getAttInfoCountByParam" resultType="java.lang.Integer">
SELECT
count(1)
from (select id from t_pre_emp_main where `STATUS`='4' and SOUR_TYPE='0'
and DEPT_NO = #{departNo}
and AUDIT_TIME >= #{startDate}
and AUDIT_TIME <![CDATA[ <= ]]> #{endDate}) a
LEFT JOIN (select * from t_atta_info where RELATION_TYPE ='23' GROUP BY DOMAIN_ID ) b on a.id=b.DOMAIN_ID
where b.DOMAIN_ID is not null
</select>
</mapper> </mapper>
...@@ -126,7 +126,6 @@ public class YifuWxLoginSuccessHandler implements AuthenticationSuccessHandler { ...@@ -126,7 +126,6 @@ public class YifuWxLoginSuccessHandler implements AuthenticationSuccessHandler {
response.setStatus(HttpStatus.HTTP_OK); response.setStatus(HttpStatus.HTTP_OK);
PrintWriter printWriter = response.getWriter(); PrintWriter printWriter = response.getWriter();
printWriter.append(objectMapper.writeValueAsString(result)); printWriter.append(objectMapper.writeValueAsString(result));
log.info("登录成功返回结果1111111:"+objectMapper.writeValueAsString(result));
} }
} }
...@@ -343,6 +343,8 @@ public interface CommonConstants { ...@@ -343,6 +343,8 @@ public interface CommonConstants {
String NO_DATA_TO_HANDLE = "无数据可操作!"; String NO_DATA_TO_HANDLE = "无数据可操作!";
String DATA_TOO_LARGER_FOR_DOWN = "下载数据超出100M,请重现选择下载条件!";
String PLEASE_LOG_IN = "请登录!"; String PLEASE_LOG_IN = "请登录!";
String SEX_MAN = "1"; String SEX_MAN = "1";
......
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