个税对接,个税申报接口

This commit is contained in:
钱涛 2023-08-11 14:20:14 +08:00
parent 50658012a1
commit dc63897165
47 changed files with 2325 additions and 994 deletions

View File

@ -7,8 +7,8 @@ create table hrsa_tax_declare_record
delete_type int default 0, delete_type int default 0,
tenant_key varchar2(10), tenant_key varchar2(10),
tax_agent_id number, tax_agent_id number,
salary_month varchar2(10), salary_month date,
tax_cycle varchar2(10), tax_cycle date,
remark varchar2(1000), remark varchar2(1000),
request_id varchar2(100), request_id varchar2(100),
tax_declare_type number, tax_declare_type number,

View File

@ -7,8 +7,8 @@ create table hrsa_tax_declare_record
delete_type int default 0, delete_type int default 0,
tenant_key varchar2(10), tenant_key varchar2(10),
tax_agent_id number, tax_agent_id number,
salary_month varchar2(10), salary_month date,
tax_cycle varchar2(10), tax_cycle date,
remark varchar2(1000), remark varchar2(1000),
request_id varchar2(100), request_id varchar2(100),
tax_declare_type number, tax_declare_type number,

View File

@ -7,8 +7,8 @@ create table hrsa_tax_declare_record
delete_type int default 0, delete_type int default 0,
tenant_key varchar2(10), tenant_key varchar2(10),
tax_agent_id number, tax_agent_id number,
salary_month varchar2(10), salary_month date,
tax_cycle varchar2(10), tax_cycle date,
remark varchar2(1000), remark varchar2(1000),
request_id varchar2(100), request_id varchar2(100),
tax_declare_type number, tax_declare_type number,

View File

@ -7,8 +7,8 @@ create table hrsa_tax_declare_record
delete_type int default 0 comment '是否删除' , delete_type int default 0 comment '是否删除' ,
tenant_key varchar(10) comment '租户KEY' , tenant_key varchar(10) comment '租户KEY' ,
tax_agent_id bigint comment '个税扣缴义务人id' , tax_agent_id bigint comment '个税扣缴义务人id' ,
salary_month varchar(10) comment '薪资所属月' , salary_month datetime comment '薪资所属月' ,
tax_cycle varchar(10) comment '税款所属期' , tax_cycle datetime comment '税款所属期' ,
remark varchar(1000) comment '备注' , remark varchar(1000) comment '备注' ,
request_id varchar(100) comment '供应商第三方系统返回的requestid' , request_id varchar(100) comment '供应商第三方系统返回的requestid' ,
tax_declare_type tinyint comment '申报类型' , tax_declare_type tinyint comment '申报类型' ,

View File

@ -7,8 +7,8 @@ create table hrsa_tax_declare_record
delete_type int default 0, delete_type int default 0,
tenant_key varchar2(10), tenant_key varchar2(10),
tax_agent_id number, tax_agent_id number,
salary_month varchar2(10), salary_month date,
tax_cycle varchar2(10), tax_cycle date,
remark varchar2(1000), remark varchar2(1000),
request_id varchar2(100), request_id varchar2(100),
tax_declare_type number, tax_declare_type number,

View File

@ -7,8 +7,8 @@ create table hrsa_tax_declare_record
delete_type int default 0, delete_type int default 0,
tenant_key varchar(10), tenant_key varchar(10),
tax_agent_id bigint, tax_agent_id bigint,
salary_month varchar(10), salary_month timestamp,
tax_cycle varchar(10), tax_cycle timestamp,
remark varchar(1000), remark varchar(1000),
request_id varchar(100), request_id varchar(100),
tax_declare_type smallint, tax_declare_type smallint,

View File

@ -7,8 +7,8 @@ create table hrsa_tax_declare_record
delete_type int default 0, delete_type int default 0,
tenant_key nvarchar(10), tenant_key nvarchar(10),
tax_agent_id bigint, tax_agent_id bigint,
salary_month nvarchar(10), salary_month datetime,
tax_cycle nvarchar(10), tax_cycle datetime,
remark nvarchar(1000), remark nvarchar(1000),
request_id nvarchar(100), request_id nvarchar(100),
tax_declare_type tinyint, tax_declare_type tinyint,

View File

@ -7,8 +7,8 @@ create table hrsa_tax_declare_record
delete_type int default 0, delete_type int default 0,
tenant_key varchar2(10), tenant_key varchar2(10),
tax_agent_id number, tax_agent_id number,
salary_month varchar2(10), salary_month date,
tax_cycle varchar2(10), tax_cycle date,
remark varchar2(1000), remark varchar2(1000),
request_id varchar2(100), request_id varchar2(100),
tax_declare_type number, tax_declare_type number,

View File

@ -0,0 +1,28 @@
package com.engine.salary.common;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;
import lombok.experimental.Accessors;
import java.util.Date;
/**
* @description: 月份范围
* @author: xiajun
* @modified By: xiajun
* @date: Created in 2022/11/22 1:53 PM
* @version:v1.0
*/
@Data
@Accessors(chain = true)
public class YearMonthRange {
//开始月份
@JsonSerialize(using = ToStringSerializer.class)
private Date startMonth;
//开始月份
@JsonSerialize(using = ToStringSerializer.class)
private Date endMonth;
}

View File

