Commit 75b0185f authored by huyuchen's avatar huyuchen

薪资审核页面接口修改

parent 829737d6
...@@ -300,6 +300,7 @@ public interface CommonConstants { ...@@ -300,6 +300,7 @@ public interface CommonConstants {
public static final String ZIP_TYPE = "zip"; public static final String ZIP_TYPE = "zip";
int BATCH_COUNT = 100; int BATCH_COUNT = 100;
int BATCH_COUNT1 = 1000;
String IMPORT_DATA_ANALYSIS_ERROR = "数据导入解析异常,请检查表数据格式(1.日期格式:yyyy-MM-dd,2.比例为整数且不含%)"; String IMPORT_DATA_ANALYSIS_ERROR = "数据导入解析异常,请检查表数据格式(1.日期格式:yyyy-MM-dd,2.比例为整数且不含%)";
String CREATE_TIME = "CREATE_TIME"; String CREATE_TIME = "CREATE_TIME";
String ID = "ID"; String ID = "ID";
......
...@@ -21,62 +21,43 @@ import com.alibaba.excel.annotation.ExcelProperty; ...@@ -21,62 +21,43 @@ import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; 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 io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute;
import org.hibernate.validator.constraints.Length; import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import java.math.BigDecimal; import java.math.BigDecimal;
/** /**
* 统计-全年一次性奖金 * 全年一次性奖金申报表
* *
* @author hgw * @author huyc
* @date 2022-08-05 11:40:15 * @date 2022-08-14 21:31:15
*/ */
@Data @Data
@TableName("t_statistics_annual_bonus") @TableName("t_statistics_bonus")
@Schema(description = "统计-全年一次性奖金") @EqualsAndHashCode(callSuper = true)
public class TStatisticsAnnualBonus { @Schema(description = "全年一次性奖金申报表")
public class TStatisticsBonus extends BaseEntity {
/** /**
* id * ID
*/ */
@TableId(type = IdType.ASSIGN_ID) @TableId(type = IdType.ASSIGN_ID)
@ExcelProperty("id") @ExcelProperty("ID")
@Schema(description = "ID")
private String id; private String id;
/** /**
* 税务主体(封面抬头) * 申报单位
*/ */
@ExcelAttribute(name = "税务主体(封面抬头)", maxLength = 50) @ExcelAttribute(name = "申报单位", maxLength = 32)
@Length(max = 50, message = "税务主体(封面抬头)不能超过50个字符") @Length(max = 32, message = "申报单位不能超过32个字符")
@ExcelProperty("税务主体(封面抬头)") @ExcelProperty("申报单位")
private String invoiceTitle; @Schema(description = "申报单位")
/** private String declareUnit;
* 结算部门id
*/
@ExcelAttribute(name = "结算部门id", isNotEmpty = true, errorInfo = "结算部门id不能为空", maxLength = 32)
@NotBlank(message = "结算部门id不能为空")
@Length(max = 32, message = "结算部门id不能超过32个字符")
@ExcelProperty("结算部门id")
private String settleDepartId;
/**
* 结算部门no
*/
@ExcelAttribute(name = "结算部门no", isNotEmpty = true, errorInfo = "结算部门no不能为空", maxLength = 50)
@NotBlank(message = "结算部门no不能为空")
@Length(max = 50, message = "结算部门no不能超过50个字符")
@ExcelProperty("结算部门no")
private String settleDepartNo;
/**
* 结算部门name
*/
@ExcelAttribute(name = "结算部门name", isNotEmpty = true, errorInfo = "结算部门name不能为空", maxLength = 50)
@NotBlank(message = "结算部门name不能为空")
@Length(max = 50, message = "结算部门name不能超过50个字符")
@ExcelProperty("结算部门name")
private String settleDepartName;
/** /**
* 申报月份(YYYYMM) * 申报月份(YYYYMM)
*/ */
...@@ -84,60 +65,62 @@ public class TStatisticsAnnualBonus { ...@@ -84,60 +65,62 @@ public class TStatisticsAnnualBonus {
@NotBlank(message = "申报月份(YYYYMM)不能为空") @NotBlank(message = "申报月份(YYYYMM)不能为空")
@Length(max = 6, message = "申报月份(YYYYMM)不能超过6个字符") @Length(max = 6, message = "申报月份(YYYYMM)不能超过6个字符")
@ExcelProperty("申报月份(YYYYMM)") @ExcelProperty("申报月份(YYYYMM)")
@Schema(description = "申报月份(YYYYMM)")
private String declareMonth; private String declareMonth;
/**
* 员工 ID
*/
@ExcelAttribute(name = "员工 ID", maxLength = 32)
@Length(max = 32, message = "员工 ID不能超过32个字符")
@ExcelProperty("员工 ID")
private String empId;
/** /**
* 员工姓名 * 员工姓名
*/ */
@ExcelAttribute(name = "员工姓名", maxLength = 50) @ExcelAttribute(name = "员工姓名", maxLength = 32)
@Length(max = 50, message = "员工姓名不能超过50个字符") @Length(max = 32, message = "员工姓名不能超过32个字符")
@ExcelProperty("员工姓名") @ExcelProperty("员工姓名")
@Schema(description = "员工姓名")
private String empName; private String empName;
/** /**
* 员工身份证号 * 身份证号
*/ */
@ExcelAttribute(name = "员工身份证号", maxLength = 25) @ExcelAttribute(name = "身份证号", maxLength = 32)
@Length(max = 25, message = "员工身份证号不能超过25个字符") @Length(max = 32, message = "身份证号不能超过32个字符")
@ExcelProperty("员工身份证号") @ExcelProperty("身份证号")
@Schema(description = "身份证号")
private String empIdcard; private String empIdcard;
/** /**
* 年终奖 * 年终奖
*/ */
@ExcelAttribute(name = "年终奖") @ExcelAttribute(name = "年终奖")
@ExcelProperty("年终奖") @ExcelProperty("年终奖")
@Schema(description = "年终奖(元)")
private BigDecimal annualBonus; private BigDecimal annualBonus;
/** /**
* 年终奖单独税 * 年终奖单独扣税应缴税额
*/
@ExcelAttribute(name = "年终奖单独扣税应缴税额")
@ExcelProperty("年终奖单独扣税应缴税额")
@Schema(description = "年终奖单独扣税应缴税额")
private BigDecimal bonusTax;
/**
* 项目id
*/
@Schema(description = "项目id")
private String deptId;
/**
* 项目编码
*/ */
@ExcelAttribute(name = "年终奖单独税") @Schema(description = "项目编码")
@ExcelProperty("年终奖单独税") private String deptNo;
private BigDecimal tax; /**
* 项目名称
*/
@Schema(description = "项目名称")
private String deptName;
/** /**
* 单位id * 单位id
*/ */
@ExcelAttribute(name = "单位id", maxLength = 32) @Schema(description = "单位id")
@Length(max = 32, message = "单位id不能超过32个字符")
@ExcelProperty("单位id")
private String unitId; private String unitId;
/** /**
* 单位no * 单位编码
*/ */
@ExcelAttribute(name = "单位no", maxLength = 50) @Schema(description = "单位编码")
@Length(max = 50, message = "单位no不能超过50个字符")
@ExcelProperty("单位no")
private String unitNo; private String unitNo;
/**
* 单位name
*/
@ExcelAttribute(name = "单位name", maxLength = 50)
@Length(max = 50, message = "单位name不能超过50个字符")
@ExcelProperty("单位name")
private String unitName;
} }
/*
* 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.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.RowIndex;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* 统计-全年一次性奖金
*
* @author huyc
* @date 2022-08-05 11:40:15
*/
@Data
public class TStatisticsAnnualBonusImportVo extends RowIndex implements Serializable {
/**
* 员工姓名
*/
@Length(max = 50, message = "员工姓名 不能超过50 个字符")
@NotNull(message = "员工姓名不可为空")
@ExcelAttribute(name = "员工姓名", maxLength = 50, isNotEmpty = true)
@Schema(description = "员工姓名")
@ExcelProperty("员工姓名")
private String empName;
/**
* 员工身份证号
*/
@Length(max = 25, message = "身份证号不能超过25个字符")
@NotNull(message = "身份证号不可为空")
@ExcelAttribute(name = "身份证号", maxLength = 25, isNotEmpty = true)
@Schema(description = "身份证号")
@ExcelProperty("身份证号")
private String empIdcard;
/**
* 年终奖
*/
@ExcelAttribute(name = "待发年终奖", isNotEmpty = true)
@NotNull(message = "待发年终奖不可为空")
@Schema(description = "待发年终奖")
@ExcelProperty("待发年终奖")
private BigDecimal preAnnualBonus;
/**
* 年终奖单独税
*/
@ExcelAttribute(name = "待发12月工资", isNotEmpty = true)
@NotNull(message = "待发12月工资不可为空")
@Schema(description = "待发12月工资")
@ExcelProperty("待发12月工资")
private BigDecimal preDecSalary;
/**
* 年终奖单独扣税12月税费
*/
@ExcelAttribute(name = "年终奖单独扣税12月税费")
@Schema(description = "年终奖单独扣税12月税费")
@ExcelProperty("年终奖单独扣税12月税费")
private BigDecimal onlyTax;
/**
* 年终奖合并扣税12月税费
*/
@ExcelAttribute(name = "年终奖合并扣税12月税费")
@Schema(description = "年终奖合并扣税12月税费")
@ExcelProperty("年终奖合并扣税12月税费")
private BigDecimal sumTax;
/**
* 最优方案-年终奖
*/
@ExcelAttribute(name = "最优方案-年终奖")
@Schema(description = "最优方案-年终奖")
@ExcelProperty("最优方案-年终奖")
private BigDecimal bestSolutionTax;
/**
* 最优方案-12月扣税
*/
@ExcelAttribute(name = "最优方案-12月扣税")
@Schema(description = "最优方案-12月扣税")
@ExcelProperty("最优方案-12月扣税")
private BigDecimal bestSolutionDecTax;
}
...@@ -16,20 +16,20 @@ ...@@ -16,20 +16,20 @@
*/ */
package com.yifu.cloud.plus.v1.yifu.salary.vo; package com.yifu.cloud.plus.v1.yifu.salary.vo;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TStatisticsAnnualBonus;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TStatisticsBonus;
import lombok.Data; import lombok.Data;
import java.time.LocalDateTime; import java.time.LocalDateTime;
/** /**
* 统计-全年一次性奖金 * 全年一次性奖金申报表
* *
* @author hgw * @author huyc
* @date 2022-08-05 11:40:15 * @date 2022-08-14 21:31:15
*/ */
@Data @Data
public class TStatisticsAnnualBonusSearchVo extends TStatisticsAnnualBonus { public class TStatisticsBonusSearchVo extends TStatisticsBonus {
/** /**
* 多选导出或删除等操作 * 多选导出或删除等操作
......
...@@ -19,10 +19,13 @@ package com.yifu.cloud.plus.v1.yifu.salary.vo; ...@@ -19,10 +19,13 @@ package com.yifu.cloud.plus.v1.yifu.salary.vo;
import com.alibaba.excel.annotation.ExcelProperty; import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute; import com.baomidou.mybatisplus.annotation.TableName;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.RowIndex; import com.yifu.cloud.plus.v1.yifu.common.core.vo.RowIndex;
import com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute;
import org.hibernate.validator.constraints.Length; import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
...@@ -30,49 +33,32 @@ import java.io.Serializable; ...@@ -30,49 +33,32 @@ import java.io.Serializable;
import java.math.BigDecimal; import java.math.BigDecimal;
/** /**
* 统计-全年一次性奖金 * 全年一次性奖金申报表
* *
* @author hgw * @author huyc
* @date 2022-08-05 11:40:15 * @date 2022-08-14 21:31:15
*/ */
@Data @Data
public class TStatisticsAnnualBonusVo extends RowIndex implements Serializable { public class TStatisticsBonusVo extends RowIndex implements Serializable {
/** /**
* 税务主体(封面抬头) * ID
*/
@Length(max = 50, message = "税务主体(封面抬头) 不能超过50 个字符")
@ExcelAttribute(name = "税务主体(封面抬头)", maxLength = 50)
@Schema(description = "税务主体(封面抬头)")
@ExcelProperty("税务主体(封面抬头)")
private String invoiceTitle;
/**
* 结算部门id
*/ */
@NotBlank(message = "结算部门id 不能为空") @TableId(type = IdType.ASSIGN_ID)
@Length(max = 32, message = "结算部门id 不能超过32 个字符") @NotBlank(message = "ID 不能为空")
@ExcelAttribute(name = "结算部门id", isNotEmpty = true, errorInfo = "结算部门id 不能为空", maxLength = 32) @Length(max = 32, message = "ID 不能超过32 个字符")
@Schema(description = "结算部门id") @ExcelAttribute(name = "ID", isNotEmpty = true, errorInfo = "ID 不能为空", maxLength = 32)
@ExcelProperty("结算部门id") @Schema(description = "ID")
private String settleDepartId; @ExcelProperty("ID")
private String id;
/** /**
* 结算部门no * 申报单位
*/ */
@NotBlank(message = "结算部门no 不能为空") @Length(max = 32, message = "申报单位 不能超过32 个字符")
@Length(max = 50, message = "结算部门no 不能超过50 个字符") @ExcelAttribute(name = "申报单位", maxLength = 32)
@ExcelAttribute(name = "结算部门no", isNotEmpty = true, errorInfo = "结算部门no 不能为空", maxLength = 50) @Schema(description = "申报单位")
@Schema(description = "结算部门no") @ExcelProperty("申报单位")
@ExcelProperty("结算部门no") private String declareUnit;
private String settleDepartNo;
/**
* 结算部门name
*/
@NotBlank(message = "结算部门name 不能为空")
@Length(max = 50, message = "结算部门name 不能超过50 个字符")
@ExcelAttribute(name = "结算部门name", isNotEmpty = true, errorInfo = "结算部门name 不能为空", maxLength = 50)
@Schema(description = "结算部门name")
@ExcelProperty("结算部门name")
private String settleDepartName;
/** /**
* 申报月份(YYYYMM) * 申报月份(YYYYMM)
*/ */
...@@ -82,29 +68,21 @@ public class TStatisticsAnnualBonusVo extends RowIndex implements Serializable { ...@@ -82,29 +68,21 @@ public class TStatisticsAnnualBonusVo extends RowIndex implements Serializable {
@Schema(description = "申报月份(YYYYMM)") @Schema(description = "申报月份(YYYYMM)")
@ExcelProperty("申报月份(YYYYMM)") @ExcelProperty("申报月份(YYYYMM)")
private String declareMonth; private String declareMonth;
/**
* 员工 ID
*/
@Length(max = 32, message = "员工 ID 不能超过32 个字符")
@ExcelAttribute(name = "员工 ID", maxLength = 32)
@Schema(description = "员工 ID")
@ExcelProperty("员工 ID")
private String empId;
/** /**
* 员工姓名 * 员工姓名
*/ */
@Length(max = 50, message = "员工姓名 不能超过50 个字符") @Length(max = 32, message = "员工姓名 不能超过32 个字符")
@ExcelAttribute(name = "员工姓名", maxLength = 50) @ExcelAttribute(name = "员工姓名", maxLength = 32)
@Schema(description = "员工姓名") @Schema(description = "员工姓名")
@ExcelProperty("员工姓名") @ExcelProperty("员工姓名")
private String empName; private String empName;
/** /**
* 员工身份证号 * 身份证号
*/ */
@Length(max = 25, message = "员工身份证号 不能超过25 个字符") @Length(max = 32, message = "身份证号 不能超过32 个字符")
@ExcelAttribute(name = "员工身份证号", maxLength = 25) @ExcelAttribute(name = "身份证号", maxLength = 32)
@Schema(description = "员工身份证号") @Schema(description = "身份证号")
@ExcelProperty("员工身份证号") @ExcelProperty("身份证号")
private String empIdcard; private String empIdcard;
/** /**
* 年终奖 * 年终奖
...@@ -114,12 +92,36 @@ public class TStatisticsAnnualBonusVo extends RowIndex implements Serializable { ...@@ -114,12 +92,36 @@ public class TStatisticsAnnualBonusVo extends RowIndex implements Serializable {
@ExcelProperty("年终奖") @ExcelProperty("年终奖")
private BigDecimal annualBonus; private BigDecimal annualBonus;
/** /**
* 年终奖单独 * 年终奖单独扣税应缴税额
*/ */
@ExcelAttribute(name = "年终奖单独税") @ExcelAttribute(name = "年终奖单独扣税应缴税额")
@Schema(description = "年终奖单独税") @Schema(description = "年终奖单独扣税应缴税额")
@ExcelProperty("年终奖单独税") @ExcelProperty("年终奖单独扣税应缴税额")
private BigDecimal tax; private BigDecimal bonusTax;
/**
* 项目id
*/
@Length(max = 32, message = "项目id 不能超过32 个字符")
@ExcelAttribute(name = "项目id", maxLength = 32)
@Schema(description = "项目id")
@ExcelProperty("项目id")
private String deptId;
/**
* 项目编码
*/
@Length(max = 50, message = "项目编码 不能超过50 个字符")
@ExcelAttribute(name = "项目编码", maxLength = 50)
@Schema(description = "项目编码")
@ExcelProperty("项目编码")
private String deptNo;
/**
* 项目名称
*/
@Length(max = 50, message = "项目名称 不能超过50 个字符")
@ExcelAttribute(name = "项目名称", maxLength = 50)
@Schema(description = "项目名称")
@ExcelProperty("项目名称")
private String deptName;
/** /**
* 单位id * 单位id
*/ */
...@@ -129,20 +131,12 @@ public class TStatisticsAnnualBonusVo extends RowIndex implements Serializable { ...@@ -129,20 +131,12 @@ public class TStatisticsAnnualBonusVo extends RowIndex implements Serializable {
@ExcelProperty("单位id") @ExcelProperty("单位id")
private String unitId; private String unitId;
/** /**
* 单位no * 单位编码
*/ */
@Length(max = 50, message = "单位no 不能超过50 个字符") @Length(max = 50, message = "单位编码 不能超过50 个字符")
@ExcelAttribute(name = "单位no", maxLength = 50) @ExcelAttribute(name = "单位编码", maxLength = 50)
@Schema(description = "单位no") @Schema(description = "单位编码")
@ExcelProperty("单位no") @ExcelProperty("单位编码")
private String unitNo; private String unitNo;
/**
* 单位name
*/
@Length(max = 50, message = "单位name 不能超过50 个字符")
@ExcelAttribute(name = "单位name", maxLength = 50)
@Schema(description = "单位name")
@ExcelProperty("单位name")
private String unitName;
} }
...@@ -17,15 +17,11 @@ ...@@ -17,15 +17,11 @@
package com.yifu.cloud.plus.v1.yifu.salary.vo; package com.yifu.cloud.plus.v1.yifu.salary.vo;
import com.alibaba.excel.annotation.ExcelProperty; import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.RowIndex; import com.yifu.cloud.plus.v1.yifu.common.core.vo.RowIndex;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute; import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
import java.io.Serializable; import java.io.Serializable;
/** /**
......
/*
* 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.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.yifu.common.core.util.*;
import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TStatisticsAnnualBonus;
import com.yifu.cloud.plus.v1.yifu.salary.service.TStatisticsAnnualBonusService;
import com.yifu.cloud.plus.v1.yifu.salary.vo.TStatisticsAnnualBonusSearchVo;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
/**
* 统计-全年一次性奖金
*
* @author hgw
* @date 2022-08-05 11:40:15
*/
@RestController
@RequiredArgsConstructor
@RequestMapping("/tstatisticsannualbonus")
@Tag(name = "统计-全年一次性奖金管理")
@Slf4j
public class TStatisticsAnnualBonusController {
private final TStatisticsAnnualBonusService tStatisticsAnnualBonusService;
/**
* 简单分页查询
*
* @param page 分页对象
* @param tStatisticsAnnualBonus 统计-全年一次性奖金
* @return
*/
@Operation(description = "简单分页查询")
@GetMapping("/page")
public R<IPage<TStatisticsAnnualBonus>> getTStatisticsAnnualBonusPage(Page<TStatisticsAnnualBonus> page, TStatisticsAnnualBonusSearchVo tStatisticsAnnualBonus) {
return new R<>(tStatisticsAnnualBonusService.getTStatisticsAnnualBonusPage(page, tStatisticsAnnualBonus));
}
/**
* 不分页查询
*
* @param tStatisticsAnnualBonus 统计-全年一次性奖金
* @return
*/
@Operation(summary = "不分页查询", description = "不分页查询")
@PostMapping("/noPage")
public R<List<TStatisticsAnnualBonus>> getTStatisticsAnnualBonusNoPage(@RequestBody TStatisticsAnnualBonusSearchVo tStatisticsAnnualBonus) {
return R.ok(tStatisticsAnnualBonusService.noPageDiy(tStatisticsAnnualBonus));
}
/**
* 通过id查询统计-全年一次性奖金
*
* @param id id
* @return R
*/
@Operation(summary = "通过id查询", description = "通过id查询")
@GetMapping("/{id}")
public R<TStatisticsAnnualBonus> getById(@PathVariable("id") String id) {
return R.ok(tStatisticsAnnualBonusService.getById(id));
}
/**
* 新增统计-全年一次性奖金
*
* @param tStatisticsAnnualBonus 统计-全年一次性奖金
* @return R
*/
@Operation(summary = "新增统计-全年一次性奖金", description = "新增统计-全年一次性奖金:hasPermission('salary_tstatisticsannualbonus_add')")
@SysLog("新增统计-全年一次性奖金")
@PostMapping
@PreAuthorize("@pms.hasPermission('salary_tstatisticsannualbonus_add')")
public R<Boolean> save(@RequestBody TStatisticsAnnualBonus tStatisticsAnnualBonus) {
return R.ok(tStatisticsAnnualBonusService.save(tStatisticsAnnualBonus));
}
/**
* 通过id删除统计-全年一次性奖金
*
* @param id id
* @return R
*/
@Operation(summary = "通过id删除统计-全年一次性奖金", description = "通过id删除统计-全年一次性奖金:hasPermission('salary_tstatisticsannualbonus_del')")
@SysLog("通过id删除统计-全年一次性奖金")
@DeleteMapping("/{id}")
@PreAuthorize("@pms.hasPermission('salary_tstatisticsannualbonus_del')")
public R<Boolean> removeById(@PathVariable String id) {
return R.ok(tStatisticsAnnualBonusService.removeById(id));
}
/**
* 统计-全年一次性奖金 批量导出
*
* @author hgw
* @date 2022-08-05 11:40:15
**/
@Operation(description = "导出统计-全年一次性奖金 hasPermission('salary_tstatisticsannualbonus-export')")
@PostMapping("/export")
@PreAuthorize("@pms.hasPermission('salary_tstatisticsannualbonus-export')")
public void export(HttpServletResponse response, @RequestBody TStatisticsAnnualBonusSearchVo searchVo) {
tStatisticsAnnualBonusService.listExport(response, searchVo);
}
/**
* 年终奖分配方案导入导出
*
* @author huyc
* @date 2022-08-08
**/
@Operation(description = "年终奖分配方案导入导出 hasPermission('salary_tstatisticsannualbonus_import')")
@PostMapping("/bestSolutionExport")
@PreAuthorize("@pms.hasPermission('salary_tstatisticsannualbonus_import')")
public R<List<ErrorMessage>> bestSolutionExport(@RequestBody MultipartFile file
, HttpServletResponse response, List<String> exportFields) throws IOException {
return tStatisticsAnnualBonusService.bestSendExport(file.getInputStream(), response, exportFields);
}
}
/*
* 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.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TStatisticsBonus;
import com.yifu.cloud.plus.v1.yifu.salary.service.TStatisticsBonusService;
import com.yifu.cloud.plus.v1.yifu.salary.vo.TStatisticsBonusSearchVo;
import lombok.SneakyThrows;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 全年一次性奖金申报表
*
* @author huyc
* @date 2022-08-14 21:31:15
*/
@RestController
@RequiredArgsConstructor
@RequestMapping("/tstatisticsbonus" )
@Tag(name = "全年一次性奖金申报表管理")
public class TStatisticsBonusController {
private final TStatisticsBonusService tStatisticsBonusService;
/**
* 简单分页查询
* @param page 分页对象
* @param tStatisticsBonus 全年一次性奖金申报表
* @return
*/
@Operation(description = "简单分页查询")
@GetMapping("/page")
public R<IPage<TStatisticsBonus>> getTStatisticsBonusPage(Page<TStatisticsBonus> page, TStatisticsBonusSearchVo tStatisticsBonus) {
return new R<>(tStatisticsBonusService.getTStatisticsBonusPage(page,tStatisticsBonus));
}
/**
* 不分页查询
* @param tStatisticsBonus 全年一次性奖金申报表
* @return
*/
@Operation(summary = "不分页查询", description = "不分页查询")
@PostMapping("/noPage" )
public R<List<TStatisticsBonus>> getTStatisticsBonusNoPage(@RequestBody TStatisticsBonusSearchVo tStatisticsBonus) {
return R.ok(tStatisticsBonusService.noPageDiy(tStatisticsBonus));
}
/**
* 新增全年一次性奖金申报表
* @param tStatisticsBonus 全年一次性奖金申报表
* @return R
*/
@Operation(summary = "新增全年一次性奖金申报表", description = "新增全年一次性奖金申报表:hasPermission('salary_tstatisticsbonus_add')")
@SysLog("新增全年一次性奖金申报表" )
@PostMapping
@PreAuthorize("@pms.hasPermission('salary_tstatisticsbonus_add')" )
public R<Boolean> save(@RequestBody TStatisticsBonus tStatisticsBonus) {
return R.ok(tStatisticsBonusService.save(tStatisticsBonus));
}
/**
* 通过id删除全年一次性奖金申报表
* @param id id
* @return R
*/
@Operation(summary = "通过id删除全年一次性奖金申报表", description = "通过id删除全年一次性奖金申报表:hasPermission('salary_tstatisticsbonus_del')")
@SysLog("通过id删除全年一次性奖金申报表" )
@DeleteMapping("/{id}" )
@PreAuthorize("@pms.hasPermission('salary_tstatisticsbonus_del')" )
public R<Boolean> removeById(@PathVariable String id) {
return R.ok(tStatisticsBonusService.removeById(id));
}
/**
* 全年一次性奖金申报表 批量导入
*
* @author huyc
* @date 2022-08-14 21:31:15
**/
@SneakyThrows
@Operation(description = "批量新增全年一次性奖金申报表 hasPermission('salary_tstatisticsbonus-batch-import')")
@SysLog("批量新增全年一次性奖金申报表")
@PostMapping("/importListAdd")
@PreAuthorize("@pms.hasPermission('salary_tstatisticsbonus-batch-import')")
public R<List<ErrorMessage>> importListAdd(@RequestBody MultipartFile file){
return tStatisticsBonusService.importDiy(file.getInputStream());
}
/**
* 全年一次性奖金申报表 批量导出
* @author huyc
* @date 2022-08-14 21:31:15
**/
@Operation(description = "导出全年一次性奖金申报表 hasPermission('salary_tstatisticsbonus-export')")
@PostMapping("/export")
@PreAuthorize("@pms.hasPermission('salary_tstatisticsbonus-export')")
public void export(HttpServletResponse response, @RequestBody TStatisticsBonusSearchVo searchVo) {
tStatisticsBonusService.listExport(response,searchVo);
}
/**
* 全年一次性奖金申报表 批量删除
*
* @author huyc
* @date 2022-08-14 21:31:15
**/
@Operation(description = "批量删除全年一次性奖金申报表 hasPermission('salary_tstatisticsbonus_del')")
@SysLog("批量删除全年一次性奖金申报表")
@PostMapping("/batchDelete")
@PreAuthorize("@pms.hasPermission('salary_tstatisticsbonus_del')")
public R batchDelete(@RequestBody String declareMonth){
return tStatisticsBonusService.batchDelete(declareMonth);
}
}
...@@ -147,7 +147,7 @@ public class TStatisticsDeclarerController { ...@@ -147,7 +147,7 @@ public class TStatisticsDeclarerController {
**/ **/
@Operation(description = "导出申报对象表 hasPermission('salary_tstatisticsdeclarer-export')") @Operation(description = "导出申报对象表 hasPermission('salary_tstatisticsdeclarer-export')")
@PostMapping("/export") @PostMapping("/export")
@PreAuthorize("@pms.hasPermission('salary_tstatisticsdeclarer-export')") // @PreAuthorize("@pms.hasPermission('salary_tstatisticsdeclarer-export')")
public void export(HttpServletResponse response, @RequestBody TStatisticsDeclarerSearchVo searchVo) { public void export(HttpServletResponse response, @RequestBody TStatisticsDeclarerSearchVo searchVo) {
tStatisticsDeclarerService.listExport(response,searchVo); tStatisticsDeclarerService.listExport(response,searchVo);
} }
......
...@@ -18,23 +18,24 @@ ...@@ -18,23 +18,24 @@
package com.yifu.cloud.plus.v1.yifu.salary.mapper; package com.yifu.cloud.plus.v1.yifu.salary.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TStatisticsAnnualBonus;
import org.apache.ibatis.annotations.Mapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TStatisticsBonus;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
/** /**
* 统计-全年一次性奖金 * 全年一次性奖金申报表
* *
* @author hgw * @author huyc
* @date 2022-08-05 11:40:15 * @date 2022-08-14 21:31:15
*/ */
@Mapper @Mapper
public interface TStatisticsAnnualBonusMapper extends BaseMapper<TStatisticsAnnualBonus> { public interface TStatisticsBonusMapper extends BaseMapper<TStatisticsBonus> {
/** /**
* 统计-全年一次性奖金简单分页查询 * 全年一次性奖金申报表简单分页查询
* @param tStatisticsAnnualBonus 统计-全年一次性奖金 * @param tStatisticsBonus 全年一次性奖金申报表
* @return * @return
*/ */
IPage<TStatisticsAnnualBonus> getTStatisticsAnnualBonusPage(Page<TStatisticsAnnualBonus> page, @Param("tStatisticsAnnualBonus") TStatisticsAnnualBonus tStatisticsAnnualBonus); IPage<TStatisticsBonus> getTStatisticsBonusPage(Page<TStatisticsBonus> page, @Param("tStatisticsBonus") TStatisticsBonus tStatisticsBonus);
} }
...@@ -17,43 +17,41 @@ ...@@ -17,43 +17,41 @@
package com.yifu.cloud.plus.v1.yifu.salary.service; package com.yifu.cloud.plus.v1.yifu.salary.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TStatisticsBonus;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage; import com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage;
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.TStatisticsAnnualBonus; import com.yifu.cloud.plus.v1.yifu.salary.vo.TStatisticsBonusSearchVo;
import com.yifu.cloud.plus.v1.yifu.salary.vo.TStatisticsAnnualBonusSearchVo;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.InputStream; import java.io.InputStream;
import java.util.List; import java.util.List;
/** /**
* 统计-全年一次性奖金 * 全年一次性奖金申报表
* *
* @author hgw * @author huyc
* @date 2022-08-05 11:40:15 * @date 2022-08-14 21:31:15
*/ */
public interface TStatisticsAnnualBonusService extends IService<TStatisticsAnnualBonus> { public interface TStatisticsBonusService extends IService<TStatisticsBonus> {
/** /**
* 统计-全年一次性奖金简单分页查询 * 全年一次性奖金申报表简单分页查询
* @param tStatisticsAnnualBonus 统计-全年一次性奖金 * @param tStatisticsBonus 全年一次性奖金申报表
* @return * @return
*/ */
IPage<TStatisticsAnnualBonus> getTStatisticsAnnualBonusPage(Page<TStatisticsAnnualBonus> page, IPage<TStatisticsBonus> getTStatisticsBonusPage(Page<TStatisticsBonus> page, TStatisticsBonusSearchVo tStatisticsBonus);
TStatisticsAnnualBonusSearchVo tStatisticsAnnualBonus);
R<List<ErrorMessage>> importDiy(InputStream inputStream); R<List<ErrorMessage>> importDiy(InputStream inputStream);
void listExport(HttpServletResponse response, TStatisticsAnnualBonusSearchVo searchVo); void listExport(HttpServletResponse response, TStatisticsBonusSearchVo searchVo);
List<TStatisticsAnnualBonus> noPageDiy(TStatisticsAnnualBonusSearchVo searchVo); List<TStatisticsBonus> noPageDiy(TStatisticsBonusSearchVo searchVo);
/** /**
* 年终奖分配方案导入导出 * 批量删除全年一次性奖金申报表
* @param inputStream * @param declareMonth 申报月份
* @return * @return
*/ */
R<List<ErrorMessage>> bestSendExport(InputStream inputStream, HttpServletResponse response,List<String> exportFields); R batchDelete(String declareMonth);
} }
/*
* 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.service.impl;
import cn.hutool.core.bean.BeanUtil;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.ExcelWriter;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.read.listener.ReadListener;
import com.alibaba.excel.read.metadata.holder.ReadRowHolder;
import com.alibaba.excel.util.ListUtils;
import com.alibaba.excel.write.metadata.WriteSheet;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
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.archives.vo.EmployeeProjectExportVO;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
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.security.util.SecurityUtils;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TStatisticsAnnualBonus;
import com.yifu.cloud.plus.v1.yifu.salary.mapper.TStatisticsAnnualBonusMapper;
import com.yifu.cloud.plus.v1.yifu.salary.service.TStatisticsAnnualBonusService;
import com.yifu.cloud.plus.v1.yifu.salary.vo.TStatisticsAnnualBonusImportVo;
import com.yifu.cloud.plus.v1.yifu.salary.vo.TStatisticsAnnualBonusSearchVo;
import com.yifu.cloud.plus.v1.yifu.salary.vo.TStatisticsAnnualBonusVo;
import lombok.extern.log4j.Log4j2;
import org.springframework.stereotype.Service;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.InputStream;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.List;
/**
* 统计-全年一次性奖金
*
* @author hgw
* @date 2022-08-05 11:40:15
*/
@Log4j2
@Service
public class TStatisticsAnnualBonusServiceImpl extends ServiceImpl<TStatisticsAnnualBonusMapper, TStatisticsAnnualBonus> implements TStatisticsAnnualBonusService {
/**
* 统计-全年一次性奖金简单分页查询
*
* @param tStatisticsAnnualBonus 统计-全年一次性奖金
* @return
*/
@Override
public IPage<TStatisticsAnnualBonus> getTStatisticsAnnualBonusPage(Page<TStatisticsAnnualBonus> page, TStatisticsAnnualBonusSearchVo tStatisticsAnnualBonus) {
return baseMapper.getTStatisticsAnnualBonusPage(page, tStatisticsAnnualBonus);
}
/**
* 统计-全年一次性奖金批量导出
*
* @return
*/
@Override
public void listExport(HttpServletResponse response, TStatisticsAnnualBonusSearchVo searchVo) {
String fileName = "不良记录批量导出" + DateUtil.getThisTime() + ".xlsx";
//获取要导出的列表
List<TStatisticsAnnualBonus> list = new ArrayList<>();
long count = noPageCountDiy(searchVo);
ServletOutputStream out = null;
try {
out = response.getOutputStream();
response.setContentType("multipart/form-data");
response.setCharacterEncoding("utf-8");
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(fileName, "UTF-8"));
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭
//EasyExcel.write(out, TEmpBadRecord.class).sheet("不良记录").doWrite(list);
ExcelWriter excelWriter = EasyExcel.write(out, TStatisticsAnnualBonus.class).build();
int index = 0;
if (count > CommonConstants.ZERO_INT) {
for (int i = 0; i <= count; ) {
// 获取实际记录
searchVo.setLimitStart(i);
searchVo.setLimitEnd(CommonConstants.EXCEL_EXPORT_LIMIT);
list = noPageDiy(searchVo);
if (Common.isNotNull(list)) {
ExcelUtil<TStatisticsAnnualBonus> util = new ExcelUtil<>(TStatisticsAnnualBonus.class);
for (TStatisticsAnnualBonus vo : list) {
util.convertEntity(vo, null, null, null);
}
}
if (Common.isNotNull(list)) {
WriteSheet writeSheet = EasyExcel.writerSheet("统计-全年一次性奖金" + 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();
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);
}
}
}
@Override
public List<TStatisticsAnnualBonus> noPageDiy(TStatisticsAnnualBonusSearchVo searchVo) {
LambdaQueryWrapper<TStatisticsAnnualBonus> wrapper = buildQueryWrapper(searchVo);
List<String> idList = Common.getList(searchVo.getIds());
if (Common.isNotNull(idList)) {
wrapper.in(TStatisticsAnnualBonus::getId, idList);
}
if (searchVo.getLimitStart() >= 0 && searchVo.getLimitEnd() > 0) {
wrapper.last(" limit " + searchVo.getLimitStart() + "," + searchVo.getLimitEnd());
}
return baseMapper.selectList(wrapper);
}
@Override
public R<List<ErrorMessage>> bestSendExport(InputStream inputStream, HttpServletResponse response,
List<String> exportFields) {
YifuUser user = SecurityUtils.getUser();
List<ErrorMessage> errorMessageList = new ArrayList<>();
ExcelUtil<TStatisticsAnnualBonusImportVo> util1 = new ExcelUtil<>(TStatisticsAnnualBonusImportVo.class);
;
// 写法2:
// 匿名内部类 不用额外写一个DemoDataListener
// 这里 需要指定读用哪个class去读,然后读取第一个sheet 文件流会自动关闭
try {
EasyExcel.read(inputStream, TStatisticsAnnualBonusImportVo.class, new ReadListener<TStatisticsAnnualBonusImportVo>() {
/**
* 单次缓存的数据量
*/
public static final int BATCH_COUNT = CommonConstants.BATCH_COUNT;
/**
*临时存储
*/
private List<TStatisticsAnnualBonusImportVo> cachedDataList = ListUtils.newArrayListWithExpectedSize(BATCH_COUNT);
@Override
public void invoke(TStatisticsAnnualBonusImportVo data, AnalysisContext context) {
ReadRowHolder readRowHolder = context.readRowHolder();
Integer rowIndex = readRowHolder.getRowIndex();
data.setRowIndex(rowIndex + 1);
ErrorMessage errorMessage = util1.checkEntity(data, data.getRowIndex());
if (Common.isNotNull(errorMessage)) {
errorMessageList.add(errorMessage);
} else {
cachedDataList.add(data);
}
if (cachedDataList.size() >= BATCH_COUNT) {
saveData();
// 存储完成清理 list
cachedDataList = ListUtils.newArrayListWithExpectedSize(BATCH_COUNT);
}
}
@Override
public void doAfterAllAnalysed(AnalysisContext context) {
saveData();
}
/**
* 加上存储数据库
*/
private void saveData() {
log.info("{}条数据,开始存储数据库!", cachedDataList.size());
importBestSendTax(cachedDataList, errorMessageList, user, response, exportFields);
log.info("存储数据库成功!");
}
}).sheet().doRead();
} catch (Exception e) {
log.error(CommonConstants.IMPORT_DATA_ANALYSIS_ERROR, e);
return R.failed(CommonConstants.IMPORT_DATA_ANALYSIS_ERROR);
}
return R.ok(errorMessageList);
}
private void importBestSendTax(List<TStatisticsAnnualBonusImportVo> list, List<ErrorMessage> errorMessageList,
YifuUser user, HttpServletResponse response, List<String> exportFields) {
if (errorMessageList.size() == CommonConstants.ZERO_INT) {
String fileName = "年终奖测算导出" + DateUtil.getThisTime() + ".xlsx";
ServletOutputStream out = null;
for (TStatisticsAnnualBonusImportVo infoVo : list) {
//todo
}
try {
out = response.getOutputStream();
response.setContentType("multipart/form-data");
response.setCharacterEncoding("utf-8");
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(fileName, "UTF-8"));
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭
EasyExcel.write(out, TStatisticsAnnualBonusImportVo.class).includeColumnFiledNames(exportFields).sheet("年终奖测算")
.doWrite(list);
out.flush();
} catch (Exception e) {
log.error("执行异常", e);
} finally {
try {
if (null != out) {
out.close();
}
} catch (IOException e) {
log.error("执行异常", e);
}
}
}
}
private Long noPageCountDiy(TStatisticsAnnualBonusSearchVo searchVo) {
LambdaQueryWrapper<TStatisticsAnnualBonus> wrapper = buildQueryWrapper(searchVo);
List<String> idList = Common.getList(searchVo.getIds());
if (Common.isNotNull(idList)) {
wrapper.in(TStatisticsAnnualBonus::getId, idList);
}
return baseMapper.selectCount(wrapper);
}
private LambdaQueryWrapper buildQueryWrapper(TStatisticsAnnualBonusSearchVo entity) {
LambdaQueryWrapper<TStatisticsAnnualBonus> wrapper = Wrappers.lambdaQuery();
return wrapper;
}
@Override
public R<List<ErrorMessage>> importDiy(InputStream inputStream) {
List<ErrorMessage> errorMessageList = new ArrayList<>();
ExcelUtil<TStatisticsAnnualBonusVo> util1 = new ExcelUtil<>(TStatisticsAnnualBonusVo.class);
;
// 写法2:
// 匿名内部类 不用额外写一个DemoDataListener
// 这里 需要指定读用哪个class去读,然后读取第一个sheet 文件流会自动关闭
try {
EasyExcel.read(inputStream, TStatisticsAnnualBonusVo.class, new ReadListener<TStatisticsAnnualBonusVo>() {
/**
* 单次缓存的数据量
*/
public static final int BATCH_COUNT = CommonConstants.BATCH_COUNT;
/**
*临时存储
*/
private List<TStatisticsAnnualBonusVo> cachedDataList = ListUtils.newArrayListWithExpectedSize(BATCH_COUNT);
@Override
public void invoke(TStatisticsAnnualBonusVo data, AnalysisContext context) {
ReadRowHolder readRowHolder = context.readRowHolder();
Integer rowIndex = readRowHolder.getRowIndex();
data.setRowIndex(rowIndex + 1);
ErrorMessage errorMessage = util1.checkEntity(data, data.getRowIndex());
if (Common.isNotNull(errorMessage)) {
errorMessageList.add(errorMessage);
} else {
cachedDataList.add(data);
}
if (cachedDataList.size() >= BATCH_COUNT) {
saveData();
// 存储完成清理 list
cachedDataList = ListUtils.newArrayListWithExpectedSize(BATCH_COUNT);
}
}
@Override
public void doAfterAllAnalysed(AnalysisContext context) {
saveData();
}
/**
* 加上存储数据库
*/
private void saveData() {
log.info("{}条数据,开始存储数据库!", cachedDataList.size());
importTStatisticsAnnualBonus(cachedDataList, errorMessageList);
log.info("存储数据库成功!");
}
}).sheet().doRead();
} catch (Exception e) {
log.error(CommonConstants.IMPORT_DATA_ANALYSIS_ERROR, e);
return R.failed(CommonConstants.IMPORT_DATA_ANALYSIS_ERROR);
}
return R.ok(errorMessageList);
}
private void importTStatisticsAnnualBonus(List<TStatisticsAnnualBonusVo> excelVOList, List<ErrorMessage> errorMessageList) {
// 个性化校验逻辑
ErrorMessage errorMsg;
// 执行数据插入操作 组装
for (int i = 0; i < excelVOList.size(); i++) {
TStatisticsAnnualBonusVo excel = excelVOList.get(i);
// 数据合法情况 TODO
// 插入
insertExcel(excel);
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), CommonConstants.SAVE_SUCCESS));
}
}
/**
* 插入excel bad record
*/
private void insertExcel(TStatisticsAnnualBonusVo excel) {
TStatisticsAnnualBonus insert = new TStatisticsAnnualBonus();
BeanUtil.copyProperties(excel, insert);
this.save(insert);
}
}
/*
* 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.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceDetail;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TStatisticsBonus;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TStatisticsDeclarer;
import com.yifu.cloud.plus.v1.yifu.salary.vo.TStatisticsBonusVo;
import com.yifu.cloud.plus.v1.yifu.salary.mapper.TStatisticsBonusMapper;
import com.yifu.cloud.plus.v1.yifu.salary.service.TStatisticsBonusService;
import lombok.RequiredArgsConstructor;
import lombok.extern.log4j.Log4j2;
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;
import com.yifu.cloud.plus.v1.yifu.salary.vo.TStatisticsBonusSearchVo;
import javax.servlet.http.HttpServletResponse;
import java.io.InputStream;
import java.util.List;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.ArrayUtil;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.ExcelWriter;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.read.listener.ReadListener;
import com.alibaba.excel.read.metadata.holder.ReadRowHolder;
import com.alibaba.excel.util.ListUtils;
import com.alibaba.excel.write.metadata.WriteSheet;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
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.util.*;
import com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.InputStream;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
/**
* 全年一次性奖金申报表
*
* @author huyc
* @date 2022-08-14 21:31:15
*/
@Log4j2
@Service
@RequiredArgsConstructor
public class TStatisticsBonusServiceImpl extends ServiceImpl<TStatisticsBonusMapper, TStatisticsBonus> implements TStatisticsBonusService {
/**
* 全年一次性奖金申报表简单分页查询
* @param tStatisticsBonus 全年一次性奖金申报表
* @return
*/
@Override
public IPage<TStatisticsBonus> getTStatisticsBonusPage(Page<TStatisticsBonus> page, TStatisticsBonusSearchVo tStatisticsBonus){
return baseMapper.getTStatisticsBonusPage(page,tStatisticsBonus);
}
/**
* 全年一次性奖金申报表批量导出
* @param searchVo 全年一次性奖金申报表
* @return
*/
@Override
public void listExport(HttpServletResponse response, TStatisticsBonusSearchVo searchVo){
String fileName = "全年一次性奖金申报表批量导出" + DateUtil.getThisTime() + ".xlsx";
//获取要导出的列表
List<TStatisticsBonus> list = new ArrayList<>();
long count = noPageCountDiy(searchVo);
ServletOutputStream out = null;
try {
out = response.getOutputStream();
response.setContentType("multipart/form-data");
response.setCharacterEncoding("utf-8");
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(fileName , "UTF-8"));
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭
ExcelWriter excelWriter = EasyExcel.write(out, TStatisticsBonus.class).build();
int index = 0;
if (count > CommonConstants.ZERO_INT){
for (int i = 0; i <= count; ) {
// 获取实际记录
searchVo.setLimitStart(i);
searchVo.setLimitEnd(CommonConstants.EXCEL_EXPORT_LIMIT);
list = noPageDiy(searchVo);
if (Common.isNotNull(list)){
ExcelUtil<TStatisticsBonus> util = new ExcelUtil<>(TStatisticsBonus.class);
for (TStatisticsBonus vo:list){
util.convertEntity(vo,null,null,null);
}
}
if (Common.isNotNull(list)){
WriteSheet writeSheet = EasyExcel.writerSheet("全年一次性奖金申报表"+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();
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);
}
}
}
@Override
public List<TStatisticsBonus> noPageDiy(TStatisticsBonusSearchVo searchVo) {
LambdaQueryWrapper<TStatisticsBonus> wrapper = buildQueryWrapper(searchVo);
List<String> idList = Common.getList(searchVo.getIds());
if (Common.isNotNull(idList)){
wrapper.in(TStatisticsBonus::getId,idList);
}
if (searchVo.getLimitStart() >= 0 && searchVo.getLimitEnd() > 0){
wrapper.last(" limit "+ searchVo.getLimitStart() +","+ searchVo.getLimitEnd());
}
wrapper.orderByDesc(BaseEntity::getCreateTime);
return baseMapper.selectList(wrapper);
}
@Override
public R batchDelete(String declareMonth) {
if (Common.isNotNull(declareMonth)) {
List<TStatisticsBonus> deleteList = baseMapper.selectList(Wrappers.<TStatisticsBonus>query().lambda()
.in(TStatisticsBonus::getDeclareMonth, declareMonth));
if (Common.isNotNull(deleteList)) {
List<String> idList = deleteList.stream().map(TStatisticsBonus::getId).collect(Collectors.toList());
baseMapper.deleteBatchIds(idList);
return R.ok();
}
return R.failed(CommonConstants.NO_DATA_TO_HANDLE);
}
return null;
}
private Long noPageCountDiy(TStatisticsBonusSearchVo searchVo) {
LambdaQueryWrapper<TStatisticsBonus> wrapper = buildQueryWrapper(searchVo);
List<String> idList = Common.getList(searchVo.getIds());
if (Common.isNotNull(idList)){
wrapper.in(TStatisticsBonus::getId,idList);
}
return baseMapper.selectCount(wrapper);
}
private LambdaQueryWrapper buildQueryWrapper(TStatisticsBonusSearchVo entity){
LambdaQueryWrapper<TStatisticsBonus> wrapper = Wrappers.lambdaQuery();
if (Common.isNotNull(entity.getDeclareMonth())) {
wrapper.eq(TStatisticsBonus::getDeclareMonth,entity.getDeclareMonth());
}
if (Common.isNotNull(entity.getDeclareUnit())) {
wrapper.eq(TStatisticsBonus::getDeclareUnit,entity.getDeclareUnit());
}
return wrapper;
}
@Override
public R<List<ErrorMessage>> importDiy(InputStream inputStream) {
List<ErrorMessage> errorMessageList = new ArrayList<>();
ExcelUtil<TStatisticsBonusVo> util1 = new ExcelUtil<>(TStatisticsBonusVo.class);;
// 写法2:
// 匿名内部类 不用额外写一个DemoDataListener
// 这里 需要指定读用哪个class去读,然后读取第一个sheet 文件流会自动关闭
try {
EasyExcel.read(inputStream, TStatisticsBonusVo.class, new ReadListener<TStatisticsBonusVo>() {
/**
* 单次缓存的数据量
*/
public static final int BATCH_COUNT = CommonConstants.BATCH_COUNT;
/**
*临时存储
*/
private List<TStatisticsBonusVo> cachedDataList = ListUtils.newArrayListWithExpectedSize(BATCH_COUNT);
@Override
public void invoke(TStatisticsBonusVo data, AnalysisContext context) {
ReadRowHolder readRowHolder = context.readRowHolder();
Integer rowIndex = readRowHolder.getRowIndex();
data.setRowIndex(rowIndex+1);
ErrorMessage errorMessage = util1.checkEntity(data, data.getRowIndex());
if (Common.isNotNull(errorMessage)){
errorMessageList.add(errorMessage);
}else {
cachedDataList.add(data);
}
if (cachedDataList.size() >= BATCH_COUNT) {
saveData();
// 存储完成清理 list
cachedDataList = ListUtils.newArrayListWithExpectedSize(BATCH_COUNT);
}
}
@Override
public void doAfterAllAnalysed(AnalysisContext context) {
saveData();
}
/**
* 加上存储数据库
*/
private void saveData() {
log.info("{}条数据,开始存储数据库!", cachedDataList.size());
importTStatisticsBonus(cachedDataList,errorMessageList);
log.info("存储数据库成功!");
}
}).sheet().doRead();
}catch (Exception e){
log.error(CommonConstants.IMPORT_DATA_ANALYSIS_ERROR,e);
return R.failed(CommonConstants.IMPORT_DATA_ANALYSIS_ERROR);
}
return R.ok(errorMessageList);
}
private void importTStatisticsBonus(List<TStatisticsBonusVo> excelVOList, List<ErrorMessage> errorMessageList) {
// 个性化校验逻辑
ErrorMessage errorMsg;
// 执行数据插入操作 组装
for (int i = 0; i < excelVOList.size(); i++) {
TStatisticsBonusVo excel = excelVOList.get(i);
// 插入
insertExcel(excel);
errorMessageList.add(new ErrorMessage(excel.getRowIndex(),CommonConstants.SAVE_SUCCESS));
}
}
/**
* 插入excel bad record
*/
private void insertExcel(TStatisticsBonusVo excel) {
TStatisticsBonus insert = new TStatisticsBonus();
BeanUtil.copyProperties(excel, insert);
this.save(insert);
}
}
...@@ -21,94 +21,84 @@ ...@@ -21,94 +21,84 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!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.TStatisticsAnnualBonusMapper"> <mapper namespace="com.yifu.cloud.plus.v1.yifu.salary.mapper.TStatisticsBonusMapper">
<resultMap id="tStatisticsAnnualBonusMap" type="com.yifu.cloud.plus.v1.yifu.salary.entity.TStatisticsAnnualBonus"> <resultMap id="tStatisticsBonusMap" type="com.yifu.cloud.plus.v1.yifu.salary.entity.TStatisticsBonus">
<id property="id" column="id"/> <id property="id" column="ID"/>
<result property="invoiceTitle" column="INVOICE_TITLE"/> <result property="declareUnit" column="DECLARE_UNIT"/>
<result property="settleDepartId" column="SETTLE_DEPART_ID"/> <result property="declareMonth" column="DECLARE_MONTH"/>
<result property="settleDepartNo" column="SETTLE_DEPART_NO"/>
<result property="settleDepartName" column="SETTLE_DEPART_NAME"/>
<result property="declareMonth" column="declare_MONTH"/>
<result property="empId" column="EMP_ID"/>
<result property="empName" column="EMP_NAME"/> <result property="empName" column="EMP_NAME"/>
<result property="empIdcard" column="EMP_IDCARD"/> <result property="empIdcard" column="EMP_IDCARD"/>
<result property="annualBonus" column="annual_bonus"/> <result property="annualBonus" column="ANNUAL_BONUS"/>
<result property="tax" column="tax"/> <result property="bonusTax" column="BONUS_TAX"/>
<result property="deptId" column="DEPT_ID"/>
<result property="deptNo" column="DEPT_NO"/>
<result property="deptName" column="DEPT_NAME"/>
<result property="unitId" column="UNIT_ID"/> <result property="unitId" column="UNIT_ID"/>
<result property="unitNo" column="UNIT_NO"/> <result property="unitNo" column="UNIT_NO"/>
<result property="unitName" column="UNIT_NAME"/>
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
a.id, a.ID,
a.INVOICE_TITLE, a.DECLARE_UNIT,
a.SETTLE_DEPART_ID, a.DECLARE_MONTH,
a.SETTLE_DEPART_NO,
a.SETTLE_DEPART_NAME,
a.declare_MONTH,
a.EMP_ID,
a.EMP_NAME, a.EMP_NAME,
a.EMP_IDCARD, a.EMP_IDCARD,
a.annual_bonus, a.ANNUAL_BONUS,
a.tax, a.BONUS_TAX,
a.DEPT_ID,
a.DEPT_NO,
a.DEPT_NAME,
a.UNIT_ID, a.UNIT_ID,
a.UNIT_NO, a.UNIT_NO
a.UNIT_NAME
</sql> </sql>
<sql id="tStatisticsAnnualBonus_where"> <sql id="tStatisticsBonus_where">
<if test="tStatisticsAnnualBonus != null"> <if test="tStatisticsBonus != null">
<if test="tStatisticsAnnualBonus.id != null and tStatisticsAnnualBonus.id.trim() != ''"> <if test="tStatisticsBonus.id != null and tStatisticsBonus.id.trim() != ''">
AND a.id = #{tStatisticsAnnualBonus.id} AND a.ID = #{tStatisticsBonus.id}
</if> </if>
<if test="tStatisticsAnnualBonus.invoiceTitle != null and tStatisticsAnnualBonus.invoiceTitle.trim() != ''"> <if test="tStatisticsBonus.declareUnit != null and tStatisticsBonus.declareUnit.trim() != ''">
AND a.INVOICE_TITLE = #{tStatisticsAnnualBonus.invoiceTitle} AND a.DECLARE_UNIT = #{tStatisticsBonus.declareUnit}
</if> </if>
<if test="tStatisticsAnnualBonus.settleDepartId != null and tStatisticsAnnualBonus.settleDepartId.trim() != ''"> <if test="tStatisticsBonus.declareMonth != null and tStatisticsBonus.declareMonth.trim() != ''">
AND a.SETTLE_DEPART_ID = #{tStatisticsAnnualBonus.settleDepartId} AND a.DECLARE_MONTH = #{tStatisticsBonus.declareMonth}
</if> </if>
<if test="tStatisticsAnnualBonus.settleDepartNo != null and tStatisticsAnnualBonus.settleDepartNo.trim() != ''"> <if test="tStatisticsBonus.empName != null and tStatisticsBonus.empName.trim() != ''">
AND a.SETTLE_DEPART_NO = #{tStatisticsAnnualBonus.settleDepartNo} AND a.EMP_NAME = #{tStatisticsBonus.empName}
</if> </if>
<if test="tStatisticsAnnualBonus.settleDepartName != null and tStatisticsAnnualBonus.settleDepartName.trim() != ''"> <if test="tStatisticsBonus.empIdcard != null and tStatisticsBonus.empIdcard.trim() != ''">
AND a.SETTLE_DEPART_NAME = #{tStatisticsAnnualBonus.settleDepartName} AND a.EMP_IDCARD = #{tStatisticsBonus.empIdcard}
</if> </if>
<if test="tStatisticsAnnualBonus.declareMonth != null and tStatisticsAnnualBonus.declareMonth.trim() != ''"> <if test="tStatisticsBonus.annualBonus != null">
AND a.declare_MONTH = #{tStatisticsAnnualBonus.declareMonth} AND a.ANNUAL_BONUS = #{tStatisticsBonus.annualBonus}
</if> </if>
<if test="tStatisticsAnnualBonus.empId != null and tStatisticsAnnualBonus.empId.trim() != ''"> <if test="tStatisticsBonus.bonusTax != null">
AND a.EMP_ID = #{tStatisticsAnnualBonus.empId} AND a.BONUS_TAX = #{tStatisticsBonus.bonusTax}
</if> </if>
<if test="tStatisticsAnnualBonus.empName != null and tStatisticsAnnualBonus.empName.trim() != ''"> <if test="tStatisticsBonus.deptId != null and tStatisticsBonus.deptId.trim() != ''">
AND a.EMP_NAME = #{tStatisticsAnnualBonus.empName} AND a.DEPT_ID = #{tStatisticsBonus.deptId}
</if> </if>
<if test="tStatisticsAnnualBonus.empIdcard != null and tStatisticsAnnualBonus.empIdcard.trim() != ''"> <if test="tStatisticsBonus.deptNo != null and tStatisticsBonus.deptNo.trim() != ''">
AND a.EMP_IDCARD = #{tStatisticsAnnualBonus.empIdcard} AND a.DEPT_NO = #{tStatisticsBonus.deptNo}
</if> </if>
<if test="tStatisticsAnnualBonus.annualBonus != null"> <if test="tStatisticsBonus.deptName != null and tStatisticsBonus.deptName.trim() != ''">
AND a.annual_bonus = #{tStatisticsAnnualBonus.annualBonus} AND a.DEPT_NAME = #{tStatisticsBonus.deptName}
</if> </if>
<if test="tStatisticsAnnualBonus.tax != null"> <if test="tStatisticsBonus.unitId != null and tStatisticsBonus.unitId.trim() != ''">
AND a.tax = #{tStatisticsAnnualBonus.tax} AND a.UNIT_ID = #{tStatisticsBonus.unitId}
</if> </if>
<if test="tStatisticsAnnualBonus.unitId != null and tStatisticsAnnualBonus.unitId.trim() != ''"> <if test="tStatisticsBonus.unitNo != null and tStatisticsBonus.unitNo.trim() != ''">
AND a.UNIT_ID = #{tStatisticsAnnualBonus.unitId} AND a.UNIT_NO = #{tStatisticsBonus.unitNo}
</if>
<if test="tStatisticsAnnualBonus.unitNo != null and tStatisticsAnnualBonus.unitNo.trim() != ''">
AND a.UNIT_NO = #{tStatisticsAnnualBonus.unitNo}
</if>
<if test="tStatisticsAnnualBonus.unitName != null and tStatisticsAnnualBonus.unitName.trim() != ''">
AND a.UNIT_NAME = #{tStatisticsAnnualBonus.unitName}
</if> </if>
</if> </if>
</sql> </sql>
<!--tStatisticsAnnualBonus简单分页查询--> <!--tStatisticsBonus简单分页查询-->
<select id="getTStatisticsAnnualBonusPage" resultMap="tStatisticsAnnualBonusMap"> <select id="getTStatisticsBonusPage" resultMap="tStatisticsBonusMap">
SELECT SELECT
<include refid="Base_Column_List"/> <include refid="Base_Column_List"/>
FROM t_statistics_annual_bonus a FROM t_statistics_bonus a
<where> <where>
1=1 1=1
<include refid="tStatisticsAnnualBonus_where"/> <include refid="tStatisticsBonus_where"/>
</where> </where>
</select> </select>
</mapper> </mapper>
...@@ -22,7 +22,7 @@ public class TPaymentHeFeiVo extends RowIndex implements Serializable { ...@@ -22,7 +22,7 @@ public class TPaymentHeFeiVo extends RowIndex implements Serializable {
* 员工姓名 * 员工姓名
*/ */
@Length(max = 20, message = "员工姓名不能超过20个字符") @Length(max = 20, message = "员工姓名不能超过20个字符")
@ExcelAttribute(name = "员工姓名", maxLength = 20) @ExcelAttribute(name = "员工姓名", maxLength = 20,isNotEmpty = true)
@Schema(description = "员工姓名") @Schema(description = "员工姓名")
@ExcelProperty("员工姓名") @ExcelProperty("员工姓名")
private String empName; private String empName;
......
...@@ -51,7 +51,7 @@ public class TPaymentInfoVo extends RowIndex implements Serializable { ...@@ -51,7 +51,7 @@ public class TPaymentInfoVo extends RowIndex implements Serializable {
* 员工姓名 * 员工姓名
*/ */
@Length(max = 20, message = "员工姓名 不能超过20 个字符") @Length(max = 20, message = "员工姓名 不能超过20 个字符")
@ExcelAttribute(name = "员工姓名", maxLength = 20) @ExcelAttribute(name = "员工姓名", maxLength = 20,isNotEmpty = true)
@Schema(description = "员工姓名") @Schema(description = "员工姓名")
@ExcelProperty("员工姓名") @ExcelProperty("员工姓名")
private String empName; private String empName;
......
...@@ -44,10 +44,8 @@ import org.springframework.web.bind.annotation.*; ...@@ -44,10 +44,8 @@ import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.net.URLDecoder; import java.net.URLDecoder;
import java.util.ArrayList; import java.util.*;
import java.util.HashMap; import java.util.stream.Collectors;
import java.util.List;
import java.util.Map;
/** /**
...@@ -226,8 +224,10 @@ public class TPreDispatchInfoController { ...@@ -226,8 +224,10 @@ public class TPreDispatchInfoController {
@SysLog("预派单批量新增派增") @SysLog("预派单批量新增派增")
@PostMapping("/analysisJsonStringImportAdd") @PostMapping("/analysisJsonStringImportAdd")
@PreAuthorize("@pms.hasPermission('social_tpredispatchinfo_importAddList')") @PreAuthorize("@pms.hasPermission('social_tpredispatchinfo_importAddList')")
public R analysisJsonStringImportAdd(@RequestBody String jsonString, @RequestParam(value = "socialHouse",required = false) String socialHouse, public R analysisJsonStringImportAdd(@RequestBody String jsonString,
@RequestParam(value = "fundHouse",required = false) String fundHouse, @RequestParam String departId) { @RequestParam(value = "socialHouse",required = false) String socialHouse,
@RequestParam(value = "fundHouse",required = false) String fundHouse
, @RequestParam String departId) {
YifuUser user = SecurityUtils.getUser(); YifuUser user = SecurityUtils.getUser();
if (null == user || null == user.getId()) { if (null == user || null == user.getId()) {
return R.failed(CommonConstants.USER_FAIL); return R.failed(CommonConstants.USER_FAIL);
...@@ -241,15 +241,19 @@ public class TPreDispatchInfoController { ...@@ -241,15 +241,19 @@ public class TPreDispatchInfoController {
//用于返回错误信息 //用于返回错误信息
List<ErrorMessage> errorInfo = new ArrayList<>(); List<ErrorMessage> errorInfo = new ArrayList<>();
if (null != util1.getErrorInfo() && !util1.getErrorInfo().isEmpty()) { if (null != util1.getErrorInfo() && !util1.getErrorInfo().isEmpty()) {
return R.failed(util1.getErrorInfo(),PreDispatchConstants.DATA_CHECK); for (ErrorMessage errorMessage: util1.getErrorInfo()) {
} else { errorInfo.add(errorMessage);
if (null != listInfo && !listInfo.isEmpty()) {
errorInfo = tPreDispatchInfoService.batchSavePreDisPatchAdd(listInfo, user,socialHouse,fundHouse,departId);
} else {
errorInfo.add(new ErrorMessage(null, CommonConstants.DATA_CAN_NOT_EMPTY));
} }
return R.ok(errorInfo);
} }
if (null != listInfo && !listInfo.isEmpty()) {
errorInfo = tPreDispatchInfoService.batchSavePreDisPatchAdd(listInfo, user,socialHouse,fundHouse,
departId,errorInfo);
} else {
errorInfo.add(new ErrorMessage(null, CommonConstants.DATA_CAN_NOT_EMPTY));
}
List<ErrorMessage> newErrorList = errorInfo.stream().sorted(Comparator.comparing(ErrorMessage::getLineNum))
.collect(Collectors.toList());
return R.ok(newErrorList);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
return R.failed(PreDispatchConstants.DATA_IMPORT_ANALYSIS_ERROR); return R.failed(PreDispatchConstants.DATA_IMPORT_ANALYSIS_ERROR);
...@@ -281,15 +285,18 @@ public class TPreDispatchInfoController { ...@@ -281,15 +285,18 @@ public class TPreDispatchInfoController {
//用于返回错误信息 //用于返回错误信息
List<ErrorMessage> errorInfo = new ArrayList<>(); List<ErrorMessage> errorInfo = new ArrayList<>();
if (null != util1.getErrorInfo() && !util1.getErrorInfo().isEmpty()) { if (null != util1.getErrorInfo() && !util1.getErrorInfo().isEmpty()) {
return R.failed(util1.getErrorInfo()); for (ErrorMessage errorMessage: util1.getErrorInfo()) {
} else { errorInfo.add(errorMessage);
if (null != listInfo && !listInfo.isEmpty()) {
errorInfo = tPreDispatchInfoService.batchSavePreDisPatchReduce(listInfo, user);
} else {
errorInfo.add(new ErrorMessage(null, CommonConstants.DATA_CAN_NOT_EMPTY));
} }
return R.ok(errorInfo);
} }
if (null != listInfo && !listInfo.isEmpty()) {
tPreDispatchInfoService.batchSavePreDisPatchReduce(listInfo, user, errorInfo);
} else {
errorInfo.add(new ErrorMessage(null, CommonConstants.DATA_CAN_NOT_EMPTY));
}
List<ErrorMessage> newErrorList = errorInfo.stream().sorted(Comparator.comparing(ErrorMessage::getLineNum))
.collect(Collectors.toList());
return R.ok(newErrorList);
} catch (Exception e) { } catch (Exception e) {
log.error("预派单批量导入派减",e); log.error("预派单批量导入派减",e);
return R.failed(PreDispatchConstants.DATA_IMPORT_ANALYSIS_ERROR); return R.failed(PreDispatchConstants.DATA_IMPORT_ANALYSIS_ERROR);
...@@ -332,15 +339,18 @@ public class TPreDispatchInfoController { ...@@ -332,15 +339,18 @@ public class TPreDispatchInfoController {
//用于返回错误信息 //用于返回错误信息
List<ErrorMessage> errorInfo = new ArrayList<>(); List<ErrorMessage> errorInfo = new ArrayList<>();
if (null != util1.getErrorInfo() && !util1.getErrorInfo().isEmpty()) { if (null != util1.getErrorInfo() && !util1.getErrorInfo().isEmpty()) {
return R.failed(util1.getErrorInfo(),PreDispatchConstants.DATA_CHECK); for (ErrorMessage errorMessage: util1.getErrorInfo()) {
} else { errorInfo.add(errorMessage);
if (null != listInfo && !listInfo.isEmpty()) {
errorInfo = tPreDispatchInfoService.batchUpdatePreDisPatch(listInfo, user);
} else {
errorInfo.add(new ErrorMessage(null, CommonConstants.DATA_CAN_NOT_EMPTY));
} }
return R.ok(errorInfo);
} }
if (null != listInfo && !listInfo.isEmpty()) {
tPreDispatchInfoService.batchUpdatePreDisPatch(listInfo, user, errorInfo);
} else {
errorInfo.add(new ErrorMessage(null, CommonConstants.DATA_CAN_NOT_EMPTY));
}
List<ErrorMessage> newErrorList = errorInfo.stream().sorted(Comparator.comparing(ErrorMessage::getLineNum))
.collect(Collectors.toList());
return R.ok(newErrorList);
} catch (Exception e) { } catch (Exception e) {
log.error("预派单批量更新",e); log.error("预派单批量更新",e);
return R.failed(PreDispatchConstants.DATA_IMPORT_ANALYSIS_ERROR); return R.failed(PreDispatchConstants.DATA_IMPORT_ANALYSIS_ERROR);
......
...@@ -109,7 +109,8 @@ public interface TPreDispatchInfoService extends IService<TPreDispatchInfo> { ...@@ -109,7 +109,8 @@ public interface TPreDispatchInfoService extends IService<TPreDispatchInfo> {
* @param departId * @param departId
* @return * @return
**/ **/
List<ErrorMessage> batchSavePreDisPatchAdd(List<TPreDispatchInfo> listInfo, YifuUser user, String socialHouse, String fundHouse, String departId); List<ErrorMessage> batchSavePreDisPatchAdd(List<TPreDispatchInfo> listInfo, YifuUser user, String socialHouse,
String fundHouse, String departId, List<ErrorMessage> errorInfo);
/** /**
* 预派单批量新增派减 * 预派单批量新增派减
...@@ -119,7 +120,8 @@ public interface TPreDispatchInfoService extends IService<TPreDispatchInfo> { ...@@ -119,7 +120,8 @@ public interface TPreDispatchInfoService extends IService<TPreDispatchInfo> {
* @param user * @param user
* @return * @return
**/ **/
List<ErrorMessage> batchSavePreDisPatchReduce(List<TPreDispatchReduceVo> listInfo, YifuUser user); List<ErrorMessage> batchSavePreDisPatchReduce(List<TPreDispatchReduceVo> listInfo, YifuUser user,
List<ErrorMessage> errorInfo);
/** /**
* 预派单批量更新 * 预派单批量更新
...@@ -129,7 +131,8 @@ public interface TPreDispatchInfoService extends IService<TPreDispatchInfo> { ...@@ -129,7 +131,8 @@ public interface TPreDispatchInfoService extends IService<TPreDispatchInfo> {
* @param user * @param user
* @return * @return
**/ **/
List<ErrorMessage> batchUpdatePreDisPatch(List<TPreDispatchUpdateVo> listInfo, YifuUser user); List<ErrorMessage> batchUpdatePreDisPatch(List<TPreDispatchUpdateVo> listInfo, YifuUser user,
List<ErrorMessage> messageList);
/** /**
* 预派单导出 * 预派单导出
......
...@@ -35,9 +35,11 @@ import com.yifu.cloud.plus.v1.yifu.salary.vo.TPaymentVo; ...@@ -35,9 +35,11 @@ import com.yifu.cloud.plus.v1.yifu.salary.vo.TPaymentVo;
import com.yifu.cloud.plus.v1.yifu.social.concurrent.threadpool.YFSocialImportThreadPoolExecutor; import com.yifu.cloud.plus.v1.yifu.social.concurrent.threadpool.YFSocialImportThreadPoolExecutor;
import com.yifu.cloud.plus.v1.yifu.social.constants.PaymentConstants; import com.yifu.cloud.plus.v1.yifu.social.constants.PaymentConstants;
import com.yifu.cloud.plus.v1.yifu.social.constants.SocialConstants; import com.yifu.cloud.plus.v1.yifu.social.constants.SocialConstants;
import com.yifu.cloud.plus.v1.yifu.social.entity.SysHouseHoldInfo;
import com.yifu.cloud.plus.v1.yifu.social.entity.TPaymentInfo; import com.yifu.cloud.plus.v1.yifu.social.entity.TPaymentInfo;
import com.yifu.cloud.plus.v1.yifu.social.entity.TProvidentFund; import com.yifu.cloud.plus.v1.yifu.social.entity.TProvidentFund;
import com.yifu.cloud.plus.v1.yifu.social.entity.TSocialInfo; import com.yifu.cloud.plus.v1.yifu.social.entity.TSocialInfo;
import com.yifu.cloud.plus.v1.yifu.social.mapper.SysHouseHoldInfoMapper;
import com.yifu.cloud.plus.v1.yifu.social.mapper.TPaymentInfoMapper; import com.yifu.cloud.plus.v1.yifu.social.mapper.TPaymentInfoMapper;
import com.yifu.cloud.plus.v1.yifu.social.mapper.TProvidentFundMapper; import com.yifu.cloud.plus.v1.yifu.social.mapper.TProvidentFundMapper;
import com.yifu.cloud.plus.v1.yifu.social.mapper.TSocialInfoMapper; import com.yifu.cloud.plus.v1.yifu.social.mapper.TSocialInfoMapper;
...@@ -56,7 +58,6 @@ import com.yifu.cloud.plus.v1.yifu.common.core.util.R; ...@@ -56,7 +58,6 @@ import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.InputStream; import java.io.InputStream;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.text.NumberFormat; import java.text.NumberFormat;
import java.util.*; import java.util.*;
...@@ -113,6 +114,9 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -113,6 +114,9 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
@Autowired @Autowired
private ArchivesDaprUtil archivesDaprUtil; private ArchivesDaprUtil archivesDaprUtil;
@Autowired
private SysHouseHoldInfoMapper sysHouseHoldInfoMapper;
/** /**
* 缴费库简单分页查询 * 缴费库简单分页查询
* *
...@@ -217,9 +221,9 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -217,9 +221,9 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
for (String id : idList) { for (String id : idList) {
paymentInfo = baseMapper.selectById(id); paymentInfo = baseMapper.selectById(id);
if (null != paymentInfo && Common.isNotNull(paymentInfo.getId())) { if (null != paymentInfo && Common.isNotNull(paymentInfo.getId())) {
if ((!user.getId().equals(paymentInfo.getCreateBy()) || if ((!user.getId().equals(paymentInfo.getCreateBy()) &&
CommonConstants.ZERO_STRING.equals(paymentInfo.getPushStatus())) !CommonConstants.ONE_STRING.equals(user.getId())) ||
&& !CommonConstants.ONE_STRING.equals(user.getId())) { CommonConstants.ZERO_STRING.equals(paymentInfo.getPushStatus())) {
return R.failed("存在不符合条件的数据(已推送至结算平台或非本人创建),禁止删除!"); return R.failed("存在不符合条件的数据(已推送至结算平台或非本人创建),禁止删除!");
} }
baseMapper.deleteById(id); baseMapper.deleteById(id);
...@@ -227,7 +231,6 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -227,7 +231,6 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
} }
return R.ok(); return R.ok();
} }
/** /**
* 通过ID获取缴费库 及社保、公积金明细 * 通过ID获取缴费库 及社保、公积金明细
* *
...@@ -246,31 +249,18 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -246,31 +249,18 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
String socialCreateMonth, String socialPayMonth) { String socialCreateMonth, String socialPayMonth) {
YifuUser user = SecurityUtils.getUser(); YifuUser user = SecurityUtils.getUser();
LambdaQueryWrapper<TPaymentInfo> wrapper = Wrappers.lambdaQuery(); LambdaQueryWrapper<TPaymentInfo> wrapper = buildQueryWrapper(empIdCard,socialHouseId,fundHouseId,
if (Common.isNotNull(empIdCard)) { socialCreateMonth,socialPayMonth);
wrapper.eq(TPaymentInfo::getEmpIdcard, empIdCard);
}
if (Common.isNotNull(socialHouseId)) {
wrapper.eq(TPaymentInfo::getSocialHousehold, socialHouseId);
}
if (Common.isNotNull(fundHouseId)) {
wrapper.eq(TPaymentInfo::getProvidentHousehold, fundHouseId);
}
if (Common.isNotNull(socialCreateMonth)) {
wrapper.eq(TPaymentInfo::getSocialCreateMonth, socialCreateMonth);
}
if (Common.isNotNull(socialPayMonth)) {
wrapper.eq(TPaymentInfo::getSocialPayMonth, socialPayMonth);
}
List<TPaymentInfo> list = baseMapper.selectList(wrapper); List<TPaymentInfo> list = baseMapper.selectList(wrapper);
List<String> idList = new ArrayList<>(); List<String> idList = new ArrayList<>();
Boolean delFlag = false;
if (Common.isNotNull(list)) { if (Common.isNotNull(list)) {
for (TPaymentInfo paymentInfo : list) { for (TPaymentInfo paymentInfo : list) {
if ((!user.getId().equals(paymentInfo.getCreateBy()) || if ((!user.getId().equals(paymentInfo.getCreateBy()) &&
CommonConstants.ZERO_STRING.equals(paymentInfo.getPushStatus())) !CommonConstants.ONE_STRING.equals(user.getId())) ||
&& !CommonConstants.ONE_STRING.equals(user.getId())) { CommonConstants.ZERO_STRING.equals(paymentInfo.getPushStatus())) {
return R.failed("存在不符合条件的数据(已推送至结算平台或非本人创建),禁止删除!"); delFlag = true;
} else { } else {
idList.add(paymentInfo.getId()); idList.add(paymentInfo.getId());
} }
...@@ -278,8 +268,42 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -278,8 +268,42 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
} else { } else {
return R.failed(CommonConstants.NO_DATA_TO_HANDLE); return R.failed(CommonConstants.NO_DATA_TO_HANDLE);
} }
baseMapper.deleteBatchIds(idList); if (Common.isNotNull(idList)) {
return R.ok(); baseMapper.deleteBatchIds(idList);
}
if (delFlag) {
return R.ok(null,"存在不符合条件的数据(已推送至结算平台或非本人创建),禁止删除!");
}
return R.ok(null,"批量删除成功");
}
private LambdaQueryWrapper buildQueryWrapper(String empIdCard, String socialHouseId, String fundHouseId,
String socialCreateMonth, String socialPayMonth){
LambdaQueryWrapper<TPaymentInfo> wrapper = Wrappers.lambdaQuery();
if (Common.isNotNull(empIdCard)) {
wrapper.eq(TPaymentInfo::getEmpIdcard, empIdCard);
}
if (Common.isNotNull(socialHouseId)) {
SysHouseHoldInfo info = sysHouseHoldInfoMapper.selectById(socialHouseId);
if (Common.isNotNull(info)) {
wrapper.eq(TPaymentInfo::getSocialHousehold, info.getName());
}
}
if (Common.isNotNull(fundHouseId)) {
SysHouseHoldInfo infoFund = sysHouseHoldInfoMapper.selectById(fundHouseId);
if (Common.isNotNull(infoFund)) {
wrapper.eq(TPaymentInfo::getProvidentHousehold, infoFund.getName());
}
}
if (Common.isNotNull(socialCreateMonth)) {
wrapper.eq(TPaymentInfo::getSocialCreateMonth, socialCreateMonth).or()
.eq(TPaymentInfo::getProvidentCreateMonth, socialCreateMonth);
}
if (Common.isNotNull(socialPayMonth)) {
wrapper.eq(TPaymentInfo::getSocialPayMonth, socialPayMonth).or()
.eq(TPaymentInfo::getProvidentPayMonth, socialPayMonth);;
}
return wrapper;
} }
@Override @Override
...@@ -296,7 +320,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -296,7 +320,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
/** /**
* 单次缓存的数据量 * 单次缓存的数据量
*/ */
public static final int BATCH_COUNT = CommonConstants.BATCH_COUNT; public static final int BATCH_COUNT = CommonConstants.BATCH_COUNT1;
/** /**
*临时存储 *临时存储
*/ */
...@@ -480,17 +504,26 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -480,17 +504,26 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
// -----------------------------线程池处理list,批量保存社保信息开始-------------------------------- // -----------------------------线程池处理list,批量保存社保信息开始--------------------------------
List<TPaymentInfoVo> tempList = new ArrayList<>(); List<TPaymentInfoVo> tempList = new ArrayList<>();
String importSuccessKey = user.getId() + CommonConstants.DOWN_LINE_STRING + CommonConstants.PAYMENT_SOCIAL_WAIT_EXPORT;
AtomicInteger atomicLine = new AtomicInteger(CommonConstants.ZERO_INT); AtomicInteger atomicLine = new AtomicInteger(CommonConstants.ZERO_INT);
List<CompletableFuture<List<ErrorMessage>>> completableFutureList = new ArrayList<>(); List<CompletableFuture<List<ErrorMessage>>> completableFutureList = new ArrayList<>();
try { try {
// 1.list.size()不足partSize,直接执行 // 1.list.size()不足partSize,直接执行
if (list.size() < partSize) { if (list.size() < partSize) {
CompletableFuture<List<ErrorMessage>> listCompletableFuture = CompletableFuture.supplyAsync(() -> CompletableFuture<List<ErrorMessage>> listCompletableFuture = CompletableFuture.supplyAsync(() ->
executeImportSocialList(user, atomicLine, random, list, areaMap, areaMap2, executeImportSocialList(user, atomicLine, list, areaMap, areaMap2,
paymentInfoPensionMap, paymentInfoBigMap, paymentInfoBirMap, paymentInfoPensionMap, paymentInfoBigMap, paymentInfoBirMap,
paymentInfoMedicalMap, paymentInfoUnEmpMap, paymentInfoInjuryMap, paymentInfoMedicalMap, paymentInfoUnEmpMap, paymentInfoInjuryMap,
CommonConstants.ONE_INT, errorMessageList), yfSocialImportThreadPoolExecutor); CommonConstants.ONE_INT, errorMessageList), yfSocialImportThreadPoolExecutor);
completableFutureList.add(listCompletableFuture); completableFutureList.add(listCompletableFuture);
// 创建一个数值格式化对象
NumberFormat numberFormat = NumberFormat.getInstance();
// 设置精确到小数点后2位
numberFormat.setMaximumFractionDigits(2);
String maerialRatio = numberFormat.format((float)atomicLine.get()/(float)list.size()*100);
redisUtil.set(importSuccessKey, maerialRatio, 180L);
} }
// 2.list.size()大于partSize,循环分批执行 // 2.list.size()大于partSize,循环分批执行
...@@ -499,7 +532,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -499,7 +532,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
// 处理第一个0位元素 // 处理第一个0位元素
final List<TPaymentInfoVo> finalList = list.subList(0, 1); final List<TPaymentInfoVo> finalList = list.subList(0, 1);
CompletableFuture<List<ErrorMessage>> listCompletableFuture = CompletableFuture.supplyAsync(() -> CompletableFuture<List<ErrorMessage>> listCompletableFuture = CompletableFuture.supplyAsync(() ->
executeImportSocialList(user, atomicLine, random, finalList, areaMap, areaMap2, executeImportSocialList(user, atomicLine, finalList, areaMap, areaMap2,
paymentInfoPensionMap, paymentInfoBigMap, paymentInfoBirMap, paymentInfoPensionMap, paymentInfoBigMap, paymentInfoBirMap,
paymentInfoMedicalMap, paymentInfoUnEmpMap, paymentInfoInjuryMap, paymentInfoMedicalMap, paymentInfoUnEmpMap, paymentInfoInjuryMap,
CommonConstants.ONE_INT, errorMessageList), yfSocialImportThreadPoolExecutor); CommonConstants.ONE_INT, errorMessageList), yfSocialImportThreadPoolExecutor);
...@@ -514,13 +547,19 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -514,13 +547,19 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
List<TPaymentInfoVo> finalTempList = tempList; List<TPaymentInfoVo> finalTempList = tempList;
final int idx = i - partSize + 2; final int idx = i - partSize + 2;
CompletableFuture.supplyAsync(() -> CompletableFuture.supplyAsync(() ->
executeImportSocialList(user, atomicLine, random, finalTempList, areaMap, areaMap2, executeImportSocialList(user, atomicLine, finalTempList, areaMap, areaMap2,
paymentInfoPensionMap, paymentInfoBigMap, paymentInfoBirMap, paymentInfoPensionMap, paymentInfoBigMap, paymentInfoBirMap,
paymentInfoMedicalMap, paymentInfoUnEmpMap, paymentInfoInjuryMap, paymentInfoMedicalMap, paymentInfoUnEmpMap, paymentInfoInjuryMap,
idx, errorMessageList), yfSocialImportThreadPoolExecutor); idx, errorMessageList), yfSocialImportThreadPoolExecutor);
tempList = new ArrayList<>(); tempList = new ArrayList<>();
} }
} }
// 创建一个数值格式化对象
NumberFormat numberFormat = NumberFormat.getInstance();
// 设置精确到小数点后2位
numberFormat.setMaximumFractionDigits(2);
String maerialRatio = numberFormat.format((float)atomicLine.get()/(float)list.size()*100);
redisUtil.set(importSuccessKey, maerialRatio, 180L);
} }
// 3.第2种方式执行完后,有余数的情况下,执行3 // 3.第2种方式执行完后,有余数的情况下,执行3
...@@ -540,11 +579,17 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -540,11 +579,17 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
List<TPaymentInfoVo> finalTempList = tempList; List<TPaymentInfoVo> finalTempList = tempList;
int finalLastIdx = lastIdx + 1; int finalLastIdx = lastIdx + 1;
CompletableFuture<List<ErrorMessage>> listCompletableFuture = CompletableFuture.supplyAsync(() -> CompletableFuture<List<ErrorMessage>> listCompletableFuture = CompletableFuture.supplyAsync(() ->
executeImportSocialList(user, atomicLine, random, finalTempList, areaMap, areaMap2, executeImportSocialList(user, atomicLine, finalTempList, areaMap, areaMap2,
paymentInfoPensionMap, paymentInfoBigMap, paymentInfoBirMap, paymentInfoPensionMap, paymentInfoBigMap, paymentInfoBirMap,
paymentInfoMedicalMap, paymentInfoUnEmpMap, paymentInfoInjuryMap, paymentInfoMedicalMap, paymentInfoUnEmpMap, paymentInfoInjuryMap,
finalLastIdx, errorMessageList), yfSocialImportThreadPoolExecutor); finalLastIdx, errorMessageList), yfSocialImportThreadPoolExecutor);
completableFutureList.add(listCompletableFuture); completableFutureList.add(listCompletableFuture);
// 创建一个数值格式化对象
NumberFormat numberFormat = NumberFormat.getInstance();
// 设置精确到小数点后2位
numberFormat.setMaximumFractionDigits(2);
String maerialRatio = numberFormat.format((float)atomicLine.get()/(float)list.size()*100);
redisUtil.set(importSuccessKey, maerialRatio, 180L);
} }
// 阻塞当前线程,等待所有的线程执行完毕 // 阻塞当前线程,等待所有的线程执行完毕
...@@ -558,15 +603,6 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -558,15 +603,6 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
} }
} while (computeFlag); } while (computeFlag);
String importSuccessKey = user.getId() + CommonConstants.DOWN_LINE_STRING + CommonConstants.PAYMENT_SOCIAL_WAIT_EXPORT;
// 创建一个数值格式化对象
NumberFormat numberFormat = NumberFormat.getInstance();
// 设置精确到小数点后2位
numberFormat.setMaximumFractionDigits(2);
String maerialRatio = numberFormat.format((float)atomicLine.get()/(float)list.size()*100);
redisUtil.set(importSuccessKey, maerialRatio, 1800L);
} catch (Exception e) { } catch (Exception e) {
log.error("社保缴费库数据批量导入异常:" + e); log.error("社保缴费库数据批量导入异常:" + e);
redisUtil.remove(key); redisUtil.remove(key);
...@@ -631,7 +667,6 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -631,7 +667,6 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
*/ */
private List<ErrorMessage> executeImportSocialList(YifuUser user, private List<ErrorMessage> executeImportSocialList(YifuUser user,
AtomicInteger atomicLine, AtomicInteger atomicLine,
String random,
List<TPaymentInfoVo> list, List<TPaymentInfoVo> list,
HashMap<String, String> areaMap, HashMap<String, String> areaMap,
HashMap<String, String> areaMap2, HashMap<String, String> areaMap2,
...@@ -961,8 +996,6 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -961,8 +996,6 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
paymentInfo.setSocialHousehold(socialInfo.getSocialHouseholdName()); paymentInfo.setSocialHousehold(socialInfo.getSocialHouseholdName());
paymentInfo.setSocialPayMonth(infoVo.getSocialPayMonth()); paymentInfo.setSocialPayMonth(infoVo.getSocialPayMonth());
// 同时设置公积金缴纳日期方便导入处理
paymentInfo.setProvidentPayMonth(infoVo.getSocialPayMonth());
if (null != paymentInfo.getSocialProvince()) { if (null != paymentInfo.getSocialProvince()) {
temp = areaMap.get(paymentInfo.getSocialProvince()); temp = areaMap.get(paymentInfo.getSocialProvince());
...@@ -1480,8 +1513,6 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -1480,8 +1513,6 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
paymentInfo.setTelecomNumber(fund.getTelecomNumber()); paymentInfo.setTelecomNumber(fund.getTelecomNumber());
} }
paymentInfo.setProvidentPayMonth(infoVo.getProvidentPayMonth()); paymentInfo.setProvidentPayMonth(infoVo.getProvidentPayMonth());
//同时设置社保缴纳日期方便导入处理
paymentInfo.setSocialPayMonth(infoVo.getProvidentPayMonth());
paymentInfo.setFundProvince(fund.getFundProvince()); paymentInfo.setFundProvince(fund.getFundProvince());
paymentInfo.setFundCity(fund.getFundCity()); paymentInfo.setFundCity(fund.getFundCity());
paymentInfo.setFundTown(fund.getFundTown()); paymentInfo.setFundTown(fund.getFundTown());
...@@ -1656,6 +1687,19 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -1656,6 +1687,19 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
+ PaymentConstants.MEDICAL + PaymentConstants.MEDICAL
, info); , info);
} }
if (BigDecimalUtils.safeAdd(BigDecimalUtils.isNullToZero(info.getPersonalBigmailmentMoney()),
BigDecimalUtils.isNullToZero(info.getUnitBigmailmentMoney())).compareTo(BigDecimal.ZERO) != 0) {
paymentInfoBigMap.put(info.getSocialPayAddr()
+ CommonConstants.DOWN_LINE_STRING
+ info.getEmpIdcard()
+ CommonConstants.DOWN_LINE_STRING
+ info.getSocialPayMonth()
+ CommonConstants.DOWN_LINE_STRING
+ info.getSocialCreateMonth()
+ CommonConstants.DOWN_LINE_STRING
+ SocialConstants.DB
, info);
}
} }
} }
// -----------------------------生成paymentInfoMap本段结束-------------------------------- // -----------------------------生成paymentInfoMap本段结束--------------------------------
...@@ -1675,7 +1719,8 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -1675,7 +1719,8 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
CompletableFuture<List<ErrorMessage>> listCompletableFuture = CompletableFuture.supplyAsync(() CompletableFuture<List<ErrorMessage>> listCompletableFuture = CompletableFuture.supplyAsync(()
-> executeImportSocialListThree(user, atomicLine, random, list, areaMap, areaMap2, -> executeImportSocialListThree(user, atomicLine, random, list, areaMap, areaMap2,
paymentInfoPensionMap, paymentInfoMedicalMap, paymentInfoUnEmpMap, paymentInfoInjuryMap, paymentInfoPensionMap, paymentInfoMedicalMap, paymentInfoUnEmpMap, paymentInfoInjuryMap,
CommonConstants.ONE_INT, type, errorMessageList), yfSocialImportThreadPoolExecutor); paymentInfoBigMap,CommonConstants.ONE_INT, type, errorMessageList),
yfSocialImportThreadPoolExecutor);
completableFutureList.add(listCompletableFuture); completableFutureList.add(listCompletableFuture);
} }
...@@ -1687,8 +1732,8 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -1687,8 +1732,8 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
CompletableFuture<List<ErrorMessage>> oneCompletableFuture = CompletableFuture.supplyAsync(() CompletableFuture<List<ErrorMessage>> oneCompletableFuture = CompletableFuture.supplyAsync(()
-> executeImportSocialListThree(user, atomicLine, random, finalList, areaMap, -> executeImportSocialListThree(user, atomicLine, random, finalList, areaMap,
areaMap2, paymentInfoPensionMap, paymentInfoMedicalMap, paymentInfoUnEmpMap, areaMap2, paymentInfoPensionMap, paymentInfoMedicalMap, paymentInfoUnEmpMap,
paymentInfoInjuryMap, CommonConstants.ONE_INT, type, errorMessageList) paymentInfoInjuryMap, paymentInfoBigMap,CommonConstants.ONE_INT, type,
, yfSocialImportThreadPoolExecutor); errorMessageList), yfSocialImportThreadPoolExecutor);
completableFutureList.add(oneCompletableFuture); completableFutureList.add(oneCompletableFuture);
lastIdx = 1; lastIdx = 1;
for (int i = 1; i < list.size(); i++) { for (int i = 1; i < list.size(); i++) {
...@@ -1701,8 +1746,8 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -1701,8 +1746,8 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
CompletableFuture<List<ErrorMessage>> listCompletableFuture = CompletableFuture.supplyAsync(() CompletableFuture<List<ErrorMessage>> listCompletableFuture = CompletableFuture.supplyAsync(()
-> executeImportSocialListThree(user, atomicLine, random, finalTempList1 -> executeImportSocialListThree(user, atomicLine, random, finalTempList1
, areaMap, areaMap2, paymentInfoPensionMap, paymentInfoMedicalMap, , areaMap, areaMap2, paymentInfoPensionMap, paymentInfoMedicalMap,
paymentInfoUnEmpMap, paymentInfoInjuryMap, idx, type, errorMessageList) paymentInfoUnEmpMap, paymentInfoInjuryMap, paymentInfoBigMap,idx, type,
, yfSocialImportThreadPoolExecutor); errorMessageList), yfSocialImportThreadPoolExecutor);
completableFutureList.add(listCompletableFuture); completableFutureList.add(listCompletableFuture);
tempList = new ArrayList<>(); tempList = new ArrayList<>();
} }
...@@ -1728,7 +1773,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -1728,7 +1773,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
CompletableFuture<List<ErrorMessage>> listCompletableFuture = CompletableFuture.supplyAsync(() CompletableFuture<List<ErrorMessage>> listCompletableFuture = CompletableFuture.supplyAsync(()
-> executeImportSocialListThree(user, atomicLine, random, finalTempList, areaMap, -> executeImportSocialListThree(user, atomicLine, random, finalTempList, areaMap,
areaMap2, paymentInfoPensionMap, paymentInfoMedicalMap, paymentInfoUnEmpMap, areaMap2, paymentInfoPensionMap, paymentInfoMedicalMap, paymentInfoUnEmpMap,
paymentInfoInjuryMap, finalLastIdx, type, errorMessageList) paymentInfoInjuryMap, paymentInfoBigMap,finalLastIdx, type, errorMessageList)
, yfSocialImportThreadPoolExecutor); , yfSocialImportThreadPoolExecutor);
completableFutureList.add(listCompletableFuture); completableFutureList.add(listCompletableFuture);
} }
...@@ -1777,6 +1822,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -1777,6 +1822,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
ConcurrentHashMap<String, TPaymentInfo> paymentInfoMedicalMap, ConcurrentHashMap<String, TPaymentInfo> paymentInfoMedicalMap,
ConcurrentHashMap<String, TPaymentInfo> paymentInfoUnEmpMap, ConcurrentHashMap<String, TPaymentInfo> paymentInfoUnEmpMap,
ConcurrentHashMap<String, TPaymentInfo> paymentInfoInjuryMap, ConcurrentHashMap<String, TPaymentInfo> paymentInfoInjuryMap,
ConcurrentHashMap<String, TPaymentInfo> paymentInfoBigMap,
int idx, String type,List<ErrorMessage> errorMessageList) { int idx, String type,List<ErrorMessage> errorMessageList) {
int i = idx; int i = idx;
if (Common.isNotNull(list)) { if (Common.isNotNull(list)) {
...@@ -1929,7 +1975,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -1929,7 +1975,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
//存在社保缴费数据 //存在社保缴费数据
if (null != payExists && BigDecimalUtils.safeMultiply(BigDecimalUtils.safeAdd( if (null != payExists && BigDecimalUtils.safeMultiply(BigDecimalUtils.safeAdd(
BigDecimalUtils.isNullToZero(infoVo.getPersonalMoney()), BigDecimalUtils.isNullToZero(infoVo.getPersonalMoney()),
BigDecimalUtils.isNullToZero(infoVo.getUnitSet())), BigDecimalUtils.safeAdd( BigDecimalUtils.isNullToZero(infoVo.getUnitMoney())), BigDecimalUtils.safeAdd(
BigDecimalUtils.isNullToZero(payExists.getUnitPensionMoney()), BigDecimalUtils.isNullToZero(payExists.getUnitPensionMoney()),
BigDecimalUtils.isNullToZero(payExists.getPersonalPensionMoney()))).compareTo(BigDecimal.ZERO) > 0) { BigDecimalUtils.isNullToZero(payExists.getPersonalPensionMoney()))).compareTo(BigDecimal.ZERO) > 0) {
errorMessageList.add(new ErrorMessage(infoVo.getRowIndex(), "已存在对应员工身份证" + infoVo.getEmpIdcard() errorMessageList.add(new ErrorMessage(infoVo.getRowIndex(), "已存在对应员工身份证" + infoVo.getEmpIdcard()
...@@ -1954,7 +2000,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -1954,7 +2000,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
//存在社保缴费数据 //存在社保缴费数据
if (null != payExists && BigDecimalUtils.safeMultiply(BigDecimalUtils.safeAdd( if (null != payExists && BigDecimalUtils.safeMultiply(BigDecimalUtils.safeAdd(
BigDecimalUtils.isNullToZero(infoVo.getPersonalMoney()), BigDecimalUtils.isNullToZero(infoVo.getPersonalMoney()),
BigDecimalUtils.isNullToZero(infoVo.getUnitSet())), BigDecimalUtils.safeAdd( BigDecimalUtils.isNullToZero(infoVo.getUnitMoney())), BigDecimalUtils.safeAdd(
BigDecimalUtils.isNullToZero(payExists.getUnitUnemploymentMoney()), BigDecimalUtils.isNullToZero(payExists.getUnitUnemploymentMoney()),
BigDecimalUtils.isNullToZero(payExists.getPersonalUnemploymentMoney()))).compareTo(BigDecimal.ZERO) > 0) { BigDecimalUtils.isNullToZero(payExists.getPersonalUnemploymentMoney()))).compareTo(BigDecimal.ZERO) > 0) {
errorMessageList.add(new ErrorMessage(infoVo.getRowIndex(), "已存在对应员工身份证" + infoVo.getEmpIdcard() errorMessageList.add(new ErrorMessage(infoVo.getRowIndex(), "已存在对应员工身份证" + infoVo.getEmpIdcard()
...@@ -2016,6 +2062,32 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -2016,6 +2062,32 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
} }
} }
//判断是否存在医疗救助金缴费数据
if (CommonConstants.ONE_STRING.equals(type)) {
payExists = paymentInfoBigMap.get(infoVo.getSocialPayAddr()
+ CommonConstants.DOWN_LINE_STRING
+ infoVo.getEmpIdcard().trim()
+ CommonConstants.DOWN_LINE_STRING
+ infoVo.getSocialPayMonth().trim()
+ CommonConstants.DOWN_LINE_STRING
+ infoVo.getSocialCreateMonth().trim()
+ CommonConstants.DOWN_LINE_STRING
+ SocialConstants.DB);
//存在社保缴费数据
if (null != payExists && BigDecimalUtils.safeMultiply(BigDecimalUtils.safeAdd(
BigDecimalUtils.isNullToZero(infoVo.getUnitBigailmentMoney()),
BigDecimalUtils.isNullToZero(infoVo.getPersonalBigailmentMoney())), BigDecimalUtils.safeAdd(
BigDecimalUtils.isNullToZero(payExists.getUnitBigmailmentMoney()),
BigDecimalUtils.isNullToZero(payExists.getPersonalBigmailmentMoney()))).compareTo(BigDecimal.ZERO) > 0) {
errorMessageList.add(new ErrorMessage(infoVo.getRowIndex(), "已存在对应员工身份证" + infoVo.getEmpIdcard()
+ "的医疗救助金缴费数据,请勿重复导入!"));
continue;
} else {
payExists = null;
}
}
if (null == payExists) { if (null == payExists) {
payExists = new TPaymentInfo(); payExists = new TPaymentInfo();
payExists.setLockStatus(CommonConstants.ZERO_STRING); payExists.setLockStatus(CommonConstants.ZERO_STRING);
...@@ -2036,8 +2108,6 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -2036,8 +2108,6 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
payExists.setSocialHousehold(socialInfo.getSocialHouseholdName()); payExists.setSocialHousehold(socialInfo.getSocialHouseholdName());
payExists.setSocialPayMonth(infoVo.getSocialPayMonth()); payExists.setSocialPayMonth(infoVo.getSocialPayMonth());
// 同时设置公积金缴纳日期方便导入处理
payExists.setProvidentPayMonth(infoVo.getSocialPayMonth());
if (null != payExists.getSocialProvince()) { if (null != payExists.getSocialProvince()) {
temp = areaMap.get(payExists.getSocialProvince()); temp = areaMap.get(payExists.getSocialProvince());
...@@ -2061,9 +2131,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -2061,9 +2131,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
payExists.setSocialCreateMonth(infoVo.getSocialCreateMonth()); payExists.setSocialCreateMonth(infoVo.getSocialCreateMonth());
if (PaymentConstants.PENSION_RISK.equals(infoVo.getRiskType())) { if (PaymentConstants.PENSION_RISK.equals(infoVo.getRiskType())) {
payExists.setUnitPensionMoney(infoVo.getUnitMoney()); payExists.setUnitPensionMoney(infoVo.getUnitMoney());
payExists.setPersonalPensionMoney(infoVo.getPersonalMoney());
payExists.setUnitPensionSet(infoVo.getUnitSet()); payExists.setUnitPensionSet(infoVo.getUnitSet());
payExists.setUnitPensionMoney(infoVo.getUnitMoney());
payExists.setPersonalPensionMoney(infoVo.getPersonalMoney()); payExists.setPersonalPensionMoney(infoVo.getPersonalMoney());
payExists.setUnitSocialSum(BigDecimalUtils.safeAdd(payExists.getUnitPensionMoney() payExists.setUnitSocialSum(BigDecimalUtils.safeAdd(payExists.getUnitPensionMoney()
, payExists.getUnitSocialSum())); , payExists.getUnitSocialSum()));
...@@ -2071,9 +2139,6 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -2071,9 +2139,6 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
, payExists.getSocialSecurityPersonalSum())); , payExists.getSocialSecurityPersonalSum()));
} }
if (PaymentConstants.UNEMPLOYEEMENT_RISK.equals(infoVo.getRiskType())) { if (PaymentConstants.UNEMPLOYEEMENT_RISK.equals(infoVo.getRiskType())) {
payExists.setUnitUnemploymentMoney(infoVo.getUnitMoney());
payExists.setPersonalUnemploymentMoney(infoVo.getPersonalMoney());
payExists.setUnitUnemploymentSet(infoVo.getUnitSet());
payExists.setUnitUnemploymentMoney(infoVo.getUnitMoney()); payExists.setUnitUnemploymentMoney(infoVo.getUnitMoney());
payExists.setPersonalUnemploymentMoney(infoVo.getPersonalMoney()); payExists.setPersonalUnemploymentMoney(infoVo.getPersonalMoney());
payExists.setUnitUnemploymentSet(infoVo.getUnitSet()); payExists.setUnitUnemploymentSet(infoVo.getUnitSet());
...@@ -2083,8 +2148,6 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -2083,8 +2148,6 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
, payExists.getSocialSecurityPersonalSum())); , payExists.getSocialSecurityPersonalSum()));
} }
if (PaymentConstants.INJURY_RISK.equals(infoVo.getRiskType())) { if (PaymentConstants.INJURY_RISK.equals(infoVo.getRiskType())) {
payExists.setUnitInjuryMoney(infoVo.getUnitMoney());
payExists.setUnitInjurySet(infoVo.getUnitSet());
payExists.setUnitInjuryMoney(infoVo.getUnitMoney()); payExists.setUnitInjuryMoney(infoVo.getUnitMoney());
payExists.setUnitInjurySet(infoVo.getUnitSet()); payExists.setUnitInjurySet(infoVo.getUnitSet());
payExists.setUnitSocialSum(BigDecimalUtils.safeAdd(payExists.getUnitInjuryMoney() payExists.setUnitSocialSum(BigDecimalUtils.safeAdd(payExists.getUnitInjuryMoney()
...@@ -2092,15 +2155,10 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa ...@@ -2092,15 +2155,10 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
} }
if (CommonConstants.ONE_STRING.equals(type)) { if (CommonConstants.ONE_STRING.equals(type)) {
payExists.setUnitMedicalMoney(infoVo.getUnitMedicalMoney()); payExists.setUnitMedicalMoney(infoVo.getUnitMedicalMoney());
payExists.setUnitMedicalSet(infoVo.getMedicalSet());
payExists.setPersonalMedicalMoney(infoVo.getPersonalMedicalMoney()); payExists.setPersonalMedicalMoney(infoVo.getPersonalMedicalMoney());
payExists.setPersonalBigmailmentMoney(infoVo.getPersonalBigailmentMoney());
payExists.setUnitBigmailmentMoney(infoVo.getUnitBigailmentMoney()); payExists.setUnitBigmailmentMoney(infoVo.getUnitBigailmentMoney());
payExists.setUnitMedicalMoney(infoVo.getUnitMedicalMoney());
payExists.setUnitMedicalSet(infoVo.getMedicalSet()); payExists.setUnitMedicalSet(infoVo.getMedicalSet());
payExists.setPersonalMedicalMoney(infoVo.getPersonalMedicalMoney());
payExists.setPersonalBigmailmentMoney(infoVo.getPersonalBigailmentMoney()); payExists.setPersonalBigmailmentMoney(infoVo.getPersonalBigailmentMoney());
payExists.setUnitBigmailmentMoney(infoVo.getUnitBigailmentMoney());
payExists.setSocialSecurityNo(infoVo.getSocialSecurityNo()); payExists.setSocialSecurityNo(infoVo.getSocialSecurityNo());
payExists.setUnitSocialSum(BigDecimalUtils.safeAdd(payExists.getUnitMedicalMoney() payExists.setUnitSocialSum(BigDecimalUtils.safeAdd(payExists.getUnitMedicalMoney()
......
...@@ -641,17 +641,17 @@ public class TPreDispatchInfoServiceImpl extends ServiceImpl<TPreDispatchInfoMap ...@@ -641,17 +641,17 @@ public class TPreDispatchInfoServiceImpl extends ServiceImpl<TPreDispatchInfoMap
@Override @Override
public List<ErrorMessage> batchSavePreDisPatchAdd(List<TPreDispatchInfo> listInfo, YifuUser user, String socialHouse public List<ErrorMessage> batchSavePreDisPatchAdd(List<TPreDispatchInfo> listInfo, YifuUser user, String socialHouse
, String fundHouse, String departId) { , String fundHouse, String departId, List<ErrorMessage> errList) {
List<ErrorMessage> errorList = new ArrayList<>();
R<TSettleDomainSelectVo> domainR = archivesDaprUtil.getSettleDomainSelectVoById(departId); R<TSettleDomainSelectVo> domainR = archivesDaprUtil.getSettleDomainSelectVoById(departId);
// 获取区域数据MAP // 获取区域数据MAP
HashMap<String, SysArea> areaHashMap = new HashMap<>(CommonConstants.SIXTEEN_INT); HashMap<String, SysArea> areaHashMap = new HashMap<>(CommonConstants.SIXTEEN_INT);
HashMap<String, SysArea> areaIdMap = new HashMap<>(CommonConstants.SIXTEEN_INT); HashMap<String, SysArea> areaIdMap = new HashMap<>(CommonConstants.SIXTEEN_INT);
if (dataCheck(listInfo, errorList, areaHashMap, areaIdMap)) { if (dataCheck(listInfo, errList, areaHashMap, areaIdMap)) {
return errorList; return errList;
} }
if (dataCheckDepart(errorList, domainR)) { if (dataCheckDepart(errList, domainR)) {
return errorList; return errList;
} }
TSettleDomainSelectVo selectVo = domainR.getData(); TSettleDomainSelectVo selectVo = domainR.getData();
// 获取基数配置信息 // 获取基数配置信息
...@@ -671,11 +671,11 @@ public class TPreDispatchInfoServiceImpl extends ServiceImpl<TPreDispatchInfoMap ...@@ -671,11 +671,11 @@ public class TPreDispatchInfoServiceImpl extends ServiceImpl<TPreDispatchInfoMap
i++; i++;
if (Common.isNotNull(info.getTelNotice()) && (!CommonConstants.IS_TRUE.equals(info.getTelNotice()) && if (Common.isNotNull(info.getTelNotice()) && (!CommonConstants.IS_TRUE.equals(info.getTelNotice()) &&
!CommonConstants.IS_FALSE.equals(info.getTelNotice()))) { !CommonConstants.IS_FALSE.equals(info.getTelNotice()))) {
errorList.add(new ErrorMessage(i,"是否电话通知不允许导入【是】和【否】之外的内容")); errList.add(new ErrorMessage(i,"是否电话通知不允许导入【是】和【否】之外的内容"));
continue; continue;
} }
// 1.验重 // 1.验重
if (checkAddRepeat(errorList, existsMap, i, info)) { if (checkAddRepeat(errList, existsMap, i, info)) {
continue; continue;
} }
// 基础封装 其他 // 基础封装 其他
...@@ -698,11 +698,22 @@ public class TPreDispatchInfoServiceImpl extends ServiceImpl<TPreDispatchInfoMap ...@@ -698,11 +698,22 @@ public class TPreDispatchInfoServiceImpl extends ServiceImpl<TPreDispatchInfoMap
if (!Common.isEmpty(info.getExceptionContent())) { if (!Common.isEmpty(info.getExceptionContent())) {
info.setPreStatus(CommonConstants.ONE_STRING); info.setPreStatus(CommonConstants.ONE_STRING);
} }
baseMapper.insert(info); int finalI = i;
if (!errList.stream().anyMatch(e-> hasError(e, finalI))) {
baseMapper.insert(info);
}
} }
return errorList; return errList;
} }
public Boolean hasError(ErrorMessage errorMessage, int i) {
if (Common.isNotNull(errorMessage.getMessage()) && errorMessage.getLineNum() == i) {
return true;
}
return false;
}
/** /**
* 预派单批量新增派减 * 预派单批量新增派减
* @param list * @param list
...@@ -713,9 +724,8 @@ public class TPreDispatchInfoServiceImpl extends ServiceImpl<TPreDispatchInfoMap ...@@ -713,9 +724,8 @@ public class TPreDispatchInfoServiceImpl extends ServiceImpl<TPreDispatchInfoMap
**/ **/
@Transactional @Transactional
@Override @Override
public List<ErrorMessage> batchSavePreDisPatchReduce(List<TPreDispatchReduceVo> list, YifuUser user) { public List<ErrorMessage> batchSavePreDisPatchReduce(List<TPreDispatchReduceVo> list, YifuUser user,
List<ErrorMessage> errorList) {
List<ErrorMessage> errorList = new ArrayList<>();
// 获取区域数据MAP // 获取区域数据MAP
HashMap<String, SysArea> areaIdMap = new HashMap<>(CommonConstants.SIXTEEN_INT); HashMap<String, SysArea> areaIdMap = new HashMap<>(CommonConstants.SIXTEEN_INT);
HashMap<String, SysArea> areaHashMap = new HashMap<>(CommonConstants.SIXTEEN_INT); HashMap<String, SysArea> areaHashMap = new HashMap<>(CommonConstants.SIXTEEN_INT);
...@@ -768,7 +778,10 @@ public class TPreDispatchInfoServiceImpl extends ServiceImpl<TPreDispatchInfoMap ...@@ -768,7 +778,10 @@ public class TPreDispatchInfoServiceImpl extends ServiceImpl<TPreDispatchInfoMap
if (!Common.isEmpty(info.getExceptionContent())) { if (!Common.isEmpty(info.getExceptionContent())) {
info.setPreStatus(CommonConstants.ONE_STRING); info.setPreStatus(CommonConstants.ONE_STRING);
} }
baseMapper.insert(info); int finalI = i;
if (!errorList.stream().anyMatch(e-> hasError(e, finalI))) {
baseMapper.insert(info);
}
} }
return errorList; return errorList;
} }
...@@ -782,8 +795,8 @@ public class TPreDispatchInfoServiceImpl extends ServiceImpl<TPreDispatchInfoMap ...@@ -782,8 +795,8 @@ public class TPreDispatchInfoServiceImpl extends ServiceImpl<TPreDispatchInfoMap
* @return * @return
**/ **/
@Override @Override
public List<ErrorMessage> batchUpdatePreDisPatch(List<TPreDispatchUpdateVo> list, YifuUser user) { public List<ErrorMessage> batchUpdatePreDisPatch(List<TPreDispatchUpdateVo> list, YifuUser user,
List<ErrorMessage> errorList = new ArrayList<>(); List<ErrorMessage> errorList) {
// 获取区域数据MAP // 获取区域数据MAP
HashMap<String, SysArea> areaHashMap = new HashMap<>(CommonConstants.SIXTEEN_INT); HashMap<String, SysArea> areaHashMap = new HashMap<>(CommonConstants.SIXTEEN_INT);
HashMap<String,SysArea> areaIdMap = new HashMap<>(CommonConstants.SIXTEEN_INT); HashMap<String,SysArea> areaIdMap = new HashMap<>(CommonConstants.SIXTEEN_INT);
...@@ -808,40 +821,43 @@ public class TPreDispatchInfoServiceImpl extends ServiceImpl<TPreDispatchInfoMap ...@@ -808,40 +821,43 @@ public class TPreDispatchInfoServiceImpl extends ServiceImpl<TPreDispatchInfoMap
TPreDispatchInfo repeat = null; TPreDispatchInfo repeat = null;
int i=1; int i=1;
String str = null; String str = null;
for (TPreDispatchInfo info:listInfo){ for (TPreDispatchInfo info:listInfo) {
i++; i++;
if (Common.isNotNull(info.getTelNotice()) && (!CommonConstants.IS_TRUE.equals(info.getTelNotice()) && if (Common.isNotNull(info.getTelNotice()) && (!CommonConstants.IS_TRUE.equals(info.getTelNotice()) &&
!CommonConstants.IS_FALSE.equals(info.getTelNotice()))) { !CommonConstants.IS_FALSE.equals(info.getTelNotice()))) {
errorList.add(new ErrorMessage(i,"是否电话通知不允许导入【是】和【否】之外的内容")); errorList.add(new ErrorMessage(i, "是否电话通知不允许导入【是】和【否】之外的内容"));
continue; continue;
} }
// 重置异常状态 // 重置异常状态
info.setExceptionContent(""); info.setExceptionContent("");
info.setPreStatus(CommonConstants.ZERO_STRING); info.setPreStatus(CommonConstants.ZERO_STRING);
temp = existsMap.get(info.getId()); temp = existsMap.get(info.getId());
repeat = repeatMap.get(info.getEmpIdcard()+CommonConstants.DOWN_LINE_STRING+info.getPayAddress()); repeat = repeatMap.get(info.getEmpIdcard() + CommonConstants.DOWN_LINE_STRING + info.getPayAddress());
// 判重 及身份证不可更新 // 判重 及身份证不可更新
if (checkRepeatOrIdcard(errorList, temp, i+1, info,repeat)) { if (checkRepeatOrIdcard(errorList, temp, i + 1, info, repeat)) {
continue; continue;
} }
// 验证派单类型 // 验证派单类型
checkDispatchType(info); checkDispatchType(info);
// 1.先校验已有数据 // 1.先校验已有数据
str = checkBatchSave(info,info.getType()); str = checkBatchSave(info, info.getType());
if (null != str) { if (null != str) {
info.setPreStatus(CommonConstants.ONE_STRING); info.setPreStatus(CommonConstants.ONE_STRING);
info.setExceptionContent(str); info.setExceptionContent(str);
} }
// 2.封装 社保缴纳地 公积金缴纳地 // 2.封装 社保缴纳地 公积金缴纳地
initBatchUpdateArea(areaHashMap, areaIdMap, info); initBatchUpdateArea(areaHashMap, areaIdMap, info);
if (Common.isEmpty(info.getExceptionContent())){ if (Common.isEmpty(info.getExceptionContent())) {
// 3.验证补缴时间是否异常 派增验证 派减日期不处理 // 3.验证补缴时间是否异常 派增验证 派减日期不处理
checkStartTime(baseSocialSetMap, baseFundSetMap, temp, info); checkStartTime(baseSocialSetMap, baseFundSetMap, temp, info);
} }
// 4.如果派增缴纳地有变更重新变更派单限制日期 // 4.如果派增缴纳地有变更重新变更派单限制日期
initDayLimitForUpdate(dayConfMap, temp, info); initDayLimitForUpdate(dayConfMap, temp, info);
// 5.更新 // 5.更新
updateInfoByIdSub(errorList, temp, i, info); int finalI = i;
if (!errorList.stream().anyMatch(e-> hasError(e, finalI))) {
updateInfoByIdSub(errorList, temp, i, info);
}
} }
return errorList; return errorList;
} }
......
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