Commit fac2f7ef authored by hongguangwu's avatar hongguangwu

MVP1.7.0 优化

parent 01bc6528
/*
* 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.entity;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.HeadFontStyle;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute;
import com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import javax.validation.constraints.NotBlank;
/**
* 薪资导入、删除锁定表(锁定后不可导入删除,除非清理掉数据)
*
* @author hgw
* @date 2024-10-24 15:22:51
*/
@Data
@TableName("t_archives_export_limit")
@EqualsAndHashCode(callSuper = true)
@Schema(description = "档案导出限定表(限定后不可导出,除非清理掉数据或等10分钟)")
public class TArchivesExportLimit extends BaseEntity {
/**
* id
*/
@TableId(type = IdType.ASSIGN_ID)
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("id")
private String id;
/**
* 删除标志:0未删除;1已删除(1代表已完成导出,释放了锁)
*/
@ExcelAttribute(name = "删除标志:0未删除;1已删除(1代表已完成导出,释放了锁)", isNotEmpty = true, errorInfo = "删除标志:0未删除;1已删除(1代表已完成导入或删除,释放了锁)不能为空")
@NotBlank(message = "删除标志:0未删除;1已删除(1代表已完成导出,释放了锁)不能为空")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("删除标志:0未删除;1已删除(1代表已完成导出,释放了锁)")
private Integer deleteFlag;
/**
* 类型:1预入职导出;2完整度监控导出
*/
@ExcelAttribute(name = "类型", isNotEmpty = true, errorInfo = "类型:1预入职导出;2完整度监控导出不能为空")
@NotBlank(message = "类型:1预入职导出;2完整度监控导出不能为空")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("类型:1预入职导出;2完整度监控导出")
private Integer type;
}
/*
* 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.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TArchivesExportLimit;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 薪资导入、删除锁定表(锁定后不可导入删除,除非清理掉数据)
*
* @author hgw
* @date 2024-10-24 15:59:09
*/
@Mapper
public interface TArchivesExportLimitMapper extends BaseMapper<TArchivesExportLimit> {
/**
* 查询是否有锁
*/
List<TArchivesExportLimit> getLimitList(@Param("tArchivesExportLimit") TArchivesExportLimit tArchivesExportLimit);
}
......@@ -3409,6 +3409,19 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
errorMust.append("有银行卡号则员工姓名必填;");
}
}
// 联动必填校验:
if (Common.isNotNull(detail.getFileProvince()) && Common.isEmpty(detail.getFileCity())) {
errorMust.append("档案所在地-省、市联动必填;");
}
if (Common.isNotNull(detail.getContactProvince()) && (Common.isEmpty(detail.getContactCity()) || Common.isEmpty(detail.getContactTown()))) {
errorMust.append("通信地址-省、市、区/县联动必填;");
}
if (Common.isNotNull(detail.getRelationProvince()) && (Common.isEmpty(detail.getRelationCity()) || Common.isEmpty(detail.getRelationTown()))) {
errorMust.append("联系地址-省、市、区/县联动必填;");
}
if (Common.isNotNull(detail.getFileProvince()) && Common.isEmpty(detail.getFileCity())) {
errorMust.append("开户省、市联动必填;");
}
// 手机号码
if (Common.isNotNull(detail.getEmpPhone())) {
mobileList.add(detail.getEmpPhone());
......
......@@ -37,6 +37,7 @@ import com.yifu.cloud.plus.v1.check.entity.TCheckBankNo;
import com.yifu.cloud.plus.v1.check.entity.TCheckIdCard;
import com.yifu.cloud.plus.v1.check.vo.CheckBatchVo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.*;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.TArchivesExportLimitMapper;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.TPreEmpMainMapper;
import com.yifu.cloud.plus.v1.yifu.archives.service.*;
import com.yifu.cloud.plus.v1.yifu.archives.utils.ExcelStyle;
......@@ -151,6 +152,8 @@ public class TPreEmpMainServiceImpl extends ServiceImpl<TPreEmpMainMapper, TPreE
// 导入批量校验身份证、卡号、手机号
private final DaprCheckProperties checkProperties;
private final TArchivesExportLimitMapper tArchivesExportLimitMapper;
private final OSSUtil ossUtil;
private static final String ID = "id";
......@@ -1529,6 +1532,9 @@ public class TPreEmpMainServiceImpl extends ServiceImpl<TPreEmpMainMapper, TPreE
TEmpEducation tEmpEducation = null;
if (Common.isNotNull(tPreEmpEducation.getOldId())) {
tEmpEducation = tEmpEducationService.getById(tPreEmpEducation.getOldId());
} else {
// 测试金龙弟建议查询信息后更新,不新增额外的一条 2024-10-24 16:23:47 hgw修改
tEmpEducation = tEmpEducationService.getByEmpId(empId);
}
if (tEmpEducation == null) {
tEmpEducation = new TEmpEducation();
......@@ -1588,6 +1594,9 @@ public class TPreEmpMainServiceImpl extends ServiceImpl<TPreEmpMainMapper, TPreE
TEmpBadRecord tEmpBadRecord = null;
if (Common.isNotNull(tPreEmpBadRecord.getOldId())) {
tEmpBadRecord = tEmpBadRecordService.getById(tPreEmpBadRecord.getOldId());
} else {
// 测试金龙弟建议查询信息后更新,不新增额外的一条 2024-10-24 16:23:47 hgw修改
tEmpBadRecord = tEmpBadRecordService.getByEmpId(empId);
}
if (tEmpBadRecord == null) {
tEmpBadRecord = new TEmpBadRecord();
......@@ -1608,6 +1617,9 @@ public class TPreEmpMainServiceImpl extends ServiceImpl<TPreEmpMainMapper, TPreE
TEmpContactInfo tEmpContactInfo = null;
if (Common.isNotNull(tPreEmpContactInfo.getOldId())) {
tEmpContactInfo = tEmpContactInfoService.getById(tPreEmpContactInfo.getOldId());
} else {
// 测试金龙弟建议查询信息后更新,不新增额外的一条 2024-10-24 16:23:47 hgw修改
tEmpContactInfo = tEmpContactInfoService.getByEmpId(empId);
}
if (tEmpContactInfo == null) {
tEmpContactInfo = new TEmpContactInfo();
......@@ -1631,6 +1643,9 @@ public class TPreEmpMainServiceImpl extends ServiceImpl<TPreEmpMainMapper, TPreE
TEmpDisabilityInfo tEmpDisabilityInfo = null;
if (Common.isNotNull(tPreEmpDisabilityInfo.getOldId())) {
tEmpDisabilityInfo = tEmpDisabilityInfoService.getById(tPreEmpDisabilityInfo.getOldId());
} else {
// 测试金龙弟建议查询信息后更新,不新增额外的一条 2024-10-24 16:23:47 hgw修改
tEmpDisabilityInfo = tEmpDisabilityInfoService.getByEmpId(empId);
}
if (tEmpDisabilityInfo == null) {
tEmpDisabilityInfo = new TEmpDisabilityInfo();
......@@ -2376,6 +2391,13 @@ public class TPreEmpMainServiceImpl extends ServiceImpl<TPreEmpMainMapper, TPreE
*/
@Override
public void exportAll(HttpServletResponse response, TPreEmpMainSearchVo searchVo) {
YifuUser user = SecurityUtils.getUser();
if (user != null) {
TArchivesExportLimit exportLimit = new TArchivesExportLimit();
exportLimit.setCreateBy(user.getId());
exportLimit.setType(CommonConstants.ONE_INT);
List<TArchivesExportLimit> limitList = tArchivesExportLimitMapper.getLimitList(exportLimit);
String name = "预入职导出全量";
String fileName = name + DateUtil.getThisTime() + ".xlsx";
//获取要导出的列表
......@@ -2394,7 +2416,18 @@ public class TPreEmpMainServiceImpl extends ServiceImpl<TPreEmpMainMapper, TPreE
List<List<String>> headList = Lists.newArrayList();
headList.add(this.getNewArrayList(new String[]{"提示"}));
EasyExcelFactory.write(out).head(headList).sheet("数据超限").doWrite(strList);
} else if (limitList != null && limitList.size() > 2) {
List<List<String>> strList = new ArrayList<>();
strList.add(this.getNewArrayList(new String[]{"多人正在导出,请耐心等待10分钟后再导出!"}));
List<List<String>> headList = Lists.newArrayList();
headList.add(this.getNewArrayList(new String[]{"提示"}));
EasyExcelFactory.write(out).head(headList).sheet("多人正在导出").doWrite(strList);
} else {
exportLimit.setDeleteFlag(CommonConstants.ZERO_INT);
exportLimit.setCreateName(user.getNickname());
exportLimit.setCreateTime(LocalDateTime.now());
tArchivesExportLimitMapper.insert(exportLimit);
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭
List<List<String>> headList = Lists.newArrayList();
headList.add(this.getNewArrayList(new String[]{"提交时间", "提交时间"}));
......@@ -2484,7 +2517,7 @@ public class TPreEmpMainServiceImpl extends ServiceImpl<TPreEmpMainMapper, TPreE
if (count > CommonConstants.ZERO_INT) {
ExcelUtil<TPreMainExportAllVO> util = new ExcelUtil<>(TPreMainExportAllVO.class);
//int limitNum = CommonConstants.EXCEL_EXPORT_LIMIT
int limitNum = 1000;
int limitNum = 10000;
ExcelWriterSheetBuilder writeSheet;
List<TPreMainExportAllVO> listWork;
Map<String, TPreMainExportAllVO> mapWork;
......@@ -2506,22 +2539,22 @@ public class TPreEmpMainServiceImpl extends ServiceImpl<TPreEmpMainMapper, TPreE
mapFamily = new HashMap<>();
mapProfessional = new HashMap<>();
if (listWork != null && !listWork.isEmpty()) {
for (TPreMainExportAllVO vo : listWork){
for (TPreMainExportAllVO vo : listWork) {
mapWork.putIfAbsent(vo.getMainId(), vo);
}
}
if (listFamily != null && !listFamily.isEmpty()) {
for (TPreMainExportAllVO vo : listFamily){
for (TPreMainExportAllVO vo : listFamily) {
mapFamily.putIfAbsent(vo.getMainId(), vo);
}
}
if (listProfessional != null && !listProfessional.isEmpty()) {
for (TPreMainExportAllVO vo : listProfessional){
for (TPreMainExportAllVO vo : listProfessional) {
mapProfessional.putIfAbsent(vo.getMainId(), vo);
}
}
if (Common.isNotNull(list)){
for (TPreMainExportAllVO vo : list){
if (Common.isNotNull(list)) {
for (TPreMainExportAllVO vo : list) {
temp = mapWork.get(vo.getMainId());
if (temp != null) {
vo.setField44(temp.getField44());
......@@ -2540,7 +2573,7 @@ public class TPreEmpMainServiceImpl extends ServiceImpl<TPreEmpMainMapper, TPreE
vo.setField52(temp.getField52());
vo.setField53(temp.getField53());
}
util.convertEntity(vo,null,null,null);
util.convertEntity(vo, null, null, null);
}
writeSheet = EasyExcelFactory.writerSheet(name + index).includeColumnFieldNames(titleContent);
excelWriter.write(list, writeSheet.build());
......@@ -2619,6 +2652,11 @@ public class TPreEmpMainServiceImpl extends ServiceImpl<TPreEmpMainMapper, TPreE
log.error("执行异常", e);
} finally {
try {
// 结束后将状态更新为已导出
exportLimit.setDeleteFlag(CommonConstants.ONE_INT);
exportLimit.setUpdateBy(user.getNickname());
exportLimit.setUpdateTime(LocalDateTime.now());
tArchivesExportLimitMapper.updateById(exportLimit);
if (null != out) {
out.close();
}
......@@ -2627,6 +2665,7 @@ public class TPreEmpMainServiceImpl extends ServiceImpl<TPreEmpMainMapper, TPreE
}
}
}
}
private Set<String> getExportFieldNameDetailByClass(Class<?> clazz) {
Set<String> exportfieldsName = new HashSet<>();
......
<?xml version="1.0" encoding="UTF-8"?>
<!--
~
~ 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)
~
-->
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yifu.cloud.plus.v1.yifu.archives.mapper.TArchivesExportLimitMapper">
<resultMap id="tArchivesExportLimitMap" type="com.yifu.cloud.plus.v1.yifu.archives.entity.TArchivesExportLimit">
<id property="id" column="id"/>
<result property="deleteFlag" column="delete_flag"/>
<result property="type" column="type"/>
<result property="createBy" column="CREATE_BY"/>
<result property="createName" column="CREATE_NAME"/>
<result property="createTime" column="CREATE_TIME"/>
<result property="updateBy" column="UPDATE_BY"/>
<result property="updateTime" column="UPDATE_TIME"/>
</resultMap>
<sql id="Base_Column_List">
a
.
id
,
a.type,
a.delete_flag,
a.CREATE_BY,
a.CREATE_NAME,
a.CREATE_TIME,
a.UPDATE_BY,
a.UPDATE_TIME
</sql>
<sql id="tArchivesExportLimit_where">
<if test="tArchivesExportLimit != null">
<if test="tArchivesExportLimit.id != null and tArchivesExportLimit.id.trim() != ''">
AND a.id = #{tArchivesExportLimit.id}
</if>
<if test="tArchivesExportLimit.createBy != null and tArchivesExportLimit.createBy.trim() != ''">
AND a.CREATE_BY = #{tArchivesExportLimit.createBy}
</if>
<if test="tArchivesExportLimit.type != null">
AND a.type = #{tArchivesExportLimit.type}
</if>
</if>
</sql>
<!--tArchivesExportLimit查询-->
<select id="getLimitList" resultMap="tArchivesExportLimitMap">
SELECT
<include refid="Base_Column_List"/>
FROM t_archives_export_limit a
<where>
a.DELETE_FLAG = 0 and a.create_time > DATE_SUB(NOW(),INTERVAL 10 MINUTE)
<include refid="tArchivesExportLimit_where"/>
</where>
</select>
</mapper>
......@@ -255,30 +255,6 @@
SELECT
count(1)
FROM t_pre_emp_main a
/*left join t_pre_employee_info e on a.id=e.PRE_MAIN_ID
left join view_sys_dict_item emp_natrue on emp_natrue.value=a.emp_Natrue and emp_natrue.type='emp_natrue'
left join view_sys_dict_item emp_married on emp_married.value=e.EMP_MARRI_STATUS and emp_married.type='emp_married'
left join view_sys_dict_item nation on nation.value=e.EMP_NATIONAL and nation.type='emp_national'
left join view_sys_dict_item registype on registype.value=e.EMP_REGIS_TYPE and registype.type='emp_registype'
left join view_sys_dict_item politicalStatus on politicalStatus.value=e.POLITICAL_STATUS and politicalStatus.type='emp_political'
left join sys_area pi on pi.id=e.ID_PROVINCE
left join sys_area ci on ci.id=e.ID_CITY
left join sys_area ti on ti.id=e.ID_TOWN
left join sys_area pf on pf.id=e.FILE_PROVINCE
left join sys_area cf on cf.id=e.FILE_CITY
left join sys_area tf on tf.id=e.FILE_TOWN
left join t_pre_employee_project p on a.id=p.PRE_MAIN_ID
left join view_sys_dict_item contractType on contractType.value=p.CONTRACT_TYPE and contractType.type='employee_contract_type'
left join view_sys_dict_item workingHours on workingHours.value=p.WORKING_HOURS and workingHours.type='working_hours'
left join t_pre_emp_contact_info ec on a.id=ec.PRE_MAIN_ID
left join t_pre_emp_education ee on a.id=ee.PRE_MAIN_ID
left join view_sys_dict_item education on education.value=ee.EDUCATION_NAME and education.type='education'
left join t_pre_emp_work_recording ew on a.id=ew.PRE_MAIN_ID
left join t_pre_emp_family ef on a.id=ef.PRE_MAIN_ID
left join t_pre_emp_professional_qualification ep on a.id=ep.PRE_MAIN_ID
left join view_sys_dict_item qualification_type on qualification_type.value=ep.QUALIFICATION_TYPE and qualification_type.type='qualification_type'
left join t_pre_emp_disability_info ed on a.id=ed.PRE_MAIN_ID
left join t_pre_emp_bad_record eb on a.id=eb.PRE_MAIN_ID*/
<where>
a.STATUS != '5'
<include refid="tPreEmpMain_where"/>
......
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