@ -7,6 +7,7 @@ import com.engine.salary.util.valid.DataCheck;
import lombok.*; import lombok.*;
import java.util.Collection; import java.util.Collection;
import java.util.Date;
import java.util.List; import java.util.List;
/** /**
@ -31,8 +32,14 @@ public class SalaryAcctEmployeeQueryParam extends BaseQueryParam {
//人员姓名") //人员姓名")
private String employeeName; private String employeeName;
/**
* 税款所属期
*/
private Date taxCycle;
//个税扣缴义务人") //个税扣缴义务人")
private Long taxAgentId; private Long taxAgentId;
private List<Long> taxAgentIds;
//分部 //分部
private List<Long> subcompanyIds; private List<Long> subcompanyIds;
@ -48,8 +55,8 @@ public class SalaryAcctEmployeeQueryParam extends BaseQueryParam {
* 状态 * 状态
* @see SalaryEmployeeStatusEnum * @see SalaryEmployeeStatusEnum
*/ */
private SalaryEmployeeStatusEnum status; private SalaryEmployeeStatusEnum status;
//状态(多选) //状态(多选)
private List<String> statuses; private List<String> statuses;

View File

@ -69,6 +69,11 @@ public class SalaryAcctEmployeePO {
@SalaryFormulaVar(defaultLabel = "薪资所属月", labelId = 86321, dataType = "string") @SalaryFormulaVar(defaultLabel = "薪资所属月", labelId = 86321, dataType = "string")
private Date salaryMonth; private Date salaryMonth;
/**
* 税款所属期
*/
private Date taxCycle;
/** /**
* 租户key * 租户key
*/ */

View File

@ -0,0 +1,75 @@
package com.engine.salary.entity.salaryacct.po;
import lombok.Data;
import lombok.experimental.Accessors;
import java.time.LocalDateTime;
import java.util.Date;
/**
* @description: 薪资核算记录对应的个税扣缴义务人
* @author: xiajun
* @modified By: xiajun
* @date: 2022/7/29 9:40
* @version:v1.0
*/
@Data
@Accessors(chain = true)
// "hrsa_acct_tax_agent")
public class SalaryAcctTaxAgentPO {
/**
* 主键id
*/
private Long id;
/**
* 薪资核算记录的id
*/
private Long salaryAcctRecordId;
/**
* 收入所得项目
*/
private Integer incomeCategory;
/**
* 个税扣缴义务人的id
*/
private Long taxAgentId;
/**
* 薪资所属月
*/
private Date salaryMonth;
/**
* 税款所属期
*/
private Date taxCycle;
/**
* 租户key
*/
private String tenantKey;
/**
* 创建人id
*/
private Long creator;
/**
* 是否删除
*/
private Integer deleteType;
/**
* 创建时间
*/
private LocalDateTime createTime;
/**
* 更新时间
*/
private LocalDateTime updateTime;
}

View File

@ -1,88 +1,86 @@
//package com.engine.salary.entity.taxdeclaration.bo; package com.engine.salary.entity.taxdeclaration.bo;
//
//import com.engine.salary.entity.taxdeclaration.dto.AbnormalEmployeeListDTO; import com.engine.salary.entity.datacollection.DataCollectionEmployee;
//import com.engine.salary.entity.taxdeclaration.po.TaxDeclareEmployeePO; import com.engine.salary.entity.employeedeclare.po.EmployeeDeclarePO;
//import com.google.common.collect.Lists; import com.engine.salary.entity.extemp.po.ExtEmpPO;
//import com.weaver.hrm.salary.entity.employeedeclare.po.EmployeeDeclarePO; import com.engine.salary.entity.taxdeclaration.dto.AbnormalEmployeeListDTO;
//import com.weaver.hrm.salary.entity.extemployee.po.ExtEmployeePO; import com.engine.salary.entity.taxdeclaration.po.TaxDeclareEmployeePO;
//import com.weaver.hrm.salary.enums.employeedeclare.CardTypeEnum; import com.engine.salary.enums.employeedeclare.CardTypeEnum;
//import com.weaver.hrm.salary.enums.employeedeclare.DeclareStatusEnum; import com.engine.salary.enums.employeedeclare.DeclareStatusEnum;
//import com.weaver.hrm.salary.enums.salaryaccounting.EmployeeTypeEnum; import com.engine.salary.enums.salaryaccounting.EmployeeTypeEnum;
//import com.weaver.hrm.salary.util.SalaryEntityUtil; import com.engine.salary.util.SalaryEntityUtil;
//import com.weaver.hrm.salary.util.SalaryEnumUtil; import com.engine.salary.util.SalaryEnumUtil;
//import com.weaver.hrm.salary.util.SalaryI18nUtil; import com.engine.salary.util.SalaryI18nUtil;
//import com.weaver.teams.domain.hr.SimpleUserInfo; import com.google.common.collect.Lists;
//import com.weaver.teams.domain.user.SimpleEmployee; import org.apache.commons.collections4.CollectionUtils;
//import org.apache.commons.collections4.CollectionUtils;
// import java.util.Collections;
//import java.util.Collections; import java.util.List;
//import java.util.List; import java.util.Map;
//import java.util.Map; import java.util.Objects;
//import java.util.Objects; import java.util.function.Function;
//import java.util.function.Function; import java.util.stream.Collectors;
//import java.util.stream.Collectors;
// /**
///** * @description: 个税申报明细表中的人员
// * @description: 个税申报明细表中的人员 * @author: xiajun
// * @author: xiajun * @modified By: xiajun
// * @modified By: xiajun * @date: Created in 2022/11/10 4:20 PM
// * @date: Created in 2022/11/10 4:20 PM * @version:v1.0
// * @version:v1.0 */
// */ public class TaxDeclareEmployeeBO {
//public class TaxDeclareEmployeeBO {
// public static List<AbnormalEmployeeListDTO> convert2AbnormalEmployee(List<TaxDeclareEmployeePO> taxDeclareEmployees,
// public static List<AbnormalEmployeeListDTO> convert2AbnormalEmployee(List<TaxDeclareEmployeePO> taxDeclareEmployees, List<EmployeeDeclarePO> employeeDeclares,
// List<EmployeeDeclarePO> employeeDeclares, List<DataCollectionEmployee> simpleEmployees,
// List<SimpleEmployee> simpleEmployees, List<DataCollectionEmployee> simpleUserInfos,
// List<SimpleUserInfo> simpleUserInfos, List<ExtEmpPO> extEmployees) {
// List<ExtEmployeePO> extEmployees) { if (CollectionUtils.isEmpty(taxDeclareEmployees)) {
// if (CollectionUtils.isEmpty(taxDeclareEmployees)) { return Collections.emptyList();
// return Collections.emptyList(); }
// } List<AbnormalEmployeeListDTO> abnormalEmployeeList = Lists.newArrayList();
// List<AbnormalEmployeeListDTO> abnormalEmployeeList = Lists.newArrayList(); Map<Long, EmployeeDeclarePO> employeeDeclareMap = SalaryEntityUtil.convert2Map(employeeDeclares, EmployeeDeclarePO::getEmployeeId);
// Map<Long, EmployeeDeclarePO> employeeDeclareMap = SalaryEntityUtil.convert2Map(employeeDeclares, EmployeeDeclarePO::getEmployeeId); Map<Long, DataCollectionEmployee> simpleEmployeeMap = SalaryEntityUtil.convert2Map(simpleEmployees, DataCollectionEmployee::getEmployeeId);
// Map<Long, SimpleEmployee> simpleEmployeeMap = SalaryEntityUtil.convert2Map(simpleEmployees, SimpleEmployee::getEmployeeId); Map<Long, DataCollectionEmployee> simpleUserInfoMap = simpleUserInfos.stream()
// Map<Long, SimpleUserInfo> simpleUserInfoMap = simpleUserInfos.stream() .collect(Collectors.toMap(DataCollectionEmployee::getEmployeeId, Function.identity(), (a, b) -> a));
// .filter(simpleUserInfo -> Objects.nonNull(simpleUserInfo) && Objects.nonNull(simpleUserInfo.getUser())) Map<Long, ExtEmpPO> extEmployeePOMap = SalaryEntityUtil.convert2Map(extEmployees, ExtEmpPO::getId);
// .collect(Collectors.toMap(simpleUserInfo -> simpleUserInfo.getUser().getId(), Function.identity(), (a, b) -> a)); for (TaxDeclareEmployeePO taxDeclareEmployee : taxDeclareEmployees) {
// Map<Long, ExtEmployeePO> extEmployeePOMap = SalaryEntityUtil.convert2Map(extEmployees, ExtEmployeePO::getId); AbnormalEmployeeListDTO abnormalEmployeeListDTO = new AbnormalEmployeeListDTO()
// for (TaxDeclareEmployeePO taxDeclareEmployee : taxDeclareEmployees) { .setId(taxDeclareEmployee.getEmployeeId())
// AbnormalEmployeeListDTO abnormalEmployeeListDTO = new AbnormalEmployeeListDTO() .setEmployeeId(taxDeclareEmployee.getEmployeeId())
// .setId(taxDeclareEmployee.getEmployeeId()) .setEmployeeType(taxDeclareEmployee.getEmployeeType());
// .setEmployeeId(taxDeclareEmployee.getEmployeeId()) EmployeeDeclarePO employeeDeclare = employeeDeclareMap.get(taxDeclareEmployee.getEmployeeId());
// .setEmployeeType(taxDeclareEmployee.getEmployeeType()); if (employeeDeclare != null) {
// EmployeeDeclarePO employeeDeclare = employeeDeclareMap.get(taxDeclareEmployee.getEmployeeId()); DeclareStatusEnum declareStatusEnum = SalaryEnumUtil.enumMatchByValue(employeeDeclare.getDeclareStatus(), DeclareStatusEnum.class);
// if (employeeDeclare != null) { abnormalEmployeeListDTO
// DeclareStatusEnum declareStatusEnum = SalaryEnumUtil.enumMatchByValue(employeeDeclare.getDeclareStatus(), DeclareStatusEnum.class); .setEmployeeName(employeeDeclare.getEmployeeName())
// abnormalEmployeeListDTO .setJobNum(employeeDeclare.getJobNum())
// .setEmployeeName(employeeDeclare.getEmployeeName()) .setCardType(SalaryI18nUtil.getI18nLabel(CardTypeEnum.RESIDENT_IDENTITY_CARDS.getLabelId(), CardTypeEnum.RESIDENT_IDENTITY_CARDS.getDefaultLabel()))
// .setJobNum(employeeDeclare.getJobNum()) .setCardNum(employeeDeclare.getCardNum())
// .setCardType(SalaryI18nUtil.getI18nLabel(CardTypeEnum.RESIDENT_IDENTITY_CARDS.getLabelId(), CardTypeEnum.RESIDENT_IDENTITY_CARDS.getDefaultLabel())) .setDeclareStatus(declareStatusEnum)
// .setCardNum(employeeDeclare.getCardNum()) .setDeclareStatusDesc(declareStatusEnum == null ? "" : SalaryI18nUtil.getI18nLabel(declareStatusEnum.getLabelId(), declareStatusEnum.getDefaultLabel()));
// .setDeclareStatus(declareStatusEnum) } else if (Objects.equals(taxDeclareEmployee.getEmployeeType(), EmployeeTypeEnum.ORGANIZATION.getValue())) {
// .setDeclareStatusDesc(declareStatusEnum == null ? "" : SalaryI18nUtil.getI18nLabel(declareStatusEnum.getLabelId(), declareStatusEnum.getDefaultLabel())); DataCollectionEmployee simpleEmployee = simpleEmployeeMap.get(taxDeclareEmployee.getEmployeeId());
// } else if (Objects.equals(taxDeclareEmployee.getEmployeeType(), EmployeeTypeEnum.ORGANIZATION.getValue())) { DataCollectionEmployee simpleUserInfo = simpleUserInfoMap.get(taxDeclareEmployee.getEmployeeId());
// SimpleEmployee simpleEmployee = simpleEmployeeMap.get(taxDeclareEmployee.getEmployeeId()); abnormalEmployeeListDTO
// SimpleUserInfo simpleUserInfo = simpleUserInfoMap.get(taxDeclareEmployee.getEmployeeId()); .setEmployeeName(simpleEmployee.getUsername())
// abnormalEmployeeListDTO .setJobNum(simpleEmployee.getWorkcode())
// .setEmployeeName(simpleEmployee.getUsername()) .setCardType(SalaryI18nUtil.getI18nLabel(CardTypeEnum.RESIDENT_IDENTITY_CARDS.getLabelId(), CardTypeEnum.RESIDENT_IDENTITY_CARDS.getDefaultLabel()))
// .setJobNum(simpleEmployee.getJobNum()) .setCardNum(simpleUserInfo == null ? "" : simpleUserInfo.getIdNo())
// .setCardType(SalaryI18nUtil.getI18nLabel(CardTypeEnum.RESIDENT_IDENTITY_CARDS.getLabelId(), CardTypeEnum.RESIDENT_IDENTITY_CARDS.getDefaultLabel())) .setDeclareStatus(null)
// .setCardNum(simpleUserInfo == null ? "" : simpleUserInfo.getIdNo()) .setDeclareStatusDesc(SalaryI18nUtil.getI18nLabel(177863, "报送人员列表中无此人员"));
// .setDeclareStatus(null) } else {
// .setDeclareStatusDesc(SalaryI18nUtil.getI18nLabel(177863, "报送人员列表中无此人员")); ExtEmpPO extEmployee = extEmployeePOMap.get(taxDeclareEmployee.getEmployeeId());
// } else { abnormalEmployeeListDTO
// ExtEmployeePO extEmployee = extEmployeePOMap.get(taxDeclareEmployee.getEmployeeId()); .setEmployeeName(extEmployee.getUsername())
// abnormalEmployeeListDTO .setJobNum("")
// .setEmployeeName(extEmployee.getUsername()) .setCardType(SalaryI18nUtil.getI18nLabel(CardTypeEnum.RESIDENT_IDENTITY_CARDS.getLabelId(), CardTypeEnum.RESIDENT_IDENTITY_CARDS.getDefaultLabel()))
// .setJobNum("") .setCardNum(extEmployee.getIdNo())
// .setCardType(SalaryI18nUtil.getI18nLabel(CardTypeEnum.RESIDENT_IDENTITY_CARDS.getLabelId(), CardTypeEnum.RESIDENT_IDENTITY_CARDS.getDefaultLabel())) .setDeclareStatus(null)
// .setCardNum(extEmployee.getCardNum()) .setDeclareStatusDesc(SalaryI18nUtil.getI18nLabel(177863, "报送人员列表中无此人员"));
// .setDeclareStatus(null) }
// .setDeclareStatusDesc(SalaryI18nUtil.getI18nLabel(177863, "报送人员列表中无此人员")); abnormalEmployeeList.add(abnormalEmployeeListDTO);
// } }
// abnormalEmployeeList.add(abnormalEmployeeListDTO); return abnormalEmployeeList;
// } }
// return abnormalEmployeeList; }
// }
//}

View File

@ -1,13 +1,16 @@
package com.engine.salary.entity.taxdeclaration.dto; package com.engine.salary.entity.taxdeclaration.dto;
import com.engine.salary.enums.taxdeclaration.TaxDeclareStatusEnum;
import com.engine.salary.enums.taxdeclaration.TaxDeclareTypeEnum;
import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import java.time.YearMonth; import java.util.Date;
/** /**
* @description: 个税申报表信息 * @description: 个税申报表信息
@ -22,13 +25,46 @@ import java.time.YearMonth;
@AllArgsConstructor @AllArgsConstructor
public class TaxDeclarationInfoDTO { public class TaxDeclarationInfoDTO {
//薪资所属月")
@JsonSerialize(using = ToStringSerializer.class)
private YearMonth salaryMonth;
//个税扣缴义务人id") @ApiModelProperty("薪资所属月")
@JsonSerialize(using = ToStringSerializer.class)
private Date salaryMonth;
@ApiModelProperty("税款所属期")
@JsonSerialize(using = ToStringSerializer.class)
private Date taxCycle;
@ApiModelProperty("个税扣缴义务人id")
@JsonSerialize(using = ToStringSerializer.class)
private Long taxAgentId; private Long taxAgentId;
//个税扣缴义务人名称") @ApiModelProperty("个税扣缴义务人名称")
private String taxAgentName; private String taxAgentName;
@ApiModelProperty("申报类型")
private TaxDeclareTypeEnum declareType;
@ApiModelProperty("申报类型描述")
private String declareTypeDesc;
@ApiModelProperty("申报状态")
private TaxDeclareStatusEnum declareStatus;
@ApiModelProperty("申报状态描述")
private String declareStatusDesc;
@ApiModelProperty("申报失败的错误信息")
private String declareErrorMsg;
@ApiModelProperty("是否展示图标")
private boolean displayIcon;
@ApiModelProperty("申报失败的人数")
private Integer declareFailSize;
@ApiModelProperty("校验异常的人数")
private Integer abnormalSize;
@ApiModelProperty("已缴金额")
private String taxPaidAmount;
} }

View File

@ -4,10 +4,11 @@ import com.engine.salary.enums.taxdeclaration.TaxDeclareStatusEnum;
import com.engine.salary.enums.taxdeclaration.TaxDeclareTypeEnum; import com.engine.salary.enums.taxdeclaration.TaxDeclareTypeEnum;
import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import java.util.Date;
/** /**
* @description: 个税申报记录列表 * @description: 个税申报记录列表
* @author: xiajun * @author: xiajun
@ -30,10 +31,10 @@ public class TaxDeclareRecordListDTO {
private String taxAgentName; private String taxAgentName;
//薪资所属月") //薪资所属月")
private String salaryMonth; private Date salaryMonth;
//税款所属期") //税款所属期")
private String taxCycle; private Date taxCycle;
//申报类型") //申报类型")
private TaxDeclareTypeEnum taxDeclareType; private TaxDeclareTypeEnum taxDeclareType;

View File

@ -2,10 +2,11 @@ package com.engine.salary.entity.taxdeclaration.param;
import com.engine.salary.common.BaseQueryParam; import com.engine.salary.common.BaseQueryParam;
import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import java.util.Date;
/** /**
* @description: 个税申报-异常数据-未报送人员列表 * @description: 个税申报-异常数据-未报送人员列表
* @author: xiajun * @author: xiajun
@ -29,5 +30,5 @@ public class AbnormalEmployeeListQueryParam extends BaseQueryParam {
@JsonIgnore @JsonIgnore
//税款所属期") //税款所属期")
private String taxCycle; private Date taxCycle;
} }

View File

@ -1,7 +1,10 @@
package com.engine.salary.entity.taxdeclaration.param; package com.engine.salary.entity.taxdeclaration.param;
import com.engine.salary.common.BaseQueryParam; import com.engine.salary.common.BaseQueryParam;
import lombok.*; import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.time.YearMonth; import java.time.YearMonth;
@ -28,4 +31,7 @@ public class TaxDeclarationListQueryParam extends BaseQueryParam {
private String fromSalaryMonthStr; private String fromSalaryMonthStr;
private String endSalaryMonthStr; private String endSalaryMonthStr;
//个税扣缴义务人菜单")
private String taxAgentName;
} }

View File

@ -82,6 +82,12 @@ public class TaxDeclarationPO {
*/ */
private Date updateTime; private Date updateTime;
/**
* 查看控制
*/
private Integer controlView;
//税款所属期 //税款所属期
LocalDateRange salaryMonths; LocalDateRange salaryMonths;

View File

@ -1,9 +1,13 @@
package com.engine.salary.entity.taxdeclaration.po; package com.engine.salary.entity.taxdeclaration.po;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import java.io.Serializable; import java.io.Serializable;
import java.util.Collection;
import java.util.Date; import java.util.Date;
/** /**
@ -15,6 +19,9 @@ import java.util.Date;
*/ */
@Data @Data
@Accessors(chain = true) @Accessors(chain = true)
@Builder
@AllArgsConstructor
@NoArgsConstructor
//hrsa_tax_declare_record") //hrsa_tax_declare_record")
//个税申报记录") //个税申报记录")
public class TaxDeclareRecordPO implements Serializable { public class TaxDeclareRecordPO implements Serializable {
@ -23,89 +30,82 @@ public class TaxDeclareRecordPO implements Serializable {
/** /**
* 主键id * 主键id
*/ */
//主键id")
private Long id; private Long id;
/** /**
* 个税扣缴义务人id * 个税扣缴义务人id
*/ */
//个税扣缴义务人")
private Long taxAgentId; private Long taxAgentId;
/** /**
* 薪资所属月 * 薪资所属月
*/ */
//薪资所属月") private Date salaryMonth;
private String salaryMonth;
/** /**
* 税款所属期 * 税款所属期
*/ */
//税款所属期") private Date taxCycle;
private String taxCycle;
/** /**
* 申报类型 * 申报类型
*/ */
//申报类型")
private Integer taxDeclareType; private Integer taxDeclareType;
/** /**
* 申报状态 * 申报状态
*/ */
//申报状态")
private Integer taxDeclareStatus; private Integer taxDeclareStatus;
/** /**
* 申报失败的错误信息 * 申报失败的错误信息
*/ */
//申报失败的错误信息")
private String taxDeclareErrorMsg; private String taxDeclareErrorMsg;
/** /**
* 请求的requestId * 请求的requestId
*/ */
//请求的requestId")
private String requestId; private String requestId;
/** /**
* 备注 * 备注
*/ */
//备注")
private String remark; private String remark;
//应缴金额") //应缴金额
private String taxPayAmount; private String taxPayAmount;
//实缴总额") //实缴总额
private String taxPaidAmount; private String taxPaidAmount;
//实缴税额不含滞纳金等") //实缴税额不含滞纳金等
private String taxPurePaidAmount; private String taxPurePaidAmount;
//申报人数") //申报人数
private Integer personNum; private Integer personNum;
/** /**
* 个税申报表的待刷新数据的标识 * 个税申报表的待刷新数据的标识
*/ */
//个税申报表的待刷新数据的标识")
private Integer displayUpdateIcon; private Integer displayUpdateIcon;
/** /**
* 租户key * 租户key
*/ */
//租户key", ignore = true)
private String tenantKey; private String tenantKey;
/** /**
* 创建人id * 创建人id
*/ */
//创建人id", ignore = true)
private Long creator; private Long creator;
/** /**
* 是否删除 * 是否删除
*/ */
//是否删除", ignore = true)
private Integer deleteType; private Integer deleteType;
/** /**
* 创建时间 * 创建时间
*/ */
//创建时间", ignore = true)
private Date createTime; private Date createTime;
/** /**
* 更新时间 * 更新时间
*/ */
//更新时间", ignore = true)
private Date updateTime; private Date updateTime;
private Collection<Long> ids;
private Collection<Long> taxAgentIds;
private Date startDate;
private Date endDate;
private Date salaryMonthStartDate;
private Date salaryMonthEndDate;
} }

View File

@ -2,6 +2,7 @@ package com.engine.salary.mapper.salaryacct;
import com.engine.salary.common.LocalDateRange; import com.engine.salary.common.LocalDateRange;
import com.engine.salary.entity.salaryacct.po.SalaryAcctRecordPO; import com.engine.salary.entity.salaryacct.po.SalaryAcctRecordPO;
import com.engine.salary.entity.salaryacct.po.SalaryAcctTaxAgentPO;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.Collection; import java.util.Collection;
@ -78,4 +79,12 @@ public interface SalaryAcctRecordMapper {
void updateLockSalaryItemIds(SalaryAcctRecordPO salaryAcctRecord); void updateLockSalaryItemIds(SalaryAcctRecordPO salaryAcctRecord);
List<SalaryAcctRecordPO> getBackCalcRecordByIds(@Param("collection") Set<Long> salaryAcctIds); List<SalaryAcctRecordPO> getBackCalcRecordByIds(@Param("collection") Set<Long> salaryAcctIds);
/**
* 获取核算记录和扣缴义务人对应关系
* @param salaryAcctIds
* @return
*/
List<SalaryAcctTaxAgentPO> listAcctTaxAgent(Collection<Long> salaryAcctIds);
} }

View File

@ -15,7 +15,8 @@
<result column="delete_type" property="deleteType"/> <result column="delete_type" property="deleteType"/>
<result column="tenant_key" property="tenantKey"/> <result column="tenant_key" property="tenantKey"/>
<result column="back_calc_status" property="backCalcStatus"/> <result column="back_calc_status" property="backCalcStatus"/>
<result column="lock_salary_item_ids" property="lockSalaryItemIds" typeHandler="com.engine.salary.handle.SalaryListTypeHandler"/> <result column="lock_salary_item_ids" property="lockSalaryItemIds"
typeHandler="com.engine.salary.handle.SalaryListTypeHandler"/>
</resultMap> </resultMap>
<!-- 表字段 --> <!-- 表字段 -->
@ -422,4 +423,24 @@
WHERE id = #{id} AND delete_type = 0 WHERE id = #{id} AND delete_type = 0
</update> </update>
<select id="listAcctTaxAgent" resultType="com.engine.salary.entity.salaryacct.po.SalaryAcctTaxAgentPO">
select record.id as salaryAcctRecordId,
sob.income_category as incomeCategory,
sob.tax_agent_id as taxAgentId,
record.salary_month as salaryMonth,
record.tax_cycle as taxCycle
FROM hrsa_salary_acct_record record
left join hrsa_salary_sob sob
on record.salary_sob_id = sob.id
where record.delete_type = 0 and sob.delete_type = 0
<if test="salaryAcctRecordIds != null and salaryAcctRecordIds.size()>0">
AND record.id IN
<foreach collection="salaryAcctRecordIds" open="(" item="salaryAcctRecordId" separator="," close=")">
#{salaryAcctRecordId}
</foreach>
</if>
</select>
</mapper> </mapper>

View File

@ -1,11 +0,0 @@
package com.engine.salary.mapper.taxagent;
/**
* @description: 个税申报
* @author: xiajun
* @modified By: xiajun
* @date: Created in 2022/11/2 5:46 PM
* @version:v1.0
*/
public interface TaxDeclareRecordMapper {
}

View File

@ -1,8 +1,10 @@
package com.engine.salary.mapper.taxdeclaration; package com.engine.salary.mapper.taxdeclaration;
import com.engine.salary.entity.taxdeclaration.dto.TaxDeclarationEmployeeDTO; import com.engine.salary.entity.taxdeclaration.dto.TaxDeclarationEmployeeDTO;
import com.engine.salary.entity.taxdeclaration.param.AbnormalEmployeeListQueryParam;
import com.engine.salary.entity.taxdeclaration.param.TaxDeclarationDetailListQueryParam; import com.engine.salary.entity.taxdeclaration.param.TaxDeclarationDetailListQueryParam;
import com.engine.salary.entity.taxdeclaration.po.TaxDeclarationDetailPO; import com.engine.salary.entity.taxdeclaration.po.TaxDeclarationDetailPO;
import com.engine.salary.entity.taxdeclaration.po.TaxDeclareEmployeePO;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.Collection; import java.util.Collection;
@ -70,4 +72,12 @@ public interface TaxDeclarationDetailMapper {
List<TaxDeclarationDetailPO> listAll(); List<TaxDeclarationDetailPO> listAll();
int batchUpdate(@Param("collection") List<TaxDeclarationDetailPO> taxDeclarationDetailPos); int batchUpdate(@Param("collection") List<TaxDeclarationDetailPO> taxDeclarationDetailPos);
List<TaxDeclareEmployeePO> listPage4NotDeclareByParam(AbnormalEmployeeListQueryParam queryParam);
List<TaxDeclareEmployeePO> list4NotDeclareByParam(AbnormalEmployeeListQueryParam queryParam);
List<TaxDeclareEmployeePO> listPage4NoValueByParam(AbnormalEmployeeListQueryParam queryParam);
List<TaxDeclareEmployeePO> list4NoValueByParam(AbnormalEmployeeListQueryParam queryParam);
} }

View File

@ -0,0 +1,79 @@
package com.engine.salary.mapper.taxdeclaration;
import com.engine.salary.entity.taxdeclaration.po.TaxDeclareRecordPO;
import org.apache.ibatis.annotations.Param;
import java.util.Collection;
import java.util.List;
public interface TaxDeclareRecordMapper {
/**
* 查询所有记录
*
* @return 返回集合没有返回空List
*/
List<TaxDeclareRecordPO> listAll();
/**
* 条件查询
*
* @return 返回集合没有返回空List
*/
List<TaxDeclareRecordPO> listSome(TaxDeclareRecordPO taxDeclareRecord);
/**
* 根据主键查询
*
* @param id 主键
* @return 返回记录没有返回null
*/
TaxDeclareRecordPO getById(Long id);
/**
* 新增忽略null字段
*
* @param taxDeclareRecord 新增的记录
* @return 返回影响行数
*/
int insertIgnoreNull(TaxDeclareRecordPO taxDeclareRecord);
/**
* 批量插入
*
* @param taxDeclareRecord
*/
void batchInsert(@Param("collection") List<TaxDeclareRecordPO> taxDeclareRecord);
/**
* 修改修改所有字段
*
* @param taxDeclareRecord 修改的记录
* @return 返回影响行数
*/
int update(TaxDeclareRecordPO taxDeclareRecord);
/**
* 修改忽略null字段
*
* @param taxDeclareRecord 修改的记录
* @return 返回影响行数
*/
int updateIgnoreNull(TaxDeclareRecordPO taxDeclareRecord);
/**
* 删除记录
*
* @param taxDeclareRecord 待删除的记录
* @return 返回影响行数
*/
int delete(TaxDeclareRecordPO taxDeclareRecord);
/**
* 批量删除记录
* @param ids 主键id集合
*/
void deleteByIds(@Param("ids") Collection<Long> ids);
}

View File

@ -0,0 +1,536 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.engine.salary.mapper.taxdeclaration.TaxDeclareRecordMapper">
<resultMap id="BaseResultMap" type="com.engine.salary.entity.taxdeclaration.po.TaxDeclareRecordPO">
<result column="id" property="id"/>
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
<result column="creator" property="creator"/>
<result column="delete_type" property="deleteType"/>
<result column="tenant_key" property="tenantKey"/>
<result column="tax_agent_id" property="taxAgentId"/>
<result column="salary_month" property="salaryMonth"/>
<result column="tax_cycle" property="taxCycle"/>
<result column="remark" property="remark"/>
<result column="request_id" property="requestId"/>
<result column="tax_declare_type" property="taxDeclareType"/>
<result column="tax_declare_status" property="taxDeclareStatus"/>
<result column="display_update_icon" property="displayUpdateIcon"/>
<result column="tax_pay_amount" property="taxPayAmount"/>
<result column="person_num" property="personNum"/>
<result column="tax_declare_error_msg" property="taxDeclareErrorMsg"/>
<result column="tax_paid_amount" property="taxPaidAmount"/>
<result column="tax_pure_paid_amount" property="taxPurePaidAmount"/>
</resultMap>
<!-- 表字段 -->
<sql id="baseColumns">
t
.
id
, t.create_time
, t.update_time
, t.creator
, t.delete_type
, t.tenant_key
, t.tax_agent_id
, t.salary_month
, t.tax_cycle
, t.remark
, t.request_id
, t.tax_declare_type
, t.tax_declare_status
, t.display_update_icon
, t.tax_pay_amount
, t.person_num
, t.tax_declare_error_msg
, t.tax_paid_amount
, t.tax_pure_paid_amount
</sql>
<!-- 查询全部 -->
<select id="listAll" resultMap="BaseResultMap">
SELECT
<include refid="baseColumns"/>
FROM hrsa_tax_declare_record t
WHERE delete_type = 0
ORDER BY tax_cycle DESC
</select>
<!-- 根据主键获取单条记录 -->
<select id="getById" resultMap="BaseResultMap" parameterType="Long">
SELECT
<include refid="baseColumns"/>
FROM hrsa_tax_declare_record t
WHERE id = #{id} AND delete_type = 0
</select>
<!-- 条件查询 -->
<select id="listSome" resultMap="BaseResultMap"
parameterType="com.engine.salary.entity.taxdeclaration.po.TaxDeclareRecordPO">
SELECT
<include refid="baseColumns"/>
FROM hrsa_tax_declare_record t
WHERE delete_type = 0
<if test="id != null">
AND id = #{id}
</if>
<if test="createTime != null">
AND create_time = #{createTime}
</if>
<if test="updateTime != null">
AND update_time = #{updateTime}
</if>
<if test="creator != null">
AND creator = #{creator}
</if>
<if test="deleteType != null">
AND delete_type = #{deleteType}
</if>
<if test="tenantKey != null">
AND tenant_key = #{tenantKey}
</if>
<if test="taxAgentId != null">
AND tax_agent_id = #{taxAgentId}
</if>
<if test="salaryMonth != null">
AND salary_month = #{salaryMonth}
</if>
<if test="taxCycle != null">
AND tax_cycle = #{taxCycle}
</if>
<if test="remark != null">
AND remark = #{remark}
</if>
<if test="requestId != null">
AND request_id = #{requestId}
</if>
<if test="taxDeclareType != null">
AND tax_declare_type = #{taxDeclareType}
</if>
<if test="taxDeclareStatus != null">
AND tax_declare_status = #{taxDeclareStatus}
</if>
<if test="displayUpdateIcon != null">
AND display_update_icon = #{displayUpdateIcon}
</if>
<if test="taxPayAmount != null">
AND tax_pay_amount = #{taxPayAmount}
</if>
<if test="personNum != null">
AND person_num = #{personNum}
</if>
<if test="taxDeclareErrorMsg != null">
AND tax_declare_error_msg = #{taxDeclareErrorMsg}
</if>
<if test="taxPaidAmount != null">
AND tax_paid_amount = #{taxPaidAmount}
</if>
<if test="taxPurePaidAmount != null">
AND tax_pure_paid_amount = #{taxPurePaidAmount}
</if>
<if test="ids != null and ids.size()>0">
AND id IN
<foreach collection="ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</if>
<if test="taxAgentIds != null and taxAgentIds.size()>0">
AND tax_agent_id IN
<foreach collection="taxAgentIds" open="(" item="taxAgentId" separator="," close=")">
#{taxAgentId}
</foreach>
</if>
<if test="startDate != null">
AND tax_cycle <![CDATA[ >= ]]> #{startDate}
</if>
<if test="endDate != null">
AND tax_cycle <![CDATA[ <= ]]> #{endDate}
</if>
ORDER BY tax_cycle DESC
</select>
<!-- 插入不为NULL的字段 -->
<insert id="insertIgnoreNull" parameterType="com.engine.salary.entity.taxdeclaration.po.TaxDeclareRecordPO">
INSERT INTO hrsa_tax_declare_record
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="creator != null">
creator,
</if>
<if test="deleteType != null">
delete_type,
</if>
<if test="tenantKey != null">
tenant_key,
</if>
<if test="taxAgentId != null">
tax_agent_id,
</if>
<if test="salaryMonth != null">
salary_month,
</if>
<if test="taxCycle != null">
tax_cycle,
</if>
<if test="remark != null">
remark,
</if>
<if test="requestId != null">
request_id,
</if>
<if test="taxDeclareType != null">
tax_declare_type,
</if>
<if test="taxDeclareStatus != null">
tax_declare_status,
</if>
<if test="displayUpdateIcon != null">
display_update_icon,
</if>
<if test="taxPayAmount != null">
tax_pay_amount,
</if>
<if test="personNum != null">
person_num,
</if>
<if test="taxDeclareErrorMsg != null">
tax_declare_error_msg,
</if>
<if test="taxPaidAmount != null">
tax_paid_amount,
</if>
<if test="taxPurePaidAmount != null">
tax_pure_paid_amount,
</if>
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id},
</if>
<if test="createTime != null">
#{createTime},
</if>
<if test="updateTime != null">
#{updateTime},
</if>
<if test="creator != null">
#{creator},
</if>
<if test="deleteType != null">
#{deleteType},
</if>
<if test="tenantKey != null">
#{tenantKey},
</if>
<if test="taxAgentId != null">
#{taxAgentId},
</if>
<if test="salaryMonth != null">
#{salaryMonth},
</if>
<if test="taxCycle != null">
#{taxCycle},
</if>
<if test="remark != null">
#{remark},
</if>
<if test="requestId != null">
#{requestId},
</if>
<if test="taxDeclareType != null">
#{taxDeclareType},
</if>
<if test="taxDeclareStatus != null">
#{taxDeclareStatus},
</if>
<if test="displayUpdateIcon != null">
#{displayUpdateIcon},
</if>
<if test="taxPayAmount != null">
#{taxPayAmount},
</if>
<if test="personNum != null">
#{personNum},
</if>
<if test="taxDeclareErrorMsg != null">
#{taxDeclareErrorMsg},
</if>
<if test="taxPaidAmount != null">
#{taxPaidAmount},
</if>
<if test="taxPurePaidAmount != null">
#{taxPurePaidAmount},
</if>
</trim>
</insert>
<insert id="batchInsert">
INSERT INTO hrsa_tax_declare_record
(
id,
create_time,
update_time,
creator,
delete_type,
tenant_key,
tax_agent_id,
salary_month,
tax_cycle,
remark,
request_id,
tax_declare_type,
tax_declare_status,
display_update_icon,
tax_pay_amount,
person_num,
tax_declare_error_msg,
tax_paid_amount,
tax_pure_paid_amount,
)
VALUES
(
<foreach collection="collection" item="item" separator=",">
#{item.id},
#{item.createTime},
#{item.updateTime},
#{item.creator},
#{item.deleteType},
#{item.tenantKey},
#{item.taxAgentId},
#{item.salaryMonth},
#{item.taxCycle},
#{item.remark},
#{item.requestId},
#{item.taxDeclareType},
#{item.taxDeclareStatus},
#{item.displayUpdateIcon},
#{item.taxPayAmount},
#{item.personNum},
#{item.taxDeclareErrorMsg},
#{item.taxPaidAmount},
#{item.taxPurePaidAmount},
</foreach>
)
</insert>
<insert id="batchInsert" databaseId="oracle">
INSERT INTO hrsa_tax_declare_record (
id,
create_time,
update_time,
creator,
delete_type,
tenant_key,
tax_agent_id,
salary_month,
tax_cycle,
remark,
request_id,
tax_declare_type,
tax_declare_status,
display_update_icon,
tax_pay_amount,
person_num,
tax_declare_error_msg,
tax_paid_amount,
tax_pure_paid_amount,
)
<foreach collection="collection" item="item" separator="union all">
select
#{item.id,jdbcType=DOUBLE},
#{item.createTime,jdbcType=DATE},
#{item.updateTime,jdbcType=DATE},
#{item.creator,jdbcType=DOUBLE},
#{item.deleteType,jdbcType=INTEGER},
#{item.tenantKey,jdbcType=VARCHAR},
#{item.taxAgentId,jdbcType=DOUBLE},
#{item.salaryMonth,jdbcType=DATE},
#{item.taxCycle,jdbcType=DATE},
#{item.remark,jdbcType=VARCHAR},
#{item.requestId,jdbcType=DOUBLE},
#{item.taxDeclareType,jdbcType=INTEGER},
#{item.taxDeclareStatus,jdbcType=INTEGER},
#{item.displayUpdateIcon,jdbcType=INTEGER},
#{item.taxPayAmount,jdbcType=VARCHAR},
#{item.personNum,jdbcType=INTEGER},
#{item.taxDeclareErrorMsg,jdbcType=VARCHAR},
#{item.taxPaidAmount,jdbcType=VARCHAR},
#{item.taxPurePaidAmount,jdbcType=VARCHAR},
from dual
</foreach>
</insert>
<insert id="batchInsert" databaseId="sqlserver">
<foreach collection="collection" item="item" separator=";">
INSERT INTO hrsa_tax_declare_record (
id,
create_time,
update_time,
creator,
delete_type,
tenant_key,
tax_agent_id,
salary_month,
tax_cycle,
remark,
request_id,
tax_declare_type,
tax_declare_status,
display_update_icon,
tax_pay_amount,
person_num,
tax_declare_error_msg,
tax_paid_amount,
tax_pure_paid_amount,
)
VALUES
(
#{item.id,jdbcType=DOUBLE、DATE、VARCHAR、INTEGER},
#{item.createTime,jdbcType=DOUBLE、DATE、VARCHAR、INTEGER},
#{item.updateTime,jdbcType=DOUBLE、DATE、VARCHAR、INTEGER},
#{item.creator,jdbcType=DOUBLE、DATE、VARCHAR、INTEGER},
#{item.deleteType,jdbcType=DOUBLE、DATE、VARCHAR、INTEGER},
#{item.tenantKey,jdbcType=DOUBLE、DATE、VARCHAR、INTEGER},
#{item.taxAgentId,jdbcType=DOUBLE、DATE、VARCHAR、INTEGER},
#{item.salaryMonth,jdbcType=DOUBLE、DATE、VARCHAR、INTEGER},
#{item.taxCycle,jdbcType=DOUBLE、DATE、VARCHAR、INTEGER},
#{item.remark,jdbcType=DOUBLE、DATE、VARCHAR、INTEGER},
#{item.requestId,jdbcType=DOUBLE、DATE、VARCHAR、INTEGER},
#{item.taxDeclareType,jdbcType=DOUBLE、DATE、VARCHAR、INTEGER},
#{item.taxDeclareStatus,jdbcType=DOUBLE、DATE、VARCHAR、INTEGER},
#{item.displayUpdateIcon,jdbcType=DOUBLE、DATE、VARCHAR、INTEGER},
#{item.taxPayAmount,jdbcType=DOUBLE、DATE、VARCHAR、INTEGER},
#{item.personNum,jdbcType=DOUBLE、DATE、VARCHAR、INTEGER},
#{item.taxDeclareErrorMsg,jdbcType=DOUBLE、DATE、VARCHAR、INTEGER},
#{item.taxPaidAmount,jdbcType=DOUBLE、DATE、VARCHAR、INTEGER},
#{item.taxPurePaidAmount,jdbcType=DOUBLE、DATE、VARCHAR、INTEGER},
)
</foreach>
</insert>
<!-- 更新,更新全部字段 -->
<update id="update" parameterType="com.engine.salary.entity.taxdeclaration.po.TaxDeclareRecordPO">
UPDATE hrsa_tax_declare_record
<set>
create_time=#{createTime},
update_time=#{updateTime},
creator=#{creator},
delete_type=#{deleteType},
tenant_key=#{tenantKey},
tax_agent_id=#{taxAgentId},
salary_month=#{salaryMonth},
tax_cycle=#{taxCycle},
remark=#{remark},
request_id=#{requestId},
tax_declare_type=#{taxDeclareType},
tax_declare_status=#{taxDeclareStatus},
display_update_icon=#{displayUpdateIcon},
tax_pay_amount=#{taxPayAmount},
person_num=#{personNum},
tax_declare_error_msg=#{taxDeclareErrorMsg},
tax_paid_amount=#{taxPaidAmount},
tax_pure_paid_amount=#{taxPurePaidAmount},
</set>
WHERE id = #{id} AND delete_type = 0
</update>
<!-- 更新不为NULL的字段 -->
<update id="updateIgnoreNull" parameterType="com.engine.salary.entity.taxdeclaration.po.TaxDeclareRecordPO">
UPDATE hrsa_tax_declare_record
<set>
<if test="createTime != null">
create_time=#{createTime},
</if>
<if test="updateTime != null">
update_time=#{updateTime},
</if>
<if test="creator != null">
creator=#{creator},
</if>
<if test="deleteType != null">
delete_type=#{deleteType},
</if>
<if test="tenantKey != null">
tenant_key=#{tenantKey},
</if>
<if test="taxAgentId != null">
tax_agent_id=#{taxAgentId},
</if>
<if test="salaryMonth != null">
salary_month=#{salaryMonth},
</if>
<if test="taxCycle != null">
tax_cycle=#{taxCycle},
</if>
<if test="remark != null">
remark=#{remark},
</if>
<if test="requestId != null">
request_id=#{requestId},
</if>
<if test="taxDeclareType != null">
tax_declare_type=#{taxDeclareType},
</if>
<if test="taxDeclareStatus != null">
tax_declare_status=#{taxDeclareStatus},
</if>
<if test="displayUpdateIcon != null">
display_update_icon=#{displayUpdateIcon},
</if>
<if test="taxPayAmount != null">
tax_pay_amount=#{taxPayAmount},
</if>
<if test="personNum != null">
person_num=#{personNum},
</if>
<if test="taxDeclareErrorMsg != null">
tax_declare_error_msg=#{taxDeclareErrorMsg},
</if>
<if test="taxPaidAmount != null">
tax_paid_amount=#{taxPaidAmount},
</if>
<if test="taxPurePaidAmount != null">
tax_pure_paid_amount=#{taxPurePaidAmount},
</if>
</set>
WHERE id = #{id} AND delete_type = 0
</update>
<!-- 根据主键删除记录 -->
<delete id="delete">
UPDATE hrsa_tax_declare_record
SET delete_type=1
WHERE id = #{id}
AND delete_type = 0
</delete>
<delete id="deleteByIds">
UPDATE hrsa_tax_declare_record
SET delete_type = 1
WHERE delete_type = 0
AND id IN
<foreach collection="ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -22,6 +22,8 @@ public interface ExtEmpService {
void delete(Collection<Long> ids); void delete(Collection<Long> ids);
List<ExtEmpPO> getExtEmpByIds(List<Long> ids);
DataCollectionEmployee getEmployeeById(Long id); DataCollectionEmployee getEmployeeById(Long id);
/** /**

View File

@ -1,31 +0,0 @@
//package com.engine.salary.service;
//
//import com.engine.salary.entity.datacollection.DataCollectionEmployee;
//
//import java.util.Collection;
//
///**
// * @description: 薪资核算
// * @author: xiajun
// * @modified By: xiajun
// * @date: Created in 8/22/22 3:15 PM
// * @version:v1.0
// */
//public interface SalaryAcctCalcService {
//
// /**
// * 按薪资核算记录id进行核算
// *
// * @param salaryAcctRecordId
// * @param simpleEmployee
// */
// void calcByRecordId(Long salaryAcctRecordId, DataCollectionEmployee simpleEmployee) throws Exception;
//
// /**
// * 按薪资核算人员id进行核算
// *
// * @param salaryAcctEmployeeIds
// * @param simpleEmployee
// */
// void calcByEmployeeIds(Long salaryAcctRecordId, Collection<Long> salaryAcctEmployeeIds, DataCollectionEmployee simpleEmployee) throws Exception;
//}

