Commit 1f512df4 authored by huyuchen's avatar huyuchen

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

parents 23e658ce 8da05fc2
/*
* 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.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttributeConstants;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 瓜子档案表——导出主表
*
* @author hgw
* @date 2025-6-18 15:15:15
*/
@Data
public class TGzEmpInfoExportMain implements Serializable {
// 流程ID 姓名 证件号码 个人手机号 职务描述 员工档案提交时间 档案推送瓜子状态 合同信息推送瓜子状态
// 合同附件推送瓜子状态 姓拼音/名拼音 出生日期 性别 星座 血型 首次工作日期 国籍 籍贯 民族
@ExcelProperty("流程ID")
private String bizId;
@ExcelProperty("姓名")
private String name;
@ExcelProperty("证件号码")
private String nationalId;
@ExcelProperty("个人手机号")
private String phone;
// 关联offer查——关联字段:offerId
@ExcelProperty("职务描述")
private String jobcodeDescr;
// 格式化
@ExcelProperty("员工档案提交时间")
private String createTime;
@ExcelAttribute(name = "档案推送瓜子状态", isDataId = true, readConverterExp = "0=待推送,1=已推送")
@ExcelProperty("档案推送瓜子状态")
private String empPushStatus;
@ExcelAttribute(name = "合同信息推送瓜子状态", isDataId = true, readConverterExp = "0=待推送,1=已推送")
@ExcelProperty("合同信息推送瓜子状态")
private String contractPushStatus;
@ExcelAttribute(name = "合同附件推送瓜子状态", isDataId = true, readConverterExp = "0=待推送,1=已推送")
@ExcelProperty("合同附件推送瓜子状态")
private String contractAttaPushStatus;
// 2025-6-18 16:10:15 —— 待倩倩确认———倩倩找瓜子——瓜子说不要回传,因此改为“姓名拼音”
@ExcelProperty("姓名拼音")
private String nameAc;
// 日期格式化
@ExcelProperty("出生日期")
private String birthdate;
@ExcelAttribute(name = "性别", isDataId = true, dataType = ExcelAttributeConstants.GZ_SEX)
@ExcelProperty("性别")
private String sex;
@ExcelProperty("星座")
private String constel;
@ExcelProperty("血型")
private String bloodType;
@ExcelProperty("首次工作日期")
@Schema(description = "首次工作日期")
private Date startDate;
@ExcelAttribute(name = "国籍", isDataId = true, dataType = ExcelAttributeConstants.GZ_COUNTRY)
@ExcelProperty("国籍")
private String country;
@ExcelProperty("籍贯(瓜子可用)")
private String nativePlace;
// 格式化
@ExcelAttribute(name = "籍贯", isArea = true)
@ExcelProperty("籍贯")
private String nativePlaceAreaId;
@ExcelAttribute(name = "民族", isDataId = true, dataType = ExcelAttributeConstants.GZ_ETHNIC_GRP_CD)
@ExcelProperty("民族")
private String ethnicGrpCd;
// 政治面貌 婚姻状态 驾照类型 驾照失效日期 是否新参社保 证件类型 证件号码 证件有效期开始日期
// 证件有效期结束日期 是否永久有效 移动电话 个人邮箱 地址类型 所在省 所在市 所在区 详细地址
// 紧急联系人姓名 与本人关系 紧急联系人电话 联系人住址 是否主要联系人: Y:是,N不是
@ExcelAttribute(name = "政治面貌", isDataId = true, dataType = ExcelAttributeConstants.GZ_POLITICAL_STA)
@ExcelProperty("政治面貌")
private String politicalSta;
@ExcelAttribute(name = "婚姻状态", isDataId = true, dataType = ExcelAttributeConstants.GZ_MAR_STATUS)
@ExcelProperty("婚姻状态")
@Schema(description = "婚姻状态")
private String marStatus;
@ExcelAttribute(name = "驾照类型", isDataId = true, dataType = ExcelAttributeConstants.GZ_DRIVER_TYPE)
@ExcelProperty("驾照类型")
private String driverType;
// 日期格式化
@ExcelProperty("驾照失效日期")
private String driverLicenExp;
@ExcelAttribute(name = "是否新参社保", isDataId = true, readConverterExp = "Y=是,N=否")
@ExcelProperty("是否新参社保")
private String insuranceSta;
@ExcelAttribute(name = "证件类型", isDataId = true, dataType = ExcelAttributeConstants.GZ_NATIONAL_ID_TYPE)
@ExcelProperty("证件类型")
private String nationalIdType;
// 模板重复了
/*ExcelProperty("证件号码")
private String nationalId*/
// 日期格式化
@ExcelProperty("证件有效期开始日期")
private Date nidStartDate;
// 日期格式化
@ExcelProperty("证件有效期结束日期")
private Date nidExpiryDate;
@ExcelAttribute(name = "是否永久有效", isDataId = true, readConverterExp = "Y=是,N=否")
@ExcelProperty("是否永久有效")
private String persistFlag;
// 模板重复了
/*ExcelProperty("移动电话")
private String phone*/
@ExcelProperty("个人邮箱")
private String mail;
@ExcelProperty("地址类型")
private String addressType;
@ExcelProperty("家庭住址-所在省编码")
private String stateId;
@ExcelProperty("家庭住址-所在市编码")
private String cityId;
@ExcelProperty("家庭住址-所在区编码")
private String countyId;
@ExcelAttribute(name = "家庭住址-所在省", isArea = true)
@ExcelProperty("家庭住址-所在省")
private String stateAreaId;
@ExcelAttribute(name = "家庭住址-所在市", isArea = true, parentField = "stateAreaId")
@ExcelProperty("家庭住址-所在市")
private String cityAreaId;
@ExcelAttribute(name = "家庭住址-所在区", isArea = true, parentField = "cityAreaId")
@ExcelProperty("家庭住址-所在区")
private String countyAreaId;
@ExcelProperty("家庭住址-详细地址")
private String address;
// 附属表——紧急联系人:
@ExcelProperty("紧急联系人姓名")
private String emergName;
@ExcelAttribute(name = "与本人关系", isDataId = true, dataType = ExcelAttributeConstants.GZ_EMERG_RELATION)
@ExcelProperty("与本人关系")
private String emergRelation;
@ExcelProperty("紧急联系人电话")
private String emergPhone;
@ExcelProperty("联系人住址")
private String emergAddress;
@ExcelAttribute(name = "是否主要联系人", isDataId = true, readConverterExp = "Y=是,N=不是")
@ExcelProperty("是否主要联系人")
private String primaryNid;
// 合同签署方式 合同编号
// 合同类型 合同签订类型 合同签订日期 合同开始日期 合同预计结束日期 合同结束日期 试用期 试用期预计结束日期
// 预计转正日期 合同签署主体 合同工作地 状态
@ExcelAttribute(name = "合同签署方式", isDataId = true, dataType = ExcelAttributeConstants.GZ_SGINATURE_METHOD)
@ExcelProperty("合同签署方式")
private String sginatureMethod;
@ExcelProperty("合同编号")
private String contractNum;
@ExcelAttribute(name = "合同类型", isDataId = true, dataType = ExcelAttributeConstants.GZ_CONTRACT_TYPE)
@ExcelProperty("合同类型")
private String contractType;
@ExcelAttribute(name = "合同签订类型", isDataId = true, dataType = ExcelAttributeConstants.GZ_SGINATURE_TYPE)
@ExcelProperty("合同签订类型")
private String sginatureType;
// 日期格式化
@ExcelProperty("合同签订日期")
private String sginatureDt;
// 日期格式化
@ExcelProperty("合同开始日期")
private String contractBeginDt;
// 日期格式化
@ExcelProperty("合同预计结束日期")
private String contractExpEndDt;
// 日期格式化
@ExcelProperty("合同结束日期")
private String contractEndDt;
@ExcelProperty("试用期")
private String probation;
// 日期格式化
@ExcelProperty("试用期预计结束日期")
private String prcExpDt;
// 日期格式化
@ExcelProperty("预计转正日期")
private String probationDt;
@ExcelProperty("合同签署主体")
private String neeProviderId;
@ExcelProperty("合同工作地")
private String workLocation;
@ExcelAttribute(name = "合同状态", isDataId = true, readConverterExp = "A=有效")
@ExcelProperty("合同状态")
private String contractState;
// 户口类型 国家 省 市 区/县 户口具体地址 银行账户类型 状态
// 国家/地区 银行
@ExcelAttribute(name = "户口类型", isDataId = true, dataType = ExcelAttributeConstants.GZ_HUKOU_TYPE)
@ExcelProperty("户口类型")
private String hukouType;
@ExcelProperty("户口-所在省编码")
private String hukouProvince;
@ExcelProperty("户口-所在市编码")
private String hukouCity;
@ExcelProperty("户口-所在区编码")
private String hukouCounty;
@ExcelAttribute(name = "户口-所在省", isArea = true)
@ExcelProperty("户口-所在省")
private String hukouProvinceAreaId;
@ExcelAttribute(name = "户口-所在市", isArea = true, parentField = "hukouProvinceAreaId")
@ExcelProperty("户口-所在市")
private String hukouCityAreaId;
@ExcelAttribute(name = "户口-所在区", isArea = true, parentField = "hukouCityAreaId")
@ExcelProperty("户口-所在区")
private String hukouCountyAreaId;
@ExcelProperty("户口具体地址")
private String hukouDetail;
@ExcelAttribute(name = "银行账户类型", isDataId = true, dataType = ExcelAttributeConstants.GZ_ACCOUNT_TYPE)
@ExcelProperty("银行账户类型")
private String accountType;
@ExcelAttribute(name = "银行账户状态", isDataId = true, readConverterExp = "A=有效")
@ExcelProperty("银行账户状态")
private String accountStatus;
@ExcelProperty("银行账户国家/地区")
private String accountCountry;
@ExcelAttribute(name = "银行", isDataId = true, dataType = ExcelAttributeConstants.GZ_BANK)
@ExcelProperty("银行")
private String bankCd;
// 联行号ID 开户行所在省 开户行所在市 开户行名称 账号 持卡人姓名
@ExcelProperty("联行号ID")
private String cnapsId;
@ExcelProperty("开户行所在省(瓜子可用)")
private String accountProvince;
@ExcelProperty("开户行所在市(瓜子可用)")
private String accountCity;
@ExcelAttribute(name = "开户行所在省", isArea = true)
@ExcelProperty("开户行所在省")
private String accountProvinceAreaId;
@ExcelAttribute(name = "开户行所在市", isArea = true, parentField = "accountProvinceAreaId")
@ExcelProperty("开户行所在市")
private String accountCityAreaId;
@ExcelProperty("开户行名称")
private String bankName;
@ExcelProperty("账号")
private String accountEcId;
@ExcelProperty("持卡人姓名")
private String accountName;
}
......@@ -18,6 +18,7 @@
package com.yifu.cloud.plus.v1.yifu.archives.vo;
import com.alibaba.excel.annotation.ExcelProperty;
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;
......@@ -32,6 +33,7 @@ import java.math.BigDecimal;
* @date 2025-6-17 09:38:47
*/
@Data
@ColumnWidth(15)
public class TGzOfferInfoExportDetailVo implements Serializable {
@ExcelProperty("流程ID")
......
......@@ -18,12 +18,11 @@
package com.yifu.cloud.plus.v1.yifu.archives.vo;
import com.alibaba.excel.annotation.ExcelProperty;
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.util.LocalDateTimeUtils;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 导出-瓜子offer信息接收表
......@@ -32,6 +31,7 @@ import java.util.Date;
* @date 2025-6-17 09:38:47
*/
@Data
@ColumnWidth(25)
public class TGzOfferInfoExportMainVo implements Serializable {
@ExcelProperty("流程ID")
......
......@@ -146,13 +146,14 @@ public class TGzEmpInfoController {
/**
* 瓜子档案表 批量导出
*
* @Description: 瓜子档案表 批量导出
* @Author: hgw
* @Date: 2025/6/18 17:24
* @return: void
**/
@Operation(description = "导出瓜子档案表 hasPermission('archives_tgzempinfo-export')")
@PostMapping("/export")
@PreAuthorize("@pms.hasPermission('archives_tgzempinfo-export')")
public void export(HttpServletResponse response, @RequestBody TGzEmpInfoSearchVo searchVo) {
@Operation(description = "导出瓜子档案表 ")
@PostMapping("/exportGzEmpInfo")
public void exportGzEmpInfo(HttpServletResponse response, @RequestBody TGzEmpInfoSearchVo searchVo) {
tGzEmpInfoService.listExport(response, searchVo);
}
}
......@@ -21,10 +21,15 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TGzEmpInfo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TGzEmpInfoExportMain;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TGzEmpInfoSearchVo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TGzOfferInfoExportSearchVo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TGzEmpInfoSearchVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 瓜子档案表
*
......@@ -40,4 +45,20 @@ public interface TGzEmpInfoMapper extends BaseMapper<TGzEmpInfo> {
* @return
*/
IPage<TGzEmpInfo> getTGzEmpInfoPage(Page<TGzEmpInfo> page, @Param("tGzEmpInfo") TGzEmpInfoSearchVo tGzEmpInfo);
/**
* @Description: 导出前先查条数
* @Author: hgw
* @Date: 2025/6/18 15:11
* @return: int
**/
int getTGzEmpInfoCount(@Param("tGzEmpInfo") TGzEmpInfoSearchVo tGzEmpInfo);
/**
* @Description: 导出主表数据
* @Author: hgw
* @Date: 2025/6/18 15:12
* @return: java.util.List<com.yifu.cloud.plus.v1.yifu.archives.entity.TGzEmpInfo>
**/
List<TGzEmpInfoExportMain> getTGzEmpInfoList(@Param("tGzEmpInfo") TGzEmpInfoSearchVo tGzEmpInfo);
}
......@@ -17,16 +17,28 @@
package com.yifu.cloud.plus.v1.yifu.archives.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.alibaba.excel.EasyExcelFactory;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.yifu.admin.api.vo.AreaMap;
import com.yifu.cloud.plus.v1.yifu.archives.entity.*;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.*;
import com.yifu.cloud.plus.v1.yifu.archives.service.TAttaInfoService;
import com.yifu.cloud.plus.v1.yifu.archives.service.TGzEmpInfoService;
import com.yifu.cloud.plus.v1.yifu.archives.service.TGzOfferInfoService;
import com.yifu.cloud.plus.v1.yifu.archives.util.IdCardUtil;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TGzEmpInfoExportMain;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TGzOfferInfoExportDetailVo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TGzOfferInfoExportMainVo;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CacheConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.SecurityConstants;
import com.yifu.cloud.plus.v1.yifu.common.dapr.config.DaprCheckProperties;
import com.yifu.cloud.plus.v1.yifu.common.dapr.config.DaprSalaryProperties;
import com.yifu.cloud.plus.v1.yifu.common.dapr.config.DaprUpmsProperties;
import com.yifu.cloud.plus.v1.yifu.common.dapr.util.HttpDaprUtil;
import lombok.RequiredArgsConstructor;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.stereotype.Service;
import com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
......@@ -34,6 +46,7 @@ import com.yifu.cloud.plus.v1.yifu.archives.vo.TGzEmpInfoSearchVo;
import javax.servlet.http.HttpServletResponse;
import java.io.InputStream;
import java.util.HashMap;
import java.net.URL;
import java.util.List;
......@@ -58,6 +71,7 @@ import javax.servlet.ServletOutputStream;
import java.io.IOException;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.Map;
/**
* 瓜子档案表
......@@ -68,6 +82,7 @@ import java.util.ArrayList;
@Log4j2
@Service
@RequiredArgsConstructor
@EnableConfigurationProperties(DaprUpmsProperties.class)
public class TGzEmpInfoServiceImpl extends ServiceImpl<TGzEmpInfoMapper, TGzEmpInfo> implements TGzEmpInfoService {
private final TGzOfferInfoService gzOfferInfoService;
......@@ -84,6 +99,9 @@ public class TGzEmpInfoServiceImpl extends ServiceImpl<TGzEmpInfoMapper, TGzEmpI
private final TAttaInfoService attaInfoService;
// 拿区域
private final DaprUpmsProperties daprUpmsProperties;
@Autowired
private OSSUtil ossUtil;
......@@ -217,44 +235,52 @@ public class TGzEmpInfoServiceImpl extends ServiceImpl<TGzEmpInfoMapper, TGzEmpI
*/
@Override
public void listExport(HttpServletResponse response, TGzEmpInfoSearchVo searchVo) {
String fileName = "瓜子档案表批量导出" + DateUtil.getThisTime() + ".xlsx";
String prfName = "瓜子员工档案信息";
String fileName = prfName + DateUtil.getThisTime() + ".xlsx";
//获取要导出的列表
List<TGzEmpInfo> list = new ArrayList<>();
long count = noPageCountDiy(searchVo);
List<TGzEmpInfoExportMain> list = new ArrayList<>();
long count = baseMapper.getTGzEmpInfoCount(searchVo);
ServletOutputStream out = null;
try {
out = response.getOutputStream();
response.setContentType(CommonConstants.MULTIPART_FORM_DATA);
response.setCharacterEncoding("utf-8");
response.setHeader(CommonConstants.CONTENT_DISPOSITION, CommonConstants.ATTACHMENT_FILENAME + URLEncoder.encode(fileName, CommonConstants.UTF8));
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭
//EasyExcel.write(out, TEmpBadRecord.class).sheet("不良记录").doWrite(list);
ExcelWriter excelWriter = EasyExcel.write(out, TGzEmpInfo.class).build();
Map<String,String> redisLabelMap = (Map<String, String>) RedisUtil.redis.opsForValue().get(CacheConstants.REDIS_DICT_LABLE);
Map<String,String> idLabelMap = (Map<String, String>) RedisUtil.redis.opsForValue().get(CacheConstants.AREA_VALUE_ALL);
if (Common.isEmpty(idLabelMap) || idLabelMap.isEmpty()) {
R<AreaMap> areaListR = HttpDaprUtil.invokeMethodPost(daprUpmsProperties.getAppUrl(), daprUpmsProperties.getAppId()
, "/area/inner/getAreaMapAll", "", AreaMap.class, SecurityConstants.FROM_IN);
if (Common.isNotNull(areaListR)) {
idLabelMap = areaListR.getData().getIdLabelMap();
}
}
if (redisLabelMap != null && idLabelMap != null) {
redisLabelMap.putAll(idLabelMap);
}
Map<String,String> nameAndDicTypeMap = new HashMap<>();
ExcelUtil.getDictMapAndExp(TGzEmpInfoExportMain.class, nameAndDicTypeMap, redisLabelMap);
ExcelWriter excelWriter = EasyExcelFactory.write(out, TGzEmpInfoExportMain.class).registerConverter(new DictConverter(nameAndDicTypeMap, redisLabelMap)).build();
int index = 0;
if (count > CommonConstants.ZERO_INT) {
for (int i = 0; i <= count; ) {
WriteSheet writeSheet;
for (int i = 0; i <= count; i += CommonConstants.EXCEL_EXPORT_LIMIT){
// 获取实际记录
searchVo.setLimitStart(i);
searchVo.setLimitEnd(CommonConstants.EXCEL_EXPORT_LIMIT);
list = noPageDiy(searchVo);
if (Common.isNotNull(list)) {
ExcelUtil<TGzEmpInfo> util = new ExcelUtil<>(TGzEmpInfo.class);
for (TGzEmpInfo vo : list) {
util.convertEntity(vo, null, null, null);
}
}
list = baseMapper.getTGzEmpInfoList(searchVo);
if (Common.isNotNull(list)) {
WriteSheet writeSheet = EasyExcel.writerSheet("瓜子档案表" + index).build();
writeSheet = EasyExcelFactory.writerSheet(prfName + index).build();
excelWriter.write(list, writeSheet);
index++;
}
i = i + CommonConstants.EXCEL_EXPORT_LIMIT;
if (Common.isNotNull(list)) {
list.clear();
}
}
} else {
WriteSheet writeSheet = EasyExcel.writerSheet("瓜子档案表" + index).build();
WriteSheet writeSheet = EasyExcelFactory.writerSheet(prfName + index).build();
excelWriter.write(list, writeSheet);
}
if (Common.isNotNull(list)) {
......
......@@ -578,23 +578,19 @@ public class TGzOfferInfoServiceImpl extends ServiceImpl<TGzOfferInfoMapper, TGz
response.setCharacterEncoding("utf-8");
response.setHeader(CommonConstants.CONTENT_DISPOSITION, CommonConstants.ATTACHMENT_FILENAME + URLEncoder.encode(fileName, CommonConstants.UTF8));
Map<String,String> redisLabelMap = (Map<String, String>) RedisUtil.redis.opsForValue().get(CacheConstants.REDIS_DICT_LABLE);
Map<String,String> nameAndDicTypeMap = getConverterDicTypeAndArea(TGzOfferInfoExportMainVo.class, redisLabelMap);
Map<String,String> nameAndDicTypeMap = new HashMap<>();
ExcelUtil.getDictMapAndExp(TGzOfferInfoExportMainVo.class, nameAndDicTypeMap, redisLabelMap);
ExcelWriter excelWriter = EasyExcelFactory.write(out, TGzOfferInfoExportMainVo.class).registerConverter(new DictConverter(nameAndDicTypeMap, redisLabelMap)).build();
int index = 0;
if (count > CommonConstants.ZERO_INT) {
WriteSheet writeSheet;
for (int i = 0; i <= count; i += CommonConstants.EXCEL_EXPORT_LIMIT){
// 获取实际记录
searchVo.setLimitStart(i);
searchVo.setLimitEnd(CommonConstants.EXCEL_EXPORT_LIMIT);
list = baseMapper.getTGzOfferMainList(searchVo);
if (Common.isNotNull(list)) {
ExcelUtil<TGzOfferInfoExportMainVo> util = new ExcelUtil<>(TGzOfferInfoExportMainVo.class);
for (TGzOfferInfoExportMainVo vo : list) {
util.convertEntity(vo, null, null, null);
}
}
if (Common.isNotNull(list)) {
WriteSheet writeSheet = EasyExcelFactory.writerSheet(prfName + index).build();
writeSheet = EasyExcelFactory.writerSheet(prfName + index).build();
excelWriter.write(list, writeSheet);
index++;
}
......@@ -646,17 +642,19 @@ public class TGzOfferInfoServiceImpl extends ServiceImpl<TGzOfferInfoMapper, TGz
response.setHeader(CommonConstants.CONTENT_DISPOSITION, CommonConstants.ATTACHMENT_FILENAME + URLEncoder.encode(fileName, CommonConstants.UTF8));
// 这是获取所有字典的值
Map<String,String> redisLabelMap = (Map<String, String>) RedisUtil.redis.opsForValue().get(CacheConstants.REDIS_DICT_LABLE);
Map<String,String> nameAndDicTypeMap = getConverterDicTypeAndArea(TGzOfferInfoExportDetailVo.class, redisLabelMap);
Map<String,String> nameAndDicTypeMap = new HashMap<>();
ExcelUtil.getDictMapAndExp(TGzOfferInfoExportDetailVo.class, nameAndDicTypeMap, redisLabelMap);
ExcelWriter excelWriter = EasyExcelFactory.write(out, TGzOfferInfoExportDetailVo.class).registerConverter(new DictConverter(nameAndDicTypeMap, redisLabelMap)).build();
int index = 0;
if (count > CommonConstants.ZERO_INT) {
WriteSheet writeSheet;
for (int i = 0; i <= count; i += CommonConstants.EXCEL_EXPORT_LIMIT){
// 获取实际记录
searchVo.setLimitStart(i);
searchVo.setLimitEnd(CommonConstants.EXCEL_EXPORT_LIMIT);
list = baseMapper.getTGzOfferDetailList(searchVo);
if (Common.isNotNull(list)) {
WriteSheet writeSheet = EasyExcelFactory.writerSheet(prfName + index).build();
writeSheet = EasyExcelFactory.writerSheet(prfName + index).build();
excelWriter.write(list, writeSheet);
index++;
}
......@@ -687,44 +685,4 @@ public class TGzOfferInfoServiceImpl extends ServiceImpl<TGzOfferInfoMapper, TGz
}
}
private Map<String,String> getConverterDicTypeAndArea(Class<?> clazz, Map<String,String> redisLabelMap) {
// 得到所有定义字段
Field[] allFields = clazz.getDeclaredFields();
Map<String,String> nameDicMap = new HashMap<>();
List<Field> fields = new ArrayList<>();
// 将需要字典表头存起来备用,如果没传,则全部翻译
for (Field field : allFields) {
if (field.isAnnotationPresent(ExcelAttribute.class)) {
fields.add(field);
}
}
ExcelAttribute attr;
Field field;
String[] convertSource;
String[] itemArray;
for (int j = 0; j < fields.size(); j++) {
field = fields.get(j);
attr = field.getAnnotation(ExcelAttribute.class);
if (Common.isNotNull(field) && Common.isNotNull(attr)){
if (Common.isNotNull(attr.dataType())) {
nameDicMap.put(field.getName(), attr.dataType());
} else if (Common.isNotNull(attr.isArea()) && attr.isArea()) {
nameDicMap.put(field.getName(), CacheConstants.AREA_VALUE_ALL);
} else if (Common.isNotNull(attr.readConverterExp())) {
convertSource = attr.readConverterExp().split(",");
if (Common.isNotNull(convertSource)) {
for (String item : convertSource) {
itemArray = item.split("=");
if (itemArray.length >1) {
redisLabelMap.put(field.getName()+CommonConstants.DOWN_LINE_STRING+itemArray[0],itemArray[1]);
}
}
nameDicMap.put(field.getName(), field.getName());
}
}
}
}
return nameDicMap;
}
}
......@@ -404,4 +404,107 @@
</where>
ORDER by a.create_time desc,a.id desc
</select>
<!--count-->
<select id="getTGzEmpInfoCount" resultType="java.lang.Integer">
SELECT
count(1)
FROM t_gz_emp_info a
<where>
a.del_flag = '0'
<include refid="tGzEmpInfo_where"/>
</where>
</select>
<!--导出-->
<select id="getTGzEmpInfoList" resultType="com.yifu.cloud.plus.v1.yifu.archives.vo.TGzEmpInfoExportMain">
SELECT
a.id,
a.biz_id,
a.offer_id,
a.emp_push_status,
a.contract_push_status,
a.contract_atta_push_status,
a.del_flag,
a.create_time,
a.create_by,
a.create_name,
a.update_by,
a.update_time,
a.name,
a.name_ac,
a.birthdate,
a.sex,
a.constel,
a.blood_type,
a.start_date,
a.country,
a.native_place,
a.ethnic_grp_cd,
a.mar_status,
a.political_sta,
a.insurance_sta,
a.driver_type,
a.driver_licen_exp,
a.national_id_type,
a.national_id,
a.persist_flag,
a.nid_start_date,
a.nid_expiry_date,
a.phone,
a.mail,
a.address_type,
a.state_id,
a.city_id,
a.county_id,
a.address,
a.sginature_method,
a.contract_num,
a.contract_type,
a.sginature_type,
a.probation,
a.sginature_dt,
a.contract_begin_dt,
a.contract_exp_end_dt,
a.contract_end_dt,
a.probation_dt,
a.prc_exp_dt,
a.nee_provider_id,
a.work_location,
a.contract_state,
a.hukou_type,
a.hukou_province,
a.hukou_city,
a.hukou_county,
a.hukou_detail,
a.account_type,
a.account_status,
a.account_country,
a.bank_cd,
a.cnaps_id,
a.bank_name,
a.account_province,
a.account_city,
a.account_ec_id,
a.account_name,
a.native_place_area_id,
a.state_area_id,
a.city_area_id,
a.county_area_id,
a.hukou_province_area_id,
a.hukou_city_area_id,
a.hukou_county_area_id,
a.account_province_area_id,
a.account_city_area_id
FROM t_gz_emp_info a
<where>
a.del_flag = '0'
<include refid="tGzEmpInfo_where"/>
</where>
ORDER by a.create_time desc,a.id desc
<if test="tGzEmpInfo.limitStart != null">
limit #{tGzEmpInfo.limitStart},#{tGzEmpInfo.limitEnd}
</if>
</select>
</mapper>
......@@ -298,7 +298,6 @@
FROM t_gz_offer_info a
where a.del_flag = '0'
<include refid="tGzOfferInfo_where"/>
ORDER by a.create_time desc,a.id desc
</select>
<!-- 导出ORRER字段 -->
......
......@@ -175,4 +175,26 @@ public class ExcelAttributeConstants {
public static final String GZ_SEX = "gz_sex";
// 瓜子的外签类型
public static final String GZ_OUT_SGIN_TYPE = "gz_out_sgin_type";
// 瓜子的民族
public static final String GZ_ETHNIC_GRP_CD = "gz_ethnic_grp_cd";
// 瓜子的政治面貌
public static final String GZ_POLITICAL_STA = "gz_political_sta";
// 瓜子的婚姻状态
public static final String GZ_MAR_STATUS = "gz_mar_status";
// 瓜子的驾驶证类型
public static final String GZ_DRIVER_TYPE = "gz_driver_type";
// 瓜子的紧急联系人关系
public static final String GZ_EMERG_RELATION = "gz_emerg_relation";
// 瓜子的合同签署方式
public static final String GZ_SGINATURE_METHOD = "gz_sginature_method";
// 瓜子的合同类型
public static final String GZ_CONTRACT_TYPE = "gz_contract_type";
// 瓜子的合同签订类型
public static final String GZ_SGINATURE_TYPE = "gz_sginature_type";
// 瓜子的户口类型
public static final String GZ_HUKOU_TYPE = "gz_hukou_type";
// 瓜子的银行账户类型
public static final String GZ_ACCOUNT_TYPE = "gz_account_type";
// 瓜子的银行
public static final String GZ_BANK = "gz_bank";
}
......@@ -1144,4 +1144,51 @@ public class ExcelUtil <T> implements Serializable {
}
return nameDicMap;
}
/**
* @param clazz 类
* @param nameDicMap 需要翻译的属性
* @param redisLabelMap 字典MAP,这里传进来,额外加上固定需要翻译的值
* @Description: 组装需要翻译的map,并且组装固定的值的map
* @Author: hgw
* @Date: 2025/6/18 14:49
* @return: void
**/
public static void getDictMapAndExp(Class<?> clazz, Map<String,String> nameDictMap, Map<String,String> redisLabelMap) {
// 得到所有定义字段
Field[] allFields = clazz.getDeclaredFields();
List<Field> fieldList = new ArrayList<>();
// 将需要字典表头存起来备用,如果没传,则全部翻译
for (Field field : allFields) {
if (field.isAnnotationPresent(ExcelAttribute.class)) {
fieldList.add(field);
}
}
ExcelAttribute attr;
Field field;
String[] convertSource;
String[] itemArray;
for (int j = 0; j < fieldList.size(); j++) {
field = fieldList.get(j);
attr = field.getAnnotation(ExcelAttribute.class);
if (Common.isNotNull(field) && Common.isNotNull(attr)){
if (Common.isNotNull(attr.dataType())) {
nameDictMap.put(field.getName(), attr.dataType());
} else if (Common.isNotNull(attr.isArea()) && attr.isArea()) {
nameDictMap.put(field.getName(), CacheConstants.AREA_VALUE_ALL);
} else if (Common.isNotNull(attr.readConverterExp())) {
convertSource = attr.readConverterExp().split(",");
if (Common.isNotNull(convertSource)) {
for (String item : convertSource) {
itemArray = item.split("=");
if (itemArray.length >1) {
redisLabelMap.put(field.getName()+CommonConstants.DOWN_LINE_STRING+itemArray[0],itemArray[1]);
}
}
nameDictMap.put(field.getName(), field.getName());
}
}
}
}
}
}
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