Commit 695a7042 authored by hongguangwu's avatar hongguangwu

MVP1.7.0 优化

parent e67bd0da
...@@ -32,7 +32,7 @@ import org.hibernate.validator.constraints.Length; ...@@ -32,7 +32,7 @@ import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
/** /**
* 薪资导入、删除锁定表(锁定后不可导入删除,除非清理掉数据 * 档案导出限定表(限定后不可导出,除非清理掉数据或等10分钟
* *
* @author hgw * @author hgw
* @date 2024-10-24 15:22:51 * @date 2024-10-24 15:22:51
...@@ -73,10 +73,4 @@ public class TArchivesExportLimit extends BaseEntity { ...@@ -73,10 +73,4 @@ public class TArchivesExportLimit extends BaseEntity {
@Schema(description = "进度条") @Schema(description = "进度条")
private String progressBar; private String progressBar;
@ExcelAttribute(name = "导出最大值(按类型)", isNotEmpty = true, errorInfo = "导出最大值(按类型)不能为空")
@NotBlank(message = "导出最大值(按类型)不能为空")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("导出最大值(按类型)")
private Integer maxNum;
} }
/*
* 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.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
/**
* 档案导入导出限制表
*
* @author hgw
* @date 2024-10-24 15:22:51
*/
@Data
@TableName("t_archives_limit")
@Schema(description = "档案导入导出限制表")
public class TArchivesLimit {
/**
* 主键(类型:1预入职导入;2档案更新;3:预入职导出;4档案完整度监控导出,具体的看remark里的说明)
*/
@TableId(type = IdType.AUTO)
@Schema(description = "主键")
private Integer id;
@Schema(description = "备注")
private String remark;
@Schema(description = "导出最大值(按类型)")
private Integer maxNum;
}
...@@ -20,7 +20,6 @@ package com.yifu.cloud.plus.v1.yifu.archives.mapper; ...@@ -20,7 +20,6 @@ package com.yifu.cloud.plus.v1.yifu.archives.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TArchivesExportLimit; import com.yifu.cloud.plus.v1.yifu.archives.entity.TArchivesExportLimit;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/** /**
* 薪资导入、删除锁定表(锁定后不可导入删除,除非清理掉数据) * 薪资导入、删除锁定表(锁定后不可导入删除,除非清理掉数据)
...@@ -30,5 +29,4 @@ import org.apache.ibatis.annotations.Param; ...@@ -30,5 +29,4 @@ import org.apache.ibatis.annotations.Param;
*/ */
@Mapper @Mapper
public interface TArchivesExportLimitMapper extends BaseMapper<TArchivesExportLimit> { public interface TArchivesExportLimitMapper extends BaseMapper<TArchivesExportLimit> {
Integer getLimitMaxNum(@Param("type") 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.TArchivesLimit;
import org.apache.ibatis.annotations.Mapper;
/**
* 档案导入导出限制表
*
* @author hgw
* @date 2024-10-24 15:59:09
*/
@Mapper
public interface TArchivesLimitMapper extends BaseMapper<TArchivesLimit> {
}
...@@ -11,6 +11,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; ...@@ -11,6 +11,7 @@ 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.admin.api.vo.AreaMap;
import com.yifu.cloud.plus.v1.yifu.archives.entity.*; 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.TArchivesExportLimitMapper;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.TArchivesLimitMapper;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.TCompleteMonitorMapper; import com.yifu.cloud.plus.v1.yifu.archives.mapper.TCompleteMonitorMapper;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmployeeProjectMapper; import com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmployeeProjectMapper;
import com.yifu.cloud.plus.v1.yifu.archives.service.*; import com.yifu.cloud.plus.v1.yifu.archives.service.*;
...@@ -78,6 +79,8 @@ public class TCompleteMonitorServiceImpl extends ServiceImpl<TCompleteMonitorMap ...@@ -78,6 +79,8 @@ public class TCompleteMonitorServiceImpl extends ServiceImpl<TCompleteMonitorMap
private final TArchivesExportLimitMapper tArchivesExportLimitMapper; private final TArchivesExportLimitMapper tArchivesExportLimitMapper;
private final TArchivesLimitMapper tArchivesLimitMapper;
private final OSSUtil ossUtil; private final OSSUtil ossUtil;
private final AtomicInteger atomicInteger = new AtomicInteger(0); private final AtomicInteger atomicInteger = new AtomicInteger(0);
...@@ -272,9 +275,10 @@ public class TCompleteMonitorServiceImpl extends ServiceImpl<TCompleteMonitorMap ...@@ -272,9 +275,10 @@ public class TCompleteMonitorServiceImpl extends ServiceImpl<TCompleteMonitorMap
@Override @Override
public void exportAll(HttpServletResponse response, TCompleteMonitorSearchVo searchVo) { public void exportAll(HttpServletResponse response, TCompleteMonitorSearchVo searchVo) {
Integer maxLimit = tArchivesExportLimitMapper.getLimitMaxNum(CommonConstants.TWO_INT); TArchivesLimit archivesLimit = tArchivesLimitMapper.selectById(CommonConstants.FOUR_INT);
if (Common.isEmpty(maxLimit)) { Integer maxLimit = 2;
maxLimit = 2; if (Common.isNotNull(archivesLimit) && Common.isNotNull(archivesLimit.getMaxNum())) {
maxLimit = archivesLimit.getMaxNum();
} }
if (atomicInteger.incrementAndGet() <= maxLimit) { if (atomicInteger.incrementAndGet() <= maxLimit) {
try { try {
......
...@@ -37,15 +37,13 @@ import com.yifu.cloud.plus.v1.check.entity.TCheckMobile; ...@@ -37,15 +37,13 @@ import com.yifu.cloud.plus.v1.check.entity.TCheckMobile;
import com.yifu.cloud.plus.v1.check.vo.CheckBatchVo; import com.yifu.cloud.plus.v1.check.vo.CheckBatchVo;
import com.yifu.cloud.plus.v1.yifu.archives.constants.EmployeeConstants; import com.yifu.cloud.plus.v1.yifu.archives.constants.EmployeeConstants;
import com.yifu.cloud.plus.v1.yifu.archives.entity.*; import com.yifu.cloud.plus.v1.yifu.archives.entity.*;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.TArchivesLimitMapper;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmployeeContractAuditMapper; import com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmployeeContractAuditMapper;
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.mapper.TPreEmpDeclarationMapper; import com.yifu.cloud.plus.v1.yifu.archives.mapper.TPreEmpDeclarationMapper;
import com.yifu.cloud.plus.v1.yifu.archives.service.*; import com.yifu.cloud.plus.v1.yifu.archives.service.*;
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.*;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.SecurityConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.exception.ErrorCodes; import com.yifu.cloud.plus.v1.yifu.common.core.exception.ErrorCodes;
import com.yifu.cloud.plus.v1.yifu.common.core.util.*; import com.yifu.cloud.plus.v1.yifu.common.core.util.*;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.ExcelColumnVo; import com.yifu.cloud.plus.v1.yifu.common.core.vo.ExcelColumnVo;
...@@ -88,6 +86,7 @@ import java.net.URL; ...@@ -88,6 +86,7 @@ import java.net.URL;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.*; import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
/** /**
* 人员档案表 * 人员档案表
...@@ -127,6 +126,8 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T ...@@ -127,6 +126,8 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
private final TEmpOtherFileService empOtherFileService; private final TEmpOtherFileService empOtherFileService;
private final TPreEmpDeclarationMapper declarationMapper; private final TPreEmpDeclarationMapper declarationMapper;
private final TArchivesLimitMapper tArchivesLimitMapper;
private final AtomicInteger updateAtomicInteger = new AtomicInteger(0);
@Autowired @Autowired
private OSSUtil ossUtil; private OSSUtil ossUtil;
...@@ -3074,14 +3075,36 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T ...@@ -3074,14 +3075,36 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
return baseMapper.getListByIdCardList(idList); return baseMapper.getListByIdCardList(idList);
} }
@Override
public R<List<PreUploadEmpImportTwoVo>> batchUpdateEmployeeAndBank(MultipartFile file, PreUploadImportParamVo paramVo) throws Exception {
TArchivesLimit archivesLimit = tArchivesLimitMapper.selectById(CommonConstants.TWO_INT);
Integer maxLimit = 10;
if (Common.isNotNull(archivesLimit) && Common.isNotNull(archivesLimit.getMaxNum())) {
maxLimit = archivesLimit.getMaxNum();
}
if (updateAtomicInteger.incrementAndGet() <= maxLimit) {
try {
return batchUpdateEmployeeAndBankCore(file, paramVo);
} catch (Exception e) {
log.error("新批量更新人员异常:", e);
} finally {
updateAtomicInteger.decrementAndGet();
}
} else {
// 前面做了+1(atomicInteger.incrementAndGet())这里也要-1
updateAtomicInteger.decrementAndGet();
log.error("新批量更新人员超出阈值");
return R.failed("新批量更新," + ResultConstants.IMPORT_DOWN_LOAD_DATA);
}
return R.failed("新批量更新中," + ResultConstants.IMPORT_DOWN_LOAD_DATA);
}
/** /**
* @Description: 批量更新人员和银行信息 * @Description: 批量更新人员和银行信息
* @Author: hgw * @Author: hgw
* @Date: 2024/10/16 17:43 * @Date: 2024/10/16 17:43
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.util.List < com.pig4cloud.plugin.excel.vo.ErrorMessage>> * @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.util.List < com.pig4cloud.plugin.excel.vo.ErrorMessage>>
**/ **/
@Override private R<List<PreUploadEmpImportTwoVo>> batchUpdateEmployeeAndBankCore(MultipartFile file, PreUploadImportParamVo paramVo) throws Exception {
public R<List<PreUploadEmpImportTwoVo>> batchUpdateEmployeeAndBank(MultipartFile file, PreUploadImportParamVo paramVo) throws Exception {
// 自定义解析Excel,判断表头、必填、格式; // 自定义解析Excel,判断表头、必填、格式;
// 按项目查项目人员、档案人员、预入职人员; // 按项目查项目人员、档案人员、预入职人员;
// 有项目人员,仅更新,否则看预入职人员,新增或更新,加导入标签; // 有项目人员,仅更新,否则看预入职人员,新增或更新,加导入标签;
......
...@@ -37,6 +37,7 @@ import com.yifu.cloud.plus.v1.check.vo.CheckBatchVo; ...@@ -37,6 +37,7 @@ import com.yifu.cloud.plus.v1.check.vo.CheckBatchVo;
import com.yifu.cloud.plus.v1.yifu.admin.api.vo.AreaMap; 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.entity.*;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.TArchivesExportLimitMapper; import com.yifu.cloud.plus.v1.yifu.archives.mapper.TArchivesExportLimitMapper;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.TArchivesLimitMapper;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.TPreEmpMainMapper; 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.service.*;
import com.yifu.cloud.plus.v1.yifu.archives.utils.ExcelStyle; import com.yifu.cloud.plus.v1.yifu.archives.utils.ExcelStyle;
...@@ -150,6 +151,8 @@ public class TPreEmpMainServiceImpl extends ServiceImpl<TPreEmpMainMapper, TPreE ...@@ -150,6 +151,8 @@ public class TPreEmpMainServiceImpl extends ServiceImpl<TPreEmpMainMapper, TPreE
private final TArchivesExportLimitMapper tArchivesExportLimitMapper; private final TArchivesExportLimitMapper tArchivesExportLimitMapper;
private final TArchivesLimitMapper tArchivesLimitMapper;
private final OSSUtil ossUtil; private final OSSUtil ossUtil;
private static final String ID = "id"; private static final String ID = "id";
...@@ -158,7 +161,8 @@ public class TPreEmpMainServiceImpl extends ServiceImpl<TPreEmpMainMapper, TPreE ...@@ -158,7 +161,8 @@ public class TPreEmpMainServiceImpl extends ServiceImpl<TPreEmpMainMapper, TPreE
private final RedisUtil redisUtil; private final RedisUtil redisUtil;
private final AtomicInteger preAtomicInteger = new AtomicInteger(0); private final AtomicInteger preImportAtomicInteger = new AtomicInteger(0);
private final AtomicInteger preExportAtomicInteger = new AtomicInteger(0);
/** /**
* 预入职-主表简单分页查询 * 预入职-主表简单分页查询
...@@ -2381,21 +2385,22 @@ public class TPreEmpMainServiceImpl extends ServiceImpl<TPreEmpMainMapper, TPreE ...@@ -2381,21 +2385,22 @@ public class TPreEmpMainServiceImpl extends ServiceImpl<TPreEmpMainMapper, TPreE
@Override @Override
public void exportAll(HttpServletResponse response, TPreEmpMainSearchVo searchVo) { public void exportAll(HttpServletResponse response, TPreEmpMainSearchVo searchVo) {
Integer preMaxLimit = tArchivesExportLimitMapper.getLimitMaxNum(CommonConstants.ONE_INT); TArchivesLimit archivesLimit = tArchivesLimitMapper.selectById(CommonConstants.THREE_INT);
if (Common.isEmpty(preMaxLimit)) { Integer preMaxLimit = 2;
preMaxLimit = 2; if (Common.isNotNull(archivesLimit) && Common.isNotNull(archivesLimit.getMaxNum())) {
preMaxLimit = archivesLimit.getMaxNum();
} }
if (preAtomicInteger.incrementAndGet() <= preMaxLimit) { if (preExportAtomicInteger.incrementAndGet() <= preMaxLimit) {
try { try {
exportAllCore(response, searchVo); exportAllCore(response, searchVo);
} catch (Exception e) { } catch (Exception e) {
log.error("导出异常:", e); log.error("导出异常:", e);
} finally { } finally {
preAtomicInteger.decrementAndGet(); preExportAtomicInteger.decrementAndGet();
} }
} else { } else {
// 前面做了+1(atomicInteger.incrementAndGet())这里也要-1 // 前面做了+1(atomicInteger.incrementAndGet())这里也要-1
preAtomicInteger.decrementAndGet(); preExportAtomicInteger.decrementAndGet();
log.error("预入职导出超出阈值:" + ResultConstants.FILE_DOWN_LOAD_DATA); log.error("预入职导出超出阈值:" + ResultConstants.FILE_DOWN_LOAD_DATA);
exportError(response, ResultConstants.FILE_DOWN_LOAD_DATA); exportError(response, ResultConstants.FILE_DOWN_LOAD_DATA);
} }
...@@ -2775,6 +2780,30 @@ public class TPreEmpMainServiceImpl extends ServiceImpl<TPreEmpMainMapper, TPreE ...@@ -2775,6 +2780,30 @@ public class TPreEmpMainServiceImpl extends ServiceImpl<TPreEmpMainMapper, TPreE
return nameDicMap; return nameDicMap;
} }
@Override
public R<List<PreUploadEmpImportVo>> uploadPreEmp(MultipartFile file, PreUploadImportParamVo paramVo) throws Exception {
TArchivesLimit archivesLimit = tArchivesLimitMapper.selectById(CommonConstants.ONE_INT);
Integer preMaxLimit = 10;
if (Common.isNotNull(archivesLimit) && Common.isNotNull(archivesLimit.getMaxNum())) {
preMaxLimit = archivesLimit.getMaxNum();
}
if (preImportAtomicInteger.incrementAndGet() <= preMaxLimit) {
try {
return uploadPreEmpCore(file, paramVo);
} catch (Exception e) {
log.error("导入预入职异常:", e);
} finally {
preImportAtomicInteger.decrementAndGet();
}
} else {
// 前面做了+1(atomicInteger.incrementAndGet())这里也要-1
preImportAtomicInteger.decrementAndGet();
log.error("导入预入职超出阈值");
return R.failed("导入预入职," + ResultConstants.IMPORT_DOWN_LOAD_DATA);
}
return R.failed("导入预入职中," + ResultConstants.IMPORT_DOWN_LOAD_DATA);
}
/** /**
* @param file 文件流 * @param file 文件流
* @Description: 导入预入职 * @Description: 导入预入职
...@@ -2782,8 +2811,7 @@ public class TPreEmpMainServiceImpl extends ServiceImpl<TPreEmpMainMapper, TPreE ...@@ -2782,8 +2811,7 @@ public class TPreEmpMainServiceImpl extends ServiceImpl<TPreEmpMainMapper, TPreE
* @Date: 2024/10/12 9:28 * @Date: 2024/10/12 9:28
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.util.List < com.yifu.cloud.plus.v1.yifu.archives.vo.PreEmpMainDetailVo>> * @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.util.List < com.yifu.cloud.plus.v1.yifu.archives.vo.PreEmpMainDetailVo>>
**/ **/
@Override private R<List<PreUploadEmpImportVo>> uploadPreEmpCore(MultipartFile file, PreUploadImportParamVo paramVo) throws Exception {
public R<List<PreUploadEmpImportVo>> uploadPreEmp(MultipartFile file, PreUploadImportParamVo paramVo) throws Exception {
// 自定义解析Excel,判断表头、必填、格式; // 自定义解析Excel,判断表头、必填、格式;
// 按项目查项目人员、档案人员、预入职人员; // 按项目查项目人员、档案人员、预入职人员;
// 有项目人员,仅更新,否则看预入职人员,新增或更新,加导入标签; // 有项目人员,仅更新,否则看预入职人员,新增或更新,加导入标签;
......
...@@ -33,7 +33,6 @@ ...@@ -33,7 +33,6 @@
<result property="updateBy" column="UPDATE_BY"/> <result property="updateBy" column="UPDATE_BY"/>
<result property="updateTime" column="UPDATE_TIME"/> <result property="updateTime" column="UPDATE_TIME"/>
<result property="progressBar" column="PROGRESS_BAR"/> <result property="progressBar" column="PROGRESS_BAR"/>
<result property="maxNum" column="MAX_NUM"/>
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
a.id, a.id,
...@@ -44,8 +43,7 @@ ...@@ -44,8 +43,7 @@
a.CREATE_TIME, a.CREATE_TIME,
a.UPDATE_BY, a.UPDATE_BY,
a.UPDATE_TIME, a.UPDATE_TIME,
a.PROGRESS_BAR, a.PROGRESS_BAR
a.MAX_NUM
</sql> </sql>
<sql id="tArchivesExportLimit_where"> <sql id="tArchivesExportLimit_where">
<if test="tArchivesExportLimit != null"> <if test="tArchivesExportLimit != null">
...@@ -61,12 +59,4 @@ ...@@ -61,12 +59,4 @@
</if> </if>
</sql> </sql>
<!--tArchivesExportLimit查询-->
<select id="getLimitMaxNum" resultType="java.lang.Integer">
SELECT
max(a.MAX_NUM)
FROM t_archives_export_limit a
where a.type = #{type}
</select>
</mapper> </mapper>
<?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.TArchivesLimitMapper">
<resultMap id="tArchivesExportLimitMap" type="com.yifu.cloud.plus.v1.yifu.archives.entity.TArchivesLimit">
<id property="id" column="id"/>
<result property="maxNum" column="MAX_NUM"/>
<result property="remark" column="REMARK"/>
</resultMap>
</mapper>
...@@ -25,4 +25,5 @@ public class ResultConstants { ...@@ -25,4 +25,5 @@ public class ResultConstants {
public static final String NO_ID = "操作失败,id不能为空!"; public static final String NO_ID = "操作失败,id不能为空!";
public static final String FILE_UPLOADING_DATA = "附件排队上传中,请稍后重试!"; public static final String FILE_UPLOADING_DATA = "附件排队上传中,请稍后重试!";
public static final String FILE_DOWN_LOAD_DATA = "导出排队下载中,请稍后重试!"; public static final String FILE_DOWN_LOAD_DATA = "导出排队下载中,请稍后重试!";
public static final String IMPORT_DOWN_LOAD_DATA = "导入排队中,请稍后重试!";
} }
...@@ -7,6 +7,7 @@ import com.yifu.cloud.plus.v1.yifu.archives.entity.TSettleDomain; ...@@ -7,6 +7,7 @@ import com.yifu.cloud.plus.v1.yifu.archives.entity.TSettleDomain;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TSettleDomainSelectVo; import com.yifu.cloud.plus.v1.yifu.archives.vo.TSettleDomainSelectVo;
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;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ResultConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.SecurityConstants; import com.yifu.cloud.plus.v1.yifu.common.core.constant.SecurityConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.*; import com.yifu.cloud.plus.v1.yifu.common.core.util.*;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser; import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
...@@ -15,6 +16,7 @@ import com.yifu.cloud.plus.v1.yifu.common.dapr.config.DaprSocialProperties; ...@@ -15,6 +16,7 @@ import com.yifu.cloud.plus.v1.yifu.common.dapr.config.DaprSocialProperties;
import com.yifu.cloud.plus.v1.yifu.common.dapr.util.HttpDaprUtil; import com.yifu.cloud.plus.v1.yifu.common.dapr.util.HttpDaprUtil;
import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils; import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import com.yifu.cloud.plus.v1.yifu.salary.entity.*; import com.yifu.cloud.plus.v1.yifu.salary.entity.*;
import com.yifu.cloud.plus.v1.yifu.salary.mapper.SysConfigLimitMapper;
import com.yifu.cloud.plus.v1.yifu.salary.mapper.TSalaryStandardMapper; import com.yifu.cloud.plus.v1.yifu.salary.mapper.TSalaryStandardMapper;
import com.yifu.cloud.plus.v1.yifu.salary.service.*; import com.yifu.cloud.plus.v1.yifu.salary.service.*;
import com.yifu.cloud.plus.v1.yifu.salary.util.SalaryAccountUtil; import com.yifu.cloud.plus.v1.yifu.salary.util.SalaryAccountUtil;
...@@ -34,6 +36,7 @@ import java.math.RoundingMode; ...@@ -34,6 +36,7 @@ import java.math.RoundingMode;
import java.net.URLDecoder; import java.net.URLDecoder;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.*; import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
/** /**
* 标准薪酬工资表 * 标准薪酬工资表
...@@ -89,6 +92,10 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper, ...@@ -89,6 +92,10 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper,
// 缓存信息 // 缓存信息
private final CacheManager cacheManager; private final CacheManager cacheManager;
private AtomicInteger importTwoAtomicInteger = new AtomicInteger(0);
private final SysConfigLimitMapper configLimitMapper;
/** /**
* vo.jsonString 客户原表数据 * vo.jsonString 客户原表数据
* repeatFlag 默认 0:不允许重复导入已存在系统内的数据;1:允许重复导入 * repeatFlag 默认 0:不允许重复导入已存在系统内的数据;1:允许重复导入
...@@ -99,6 +106,28 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper, ...@@ -99,6 +106,28 @@ public class SalaryUploadServiceImpl extends ServiceImpl<TSalaryStandardMapper,
**/ **/
@Override @Override
public R<List<ErrorMessage>> salaryUpload(SalaryUploadParamVo vo) { public R<List<ErrorMessage>> salaryUpload(SalaryUploadParamVo vo) {
Integer maxLimit = configLimitMapper.getSysConfigLimitByKey("IMPORT_SALARY_TWO_LIMIT");
if (Common.isEmpty(maxLimit)) {
maxLimit = 10;
}
if (importTwoAtomicInteger.incrementAndGet() <= maxLimit){
try {
return this.salaryUploadCore(vo);
} catch (Exception e){
log.error("薪资导入异常:",e);
} finally {
importTwoAtomicInteger.decrementAndGet();
}
} else {
// 前面做了+1(atomicInteger.incrementAndGet())这里也要-1
importTwoAtomicInteger.decrementAndGet();
log.error("超出阈值:"+ ResultConstants.IMPORT_DOWN_LOAD_DATA);
return R.failed("薪资导入," + ResultConstants.IMPORT_DOWN_LOAD_DATA);
}
return R.failed("薪资导入," + ResultConstants.IMPORT_DOWN_LOAD_DATA);
}
private R<List<ErrorMessage>> salaryUploadCore(SalaryUploadParamVo vo) {
// R<List<ErrorMessage>> salaryUpload(String jsonString, String settleDepart, String configId, String salaryType, String orderId) // R<List<ErrorMessage>> salaryUpload(String jsonString, String settleDepart, String configId, String salaryType, String orderId)
String jsonString = vo.getJsonString(); String jsonString = vo.getJsonString();
String settleDepart = vo.getSettleDepart(); String settleDepart = vo.getSettleDepart();
......
...@@ -26,13 +26,14 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; ...@@ -26,13 +26,14 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.monitorjbl.xlsx.StreamingReader; import com.monitorjbl.xlsx.StreamingReader;
import com.yifu.cloud.plus.v1.check.entity.TCheckIdCard; import com.yifu.cloud.plus.v1.check.entity.TCheckIdCard;
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.constant.ResultConstants;
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.DateUtil; import com.yifu.cloud.plus.v1.yifu.common.core.util.DateUtil;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R; import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryStandardOriginal; import com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryStandardOriginal;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryStandardOriginalDetail; import com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryStandardOriginalDetail;
import com.yifu.cloud.plus.v1.yifu.salary.mapper.SysConfigLimitMapper;
import com.yifu.cloud.plus.v1.yifu.salary.mapper.TSalaryStandardOriginalMapper; import com.yifu.cloud.plus.v1.yifu.salary.mapper.TSalaryStandardOriginalMapper;
import com.yifu.cloud.plus.v1.yifu.salary.service.SalaryUploadService;
import com.yifu.cloud.plus.v1.yifu.salary.service.TSalaryStandardOriginalDetailService; import com.yifu.cloud.plus.v1.yifu.salary.service.TSalaryStandardOriginalDetailService;
import com.yifu.cloud.plus.v1.yifu.salary.service.TSalaryStandardOriginalService; import com.yifu.cloud.plus.v1.yifu.salary.service.TSalaryStandardOriginalService;
import com.yifu.cloud.plus.v1.yifu.salary.util.SalaryConstants; import com.yifu.cloud.plus.v1.yifu.salary.util.SalaryConstants;
...@@ -55,6 +56,7 @@ import java.util.ArrayList; ...@@ -55,6 +56,7 @@ import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
...@@ -70,9 +72,12 @@ import java.util.regex.Pattern; ...@@ -70,9 +72,12 @@ import java.util.regex.Pattern;
public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStandardOriginalMapper, TSalaryStandardOriginal> public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStandardOriginalMapper, TSalaryStandardOriginal>
implements TSalaryStandardOriginalService { implements TSalaryStandardOriginalService {
private final SalaryUploadService salaryUploadService;
private final TSalaryStandardOriginalDetailService tSalaryStandardOriginalDetailService; private final TSalaryStandardOriginalDetailService tSalaryStandardOriginalDetailService;
private AtomicInteger importAtomicInteger = new AtomicInteger(0);
private final SysConfigLimitMapper configLimitMapper;
/** /**
* @Description: 分页查询 * @Description: 分页查询
* @Author: hgw * @Author: hgw
...@@ -790,7 +795,25 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand ...@@ -790,7 +795,25 @@ public class TSalaryStandardOriginalServiceImpl extends ServiceImpl<TSalaryStand
**/ **/
@Override @Override
public R<SalaryUploadParamVo> salaryUploadByOriginal(MultipartFile file, SalaryUploadOriginalParamVo excelVo) { public R<SalaryUploadParamVo> salaryUploadByOriginal(MultipartFile file, SalaryUploadOriginalParamVo excelVo) {
return this.getExcelContent(file, excelVo); Integer maxLimit = configLimitMapper.getSysConfigLimitByKey("IMPORT_SALARY_ONE_LIMIT");
if (Common.isEmpty(maxLimit)) {
maxLimit = 10;
}
if (importAtomicInteger.incrementAndGet() <= maxLimit){
try {
return this.getExcelContent(file, excelVo);
} catch (Exception e){
log.error("薪资原表识别异常:",e);
} finally {
importAtomicInteger.decrementAndGet();
}
} else {
// 前面做了+1(atomicInteger.incrementAndGet())这里也要-1
importAtomicInteger.decrementAndGet();
log.error("超出阈值:"+ ResultConstants.IMPORT_DOWN_LOAD_DATA);
return R.failed("薪资原表识别," + ResultConstants.IMPORT_DOWN_LOAD_DATA);
}
return R.failed("薪资原表识别中," + ResultConstants.IMPORT_DOWN_LOAD_DATA);
} }
/** /**
......
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