View File

@ -5,6 +5,7 @@ import com.engine.salary.entity.salaryacct.param.SalaryAcctRecordQueryParam;
import com.engine.salary.entity.salaryacct.param.SalaryAcctRecordSaveParam; import com.engine.salary.entity.salaryacct.param.SalaryAcctRecordSaveParam;
import com.engine.salary.entity.salaryacct.po.SalaryAcctRecordPO; import com.engine.salary.entity.salaryacct.po.SalaryAcctRecordPO;
import com.engine.salary.entity.salaryacct.po.SalaryAcctResultPO; import com.engine.salary.entity.salaryacct.po.SalaryAcctResultPO;
import com.engine.salary.entity.salaryacct.po.SalaryAcctTaxAgentPO;
import com.engine.salary.entity.salarysob.dto.SalarySobCycleDTO; import com.engine.salary.entity.salarysob.dto.SalarySobCycleDTO;
import com.engine.salary.enums.salaryaccounting.SalaryAcctRecordStatusEnum; import com.engine.salary.enums.salaryaccounting.SalaryAcctRecordStatusEnum;
import com.engine.salary.util.page.PageInfo; import com.engine.salary.util.page.PageInfo;
@ -207,4 +208,13 @@ public interface SalaryAcctRecordService {
List<SalaryAcctRecordPO> listSome(SalaryAcctRecordPO po); List<SalaryAcctRecordPO> listSome(SalaryAcctRecordPO po);
/**
* 根据薪资核算记录id查询关联的个税扣缴义务人
*
* @param salaryAcctRecordIds
* @return
*/
List<SalaryAcctTaxAgentPO> listBySalaryAcctRecordIds(Collection<Long> salaryAcctRecordIds);
} }

View File

@ -50,4 +50,13 @@ public interface TaxDeclarationService {
* @param taxDeclarationId * @param taxDeclarationId
*/ */
void withDrawTaxDeclaration(Long taxDeclarationId); void withDrawTaxDeclaration(Long taxDeclarationId);
/**
* 删除个税申报表
*
* @param taxDeclareRecordIds
*/
void deleteByTaxDeclareRecordIds(Collection<Long> taxDeclareRecordIds);
void saveBatch(List<TaxDeclarationPO> taxDeclarations);
} }

View File

@ -0,0 +1,71 @@
package com.engine.salary.service;
import com.engine.salary.entity.taxdeclaration.dto.TaxDeclarationValueListDTO;
import com.engine.salary.entity.taxdeclaration.po.TaxDeclarationPO;
import com.engine.salary.entity.taxdeclaration.po.TaxDeclarationValuePO;
import com.engine.salary.util.page.PageInfo;
import java.util.Collection;
import java.util.List;
/**
* @description: 个税申报表明细
* @author: xiajun
* @modified By: xiajun
* @date: Created in 9/28/22 9:41 AM
* @version:v1.0
*/
public interface TaxDeclarationValueService {
/**
* 查询个税申报表明细
*
* @param page
* @param taxDeclarationIds
* @return
*/
PageInfo<TaxDeclarationValuePO> listPageByTaxDeclarationIds( Collection<Long> taxDeclarationIds);
/**
* 查询个税申报表明细
*
* @param taxDeclarationIds
* @param tenantKey
* @return
*/
List<TaxDeclarationValuePO> listByTaxDeclarationIds(Collection<Long> taxDeclarationIds);
/**
* 查询个税申报表明细
*
* @param taxDeclarationIds
* @param tenantKey
* @return
*/
List<TaxDeclarationValuePO> listByTaxDeclarationIdsNoDecrypt(Collection<Long> taxDeclarationIds);
/**
* 个税申报表明细列表
*
* @param taxDeclarationValues
* @param tenantKey
* @return
*/
TaxDeclarationValueListDTO convert2List(TaxDeclarationPO taxDeclaration, List<TaxDeclarationValuePO> taxDeclarationValues);
/**
* 批量保存
*
* @param taxDeclarationValues
* @param tenantKey
*/
void batchSave(List<TaxDeclarationValuePO> taxDeclarationValues);
/**
* 删除个税申报表明细
*
* @param taxDeclareRecordIds
* @param tenantKey
*/
void deleteByTaxDeclareRecordIds(Collection<Long> taxDeclareRecordIds);
}

View File

@ -0,0 +1,60 @@
package com.engine.salary.service;
import com.engine.salary.entity.taxdeclaration.dto.AbnormalEmployeeListDTO;
import com.engine.salary.entity.taxdeclaration.param.AbnormalEmployeeListQueryParam;
import com.engine.salary.entity.taxdeclaration.po.TaxDeclareEmployeePO;
import com.engine.salary.entity.taxdeclaration.po.TaxDeclareRecordPO;
import com.engine.salary.util.page.PageInfo;
import java.util.List;
/**
* @description: 个税申报表明细中的人员
* @author: xiajun
* @modified By: xiajun
* @date: Created in 2022/11/10 4:10 PM
* @version:v1.0
*/
public interface TaxDeclareEmployeeService {
/**
* 查询个税申报表明细中未报送成功的人员
*
* @param queryParam
* @return
*/
PageInfo<TaxDeclareEmployeePO> listPage4NotDeclareByParam(AbnormalEmployeeListQueryParam queryParam);
/**
* 查询个税申报表明细中未报送成功的人员
*
* @param queryParam
* @return
*/
List<TaxDeclareEmployeePO> list4NotDeclareByParam(AbnormalEmployeeListQueryParam queryParam);
/**
* 查询已报送但是没有申报数据的人员
*
* @param queryParam
* @return
*/
PageInfo<TaxDeclareEmployeePO> listPage4NoValueByParam(AbnormalEmployeeListQueryParam queryParam);
/**
* 查询已报送但是没有申报数据的人员
*
* @param queryParam
* @return
*/
List<TaxDeclareEmployeePO> list4NoValueByParam(AbnormalEmployeeListQueryParam queryParam);
/**
* 转换成数据异常人员dto
*
* @param taxDeclareRecord
* @param taxDeclareEmployees
* @return
*/
List<AbnormalEmployeeListDTO> convert2AbnormalEmployeeList(TaxDeclareRecordPO taxDeclareRecord, List<TaxDeclareEmployeePO> taxDeclareEmployees);
}

View File

@ -0,0 +1,51 @@
package com.engine.salary.service;
import com.engine.salary.entity.taxdeclaration.dto.FailEmployeeListDTO;
import com.engine.salary.entity.taxdeclaration.po.TaxDeclareFailPO;
import com.engine.salary.entity.taxdeclaration.po.TaxDeclareRecordPO;
import com.engine.salary.util.page.PageInfo;
import java.util.Collection;
import java.util.List;
/**
* @description: 个税申报失败数据
* @author: xiajun
* @modified By: xiajun
* @date: Created in 2022/11/30 1:31 PM
* @version:v1.0
*/
public interface TaxDeclareFailService {
/**
* 根据个税申报记录id查询申报失败数据分页
*
* @param taxDeclareRecordIds
* @return
*/
PageInfo<TaxDeclareFailPO> listPageByTaxDeclareRecordIds( Collection<Long> taxDeclareRecordIds);
/**
* 根据个税申报记录id查询申报失败数据
*
* @param taxDeclareRecordIds
* @return
*/
List<TaxDeclareFailPO> listByTaxDeclareRecordIds(Collection<Long> taxDeclareRecordIds);
/**
* 根据个税申报记录id删除申报失败数据
*
* @param taxDeclareRecordIds
*/
void deleteByTaxDeclareRecordIds(Collection<Long> taxDeclareRecordIds);
/**
* 转换成申报失败数据dto
*
* @param taxDeclareRecord
* @param taxDeclareFails
* @return
*/
List<FailEmployeeListDTO> convert2FailEmployeeList(TaxDeclareRecordPO taxDeclareRecord, List<TaxDeclareFailPO> taxDeclareFails);
}

View File

