Commit 46d98b15 authored by fangxinjiang's avatar fangxinjiang

绅士-fxj

parent 4604a0f6
......@@ -33,7 +33,7 @@ spec: # 资源规范字段
#dapr.io/sidecar-memory-limit: "800Mi" #Dapr sidecar可以使用的最大内存量。默认情况下未设置 请参阅 https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/quota-memory-cpu-namespace/ 的有效值。
#dapr.io/sidecar-cpu-request: 1 #Dapr sidecar要求的 CPU 数量
#dapr.io/sidecar-memory-request #Dapr sidecar 请求的内存数量
dapr.io/http-max-request-size: "100" #增加http和grpc服务器请求正文参数的最大大小,单位为MB,以处理大文件的上传。 默认值为 4 MB
dapr.io/http-max-request-size: "200" #增加http和grpc服务器请求正文参数的最大大小,单位为MB,以处理大文件的上传。 默认值为 4 MB
dapr.io/http-read-buffer-size: "16" #Dapr has a default limit of 4KB for the http header read buffer size. When sending http headers that are bigger than the default 4KB, you can increase this value. Otherwise, you may encounter a Too big request header
dapr.io/sidecar-listen-addresses: "0.0.0.0"
# 更多dapr配置请参考 https://www.bookstack.cn/read/dapr-1.5-zh/cc77b74e2cc2f4d4.md
......
......@@ -33,7 +33,7 @@ spec: # 资源规范字段
#dapr.io/sidecar-memory-limit: "800Mi" #Dapr sidecar可以使用的最大内存量。默认情况下未设置 请参阅 https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/quota-memory-cpu-namespace/ 的有效值。
#dapr.io/sidecar-cpu-request: 1 #Dapr sidecar要求的 CPU 数量
#dapr.io/sidecar-memory-request #Dapr sidecar 请求的内存数量
dapr.io/http-max-request-size: "100" #增加http和grpc服务器请求正文参数的最大大小,单位为MB,以处理大文件的上传。 默认值为 4 MB
dapr.io/http-max-request-size: "200" #增加http和grpc服务器请求正文参数的最大大小,单位为MB,以处理大文件的上传。 默认值为 4 MB
dapr.io/http-read-buffer-size: "16" #Dapr has a default limit of 4KB for the http header read buffer size. When sending http headers that are bigger than the default 4KB, you can increase this value. Otherwise, you may encounter a Too big request header
#dapr.io/sidecar-listen-addresses: "0.0.0.0"
# 更多dapr配置请参考 https://www.bookstack.cn/read/dapr-1.5-zh/cc77b74e2cc2f4d4.md
......
......@@ -170,6 +170,10 @@ public interface CacheConstants {
String EMP_ADD_LOCK ="emp_add_lock";
String SALARY_ACCOUNT_EXPORT_LOCK ="salary_account_export_lock";
String SALARY_ACCOUNT_AUDIT_EXPORT_LOCK ="salary_account_audit_export_lock";
String FUND_IMPORT_HANDLE_LOCK = "fund_import_handle_handle_lock";
// 项目报销token的key
......
......@@ -373,6 +373,8 @@ public interface CommonConstants {
int EXCEL_EXPORT_LIMIT_1 = 10000;
int EXCEL_EXPORT_LIMIT_2 = 20000;
String USER = "用户";
/**
......
......@@ -24,4 +24,5 @@ public class ResultConstants {
public static final String NO_ID = "操作失败,id不能为空!";
public static final String FILE_UPLOADING_DATA = "附件排队上传中,请稍后重试!";
public static final String FILE_DOWN_LOAD_DATA = "导出排队下载中,请稍后重试!";
}
/*
* 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.salary.entity;
import com.alibaba.excel.annotation.ExcelProperty;
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 io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
/**
* @Author fxj
* @Description 系统下载限制配置表
* @Date 15:08 2024/10/23
* @Param
* @return
**/
@Data
@TableName("sys_config_limit")
@Schema(description = "系统限制配置表")
public class SysConfigLimit {
/**
* id
*/
@TableId(type = IdType.ASSIGN_ID)
@ExcelProperty("id")
@Schema(description = "id")
private String id;
/**
* 限制键
*/
@ExcelAttribute(name = "限制键", isNotEmpty = true, errorInfo = "限制键不能为空", maxLength = 32)
@NotBlank(message = "限制键不能为空")
@Length(max = 32, message = "限制键不能超过32个字符")
@ExcelProperty("限制键")
@Schema(description = "限制键")
private String configKey;
/**
* 限制值
*/
@ExcelAttribute(name = "限制值", isNotEmpty = true, errorInfo = "限制值不能为空")
@NotBlank(message = "限制值不能为空")
@ExcelProperty("限制值")
@Schema(description = "限制值")
private Integer configValue;
/**
* 备注
*/
@ExcelAttribute(name = "备注", maxLength = 255)
@Length(max = 255, message = "备注不能超过255个字符")
@ExcelProperty("备注")
@Schema(description = "备注")
private String remark;
}
package com.yifu.cloud.plus.v1.yifu.salary.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.HeadFontStyle;
import lombok.Data;
/**
* @Author fxj
* @Date 2024/10/22
* @Description
* @Version 1.0
*/
@Data
public class ExportErrorVo {
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("异常信息")
private String errorMessage;
public ExportErrorVo(String errorMessage) {
this.errorMessage = errorMessage;
}
}
/*
* 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.salary.vo;
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.TableField;
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 com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryAccountItem;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* @Author fxj
* @Description 工资报账主表(工资条)导出
* @Date 11:17 2024/10/22
* @Param
* @return
**/
@Data
@Schema(description = "工资报账主表(工资条)")
@HeadFontStyle(fontHeightInPoints = 11)
public class SalaryAccountExportVo{
/**
* 项目name
*/
@ExcelAttribute(name = "项目名称", isNotEmpty = true, errorInfo = "项目name不能为空", maxLength = 50)
@NotBlank(message = "项目名称不能为空")
@Length(max = 50, message = "项目名称不能超过50个字符")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("项目名称")
private String deptName;
/**
* 项目no
*/
@ExcelAttribute(name = "项目编码", isNotEmpty = true, errorInfo = "项目no不能为空", maxLength = 50)
@NotBlank(message = "项目编码不能为空")
@Length(max = 50, message = "项目编码不能超过50个字符")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("项目编码")
private String deptNo;
/**
* 员工姓名
*/
@ExcelAttribute(name = "员工姓名", maxLength = 50)
@Length(max = 50, message = "员工姓名不能超过50个字符")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("员工姓名")
private String empName;
/**
* 员工身份证号
*/
@ExcelAttribute(name = "身份证号", maxLength = 25)
@Length(max = 25, message = "身份证号不能超过25个字符")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("身份证号")
private String empIdcard;
/**
* 手机号
*/
@ExcelAttribute(name = "手机号码", maxLength = 11)
@Length(max = 11, message = "手机号码不能超过11个字符")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("手机号码")
private String empPhone;
/**
* 银行卡号
*/
@ExcelProperty("银行卡号")
private String bankNo;
/**
* 开户行总行
*/
@ExcelProperty("开户行总行")
private String bankName;
/**
* 开户行省
*/
@ExcelProperty("开户行省")
private String bankProvince;
/**
* 开户行市
*/
@ExcelProperty("开户行市")
private String bankCity;
/**
* 开户行支行
*/
@ExcelProperty("开户行支行")
private String bankSubName;
/**
* 表单类型0:薪资;1:绩效;2:其他;3:劳务费;4:稿酬
*/
@ExcelProperty("表单类型")
private String formType;
/**
* 薪酬月份
*/
@ExcelProperty("薪酬月份")
private String salaryMonth;
/**
* 结算月
*/
@ExcelProperty("结算月")
private String settlementMonth;
}
......@@ -34,7 +34,7 @@ import java.math.BigDecimal;
@Schema(description = "工资报账导出-审核人专用")
@HeadFontStyle(fontHeightInPoints = 11)
public class TSalaryAccountExportVo {
private String id;
// 是否劳务费 手机号 计税月份 发放时间 结算月份 工资月份 出账单位 结算单位 结算单位编码
// 结算部门 部门编码 人员类型 在职状态 员工姓名 身份证号 工资应发 实发工资合计
// 年终奖 薪资个税 年终奖扣税 代扣个人社保 代扣个人公积金 个人社保 个人公积金
......
/*
* 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.salary.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.HeadFontStyle;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.math.BigDecimal;
/**
* 工资报账表明细项 t_salary_account_item
*
* @author hgw
* @date 2023-2-17 17:41:43
*/
@Data
@Schema(description = "工资报账表明细项")
@HeadFontStyle(fontHeightInPoints = 11)
public class TSalaryAccountItemExportVo {
private String salaryAccountId;
@ExcelProperty("个人代扣明细")
private String pdeductionDetail;
@ExcelProperty("个人代扣金额")
private String pdeductionMoney;
}
......@@ -21,8 +21,11 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TSettleDomainListVo;
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.ResultConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.SecurityConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.redis.RedisDistributedLock;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.LocalDateTimeUtils;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
......@@ -206,8 +209,11 @@ public class TSalaryAccountController {
@PreAuthorize("@pms.hasPermission('salary_tsalaryaccount-export')")
public void export(HttpServletResponse response, @RequestBody TSalaryAccountSearchVo searchVo) {
YifuUser user = SecurityUtils.getUser();
if (Common.isEmpty(user)){
tSalaryAccountService.exportError(response, CommonConstants.USER_FAIL);
}
menuUtil.setAuthSql(user, searchVo);
tSalaryAccountService.listExport(response, searchVo);
tSalaryAccountService.exportAsso(response, searchVo,CommonConstants.ZERO_INT);
}
/**
......@@ -219,7 +225,7 @@ public class TSalaryAccountController {
@PostMapping("/auditExport")
@PreAuthorize("@pms.hasPermission('account_audit_export')")
public void auditExport(HttpServletResponse response, @RequestBody TSalaryAccountSearchVo searchVo) {
tSalaryAccountService.auditExport(response, searchVo);
tSalaryAccountService.exportAsso(response, searchVo,CommonConstants.ONE_INT);
}
/**
......
/*
* 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.salary.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yifu.cloud.plus.v1.yifu.salary.entity.SysConfigLimit;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* 系统限制配置表
*
* @author hgw
* @date 2024-09-24 17:39:57
*/
@Mapper
public interface SysConfigLimitMapper extends BaseMapper<SysConfigLimit> {
/**
* 系统限制配置表简单分页查询
*
* @param configKey 键
* @return
*/
Integer getSysConfigLimitByKey(@Param("configKey") String configKey);
}
......@@ -43,7 +43,9 @@ public interface TSalaryAccountMapper extends BaseMapper<TSalaryAccount> {
* @param tSalaryAccount 工资报账主表(工资条)
* @return
*/
IPage<TSalaryAccount> getTSalaryAccountPage(Page<TSalaryAccount> page, @Param("tSalaryAccount") TSalaryAccount tSalaryAccount);
IPage<TSalaryAccount> getTSalaryAccountPage(Page<TSalaryAccount> page,
@Param("tSalaryAccount") TSalaryAccount tSalaryAccount,
@Param("deptNos") List<String> deptNos);
List<TSalaryAccount> getTSalaryAccountPageDiy( @Param("tSalaryAccount") TSalaryAccount tSalaryAccount,@Param("page")Long page, @Param("size")Long size);
......@@ -107,10 +109,17 @@ public interface TSalaryAccountMapper extends BaseMapper<TSalaryAccount> {
List<TSalaryAccount> noPageDiy(@Param("searchVo") TSalaryAccountSearchVo searchVo,
@Param("idList") List<String> idList);
List<SalaryAccountExportVo> noPageDiyLast(@Param("searchVo") TSalaryAccountSearchVo searchVo,
@Param("idList") List<String> idList,
@Param("deptNos") List<String> deptNos);
List<TSalaryAccountExportVo> auditExport(@Param("searchVo") TSalaryAccountSearchVo searchVo,
@Param("idList") List<String> idList);
List<TSalaryAccountExportVo> auditExportDiy(@Param("searchVo") TSalaryAccountSearchVo searchVo,
@Param("idList") List<String> idList);
List<TSalaryAccountItemExportVo> auditExportSelectItems(@Param("idList") List<String> idList);
List<TSalaryAccount> getAccountListBySalaryId(@Param("searchVo") TSalaryAccountSearchVo searchVo);
// 导出报账专用hgw
......@@ -127,9 +136,16 @@ public interface TSalaryAccountMapper extends BaseMapper<TSalaryAccount> {
int noPageCountDiy(@Param("searchVo") TSalaryAccountSearchVo searchVo,
@Param("idList") List<String> idList);
int noPageCountDiyLast(@Param("searchVo") TSalaryAccountSearchVo searchVo,
@Param("idList") List<String> idList,
@Param("deptNos")List<String> deptNos);
int auditExportCount(@Param("searchVo") TSalaryAccountSearchVo searchVo,
@Param("idList") List<String> idList);
int auditExportCountDiy(@Param("searchVo") TSalaryAccountSearchVo searchVo,
@Param("idList") List<String> idList);
/**
* @param salaryId 工资表id
* @Description: 退表回退状态
......
......@@ -44,6 +44,14 @@ public interface TSalaryAccountService extends IService<TSalaryAccount> {
* @return
*/
IPage<TSalaryAccount> getTSalaryAccountPage(Page<TSalaryAccount> page, TSalaryAccountSearchVo tSalaryAccount);
/**
* @Author fxj
* @Description 薪资报账导出统一导出限制
* @Date 15:25 2024/10/23
* @Param
* @return
**/
void exportAsso(HttpServletResponse response, TSalaryAccountSearchVo searchVo,int type);
void listExport(HttpServletResponse response, TSalaryAccountSearchVo searchVo);
......@@ -55,6 +63,8 @@ public interface TSalaryAccountService extends IService<TSalaryAccount> {
**/
void auditExport(HttpServletResponse response, TSalaryAccountSearchVo searchVo);
void exportError(HttpServletResponse response, String errorMessage);
/**
* @param salaryId
* @Description: 根据工资id,返回报账明细(字段较少且有计算,其他地方勿用)
......@@ -66,6 +76,8 @@ public interface TSalaryAccountService extends IService<TSalaryAccount> {
List<TSalaryAccount> noPageDiy(TSalaryAccountSearchVo searchVo);
List<SalaryAccountExportVo> noPageDiyLast(TSalaryAccountSearchVo searchVo,List<String> deptNos);
/**
* @param searchVo
* @Description: 无需权限仅按照工资id查询报账
......
......@@ -20,19 +20,27 @@ import com.alibaba.excel.EasyExcelFactory;
import com.alibaba.excel.ExcelWriter;
import com.alibaba.excel.write.metadata.WriteSheet;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
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.DateUtil;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.ekp.vo.EkpSalaryParamVo;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.EkpSocialViewVo;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TDeptSee;
import com.yifu.cloud.plus.v1.yifu.salary.entity.THaveSalaryNosocial;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryAccount;
import com.yifu.cloud.plus.v1.yifu.salary.mapper.SysConfigLimitMapper;
import com.yifu.cloud.plus.v1.yifu.salary.mapper.TDeptSeeMapper;
import com.yifu.cloud.plus.v1.yifu.salary.mapper.TSalaryAccountMapper;
import com.yifu.cloud.plus.v1.yifu.salary.service.TSalaryAccountService;
import com.yifu.cloud.plus.v1.yifu.salary.vo.*;
import lombok.RequiredArgsConstructor;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.servlet.ServletOutputStream;
......@@ -44,6 +52,8 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
/**
* 工资报账主表(工资条)
......@@ -52,8 +62,17 @@ import java.util.Map;
* @date 2022-08-05 11:40:14
*/
@Log4j2
@RequiredArgsConstructor
@Service
public class TSalaryAccountServiceImpl extends ServiceImpl<TSalaryAccountMapper, TSalaryAccount> implements TSalaryAccountService {
@Autowired
private TDeptSeeMapper deptSeeMapper;
private AtomicInteger atomicInteger = new AtomicInteger(0);
//初始化附件上传队列上限值
private int maxLimit = 1;
private final SysConfigLimitMapper configLimitMapper;
/**
* 工资报账主表(工资条)简单分页查询
*
......@@ -62,9 +81,45 @@ public class TSalaryAccountServiceImpl extends ServiceImpl<TSalaryAccountMapper,
*/
@Override
public IPage<TSalaryAccount> getTSalaryAccountPage(Page<TSalaryAccount> page, TSalaryAccountSearchVo tSalaryAccount) {
return baseMapper.getTSalaryAccountPage(page, tSalaryAccount);
// 不可查询项目合集 fxj 2024-10-23 优化
List<TDeptSee> depts = deptSeeMapper.selectList(Wrappers.<TDeptSee>query().lambda().eq(TDeptSee::getCanSee,CommonConstants.ONE_INT));
List<String> deptNos = null;
if (Common.isNotNull(depts)){
deptNos = depts.stream().map(TDeptSee::getDeptNo).collect(Collectors.toList());
}
return baseMapper.getTSalaryAccountPage(page, tSalaryAccount,deptNos);
}
/**
* @Author fxj
* @Description
* @Date 15:27 2024/10/23
* @Param type 0 报账批量导出 1 报账审核人导出
* @return
**/
@Override
public void exportAsso(HttpServletResponse response, TSalaryAccountSearchVo searchVo,int type) {
maxLimit = configLimitMapper.getSysConfigLimitByKey("DOWN_LOAD_MAX_LIMIT");
if (atomicInteger.incrementAndGet() <= maxLimit){
try {
if (CommonConstants.ZERO_INT == type){
listExport(response, searchVo);
}else if (CommonConstants.ONE_INT == type){
auditExport(response, searchVo);
}
}catch (Exception e){
log.error("导出异常:",e);
}finally {
atomicInteger.decrementAndGet();
}
}else {
// 前面做了+1(atomicInteger.incrementAndGet())这里也要-1
atomicInteger.decrementAndGet();
log.error("超出阈值:"+ ResultConstants.FILE_DOWN_LOAD_DATA);
exportError(response, ResultConstants.FILE_DOWN_LOAD_DATA);
}
}
/**
* 工资报账主表(工资条)批量导出
*
......@@ -74,8 +129,14 @@ public class TSalaryAccountServiceImpl extends ServiceImpl<TSalaryAccountMapper,
public void listExport(HttpServletResponse response, TSalaryAccountSearchVo searchVo) {
String fileName = "员工报账查询批量导出" + DateUtil.getThisTime() + CommonConstants.XLSX;
//获取要导出的列表
List<TSalaryAccount> list = new ArrayList<>();
long count = noPageCountDiy(searchVo);
List<SalaryAccountExportVo> list = new ArrayList<>();
// 不可查询项目合集 fxj 2024-10-23 优化
List<TDeptSee> depts = deptSeeMapper.selectList(Wrappers.<TDeptSee>query().lambda().eq(TDeptSee::getCanSee,CommonConstants.ONE_INT));
List<String> deptNos = null;
if (Common.isNotNull(depts)){
deptNos = depts.stream().map(TDeptSee::getDeptNo).collect(Collectors.toList());
}
long count = noPageCountDiyLast(searchVo,deptNos);
ServletOutputStream out = null;
try {
out = response.getOutputStream();
......@@ -85,17 +146,20 @@ public class TSalaryAccountServiceImpl extends ServiceImpl<TSalaryAccountMapper,
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭
ExcelWriter excelWriter = EasyExcelFactory.write(out, TSalaryAccount.class).includeColumnFiledNames(searchVo.getExportFields()).build();
int index = 0;
WriteSheet writeSheet;
WriteSheet writeSheet = null;
if (count > CommonConstants.ZERO_INT) {
for (int i = 0; i <= count; i += CommonConstants.EXCEL_EXPORT_LIMIT_3) {
for (int i = 0; i <= count; i += CommonConstants.EXCEL_EXPORT_LIMIT_1) {
// 获取实际记录
searchVo.setLimitStart(i);
searchVo.setLimitEnd(CommonConstants.EXCEL_EXPORT_LIMIT_3);
list = noPageDiy(searchVo);
searchVo.setLimitEnd(CommonConstants.EXCEL_EXPORT_LIMIT_1);
list = noPageDiyLast(searchVo,deptNos);
if (Common.isNotNull(list)) {
log.error("导出条数:"+list.size());
if (i%CommonConstants.EXCEL_EXPORT_LIMIT==0){
writeSheet = EasyExcelFactory.writerSheet("工资报账主表(工资条)" + index).build();
excelWriter.write(list, writeSheet);
index++;
}
excelWriter.write(list, writeSheet);
list.clear();
}
}
......@@ -131,7 +195,7 @@ public class TSalaryAccountServiceImpl extends ServiceImpl<TSalaryAccountMapper,
String fileName = "员工报账导出" + DateUtil.getThisTime() + CommonConstants.XLSX;
//获取要导出的列表
List<TSalaryAccountExportVo> list = new ArrayList<>();
long count = baseMapper.auditExportCount(searchVo, searchVo.getIdList());
long count = baseMapper.auditExportCountDiy(searchVo, searchVo.getIdList());
ServletOutputStream out = null;
try {
out = response.getOutputStream();
......@@ -141,19 +205,41 @@ public class TSalaryAccountServiceImpl extends ServiceImpl<TSalaryAccountMapper,
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭
ExcelWriter excelWriter = EasyExcelFactory.write(out, TSalaryAccountExportVo.class).includeColumnFiledNames(searchVo.getExportFields()).build();
int index = 0;
WriteSheet writeSheet;
WriteSheet writeSheet = null;
if (count > CommonConstants.ZERO_INT) {
for (int i = 0; i <= count; i += CommonConstants.EXCEL_EXPORT_LIMIT_3) {
Map<String,TSalaryAccountItemExportVo> itemExportVoMap = new HashMap<>();
List<String> idList = null;
List<TSalaryAccountItemExportVo> items = null;
for (int i = 0; i <= count; i += CommonConstants.EXCEL_EXPORT_LIMIT_2) {
// 获取实际记录
searchVo.setLimitStart(i);
searchVo.setLimitEnd(CommonConstants.EXCEL_EXPORT_LIMIT_3);
list = baseMapper.auditExport(searchVo, searchVo.getIdList());
searchVo.setLimitEnd(CommonConstants.EXCEL_EXPORT_LIMIT_2);
list = baseMapper.auditExportDiy(searchVo, searchVo.getIdList());
if (Common.isNotNull(list)) {
log.error("导出条数:"+list.size());
//先把数据封装完成
idList = list.stream().map(TSalaryAccountExportVo::getId).collect(Collectors.toList());
if (Common.isNotNull(idList)){
items = baseMapper.auditExportSelectItems(idList);
}
if (Common.isNotNull(items)){
itemExportVoMap = items.stream().collect(Collectors.toMap(TSalaryAccountItemExportVo::getSalaryAccountId,vo -> vo,(k1,k2) -> k1));
}
//封装信息
initResult(list, itemExportVoMap);
if (i%CommonConstants.EXCEL_EXPORT_LIMIT==0){
writeSheet = EasyExcelFactory.writerSheet("工资报账" + index).build();
excelWriter.write(list, writeSheet);
index++;
}
excelWriter.write(list, writeSheet);
list.clear();
}
if (Common.isNotNull(idList)){
idList.clear();
}
if (Common.isNotNull(itemExportVoMap)){
itemExportVoMap.clear();
}
}
} else {
writeSheet = EasyExcelFactory.writerSheet("工资报账" + index).build();
......@@ -167,6 +253,7 @@ public class TSalaryAccountServiceImpl extends ServiceImpl<TSalaryAccountMapper,
} catch (Exception e) {
log.error("执行异常", e);
} finally {
try {
if (null != out) {
out.close();
......@@ -177,6 +264,17 @@ public class TSalaryAccountServiceImpl extends ServiceImpl<TSalaryAccountMapper,
}
}
private void initResult(List<TSalaryAccountExportVo> list, Map<String, TSalaryAccountItemExportVo> itemExportVoMap) {
TSalaryAccountItemExportVo voTemp;
for (TSalaryAccountExportVo vo: list){
voTemp = itemExportVoMap.get(vo.getId());
if (Common.isNotNull(voTemp)){
vo.setPdeductionMoney(voTemp.getPdeductionMoney());
vo.setPdeductionDetail(voTemp.getPdeductionDetail());
}
}
}
/**
* @Description: 根据工资id,返回报账明细(字段较少且有计算,其他地方勿用)
* @Author: hgw
......@@ -193,6 +291,11 @@ public class TSalaryAccountServiceImpl extends ServiceImpl<TSalaryAccountMapper,
return baseMapper.noPageDiy(searchVo,searchVo.getIdList());
}
@Override
public List<SalaryAccountExportVo> noPageDiyLast(TSalaryAccountSearchVo searchVo,List<String> deptNos) {
return baseMapper.noPageDiyLast(searchVo,searchVo.getIdList(),deptNos);
}
@Override
public List<TSalaryAccount> getAccountListBySalaryId(TSalaryAccountSearchVo searchVo) {
return baseMapper.getAccountListBySalaryId(searchVo);
......@@ -214,6 +317,10 @@ public class TSalaryAccountServiceImpl extends ServiceImpl<TSalaryAccountMapper,
return baseMapper.noPageCountDiy(searchVo,searchVo.getIdList());
}
private int noPageCountDiyLast(TSalaryAccountSearchVo searchVo,List<String> deptNos) {
return baseMapper.noPageCountDiyLast(searchVo,searchVo.getIdList(),deptNos);
}
@Override
public Map<String, Integer> getAccountCheckMap(String settleId, String settleMonth, String salaryType) {
List<AccountCheckVo> list;
......@@ -406,4 +513,40 @@ public class TSalaryAccountServiceImpl extends ServiceImpl<TSalaryAccountMapper,
public List<TSalaryTypeFourExportEkpVo> getAccountFourListByApplyNo(String applyNo) {
return baseMapper.getAccountFourListByApplyNo(applyNo);
}
@Override
public void exportError(HttpServletResponse response, String errorMessage) {
String fileName = "导出异常" + DateUtil.getThisTime() + CommonConstants.XLSX;
//获取要导出的列表
List<ExportErrorVo> list = new ArrayList<>();
list.add(new ExportErrorVo(errorMessage));
long count = 0;
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, "UTF-8"));
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭
ExcelWriter excelWriter = EasyExcelFactory.write(out, ExportErrorVo.class).build();
int index = 0;
WriteSheet writeSheet = EasyExcelFactory.writerSheet("异常信息" + index).build();
excelWriter.write(list, writeSheet);
if (Common.isNotNull(list)) {
list.clear();
}
out.flush();
excelWriter.finish();
} catch (Exception e) {
log.error("执行异常", e);
} finally {
try {
if (null != out) {
out.close();
}
} catch (IOException e) {
log.error("执行异常", e);
}
}
}
}
......@@ -26,7 +26,7 @@ mybatis-plus:
logic-not-delete-value: 0
configuration:
map-underscore-to-camel-case: true
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
#log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
# spring security 配置
security:
......@@ -72,7 +72,7 @@ spring:
servlet:
multipart:
#所有上传文件最大大小
max-request-size: 100MB
max-request-size: 250MB
#单个文件最大大小
max-file-size: 50MB
#swagger 文档 https://springdoc.org/
......
<?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.salary.mapper.SysConfigLimitMapper">
<resultMap id="sysConfigLimitMap" type="com.yifu.cloud.plus.v1.yifu.salary.entity.SysConfigLimit">
<id property="id" column="ID"/>
<result property="configKey" column="CONFIG_KEY"/>
<result property="configValue" column="CONFIG_VALUE"/>
<result property="remark" column="REMARK"/>
</resultMap>
<!-- 根据key获取value -->
<select id="getSysConfigLimitByKey" resultType="java.lang.Integer">
SELECT a.CONFIG_VALUE
FROM sys_config_limit a
where a.CONFIG_KEY = #{configKey} limit 1
</select>
</mapper>
......@@ -554,10 +554,16 @@
</if>
<where>
a.DELETE_FLAG = 0
and not EXISTS (
/*and not EXISTS (
select 1 from t_dept_see d where a.DEPT_NO = d.DEPT_NO and d.CAN_SEE = 1
)
)*/
<include refid="tSalaryAccount_where"/>
<if test="deptNos != null and deptNos.size>0">
AND a.DEPT_NO not in
<foreach item="no" index="index" collection="deptNos" open="(" separator="," close=")">
#{no}
</foreach>
</if>
<if test="tSalaryAccount.authSql != null and tSalaryAccount.authSql.trim() != ''">
${tSalaryAccount.authSql}
</if>
......@@ -1496,5 +1502,175 @@
<select id="getAccountIdByIdCard" resultType="java.lang.Integer">
select count(1) from t_salary_account a where a.DELETE_FLAG = 0 and a.EMP_IDCARD = #{empIdCard} and a.SETTLEMENT_MONTH like concat(DATE_FORMAT(NOW(), '%Y'), '%')
</select>
<select id="noPageDiyLast" resultMap="tSalaryAccountMap" parameterType="com.yifu.cloud.plus.v1.yifu.salary.vo.SalaryAccountExportVo">
SELECT
a.DEPT_NAME,
a.DEPT_NO,
a.EMP_NAME,
a.EMP_IDCARD,
a.EMP_PHONE,
a.BANK_NO,
a.BANK_NAME,
ap.AREA_NAME BANK_PROVINCE,
ac.AREA_NAME BANK_CITY,
a.BANK_SUB_NAME,
case a.FORM_TYPE when '0' then '薪资' when '1' then '绩效' when '3' then '劳务费' when '4' then '稿酬' else '其他' end as FORM_TYPE,
a.SALARY_MONTH,
if(a.RELAY_SALARY_UNIT is not null and a.RELAY_SALARY_UNIT != 0,a.RELAY_SALARY_UNIT,ifnull(a.RELAY_SALARY,0)) RELAY_SALARY,
a.ACTUAL_SALARY
FROM
<if test="searchVo.salaryMonthStart == null or searchVo.salaryMonthStart.trim() >= '202201'">
t_salary_account a
</if>
<if test="searchVo.salaryMonthStart != null and searchVo.salaryMonthStart.trim() &lt; '202201' ">
t_salary_account_hro_2021 a
</if>
left join sys_area ap on ap.id=a.BANK_PROVINCE
left join sys_area ac on ac.id=a.BANK_CITY
<where>
a.DELETE_FLAG = 0
/*and not EXISTS (
select 1 from t_dept_see d where a.DEPT_NO = d.DEPT_NO and d.CAN_SEE = 1
)*/
<include refid="where_export"/>
<if test="deptNos != null and deptNos.size>0">
AND a.DEPT_NO not in
<foreach item="no" index="index" collection="deptNos" open="(" separator="," close=")">
#{no}
</foreach>
</if>
<if test="searchVo.authSql != null and searchVo.authSql.trim() != ''">
${searchVo.authSql}
</if>
ORDER BY a.CREATE_TIME desc
<if test="searchVo != null">
<if test="searchVo.limitStart != null">
limit #{searchVo.limitStart},#{searchVo.limitEnd}
</if>
</if>
</where>
</select>
<select id="noPageCountDiyLast" resultType="java.lang.Integer">
SELECT
count(1)
FROM
<if test="searchVo.salaryMonthStart == null or searchVo.salaryMonthStart.trim() >= '202201' ">
t_salary_account a
</if>
<if test="searchVo.salaryMonthStart != null and searchVo.salaryMonthStart.trim() &lt; '202201' ">
t_salary_account_hro_2021 a
</if>
<where>
a.DELETE_FLAG = 0
/*and not EXISTS (
select 1 from t_dept_see d where a.DEPT_NO = d.DEPT_NO and d.CAN_SEE = 1
)*/
<include refid="where_export"/>
<if test="deptNos != null and deptNos.size>0">
AND a.DEPT_NO not in
<foreach item="no" index="index" collection="deptNos" open="(" separator="," close=")">
#{no}
</foreach>
</if>
<if test="searchVo.authSql != null and searchVo.authSql.trim() != ''">
${searchVo.authSql}
</if>
</where>
</select>
<select id="auditExportDiy" resultType="com.yifu.cloud.plus.v1.yifu.salary.vo.TSalaryAccountExportVo"
parameterType="com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryAccount">
select
a.id,
case a.FORM_TYPE when '0' then '薪资' when '1' then '绩效' when '3' then '劳务费' when '4' then '稿酬' else '其他' end as formType,
a.EMP_PHONE as empPhone,
a.TAX_MONTH as taxMonth,
a.SETTLEMENT_MONTH as settlementMonth,
a.SALARY_MONTH as salaryMonth,
a.INVOICE_TITLE as invoiceTitle,
a.UNIT_NAME as unitName,
a.UNIT_NO as unitNo,
a.DEPT_NAME as deptName,
a.DEPT_NO as deptNo,
a.EMP_NAME as empName,
a.EMP_IDCARD as empIdcard,
if(a.RELAY_SALARY_UNIT is not null and a.RELAY_SALARY_UNIT != 0, a.RELAY_SALARY_UNIT, ifnull(a.RELAY_SALARY,0)) as relaySalary,
a.ACTUAL_SALARY as actualSalary,
annualBonus.SALARY_MONEY as annualBonus,
ifnull(a.SALARY_TAX,0) + ifnull(a.SALARY_TAX_UNIT,0) as salaryTax,
a.ANNUAL_BONUS_TAX as annualBonusTax,
a.PERSON_SOCIAL as personSocial,
a.PERSON_FUND as personFund,
exemptionPersionTax.SALARY_MONEY as exemptionPersionTax,
enterpriseAnnuity.SALARY_MONEY as enterpriseAnnuity,
a.UNIT_SOCIAL as unitSocial,
a.UNIT_FUND as unitFund,
a.SUM_BABY_MONEY as sumBabyMoney,
a.SUM_CHILD_EDU_MONEY as sumChildEduMoney,
a.SUM_CONTINUING_EDUCATION_MONEY as sumContinuingEducationMoney,
a.SUM_HOUSING_LOAN_MONEY as sumHousingLoanMoney,
a.SUM_HOUSING_RENT_MONEY as sumHousingRentMoney,
a.SUM_PRIVATE_PENSION as sumPrivatePension,
a.SUM_SUPPORT_ELDERLY_MONEY as sumSupportElderlyMoney,
a.COST_REDUCTION as costReduction,
a.CREATE_NAME as createName,
/*GROUP_CONCAT(pdeduction.CN_NAME,':',pdeduction.SALARY_MONEY SEPARATOR ';') pdeductionDetail,
sum(ifnull(pdeduction.SALARY_MONEY,0)) pdeductionMoney,*/
if(a.PAY_SETTLE_FLAG = '0','已结算',if(a.PAY_SETTLE_FLAG = '1','结算中',if(a.PAY_SETTLE_FLAG = '2','未结算','-'))) paySettleFlag,
case s.STATUS when 0 then '待提交' when 1 then '待审核' when 2 then '待推送明细' when 3 then '已推送待发放' when 4 then '已发放' when 5 then '审核不通过' when 6 then '确认不通过' when 7 then '财务退回' when 10 then '推送失败' when 11 then '已审核生成收入中' when 12 then '已审核生成收入失败' else '-' end as status
,phoneSubsidy.SALARY_MONEY as phoneSubsidy
,s.BUSINESS_PRIMARY_TYPE as businessPrimaryType
,s.BUSINESS_SECOND_TYPE as businessSecondType
,s.BUSINESS_THIRD_TYPE as businessThirdType
from
t_salary_account a
left join t_salary_standard s on a.SALARY_FORM_ID = s.id
left join t_salary_account_item annualBonus on annualBonus.SALARY_ACCOUNT_ID = a.id and annualBonus.JAVA_FIED_NAME = 'annualBonus'
left join t_salary_account_item exemptionPersionTax on exemptionPersionTax.SALARY_ACCOUNT_ID = a.id and exemptionPersionTax.JAVA_FIED_NAME='exemptionPersionTax'
left join t_salary_account_item enterpriseAnnuity on enterpriseAnnuity.SALARY_ACCOUNT_ID = a.id and enterpriseAnnuity.JAVA_FIED_NAME='enterpriseAnnuity'
/*left join t_salary_account_item pdeduction on pdeduction.SALARY_ACCOUNT_ID = a.id and pdeduction.JAVA_FIED_NAME='pdeduction'*/
left join t_salary_account_item phoneSubsidy on phoneSubsidy.SALARY_ACCOUNT_ID = a.id and phoneSubsidy.JAVA_FIED_NAME='phoneSubsidy'
<where>
a.DELETE_FLAG = 0
<include refid="where_export"/>
/*GROUP BY a.id */
ORDER BY a.SALARY_MONTH asc
<if test="searchVo != null">
<if test="searchVo.limitStart != null">
limit #{searchVo.limitStart},#{searchVo.limitEnd}
</if>
</if>
</where>
</select>
<select id="auditExportSelectItems" resultType="com.yifu.cloud.plus.v1.yifu.salary.vo.TSalaryAccountItemExportVo">
select
GROUP_CONCAT(pdeduction.CN_NAME,':',pdeduction.SALARY_MONEY SEPARATOR ';') pdeductionDetail,
sum(ifnull(pdeduction.SALARY_MONEY,0)) pdeductionMoney,
pdeduction.SALARY_ACCOUNT_ID as salaryAccountId
FROM
t_salary_account_item pdeduction
where
pdeduction.JAVA_FIED_NAME='pdeduction'
<if test="idList != null and idList.size>0">
AND pdeduction.SALARY_ACCOUNT_ID in
<foreach item="idStr" index="index" collection="idList" open="(" separator="," close=")">
#{idStr}
</foreach>
</if>
GROUP BY pdeduction.SALARY_ACCOUNT_ID
</select>
<select id="auditExportCountDiy" resultType="java.lang.Integer">
SELECT
count(1)
FROM
t_salary_account a
<where>
a.DELETE_FLAG = 0
<include refid="where_export"/>
</where>
</select>
</mapper>
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