@ -1,11 +1,16 @@
package com.engine.salary.service; package com.engine.salary.service;
import com.engine.salary.common.YearMonthRange;
import com.engine.salary.entity.taxdeclaration.dto.TaxDeclarationRateDTO; import com.engine.salary.entity.taxdeclaration.dto.TaxDeclarationRateDTO;
import com.engine.salary.entity.taxdeclaration.param.TaxDeclarationListQueryParam;
import com.engine.salary.entity.taxdeclaration.param.TaxDeclarationSaveParam;
import com.engine.salary.entity.taxdeclaration.po.TaxDeclarationPO; import com.engine.salary.entity.taxdeclaration.po.TaxDeclarationPO;
import com.engine.salary.entity.taxdeclaration.po.TaxDeclareRecordPO; import com.engine.salary.entity.taxdeclaration.po.TaxDeclareRecordPO;
import com.engine.salary.util.page.PageInfo;
import java.time.YearMonth;
import java.util.Collection; import java.util.Collection;
import java.util.Date;
import java.util.List;
/** /**
* @description: 个税申报 * @description: 个税申报
@ -24,164 +29,139 @@ public interface TaxDeclareRecordService {
*/ */
TaxDeclareRecordPO getById(Long id); TaxDeclareRecordPO getById(Long id);
// /** /**
// * 查询个税申报记录 * 查询个税申报记录
// * *
// * @param ids * @param ids
// * @param tenantKey * @return
// * @return */
// */ List<TaxDeclareRecordPO> listByIds(Collection<Long> ids);
// List<TaxDeclareRecordPO> listByIds(Collection<Long> ids, String tenantKey);
// /**
// /** * 查询个税申报记录
// * 查询个税申报记录 *
// * * @param taxCycleRange
// * @param taxCycleRange * @return
// * @param tenantKey */
// * @return List<TaxDeclareRecordPO> listByTaxCycleRange(YearMonthRange taxCycleRange);
// */
// List<TaxDeclareRecordPO> listByTaxCycleRange(YearMonthRange taxCycleRange, String tenantKey); /**
// * 根据个税扣缴义务人id税款所属期查询个税申报记录
// /** *
// * 根据个税扣缴义务人id税款所属期查询个税申报记录 * @param taxAgentIds
// * * @param taxCycle
// * @param taxAgentIds * @return
// * @param taxCycle */
// * @param tenantKey List<TaxDeclareRecordPO> listByTaxCycleAndTaxAgentIds(Date taxCycle, Collection<Long> taxAgentIds);
// * @return
// */ /**
// List<TaxDeclareRecordPO> listByTaxCycleAndTaxAgentIds(YearMonth taxCycle, Collection<Long> taxAgentIds, String tenantKey); * 根据个税扣缴义务人id薪资所属月查询个税申报记录
// *
// /** * @param salaryMonth
// * 根据个税扣缴义务人id薪资所属月查询个税申报记录 * @param taxAgentIds
// * * @return
// * @param salaryMonth */
// * @param taxAgentIds List<TaxDeclareRecordPO> listBySalaryMonthAndTaxAgentIds(Date salaryMonth, Collection<Long> taxAgentIds);
// * @param tenantKey
// * @return /**
// */ * 查询个税申报记录
// List<TaxDeclareRecordPO> listBySalaryMonthAndTaxAgentIds(YearMonth salaryMonth, Collection<Long> taxAgentIds, String tenantKey); *
// * @param queryParam
// /** * @return
// * 查询个税申报记录 */
// * PageInfo<TaxDeclareRecordPO> listPageByParam(TaxDeclarationListQueryParam queryParam);
// * @param queryParam
// * @param tenantKey /**
// * @return * 生成申报表
// */ *
// Page<TaxDeclareRecordPO> listPageByParam(TaxDeclarationListQueryParam queryParam, Long employeeId, String tenantKey); * @param saveParam
// */
// /** void save(TaxDeclarationSaveParam saveParam);
// * 生成申报表
// *
// * @param saveParam
// * @param employeeId
// * @param tenantKey
// */
// void save(TaxDeclarationSaveParam saveParam, Long employeeId, String tenantKey);
/** /**
* 刷新数据 * 刷新数据
* *
* @param id * @param id
* @param employeeId
* @param tenantKey
*/ */
void refreshData(Long id, Long employeeId, String tenantKey); void refreshData(Long id);
/** /**
* 更新个税申报表的待刷新数据的标识 * 更新个税申报表的待刷新数据的标识
* *
* @param id * @param id
* @param employeeId
* @param tenantKey
*/ */
void updateIcon(Long id, Integer displayIcon, Long employeeId, String tenantKey); void updateIcon(Long id, Integer displayIcon);
/** /**
* 因为薪资核算结果发生变动所以需要更新个税申报表的待刷新数据的标识 * 因为薪资核算结果发生变动所以需要更新个税申报表的待刷新数据的标识
* *
* @param taxCycle * @param taxCycle
* @param taxAgentIds * @param taxAgentIds
* @param tenantKey
*/ */
void updateByTaxCycleAndTaxAgentIds(YearMonth taxCycle, Collection<Long> taxAgentIds, String tenantKey); void updateByTaxCycleAndTaxAgentIds(Date taxCycle, Collection<Long> taxAgentIds);
/** /**
* 判断是否有权限可查看个税申报表 * 判断是否有权限可查看个税申报表
* *
* @param taxDeclaration * @param taxDeclaration
* @param employeeId
* @param tenantKey
* @return * @return
*/ */
boolean checkByAuthority(TaxDeclarationPO taxDeclaration, Long employeeId, String tenantKey); boolean checkByAuthority(TaxDeclarationPO taxDeclaration);
/** /**
* 根据id删除 * 根据id删除
* *
* @param ids * @param ids
* @param tenantKey
*/ */
void deleteByIds(Collection<Long> ids, String tenantKey); void deleteByIds(Collection<Long> ids);
/** /**
* 个税申报 * 个税申报
* *
* @param id * @param id
* @param tenantKey
*/ */
void declare(Long id, Long employeeId, String tenantKey); void declare(Long id);
/** /**
* 个税申报获取反馈 * 个税申报获取反馈
* *
* @param id * @param id
* @param tenantKey
*/ */
void getDeclareFeedback(Long id, TaxDeclarationRateDTO taxDeclarationRate, Long employeeId, String tenantKey); void getDeclareFeedback(Long id, TaxDeclarationRateDTO taxDeclarationRate);
/** /**
* 作废 * 作废
* *
* @param id * @param id
* @param tenantKey
*/ */
void cancelDeclare(Long id, Long employeeId, String tenantKey); void cancelDeclare(Long id);
/** /**
* 获取作废反馈 * 获取作废反馈
* *
* @param id * @param id
* @param tenantKey
*/ */
void getCancelFeedback(Long id, TaxDeclarationRateDTO taxDeclarationRate, Long employeeId, String tenantKey); void getCancelFeedback(Long id, TaxDeclarationRateDTO taxDeclarationRate);
/** /**
* 更正申报 * 更正申报
* *
* @param id * @param id
* @param employeeId
* @param tenantKey
*/ */
void updateDeclare(Long id, Long employeeId, String tenantKey); void updateDeclare(Long id);
/** /**
* 税局端申报状态查询 * 税局端申报状态查询
* *
* @param id * @param id
* @param employeeId
* @param tenantKey
*/ */
String queryDeclareStatus(Long id, Long employeeId, String tenantKey); String queryDeclareStatus(Long id);
/** /**
* 税局端申报明细查询 * 税局端申报明细查询
* *
* @param id * @param id
* @param employeeId
* @param tenantKey
*/ */
String queryCompanyIncomes(Long id, Long employeeId, String tenantKey); String queryCompanyIncomes(Long id);
} }

View File

@ -0,0 +1,31 @@
package com.engine.salary.service;
import com.engine.salary.entity.taxdeclaration.po.TaxReportColumnPO;
import com.engine.salary.enums.salarysob.IncomeCategoryEnum;
import java.util.List;
/**
* @description: 个税申报表表头
* @author: xiajun
* @modified By: xiajun
* @date: Created in 2022/12/5 6:36 PM
* @version:v1.0
*/
public interface TaxReportColumnService {
/**
* 查询所有所得项目的个税申报表表头
*
* @return
*/
List<TaxReportColumnPO> listAll();
/**
* 根据所得项目查询个税申报表表头
*
* @param incomeCategory
* @return
*/
List<TaxReportColumnPO> listByIncomeCategory(IncomeCategoryEnum incomeCategory);
}

View File

@ -22,7 +22,7 @@
// //
// private final Map<String, SalaryCalcRunService> serviceMap = new ConcurrentHashMap<>(); // private final Map<String, SalaryCalcRunService> serviceMap = new ConcurrentHashMap<>();
// //
// @Autowired //
// public SalaryCalcRunServiceFactory(Map<String, SalaryCalcRunService> map) { // public SalaryCalcRunServiceFactory(Map<String, SalaryCalcRunService> map) {
// for (Map.Entry<String, SalaryCalcRunService> entry : map.entrySet()) { // for (Map.Entry<String, SalaryCalcRunService> entry : map.entrySet()) {
// serviceMap.put(entry.getValue().getCalcType(), entry.getValue()); // serviceMap.put(entry.getValue().getCalcType(), entry.getValue());

View File

@ -16,7 +16,7 @@
//public class TaxPaymentServiceFactory { //public class TaxPaymentServiceFactory {
// private final Map<Integer, TaxPaymentService> serviceMap = new ConcurrentHashMap<>(); // private final Map<Integer, TaxPaymentService> serviceMap = new ConcurrentHashMap<>();
// //
// @Autowired //
// public TaxPaymentServiceFactory(Map<String, TaxPaymentService> map) { // public TaxPaymentServiceFactory(Map<String, TaxPaymentService> map) {
// for (Map.Entry<String, TaxPaymentService> entry : map.entrySet()) { // for (Map.Entry<String, TaxPaymentService> entry : map.entrySet()) {
// serviceMap.putIfAbsent(entry.getValue().getServiceType(), entry.getValue()); // serviceMap.putIfAbsent(entry.getValue().getServiceType(), entry.getValue());

View File

@ -109,6 +109,18 @@ public class ExtEmpServiceImpl extends Service implements ExtEmpService {
} }
} }
@Override
public List<ExtEmpPO> getExtEmpByIds(List<Long> ids) {
if (CollectionUtils.isEmpty(ids)) {
return new ArrayList<>();
}
List<ExtEmpPO> extEmpPOS = new ArrayList<>();
List<List<Long>> partition = Lists.partition(ids, 500);
partition.forEach(list -> extEmpPOS.addAll(getExternalEmployeeMapper().listSome(ExtEmpPO.builder().ids(list).build())));
return extEmpPOS;
}
@Override @Override
public DataCollectionEmployee getEmployeeById(Long id) { public DataCollectionEmployee getEmployeeById(Long id) {
ExtEmpPO po = getExternalEmployeeMapper().getById(id); ExtEmpPO po = getExternalEmployeeMapper().getById(id);

View File

@ -11,6 +11,7 @@ import com.engine.salary.entity.salaryacct.param.SalaryAcctRecordSaveParam;
import com.engine.salary.entity.salaryacct.po.SalaryAcctEmployeePO; import com.engine.salary.entity.salaryacct.po.SalaryAcctEmployeePO;
import com.engine.salary.entity.salaryacct.po.SalaryAcctRecordPO; import com.engine.salary.entity.salaryacct.po.SalaryAcctRecordPO;
import com.engine.salary.entity.salaryacct.po.SalaryAcctResultPO; import com.engine.salary.entity.salaryacct.po.SalaryAcctResultPO;
import com.engine.salary.entity.salaryacct.po.SalaryAcctTaxAgentPO;
import com.engine.salary.entity.salarysob.dto.SalarySobCycleDTO; import com.engine.salary.entity.salarysob.dto.SalarySobCycleDTO;
import com.engine.salary.entity.salarysob.po.SalarySobPO; import com.engine.salary.entity.salarysob.po.SalarySobPO;
import com.engine.salary.enums.salaryaccounting.SalaryAcctRecordStatusEnum; import com.engine.salary.enums.salaryaccounting.SalaryAcctRecordStatusEnum;
@ -806,4 +807,12 @@ public class SalaryAcctRecordServiceImpl extends Service implements SalaryAcctRe
public List<SalaryAcctRecordPO> listSome(SalaryAcctRecordPO po) { public List<SalaryAcctRecordPO> listSome(SalaryAcctRecordPO po) {
return getSalaryAcctRecordMapper().listSome(po); return getSalaryAcctRecordMapper().listSome(po);
} }
@Override
public List<SalaryAcctTaxAgentPO> listBySalaryAcctRecordIds(Collection<Long> salaryAcctRecordIds) {
if (CollectionUtils.isEmpty(salaryAcctRecordIds)) {
return Collections.emptyList();
}
return getSalaryAcctRecordMapper().listAcctTaxAgent(salaryAcctRecordIds);
}
} }

View File

@ -71,7 +71,7 @@ public class SalaryItemServiceImpl extends Service implements SalaryItemService
private SysSalaryItemBiz sysSalaryItemBiz = new SysSalaryItemBiz(); private SysSalaryItemBiz sysSalaryItemBiz = new SysSalaryItemBiz();
// @Autowired //
// private LoggerTemplate salaryItemLoggerTemplate; // private LoggerTemplate salaryItemLoggerTemplate;
@Override @Override

View File

@ -318,7 +318,7 @@ public class TaxDeclarationServiceImpl extends Service implements TaxDeclaration
@Override @Override
public void withDrawTaxDeclaration(Long taxDeclarationId) { public void withDrawTaxDeclaration(Long taxDeclarationId) {
TaxDeclarationPO po = getTaxDeclarationMapper().getById(taxDeclarationId); TaxDeclarationPO po = getTaxDeclarationMapper().getById(taxDeclarationId);
if(Objects.isNull(po)){ if (Objects.isNull(po)) {
throw new SalaryRunTimeException("个税申报表不存在"); throw new SalaryRunTimeException("个税申报表不存在");
} }
// 获取当前个税扣缴义务人下的薪资账套 // 获取当前个税扣缴义务人下的薪资账套
@ -331,8 +331,30 @@ public class TaxDeclarationServiceImpl extends Service implements TaxDeclaration
// 删除个税申报表 // 删除个税申报表
getTaxDeclarationMapper().deleteByIdZj(po.getId()); getTaxDeclarationMapper().deleteByIdZj(po.getId());
// 修改薪资核算记录状态为已归档 // 修改薪资核算记录状态为已归档
if(CollectionUtils.isNotEmpty(salaryAcctRecordIds)){ if (CollectionUtils.isNotEmpty(salaryAcctRecordIds)) {
getSalaryAcctRecordService(user).updateStatusByIds(salaryAcctRecordIds,SalaryAcctRecordStatusEnum.ARCHIVED); getSalaryAcctRecordService(user).updateStatusByIds(salaryAcctRecordIds, SalaryAcctRecordStatusEnum.ARCHIVED);
}
}
@Override
public void deleteByTaxDeclareRecordIds(Collection<Long> taxDeclareRecordIds) {
if (CollectionUtils.isEmpty(taxDeclareRecordIds)) {
return;
}
getTaxDeclarationMapper().deleteByIds(taxDeclareRecordIds);
// new LambdaUpdateChainWrapper<>(baseMapper)
// .eq(TaxDeclarationPO::getTenantKey, tenantKey)
// .eq(TaxDeclarationPO::getDeleteType, DeleteTypeEnum.NOT_DELETED.getValue())
// .in(TaxDeclarationPO::getTaxDeclareRecordId, taxDeclareRecordIds)
// .set(TaxDeclarationPO::getDeleteType, DeleteTypeEnum.DELETED.getValue())
// .set(TaxDeclarationPO::getUpdateTime, LocalDateTime.now())
// .update();
}
@Override
public void saveBatch(List<TaxDeclarationPO> taxDeclarations) {
if (CollectionUtils.isNotEmpty(taxDeclarations)) {
getTaxDeclarationMapper().batchInsert(taxDeclarations);
} }
} }
} }

View File

@ -0,0 +1,173 @@
package com.engine.salary.service.impl;
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
import com.baomidou.mybatisplus.extension.conditions.update.LambdaUpdateChainWrapper;
import com.engine.core.impl.Service;
import com.engine.salary.entity.taxdeclaration.po.TaxDeclarationValuePO;
import com.engine.salary.service.EmployeeDeclareService;
import com.engine.salary.service.ExtEmpService;
import com.engine.salary.service.SalaryEmployeeService;
import com.engine.salary.service.TaxDeclarationValueService;
import com.engine.salary.util.page.PageInfo;
import com.google.common.collect.Lists;
import com.weaver.common.component.table.column.WeaTableColumn;
import com.weaver.common.hrm.service.HrmCommonEmployeeService;
import com.weaver.framework.util.JsonUtil;
import com.weaver.hrm.salary.entity.employeedeclare.po.EmployeeDeclarePO;
import com.weaver.hrm.salary.entity.extemployee.po.ExtEmployeePO;
import com.weaver.hrm.salary.entity.taxdeclaration.bo.TaxDeclarationValueList;
import com.weaver.hrm.salary.entity.taxdeclaration.dto.TaxDeclarationValueListDTO;
import com.weaver.hrm.salary.entity.taxdeclaration.po.TaxDeclarationPO;
import com.weaver.hrm.salary.entity.taxdeclaration.po.TaxReportColumnPO;
import com.weaver.hrm.salary.enums.salaryaccounting.EmployeeTypeEnum;
import com.weaver.hrm.salary.enums.salarysob.IncomeCategoryEnum;
import com.weaver.hrm.salary.enums.sicategory.DeleteTypeEnum;
import com.weaver.hrm.salary.service.*;
import com.weaver.hrm.salary.util.SalaryEntityUtil;
import com.weaver.hrm.salary.util.SalaryEnumUtil;
import com.weaver.hrm.salary.util.SalaryPageUtil;
import com.weaver.teams.domain.hr.SimpleUserInfo;
import com.weaver.teams.domain.user.SimpleEmployee;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import java.time.LocalDateTime;
import java.time.YearMonth;
import java.util.*;
import java.util.stream.Collectors;
import static com.engine.salary.entity.siaccount.param.DSTenantKeyThreadVar.tenantKey;
/**
* @description: 个税申报表
* @author: xiajun
* @modified By: xiajun
* @date: Created in 9/28/22 9:41 AM
* @version:v1.0
*/
@Slf4j
public class TaxDeclarationValueServiceImpl extends Service implements TaxDeclarationValueService {
private DataSecurityService dataSecurityService;
private HrmCommonEmployeeService hrmCommonEmployeeService;
private SalaryEmployeeService salaryEmployeeService;
private ExtEmpService extEmployeeService;
private EmployeeDeclareService employeeDeclareService;
// private TaxReportColumnService taxReportColumnService;
@Override
public PageInfo<TaxDeclarationValuePO> listPageByTaxDeclarationIds( Collection<Long> taxDeclarationIds) {
if (page == null) {
return page;
}
page = new LambdaQueryChainWrapper<>(baseMapper)
.eq(TaxDeclarationValuePO::getTenantKey, tenantKey)
.eq(TaxDeclarationValuePO::getDeleteType, DeleteTypeEnum.NOT_DELETED.getValue())
.in(TaxDeclarationValuePO::getTaxDeclarationId, taxDeclarationIds)
.page(page);
page.setRecords(decryptBatch(page.getRecords(), tenantKey));
return page;
}
@Override
public List<TaxDeclarationValuePO> listByTaxDeclarationIds(Collection<Long> taxDeclarationIds) {
List<TaxDeclarationValuePO> taxDeclarationValues = new LambdaQueryChainWrapper<>(baseMapper)
.eq(TaxDeclarationValuePO::getTenantKey, tenantKey)
.eq(TaxDeclarationValuePO::getDeleteType, DeleteTypeEnum.NOT_DELETED.getValue())
.in(TaxDeclarationValuePO::getTaxDeclarationId, taxDeclarationIds)
.list();
return decryptBatch(taxDeclarationValues);
}
@Override
public List<TaxDeclarationValuePO> listByTaxDeclarationIdsNoDecrypt(Collection<Long> taxDeclarationIds) {
return new LambdaQueryChainWrapper<>(baseMapper)
.eq(TaxDeclarationValuePO::getTenantKey, tenantKey)
.eq(TaxDeclarationValuePO::getDeleteType, DeleteTypeEnum.NOT_DELETED.getValue())
.in(TaxDeclarationValuePO::getTaxDeclarationId, taxDeclarationIds)
.list();
}
@Override
public TaxDeclarationValueListDTO convert2List(TaxDeclarationPO taxDeclaration, List<TaxDeclarationValuePO> taxDeclarationValues) {
// 查询个税申报表表头
IncomeCategoryEnum incomeCategoryEnum = SalaryEnumUtil.enumMatchByValue(taxDeclaration.getIncomeCategory(), IncomeCategoryEnum.class);
List<TaxReportColumnPO> taxReportColumns = taxReportColumnService.listByIncomeCategory(incomeCategoryEnum, tenantKey);
// 人员id
Set<Long> employeeIds = SalaryEntityUtil.properties(taxDeclarationValues, TaxDeclarationValuePO::getEmployeeId);
// 查询报送的人员
List<EmployeeDeclarePO> employeeDeclares = employeeDeclareService.listByTaxCycleAndTaxAgentIdAndEmployeeIds(
YearMonth.parse(taxDeclaration.getTaxCycle()), taxDeclaration.getTaxAgentId(), employeeIds, tenantKey);
// 查询人员信息
List<Long> simpleEmployeeIds = taxDeclarationValues.stream()
.filter(taxDeclarationValue -> Objects.equals(taxDeclarationValue.getEmployeeType(), EmployeeTypeEnum.ORGANIZATION.getValue()))
.map(TaxDeclarationValuePO::getEmployeeId)
.distinct()
.collect(Collectors.toList());
List<SimpleEmployee> simpleEmployees = hrmCommonEmployeeService.getEmployeeByIds(simpleEmployeeIds, tenantKey);
// 查询人员薪资身份证号码等
List<SimpleUserInfo> simpleUserInfos = salaryEmployeeService.listByEmployeeIds(simpleEmployeeIds, tenantKey);
// 查询外部人员
Set<Long> extEmployeeIds = taxDeclarationValues.stream()
.filter(taxDeclarationValue -> Objects.equals(taxDeclarationValue.getEmployeeType(), EmployeeTypeEnum.EXT_EMPLOYEE.getValue()))
.map(TaxDeclarationValuePO::getEmployeeId)
.collect(Collectors.toSet());
List<ExtEmployeePO> extEmployees = extEmployeeService.listByIdsWithDeleted(extEmployeeIds, tenantKey);
// 列表表头
List<WeaTableColumn> weaTableColumns = TaxDeclarationValueList.buildTableColumns(taxReportColumns);
// 列表数据
List<Map<String, Object>> data = TaxDeclarationValueList.buildTableData(incomeCategoryEnum, taxReportColumns, taxDeclarationValues,
employeeDeclares, simpleEmployees, simpleUserInfos, extEmployees);
return new TaxDeclarationValueListDTO().setColumns(weaTableColumns).setData(data);
}
@Override
public void batchSave(List<TaxDeclarationValuePO> taxDeclarationValues) {
if (CollectionUtils.isNotEmpty(taxDeclarationValues)) {
// 加密
taxDeclarationValues.forEach(taxDeclarationValue ->
taxDeclarationValue.setResultValueJson(JsonUtil.toJsonString(taxDeclarationValue.getResultValue())));
taxDeclarationValues = dataSecurityService.encryptBatch(taxDeclarationValues, TaxDeclarationValuePO.class, tenantKey);
// 分批保存
int batchSize = SalaryPageUtil.getBatchSize();
List<List<TaxDeclarationValuePO>> partition = Lists.partition(taxDeclarationValues, batchSize);
for (List<TaxDeclarationValuePO> subTaxDeclarationValues : partition) {
baseMapper.batchInsert(subTaxDeclarationValues);
}
}
}
@Override
public void deleteByTaxDeclareRecordIds(Collection<Long> taxDeclareRecordIds) {
if (CollectionUtils.isEmpty(taxDeclareRecordIds)) {
return;
}
new LambdaUpdateChainWrapper<>(baseMapper)
.eq(TaxDeclarationValuePO::getTenantKey, tenantKey)
.eq(TaxDeclarationValuePO::getDeleteType, DeleteTypeEnum.NOT_DELETED.getValue())
.in(TaxDeclarationValuePO::getTaxDeclareRecordId, taxDeclareRecordIds)
.set(TaxDeclarationValuePO::getDeleteType, DeleteTypeEnum.PHYSICAL_DELETED.getValue())
.set(TaxDeclarationValuePO::getUpdateTime, LocalDateTime.now())
.update();
}
private List<TaxDeclarationValuePO> decryptBatch(List<TaxDeclarationValuePO> taxDeclarationValues) {
if (CollectionUtils.isEmpty(taxDeclarationValues)) {
return Collections.emptyList();
}
// 解密
taxDeclarationValues = dataSecurityService.decryptBatch(taxDeclarationValues, TaxDeclarationValuePO.class, tenantKey);
taxDeclarationValues.forEach(salaryAcctResultValue -> {
salaryAcctResultValue.setResultValue(JsonUtil.parseMap(salaryAcctResultValue.getResultValueJson(), String.class));
});
return taxDeclarationValues;
}
}

View File

@ -0,0 +1,101 @@
package com.engine.salary.service.impl;
import com.engine.core.impl.Service;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.entity.employeedeclare.po.EmployeeDeclarePO;
import com.engine.salary.entity.extemp.po.ExtEmpPO;
import com.engine.salary.entity.taxdeclaration.bo.TaxDeclareEmployeeBO;
import com.engine.salary.entity.taxdeclaration.dto.AbnormalEmployeeListDTO;
import com.engine.salary.entity.taxdeclaration.param.AbnormalEmployeeListQueryParam;
import com.engine.salary.entity.taxdeclaration.po.TaxDeclareEmployeePO;
import com.engine.salary.entity.taxdeclaration.po.TaxDeclareRecordPO;
import com.engine.salary.enums.salaryaccounting.EmployeeTypeEnum;
import com.engine.salary.mapper.taxdeclaration.TaxDeclarationDetailMapper;
import com.engine.salary.service.EmployeeDeclareService;
import com.engine.salary.service.ExtEmpService;
import com.engine.salary.service.SalaryEmployeeService;
import com.engine.salary.service.TaxDeclareEmployeeService;
import com.engine.salary.util.SalaryDateUtil;
import com.engine.salary.util.SalaryEntityUtil;
import com.engine.salary.util.page.PageInfo;
import com.engine.salary.util.page.SalaryPageUtil;
import org.apache.commons.collections4.CollectionUtils;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;
/**
* @description: 个税申报表明细中的人员
* @author: xiajun
* @modified By: xiajun
* @date: Created in 2022/11/10 4:12 PM
* @version:v1.0
*/
public class TaxDeclareEmployeeServiceImpl extends Service implements TaxDeclareEmployeeService {
// private TaxDeclarationValueMapper taxDeclarationValueMapper;
private TaxDeclarationDetailMapper taxDeclarationValueMapper;
private SalaryEmployeeService hrmCommonEmployeeService;
private SalaryEmployeeService salaryEmployeeService;
private ExtEmpService extEmployeeService;
private EmployeeDeclareService employeeDeclareService;
@Override
public PageInfo<TaxDeclareEmployeePO> listPage4NotDeclareByParam(AbnormalEmployeeListQueryParam queryParam) {
List<TaxDeclareEmployeePO> list = taxDeclarationValueMapper.listPage4NotDeclareByParam(queryParam);
return SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), list, TaxDeclareEmployeePO.class);
}
@Override
public List<TaxDeclareEmployeePO> list4NotDeclareByParam(AbnormalEmployeeListQueryParam queryParam) {
return taxDeclarationValueMapper.list4NotDeclareByParam(queryParam);
}
@Override
public PageInfo<TaxDeclareEmployeePO> listPage4NoValueByParam(AbnormalEmployeeListQueryParam queryParam) {
List<TaxDeclareEmployeePO> list = taxDeclarationValueMapper.listPage4NoValueByParam(queryParam);
return SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), list, TaxDeclareEmployeePO.class);
}
@Override
public List<TaxDeclareEmployeePO> list4NoValueByParam(AbnormalEmployeeListQueryParam queryParam) {
return taxDeclarationValueMapper.list4NoValueByParam(queryParam);
}
@Override
public List<AbnormalEmployeeListDTO> convert2AbnormalEmployeeList(TaxDeclareRecordPO taxDeclareRecord, List<TaxDeclareEmployeePO> taxDeclareEmployees) {
if (CollectionUtils.isEmpty(taxDeclareEmployees)) {
return Collections.emptyList();
}
// 人员id
Set<Long> employeeIds = SalaryEntityUtil.properties(taxDeclareEmployees, TaxDeclareEmployeePO::getEmployeeId);
// 查询报送的人员
List<EmployeeDeclarePO> employeeDeclares = employeeDeclareService.listByTaxCycleAndTaxAgentIdAndEmployeeIds(
SalaryDateUtil.localDate2YearMonth(taxDeclareRecord.getTaxCycle()), taxDeclareRecord.getTaxAgentId(), employeeIds);
// 查询人员信息
List<Long> simpleEmployeeIds = taxDeclareEmployees.stream()
.filter(taxDeclarationValue -> Objects.equals(taxDeclarationValue.getEmployeeType(), EmployeeTypeEnum.ORGANIZATION.getValue()))
.map(TaxDeclareEmployeePO::getEmployeeId)
.distinct()
.collect(Collectors.toList());
List<DataCollectionEmployee> simpleEmployees = hrmCommonEmployeeService.getEmployeeByIds(simpleEmployeeIds);
// 查询人员薪资身份证号码等
List<DataCollectionEmployee> simpleUserInfos = salaryEmployeeService.listByIds(simpleEmployeeIds);
// 查询外部人员
List<Long> extEmployeeIds = taxDeclareEmployees.stream()
.filter(taxDeclarationValue -> Objects.equals(taxDeclarationValue.getEmployeeType(), EmployeeTypeEnum.EXT_EMPLOYEE.getValue()))
.map(TaxDeclareEmployeePO::getEmployeeId)
.collect(Collectors.toList());
List<ExtEmpPO> extEmployees = extEmployeeService.getExtEmpByIds(extEmployeeIds);
return TaxDeclareEmployeeBO.convert2AbnormalEmployee(taxDeclareEmployees, employeeDeclares, simpleEmployees, simpleUserInfos, extEmployees);
}
}

View File

@ -0,0 +1,97 @@
package com.engine.salary.service.impl;
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
import com.baomidou.mybatisplus.extension.conditions.update.LambdaUpdateChainWrapper;
import com.engine.core.impl.Service;
import com.engine.salary.entity.taxagent.po.TaxAgentPO;
import com.engine.salary.entity.taxdeclaration.dto.FailEmployeeListDTO;
import com.engine.salary.entity.taxdeclaration.po.TaxDeclareFailPO;
import com.engine.salary.entity.taxdeclaration.po.TaxDeclareRecordPO;
import com.engine.salary.enums.salarysob.IncomeCategoryEnum;
import com.engine.salary.service.TaxAgentService;
import com.engine.salary.service.TaxDeclareFailService;
import com.engine.salary.util.SalaryI18nUtil;
import com.engine.salary.util.page.PageInfo;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.weaver.common.component.table.page.Page;
import com.weaver.hrm.salary.dao.TaxDeclareFailMapper;
import com.weaver.hrm.salary.enums.sicategory.DeleteTypeEnum;
import org.apache.commons.collections4.CollectionUtils;
import java.time.LocalDateTime;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import static com.engine.salary.entity.siaccount.param.DSTenantKeyThreadVar.tenantKey;
/**
* @description: 个税申报失败数据
* @author: xiajun
* @modified By: xiajun
* @date: Created in 2022/11/30 1:32 PM
* @version:v1.0
*/
public class TaxDeclareFailServiceImpl extends Service implements TaxDeclareFailService {
private TaxDeclareFailMapper taxDeclareFailMapper;
private TaxAgentService taxAgentService;
@Override
public PageInfo<TaxDeclareFailPO> listPageByTaxDeclareRecordIds(Collection<Long> taxDeclareRecordIds) {
return new LambdaQueryChainWrapper<>(taxDeclareFailMapper)
.eq(TaxDeclareFailPO::getTenantKey, tenantKey)
.eq(TaxDeclareFailPO::getDeleteType, DeleteTypeEnum.NOT_DELETED.getValue())
.in(TaxDeclareFailPO::getTaxDeclareRecordId, taxDeclareRecordIds)
.page(page);
}
@Override
public List<TaxDeclareFailPO> listByTaxDeclareRecordIds(Collection<Long> taxDeclareRecordIds) {
return new LambdaQueryChainWrapper<>(taxDeclareFailMapper)
.eq(TaxDeclareFailPO::getTenantKey, tenantKey)
.eq(TaxDeclareFailPO::getDeleteType, DeleteTypeEnum.NOT_DELETED.getValue())
.in(TaxDeclareFailPO::getTaxDeclareRecordId, taxDeclareRecordIds)
.list();
}
@Override
public void deleteByTaxDeclareRecordIds(Collection<Long> taxDeclareRecordIds) {
new LambdaUpdateChainWrapper<>(taxDeclareFailMapper)
.eq(TaxDeclareFailPO::getTenantKey, tenantKey)
.eq(TaxDeclareFailPO::getDeleteType, DeleteTypeEnum.NOT_DELETED.getValue())
.in(TaxDeclareFailPO::getTaxDeclareRecordId, taxDeclareRecordIds)
.set(TaxDeclareFailPO::getDeleteType, DeleteTypeEnum.PHYSICAL_DELETED.getValue())
.set(TaxDeclareFailPO::getUpdateTime, LocalDateTime.now())
.update();
}
@Override
public List<FailEmployeeListDTO> convert2FailEmployeeList(TaxDeclareRecordPO taxDeclareRecord, List<TaxDeclareFailPO> taxDeclareFails) {
if (CollectionUtils.isEmpty(taxDeclareFails)) {
return Collections.emptyList();
}
// 查询个税扣缴义务人
TaxAgentPO taxAgent = taxAgentService.getById(taxDeclareRecord.getTaxAgentId());
Map<String, IncomeCategoryEnum> incomeCategoryEnumMap = Maps.newHashMap();
for (IncomeCategoryEnum incomeCategoryEnum : IncomeCategoryEnum.values()) {
incomeCategoryEnumMap.put(incomeCategoryEnum.getCode(), incomeCategoryEnum);
}
List<FailEmployeeListDTO> dtos = Lists.newArrayList();
for (TaxDeclareFailPO taxDeclareFail : taxDeclareFails) {
IncomeCategoryEnum incomeCategoryEnum = incomeCategoryEnumMap.get(taxDeclareFail.getIncomeCategory());
FailEmployeeListDTO dto = new FailEmployeeListDTO()
.setId(taxDeclareFail.getId())
.setEmployeeName(taxDeclareFail.getEmployeeName())
.setTaxAgentName(taxAgent.getName())
.setCardNum(taxDeclareFail.getCardNum())
.setErrorMsg(taxDeclareFail.getErrorMsg())
.setIncomeCategory(incomeCategoryEnum == null ? "" : SalaryI18nUtil.getI18nLabel(incomeCategoryEnum.getLabelId(), incomeCategoryEnum.getDefaultLabel()));
dtos.add(dto);
}
return dtos;
}
}

View File

@ -0,0 +1,40 @@
package com.engine.salary.service.impl;
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
import com.engine.core.impl.Service;
import com.engine.salary.entity.taxdeclaration.po.TaxReportColumnPO;
import com.engine.salary.enums.salarysob.IncomeCategoryEnum;
import com.engine.salary.service.TaxReportColumnService;
import com.weaver.hrm.salary.constant.SalaryConstant;
import com.weaver.hrm.salary.enums.sicategory.DeleteTypeEnum;
import java.util.List;
/**
* @description: 个税申报表表头
* @author: xiajun
* @modified By: xiajun
* @date: Created in 2022/12/5 6:36 PM
* @version:v1.0
*/
public class TaxReportColumnServiceImpl extends Service implements TaxReportColumnService {
@Override
public List<TaxReportColumnPO> listAll() {
return new LambdaQueryChainWrapper<>(baseMapper)
.eq(TaxReportColumnPO::getTenantKey, SalaryConstant.DEFAULT_TENANT_KEY)
.eq(TaxReportColumnPO::getDeleteType, DeleteTypeEnum.NOT_DELETED.getValue())
.orderByAsc(TaxReportColumnPO::getId)
.list();
}
@Override
public List<TaxReportColumnPO> listByIncomeCategory(IncomeCategoryEnum incomeCategory) {
return new LambdaQueryChainWrapper<>(baseMapper)
.eq(TaxReportColumnPO::getTenantKey, SalaryConstant.DEFAULT_TENANT_KEY)
.eq(TaxReportColumnPO::getDeleteType, DeleteTypeEnum.NOT_DELETED.getValue())
.eq(TaxReportColumnPO::getIncomeCategory, incomeCategory.getValue())
.orderByAsc(TaxReportColumnPO::getId)
.list();
}
}

View File

@ -166,7 +166,7 @@ public class TaxDeclarationController {
taxDeclareRecordWrapper.updateIcon(param.getTaxDeclareRecordId(), UserContext.getCurrentEmployeeId(), TenantContext.getCurrentTenantKey()); taxDeclareRecordWrapper.updateIcon(param.getTaxDeclareRecordId(), UserContext.getCurrentEmployeeId(), TenantContext.getCurrentTenantKey());
return WeaResult.success(null); return WeaResult.success(null);
User user = HrmUserVarify.getUser(request, response); User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<Long, TaxDeclarationInfoDTO>(user).run(getTaxDeclarationWrapper(user)::getTaxDeclarationInfoById, taxDeclarationId); return new ResponseResult<Long, TaxDeclarationInfoDTO>(user).run(getTaxDeclareRecordWrapper(user)::updateIcon, taxDeclarationId);
} }
/** /**

View File

@ -1,50 +1,38 @@
package com.engine.salary.wrapper; package com.engine.salary.wrapper;
import com.engine.core.impl.Service; import com.engine.core.impl.Service;
import com.engine.salary.service.SalaryCacheService; import com.engine.salary.cache.SalaryCacheKey;
import com.engine.salary.service.TaxAgentService; import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.service.TaxDeclarationExcelService; import com.engine.salary.entity.taxagent.po.TaxAgentPO;
import com.engine.salary.service.TaxDeclarationService; import com.engine.salary.entity.taxdeclaration.dto.*;
import com.weaver.common.component.form.WeaForm; import com.engine.salary.entity.taxdeclaration.param.AbnormalEmployeeListQueryParam;
import com.weaver.common.component.table.WeaTable; import com.engine.salary.entity.taxdeclaration.param.TaxDeclarationListQueryParam;
import com.weaver.common.component.table.page.Page; import com.engine.salary.entity.taxdeclaration.param.TaxDeclarationSaveParam;
import com.weaver.common.component.table.permission.Permission; import com.engine.salary.entity.taxdeclaration.param.TaxDeclarationValueListQueryParam;
import com.weaver.common.distribution.genid.IdGenerator; import com.engine.salary.entity.taxdeclaration.po.*;
import com.weaver.common.hr.util.Util; import com.engine.salary.enums.salarysob.IncomeCategoryEnum;
import com.weaver.common.hrm.service.HrmCommonEmployeeService; import com.engine.salary.enums.taxdeclaration.TaxDeclareStatusEnum;
import com.weaver.common.threadPool.ThreadPoolUtil; import com.engine.salary.enums.taxdeclaration.TaxDeclareTypeEnum;
import com.weaver.common.threadPool.constant.ModulePoolEnum; import com.engine.salary.exception.SalaryRunTimeException;
import com.weaver.common.threadPool.entity.LocalRunnable; import com.engine.salary.service.*;
import com.weaver.datasecurity.interceptor.DSTenantKeyThreadVar; import com.engine.salary.util.SalaryDateUtil;
import com.weaver.framework.util.JsonUtil; import com.engine.salary.util.SalaryEntityUtil;
import com.weaver.hrm.salary.cache.SalaryCacheKey; import com.engine.salary.util.SalaryEnumUtil;
import com.weaver.hrm.salary.common.excel.ExcelExportParam; import com.engine.salary.util.SalaryI18nUtil;
import com.weaver.hrm.salary.constant.SalaryConstant; import com.engine.salary.util.page.PageInfo;
import com.weaver.hrm.salary.entity.taxagent.po.TaxAgentPO; import com.engine.salary.util.page.SalaryPageUtil;
import com.weaver.hrm.salary.entity.taxdeclaration.dto.*; import com.weaver.util.threadPool.ThreadPoolUtil;
import com.weaver.hrm.salary.entity.taxdeclaration.param.AbnormalEmployeeListQueryParam; import com.weaver.util.threadPool.constant.ModulePoolEnum;
import com.weaver.hrm.salary.entity.taxdeclaration.param.TaxDeclarationListQueryParam; import com.weaver.util.threadPool.entity.LocalRunnable;
import com.weaver.hrm.salary.entity.taxdeclaration.param.TaxDeclarationSaveParam; import dm.jdbc.util.IdGenerator;
import com.weaver.hrm.salary.entity.taxdeclaration.param.TaxDeclarationValueListQueryParam;
import com.weaver.hrm.salary.entity.taxdeclaration.po.*;
import com.weaver.hrm.salary.enums.salarysob.IncomeCategoryEnum;
import com.weaver.hrm.salary.enums.taxdeclaration.TaxAgentRangeEnum;
import com.weaver.hrm.salary.enums.taxdeclaration.TaxDeclareStatusEnum;
import com.weaver.hrm.salary.enums.taxdeclaration.TaxDeclareTypeEnum;
import com.weaver.hrm.salary.exception.SalaryNullException;
import com.weaver.hrm.salary.exception.SalaryRunTimeException;
import com.weaver.hrm.salary.service.*;
import com.weaver.hrm.salary.util.*;
import com.weaver.teams.domain.EntityType;
import com.weaver.teams.domain.user.SimpleEmployee;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.compress.utils.Lists; import org.apache.commons.compress.utils.Lists;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils; import org.apache.commons.lang3.math.NumberUtils;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import weaver.general.Util;
import java.time.YearMonth;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -64,7 +52,7 @@ public class TaxDeclareRecordWrapper extends Service {
private TaxAgentService taxAgentService; private TaxAgentService taxAgentService;
private HrmCommonEmployeeService hrmCommonEmployeeService; private SalaryEmployeeService hrmCommonEmployeeService;
private SalaryCacheService salaryCacheService; private SalaryCacheService salaryCacheService;
@ -82,25 +70,25 @@ public class TaxDeclareRecordWrapper extends Service {
* 个税申报记录列表 * 个税申报记录列表
* *
* @param queryParam * @param queryParam
* @param employeeId
* @param tenantKey
* @return * @return
*/ */
public WeaTable<TaxDeclareRecordListDTO> listPage(TaxDeclarationListQueryParam queryParam, Long employeeId, String tenantKey) { public PageInfo<TaxDeclareRecordListDTO> listPage(TaxDeclarationListQueryParam queryParam) {
Page<TaxDeclareRecordPO> page = taxDeclareRecordService.listPageByParam(queryParam, employeeId, tenantKey); PageInfo<TaxDeclareRecordPO> page = taxDeclareRecordService.listPageByParam(queryParam);
Page<TaxDeclareRecordListDTO> dtoPage = new Page<>(page.getCurrent(), page.getSize(), page.getTotal(), page.isSearchCount()); List<TaxDeclareRecordPO> list = page.getList();
if (CollectionUtils.isNotEmpty(page.getRecords())) {
PageInfo<TaxDeclareRecordListDTO> dtoPage = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), TaxDeclareRecordListDTO.class);
if (CollectionUtils.isNotEmpty(list)) {
// 查询个税扣缴义务人 // 查询个税扣缴义务人
Set<Long> taxAgentIds = SalaryEntityUtil.properties(page.getRecords(), TaxDeclareRecordPO::getTaxAgentId); Set<Long> taxAgentIds = SalaryEntityUtil.properties(list, TaxDeclareRecordPO::getTaxAgentId);
List<TaxAgentPO> taxAgents = taxAgentService.listByIds(taxAgentIds, tenantKey); List<TaxAgentPO> taxAgents = taxAgentService.listByIds(taxAgentIds);
// 查询人员姓名 // 查询人员姓名
List<Long> employeeIds = SalaryEntityUtil.properties(page.getRecords(), TaxDeclareRecordPO::getCreator, Collectors.toList()); List<Long> employeeIds = SalaryEntityUtil.properties(list, TaxDeclareRecordPO::getCreator, Collectors.toList());
List<SimpleEmployee> simpleEmployees = hrmCommonEmployeeService.getEmployeeByIds(employeeIds, tenantKey); List<DataCollectionEmployee> simpleEmployees = hrmCommonEmployeeService.getEmployeeByIds(employeeIds);
List<TaxDeclareRecordListDTO> dtoList = Lists.newArrayList(); List<TaxDeclareRecordListDTO> dtoList = Lists.newArrayList();
Map<Long, String> taxAgentNameMap = SalaryEntityUtil.convert2Map(taxAgents, TaxAgentPO::getId, TaxAgentPO::getName); Map<Long, String> taxAgentNameMap = SalaryEntityUtil.convert2Map(taxAgents, TaxAgentPO::getId, TaxAgentPO::getName);
Map<Long, String> simpleEmployeeNameMap = SalaryEntityUtil.convert2Map(simpleEmployees, SimpleEmployee::getEmployeeId, SimpleEmployee::getName); Map<Long, String> simpleEmployeeNameMap = SalaryEntityUtil.convert2Map(simpleEmployees, DataCollectionEmployee::getEmployeeId, DataCollectionEmployee::getUsername);
for (TaxDeclareRecordPO taxDeclareRecord : page.getRecords()) { for (TaxDeclareRecordPO taxDeclareRecord : list) {
TaxDeclareTypeEnum taxDeclareTypeEnum = SalaryEnumUtil.enumMatchByValue(taxDeclareRecord.getTaxDeclareType(), TaxDeclareTypeEnum.class); TaxDeclareTypeEnum taxDeclareTypeEnum = SalaryEnumUtil.enumMatchByValue(taxDeclareRecord.getTaxDeclareType(), TaxDeclareTypeEnum.class);
TaxDeclareStatusEnum taxDeclareStatusEnum = SalaryEnumUtil.enumMatchByValue(taxDeclareRecord.getTaxDeclareStatus(), TaxDeclareStatusEnum.class); TaxDeclareStatusEnum taxDeclareStatusEnum = SalaryEnumUtil.enumMatchByValue(taxDeclareRecord.getTaxDeclareStatus(), TaxDeclareStatusEnum.class);
TaxDeclareRecordListDTO taxDeclareRecordListDTO = new TaxDeclareRecordListDTO() TaxDeclareRecordListDTO taxDeclareRecordListDTO = new TaxDeclareRecordListDTO()
@ -121,195 +109,152 @@ public class TaxDeclareRecordWrapper extends Service {
.setDisplayIcon(Objects.equals(taxDeclareRecord.getDisplayUpdateIcon(), 1)); .setDisplayIcon(Objects.equals(taxDeclareRecord.getDisplayUpdateIcon(), 1));
dtoList.add(taxDeclareRecordListDTO); dtoList.add(taxDeclareRecordListDTO);
} }
dtoPage.setRecords(dtoList); dtoPage.setList(dtoList);
} }
// 转换成前端所需的数据格式 return dtoPage;
WeaTable<TaxDeclareRecordListDTO> weaTable = SalaryFormatUtil.<TaxDeclareRecordListDTO>getInstance()
.buildTable(TaxDeclareRecordListDTO.class, dtoPage);
for (int i = 0; i < dtoPage.getRecords().size(); i++) {
TaxDeclareRecordListDTO dto = dtoPage.getRecords().get(i);
List<Permission> permissions = weaTable.getOperatesPermission().get(i);
for (int j = 0; j < permissions.size(); j++) {
Permission permission = permissions.get(j);
if (j == 1 && (dto.getTaxDeclareStatus() != TaxDeclareStatusEnum.NOT_DECLARE || dto.getTaxDeclareType() != TaxDeclareTypeEnum.NORMAL_DECLARE)) {
permission.setVisible(false);
permission.setDisabled(false);
}
}
}
return weaTable;
} }
/** /**
* 个税申报表明细列表 * 个税申报表明细列表
* *
* @param queryParam 列表查询条件 * @param queryParam 列表查询条件
* @param tenantKey 租户key
* @return * @return
*/ */
public WeaTable<?> listValuePage(TaxDeclarationValueListQueryParam queryParam, Long employeeId, String tenantKey) { public PageInfo listValuePage(TaxDeclarationValueListQueryParam queryParam) {
// 查询个税申报表 // 查询个税申报表
TaxDeclarationPO taxDeclaration = taxDeclarationService.getById(queryParam.getTaxDeclarationId(), tenantKey); TaxDeclarationPO taxDeclaration = taxDeclarationService.getById(queryParam.getTaxDeclarationId());
// 判断是否有权限查看 // 判断是否有权限查看
boolean canSee = taxDeclareRecordService.checkByAuthority(taxDeclaration, employeeId, tenantKey); boolean canSee = taxDeclareRecordService.checkByAuthority(taxDeclaration);
if (!canSee) { if (!canSee) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(156515, "对不起,您暂时没有权限查看")); throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(156515, "对不起,您暂时没有权限查看"));
} }
String pageUid = "taxDeclarationValueList";
SalaryPageUtil.handlePageSize(pageUid, queryParam);
// 查询个税申报表详情 // 查询个税申报表详情
Page<TaxDeclarationValuePO> page = taxDeclarationValueService.listPageByTaxDeclarationIds( PageInfo<TaxDeclarationValuePO> page = taxDeclarationValueService.listPageByTaxDeclarationIds(Collections.singleton(queryParam.getTaxDeclarationId()));
new Page<>(queryParam.getCurrent(), queryParam.getPageSize(), true), Collections.singleton(queryParam.getTaxDeclarationId()), tenantKey); TaxDeclarationValueListDTO taxDeclarationValueListDTO = taxDeclarationValueService.convert2List(taxDeclaration, page.getList());
TaxDeclarationValueListDTO taxDeclarationValueListDTO = taxDeclarationValueService.convert2List(taxDeclaration, page.getRecords(), tenantKey); PageInfo<Map<String, Object>> dtoPage = new PageInfo();
Page<Map<String, Object>> dtoPage = new Page<>(page.getCurrent(), page.getSize(), page.getTotal(), page.isSearchCount()); dtoPage.setList(taxDeclarationValueListDTO.getData());
dtoPage.setRecords(taxDeclarationValueListDTO.getData()); return dtoPage;
// 转成前端所需的格式
WeaTable<Map<String, Object>> weaTable = new WeaTable<>();
weaTable.setColumns(taxDeclarationValueListDTO.getColumns());
weaTable.setPage(dtoPage);
weaTable.setModule(SalaryConstant.MODULE);
weaTable.setPageUid(pageUid);
return weaTable;
} }
/** /**
* 未报送的人员列表 * 未报送的人员列表
* *
* @param queryParam * @param queryParam
* @param tenantKey
* @return * @return
*/ */
public WeaTable<AbnormalEmployeeListDTO> listEmployeePage4NotDeclare(AbnormalEmployeeListQueryParam queryParam, String tenantKey) { public PageInfo<AbnormalEmployeeListDTO> listEmployeePage4NotDeclare(AbnormalEmployeeListQueryParam queryParam) {
String pageUid = "abnormalEmployeeList4NoDeclare"; return listEmployeePage("NotDeclare", queryParam);
SalaryPageUtil.handlePageSize(pageUid, queryParam);
WeaTable<AbnormalEmployeeListDTO> weaTable = listEmployeePage("NotDeclare", queryParam, tenantKey);
weaTable.setPageUid(pageUid);
return weaTable;
} }
/** /**
* 没有申报数据的人员列表 * 没有申报数据的人员列表
* *
* @param queryParam * @param queryParam
* @param tenantKey
* @return * @return
*/ */
public WeaTable<AbnormalEmployeeListDTO> listEmployeePage4NoValue(AbnormalEmployeeListQueryParam queryParam, String tenantKey) { public PageInfo<AbnormalEmployeeListDTO> listEmployeePage4NoValue(AbnormalEmployeeListQueryParam queryParam) {
String pageUid = "abnormalEmployeeList4NoValue"; return listEmployeePage("NoValue", queryParam);
SalaryPageUtil.handlePageSize(pageUid, queryParam);
WeaTable<AbnormalEmployeeListDTO> weaTable = listEmployeePage("NoValue", queryParam, tenantKey);
weaTable.setPageUid(pageUid);
return weaTable;
} }
/** /**
* 申报失败的人员列表 * 申报失败的人员列表
* *
* @param queryParam * @param queryParam
* @param tenantKey
* @return * @return
*/ */
public WeaTable<FailEmployeeListDTO> listEmployeePage4Fail(AbnormalEmployeeListQueryParam queryParam, String tenantKey) { public PageInfo<FailEmployeeListDTO> listEmployeePage4Fail(AbnormalEmployeeListQueryParam queryParam) {
String pageUid = "failEmployeeList";
SalaryPageUtil.handlePageSize(pageUid, queryParam);
// 查询个税申报记录 // 查询个税申报记录
TaxDeclareRecordPO taxDeclareRecord = taxDeclareRecordService.getById(queryParam.getTaxDeclareRecordId(), tenantKey); TaxDeclareRecordPO taxDeclareRecord = taxDeclareRecordService.getById(queryParam.getTaxDeclareRecordId());
// 查询申报失败的数据 // 查询申报失败的数据
Page<TaxDeclareFailPO> page = new Page<>(queryParam.getCurrent(), queryParam.getPageSize(), true); PageInfo<TaxDeclareFailPO> taxDeclareFailPOPageInfo = taxDeclareFailService.listPageByTaxDeclareRecordIds(Collections.singleton(taxDeclareRecord.getId()));
page = taxDeclareFailService.listPageByTaxDeclareRecordIds(page, Collections.singleton(taxDeclareRecord.getId()), tenantKey); List list = taxDeclareFailPOPageInfo.getList();
// 转换成dto // 转换成dto
Page<FailEmployeeListDTO> dtoPage = new Page<>(page.getCurrent(), page.getSize(), page.getTotal(), page.isSearchCount()); PageInfo<FailEmployeeListDTO> dtoPage = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), FailEmployeeListDTO.class);
dtoPage.setRecords(taxDeclareFailService.convert2FailEmployeeList(taxDeclareRecord, page.getRecords(), tenantKey)); dtoPage.setList(taxDeclareFailService.convert2FailEmployeeList(taxDeclareRecord, list));
// 转成前端所需的格式 // 转成前端所需的格式
return SalaryFormatUtil.<FailEmployeeListDTO>getInstance().buildTable(FailEmployeeListDTO.class, dtoPage); return dtoPage;
} }
private WeaTable<AbnormalEmployeeListDTO> listEmployeePage(String key, AbnormalEmployeeListQueryParam queryParam, String tenantKey) { private PageInfo<AbnormalEmployeeListDTO> listEmployeePage(String key, AbnormalEmployeeListQueryParam queryParam) {
WeaTable<AbnormalEmployeeListDTO> weaTable;
// 查询个税申报记录 // 查询个税申报记录
TaxDeclareRecordPO taxDeclareRecord = taxDeclareRecordService.getById(queryParam.getTaxDeclareRecordId(), tenantKey); TaxDeclareRecordPO taxDeclareRecord = taxDeclareRecordService.getById(queryParam.getTaxDeclareRecordId());
queryParam.setTaxAgentId(taxDeclareRecord.getTaxAgentId()); queryParam.setTaxAgentId(taxDeclareRecord.getTaxAgentId());
queryParam.setTaxCycle(taxDeclareRecord.getTaxCycle()); queryParam.setTaxCycle(taxDeclareRecord.getTaxCycle());
if (StringUtils.isEmpty(queryParam.getKeyword())) { if (StringUtils.isEmpty(queryParam.getKeyword())) {
// 查询个税申报记录的人员 // 查询个税申报记录的人员
Page<TaxDeclareEmployeePO> page = new Page<>(queryParam.getCurrent(), queryParam.getPageSize(), true); PageInfo<TaxDeclareEmployeePO> page = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), TaxDeclareEmployeePO.class);
if (StringUtils.equals("NotDeclare", key)) { if (StringUtils.equals("NotDeclare", key)) {
page = taxDeclareEmployeeService.listPage4NotDeclareByParam(queryParam, tenantKey); page = taxDeclareEmployeeService.listPage4NotDeclareByParam(queryParam);
} else if (StringUtils.equals("NoValue", key)) { } else if (StringUtils.equals("NoValue", key)) {
page = taxDeclareEmployeeService.listPage4NoValueByParam(queryParam, tenantKey); page = taxDeclareEmployeeService.listPage4NoValueByParam(queryParam);
} }
Page<AbnormalEmployeeListDTO> dtoPage = new Page<>(page.getCurrent(), page.getSize(), page.getTotal(), page.isSearchCount()); PageInfo<AbnormalEmployeeListDTO> dtoPage = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), AbnormalEmployeeListDTO.class);
dtoPage.setRecords(taxDeclareEmployeeService.convert2AbnormalEmployeeList(taxDeclareRecord, page.getRecords(), tenantKey)); dtoPage.setList(taxDeclareEmployeeService.convert2AbnormalEmployeeList(taxDeclareRecord, page.getList()));
// 转换成前端所需的格式 return dtoPage;
weaTable = SalaryFormatUtil.<AbnormalEmployeeListDTO>getInstance().buildTable(AbnormalEmployeeListDTO.class, dtoPage);
} else { } else {
// 查询条件中包含"keyword"不好通过SQL分页所以在内存中分页 // 查询条件中包含"keyword"不好通过SQL分页所以在内存中分页
List<TaxDeclareEmployeePO> taxDeclareEmployees = Collections.emptyList(); List<TaxDeclareEmployeePO> taxDeclareEmployees = Collections.emptyList();
if (StringUtils.equals("NotDeclare", key)) { if (StringUtils.equals("NotDeclare", key)) {
taxDeclareEmployees = taxDeclareEmployeeService.list4NotDeclareByParam(queryParam, tenantKey); taxDeclareEmployees = taxDeclareEmployeeService.list4NotDeclareByParam(queryParam);
} else if (StringUtils.equals("NoValue", key)) { } else if (StringUtils.equals("NoValue", key)) {
taxDeclareEmployees = taxDeclareEmployeeService.list4NoValueByParam(queryParam, tenantKey); taxDeclareEmployees = taxDeclareEmployeeService.list4NoValueByParam(queryParam);
} }
List<AbnormalEmployeeListDTO> dtos = taxDeclareEmployeeService.convert2AbnormalEmployeeList(taxDeclareRecord, taxDeclareEmployees, tenantKey) List<AbnormalEmployeeListDTO> dtos = taxDeclareEmployeeService.convert2AbnormalEmployeeList(taxDeclareRecord, taxDeclareEmployees)
.stream() .stream()
.filter(e -> StringUtils.contains(e.getEmployeeName(), queryParam.getKeyword()) .filter(e -> StringUtils.contains(e.getEmployeeName(), queryParam.getKeyword())
|| StringUtils.contains(e.getJobNum(), queryParam.getKeyword()) || StringUtils.contains(e.getJobNum(), queryParam.getKeyword())
|| StringUtils.contains(e.getCardNum(), queryParam.getKeyword())) || StringUtils.contains(e.getCardNum(), queryParam.getKeyword()))
.collect(Collectors.toList()); .collect(Collectors.toList());
Page<AbnormalEmployeeListDTO> dtoPage = new Page<>(queryParam.getCurrent(), queryParam.getPageSize(), dtos.size(), true); PageInfo<AbnormalEmployeeListDTO> dtoPage = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), dtos, AbnormalEmployeeListDTO.class);
dtoPage.setRecords(SalaryPageUtil.subList((int) dtoPage.getCurrent(), (int) dtoPage.getSize(), dtos)); return dtoPage;
// 转换成前端所需的格式
weaTable = SalaryFormatUtil.<AbnormalEmployeeListDTO>getInstance().buildTable(AbnormalEmployeeListDTO.class, dtoPage);
} }
return weaTable;
} }
/** // /**
* 获取个税申报记录的表单 // * 获取个税申报记录的表单
* // *
* @param id // * @param id
* @param tenantKey // * @param tenantKey
* @return // * @return
*/ // */
public WeaForm getForm(Long id, Long employeeId, String tenantKey) { // public WeaForm getForm(Long id) {
TaxDeclareRecordFormDTO formDTO = new TaxDeclareRecordFormDTO(); // TaxDeclareRecordFormDTO formDTO = new TaxDeclareRecordFormDTO();
formDTO.setTaxAgentRange(TaxAgentRangeEnum.SELECT_TAX_AGENT); // formDTO.setTaxAgentRange(TaxAgentRangeEnum.SELECT_TAX_AGENT);
// 判断当前是否开启了分权 // // 判断当前是否开启了分权
Boolean openDevolution = taxAgentService.isOpenDevolution(tenantKey); // Boolean openDevolution = taxAgentService.isOpenDevolution(tenantKey);
Boolean isChief = taxAgentService.isChief(employeeId, tenantKey); // Boolean isChief = taxAgentService.isChief(employeeId);
// 转换成前端所需的数据格式 // // 转换成前端所需的数据格式
WeaForm weaForm = SalaryFormatUtil.<TaxDeclareRecordFormDTO>getInstance().buildForm(TaxDeclareRecordFormDTO.class, formDTO); // WeaForm weaForm = SalaryFormatUtil.<TaxDeclareRecordFormDTO>getInstance().buildForm(TaxDeclareRecordFormDTO.class, formDTO);
weaForm.getItems().forEach((k, v) -> { // weaForm.getItems().forEach((k, v) -> {
if (StringUtils.equals("salaryMonth", k)) { // if (StringUtils.equals("salaryMonth", k)) {
Map<String, Object> otherParams = new HashMap<>(); // Map<String, Object> otherParams = new HashMap<>();
otherParams.put("type", "month"); // otherParams.put("type", "month");
v.setOtherParams(otherParams); // v.setOtherParams(otherParams);
} // }
// 未开启分权没有"作为管理员的个税扣缴义务人" // // 未开启分权没有"作为管理员的个税扣缴义务人"
if (!openDevolution && StringUtils.equals("taxAgentRange", k)) { // if (!openDevolution && StringUtils.equals("taxAgentRange", k)) {
v.getOptions().remove(1); // v.getOptions().remove(1);
} // }
// 开启分权但不是总管理员没有"所有个税扣缴义务人" // // 开启分权但不是总管理员没有"所有个税扣缴义务人"
if (openDevolution && !isChief && StringUtils.equals("taxAgentRange", k)) { // if (openDevolution && !isChief && StringUtils.equals("taxAgentRange", k)) {
v.getOptions().remove(0); // v.getOptions().remove(0);
} // }
}); // });
return weaForm; // return weaForm;
} // }
/** /**
* 获取个税申报记录下的个税申报表TAB * 获取个税申报记录下的个税申报表TAB
* *
* @param id * @param id
* @param tenantKey
* @return * @return
*/ */
public List<TaxDeclarationTabDTO> getTaxDeclarationTab(Long id, Long employeeId, String tenantKey) { public List<TaxDeclarationTabDTO> getTaxDeclarationTab(Long id, Long employeeId) {
// 查询个税申报记录 // 查询个税申报记录
TaxDeclareRecordPO taxDeclareRecord = taxDeclareRecordService.getById(id, tenantKey); TaxDeclareRecordPO taxDeclareRecord = taxDeclareRecordService.getById(id);
// 查询个税申报记录下的个税申报表 // 查询个税申报记录下的个税申报表
List<TaxDeclarationPO> taxDeclarations = taxDeclarationService.listByTaxCycleAndTaxAgentIds(YearMonth.parse(taxDeclareRecord.getTaxCycle()), List<TaxDeclarationPO> taxDeclarations = taxDeclarationService.listByTaxCycleAndTaxAgentIds(SalaryDateUtil.localDate2YearMonth(taxDeclareRecord.getTaxCycle()),
Collections.singleton(taxDeclareRecord.getTaxAgentId()), tenantKey); Collections.singleton(taxDeclareRecord.getTaxAgentId()));
taxDeclarations = taxDeclarations.stream() taxDeclarations = taxDeclarations.stream()
.filter(e -> Objects.equals(e.getControlView(), 0) || Objects.equals(e.getCreator(), employeeId)) .filter(e -> Objects.equals(e.getControlView(), 0) || Objects.equals(e.getCreator(), employeeId))
.collect(Collectors.toList()); .collect(Collectors.toList());
@ -332,12 +277,11 @@ public class TaxDeclareRecordWrapper extends Service {
* 查询个税申报表的基本信息 * 查询个税申报表的基本信息
* *
* @param id 个税申报表id * @param id 个税申报表id
* @param tenantKey 租户key
* @return * @return
*/ */
public TaxDeclarationInfoDTO getTaxDeclarationInfoById(Long id, String tenantKey) { public TaxDeclarationInfoDTO getTaxDeclarationInfoById(Long id) {
// 查询个税申报表 // 查询个税申报表
TaxDeclareRecordPO taxDeclareRecord = taxDeclareRecordService.getById(id, tenantKey); TaxDeclareRecordPO taxDeclareRecord = taxDeclareRecordService.getById(id);
if (Objects.isNull(taxDeclareRecord)) { if (Objects.isNull(taxDeclareRecord)) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98877, "个税申报表不存在或已删除")); throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98877, "个税申报表不存在或已删除"));
} }
@ -346,58 +290,55 @@ public class TaxDeclareRecordWrapper extends Service {
.setTaxAgentId(taxDeclareRecord.getTaxAgentId()) .setTaxAgentId(taxDeclareRecord.getTaxAgentId())
.setTaxCycle(taxDeclareRecord.getTaxCycle()); .setTaxCycle(taxDeclareRecord.getTaxCycle());
// 查询是否存在有未报送的人 // 查询是否存在有未报送的人
List<TaxDeclareEmployeePO> notDeclareTaxDeclareEmployees = taxDeclareEmployeeService.list4NotDeclareByParam(queryParam, tenantKey); List<TaxDeclareEmployeePO> notDeclareTaxDeclareEmployees = taxDeclareEmployeeService.list4NotDeclareByParam(queryParam);
// 查询是否存在没有申报数据的人 // 查询是否存在没有申报数据的人
List<TaxDeclareEmployeePO> noValueTaxDeclareEmployees = taxDeclareEmployeeService.list4NoValueByParam(queryParam, tenantKey); List<TaxDeclareEmployeePO> noValueTaxDeclareEmployees = taxDeclareEmployeeService.list4NoValueByParam(queryParam);
// 查询是否存在申报失败的人 // 查询是否存在申报失败的人
List<TaxDeclareFailPO> taxDeclareFails = taxDeclareFailService.listByTaxDeclareRecordIds(Collections.singleton(taxDeclareRecord.getId()), tenantKey); List<TaxDeclareFailPO> taxDeclareFails = taxDeclareFailService.listByTaxDeclareRecordIds(Collections.singleton(taxDeclareRecord.getId()));
// 查询个税扣缴义务人 // 查询个税扣缴义务人
TaxAgentPO taxAgentPO = taxAgentService.getById(taxDeclareRecord.getTaxAgentId(), tenantKey); TaxAgentPO taxAgentPO = taxAgentService.getById(taxDeclareRecord.getTaxAgentId());
TaxDeclareTypeEnum taxDeclareTypeEnum = SalaryEnumUtil.enumMatchByValue(taxDeclareRecord.getTaxDeclareType(), TaxDeclareTypeEnum.class); TaxDeclareTypeEnum taxDeclareTypeEnum = SalaryEnumUtil.enumMatchByValue(taxDeclareRecord.getTaxDeclareType(), TaxDeclareTypeEnum.class);
TaxDeclareStatusEnum taxDeclareStatusEnum = SalaryEnumUtil.enumMatchByValue(taxDeclareRecord.getTaxDeclareStatus(), TaxDeclareStatusEnum.class); TaxDeclareStatusEnum taxDeclareStatusEnum = SalaryEnumUtil.enumMatchByValue(taxDeclareRecord.getTaxDeclareStatus(), TaxDeclareStatusEnum.class);
return new TaxDeclarationInfoDTO() return TaxDeclarationInfoDTO.builder()
.setSalaryMonth(taxDeclareRecord.getSalaryMonth()) .salaryMonth(taxDeclareRecord.getSalaryMonth())
.setTaxCycle(taxDeclareRecord.getTaxCycle()) .taxCycle(taxDeclareRecord.getTaxCycle())
.setTaxAgentId(taxDeclareRecord.getTaxAgentId()) .taxAgentId(taxDeclareRecord.getTaxAgentId())
.setTaxAgentName(Optional.ofNullable(taxAgentPO).map(TaxAgentPO::getName).orElse("")) .taxAgentName(Optional.ofNullable(taxAgentPO).map(TaxAgentPO::getName).orElse(""))
.setDeclareType(taxDeclareTypeEnum) .declareType(taxDeclareTypeEnum)
.setDeclareTypeDesc(taxDeclareTypeEnum == null ? "" : SalaryI18nUtil.getI18nLabel(taxDeclareTypeEnum.getLabelId(), taxDeclareTypeEnum.getDefaultLabel())) .declareTypeDesc(taxDeclareTypeEnum == null ? "" : SalaryI18nUtil.getI18nLabel(taxDeclareTypeEnum.getLabelId(), taxDeclareTypeEnum.getDefaultLabel()))
.setDeclareStatus(taxDeclareStatusEnum) .declareStatus(taxDeclareStatusEnum)
.setDeclareStatusDesc(taxDeclareStatusEnum == null ? "" : SalaryI18nUtil.getI18nLabel(taxDeclareStatusEnum.getLabelId(), taxDeclareStatusEnum.getDefaultLabel())) .declareStatusDesc(taxDeclareStatusEnum == null ? "" : SalaryI18nUtil.getI18nLabel(taxDeclareStatusEnum.getLabelId(), taxDeclareStatusEnum.getDefaultLabel()))
.setDeclareErrorMsg(taxDeclareRecord.getTaxDeclareErrorMsg()) .declareErrorMsg(taxDeclareRecord.getTaxDeclareErrorMsg())
.setDisplayIcon(Objects.equals(taxDeclareRecord.getDisplayUpdateIcon(), 1)) .displayIcon(Objects.equals(taxDeclareRecord.getDisplayUpdateIcon(), 1))
.setDeclareFailSize(taxDeclareFails.size()) .declareFailSize(taxDeclareFails.size())
.setAbnormalSize(notDeclareTaxDeclareEmployees.size() + noValueTaxDeclareEmployees.size()) .abnormalSize(notDeclareTaxDeclareEmployees.size() + noValueTaxDeclareEmployees.size())
.setTaxPaidAmount(SalaryEntityUtil.thousandthConvert(taxDeclareRecord.getTaxPaidAmount())); .taxPaidAmount(SalaryEntityUtil.thousandthConvert(taxDeclareRecord.getTaxPaidAmount()))
.build();
} }
/** /**
* 保存 * 保存
* *
* @param saveParam 保存参数 * @param saveParam 保存参数
* @param employeeId 人员id
* @param tenantKey 租户key
*/ */
public String save(TaxDeclarationSaveParam saveParam, Long employeeId, String tenantKey) { public String save(TaxDeclarationSaveParam saveParam) {
TaxDeclarationRateDTO taxDeclarationRate = new TaxDeclarationRateDTO().setStatus(true) TaxDeclarationRateDTO taxDeclarationRate = new TaxDeclarationRateDTO().setStatus(true)
.setIndex(Util.null2String(IdGenerator.generate())) .setIndex(Util.null2String(IdGenerator.generate()))
.setMsg(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 95836, "生成申报表")); .setMsg(SalaryI18nUtil.getI18nLabel(95836, "生成申报表"));
salaryCacheService.set(SalaryCacheKey.TAX_DECLARATION, taxDeclarationRate.getIndex(), taxDeclarationRate); salaryCacheService.set(SalaryCacheKey.TAX_DECLARATION + taxDeclarationRate.getIndex(), taxDeclarationRate);
LocalRunnable localRunnable = new LocalRunnable() { LocalRunnable localRunnable = new LocalRunnable() {
@Override @Override
public void execute() { public void execute() {
try { try {
DSTenantKeyThreadVar.tenantKey.set(tenantKey); taxDeclareRecordService.save(saveParam);
taxDeclareRecordService.save(saveParam, employeeId, tenantKey);
taxDeclarationRate.setStatus(true).setFinish(true); taxDeclarationRate.setStatus(true).setFinish(true);
} catch (SalaryRunTimeException e) { } catch (SalaryRunTimeException e) {
taxDeclarationRate.setStatus(false).setFinish(true).setMsg(e.getMessage()); taxDeclarationRate.setStatus(false).setFinish(true).setMsg(e.getMessage());
} catch (Exception e) { } catch (Exception e) {
log.error("个税申报表生成报错:{}", e.getMessage(), e); log.error("个税申报表生成报错:{}", e.getMessage(), e);
taxDeclarationRate.setStatus(false).setFinish(true).setMsg(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 187276, "个税申报表生成报错:") + e.getMessage()); taxDeclarationRate.setStatus(false).setFinish(true).setMsg(SalaryI18nUtil.getI18nLabel(187276, "个税申报表生成报错:") + e.getMessage());
} finally { } finally {
DSTenantKeyThreadVar.tenantKey.remove(); salaryCacheService.set(SalaryCacheKey.TAX_DECLARATION + taxDeclarationRate.getIndex(), taxDeclarationRate);
salaryCacheService.set(SalaryCacheKey.TAX_DECLARATION, taxDeclarationRate.getIndex(), taxDeclarationRate);
} }
} }
}; };
@ -409,61 +350,53 @@ public class TaxDeclareRecordWrapper extends Service {
* 更新个税申报表的待刷新数据的标识 * 更新个税申报表的待刷新数据的标识
* *
* @param id * @param id
* @param employeeId
* @param tenantKey
*/ */
public void updateIcon(Long id, Long employeeId, String tenantKey) { public void updateIcon(Long id) {
taxDeclareRecordService.updateIcon(id, NumberUtils.INTEGER_ZERO, employeeId, tenantKey); taxDeclareRecordService.updateIcon(id, NumberUtils.INTEGER_ZERO);
} }
/** /**
* 删除个税申报表 * 删除个税申报表
* *
* @param ids * @param ids
* @param employeeId
* @param tenantKey
*/ */
public void delete(Collection<Long> ids, Long employeeId, String tenantKey) { public void delete(Collection<Long> ids) {
taxDeclareRecordService.deleteByIds(ids, tenantKey); taxDeclareRecordService.deleteByIds(ids);
} }
/** /**
* 获取个税申报表是否已经生成 * 获取个税申报表是否已经生成
* *
* @param index * @param index
* @param tenantKey
* @return * @return
*/ */
public TaxDeclarationRateDTO getRate(String index, String tenantKey) { public TaxDeclarationRateDTO getRate(String index) {
return salaryCacheService.get(SalaryCacheKey.TAX_DECLARATION, index, TaxDeclarationRateDTO.class); return salaryCacheService.get(SalaryCacheKey.TAX_DECLARATION + index);
} }
/** /**
* 申报 * 申报
* *
* @param id * @param id
* @param tenantKey
*/ */
public String declare(Long id, Long employeeId, String tenantKey) { public String declare(Long id) {
checkBefore(id); checkBefore(id);
TaxDeclarationRateDTO taxDeclarationRate = new TaxDeclarationRateDTO().setStatus(true).setIndex(Util.null2String(id)) TaxDeclarationRateDTO taxDeclarationRate = new TaxDeclarationRateDTO().setStatus(true).setIndex(Util.null2String(id))
.setMsg(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 156454, "在线申报")); .setMsg(SalaryI18nUtil.getI18nLabel(156454, "在线申报"));
salaryCacheService.set(SalaryCacheKey.TAX_DECLARATION, taxDeclarationRate.getIndex(), taxDeclarationRate); salaryCacheService.set(SalaryCacheKey.TAX_DECLARATION + taxDeclarationRate.getIndex(), taxDeclarationRate);
LocalRunnable localRunnable = new LocalRunnable() { LocalRunnable localRunnable = new LocalRunnable() {
@Override @Override
public void execute() { public void execute() {
try { try {
DSTenantKeyThreadVar.tenantKey.set(tenantKey); taxDeclareRecordService.declare(id);
taxDeclareRecordService.declare(id, employeeId, tenantKey);
taxDeclarationRate.setFinish(true); taxDeclarationRate.setFinish(true);
} catch (SalaryRunTimeException | SalaryNullException e) { } catch (SalaryRunTimeException e) {
taxDeclarationRate.setStatus(false).setFinish(true).setMsg(e.getMessage()); taxDeclarationRate.setStatus(false).setFinish(true).setMsg(e.getMessage());
} catch (Exception e) { } catch (Exception e) {
log.error("在线申报失败:{}", e.getMessage(), e); log.error("在线申报失败:{}", e.getMessage(), e);
taxDeclarationRate.setStatus(false).setFinish(true).setMsg(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 187274, "在线申报失败:") + e.getMessage()); taxDeclarationRate.setStatus(false).setFinish(true).setMsg(SalaryI18nUtil.getI18nLabel(187274, "在线申报失败:") + e.getMessage());
} finally { } finally {
DSTenantKeyThreadVar.tenantKey.remove(); salaryCacheService.set(SalaryCacheKey.TAX_DECLARATION + taxDeclarationRate.getIndex(), taxDeclarationRate);
salaryCacheService.set(SalaryCacheKey.TAX_DECLARATION, taxDeclarationRate.getIndex(), taxDeclarationRate);
} }
} }
}; };
@ -475,26 +408,25 @@ public class TaxDeclareRecordWrapper extends Service {
* 获取申报反馈 * 获取申报反馈
* *
* @param id * @param id
* @param tenantKey
*/ */
public String getDeclareFeedback(Long id, Long employeeId, String tenantKey) { public String getDeclareFeedback(Long id, Long employeeId) {
checkBefore(id); checkBefore(id);
TaxDeclarationRateDTO taxDeclarationRate = new TaxDeclarationRateDTO().setStatus(true).setIndex(Util.null2String(id)) TaxDeclarationRateDTO taxDeclarationRate = new TaxDeclarationRateDTO().setStatus(true).setIndex(Util.null2String(id))
.setMsg(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 182680, "获取申报反馈")); .setMsg(SalaryI18nUtil.getI18nLabel(182680, "获取申报反馈"));
salaryCacheService.set(SalaryCacheKey.TAX_DECLARATION, taxDeclarationRate.getIndex(), taxDeclarationRate); salaryCacheService.set(SalaryCacheKey.TAX_DECLARATION + taxDeclarationRate.getIndex(), taxDeclarationRate);
LocalRunnable localRunnable = new LocalRunnable() { LocalRunnable localRunnable = new LocalRunnable() {
@Override @Override
public void execute() { public void execute() {
try { try {
taxDeclareRecordService.getDeclareFeedback(id, taxDeclarationRate, employeeId, tenantKey); taxDeclareRecordService.getDeclareFeedback(id, taxDeclarationRate);
taxDeclarationRate.setFinish(true); taxDeclarationRate.setFinish(true);
} catch (SalaryRunTimeException | SalaryNullException e) { } catch (SalaryRunTimeException e) {
taxDeclarationRate.setStatus(false).setFinish(true).setMsg(e.getMessage()); taxDeclarationRate.setStatus(false).setFinish(true).setMsg(e.getMessage());
} catch (Exception e) { } catch (Exception e) {
log.error("获取申报反馈失败:{}", e.getMessage(), e); log.error("获取申报反馈失败:{}", e.getMessage(), e);
taxDeclarationRate.setStatus(false).setFinish(true).setMsg(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 187255, "获取申报反馈失败:") + e.getMessage()); taxDeclarationRate.setStatus(false).setFinish(true).setMsg(SalaryI18nUtil.getI18nLabel(187255, "获取申报反馈失败:") + e.getMessage());
} finally { } finally {
salaryCacheService.set(SalaryCacheKey.TAX_DECLARATION, taxDeclarationRate.getIndex(), taxDeclarationRate); salaryCacheService.set(SalaryCacheKey.TAX_DECLARATION + taxDeclarationRate.getIndex(), taxDeclarationRate);
} }
} }
}; };
@ -506,26 +438,25 @@ public class TaxDeclareRecordWrapper extends Service {
* 作废 * 作废
* *
* @param id * @param id
* @param tenantKey
*/ */
public String cancelDeclare(Long id, Long employeeId, String tenantKey) { public String cancelDeclare(Long id, Long employeeId) {
checkBefore(id); checkBefore(id);
TaxDeclarationRateDTO taxDeclarationRate = new TaxDeclarationRateDTO().setStatus(true).setIndex(Util.null2String(id)) TaxDeclarationRateDTO taxDeclarationRate = new TaxDeclarationRateDTO().setStatus(true).setIndex(Util.null2String(id))
.setMsg(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 158842, "作废申报")); .setMsg(SalaryI18nUtil.getI18nLabel(158842, "作废申报"));
salaryCacheService.set(SalaryCacheKey.TAX_DECLARATION, taxDeclarationRate.getIndex(), taxDeclarationRate); salaryCacheService.set(SalaryCacheKey.TAX_DECLARATION + taxDeclarationRate.getIndex(), taxDeclarationRate);
LocalRunnable localRunnable = new LocalRunnable() { LocalRunnable localRunnable = new LocalRunnable() {
@Override @Override
public void execute() { public void execute() {
try { try {
taxDeclareRecordService.cancelDeclare(id, employeeId, tenantKey); taxDeclareRecordService.cancelDeclare(id);
taxDeclarationRate.setFinish(true); taxDeclarationRate.setFinish(true);
} catch (SalaryRunTimeException | SalaryNullException e) { } catch (SalaryRunTimeException e) {
taxDeclarationRate.setStatus(false).setFinish(true).setMsg(e.getMessage()); taxDeclarationRate.setStatus(false).setFinish(true).setMsg(e.getMessage());
} catch (Exception e) { } catch (Exception e) {
log.error("作废申报失败:{}", e.getMessage(), e); log.error("作废申报失败:{}", e.getMessage(), e);
taxDeclarationRate.setStatus(false).setFinish(true).setMsg(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 187272, "作废申报失败:") + e.getMessage()); taxDeclarationRate.setStatus(false).setFinish(true).setMsg(SalaryI18nUtil.getI18nLabel(187272, "作废申报失败:") + e.getMessage());
} finally { } finally {
salaryCacheService.set(SalaryCacheKey.TAX_DECLARATION, taxDeclarationRate.getIndex(), taxDeclarationRate); salaryCacheService.set(SalaryCacheKey.TAX_DECLARATION + taxDeclarationRate.getIndex(), taxDeclarationRate);
} }
} }
}; };
@ -537,26 +468,25 @@ public class TaxDeclareRecordWrapper extends Service {
* 获取作废反馈 * 获取作废反馈
* *
* @param id * @param id
* @param tenantKey
*/ */
public String getCancelFeedback(Long id, Long employeeId, String tenantKey) { public String getCancelFeedback(Long id, Long employeeId) {
checkBefore(id); checkBefore(id);
TaxDeclarationRateDTO taxDeclarationRate = new TaxDeclarationRateDTO().setStatus(true).setIndex(Util.null2String(id)) TaxDeclarationRateDTO taxDeclarationRate = new TaxDeclarationRateDTO().setStatus(true).setIndex(Util.null2String(id))
.setMsg(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 182681, "获取作废申报反馈")); .setMsg(SalaryI18nUtil.getI18nLabel(182681, "获取作废申报反馈"));
salaryCacheService.set(SalaryCacheKey.TAX_DECLARATION, taxDeclarationRate.getIndex(), taxDeclarationRate); salaryCacheService.set(SalaryCacheKey.TAX_DECLARATION + taxDeclarationRate.getIndex(), taxDeclarationRate);
LocalRunnable localRunnable = new LocalRunnable() { LocalRunnable localRunnable = new LocalRunnable() {
@Override @Override
public void execute() { public void execute() {
try { try {
taxDeclareRecordService.getCancelFeedback(id, taxDeclarationRate, employeeId, tenantKey); taxDeclareRecordService.getCancelFeedback(id, taxDeclarationRate);
taxDeclarationRate.setFinish(true); taxDeclarationRate.setFinish(true);
} catch (SalaryRunTimeException | SalaryNullException e) { } catch (SalaryRunTimeException e) {
taxDeclarationRate.setStatus(false).setFinish(true).setMsg(e.getMessage()); taxDeclarationRate.setStatus(false).setFinish(true).setMsg(e.getMessage());
} catch (Exception e) { } catch (Exception e) {
log.error("获取作废反馈结果失败:{}", e.getMessage(), e); log.error("获取作废反馈结果失败:{}", e.getMessage(), e);
taxDeclarationRate.setStatus(false).setFinish(true).setMsg(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 187270, "获取作废反馈结果失败:") + e.getMessage()); taxDeclarationRate.setStatus(false).setFinish(true).setMsg(SalaryI18nUtil.getI18nLabel(187270, "获取作废反馈结果失败:") + e.getMessage());
} finally { } finally {
salaryCacheService.set(SalaryCacheKey.TAX_DECLARATION, taxDeclarationRate.getIndex(), taxDeclarationRate); salaryCacheService.set(SalaryCacheKey.TAX_DECLARATION + taxDeclarationRate.getIndex(), taxDeclarationRate);
} }
} }
}; };
@ -569,27 +499,26 @@ public class TaxDeclareRecordWrapper extends Service {
* *
* @param id * @param id
* @param employeeId * @param employeeId
* @param tenantKey
* @return * @return
*/ */
public String updateDeclare(Long id, Long employeeId, String tenantKey) { public String updateDeclare(Long id, Long employeeId) {
checkBefore(id); checkBefore(id);
TaxDeclarationRateDTO taxDeclarationRate = new TaxDeclarationRateDTO().setStatus(true).setIndex(Util.null2String(id)) TaxDeclarationRateDTO taxDeclarationRate = new TaxDeclarationRateDTO().setStatus(true).setIndex(Util.null2String(id))
.setMsg(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 177637, "更正申报")); .setMsg(SalaryI18nUtil.getI18nLabel(177637, "更正申报"));
salaryCacheService.set(SalaryCacheKey.TAX_DECLARATION, taxDeclarationRate.getIndex(), taxDeclarationRate); salaryCacheService.set(SalaryCacheKey.TAX_DECLARATION + taxDeclarationRate.getIndex(), taxDeclarationRate);
LocalRunnable localRunnable = new LocalRunnable() { LocalRunnable localRunnable = new LocalRunnable() {
@Override @Override
public void execute() { public void execute() {
try { try {
taxDeclareRecordService.updateDeclare(id, employeeId, tenantKey); taxDeclareRecordService.updateDeclare(id);
taxDeclarationRate.setFinish(true); taxDeclarationRate.setFinish(true);
} catch (SalaryRunTimeException | SalaryNullException e) { } catch (SalaryRunTimeException e) {
taxDeclarationRate.setStatus(false).setFinish(true).setMsg(e.getMessage()); taxDeclarationRate.setStatus(false).setFinish(true).setMsg(e.getMessage());
} catch (Exception e) { } catch (Exception e) {
log.error("更正申报失败:{}", e.getMessage(), e); log.error("更正申报失败:{}", e.getMessage(), e);
taxDeclarationRate.setStatus(false).setFinish(true).setMsg(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 187269, "更正申报失败:") + e.getMessage()); taxDeclarationRate.setStatus(false).setFinish(true).setMsg(SalaryI18nUtil.getI18nLabel(187269, "更正申报失败:") + e.getMessage());
} finally { } finally {
salaryCacheService.set(SalaryCacheKey.TAX_DECLARATION, taxDeclarationRate.getIndex(), taxDeclarationRate); salaryCacheService.set(SalaryCacheKey.TAX_DECLARATION + taxDeclarationRate.getIndex(), taxDeclarationRate);
} }
} }
}; };
@ -601,54 +530,46 @@ public class TaxDeclareRecordWrapper extends Service {
* 税局端申报状态查询 * 税局端申报状态查询
* *
* @param id * @param id
* @param employeeId
* @param tenantKey
* @return * @return
*/ */
public String queryDeclareStatus(Long id, Long employeeId, String tenantKey) { public String queryDeclareStatus(Long id) {
return taxDeclareRecordService.queryDeclareStatus(id, employeeId, tenantKey); return taxDeclareRecordService.queryDeclareStatus(id);
} }
/** /**
* 税局端申报明细查询 * 税局端申报明细查询
* *
* @param id * @param id
* @param employeeId
* @param tenantKey
* @return * @return
*/ */
public String queryCompanyIncomes(Long id, Long employeeId, String tenantKey) { public String queryCompanyIncomes(Long id) {
return taxDeclareRecordService.queryCompanyIncomes(id, employeeId, tenantKey); return taxDeclareRecordService.queryCompanyIncomes(id);
} }
/** /**
* 刷新数据 * 刷新数据
* *
* @param id * @param id
* @param employeeId
* @param tenantKey
* @return * @return
*/ */
public String refreshData(Long id, Long employeeId, String tenantKey) { public String refreshData(Long id) {
checkBefore(id); checkBefore(id);
TaxDeclarationRateDTO taxDeclarationRate = new TaxDeclarationRateDTO().setStatus(true).setIndex(Util.null2String(id)) TaxDeclarationRateDTO taxDeclarationRate = new TaxDeclarationRateDTO().setStatus(true).setIndex(Util.null2String(id))
.setMsg(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 156447, "刷新数据")); .setMsg(SalaryI18nUtil.getI18nLabel(156447, "刷新数据"));
salaryCacheService.set(SalaryCacheKey.TAX_DECLARATION, taxDeclarationRate.getIndex(), taxDeclarationRate); salaryCacheService.set(SalaryCacheKey.TAX_DECLARATION + taxDeclarationRate.getIndex(), taxDeclarationRate);
LocalRunnable localRunnable = new LocalRunnable() { LocalRunnable localRunnable = new LocalRunnable() {
@Override @Override
public void execute() { public void execute() {
try { try {
DSTenantKeyThreadVar.tenantKey.set(tenantKey); taxDeclareRecordService.refreshData(id);
taxDeclareRecordService.refreshData(id, employeeId, tenantKey);
taxDeclarationRate.setFinish(true); taxDeclarationRate.setFinish(true);
} catch (SalaryRunTimeException | SalaryNullException e) { } catch (SalaryRunTimeException e) {
taxDeclarationRate.setStatus(false).setFinish(true).setMsg(e.getMessage()); taxDeclarationRate.setStatus(false).setFinish(true).setMsg(e.getMessage());
} catch (Exception e) { } catch (Exception e) {
log.error("刷新数据失败:{}", e.getMessage(), e); log.error("刷新数据失败:{}", e.getMessage(), e);
taxDeclarationRate.setStatus(false).setFinish(true).setMsg(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 187268, "刷新数据失败:") + e.getMessage()); taxDeclarationRate.setStatus(false).setFinish(true).setMsg(SalaryI18nUtil.getI18nLabel(187268, "刷新数据失败:") + e.getMessage());
} finally { } finally {
DSTenantKeyThreadVar.tenantKey.remove(); salaryCacheService.set(SalaryCacheKey.TAX_DECLARATION + taxDeclarationRate.getIndex(), taxDeclarationRate);
salaryCacheService.set(SalaryCacheKey.TAX_DECLARATION, taxDeclarationRate.getIndex(), taxDeclarationRate);
} }
} }
}; };
@ -657,97 +578,96 @@ public class TaxDeclareRecordWrapper extends Service {
} }
private void checkBefore(Long id) { private void checkBefore(Long id) {
TaxDeclarationRateDTO taxDeclarationRate = salaryCacheService.get(SalaryCacheKey.TAX_DECLARATION, Util.null2String(id), TaxDeclarationRateDTO.class); TaxDeclarationRateDTO taxDeclarationRate = salaryCacheService.get(SalaryCacheKey.TAX_DECLARATION + Util.null2String(id));
if (taxDeclarationRate != null && !taxDeclarationRate.isFinish()) { if (taxDeclarationRate != null && !taxDeclarationRate.isFinish()) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(182691, "当前正处于「{0}」中,请稍后再试").replace("{0}", taxDeclarationRate.getMsg())); throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(182691, "当前正处于「{0}」中,请稍后再试").replace("{0}", taxDeclarationRate.getMsg()));
} }
} }
/** // /**
* 导出个税申报明细列表 // * 导出个税申报明细列表
* // *
* @param queryParam // * @param queryParam
* @param simpleEmployee // * @return
* @return // */
*/ // public Map<String, Object> exportTaxDeclarationValue(TaxDeclarationValueListQueryParam queryParam) {
public Map<String, Object> exportTaxDeclarationValue(TaxDeclarationValueListQueryParam queryParam, SimpleEmployee simpleEmployee) { // ExcelExportParam excelExportParam = new ExcelExportParam()
ExcelExportParam excelExportParam = new ExcelExportParam() // .setBiz(String.valueOf(IdGenerator.generate()))
.setBiz(String.valueOf(IdGenerator.generate())) // .setModule(EntityType.hrmsalary.name())
.setModule(EntityType.hrmsalary.name()) // .setFunction("exportTaxDeclarationValue");
.setFunction("exportTaxDeclarationValue"); // LocalRunnable localRunnable = new LocalRunnable() {
LocalRunnable localRunnable = new LocalRunnable() { // @Override
@Override // public void execute() {
public void execute() { // taxDeclarationExcelService.exportTaxDeclarationValue(excelExportParam, queryParam, simpleEmployee);
taxDeclarationExcelService.exportTaxDeclarationValue(excelExportParam, queryParam, simpleEmployee); // }
} // };
}; // ThreadPoolUtil.fixedPoolExecute(ModulePoolEnum.OTHER, "exportTaxDeclarationValue", localRunnable);
ThreadPoolUtil.fixedPoolExecute(ModulePoolEnum.OTHER, "exportTaxDeclarationValue", localRunnable); // return JsonUtil.parseMap(excelExportParam, Object.class);
return JsonUtil.parseMap(excelExportParam, Object.class); // }
} //
// /**
/** // * 导出未报送的人员列表
* 导出未报送的人员列表 // *
* // * @param queryParam
* @param queryParam // * @param simpleEmployee
* @param simpleEmployee // * @return
* @return // */
*/ // public Map<String, Object> exportEmployee4NotDeclare(AbnormalEmployeeListQueryParam queryParam) {
public Map<String, Object> exportEmployee4NotDeclare(AbnormalEmployeeListQueryParam queryParam, SimpleEmployee simpleEmployee) { // ExcelExportParam excelExportParam = new ExcelExportParam()
ExcelExportParam excelExportParam = new ExcelExportParam() // .setBiz(String.valueOf(IdGenerator.generate()))
.setBiz(String.valueOf(IdGenerator.generate())) // .setModule(EntityType.hrmsalary.name())
.setModule(EntityType.hrmsalary.name()) // .setFunction("exportEmployee4NotDeclare");
.setFunction("exportEmployee4NotDeclare"); // LocalRunnable localRunnable = new LocalRunnable() {
LocalRunnable localRunnable = new LocalRunnable() { // @Override
@Override // public void execute() {
public void execute() { // taxDeclarationExcelService.exportEmployee4NotDeclare(excelExportParam, queryParam, simpleEmployee);
taxDeclarationExcelService.exportEmployee4NotDeclare(excelExportParam, queryParam, simpleEmployee); // }
} // };
}; // ThreadPoolUtil.fixedPoolExecute(ModulePoolEnum.OTHER, "exportEmployee4NotDeclare", localRunnable);
ThreadPoolUtil.fixedPoolExecute(ModulePoolEnum.OTHER, "exportEmployee4NotDeclare", localRunnable); // return JsonUtil.parseMap(excelExportParam, Object.class);
return JsonUtil.parseMap(excelExportParam, Object.class); // }
} //
// /**
/** // * 导出没有申报数据的人员列表
* 导出没有申报数据的人员列表 // *
* // * @param queryParam
* @param queryParam // * @param simpleEmployee
* @param simpleEmployee // * @return
* @return // */
*/ // public Map<String, Object> exportEmployee4NoValue(AbnormalEmployeeListQueryParam queryParam, SimpleEmployee simpleEmployee) {
public Map<String, Object> exportEmployee4NoValue(AbnormalEmployeeListQueryParam queryParam, SimpleEmployee simpleEmployee) { // ExcelExportParam excelExportParam = new ExcelExportParam()
ExcelExportParam excelExportParam = new ExcelExportParam() // .setBiz(String.valueOf(IdGenerator.generate()))
.setBiz(String.valueOf(IdGenerator.generate())) // .setModule(EntityType.hrmsalary.name())
.setModule(EntityType.hrmsalary.name()) // .setFunction("exportEmployee4NoValue");
.setFunction("exportEmployee4NoValue"); // LocalRunnable localRunnable = new LocalRunnable() {
LocalRunnable localRunnable = new LocalRunnable() { // @Override
@Override // public void execute() {
public void execute() { // taxDeclarationExcelService.exportEmployee4NoValue(excelExportParam, queryParam, simpleEmployee);
taxDeclarationExcelService.exportEmployee4NoValue(excelExportParam, queryParam, simpleEmployee); // }
} // };
}; // ThreadPoolUtil.fixedPoolExecute(ModulePoolEnum.OTHER, "exportEmployee4NoValue", localRunnable);
ThreadPoolUtil.fixedPoolExecute(ModulePoolEnum.OTHER, "exportEmployee4NoValue", localRunnable); // return JsonUtil.parseMap(excelExportParam, Object.class);
return JsonUtil.parseMap(excelExportParam, Object.class); // }
} //
// /**
/** // * 导出申报失败的人员列表
* 导出申报失败的人员列表 // *
* // * @param queryParam
* @param queryParam // * @param simpleEmployee
* @param simpleEmployee // * @return
* @return // */
*/ // public Map<String, Object> exportEmployee4Fail(AbnormalEmployeeListQueryParam queryParam, SimpleEmployee simpleEmployee) {
public Map<String, Object> exportEmployee4Fail(AbnormalEmployeeListQueryParam queryParam, SimpleEmployee simpleEmployee) { // ExcelExportParam excelExportParam = new ExcelExportParam()
ExcelExportParam excelExportParam = new ExcelExportParam() // .setBiz(String.valueOf(IdGenerator.generate()))
.setBiz(String.valueOf(IdGenerator.generate())) // .setModule(EntityType.hrmsalary.name())
.setModule(EntityType.hrmsalary.name()) // .setFunction("exportEmployee4Fail");
.setFunction("exportEmployee4Fail"); // LocalRunnable localRunnable = new LocalRunnable() {
LocalRunnable localRunnable = new LocalRunnable() { // @Override
@Override // public void execute() {
public void execute() { // taxDeclarationExcelService.exportEmployee4Fail(excelExportParam, queryParam, simpleEmployee);
taxDeclarationExcelService.exportEmployee4Fail(excelExportParam, queryParam, simpleEmployee); // }
} // };
}; // ThreadPoolUtil.fixedPoolExecute(ModulePoolEnum.OTHER, "exportEmployee4Fail", localRunnable);
ThreadPoolUtil.fixedPoolExecute(ModulePoolEnum.OTHER, "exportEmployee4Fail", localRunnable); // return JsonUtil.parseMap(excelExportParam, Object.class);
return JsonUtil.parseMap(excelExportParam, Object.class); // }
}
} }