From dc638971657e304f0ba1040baee39e49a5fd6323 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=92=B1=E6=B6=9B?= <15850646081@163.com> Date: Fri, 11 Aug 2023 14:20:14 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=AA=E7=A8=8E=E5=AF=B9=E6=8E=A5=EF=BC=8C?= =?UTF-8?q?=E4=B8=AA=E7=A8=8E=E7=94=B3=E6=8A=A5=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- resource/sqlupgrade/DM/sql202308090303.sql | 4 +- resource/sqlupgrade/GS/sql202308090303.sql | 4 +- resource/sqlupgrade/JC/sql202308090303.sql | 4 +- resource/sqlupgrade/Mysql/sql202308090303.sql | 4 +- .../sqlupgrade/Oracle/sql202308090303.sql | 4 +- resource/sqlupgrade/PG/sql202308090303.sql | 4 +- .../sqlupgrade/SQLServer/sql202308090303.sql | 4 +- resource/sqlupgrade/ST/sql202308090303.sql | 4 +- .../engine/salary/common/YearMonthRange.java | 28 + .../param/SalaryAcctEmployeeQueryParam.java | 9 +- .../salaryacct/po/SalaryAcctEmployeePO.java | 5 + .../salaryacct/po/SalaryAcctTaxAgentPO.java | 75 ++ .../bo/TaxDeclareEmployeeBO.java | 174 +++-- .../dto/TaxDeclarationInfoDTO.java | 48 +- .../dto/TaxDeclareRecordListDTO.java | 7 +- .../param/AbnormalEmployeeListQueryParam.java | 5 +- .../param/TaxDeclarationListQueryParam.java | 8 +- .../taxdeclaration/po/TaxDeclarationPO.java | 6 + .../taxdeclaration/po/TaxDeclareRecordPO.java | 42 +- .../salaryacct/SalaryAcctRecordMapper.java | 9 + .../salaryacct/SalaryAcctRecordMapper.xml | 25 +- .../taxagent/TaxDeclareRecordMapper.java | 11 - .../TaxDeclarationDetailMapper.java | 10 + .../TaxDeclareRecordMapper.java | 79 ++ .../taxdeclaration/TaxDeclareRecordMapper.xml | 536 ++++++++++++++ .../engine/salary/service/ExtEmpService.java | 2 + .../salary/service/SalaryAcctCalcService.java | 31 - .../service/SalaryAcctRecordService.java | 10 + .../salary/service/TaxDeclarationService.java | 9 + .../service/TaxDeclarationValueService.java | 71 ++ .../service/TaxDeclareEmployeeService.java | 60 ++ .../salary/service/TaxDeclareFailService.java | 51 ++ .../service/TaxDeclareRecordService.java | 152 ++-- .../service/TaxReportColumnService.java | 31 + .../factory/SalaryCalcRunServiceFactory.java | 2 +- .../factory/TaxPaymentServiceFactory.java | 2 +- .../service/impl/ExtEmpServiceImpl.java | 12 + .../impl/SalaryAcctRecordServiceImpl.java | 9 + .../service/impl/SalaryItemServiceImpl.java | 2 +- .../impl/TaxDeclarationServiceImpl.java | 28 +- .../impl/TaxDeclarationValueServiceImpl.java | 173 +++++ .../impl/TaxDeclareEmployeeServiceImpl.java | 101 +++ .../impl/TaxDeclareFailServiceImpl.java | 97 +++ .../impl/TaxDeclareRecordServiceImpl.java | 677 +++++++++--------- .../impl/TaxReportColumnServiceImpl.java | 40 ++ .../salary/web/TaxDeclarationController.java | 2 +- .../wrapper/TaxDeclareRecordWrapper.java | 648 ++++++++--------- 47 files changed, 2325 insertions(+), 994 deletions(-) create mode 100644 src/com/engine/salary/common/YearMonthRange.java create mode 100644 src/com/engine/salary/entity/salaryacct/po/SalaryAcctTaxAgentPO.java delete mode 100644 src/com/engine/salary/mapper/taxagent/TaxDeclareRecordMapper.java create mode 100644 src/com/engine/salary/mapper/taxdeclaration/TaxDeclareRecordMapper.java create mode 100644 src/com/engine/salary/mapper/taxdeclaration/TaxDeclareRecordMapper.xml delete mode 100644 src/com/engine/salary/service/SalaryAcctCalcService.java create mode 100644 src/com/engine/salary/service/TaxDeclarationValueService.java create mode 100644 src/com/engine/salary/service/TaxDeclareEmployeeService.java create mode 100644 src/com/engine/salary/service/TaxDeclareFailService.java create mode 100644 src/com/engine/salary/service/TaxReportColumnService.java create mode 100644 src/com/engine/salary/service/impl/TaxDeclarationValueServiceImpl.java create mode 100644 src/com/engine/salary/service/impl/TaxDeclareEmployeeServiceImpl.java create mode 100644 src/com/engine/salary/service/impl/TaxDeclareFailServiceImpl.java create mode 100644 src/com/engine/salary/service/impl/TaxReportColumnServiceImpl.java diff --git a/resource/sqlupgrade/DM/sql202308090303.sql b/resource/sqlupgrade/DM/sql202308090303.sql index 3c9a6cee5..0a9e21cc4 100644 --- a/resource/sqlupgrade/DM/sql202308090303.sql +++ b/resource/sqlupgrade/DM/sql202308090303.sql @@ -7,8 +7,8 @@ create table hrsa_tax_declare_record delete_type int default 0, tenant_key varchar2(10), tax_agent_id number, - salary_month varchar2(10), - tax_cycle varchar2(10), + salary_month date, + tax_cycle date, remark varchar2(1000), request_id varchar2(100), tax_declare_type number, diff --git a/resource/sqlupgrade/GS/sql202308090303.sql b/resource/sqlupgrade/GS/sql202308090303.sql index 3c9a6cee5..0a9e21cc4 100644 --- a/resource/sqlupgrade/GS/sql202308090303.sql +++ b/resource/sqlupgrade/GS/sql202308090303.sql @@ -7,8 +7,8 @@ create table hrsa_tax_declare_record delete_type int default 0, tenant_key varchar2(10), tax_agent_id number, - salary_month varchar2(10), - tax_cycle varchar2(10), + salary_month date, + tax_cycle date, remark varchar2(1000), request_id varchar2(100), tax_declare_type number, diff --git a/resource/sqlupgrade/JC/sql202308090303.sql b/resource/sqlupgrade/JC/sql202308090303.sql index 3c9a6cee5..0a9e21cc4 100644 --- a/resource/sqlupgrade/JC/sql202308090303.sql +++ b/resource/sqlupgrade/JC/sql202308090303.sql @@ -7,8 +7,8 @@ create table hrsa_tax_declare_record delete_type int default 0, tenant_key varchar2(10), tax_agent_id number, - salary_month varchar2(10), - tax_cycle varchar2(10), + salary_month date, + tax_cycle date, remark varchar2(1000), request_id varchar2(100), tax_declare_type number, diff --git a/resource/sqlupgrade/Mysql/sql202308090303.sql b/resource/sqlupgrade/Mysql/sql202308090303.sql index f7094b24b..4e6351529 100644 --- a/resource/sqlupgrade/Mysql/sql202308090303.sql +++ b/resource/sqlupgrade/Mysql/sql202308090303.sql @@ -7,8 +7,8 @@ create table hrsa_tax_declare_record delete_type int default 0 comment '是否删除' , tenant_key varchar(10) comment '租户KEY' , tax_agent_id bigint comment '个税扣缴义务人id' , - salary_month varchar(10) comment '薪资所属月' , - tax_cycle varchar(10) comment '税款所属期' , + salary_month datetime comment '薪资所属月' , + tax_cycle datetime comment '税款所属期' , remark varchar(1000) comment '备注' , request_id varchar(100) comment '供应商第三方系统返回的requestid' , tax_declare_type tinyint comment '申报类型' , diff --git a/resource/sqlupgrade/Oracle/sql202308090303.sql b/resource/sqlupgrade/Oracle/sql202308090303.sql index e9a221fca..7ce46cb95 100644 --- a/resource/sqlupgrade/Oracle/sql202308090303.sql +++ b/resource/sqlupgrade/Oracle/sql202308090303.sql @@ -7,8 +7,8 @@ create table hrsa_tax_declare_record delete_type int default 0, tenant_key varchar2(10), tax_agent_id number, - salary_month varchar2(10), - tax_cycle varchar2(10), + salary_month date, + tax_cycle date, remark varchar2(1000), request_id varchar2(100), tax_declare_type number, diff --git a/resource/sqlupgrade/PG/sql202308090303.sql b/resource/sqlupgrade/PG/sql202308090303.sql index 33f4a8aea..511123b31 100644 --- a/resource/sqlupgrade/PG/sql202308090303.sql +++ b/resource/sqlupgrade/PG/sql202308090303.sql @@ -7,8 +7,8 @@ create table hrsa_tax_declare_record delete_type int default 0, tenant_key varchar(10), tax_agent_id bigint, - salary_month varchar(10), - tax_cycle varchar(10), + salary_month timestamp, + tax_cycle timestamp, remark varchar(1000), request_id varchar(100), tax_declare_type smallint, diff --git a/resource/sqlupgrade/SQLServer/sql202308090303.sql b/resource/sqlupgrade/SQLServer/sql202308090303.sql index e3ca10522..6757c6ad9 100644 --- a/resource/sqlupgrade/SQLServer/sql202308090303.sql +++ b/resource/sqlupgrade/SQLServer/sql202308090303.sql @@ -7,8 +7,8 @@ create table hrsa_tax_declare_record delete_type int default 0, tenant_key nvarchar(10), tax_agent_id bigint, - salary_month nvarchar(10), - tax_cycle nvarchar(10), + salary_month datetime, + tax_cycle datetime, remark nvarchar(1000), request_id nvarchar(100), tax_declare_type tinyint, diff --git a/resource/sqlupgrade/ST/sql202308090303.sql b/resource/sqlupgrade/ST/sql202308090303.sql index 3c9a6cee5..0a9e21cc4 100644 --- a/resource/sqlupgrade/ST/sql202308090303.sql +++ b/resource/sqlupgrade/ST/sql202308090303.sql @@ -7,8 +7,8 @@ create table hrsa_tax_declare_record delete_type int default 0, tenant_key varchar2(10), tax_agent_id number, - salary_month varchar2(10), - tax_cycle varchar2(10), + salary_month date, + tax_cycle date, remark varchar2(1000), request_id varchar2(100), tax_declare_type number, diff --git a/src/com/engine/salary/common/YearMonthRange.java b/src/com/engine/salary/common/YearMonthRange.java new file mode 100644 index 000000000..e5d7e82d9 --- /dev/null +++ b/src/com/engine/salary/common/YearMonthRange.java @@ -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; +} diff --git a/src/com/engine/salary/entity/salaryacct/param/SalaryAcctEmployeeQueryParam.java b/src/com/engine/salary/entity/salaryacct/param/SalaryAcctEmployeeQueryParam.java index cfe97aae9..7ec1aea5e 100644 --- a/src/com/engine/salary/entity/salaryacct/param/SalaryAcctEmployeeQueryParam.java +++ b/src/com/engine/salary/entity/salaryacct/param/SalaryAcctEmployeeQueryParam.java @@ -7,6 +7,7 @@ import com.engine.salary.util.valid.DataCheck; import lombok.*; import java.util.Collection; +import java.util.Date; import java.util.List; /** @@ -31,8 +32,14 @@ public class SalaryAcctEmployeeQueryParam extends BaseQueryParam { //浜哄憳濮撳悕") private String employeeName; + /** + * 绋庢鎵灞炴湡 + */ + private Date taxCycle; + //涓◣鎵g即涔夊姟浜") private Long taxAgentId; + private List taxAgentIds; //鍒嗛儴 private List subcompanyIds; @@ -48,8 +55,8 @@ public class SalaryAcctEmployeeQueryParam extends BaseQueryParam { * 鐘舵 * @see SalaryEmployeeStatusEnum */ - private SalaryEmployeeStatusEnum status; + //鐘舵(澶氶) private List statuses; diff --git a/src/com/engine/salary/entity/salaryacct/po/SalaryAcctEmployeePO.java b/src/com/engine/salary/entity/salaryacct/po/SalaryAcctEmployeePO.java index 7d6c82f58..3e7e00b35 100644 --- a/src/com/engine/salary/entity/salaryacct/po/SalaryAcctEmployeePO.java +++ b/src/com/engine/salary/entity/salaryacct/po/SalaryAcctEmployeePO.java @@ -69,6 +69,11 @@ public class SalaryAcctEmployeePO { @SalaryFormulaVar(defaultLabel = "钖祫鎵灞炴湀", labelId = 86321, dataType = "string") private Date salaryMonth; + /** + * 绋庢鎵灞炴湡 + */ + private Date taxCycle; + /** * 绉熸埛key */ diff --git a/src/com/engine/salary/entity/salaryacct/po/SalaryAcctTaxAgentPO.java b/src/com/engine/salary/entity/salaryacct/po/SalaryAcctTaxAgentPO.java new file mode 100644 index 000000000..945482916 --- /dev/null +++ b/src/com/engine/salary/entity/salaryacct/po/SalaryAcctTaxAgentPO.java @@ -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; + + /** + * 钖祫鏍哥畻璁板綍鐨刬d + */ + private Long salaryAcctRecordId; + + /** + * 鏀跺叆鎵寰楅」鐩 + */ + private Integer incomeCategory; + + /** + * 涓◣鎵g即涔夊姟浜虹殑id + */ + private Long taxAgentId; + + /** + * 钖祫鎵灞炴湀 + */ + private Date salaryMonth; + + /** + * 绋庢鎵灞炴湡 + */ + private Date taxCycle; + + /** + * 绉熸埛key + */ + private String tenantKey; + + /** + * 鍒涘缓浜篿d + */ + private Long creator; + + /** + * 鏄惁鍒犻櫎 + */ + private Integer deleteType; + + /** + * 鍒涘缓鏃堕棿 + */ + private LocalDateTime createTime; + + /** + * 鏇存柊鏃堕棿 + */ + private LocalDateTime updateTime; +} diff --git a/src/com/engine/salary/entity/taxdeclaration/bo/TaxDeclareEmployeeBO.java b/src/com/engine/salary/entity/taxdeclaration/bo/TaxDeclareEmployeeBO.java index 0f1b6e5a6..22156a38c 100644 --- a/src/com/engine/salary/entity/taxdeclaration/bo/TaxDeclareEmployeeBO.java +++ b/src/com/engine/salary/entity/taxdeclaration/bo/TaxDeclareEmployeeBO.java @@ -1,88 +1,86 @@ -//package com.engine.salary.entity.taxdeclaration.bo; -// -//import com.engine.salary.entity.taxdeclaration.dto.AbnormalEmployeeListDTO; -//import com.engine.salary.entity.taxdeclaration.po.TaxDeclareEmployeePO; -//import com.google.common.collect.Lists; -//import com.weaver.hrm.salary.entity.employeedeclare.po.EmployeeDeclarePO; -//import com.weaver.hrm.salary.entity.extemployee.po.ExtEmployeePO; -//import com.weaver.hrm.salary.enums.employeedeclare.CardTypeEnum; -//import com.weaver.hrm.salary.enums.employeedeclare.DeclareStatusEnum; -//import com.weaver.hrm.salary.enums.salaryaccounting.EmployeeTypeEnum; -//import com.weaver.hrm.salary.util.SalaryEntityUtil; -//import com.weaver.hrm.salary.util.SalaryEnumUtil; -//import com.weaver.hrm.salary.util.SalaryI18nUtil; -//import com.weaver.teams.domain.hr.SimpleUserInfo; -//import com.weaver.teams.domain.user.SimpleEmployee; -//import org.apache.commons.collections4.CollectionUtils; -// -//import java.util.Collections; -//import java.util.List; -//import java.util.Map; -//import java.util.Objects; -//import java.util.function.Function; -//import java.util.stream.Collectors; -// -///** -// * @description: 涓◣鐢虫姤鏄庣粏琛ㄤ腑鐨勪汉鍛 -// * @author: xiajun -// * @modified By: xiajun -// * @date: Created in 2022/11/10 4:20 PM -// * @version:v1.0 -// */ -//public class TaxDeclareEmployeeBO { -// -// public static List convert2AbnormalEmployee(List taxDeclareEmployees, -// List employeeDeclares, -// List simpleEmployees, -// List simpleUserInfos, -// List extEmployees) { -// if (CollectionUtils.isEmpty(taxDeclareEmployees)) { -// return Collections.emptyList(); -// } -// List abnormalEmployeeList = Lists.newArrayList(); -// Map employeeDeclareMap = SalaryEntityUtil.convert2Map(employeeDeclares, EmployeeDeclarePO::getEmployeeId); -// Map simpleEmployeeMap = SalaryEntityUtil.convert2Map(simpleEmployees, SimpleEmployee::getEmployeeId); -// Map simpleUserInfoMap = simpleUserInfos.stream() -// .filter(simpleUserInfo -> Objects.nonNull(simpleUserInfo) && Objects.nonNull(simpleUserInfo.getUser())) -// .collect(Collectors.toMap(simpleUserInfo -> simpleUserInfo.getUser().getId(), Function.identity(), (a, b) -> a)); -// Map extEmployeePOMap = SalaryEntityUtil.convert2Map(extEmployees, ExtEmployeePO::getId); -// for (TaxDeclareEmployeePO taxDeclareEmployee : taxDeclareEmployees) { -// AbnormalEmployeeListDTO abnormalEmployeeListDTO = new AbnormalEmployeeListDTO() -// .setId(taxDeclareEmployee.getEmployeeId()) -// .setEmployeeId(taxDeclareEmployee.getEmployeeId()) -// .setEmployeeType(taxDeclareEmployee.getEmployeeType()); -// EmployeeDeclarePO employeeDeclare = employeeDeclareMap.get(taxDeclareEmployee.getEmployeeId()); -// if (employeeDeclare != null) { -// DeclareStatusEnum declareStatusEnum = SalaryEnumUtil.enumMatchByValue(employeeDeclare.getDeclareStatus(), DeclareStatusEnum.class); -// abnormalEmployeeListDTO -// .setEmployeeName(employeeDeclare.getEmployeeName()) -// .setJobNum(employeeDeclare.getJobNum()) -// .setCardType(SalaryI18nUtil.getI18nLabel(CardTypeEnum.RESIDENT_IDENTITY_CARDS.getLabelId(), CardTypeEnum.RESIDENT_IDENTITY_CARDS.getDefaultLabel())) -// .setCardNum(employeeDeclare.getCardNum()) -// .setDeclareStatus(declareStatusEnum) -// .setDeclareStatusDesc(declareStatusEnum == null ? "" : SalaryI18nUtil.getI18nLabel(declareStatusEnum.getLabelId(), declareStatusEnum.getDefaultLabel())); -// } else if (Objects.equals(taxDeclareEmployee.getEmployeeType(), EmployeeTypeEnum.ORGANIZATION.getValue())) { -// SimpleEmployee simpleEmployee = simpleEmployeeMap.get(taxDeclareEmployee.getEmployeeId()); -// SimpleUserInfo simpleUserInfo = simpleUserInfoMap.get(taxDeclareEmployee.getEmployeeId()); -// abnormalEmployeeListDTO -// .setEmployeeName(simpleEmployee.getUsername()) -// .setJobNum(simpleEmployee.getJobNum()) -// .setCardType(SalaryI18nUtil.getI18nLabel(CardTypeEnum.RESIDENT_IDENTITY_CARDS.getLabelId(), CardTypeEnum.RESIDENT_IDENTITY_CARDS.getDefaultLabel())) -// .setCardNum(simpleUserInfo == null ? "" : simpleUserInfo.getIdNo()) -// .setDeclareStatus(null) -// .setDeclareStatusDesc(SalaryI18nUtil.getI18nLabel(177863, "鎶ラ佷汉鍛樺垪琛ㄤ腑鏃犳浜哄憳")); -// } else { -// ExtEmployeePO extEmployee = extEmployeePOMap.get(taxDeclareEmployee.getEmployeeId()); -// abnormalEmployeeListDTO -// .setEmployeeName(extEmployee.getUsername()) -// .setJobNum("") -// .setCardType(SalaryI18nUtil.getI18nLabel(CardTypeEnum.RESIDENT_IDENTITY_CARDS.getLabelId(), CardTypeEnum.RESIDENT_IDENTITY_CARDS.getDefaultLabel())) -// .setCardNum(extEmployee.getCardNum()) -// .setDeclareStatus(null) -// .setDeclareStatusDesc(SalaryI18nUtil.getI18nLabel(177863, "鎶ラ佷汉鍛樺垪琛ㄤ腑鏃犳浜哄憳")); -// } -// abnormalEmployeeList.add(abnormalEmployeeListDTO); -// } -// return abnormalEmployeeList; -// } -//} +package com.engine.salary.entity.taxdeclaration.bo; + +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.dto.AbnormalEmployeeListDTO; +import com.engine.salary.entity.taxdeclaration.po.TaxDeclareEmployeePO; +import com.engine.salary.enums.employeedeclare.CardTypeEnum; +import com.engine.salary.enums.employeedeclare.DeclareStatusEnum; +import com.engine.salary.enums.salaryaccounting.EmployeeTypeEnum; +import com.engine.salary.util.SalaryEntityUtil; +import com.engine.salary.util.SalaryEnumUtil; +import com.engine.salary.util.SalaryI18nUtil; +import com.google.common.collect.Lists; +import org.apache.commons.collections4.CollectionUtils; + +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.function.Function; +import java.util.stream.Collectors; + +/** + * @description: 涓◣鐢虫姤鏄庣粏琛ㄤ腑鐨勪汉鍛 + * @author: xiajun + * @modified By: xiajun + * @date: Created in 2022/11/10 4:20 PM + * @version:v1.0 + */ +public class TaxDeclareEmployeeBO { + + public static List convert2AbnormalEmployee(List taxDeclareEmployees, + List employeeDeclares, + List simpleEmployees, + List simpleUserInfos, + List extEmployees) { + if (CollectionUtils.isEmpty(taxDeclareEmployees)) { + return Collections.emptyList(); + } + List abnormalEmployeeList = Lists.newArrayList(); + Map employeeDeclareMap = SalaryEntityUtil.convert2Map(employeeDeclares, EmployeeDeclarePO::getEmployeeId); + Map simpleEmployeeMap = SalaryEntityUtil.convert2Map(simpleEmployees, DataCollectionEmployee::getEmployeeId); + Map simpleUserInfoMap = simpleUserInfos.stream() + .collect(Collectors.toMap(DataCollectionEmployee::getEmployeeId, Function.identity(), (a, b) -> a)); + Map extEmployeePOMap = SalaryEntityUtil.convert2Map(extEmployees, ExtEmpPO::getId); + for (TaxDeclareEmployeePO taxDeclareEmployee : taxDeclareEmployees) { + AbnormalEmployeeListDTO abnormalEmployeeListDTO = new AbnormalEmployeeListDTO() + .setId(taxDeclareEmployee.getEmployeeId()) + .setEmployeeId(taxDeclareEmployee.getEmployeeId()) + .setEmployeeType(taxDeclareEmployee.getEmployeeType()); + EmployeeDeclarePO employeeDeclare = employeeDeclareMap.get(taxDeclareEmployee.getEmployeeId()); + if (employeeDeclare != null) { + DeclareStatusEnum declareStatusEnum = SalaryEnumUtil.enumMatchByValue(employeeDeclare.getDeclareStatus(), DeclareStatusEnum.class); + abnormalEmployeeListDTO + .setEmployeeName(employeeDeclare.getEmployeeName()) + .setJobNum(employeeDeclare.getJobNum()) + .setCardType(SalaryI18nUtil.getI18nLabel(CardTypeEnum.RESIDENT_IDENTITY_CARDS.getLabelId(), CardTypeEnum.RESIDENT_IDENTITY_CARDS.getDefaultLabel())) + .setCardNum(employeeDeclare.getCardNum()) + .setDeclareStatus(declareStatusEnum) + .setDeclareStatusDesc(declareStatusEnum == null ? "" : SalaryI18nUtil.getI18nLabel(declareStatusEnum.getLabelId(), declareStatusEnum.getDefaultLabel())); + } else if (Objects.equals(taxDeclareEmployee.getEmployeeType(), EmployeeTypeEnum.ORGANIZATION.getValue())) { + DataCollectionEmployee simpleEmployee = simpleEmployeeMap.get(taxDeclareEmployee.getEmployeeId()); + DataCollectionEmployee simpleUserInfo = simpleUserInfoMap.get(taxDeclareEmployee.getEmployeeId()); + abnormalEmployeeListDTO + .setEmployeeName(simpleEmployee.getUsername()) + .setJobNum(simpleEmployee.getWorkcode()) + .setCardType(SalaryI18nUtil.getI18nLabel(CardTypeEnum.RESIDENT_IDENTITY_CARDS.getLabelId(), CardTypeEnum.RESIDENT_IDENTITY_CARDS.getDefaultLabel())) + .setCardNum(simpleUserInfo == null ? "" : simpleUserInfo.getIdNo()) + .setDeclareStatus(null) + .setDeclareStatusDesc(SalaryI18nUtil.getI18nLabel(177863, "鎶ラ佷汉鍛樺垪琛ㄤ腑鏃犳浜哄憳")); + } else { + ExtEmpPO extEmployee = extEmployeePOMap.get(taxDeclareEmployee.getEmployeeId()); + abnormalEmployeeListDTO + .setEmployeeName(extEmployee.getUsername()) + .setJobNum("") + .setCardType(SalaryI18nUtil.getI18nLabel(CardTypeEnum.RESIDENT_IDENTITY_CARDS.getLabelId(), CardTypeEnum.RESIDENT_IDENTITY_CARDS.getDefaultLabel())) + .setCardNum(extEmployee.getIdNo()) + .setDeclareStatus(null) + .setDeclareStatusDesc(SalaryI18nUtil.getI18nLabel(177863, "鎶ラ佷汉鍛樺垪琛ㄤ腑鏃犳浜哄憳")); + } + abnormalEmployeeList.add(abnormalEmployeeListDTO); + } + return abnormalEmployeeList; + } +} diff --git a/src/com/engine/salary/entity/taxdeclaration/dto/TaxDeclarationInfoDTO.java b/src/com/engine/salary/entity/taxdeclaration/dto/TaxDeclarationInfoDTO.java index 11900c619..acb55f5b7 100644 --- a/src/com/engine/salary/entity/taxdeclaration/dto/TaxDeclarationInfoDTO.java +++ b/src/com/engine/salary/entity/taxdeclaration/dto/TaxDeclarationInfoDTO.java @@ -1,13 +1,16 @@ 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.ser.std.ToStringSerializer; +import io.swagger.annotations.ApiModelProperty; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; -import java.time.YearMonth; +import java.util.Date; /** * @description: 涓◣鐢虫姤琛ㄤ俊鎭 @@ -22,13 +25,46 @@ import java.time.YearMonth; @AllArgsConstructor public class TaxDeclarationInfoDTO { - //钖祫鎵灞炴湀") - @JsonSerialize(using = ToStringSerializer.class) - private YearMonth salaryMonth; - //涓◣鎵g即涔夊姟浜篿d") + @ApiModelProperty("钖祫鎵灞炴湀") + @JsonSerialize(using = ToStringSerializer.class) + private Date salaryMonth; + + @ApiModelProperty("绋庢鎵灞炴湡") + @JsonSerialize(using = ToStringSerializer.class) + private Date taxCycle; + + @ApiModelProperty("涓◣鎵g即涔夊姟浜篿d") + @JsonSerialize(using = ToStringSerializer.class) private Long taxAgentId; - //涓◣鎵g即涔夊姟浜哄悕绉") + @ApiModelProperty("涓◣鎵g即涔夊姟浜哄悕绉") 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; } diff --git a/src/com/engine/salary/entity/taxdeclaration/dto/TaxDeclareRecordListDTO.java b/src/com/engine/salary/entity/taxdeclaration/dto/TaxDeclareRecordListDTO.java index 5b8762da2..2e952ba37 100644 --- a/src/com/engine/salary/entity/taxdeclaration/dto/TaxDeclareRecordListDTO.java +++ b/src/com/engine/salary/entity/taxdeclaration/dto/TaxDeclareRecordListDTO.java @@ -4,10 +4,11 @@ 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.ser.std.ToStringSerializer; -import io.swagger.annotations.ApiModelProperty; import lombok.Data; import lombok.experimental.Accessors; +import java.util.Date; + /** * @description: 涓◣鐢虫姤璁板綍鍒楄〃 * @author: xiajun @@ -30,10 +31,10 @@ public class TaxDeclareRecordListDTO { private String taxAgentName; //钖祫鎵灞炴湀") - private String salaryMonth; + private Date salaryMonth; //绋庢鎵灞炴湡") - private String taxCycle; + private Date taxCycle; //鐢虫姤绫诲瀷") private TaxDeclareTypeEnum taxDeclareType; diff --git a/src/com/engine/salary/entity/taxdeclaration/param/AbnormalEmployeeListQueryParam.java b/src/com/engine/salary/entity/taxdeclaration/param/AbnormalEmployeeListQueryParam.java index dc8682958..09b322559 100644 --- a/src/com/engine/salary/entity/taxdeclaration/param/AbnormalEmployeeListQueryParam.java +++ b/src/com/engine/salary/entity/taxdeclaration/param/AbnormalEmployeeListQueryParam.java @@ -2,10 +2,11 @@ package com.engine.salary.entity.taxdeclaration.param; import com.engine.salary.common.BaseQueryParam; import com.fasterxml.jackson.annotation.JsonIgnore; -import io.swagger.annotations.ApiModelProperty; import lombok.Data; import lombok.experimental.Accessors; +import java.util.Date; + /** * @description: 涓◣鐢虫姤-寮傚父鏁版嵁-鏈姤閫佷汉鍛樺垪琛 * @author: xiajun @@ -29,5 +30,5 @@ public class AbnormalEmployeeListQueryParam extends BaseQueryParam { @JsonIgnore //绋庢鎵灞炴湡") - private String taxCycle; + private Date taxCycle; } diff --git a/src/com/engine/salary/entity/taxdeclaration/param/TaxDeclarationListQueryParam.java b/src/com/engine/salary/entity/taxdeclaration/param/TaxDeclarationListQueryParam.java index 521fadd56..16ed00006 100644 --- a/src/com/engine/salary/entity/taxdeclaration/param/TaxDeclarationListQueryParam.java +++ b/src/com/engine/salary/entity/taxdeclaration/param/TaxDeclarationListQueryParam.java @@ -1,7 +1,10 @@ package com.engine.salary.entity.taxdeclaration.param; import com.engine.salary.common.BaseQueryParam; -import lombok.*; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; import java.time.YearMonth; @@ -28,4 +31,7 @@ public class TaxDeclarationListQueryParam extends BaseQueryParam { private String fromSalaryMonthStr; private String endSalaryMonthStr; + + //涓◣鎵g即涔夊姟浜鸿彍鍗") + private String taxAgentName; } diff --git a/src/com/engine/salary/entity/taxdeclaration/po/TaxDeclarationPO.java b/src/com/engine/salary/entity/taxdeclaration/po/TaxDeclarationPO.java index 8319f9e4d..67acbc304 100644 --- a/src/com/engine/salary/entity/taxdeclaration/po/TaxDeclarationPO.java +++ b/src/com/engine/salary/entity/taxdeclaration/po/TaxDeclarationPO.java @@ -82,6 +82,12 @@ public class TaxDeclarationPO { */ private Date updateTime; + + /** + * 鏌ョ湅鎺у埗 + */ + private Integer controlView; + //绋庢鎵灞炴湡 LocalDateRange salaryMonths; diff --git a/src/com/engine/salary/entity/taxdeclaration/po/TaxDeclareRecordPO.java b/src/com/engine/salary/entity/taxdeclaration/po/TaxDeclareRecordPO.java index 5a708da50..0a257bf4a 100644 --- a/src/com/engine/salary/entity/taxdeclaration/po/TaxDeclareRecordPO.java +++ b/src/com/engine/salary/entity/taxdeclaration/po/TaxDeclareRecordPO.java @@ -1,9 +1,13 @@ package com.engine.salary.entity.taxdeclaration.po; +import lombok.AllArgsConstructor; +import lombok.Builder; import lombok.Data; +import lombok.NoArgsConstructor; import lombok.experimental.Accessors; import java.io.Serializable; +import java.util.Collection; import java.util.Date; /** @@ -15,6 +19,9 @@ import java.util.Date; */ @Data @Accessors(chain = true) +@Builder +@AllArgsConstructor +@NoArgsConstructor //hrsa_tax_declare_record") //涓◣鐢虫姤璁板綍") public class TaxDeclareRecordPO implements Serializable { @@ -23,89 +30,82 @@ public class TaxDeclareRecordPO implements Serializable { /** * 涓婚敭id */ - //涓婚敭id") private Long id; /** * 涓◣鎵g即涔夊姟浜篿d */ - //涓◣鎵g即涔夊姟浜") private Long taxAgentId; /** * 钖祫鎵灞炴湀 */ - //钖祫鎵灞炴湀") - private String salaryMonth; + private Date salaryMonth; /** * 绋庢鎵灞炴湡 */ - //绋庢鎵灞炴湡") - private String taxCycle; + private Date taxCycle; /** * 鐢虫姤绫诲瀷 */ - //鐢虫姤绫诲瀷") private Integer taxDeclareType; /** * 鐢虫姤鐘舵 */ - //鐢虫姤鐘舵") private Integer taxDeclareStatus; /** * 鐢虫姤澶辫触鐨勯敊璇俊鎭 */ - //鐢虫姤澶辫触鐨勯敊璇俊鎭") private String taxDeclareErrorMsg; /** * 璇锋眰鐨剅equestId */ - //璇锋眰鐨剅equestId") private String requestId; /** * 澶囨敞 */ - //澶囨敞") private String remark; - //搴旂即閲戦") + //搴旂即閲戦 private String taxPayAmount; - //瀹炵即鎬婚") + //瀹炵即鎬婚 private String taxPaidAmount; - //瀹炵即绋庨锛堜笉鍚粸绾抽噾绛夛級") + //瀹炵即绋庨锛堜笉鍚粸绾抽噾绛夛級 private String taxPurePaidAmount; - //鐢虫姤浜烘暟") + //鐢虫姤浜烘暟 private Integer personNum; /** * 涓◣鐢虫姤琛ㄧ殑寰呭埛鏂版暟鎹殑鏍囪瘑 */ - //涓◣鐢虫姤琛ㄧ殑寰呭埛鏂版暟鎹殑鏍囪瘑") private Integer displayUpdateIcon; /** * 绉熸埛key */ - //绉熸埛key", ignore = true) private String tenantKey; /** * 鍒涘缓浜篿d */ - //鍒涘缓浜篿d", ignore = true) private Long creator; /** * 鏄惁鍒犻櫎 */ - //鏄惁鍒犻櫎", ignore = true) private Integer deleteType; /** * 鍒涘缓鏃堕棿 */ - //鍒涘缓鏃堕棿", ignore = true) private Date createTime; /** * 鏇存柊鏃堕棿 */ - //鏇存柊鏃堕棿", ignore = true) private Date updateTime; + + + private Collection ids; + private Collection taxAgentIds; + private Date startDate; + private Date endDate; + private Date salaryMonthStartDate; + private Date salaryMonthEndDate; } diff --git a/src/com/engine/salary/mapper/salaryacct/SalaryAcctRecordMapper.java b/src/com/engine/salary/mapper/salaryacct/SalaryAcctRecordMapper.java index 4b560b7c2..0863b5358 100644 --- a/src/com/engine/salary/mapper/salaryacct/SalaryAcctRecordMapper.java +++ b/src/com/engine/salary/mapper/salaryacct/SalaryAcctRecordMapper.java @@ -2,6 +2,7 @@ package com.engine.salary.mapper.salaryacct; import com.engine.salary.common.LocalDateRange; import com.engine.salary.entity.salaryacct.po.SalaryAcctRecordPO; +import com.engine.salary.entity.salaryacct.po.SalaryAcctTaxAgentPO; import org.apache.ibatis.annotations.Param; import java.util.Collection; @@ -78,4 +79,12 @@ public interface SalaryAcctRecordMapper { void updateLockSalaryItemIds(SalaryAcctRecordPO salaryAcctRecord); List getBackCalcRecordByIds(@Param("collection") Set salaryAcctIds); + + + /** + * 鑾峰彇鏍哥畻璁板綍鍜屾墸缂翠箟鍔′汉瀵瑰簲鍏崇郴 + * @param salaryAcctIds + * @return + */ + List listAcctTaxAgent(Collection salaryAcctIds); } \ No newline at end of file diff --git a/src/com/engine/salary/mapper/salaryacct/SalaryAcctRecordMapper.xml b/src/com/engine/salary/mapper/salaryacct/SalaryAcctRecordMapper.xml index 4266b9277..b1abf055d 100644 --- a/src/com/engine/salary/mapper/salaryacct/SalaryAcctRecordMapper.xml +++ b/src/com/engine/salary/mapper/salaryacct/SalaryAcctRecordMapper.xml @@ -15,7 +15,8 @@ - + @@ -148,7 +149,7 @@ FROM hrsa_salary_acct_record t where delete_type = 0 - AND back_calc_status = 1 + AND back_calc_status = 1 AND id IN @@ -422,4 +423,24 @@ WHERE id = #{id} AND delete_type = 0 + + + \ No newline at end of file diff --git a/src/com/engine/salary/mapper/taxagent/TaxDeclareRecordMapper.java b/src/com/engine/salary/mapper/taxagent/TaxDeclareRecordMapper.java deleted file mode 100644 index 6142d2c21..000000000 --- a/src/com/engine/salary/mapper/taxagent/TaxDeclareRecordMapper.java +++ /dev/null @@ -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 { -} diff --git a/src/com/engine/salary/mapper/taxdeclaration/TaxDeclarationDetailMapper.java b/src/com/engine/salary/mapper/taxdeclaration/TaxDeclarationDetailMapper.java index cbe931b93..3ee8b562a 100644 --- a/src/com/engine/salary/mapper/taxdeclaration/TaxDeclarationDetailMapper.java +++ b/src/com/engine/salary/mapper/taxdeclaration/TaxDeclarationDetailMapper.java @@ -1,8 +1,10 @@ package com.engine.salary.mapper.taxdeclaration; 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.po.TaxDeclarationDetailPO; +import com.engine.salary.entity.taxdeclaration.po.TaxDeclareEmployeePO; import org.apache.ibatis.annotations.Param; import java.util.Collection; @@ -70,4 +72,12 @@ public interface TaxDeclarationDetailMapper { List listAll(); int batchUpdate(@Param("collection") List taxDeclarationDetailPos); + + List listPage4NotDeclareByParam(AbnormalEmployeeListQueryParam queryParam); + + List list4NotDeclareByParam(AbnormalEmployeeListQueryParam queryParam); + + List listPage4NoValueByParam(AbnormalEmployeeListQueryParam queryParam); + + List list4NoValueByParam(AbnormalEmployeeListQueryParam queryParam); } \ No newline at end of file diff --git a/src/com/engine/salary/mapper/taxdeclaration/TaxDeclareRecordMapper.java b/src/com/engine/salary/mapper/taxdeclaration/TaxDeclareRecordMapper.java new file mode 100644 index 000000000..e8cedfc93 --- /dev/null +++ b/src/com/engine/salary/mapper/taxdeclaration/TaxDeclareRecordMapper.java @@ -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 listAll(); + + /** + * 鏉′欢鏌ヨ + * + * @return 杩斿洖闆嗗悎锛屾病鏈夎繑鍥炵┖List + */ + List listSome(TaxDeclareRecordPO taxDeclareRecord); + + + /** + * 鏍规嵁涓婚敭鏌ヨ + * + * @param id 涓婚敭 + * @return 杩斿洖璁板綍锛屾病鏈夎繑鍥瀗ull + */ + TaxDeclareRecordPO getById(Long id); + + /** + * 鏂板锛屽拷鐣ull瀛楁 + * + * @param taxDeclareRecord 鏂板鐨勮褰 + * @return 杩斿洖褰卞搷琛屾暟 + */ + int insertIgnoreNull(TaxDeclareRecordPO taxDeclareRecord); + + /** + * 鎵归噺鎻掑叆 + * + * @param taxDeclareRecord + */ + void batchInsert(@Param("collection") List taxDeclareRecord); + + /** + * 淇敼锛屼慨鏀规墍鏈夊瓧娈 + * + * @param taxDeclareRecord 淇敼鐨勮褰 + * @return 杩斿洖褰卞搷琛屾暟 + */ + int update(TaxDeclareRecordPO taxDeclareRecord); + + /** + * 淇敼锛屽拷鐣ull瀛楁 + * + * @param taxDeclareRecord 淇敼鐨勮褰 + * @return 杩斿洖褰卞搷琛屾暟 + */ + int updateIgnoreNull(TaxDeclareRecordPO taxDeclareRecord); + + /** + * 鍒犻櫎璁板綍 + * + * @param taxDeclareRecord 寰呭垹闄ょ殑璁板綍 + * @return 杩斿洖褰卞搷琛屾暟 + */ + int delete(TaxDeclareRecordPO taxDeclareRecord); + + /** + * 鎵归噺鍒犻櫎璁板綍 + * @param ids 涓婚敭id闆嗗悎 + */ + void deleteByIds(@Param("ids") Collection ids); + +} \ No newline at end of file diff --git a/src/com/engine/salary/mapper/taxdeclaration/TaxDeclareRecordMapper.xml b/src/com/engine/salary/mapper/taxdeclaration/TaxDeclareRecordMapper.xml new file mode 100644 index 000000000..e3d62fdcc --- /dev/null +++ b/src/com/engine/salary/mapper/taxdeclaration/TaxDeclareRecordMapper.xml @@ -0,0 +1,536 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + + + + + + + + + + + + + + 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, + + + + + #{id}, + + + #{createTime}, + + + #{updateTime}, + + + #{creator}, + + + #{deleteType}, + + + #{tenantKey}, + + + #{taxAgentId}, + + + #{salaryMonth}, + + + #{taxCycle}, + + + #{remark}, + + + #{requestId}, + + + #{taxDeclareType}, + + + #{taxDeclareStatus}, + + + #{displayUpdateIcon}, + + + #{taxPayAmount}, + + + #{personNum}, + + + #{taxDeclareErrorMsg}, + + + #{taxPaidAmount}, + + + #{taxPurePaidAmount}, + + + + + + + + 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}, + #{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}, + + ) + + + + + 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, + ) + + + 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 + + + + + + + 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銆丏ATE銆乂ARCHAR銆両NTEGER}, + #{item.createTime,jdbcType=DOUBLE銆丏ATE銆乂ARCHAR銆両NTEGER}, + #{item.updateTime,jdbcType=DOUBLE銆丏ATE銆乂ARCHAR銆両NTEGER}, + #{item.creator,jdbcType=DOUBLE銆丏ATE銆乂ARCHAR銆両NTEGER}, + #{item.deleteType,jdbcType=DOUBLE銆丏ATE銆乂ARCHAR銆両NTEGER}, + #{item.tenantKey,jdbcType=DOUBLE銆丏ATE銆乂ARCHAR銆両NTEGER}, + #{item.taxAgentId,jdbcType=DOUBLE銆丏ATE銆乂ARCHAR銆両NTEGER}, + #{item.salaryMonth,jdbcType=DOUBLE銆丏ATE銆乂ARCHAR銆両NTEGER}, + #{item.taxCycle,jdbcType=DOUBLE銆丏ATE銆乂ARCHAR銆両NTEGER}, + #{item.remark,jdbcType=DOUBLE銆丏ATE銆乂ARCHAR銆両NTEGER}, + #{item.requestId,jdbcType=DOUBLE銆丏ATE銆乂ARCHAR銆両NTEGER}, + #{item.taxDeclareType,jdbcType=DOUBLE銆丏ATE銆乂ARCHAR銆両NTEGER}, + #{item.taxDeclareStatus,jdbcType=DOUBLE銆丏ATE銆乂ARCHAR銆両NTEGER}, + #{item.displayUpdateIcon,jdbcType=DOUBLE銆丏ATE銆乂ARCHAR銆両NTEGER}, + #{item.taxPayAmount,jdbcType=DOUBLE銆丏ATE銆乂ARCHAR銆両NTEGER}, + #{item.personNum,jdbcType=DOUBLE銆丏ATE銆乂ARCHAR銆両NTEGER}, + #{item.taxDeclareErrorMsg,jdbcType=DOUBLE銆丏ATE銆乂ARCHAR銆両NTEGER}, + #{item.taxPaidAmount,jdbcType=DOUBLE銆丏ATE銆乂ARCHAR銆両NTEGER}, + #{item.taxPurePaidAmount,jdbcType=DOUBLE銆丏ATE銆乂ARCHAR銆両NTEGER}, + ) + + + + + + UPDATE hrsa_tax_declare_record + + 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}, + + WHERE id = #{id} AND delete_type = 0 + + + + + + UPDATE hrsa_tax_declare_record + + + 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}, + + + WHERE id = #{id} AND delete_type = 0 + + + + + + UPDATE hrsa_tax_declare_record + SET delete_type=1 + WHERE id = #{id} + AND delete_type = 0 + + + + UPDATE hrsa_tax_declare_record + SET delete_type = 1 + WHERE delete_type = 0 + AND id IN + + #{id} + + + + + \ No newline at end of file diff --git a/src/com/engine/salary/service/ExtEmpService.java b/src/com/engine/salary/service/ExtEmpService.java index d6f3b2d7d..b3a897798 100644 --- a/src/com/engine/salary/service/ExtEmpService.java +++ b/src/com/engine/salary/service/ExtEmpService.java @@ -22,6 +22,8 @@ public interface ExtEmpService { void delete(Collection ids); + List getExtEmpByIds(List ids); + DataCollectionEmployee getEmployeeById(Long id); /** diff --git a/src/com/engine/salary/service/SalaryAcctCalcService.java b/src/com/engine/salary/service/SalaryAcctCalcService.java deleted file mode 100644 index 842622b3c..000000000 --- a/src/com/engine/salary/service/SalaryAcctCalcService.java +++ /dev/null @@ -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 { -// -// /** -// * 鎸夎柂璧勬牳绠楄褰昳d杩涜鏍哥畻 -// * -// * @param salaryAcctRecordId -// * @param simpleEmployee -// */ -// void calcByRecordId(Long salaryAcctRecordId, DataCollectionEmployee simpleEmployee) throws Exception; -// -// /** -// * 鎸夎柂璧勬牳绠椾汉鍛榠d杩涜鏍哥畻 -// * -// * @param salaryAcctEmployeeIds -// * @param simpleEmployee -// */ -// void calcByEmployeeIds(Long salaryAcctRecordId, Collection salaryAcctEmployeeIds, DataCollectionEmployee simpleEmployee) throws Exception; -//} diff --git a/src/com/engine/salary/service/SalaryAcctRecordService.java b/src/com/engine/salary/service/SalaryAcctRecordService.java index 1ba3419bf..4e7c8eb2e 100644 --- a/src/com/engine/salary/service/SalaryAcctRecordService.java +++ b/src/com/engine/salary/service/SalaryAcctRecordService.java @@ -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.po.SalaryAcctRecordPO; 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.enums.salaryaccounting.SalaryAcctRecordStatusEnum; import com.engine.salary.util.page.PageInfo; @@ -207,4 +208,13 @@ public interface SalaryAcctRecordService { List listSome(SalaryAcctRecordPO po); + + /** + * 鏍规嵁钖祫鏍哥畻璁板綍id鏌ヨ鍏宠仈鐨勪釜绋庢墸缂翠箟鍔′汉 + * + * @param salaryAcctRecordIds + * @return + */ + List listBySalaryAcctRecordIds(Collection salaryAcctRecordIds); + } diff --git a/src/com/engine/salary/service/TaxDeclarationService.java b/src/com/engine/salary/service/TaxDeclarationService.java index 7537c1c06..4e7d0e3ce 100644 --- a/src/com/engine/salary/service/TaxDeclarationService.java +++ b/src/com/engine/salary/service/TaxDeclarationService.java @@ -50,4 +50,13 @@ public interface TaxDeclarationService { * @param taxDeclarationId */ void withDrawTaxDeclaration(Long taxDeclarationId); + + /** + * 鍒犻櫎涓◣鐢虫姤琛 + * + * @param taxDeclareRecordIds + */ + void deleteByTaxDeclareRecordIds(Collection taxDeclareRecordIds); + + void saveBatch(List taxDeclarations); } diff --git a/src/com/engine/salary/service/TaxDeclarationValueService.java b/src/com/engine/salary/service/TaxDeclarationValueService.java new file mode 100644 index 000000000..1eedf2b59 --- /dev/null +++ b/src/com/engine/salary/service/TaxDeclarationValueService.java @@ -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 listPageByTaxDeclarationIds( Collection taxDeclarationIds); + + /** + * 鏌ヨ涓◣鐢虫姤琛ㄦ槑缁 + * + * @param taxDeclarationIds + * @param tenantKey + * @return + */ + List listByTaxDeclarationIds(Collection taxDeclarationIds); + + /** + * 鏌ヨ涓◣鐢虫姤琛ㄦ槑缁 + * + * @param taxDeclarationIds + * @param tenantKey + * @return + */ + List listByTaxDeclarationIdsNoDecrypt(Collection taxDeclarationIds); + + /** + * 涓◣鐢虫姤琛ㄦ槑缁嗗垪琛 + * + * @param taxDeclarationValues + * @param tenantKey + * @return + */ + TaxDeclarationValueListDTO convert2List(TaxDeclarationPO taxDeclaration, List taxDeclarationValues); + + /** + * 鎵归噺淇濆瓨 + * + * @param taxDeclarationValues + * @param tenantKey + */ + void batchSave(List taxDeclarationValues); + + /** + * 鍒犻櫎涓◣鐢虫姤琛ㄦ槑缁 + * + * @param taxDeclareRecordIds + * @param tenantKey + */ + void deleteByTaxDeclareRecordIds(Collection taxDeclareRecordIds); +} diff --git a/src/com/engine/salary/service/TaxDeclareEmployeeService.java b/src/com/engine/salary/service/TaxDeclareEmployeeService.java new file mode 100644 index 000000000..7b29555cb --- /dev/null +++ b/src/com/engine/salary/service/TaxDeclareEmployeeService.java @@ -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 listPage4NotDeclareByParam(AbnormalEmployeeListQueryParam queryParam); + + /** + * 鏌ヨ涓◣鐢虫姤琛ㄦ槑缁嗕腑鏈姤閫佹垚鍔熺殑浜哄憳 + * + * @param queryParam + * @return + */ + List list4NotDeclareByParam(AbnormalEmployeeListQueryParam queryParam); + + /** + * 鏌ヨ宸叉姤閫佷絾鏄病鏈夌敵鎶ユ暟鎹殑浜哄憳 + * + * @param queryParam + * @return + */ + PageInfo listPage4NoValueByParam(AbnormalEmployeeListQueryParam queryParam); + + /** + * 鏌ヨ宸叉姤閫佷絾鏄病鏈夌敵鎶ユ暟鎹殑浜哄憳 + * + * @param queryParam + * @return + */ + List list4NoValueByParam(AbnormalEmployeeListQueryParam queryParam); + + /** + * 杞崲鎴愭暟鎹紓甯镐汉鍛榙to + * + * @param taxDeclareRecord + * @param taxDeclareEmployees + * @return + */ + List convert2AbnormalEmployeeList(TaxDeclareRecordPO taxDeclareRecord, List taxDeclareEmployees); +} diff --git a/src/com/engine/salary/service/TaxDeclareFailService.java b/src/com/engine/salary/service/TaxDeclareFailService.java new file mode 100644 index 000000000..25b649933 --- /dev/null +++ b/src/com/engine/salary/service/TaxDeclareFailService.java @@ -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 listPageByTaxDeclareRecordIds( Collection taxDeclareRecordIds); + + /** + * 鏍规嵁涓◣鐢虫姤璁板綍id鏌ヨ鐢虫姤澶辫触鏁版嵁 + * + * @param taxDeclareRecordIds + * @return + */ + List listByTaxDeclareRecordIds(Collection taxDeclareRecordIds); + + /** + * 鏍规嵁涓◣鐢虫姤璁板綍id鍒犻櫎鐢虫姤澶辫触鏁版嵁 + * + * @param taxDeclareRecordIds + */ + void deleteByTaxDeclareRecordIds(Collection taxDeclareRecordIds); + + /** + * 杞崲鎴愮敵鎶ュけ璐ユ暟鎹甦to + * + * @param taxDeclareRecord + * @param taxDeclareFails + * @return + */ + List convert2FailEmployeeList(TaxDeclareRecordPO taxDeclareRecord, List taxDeclareFails); +} diff --git a/src/com/engine/salary/service/TaxDeclareRecordService.java b/src/com/engine/salary/service/TaxDeclareRecordService.java index 4f64025d6..4fdfb64aa 100644 --- a/src/com/engine/salary/service/TaxDeclareRecordService.java +++ b/src/com/engine/salary/service/TaxDeclareRecordService.java @@ -1,11 +1,16 @@ 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.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.TaxDeclareRecordPO; +import com.engine.salary.util.page.PageInfo; -import java.time.YearMonth; import java.util.Collection; +import java.util.Date; +import java.util.List; /** * @description: 涓◣鐢虫姤 @@ -24,164 +29,139 @@ public interface TaxDeclareRecordService { */ TaxDeclareRecordPO getById(Long id); -// /** -// * 鏌ヨ涓◣鐢虫姤璁板綍 -// * -// * @param ids -// * @param tenantKey -// * @return -// */ -// List listByIds(Collection ids, String tenantKey); -// -// /** -// * 鏌ヨ涓◣鐢虫姤璁板綍 -// * -// * @param taxCycleRange -// * @param tenantKey -// * @return -// */ -// List listByTaxCycleRange(YearMonthRange taxCycleRange, String tenantKey); -// -// /** -// * 鏍规嵁涓◣鎵g即涔夊姟浜篿d銆佺◣娆炬墍灞炴湡鏌ヨ涓◣鐢虫姤璁板綍 -// * -// * @param taxAgentIds -// * @param taxCycle -// * @param tenantKey -// * @return -// */ -// List listByTaxCycleAndTaxAgentIds(YearMonth taxCycle, Collection taxAgentIds, String tenantKey); -// -// /** -// * 鏍规嵁涓◣鎵g即涔夊姟浜篿d銆佽柂璧勬墍灞炴湀鏌ヨ涓◣鐢虫姤璁板綍 -// * -// * @param salaryMonth -// * @param taxAgentIds -// * @param tenantKey -// * @return -// */ -// List listBySalaryMonthAndTaxAgentIds(YearMonth salaryMonth, Collection taxAgentIds, String tenantKey); -// -// /** -// * 鏌ヨ涓◣鐢虫姤璁板綍 -// * -// * @param queryParam -// * @param tenantKey -// * @return -// */ -// Page listPageByParam(TaxDeclarationListQueryParam queryParam, Long employeeId, String tenantKey); -// -// /** -// * 鐢熸垚鐢虫姤琛 -// * -// * @param saveParam -// * @param employeeId -// * @param tenantKey -// */ -// void save(TaxDeclarationSaveParam saveParam, Long employeeId, String tenantKey); + /** + * 鏌ヨ涓◣鐢虫姤璁板綍 + * + * @param ids + * @return + */ + List listByIds(Collection ids); + + /** + * 鏌ヨ涓◣鐢虫姤璁板綍 + * + * @param taxCycleRange + * @return + */ + List listByTaxCycleRange(YearMonthRange taxCycleRange); + + /** + * 鏍规嵁涓◣鎵g即涔夊姟浜篿d銆佺◣娆炬墍灞炴湡鏌ヨ涓◣鐢虫姤璁板綍 + * + * @param taxAgentIds + * @param taxCycle + * @return + */ + List listByTaxCycleAndTaxAgentIds(Date taxCycle, Collection taxAgentIds); + + /** + * 鏍规嵁涓◣鎵g即涔夊姟浜篿d銆佽柂璧勬墍灞炴湀鏌ヨ涓◣鐢虫姤璁板綍 + * + * @param salaryMonth + * @param taxAgentIds + * @return + */ + List listBySalaryMonthAndTaxAgentIds(Date salaryMonth, Collection taxAgentIds); + + /** + * 鏌ヨ涓◣鐢虫姤璁板綍 + * + * @param queryParam + * @return + */ + PageInfo listPageByParam(TaxDeclarationListQueryParam queryParam); + + /** + * 鐢熸垚鐢虫姤琛 + * + * @param saveParam + */ + void save(TaxDeclarationSaveParam saveParam); /** * 鍒锋柊鏁版嵁 * * @param id - * @param employeeId - * @param tenantKey */ - void refreshData(Long id, Long employeeId, String tenantKey); + void refreshData(Long 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 taxAgentIds - * @param tenantKey */ - void updateByTaxCycleAndTaxAgentIds(YearMonth taxCycle, Collection taxAgentIds, String tenantKey); + void updateByTaxCycleAndTaxAgentIds(Date taxCycle, Collection taxAgentIds); /** * 鍒ゆ柇鏄惁鏈夋潈闄愬彲鏌ョ湅涓◣鐢虫姤琛 * * @param taxDeclaration - * @param employeeId - * @param tenantKey * @return */ - boolean checkByAuthority(TaxDeclarationPO taxDeclaration, Long employeeId, String tenantKey); + boolean checkByAuthority(TaxDeclarationPO taxDeclaration); /** * 鏍规嵁id鍒犻櫎 * * @param ids - * @param tenantKey */ - void deleteByIds(Collection ids, String tenantKey); + void deleteByIds(Collection ids); /** * 涓◣鐢虫姤 * * @param id - * @param tenantKey */ - void declare(Long id, Long employeeId, String tenantKey); + void declare(Long id); /** * 涓◣鐢虫姤鑾峰彇鍙嶉 * * @param id - * @param tenantKey */ - void getDeclareFeedback(Long id, TaxDeclarationRateDTO taxDeclarationRate, Long employeeId, String tenantKey); + void getDeclareFeedback(Long id, TaxDeclarationRateDTO taxDeclarationRate); /** * 浣滃簾 * * @param id - * @param tenantKey */ - void cancelDeclare(Long id, Long employeeId, String tenantKey); + void cancelDeclare(Long id); /** * 鑾峰彇浣滃簾鍙嶉 * * @param id - * @param tenantKey */ - void getCancelFeedback(Long id, TaxDeclarationRateDTO taxDeclarationRate, Long employeeId, String tenantKey); + void getCancelFeedback(Long id, TaxDeclarationRateDTO taxDeclarationRate); /** * 鏇存鐢虫姤 * * @param id - * @param employeeId - * @param tenantKey */ - void updateDeclare(Long id, Long employeeId, String tenantKey); + void updateDeclare(Long id); /** * 绋庡眬绔敵鎶ョ姸鎬佹煡璇 * * @param id - * @param employeeId - * @param tenantKey */ - String queryDeclareStatus(Long id, Long employeeId, String tenantKey); + String queryDeclareStatus(Long id); /** * 绋庡眬绔敵鎶ユ槑缁嗘煡璇 * * @param id - * @param employeeId - * @param tenantKey */ - String queryCompanyIncomes(Long id, Long employeeId, String tenantKey); + String queryCompanyIncomes(Long id); } diff --git a/src/com/engine/salary/service/TaxReportColumnService.java b/src/com/engine/salary/service/TaxReportColumnService.java new file mode 100644 index 000000000..28ba37b8b --- /dev/null +++ b/src/com/engine/salary/service/TaxReportColumnService.java @@ -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 listAll(); + + /** + * 鏍规嵁鎵寰楅」鐩煡璇釜绋庣敵鎶ヨ〃琛ㄥご + * + * @param incomeCategory + * @return + */ + List listByIncomeCategory(IncomeCategoryEnum incomeCategory); +} diff --git a/src/com/engine/salary/service/factory/SalaryCalcRunServiceFactory.java b/src/com/engine/salary/service/factory/SalaryCalcRunServiceFactory.java index f1ca117ab..938452813 100644 --- a/src/com/engine/salary/service/factory/SalaryCalcRunServiceFactory.java +++ b/src/com/engine/salary/service/factory/SalaryCalcRunServiceFactory.java @@ -22,7 +22,7 @@ // // private final Map serviceMap = new ConcurrentHashMap<>(); // -// @Autowired +// // public SalaryCalcRunServiceFactory(Map map) { // for (Map.Entry entry : map.entrySet()) { // serviceMap.put(entry.getValue().getCalcType(), entry.getValue()); diff --git a/src/com/engine/salary/service/factory/TaxPaymentServiceFactory.java b/src/com/engine/salary/service/factory/TaxPaymentServiceFactory.java index dde22b970..d8587a395 100644 --- a/src/com/engine/salary/service/factory/TaxPaymentServiceFactory.java +++ b/src/com/engine/salary/service/factory/TaxPaymentServiceFactory.java @@ -16,7 +16,7 @@ //public class TaxPaymentServiceFactory { // private final Map serviceMap = new ConcurrentHashMap<>(); // -// @Autowired +// // public TaxPaymentServiceFactory(Map map) { // for (Map.Entry entry : map.entrySet()) { // serviceMap.putIfAbsent(entry.getValue().getServiceType(), entry.getValue()); diff --git a/src/com/engine/salary/service/impl/ExtEmpServiceImpl.java b/src/com/engine/salary/service/impl/ExtEmpServiceImpl.java index 8de9513ee..755b9e32f 100644 --- a/src/com/engine/salary/service/impl/ExtEmpServiceImpl.java +++ b/src/com/engine/salary/service/impl/ExtEmpServiceImpl.java @@ -109,6 +109,18 @@ public class ExtEmpServiceImpl extends Service implements ExtEmpService { } } + @Override + public List getExtEmpByIds(List ids) { + if (CollectionUtils.isEmpty(ids)) { + return new ArrayList<>(); + } + List extEmpPOS = new ArrayList<>(); + List> partition = Lists.partition(ids, 500); + partition.forEach(list -> extEmpPOS.addAll(getExternalEmployeeMapper().listSome(ExtEmpPO.builder().ids(list).build()))); + return extEmpPOS; + + } + @Override public DataCollectionEmployee getEmployeeById(Long id) { ExtEmpPO po = getExternalEmployeeMapper().getById(id); diff --git a/src/com/engine/salary/service/impl/SalaryAcctRecordServiceImpl.java b/src/com/engine/salary/service/impl/SalaryAcctRecordServiceImpl.java index 459873c3e..35fcdab05 100644 --- a/src/com/engine/salary/service/impl/SalaryAcctRecordServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalaryAcctRecordServiceImpl.java @@ -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.SalaryAcctRecordPO; 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.po.SalarySobPO; import com.engine.salary.enums.salaryaccounting.SalaryAcctRecordStatusEnum; @@ -806,4 +807,12 @@ public class SalaryAcctRecordServiceImpl extends Service implements SalaryAcctRe public List listSome(SalaryAcctRecordPO po) { return getSalaryAcctRecordMapper().listSome(po); } + + @Override + public List listBySalaryAcctRecordIds(Collection salaryAcctRecordIds) { + if (CollectionUtils.isEmpty(salaryAcctRecordIds)) { + return Collections.emptyList(); + } + return getSalaryAcctRecordMapper().listAcctTaxAgent(salaryAcctRecordIds); + } } diff --git a/src/com/engine/salary/service/impl/SalaryItemServiceImpl.java b/src/com/engine/salary/service/impl/SalaryItemServiceImpl.java index d2c0999f3..29d4ee4e2 100644 --- a/src/com/engine/salary/service/impl/SalaryItemServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalaryItemServiceImpl.java @@ -71,7 +71,7 @@ public class SalaryItemServiceImpl extends Service implements SalaryItemService private SysSalaryItemBiz sysSalaryItemBiz = new SysSalaryItemBiz(); -// @Autowired +// // private LoggerTemplate salaryItemLoggerTemplate; @Override diff --git a/src/com/engine/salary/service/impl/TaxDeclarationServiceImpl.java b/src/com/engine/salary/service/impl/TaxDeclarationServiceImpl.java index 6f66a9b54..38fb5b51d 100644 --- a/src/com/engine/salary/service/impl/TaxDeclarationServiceImpl.java +++ b/src/com/engine/salary/service/impl/TaxDeclarationServiceImpl.java @@ -318,7 +318,7 @@ public class TaxDeclarationServiceImpl extends Service implements TaxDeclaration @Override public void withDrawTaxDeclaration(Long taxDeclarationId) { TaxDeclarationPO po = getTaxDeclarationMapper().getById(taxDeclarationId); - if(Objects.isNull(po)){ + if (Objects.isNull(po)) { throw new SalaryRunTimeException("涓◣鐢虫姤琛ㄤ笉瀛樺湪"); } // 鑾峰彇褰撳墠涓◣鎵g即涔夊姟浜轰笅鐨勮柂璧勮处濂 @@ -331,8 +331,30 @@ public class TaxDeclarationServiceImpl extends Service implements TaxDeclaration // 鍒犻櫎涓◣鐢虫姤琛 getTaxDeclarationMapper().deleteByIdZj(po.getId()); // 淇敼钖祫鏍哥畻璁板綍鐘舵佷负宸插綊妗 - if(CollectionUtils.isNotEmpty(salaryAcctRecordIds)){ - getSalaryAcctRecordService(user).updateStatusByIds(salaryAcctRecordIds,SalaryAcctRecordStatusEnum.ARCHIVED); + if (CollectionUtils.isNotEmpty(salaryAcctRecordIds)) { + getSalaryAcctRecordService(user).updateStatusByIds(salaryAcctRecordIds, SalaryAcctRecordStatusEnum.ARCHIVED); + } + } + + @Override + public void deleteByTaxDeclareRecordIds(Collection 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 taxDeclarations) { + if (CollectionUtils.isNotEmpty(taxDeclarations)) { + getTaxDeclarationMapper().batchInsert(taxDeclarations); } } } diff --git a/src/com/engine/salary/service/impl/TaxDeclarationValueServiceImpl.java b/src/com/engine/salary/service/impl/TaxDeclarationValueServiceImpl.java new file mode 100644 index 000000000..292a84204 --- /dev/null +++ b/src/com/engine/salary/service/impl/TaxDeclarationValueServiceImpl.java @@ -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 listPageByTaxDeclarationIds( Collection 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 listByTaxDeclarationIds(Collection taxDeclarationIds) { + List 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 listByTaxDeclarationIdsNoDecrypt(Collection 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 taxDeclarationValues) { + // 鏌ヨ涓◣鐢虫姤琛ㄨ〃澶 + IncomeCategoryEnum incomeCategoryEnum = SalaryEnumUtil.enumMatchByValue(taxDeclaration.getIncomeCategory(), IncomeCategoryEnum.class); + List taxReportColumns = taxReportColumnService.listByIncomeCategory(incomeCategoryEnum, tenantKey); + // 浜哄憳id + Set employeeIds = SalaryEntityUtil.properties(taxDeclarationValues, TaxDeclarationValuePO::getEmployeeId); + // 鏌ヨ鎶ラ佺殑浜哄憳 + List employeeDeclares = employeeDeclareService.listByTaxCycleAndTaxAgentIdAndEmployeeIds( + YearMonth.parse(taxDeclaration.getTaxCycle()), taxDeclaration.getTaxAgentId(), employeeIds, tenantKey); + // 鏌ヨ浜哄憳淇℃伅 + List simpleEmployeeIds = taxDeclarationValues.stream() + .filter(taxDeclarationValue -> Objects.equals(taxDeclarationValue.getEmployeeType(), EmployeeTypeEnum.ORGANIZATION.getValue())) + .map(TaxDeclarationValuePO::getEmployeeId) + .distinct() + .collect(Collectors.toList()); + List simpleEmployees = hrmCommonEmployeeService.getEmployeeByIds(simpleEmployeeIds, tenantKey); + // 鏌ヨ浜哄憳钖祫锛堣韩浠借瘉鍙风爜绛夛級 + List simpleUserInfos = salaryEmployeeService.listByEmployeeIds(simpleEmployeeIds, tenantKey); + // 鏌ヨ澶栭儴浜哄憳 + Set extEmployeeIds = taxDeclarationValues.stream() + .filter(taxDeclarationValue -> Objects.equals(taxDeclarationValue.getEmployeeType(), EmployeeTypeEnum.EXT_EMPLOYEE.getValue())) + .map(TaxDeclarationValuePO::getEmployeeId) + .collect(Collectors.toSet()); + List extEmployees = extEmployeeService.listByIdsWithDeleted(extEmployeeIds, tenantKey); + + // 鍒楄〃琛ㄥご + List weaTableColumns = TaxDeclarationValueList.buildTableColumns(taxReportColumns); + // 鍒楄〃鏁版嵁 + List> data = TaxDeclarationValueList.buildTableData(incomeCategoryEnum, taxReportColumns, taxDeclarationValues, + employeeDeclares, simpleEmployees, simpleUserInfos, extEmployees); + + return new TaxDeclarationValueListDTO().setColumns(weaTableColumns).setData(data); + } + + @Override + public void batchSave(List 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> partition = Lists.partition(taxDeclarationValues, batchSize); + for (List subTaxDeclarationValues : partition) { + baseMapper.batchInsert(subTaxDeclarationValues); + } + } + } + + @Override + public void deleteByTaxDeclareRecordIds(Collection 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 decryptBatch(List taxDeclarationValues) { + if (CollectionUtils.isEmpty(taxDeclarationValues)) { + return Collections.emptyList(); + } + // 瑙e瘑 + taxDeclarationValues = dataSecurityService.decryptBatch(taxDeclarationValues, TaxDeclarationValuePO.class, tenantKey); + taxDeclarationValues.forEach(salaryAcctResultValue -> { + salaryAcctResultValue.setResultValue(JsonUtil.parseMap(salaryAcctResultValue.getResultValueJson(), String.class)); + }); + return taxDeclarationValues; + } +} diff --git a/src/com/engine/salary/service/impl/TaxDeclareEmployeeServiceImpl.java b/src/com/engine/salary/service/impl/TaxDeclareEmployeeServiceImpl.java new file mode 100644 index 000000000..88de031b4 --- /dev/null +++ b/src/com/engine/salary/service/impl/TaxDeclareEmployeeServiceImpl.java @@ -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 listPage4NotDeclareByParam(AbnormalEmployeeListQueryParam queryParam) { + List list = taxDeclarationValueMapper.listPage4NotDeclareByParam(queryParam); + return SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), list, TaxDeclareEmployeePO.class); + } + + @Override + public List list4NotDeclareByParam(AbnormalEmployeeListQueryParam queryParam) { + return taxDeclarationValueMapper.list4NotDeclareByParam(queryParam); + } + + @Override + public PageInfo listPage4NoValueByParam(AbnormalEmployeeListQueryParam queryParam) { + List list = taxDeclarationValueMapper.listPage4NoValueByParam(queryParam); + return SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), list, TaxDeclareEmployeePO.class); + } + + @Override + public List list4NoValueByParam(AbnormalEmployeeListQueryParam queryParam) { + return taxDeclarationValueMapper.list4NoValueByParam(queryParam); + } + + @Override + public List convert2AbnormalEmployeeList(TaxDeclareRecordPO taxDeclareRecord, List taxDeclareEmployees) { + if (CollectionUtils.isEmpty(taxDeclareEmployees)) { + return Collections.emptyList(); + } + // 浜哄憳id + Set employeeIds = SalaryEntityUtil.properties(taxDeclareEmployees, TaxDeclareEmployeePO::getEmployeeId); + // 鏌ヨ鎶ラ佺殑浜哄憳 + List employeeDeclares = employeeDeclareService.listByTaxCycleAndTaxAgentIdAndEmployeeIds( + SalaryDateUtil.localDate2YearMonth(taxDeclareRecord.getTaxCycle()), taxDeclareRecord.getTaxAgentId(), employeeIds); + // 鏌ヨ浜哄憳淇℃伅 + List simpleEmployeeIds = taxDeclareEmployees.stream() + .filter(taxDeclarationValue -> Objects.equals(taxDeclarationValue.getEmployeeType(), EmployeeTypeEnum.ORGANIZATION.getValue())) + .map(TaxDeclareEmployeePO::getEmployeeId) + .distinct() + .collect(Collectors.toList()); + List simpleEmployees = hrmCommonEmployeeService.getEmployeeByIds(simpleEmployeeIds); + // 鏌ヨ浜哄憳钖祫锛堣韩浠借瘉鍙风爜绛夛級 + List simpleUserInfos = salaryEmployeeService.listByIds(simpleEmployeeIds); + // 鏌ヨ澶栭儴浜哄憳 + List extEmployeeIds = taxDeclareEmployees.stream() + .filter(taxDeclarationValue -> Objects.equals(taxDeclarationValue.getEmployeeType(), EmployeeTypeEnum.EXT_EMPLOYEE.getValue())) + .map(TaxDeclareEmployeePO::getEmployeeId) + .collect(Collectors.toList()); + List extEmployees = extEmployeeService.getExtEmpByIds(extEmployeeIds); + + return TaxDeclareEmployeeBO.convert2AbnormalEmployee(taxDeclareEmployees, employeeDeclares, simpleEmployees, simpleUserInfos, extEmployees); + } +} diff --git a/src/com/engine/salary/service/impl/TaxDeclareFailServiceImpl.java b/src/com/engine/salary/service/impl/TaxDeclareFailServiceImpl.java new file mode 100644 index 000000000..58fefe59f --- /dev/null +++ b/src/com/engine/salary/service/impl/TaxDeclareFailServiceImpl.java @@ -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 listPageByTaxDeclareRecordIds(Collection 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 listByTaxDeclareRecordIds(Collection 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 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 convert2FailEmployeeList(TaxDeclareRecordPO taxDeclareRecord, List taxDeclareFails) { + if (CollectionUtils.isEmpty(taxDeclareFails)) { + return Collections.emptyList(); + } + // 鏌ヨ涓◣鎵g即涔夊姟浜 + TaxAgentPO taxAgent = taxAgentService.getById(taxDeclareRecord.getTaxAgentId()); + Map incomeCategoryEnumMap = Maps.newHashMap(); + for (IncomeCategoryEnum incomeCategoryEnum : IncomeCategoryEnum.values()) { + incomeCategoryEnumMap.put(incomeCategoryEnum.getCode(), incomeCategoryEnum); + } + + List 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; + } +} diff --git a/src/com/engine/salary/service/impl/TaxDeclareRecordServiceImpl.java b/src/com/engine/salary/service/impl/TaxDeclareRecordServiceImpl.java index 75c5d06b7..8e3771445 100644 --- a/src/com/engine/salary/service/impl/TaxDeclareRecordServiceImpl.java +++ b/src/com/engine/salary/service/impl/TaxDeclareRecordServiceImpl.java @@ -1,46 +1,52 @@ package com.engine.salary.service.impl; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -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.TaxDeclareRecordPO; -import com.engine.salary.mapper.taxagent.TaxDeclareRecordMapper; +import com.engine.salary.common.YearMonthRange; +import com.engine.salary.entity.datacollection.AddUpSituation; +import com.engine.salary.entity.employeedeclare.po.EmployeeDeclarePO; +import com.engine.salary.entity.salaryacct.param.SalaryAcctEmployeeQueryParam; +import com.engine.salary.entity.salaryacct.po.SalaryAcctEmployeePO; +import com.engine.salary.entity.salaryacct.po.SalaryAcctRecordPO; +import com.engine.salary.entity.salaryacct.po.SalaryAcctTaxAgentPO; +import com.engine.salary.entity.salaryitem.po.SalaryItemPO; +import com.engine.salary.entity.taxagent.param.TaxAgentQueryParam; +import com.engine.salary.entity.taxagent.po.TaxAgentPO; +import com.engine.salary.entity.taxdeclaration.bo.TaxDeclarationResult; +import com.engine.salary.entity.taxdeclaration.bo.TaxDeclareRequest; +import com.engine.salary.entity.taxdeclaration.param.AbnormalEmployeeListQueryParam; +import com.engine.salary.entity.taxdeclaration.param.TaxDeclarationListQueryParam; +import com.engine.salary.entity.taxdeclaration.param.TaxDeclarationSaveParam; +import com.engine.salary.entity.taxdeclaration.po.*; +import com.engine.salary.enums.salaryaccounting.SalaryAcctRecordStatusEnum; +import com.engine.salary.enums.sicategory.DeleteTypeEnum; +import com.engine.salary.enums.taxdeclaration.TaxAgentRangeEnum; +import com.engine.salary.enums.taxdeclaration.TaxDeclareStatusEnum; +import com.engine.salary.enums.taxdeclaration.TaxDeclareTypeEnum; +import com.engine.salary.exception.SalaryRunTimeException; +import com.engine.salary.mapper.taxdeclaration.TaxDeclareRecordMapper; import com.engine.salary.service.*; +import com.engine.salary.util.SalaryDateUtil; +import com.engine.salary.util.SalaryEntityUtil; +import com.engine.salary.util.SalaryI18nUtil; +import com.engine.salary.util.page.PageInfo; +import com.engine.salary.util.page.SalaryPageUtil; import com.google.common.collect.ImmutableMap; import com.google.common.collect.Lists; -import com.google.common.collect.Sets; -import com.weaver.common.component.table.page.Page; -import com.weaver.common.distribution.genid.IdGenerator; import com.weaver.common.elog.dto.LoggerContext; -import com.weaver.common.elog.util.LoggerTemplate; import com.weaver.common.elog.util.Util; import com.weaver.framework.util.JsonUtil; -import com.weaver.hrm.salary.common.YearMonthRange; import com.weaver.hrm.salary.constant.SzyhApiConstant; import com.weaver.hrm.salary.dao.TaxPaymentRequestMapper; -import com.weaver.hrm.salary.entity.datacollection.po.AddUpSituationPO; import com.weaver.hrm.salary.entity.employeedeclare.bo.EmployeeDeclareRequest; -import com.weaver.hrm.salary.entity.employeedeclare.po.EmployeeDeclarePO; -import com.weaver.hrm.salary.entity.salaryacct.param.SalaryAcctEmployeeQueryParam; -import com.weaver.hrm.salary.entity.salaryacct.po.SalaryAcctEmployeePO; -import com.weaver.hrm.salary.entity.salaryacct.po.SalaryAcctRecordPO; import com.weaver.hrm.salary.entity.salaryacct.po.SalaryAcctResultValuePO; -import com.weaver.hrm.salary.entity.salaryacct.po.SalaryAcctTaxAgentPO; -import com.weaver.hrm.salary.entity.salaryitem.po.SalaryItemPO; import com.weaver.hrm.salary.entity.salarysob.po.SalarySobAddUpRulePO; import com.weaver.hrm.salary.entity.salarysob.po.SalarySobTaxReportRulePO; import com.weaver.hrm.salary.entity.taxagent.bo.TaxAgentTaxReturnBO; -import com.weaver.hrm.salary.entity.taxagent.po.TaxAgentPO; import com.weaver.hrm.salary.entity.taxagent.po.TaxAgentTaxReturnPO; import com.weaver.hrm.salary.entity.taxapiflow.bo.TaxApiFlowBO; import com.weaver.hrm.salary.entity.taxapiflow.po.TaxDeclarationApiFlowRecordPO; import com.weaver.hrm.salary.entity.taxdeclaration.bo.*; import com.weaver.hrm.salary.entity.taxdeclaration.dto.TaxDeclarationRateDTO; -import com.weaver.hrm.salary.entity.taxdeclaration.param.AbnormalEmployeeListQueryParam; -import com.weaver.hrm.salary.entity.taxdeclaration.param.TaxDeclarationListQueryParam; -import com.weaver.hrm.salary.entity.taxdeclaration.param.TaxDeclarationSaveParam; import com.weaver.hrm.salary.entity.taxdeclaration.po.*; import com.weaver.hrm.salary.entity.taxdeclaration.response.CancelDeclareFeedbackResponse; import com.weaver.hrm.salary.entity.taxdeclaration.response.DeclareTaxFeedbackResponse; @@ -48,20 +54,17 @@ import com.weaver.hrm.salary.entity.taxdeclaration.response.DeclareTaxResponse; import com.weaver.hrm.salary.entity.taxdeclaration.response.UpdateDeclareResponse; import com.weaver.hrm.salary.enums.OperateTypeEnum; import com.weaver.hrm.salary.enums.employeedeclare.DeclareStatusEnum; -import com.weaver.hrm.salary.enums.salaryaccounting.SalaryAcctRecordStatusEnum; -import com.weaver.hrm.salary.enums.sicategory.DeleteTypeEnum; import com.weaver.hrm.salary.enums.taxagent.TaxAgentTaxReturnStatusEnum; import com.weaver.hrm.salary.enums.taxdeclaration.*; -import com.weaver.hrm.salary.exception.SalaryRunTimeException; import com.weaver.hrm.salary.service.*; import com.weaver.hrm.salary.service.factory.TaxPaymentServiceFactory; import com.weaver.hrm.salary.util.*; +import dm.jdbc.util.IdGenerator; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.transaction.annotation.Transactional; -import javax.annotation.Resource; import java.math.BigDecimal; import java.time.LocalDate; import java.time.LocalDateTime; @@ -69,6 +72,8 @@ 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 @@ -79,173 +84,145 @@ import java.util.stream.Collectors; @Slf4j public class TaxDeclareRecordServiceImpl extends Service implements TaxDeclareRecordService { - + private TaxDeclareRecordMapper taxDeclareRecordMapper; - + private TaxDeclarationService taxDeclarationService; - + private TaxDeclarationValueService taxDeclarationValueService; - + private EmployeeDeclareService employeeDeclareService; - + private TaxAgentTaxReturnService taxAgentTaxReturnService; - + private TaxAgentService taxAgentService; - + private TaxDeclarationApiConfigService taxDeclarationApiConfigService; - + private AddUpSituationService addUpSituationService; - + private TaxDeclarationApiBillingService taxDeclarationApiBillingService; - @Resource(name = "taxDeclarationLoggerTemplate") - private LoggerTemplate taxDeclarationLoggerTemplate; - + private TaxDeclareEmployeeService taxDeclareEmployeeService; - + private TaxDeclareFailService taxDeclareFailService; - + private SalaryAcctRecordService salaryAcctRecordService; - + private SalaryAcctTaxAgentService salaryAcctTaxAgentService; - + private SalaryAcctEmployeeService salaryAcctEmployeeService; - + private SalaryAcctResultService salaryAcctResultValueService; - + private SalaryItemService salaryItemService; - + private SalarySobTaxReportRuleService salarySobTaxReportRuleService; - + private TaxReportColumnService taxReportColumnService; - + private SalarySobAddUpRuleService salarySobAddUpRuleService; - + private TaxPaymentServiceFactory taxPaymentServiceFactory; - + private TaxPaymentRequestMapper taxPaymentRequestMapper; @Override public TaxDeclareRecordPO getById(Long id) { - return new LambdaQueryChainWrapper<>(taxDeclareRecordMapper) - .eq(TaxDeclareRecordPO::getTenantKey, tenantKey) - .eq(TaxDeclareRecordPO::getDeleteType, DeleteTypeEnum.NOT_DELETED.getValue()) - .eq(TaxDeclareRecordPO::getId, id) - .one(); + return taxDeclareRecordMapper.getById(id); } -// -// @Override -// public List listByIds(Collection ids, String tenantKey) { -// return new LambdaQueryChainWrapper<>(taxDeclareRecordMapper) -// .eq(TaxDeclareRecordPO::getTenantKey, tenantKey) -// .eq(TaxDeclareRecordPO::getDeleteType, DeleteTypeEnum.NOT_DELETED.getValue()) -// .in(TaxDeclareRecordPO::getId, ids) -// .list(); -// } -// -// @Override -// public List listByTaxCycleRange(YearMonthRange taxCycleRange, String tenantKey) { -// LambdaQueryWrapper queryWrapper = Wrappers.lambdaQuery(); -// queryWrapper.eq(TaxDeclareRecordPO::getTenantKey, tenantKey); -// queryWrapper.eq(TaxDeclareRecordPO::getDeleteType, DeleteTypeEnum.NOT_DELETED.getValue()); -// if (Objects.nonNull(taxCycleRange.getStartMonth())) { -// queryWrapper.ge(TaxDeclareRecordPO::getTaxCycle, taxCycleRange.getStartMonth().toString()); -// } -// if (Objects.nonNull(taxCycleRange.getEndMonth())) { -// queryWrapper.le(TaxDeclareRecordPO::getTaxCycle, taxCycleRange.getEndMonth().toString()); -// } -// return taxDeclareRecordMapper.selectList(queryWrapper); -// } -// -// @Override -// public List listByTaxCycleAndTaxAgentIds(YearMonth taxCycle, Collection taxAgentIds, String tenantKey) { -// if (Objects.isNull(taxCycle) || CollectionUtils.isEmpty(taxAgentIds)) { -// return Collections.emptyList(); -// } -// return new LambdaQueryChainWrapper<>(taxDeclareRecordMapper) -// .eq(TaxDeclareRecordPO::getTenantKey, tenantKey) -// .eq(TaxDeclareRecordPO::getDeleteType, DeleteTypeEnum.NOT_DELETED.getValue()) -// .in(TaxDeclareRecordPO::getTaxAgentId, taxAgentIds) -// .eq(TaxDeclareRecordPO::getTaxCycle, taxCycle.toString()) -// .list(); -// } -// -// @Override -// public List listBySalaryMonthAndTaxAgentIds(YearMonth salaryMonth, Collection taxAgentIds, String tenantKey) { -// if (Objects.isNull(salaryMonth) || CollectionUtils.isEmpty(taxAgentIds)) { -// return Collections.emptyList(); -// } -// return new LambdaQueryChainWrapper<>(taxDeclareRecordMapper) -// .eq(TaxDeclareRecordPO::getTenantKey, tenantKey) -// .eq(TaxDeclareRecordPO::getDeleteType, DeleteTypeEnum.NOT_DELETED.getValue()) -// .in(TaxDeclareRecordPO::getTaxAgentId, taxAgentIds) -// .eq(TaxDeclareRecordPO::getSalaryMonth, salaryMonth.toString()) -// .list(); -// } -// -// @Override -// public Page listPageByParam(TaxDeclarationListQueryParam queryParam, Long employeeId, String tenantKey) { -// Page page = new Page<>(queryParam.getCurrent(), queryParam.getPageSize(), true); -// // 鏋勫缓鏌ヨ鍙傛暟 -// LambdaQueryWrapper queryWrapper = Wrappers.lambdaQuery(); -// queryWrapper.eq(TaxDeclareRecordPO::getTenantKey, tenantKey); -// queryWrapper.eq(TaxDeclareRecordPO::getDeleteType, 0); -// if (SalaryEntityUtil.isNotNullOrEmpty(queryParam.getFromSalaryMonth())) { -// queryWrapper.ge(TaxDeclareRecordPO::getSalaryMonth, queryParam.getFromSalaryMonth()); -// } -// if (SalaryEntityUtil.isNotNullOrEmpty(queryParam.getEndSalaryMonth())) { -// queryWrapper.le(TaxDeclareRecordPO::getSalaryMonth, queryParam.getEndSalaryMonth()); -// } -// if (StringUtils.isNotEmpty(queryParam.getTaxAgentName())) { -// List taxAgents = taxAgentService.listByNameLike(queryParam.getTaxAgentName(), tenantKey); -// if (CollectionUtils.isEmpty(taxAgents)) { -// return page; -// } -// Set taxAgentIds = SalaryEntityUtil.properties(taxAgents, TaxAgentPO::getId); -// queryWrapper.in(TaxDeclareRecordPO::getTaxAgentId, taxAgentIds); -// } -// // 鍒ゆ柇鏄惁寮鍚簡鍒嗘潈 -// Boolean openDevolution = taxAgentService.isOpenDevolution(tenantKey); -// // 鍒ゆ柇鏄惁鏄荤鐞嗗憳 -// Boolean isChief = taxAgentService.isChief(employeeId, tenantKey); -// // 鍙鑼冨洿鍐呯殑涓◣鎵g即涔夊姟浜 -// List taxAgents = Lists.newArrayList(); -// if (openDevolution) { -// if (isChief) { -// taxAgents = taxAgentService.listAsChief(openDevolution, isChief, employeeId, tenantKey); -// } else { -// taxAgents = taxAgentService.listAllTaxAgentsAsAdmin(employeeId, tenantKey); -// } -// if (CollectionUtils.isEmpty(taxAgents)) { -// return page; -// } -// Set taxAgentIds = SalaryEntityUtil.properties(taxAgents, TaxAgentPO::getId); -// queryWrapper.in(TaxDeclareRecordPO::getTaxAgentId, taxAgentIds); -// } -// queryWrapper.orderByDesc(TaxDeclareRecordPO::getTaxCycle); -// queryWrapper.orderByDesc(TaxDeclareRecordPO::getId); -// return taxDeclareRecordMapper.selectPage(page, queryWrapper); -// } -// -// @Override -// public void save(TaxDeclarationSaveParam saveParam, Long employeeId, String tenantKey) { -// LocalDateTime now = LocalDateTime.now(); + + @Override + public List listByIds(Collection ids) { + return taxDeclareRecordMapper.listSome(TaxDeclareRecordPO.builder().ids(ids).build()); + } + + @Override + public List listByTaxCycleRange(YearMonthRange taxCycleRange) { + TaxDeclareRecordPO build = TaxDeclareRecordPO.builder().build(); + if (Objects.nonNull(taxCycleRange.getStartMonth())) { + build.setStartDate(taxCycleRange.getStartMonth()); + } + if (Objects.nonNull(taxCycleRange.getEndMonth())) { + build.setEndDate(taxCycleRange.getEndMonth()); + } + return taxDeclareRecordMapper.listSome(build); + } + + @Override + public List listByTaxCycleAndTaxAgentIds(Date taxCycle, Collection taxAgentIds) { + if (Objects.isNull(taxCycle) || CollectionUtils.isEmpty(taxAgentIds)) { + return Collections.emptyList(); + } + return taxDeclareRecordMapper.listSome(TaxDeclareRecordPO.builder().taxAgentIds(taxAgentIds).taxCycle(taxCycle).build()); + } + + @Override + public List listBySalaryMonthAndTaxAgentIds(Date salaryMonth, Collection taxAgentIds) { + if (Objects.isNull(salaryMonth) || CollectionUtils.isEmpty(taxAgentIds)) { + return Collections.emptyList(); + } + return taxDeclareRecordMapper.listSome(TaxDeclareRecordPO.builder().taxAgentIds(taxAgentIds).salaryMonth(salaryMonth).build()); + } + + @Override + public PageInfo listPageByParam(TaxDeclarationListQueryParam queryParam) { + PageInfo pageInfo = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), TaxDeclareRecordPO.class); + // 鏋勫缓鏌ヨ鍙傛暟 + TaxDeclareRecordPO build = TaxDeclareRecordPO.builder().build(); + if (SalaryEntityUtil.isNotNullOrEmpty(queryParam.getFromSalaryMonth())) { + build.setSalaryMonthStartDate(SalaryDateUtil.localDateToDate(queryParam.getFromSalaryMonth().atDay(1))); + } + if (SalaryEntityUtil.isNotNullOrEmpty(queryParam.getEndSalaryMonth())) { + build.setSalaryMonthEndDate(SalaryDateUtil.localDateToDate(queryParam.getEndSalaryMonth().atDay(1))); + } + List taxAgentIds = new ArrayList<>(); + if (StringUtils.isNotEmpty(queryParam.getTaxAgentName())) { + List taxAgents = taxAgentService.list(TaxAgentQueryParam.builder().name(queryParam.getTaxAgentName()).build()); + if (CollectionUtils.isEmpty(taxAgents)) { + return pageInfo; + } + taxAgentIds = SalaryEntityUtil.properties(taxAgents, TaxAgentPO::getId, Collectors.toList()); + } + // 鍒ゆ柇鏄惁寮鍚簡鍒嗘潈 + Boolean openDevolution = taxAgentService.isOpenDevolution(); + // 鍒ゆ柇鏄惁鏄荤鐞嗗憳 + Boolean isChief = taxAgentService.isChief((long) user.getUID()); + // 鍙鑼冨洿鍐呯殑涓◣鎵g即涔夊姟浜 + Collection taxAgents = Lists.newArrayList(); + if (openDevolution && !isChief) { + taxAgents = taxAgentService.listAllTaxAgentsAsAdmin((long) user.getUID()); + if (CollectionUtils.isEmpty(taxAgents)) { + return pageInfo; + } + List taxAgentDevolution = SalaryEntityUtil.properties(taxAgents, TaxAgentPO::getId, Collectors.toList()); + taxAgentIds = taxAgentIds.stream().filter(taxAgentDevolution::contains).collect(Collectors.toList()); + } + build.setTaxAgentIds(taxAgentIds); + List taxDeclareRecordPOS = taxDeclareRecordMapper.listSome(build); + return SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), + taxDeclareRecordPOS, TaxDeclareRecordPO.class); + } + + @Override + public void save(TaxDeclarationSaveParam saveParam) { +// Date now = new Date(); // Set needDeleteTaxDeclareRecordIds = Sets.newHashSet(); // List newTaxDeclareRecords = Lists.newArrayList(); // List newTaxDeclarations = Lists.newArrayList(); // List newTaxDeclarationValues = Lists.newArrayList(); -// List newAddUpSituations = Lists.newArrayList(); +// List newAddUpSituations = Lists.newArrayList(); // // 鏍规嵁涓◣鎵g即涔夊姟浜鸿寖鍥存煡璇釜绋庢墸缂翠箟鍔′汉 -// List taxAgents = queryByTaxAgentRange(saveParam, employeeId, tenantKey); +// List taxAgents = queryByTaxAgentRange(saveParam); // Map taxAgentNameMap = SalaryEntityUtil.convert2Map(taxAgents, TaxAgentPO::getId, TaxAgentPO::getName); // // 鏌ヨ钖祫鎵灞炴湀涓嬬殑钖祫鏍哥畻璁板綍锛屽苟鎸夌収鏉冮檺杩囨护 -// YearMonthRange salaryMonthRange = new YearMonthRange() -// .setStartMonth(saveParam.getSalaryMonth()) -// .setEndMonth(saveParam.getSalaryMonth()); -// List salaryAcctRecords = salaryAcctRecordService.filterByAuthority( -// salaryAcctRecordService.listBySalaryMonth(salaryMonthRange, tenantKey), employeeId, tenantKey); +// LocalDateRange salaryMonthRange = new LocalDateRange() +// .setFromDate(SalaryDateUtil.localDateToDate(saveParam.getSalaryMonth().atDay(1))) +// .setEndDate(SalaryDateUtil.localDateToDate(saveParam.getSalaryMonth().atDay(1))); +// List salaryAcctRecords = salaryAcctRecordService.listBySalaryMonth(salaryMonthRange); // // 鏌ヨ钖祫鏍哥畻璁板綍鍏宠仈鐨勪釜绋庢墸缂翠箟鍔′汉 -// List salaryAcctTaxAgents = salaryAcctTaxAgentService.listBySalaryAcctRecordIds( -// SalaryEntityUtil.properties(salaryAcctRecords, SalaryAcctRecordPO::getId), tenantKey); +// List salaryAcctTaxAgents = salaryAcctRecordService.listBySalaryAcctRecordIds( +// SalaryEntityUtil.properties(salaryAcctRecords, SalaryAcctRecordPO::getId)); // // 鎸夌収saveParam涓殑涓◣鎵g即涔夊姟浜鸿寖鍥磋繃婊 // Set taxAgentIds = SalaryEntityUtil.properties(taxAgents, TaxAgentPO::getId); // salaryAcctTaxAgents = salaryAcctTaxAgents.stream() @@ -257,14 +234,14 @@ public class TaxDeclareRecordServiceImpl extends Service implements TaxDeclareRe // .collect(Collectors.toList()); // // 鏍¢獙鏄惁鍙互鐢熸垚涓◣鐢虫姤琛 // // 杩斿洖鐩墠宸茬粡鐢熸垚鐨勪釜绋庣敵鎶ヨ〃 -// List taxDeclareRecords = checkBeforeSave(saveParam, taxAgentNameMap, salaryAcctRecords, salaryAcctTaxAgents, employeeId, tenantKey); +// List taxDeclareRecords = checkBeforeSave(saveParam, taxAgentNameMap, salaryAcctRecords, salaryAcctTaxAgents); // Map taxDeclareRecordMap = SalaryEntityUtil.convert2Map(taxDeclareRecords, e -> e.getTaxCycle() + "-" + e.getTaxAgentId()); // // 鏌ヨ钖祫鏍哥畻浜哄憳 -// List salaryAcctEmployees = salaryAcctEmployeeService.listByRecordIdsAndTaxAgentIds(salaryAcctRecordIds, taxAgentIds, tenantKey); +// List salaryAcctEmployees = salaryAcctEmployeeService.listByRecordIdsAndEmpIdAndTaxAgentId(salaryAcctRecordIds, null, taxAgents.get(0).getId()); // // 钖祫鏍哥畻浜哄憳鎸夌収绋庢鎵灞炴湡鑱氬悎鍒嗙被 -// Map> taxCycleKeyEmployeeMap = SalaryEntityUtil.group2Map( +// Map> taxCycleKeyEmployeeMap = SalaryEntityUtil.group2Map( // salaryAcctEmployees, SalaryAcctEmployeePO::getTaxCycle); -// for (Map.Entry> taxCycleEntry : taxCycleKeyEmployeeMap.entrySet()) { +// for (Map.Entry> taxCycleEntry : taxCycleKeyEmployeeMap.entrySet()) { // // 钖祫鏍哥畻浜哄憳鎸夌収涓◣鎵g即涔夊姟浜篿d鑱氬悎鍒嗙被 // Map> taxAgentIdKeyEmployeeMap = SalaryEntityUtil.group2Map( // taxCycleEntry.getValue(), SalaryAcctEmployeePO::getTaxAgentId); @@ -281,19 +258,19 @@ public class TaxDeclareRecordServiceImpl extends Service implements TaxDeclareRe // TaxDeclareRecordPO taxDeclareRecord = new TaxDeclareRecordPO() // .setId(IdGenerator.generate()) // .setTaxAgentId(taxAgentIdEntry.getKey()) -// .setSalaryMonth(saveParam.getSalaryMonth().toString()) +// .setSalaryMonth(SalaryDateUtil.localDateToDate(saveParam.getSalaryMonth().atDay(1))) // .setTaxCycle(taxCycleEntry.getKey()) // .setTaxDeclareType(TaxDeclareTypeEnum.NORMAL_DECLARE.getValue()) // .setTaxDeclareStatus(TaxDeclareStatusEnum.NOT_DECLARE.getValue()) // .setRemark(saveParam.getDescription()) -// .setCreator(employeeId) -// .setTenantKey(tenantKey) +// .setCreator((long)user.getUID()) +// .setTenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY) // .setDeleteType(DeleteTypeEnum.NOT_DELETED.getValue()) // .setCreateTime(now) // .setUpdateTime(now); // newTaxDeclareRecords.add(taxDeclareRecord); // // 鐢熸垚涓◣鐢虫姤琛 -// TaxDeclarationResult taxDeclarationResult = generateReportPerRecord(taxDeclareRecord, taxAgentIdEntry.getValue(), employeeId, tenantKey); +// TaxDeclarationResult taxDeclarationResult = generateReportPerRecord(taxDeclareRecord, taxAgentIdEntry.getValue()); // newTaxDeclarations.addAll(taxDeclarationResult.getTaxDeclarations()); // newTaxDeclarationValues.addAll(taxDeclarationResult.getTaxDeclarationValues()); // newAddUpSituations.addAll(taxDeclarationResult.getAddUpSituations()); @@ -301,7 +278,7 @@ public class TaxDeclareRecordServiceImpl extends Service implements TaxDeclareRe // } // // // 鍒犻櫎鍘熸潵鐢熸垚鐨勪釜绋庣敵鎶ヨ褰曘佷釜绋庣敵鎶ヨ〃銆佷釜绋庣敵鎶ヨ〃鏄庣粏 -// deleteByIds(needDeleteTaxDeclareRecordIds, tenantKey); +// deleteByIds(needDeleteTaxDeclareRecordIds); // // 淇濆瓨涓◣鐢虫姤璁板綍 // if (CollectionUtils.isNotEmpty(newTaxDeclareRecords)) { // saveBatch(newTaxDeclareRecords); @@ -312,32 +289,32 @@ public class TaxDeclareRecordServiceImpl extends Service implements TaxDeclareRe // } // // 淇濆瓨涓◣鐢虫姤琛ㄦ槑缁 // if (CollectionUtils.isNotEmpty(newTaxDeclarationValues)) { -// taxDeclarationValueService.batchSave(newTaxDeclarationValues, tenantKey); +// taxDeclarationValueService.batchSave(newTaxDeclarationValues); // } // // 淇濆瓨绱鎯呭喌 // if (CollectionUtils.isNotEmpty(newAddUpSituations)) { // Map> addUpSituationMap = SalaryEntityUtil.group2Map(newAddUpSituations, e -> SalaryDateUtil.getFormatYearMonth(e.getTaxYearMonth())); // for (Map.Entry> entry : addUpSituationMap.entrySet()) { // addUpSituationService.deleteByTaxYearMonthAndTaxAgentIds(YearMonth.parse(entry.getKey()), -// SalaryEntityUtil.properties(entry.getValue(), AddUpSituationPO::getTaxAgentId), tenantKey); -// addUpSituationService.saveBatch(entry.getValue(), tenantKey); +// SalaryEntityUtil.properties(entry.getValue(), AddUpSituationPO::getTaxAgentId)); +// addUpSituationService.saveBatch(entry.getValue()); // } // } // // 璁板綍鏃ュ織 // for (TaxDeclareRecordPO taxDeclareRecord : newTaxDeclareRecords) { // LoggerContext loggerContext = new LoggerContext<>(); // loggerContext.setTargetId(String.valueOf(taxDeclareRecord.getId())); -// loggerContext.setTargetName(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 203562, "涓◣鎵g即涔夊姟浜恒寋0}銆嶇◣娆炬墍灞炴湡銆寋1}銆") +// loggerContext.setTargetName(SalaryI18nUtil.getI18nLabel(203562, "涓◣鎵g即涔夊姟浜恒寋0}銆嶇◣娆炬墍灞炴湡銆寋1}銆") // .replace("{0}", taxAgentNameMap.getOrDefault(taxDeclareRecord.getTaxAgentId(), StringUtils.EMPTY)) // .replace("{1}", taxDeclareRecord.getTaxCycle())); // loggerContext.setOperator(Util.null2String(employeeId)); // loggerContext.setOperateType(OperateTypeEnum.ADD.getValue()); -// loggerContext.setOperateTypeName(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 99815, "鐢熸垚涓◣鐢虫姤琛")); -// loggerContext.setOperatedesc(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 99815, "鐢熸垚涓◣鐢虫姤琛")); +// loggerContext.setOperateTypeName(SalaryI18nUtil.getI18nLabel(99815, "鐢熸垚涓◣鐢虫姤琛")); +// loggerContext.setOperatedesc(SalaryI18nUtil.getI18nLabel(99815, "鐢熸垚涓◣鐢虫姤琛")); // loggerContext.setNewValues(taxDeclareRecord); // taxDeclarationLoggerTemplate.write(loggerContext); // } -// } + } @Override @Transactional(rollbackFor = Exception.class) @@ -345,80 +322,79 @@ public class TaxDeclareRecordServiceImpl extends Service implements TaxDeclareRe // 鏌ヨ涓◣鐢虫姤璁板綍 TaxDeclareRecordPO taxDeclareRecord = getById(id); if (Objects.isNull(taxDeclareRecord)) { - throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 156495, "鍙傛暟寮傚父锛屼釜绋庣敵鎶ヨ褰曚笉瀛樺湪鎴栧凡琚垹闄")); + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(156495, "鍙傛暟寮傚父锛屼釜绋庣敵鎶ヨ褰曚笉瀛樺湪鎴栧凡琚垹闄")); } if (!Objects.equals(taxDeclareRecord.getTaxDeclareStatus(), TaxDeclareStatusEnum.NOT_DECLARE.getValue()) && !Objects.equals(taxDeclareRecord.getTaxDeclareStatus(), TaxDeclareStatusEnum.DECLARE_FAIL.getValue())) { - throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 182700, "瀵逛笉璧凤紝鍙湁鏈敵鎶ョ姸鎬佷笅鍙互鍒锋柊鏁版嵁")); + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(182700, "瀵逛笉璧凤紝鍙湁鏈敵鎶ョ姸鎬佷笅鍙互鍒锋柊鏁版嵁")); } // 鏌ヨ绋庢鎵灞炴湡涓嬬殑钖祫鏍哥畻浜哄憳 - SalaryAcctEmployeeQueryParam salaryAcctEmployeeQueryParam = new SalaryAcctEmployeeQueryParam() - .setTaxAgentIds(Collections.singletonList(taxDeclareRecord.getTaxAgentId())) - .setTaxCycle(taxDeclareRecord.getTaxCycle()); - List salaryAcctEmployees = salaryAcctEmployeeService.listByParam(salaryAcctEmployeeQueryParam, tenantKey); + SalaryAcctEmployeeQueryParam salaryAcctEmployeeQueryParam = SalaryAcctEmployeeQueryParam.builder() + .taxAgentIds(Collections.singletonList(taxDeclareRecord.getTaxAgentId())) + .taxCycle(taxDeclareRecord.getTaxCycle()) + .build(); + List salaryAcctEmployees = salaryAcctEmployeeService.listByParam(salaryAcctEmployeeQueryParam); // 鏌ヨ钖祫鏍哥畻璁板綍 Set salaryAcctRecordIds = SalaryEntityUtil.properties(salaryAcctEmployees, SalaryAcctEmployeePO::getSalaryAcctRecordId); - List salaryAcctRecords = salaryAcctRecordService.listByIds(salaryAcctRecordIds, tenantKey); + List salaryAcctRecords = salaryAcctRecordService.listByIds(salaryAcctRecordIds); // 濡傛灉瀛樺湪鏈綊妗g殑钖祫鏍哥畻璁板綍锛屼笉鍏佽鐢熸垚涓◣鐢虫姤琛 boolean notArchived = salaryAcctRecords.stream() .anyMatch(salaryAcctRecordPO -> Objects.equals(salaryAcctRecordPO.getStatus(), SalaryAcctRecordStatusEnum.NOT_ARCHIVED.getValue())); if (notArchived) { - throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 98875, "{0}鏈夋湭褰掓。鏁版嵁锛岃鍏ㄩ儴褰掓。鍚庡啀鐢虫姤") - .replace("{0}", taxDeclareRecord.getSalaryMonth())); + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98875, "{0}鏈夋湭褰掓。鏁版嵁锛岃鍏ㄩ儴褰掓。鍚庡啀鐢虫姤") + .replace("{0}", SalaryDateUtil.getFormatYearMonth(taxDeclareRecord.getSalaryMonth()))); } - TaxDeclarationResult taxDeclarationResult = generateReportPerRecord(taxDeclareRecord, salaryAcctEmployees, employeeId, tenantKey); + TaxDeclarationResult taxDeclarationResult = generateReportPerRecord(taxDeclareRecord, salaryAcctEmployees); // 鏇存柊涓◣鐢虫姤璁板綍 - taxDeclareRecord.setDisplayUpdateIcon(0).setUpdateTime(LocalDateTime.now()); - updateById(taxDeclareRecord); + taxDeclareRecord.setDisplayUpdateIcon(0).setUpdateTime(new Date()); + taxDeclareRecordMapper.updateIgnoreNull(taxDeclareRecord); // 鍒犻櫎鍘熸潵鐨勭敵鎶ヨ〃锛屼繚瀛樻柊鐢熸垚鐨 - taxDeclarationService.deleteByTaxDeclareRecordIds(Collections.singleton(taxDeclareRecord.getId()), tenantKey); + taxDeclarationService.deleteByTaxDeclareRecordIds(Collections.singleton(taxDeclareRecord.getId())); if (CollectionUtils.isNotEmpty(taxDeclarationResult.getTaxDeclarations())) { taxDeclarationService.saveBatch(taxDeclarationResult.getTaxDeclarations()); } // 鍒犻櫎鍘熸潵鐨勭敵鎶ヨ〃鏄庣粏锛屼繚瀛樻柊鐢熸垚鐨 - taxDeclarationValueService.deleteByTaxDeclareRecordIds(Collections.singleton(taxDeclareRecord.getId()), tenantKey); + taxDeclarationValueService.deleteByTaxDeclareRecordIds(Collections.singleton(taxDeclareRecord.getId())); if (CollectionUtils.isNotEmpty(taxDeclarationResult.getTaxDeclarationValues())) { - taxDeclarationValueService.batchSave(taxDeclarationResult.getTaxDeclarationValues(), tenantKey); + taxDeclarationValueService.batchSave(taxDeclarationResult.getTaxDeclarationValues()); } // 淇濆瓨绱鎯呭喌 if (CollectionUtils.isNotEmpty(taxDeclarationResult.getAddUpSituations())) { - Map> addUpSituationMap = SalaryEntityUtil.group2Map(taxDeclarationResult.getAddUpSituations(), + Map> addUpSituationMap = SalaryEntityUtil.group2Map(taxDeclarationResult.getAddUpSituations(), e -> SalaryDateUtil.getFormatYearMonth(e.getTaxYearMonth())); - for (Map.Entry> entry : addUpSituationMap.entrySet()) { + for (Map.Entry> entry : addUpSituationMap.entrySet()) { addUpSituationService.deleteByTaxYearMonthAndTaxAgentIds(YearMonth.parse(entry.getKey()), - SalaryEntityUtil.properties(entry.getValue(), AddUpSituationPO::getTaxAgentId), tenantKey); - addUpSituationService.saveBatch(entry.getValue(), tenantKey); + SalaryEntityUtil.properties(entry.getValue(), AddUpSituation::getTaxAgentId)); + addUpSituationService.batchSave(entry.getValue()); } } } - private TaxDeclarationResult generateReportPerRecord(TaxDeclareRecordPO taxDeclareRecord, - List salaryAcctEmployees, - Long employeeId, String tenantKey) { + private TaxDeclarationResult generateReportPerRecord(TaxDeclareRecordPO taxDeclareRecord, List salaryAcctEmployees) { LocalDateTime now = LocalDateTime.now(); List taxDeclarations = Lists.newArrayList(); List taxDeclarationValues = Lists.newArrayList(); - List addUpSituations = Lists.newArrayList(); + List addUpSituations = Lists.newArrayList(); // 鏌ヨ钖祫椤圭洰 - List salaryItems = salaryItemService.listAll(employeeId, tenantKey); + List salaryItems = salaryItemService.listAll(); // 鏌ヨ涓◣鐢虫姤琛ㄥ垪 - List taxReportColumns = taxReportColumnService.listAll(tenantKey); + List taxReportColumns = taxReportColumnService.listAll(); Map> taxReportColumnMap = SalaryEntityUtil.group2Map(taxReportColumns, TaxReportColumnPO::getIncomeCategory); // 鏌ヨ钖祫鏍哥畻璁板綍 Set salaryAcctRecordIds = SalaryEntityUtil.properties(salaryAcctEmployees, SalaryAcctEmployeePO::getSalaryAcctRecordId); - List salaryAcctRecords = salaryAcctRecordService.listByIds(salaryAcctRecordIds, tenantKey); + List salaryAcctRecords = salaryAcctRecordService.listByIds(salaryAcctRecordIds); Map salaryAcctRecordMap = SalaryEntityUtil.convert2Map(salaryAcctRecords, SalaryAcctRecordPO::getId); // 鏌ヨ钖祫鏍哥畻缁撴灉 Set salaryAcctEmployeeIds = SalaryEntityUtil.properties(salaryAcctEmployees, SalaryAcctEmployeePO::getId); - List salaryAcctResultValues = salaryAcctResultValueService.listBySalaryAcctEmployeeIds(salaryAcctEmployeeIds, tenantKey); + List salaryAcctResultValues = salaryAcctResultValueService.listBySalaryAcctEmployeeIds(salaryAcctEmployeeIds); // 鏌ヨ钖祫璐﹀鐨勭疮璁″瓧娈靛搴斿叧绯 Set salarySobIds = SalaryEntityUtil.properties(salaryAcctEmployees, SalaryAcctEmployeePO::getSalarySobId); - List salarySobAddUpRules = salarySobAddUpRuleService.listBySalarySobIds(salarySobIds, tenantKey); + List salarySobAddUpRules = salarySobAddUpRuleService.listBySalarySobIds(salarySobIds); Map salarySobAddUpRuleMap = SalaryEntityUtil.convert2Map(salarySobAddUpRules, e -> e.getSalarySobId() + "-" + e.getAddUpColumnDataIndex()); // 鏌ヨ钖祫璐﹀鐨勪釜绋庣敵鎶ヨ〃瀵瑰簲瑙勫垯 - List salarySobTaxReportRules = salarySobTaxReportRuleService.listBySalarySobIds(salarySobIds, tenantKey); + List salarySobTaxReportRules = salarySobTaxReportRuleService.listBySalarySobIds(salarySobIds); Map salarySobTaxReportRuleMap = SalaryEntityUtil.convert2Map(salarySobTaxReportRules, e -> e.getSalarySobId() + "-" + e.getReportColumnDataIndex()); // 钖祫鏍哥畻缁撴灉鎸夌収钖祫鏍哥畻浜哄憳id鑱氬悎鍒嗙被 Map salaryAcctResultValueMap = SalaryEntityUtil.convert2Map( @@ -464,7 +440,7 @@ public class TaxDeclareRecordServiceImpl extends Service implements TaxDeclareRe .setTaxReportColumns(taxReportColumnMap.get(incomeCategoryEntry.getKey())) .setSalaryItems(salaryItems); TaxDeclarationStrategy taxDeclarationStrategy = new TaxDeclarationCommon(); - TaxDeclarationGenerateResult generateResult = taxDeclarationStrategy.generate(taxDeclareContext, employeeId, tenantKey); + TaxDeclarationGenerateResult generateResult = taxDeclarationStrategy.generate(taxDeclareContext); taxDeclarationValues.addAll(generateResult.getTaxDeclarationValues()); addUpSituations.addAll(generateResult.getAddUpSituations()); } @@ -481,19 +457,17 @@ public class TaxDeclareRecordServiceImpl extends Service implements TaxDeclareRe * @param taxAgentNameMap * @param salaryAcctRecords * @param salaryAcctTaxAgents - * @param tenantKey */ private List checkBeforeSave(TaxDeclarationSaveParam saveParam, Map taxAgentNameMap, List salaryAcctRecords, - List salaryAcctTaxAgents, - Long employeeId, String tenantKey) { + List salaryAcctTaxAgents) { List resultList = Lists.newArrayList(); // 濡傛灉瀛樺湪鏈綊妗g殑钖祫鏍哥畻璁板綍锛屼笉鍏佽鐢熸垚涓◣鐢虫姤琛 boolean notArchived = salaryAcctRecords.stream() .anyMatch(salaryAcctRecordPO -> Objects.equals(salaryAcctRecordPO.getStatus(), SalaryAcctRecordStatusEnum.NOT_ARCHIVED.getValue())); if (notArchived) { - throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 98875, "{0}鏈夋湭褰掓。鏁版嵁锛岃鍏ㄩ儴褰掓。鍚庡啀鐢虫姤") + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98875, "{0}鏈夋湭褰掓。鏁版嵁锛岃鍏ㄩ儴褰掓。鍚庡啀鐢虫姤") .replace("{0}", saveParam.getSalaryMonth().toString())); } // 鏌ヨ宸插綊妗g殑钖祫鏍哥畻璁板綍 @@ -502,14 +476,14 @@ public class TaxDeclareRecordServiceImpl extends Service implements TaxDeclareRe .collect(Collectors.toList()); // 鏃犲凡褰掓。鐨勮柂璧勬牳绠楄褰曪紝涓嶅厑璁哥敓鎴愪釜绋庣敵鎶ヨ〃 if (CollectionUtils.isEmpty(archivedSalaryAcctRecords)) { - throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 177860, "{0}鏃犲彲鐢虫姤鏁版嵁") + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(177860, "{0}鏃犲彲鐢虫姤鏁版嵁") .replace("{0}", saveParam.getSalaryMonth().toString())); } // 鏌ヨ宸插綊妗g殑钖祫鏍哥畻璁板綍鏄惁宸茬粡鐢熸垚杩囦釜绋庣敵鎶ヨ〃 - Map> taxCycleKeySalaryAcctTaxAgentMap = SalaryEntityUtil.group2Map(salaryAcctTaxAgents, SalaryAcctTaxAgentPO::getTaxCycle); - for (Map.Entry> taxCycleEntry : taxCycleKeySalaryAcctTaxAgentMap.entrySet()) { + Map> taxCycleKeySalaryAcctTaxAgentMap = SalaryEntityUtil.group2Map(salaryAcctTaxAgents, SalaryAcctTaxAgentPO::getTaxCycle); + for (Map.Entry> taxCycleEntry : taxCycleKeySalaryAcctTaxAgentMap.entrySet()) { Set archivedTaxAgentIds = SalaryEntityUtil.properties(taxCycleEntry.getValue(), SalaryAcctTaxAgentPO::getTaxAgentId); - List taxDeclareRecords = listBySalaryMonthAndTaxAgentIds(saveParam.getSalaryMonth(), archivedTaxAgentIds, tenantKey); + List taxDeclareRecords = listBySalaryMonthAndTaxAgentIds(SalaryDateUtil.localDateToDate(saveParam.getSalaryMonth().atDay(1)), archivedTaxAgentIds); TaxDeclareRecordPO declareSuccessTaxDeclareRecord = taxDeclareRecords.stream() .filter(taxDeclareRecordPO -> archivedTaxAgentIds.contains(taxDeclareRecordPO.getTaxAgentId()) && !(Objects.equals(taxDeclareRecordPO.getTaxDeclareStatus(), TaxDeclareStatusEnum.NOT_DECLARE.getValue()) @@ -518,9 +492,9 @@ public class TaxDeclareRecordServiceImpl extends Service implements TaxDeclareRe .orElse(null); // 宸茬粡鐢虫姤鎴愬姛浜嗙殑涓◣鐢虫姤琛ㄧ殑涓◣鎵g即涔夊姟浜轰笉鍏佽閲嶆柊鐢熸垚 if (Objects.nonNull(declareSuccessTaxDeclareRecord)) { - throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 160522, "宸插紑鍚櫤鑳界畻钖笟鍔★紝涓◣鎵g即涔夊姟浜簕0}鐨勭◣娆炬墍灞炴湡{1}鐨勪釜绋庣敵鎶ヨ〃姝e湪鐢虫姤涓垨鑰呭凡缁忕敵鎶ユ垚鍔燂紝涓嶅彲閲嶅鐢熸垚") + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(160522, "宸插紑鍚櫤鑳界畻钖笟鍔★紝涓◣鎵g即涔夊姟浜簕0}鐨勭◣娆炬墍灞炴湡{1}鐨勪釜绋庣敵鎶ヨ〃姝e湪鐢虫姤涓垨鑰呭凡缁忕敵鎶ユ垚鍔燂紝涓嶅彲閲嶅鐢熸垚") .replace("{0}", taxAgentNameMap.get(declareSuccessTaxDeclareRecord.getTaxAgentId())) - .replace("{1}", declareSuccessTaxDeclareRecord.getTaxCycle())); + .replace("{1}", SalaryDateUtil.getFormatYearMonth(declareSuccessTaxDeclareRecord.getTaxCycle()))); } resultList.addAll(taxDeclareRecords); } @@ -531,88 +505,88 @@ public class TaxDeclareRecordServiceImpl extends Service implements TaxDeclareRe * 鏍规嵁涓◣鎵g即涔夊姟浜鸿寖鍥存煡璇釜绋庢墸缂翠箟鍔′汉 * * @param saveParam - * @param employeeId - * @param tenantKey * @return */ - private List queryByTaxAgentRange(TaxDeclarationSaveParam saveParam, Long employeeId, String tenantKey) { - List taxAgents; - if (saveParam.getTaxAgentRange() == TaxAgentRangeEnum.ALL_TAX_AGENT) { - // 鍒ゆ柇褰撳墠鏄惁寮鍚簡鍒嗘潈 - Boolean openDevolution = taxAgentService.isOpenDevolution(tenantKey); - // 鍒ゆ柇鏄惁鏄荤鐞嗗憳 - Boolean isChief = taxAgentService.isChief(employeeId, tenantKey); - if (openDevolution && !isChief) { - throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 160523, "瀵逛笉璧凤紝鎮ㄤ笉鏄柂閰ā鍧楃殑鎬荤鐞嗗憳锛屼笉鍏峰鐢熸垚鎵鏈変釜绋庢墸缂翠箟鍔′汉鐨勬潈闄")); - } - taxAgents = taxAgentService.listAll(tenantKey); - } else if (saveParam.getTaxAgentRange() == TaxAgentRangeEnum.ADMIN_TAX_AGENT) { - taxAgents = taxAgentService.listAllTaxAgentsAsAdmin(employeeId, tenantKey); - } else { - taxAgents = taxAgentService.listByIds(saveParam.getTaxAgentIds(), tenantKey); - } - return taxAgents; - } +// private List queryByTaxAgentRange(TaxDeclarationSaveParam saveParam) { +// List taxAgents; +// if (saveParam.getTaxAgentRange() == TaxAgentRangeEnum.ALL_TAX_AGENT) { +// // 鍒ゆ柇褰撳墠鏄惁寮鍚簡鍒嗘潈 +// Boolean openDevolution = taxAgentService.isOpenDevolution(tenantKey); +// // 鍒ゆ柇鏄惁鏄荤鐞嗗憳 +// Boolean isChief = taxAgentService.isChief(employeeId); +// if (openDevolution && !isChief) { +// throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(160523, "瀵逛笉璧凤紝鎮ㄤ笉鏄柂閰ā鍧楃殑鎬荤鐞嗗憳锛屼笉鍏峰鐢熸垚鎵鏈変釜绋庢墸缂翠箟鍔′汉鐨勬潈闄")); +// } +// taxAgents = taxAgentService.listAll(tenantKey); +// } else if (saveParam.getTaxAgentRange() == TaxAgentRangeEnum.ADMIN_TAX_AGENT) { +// taxAgents = taxAgentService.listAllTaxAgentsAsAdmin(employeeId); +// } else { +// taxAgents = taxAgentService.listByIds(saveParam.getTaxAgentIds()); +// } +// return taxAgents; +// } @Override - public void updateIcon(Long id, Integer displayIcon, Long employeeId, String tenantKey) { - TaxDeclareRecordPO taxDeclareRecord = getById(id, tenantKey); + public void updateIcon(Long id, Integer displayIcon) { + TaxDeclareRecordPO taxDeclareRecord = getById(id); if (taxDeclareRecord == null) { - throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 84026, "鍙傛暟閿欒")); + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(84026, "鍙傛暟閿欒")); } taxDeclareRecord.setDisplayUpdateIcon(displayIcon); - taxDeclareRecord.setUpdateTime(LocalDateTime.now()); - updateById(taxDeclareRecord); + taxDeclareRecord.setUpdateTime(new Date()); + taxDeclareRecordMapper.update(taxDeclareRecord); } @Override - public void updateByTaxCycleAndTaxAgentIds(YearMonth taxCycle, Collection taxAgentIds, String tenantKey) { + public void updateByTaxCycleAndTaxAgentIds(Date taxCycle, Collection taxAgentIds) { if (Objects.isNull(taxCycle) || CollectionUtils.isEmpty(taxAgentIds)) { throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(84026, "鍙傛暟閿欒")); } - List taxDeclareRecords = listByTaxCycleAndTaxAgentIds(taxCycle, taxAgentIds, tenantKey); + List taxDeclareRecords = listByTaxCycleAndTaxAgentIds(taxCycle, taxAgentIds); if (CollectionUtils.isEmpty(taxDeclareRecords)) { return; } - LocalDateTime now = LocalDateTime.now(); - taxDeclareRecords.forEach(e -> e.setDisplayUpdateIcon(1).setUpdateTime(now)); - updateBatchById(taxDeclareRecords); + Date now = new Date(); + taxDeclareRecords.forEach(e -> { + e.setDisplayUpdateIcon(1).setUpdateTime(now); + taxDeclareRecordMapper.update(e); + }); } @Override - public boolean checkByAuthority(TaxDeclarationPO taxDeclaration, Long employeeId, String tenantKey) { - // 鍒ゆ柇鏄惁浠呮湰浜哄彲瑙 - if (Objects.equals(taxDeclaration.getControlView(), 1) && !Objects.equals(taxDeclaration.getCreator(), employeeId)) { - return false; - } - // 鍒ゆ柇鏄惁寮鍚簡鍒嗘潈 - Boolean openDevolution = taxAgentService.isOpenDevolution(tenantKey); - // 鍒ゆ柇鏄惁鏄荤鐞嗗憳 - Boolean isChief = taxAgentService.isChief(employeeId, tenantKey); - // 鍙鑼冨洿鍐呯殑涓◣鎵g即涔夊姟浜 - List taxAgents = Lists.newArrayList(); - if (openDevolution) { - if (isChief) { - taxAgents = taxAgentService.listAsChief(true, true, employeeId, tenantKey); - } else { - taxAgents = taxAgentService.listAllTaxAgentsAsAdmin(employeeId, tenantKey); - } - if (CollectionUtils.isEmpty(taxAgents)) { - return false; - } - Set taxAgentIds = SalaryEntityUtil.properties(taxAgents, TaxAgentPO::getId); - return taxAgentIds.contains(taxDeclaration.getTaxAgentId()); - } + public boolean checkByAuthority(TaxDeclarationPO taxDeclaration) { +// // 鍒ゆ柇鏄惁浠呮湰浜哄彲瑙 +// if (Objects.equals(taxDeclaration.getControlView(), 1) && !Objects.equals(taxDeclaration.getCreator(), employeeId)) { +// return false; +// } +// // 鍒ゆ柇鏄惁寮鍚簡鍒嗘潈 +// Boolean openDevolution = taxAgentService.isOpenDevolution(tenantKey); +// // 鍒ゆ柇鏄惁鏄荤鐞嗗憳 +// Boolean isChief = taxAgentService.isChief(employeeId); +// // 鍙鑼冨洿鍐呯殑涓◣鎵g即涔夊姟浜 +// List taxAgents = Lists.newArrayList(); +// if (openDevolution) { +// if (isChief) { +// taxAgents = taxAgentService.listAsChief(true, true); +// } else { +// taxAgents = taxAgentService.listAllTaxAgentsAsAdmin(employeeId); +// } +// if (CollectionUtils.isEmpty(taxAgents)) { +// return false; +// } +// Set taxAgentIds = SalaryEntityUtil.properties(taxAgents, TaxAgentPO::getId); +// return taxAgentIds.contains(taxDeclaration.getTaxAgentId()); +// } // 鏌ヨ涓◣鐢虫姤琛 return true; } @Override - public void deleteByIds(Collection ids, String tenantKey) { + public void deleteByIds(Collection ids) { if (CollectionUtils.isEmpty(ids)) { return; } - List taxDeclareRecords = listByIds(ids, tenantKey); + List taxDeclareRecords = listByIds(ids); if (CollectionUtils.isEmpty(taxDeclareRecords)) { throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(160524, "涓◣鐢虫姤琛ㄤ笉瀛樺湪鎴栧凡琚垹闄")); } @@ -623,74 +597,68 @@ public class TaxDeclareRecordServiceImpl extends Service implements TaxDeclareRe if (CollectionUtils.isNotEmpty(cantDeleteTaxDeclareRecords)) { throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(177854, "涓◣鐢虫姤琛ㄥ凡缁忕敵鎶ワ紝鏃犳硶鍒犻櫎")); } - new LambdaUpdateChainWrapper<>(taxDeclareRecordMapper) - .eq(TaxDeclareRecordPO::getTenantKey, tenantKey) - .eq(TaxDeclareRecordPO::getDeleteType, DeleteTypeEnum.NOT_DELETED.getValue()) - .in(TaxDeclareRecordPO::getId, ids) - .set(TaxDeclareRecordPO::getDeleteType, DeleteTypeEnum.DELETED.getValue()) - .update(); + taxDeclareRecordMapper.deleteByIds(ids); // 鍒犻櫎涓◣鐢虫姤琛 - taxDeclarationService.deleteByTaxDeclareRecordIds(ids, tenantKey); + taxDeclarationService.deleteByTaxDeclareRecordIds(ids); // 鍒犻櫎涓◣鐢虫姤琛ㄦ槑缁 - taxDeclarationValueService.deleteByTaxDeclareRecordIds(ids, tenantKey); + taxDeclarationValueService.deleteByTaxDeclareRecordIds(ids); // 璁板綍鏃ュ織 - writeDeleteLog(taxDeclareRecords, tenantKey); +// writeDeleteLog(taxDeclareRecords); } - private void writeDeleteLog(List taxDeclareRecords, String tenantKey) { - // 璁板綍鏃ュ織 - List taxAgents = taxAgentService.listByIds(SalaryEntityUtil.properties(taxDeclareRecords, TaxDeclareRecordPO::getTaxAgentId), tenantKey); - Map taxAgentNameMap = SalaryEntityUtil.convert2Map(taxAgents, TaxAgentPO::getId, TaxAgentPO::getName); - for (TaxDeclareRecordPO taxDeclareRecord : taxDeclareRecords) { - LoggerContext loggerContext = new LoggerContext<>(); - loggerContext.setTargetId(String.valueOf(taxDeclareRecord.getId())); - loggerContext.setTargetName(SalaryI18nUtil.getI18nLabel(203562, "涓◣鎵g即涔夊姟浜恒寋0}銆嶇◣娆炬墍灞炴湡銆寋1}銆") - .replace("{0}", taxAgentNameMap.getOrDefault(taxDeclareRecord.getTaxAgentId(), com.baomidou.mybatisplus.core.toolkit.StringUtils.EMPTY)) - .replace("{1}", taxDeclareRecord.getTaxCycle())); - loggerContext.setOperateType(OperateTypeEnum.DELETE.getValue()); - loggerContext.setOperateTypeName(SalaryI18nUtil.getI18nLabel(156453, "鍒犻櫎涓◣鐢虫姤琛")); - loggerContext.setOperatedesc(SalaryI18nUtil.getI18nLabel(156453, "鍒犻櫎涓◣鐢虫姤琛")); - taxDeclarationLoggerTemplate.write(loggerContext); - } - } +// private void writeDeleteLog(List taxDeclareRecords) { +// // 璁板綍鏃ュ織 +// List taxAgents = taxAgentService.listByIds(SalaryEntityUtil.properties(taxDeclareRecords, TaxDeclareRecordPO::getTaxAgentId)); +// Map taxAgentNameMap = SalaryEntityUtil.convert2Map(taxAgents, TaxAgentPO::getId, TaxAgentPO::getName); +// for (TaxDeclareRecordPO taxDeclareRecord : taxDeclareRecords) { +// LoggerContext loggerContext = new LoggerContext<>(); +// loggerContext.setTargetId(String.valueOf(taxDeclareRecord.getId())); +// loggerContext.setTargetName(SalaryI18nUtil.getI18nLabel(203562, "涓◣鎵g即涔夊姟浜恒寋0}銆嶇◣娆炬墍灞炴湡銆寋1}銆") +// .replace("{0}", taxAgentNameMap.getOrDefault(taxDeclareRecord.getTaxAgentId(), com.baomidou.mybatisplus.core.toolkit.StringUtils.EMPTY)) +// .replace("{1}", taxDeclareRecord.getTaxCycle())); +// loggerContext.setOperateType(OperateTypeEnum.DELETE.getValue()); +// loggerContext.setOperateTypeName(SalaryI18nUtil.getI18nLabel(156453, "鍒犻櫎涓◣鐢虫姤琛")); +// loggerContext.setOperatedesc(SalaryI18nUtil.getI18nLabel(156453, "鍒犻櫎涓◣鐢虫姤琛")); +// taxDeclarationLoggerTemplate.write(loggerContext); +// } +// } @Override - public void declare(Long id, Long employeeId, String tenantKey) { - TaxDeclareRequest taxDeclareRequest = buildTaxDeclareRequest(id, employeeId, tenantKey); + public void declare(Long id) { + TaxDeclareRequest taxDeclareRequest = buildTaxDeclareRequest(id); TaxDeclareRecordPO taxDeclareRecord = taxDeclareRequest.getTaxDeclareRecord(); if (StringUtils.isNotEmpty(taxDeclareRecord.getRequestId()) && Objects.equals(taxDeclareRecord.getTaxDeclareStatus(), TaxDeclareStatusEnum.DECLARING.getValue())) { - throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 160526, "鐩墠姝e浜庣敵鎶ヤ腑锛岃绋嶅悗鐗囧埢鍐嶇偣鍑汇岀敵鎶ュ弽棣堛嶈幏鍙栫粨鏋")); + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(160526, "鐩墠姝e浜庣敵鎶ヤ腑锛岃绋嶅悗鐗囧埢鍐嶇偣鍑汇岀敵鎶ュ弽棣堛嶈幏鍙栫粨鏋")); } if (StringUtils.isNotEmpty(taxDeclareRecord.getRequestId()) && Objects.equals(taxDeclareRecord.getTaxDeclareStatus(), TaxDeclareStatusEnum.DECLARE_CANCELLING.getValue())) { - throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 160527, "鐩墠姝e浜庝綔搴熺敵鎶ヤ腑锛岃绋嶅悗鐗囧埢鍐嶇偣鍑汇屼綔搴熷弽棣堛嶈幏鍙栫粨鏋")); + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(160527, "鐩墠姝e浜庝綔搴熺敵鎶ヤ腑锛岃绋嶅悗鐗囧埢鍐嶇偣鍑汇屼綔搴熷弽棣堛嶈幏鍙栫粨鏋")); } // 鏌ヨ涓◣鐢虫姤琛 - List taxDeclarations = taxDeclarationService.listByTaxCycleAndTaxAgentIds(YearMonth.parse(taxDeclareRecord.getTaxCycle()), - Collections.singleton(taxDeclareRecord.getTaxAgentId()), tenantKey); + List taxDeclarations = taxDeclarationService.listByTaxCycleAndTaxAgentIds(SalaryDateUtil.localDate2YearMonth(taxDeclareRecord.getTaxCycle()), Collections.singleton(taxDeclareRecord.getTaxAgentId())); if (CollectionUtils.isEmpty(taxDeclarations)) { - throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 156494, "褰撳墠鏃犲彲鐢虫姤鐨勬暟鎹")); + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(156494, "褰撳墠鏃犲彲鐢虫姤鐨勬暟鎹")); } AbnormalEmployeeListQueryParam queryParam = new AbnormalEmployeeListQueryParam() .setTaxDeclareRecordId(taxDeclareRecord.getId()) .setTaxAgentId(taxDeclareRecord.getTaxAgentId()) .setTaxCycle(taxDeclareRecord.getTaxCycle()); // 鏌ヨ鏄惁瀛樺湪鏈夋湭鎶ラ佺殑浜 - List notDeclareTaxDeclareEmployees = taxDeclareEmployeeService.list4NotDeclareByParam(queryParam, tenantKey); + List notDeclareTaxDeclareEmployees = taxDeclareEmployeeService.list4NotDeclareByParam(queryParam); if (CollectionUtils.isNotEmpty(notDeclareTaxDeclareEmployees)) { - throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 162125, "瀛樺湪鏈夋湭鎶ラ佺殑浜猴紝璇峰厛鎶ラ佺浉鍏充汉鍛樺悗鍐嶇敵鎶ヤ釜绋")); + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(162125, "瀛樺湪鏈夋湭鎶ラ佺殑浜猴紝璇峰厛鎶ラ佺浉鍏充汉鍛樺悗鍐嶇敵鎶ヤ釜绋")); } // 鏌ヨ鏄惁瀛樺湪娌℃湁鐢虫姤鏁版嵁鐨勪汉 - List noValueTaxDeclareEmployees = taxDeclareEmployeeService.list4NoValueByParam(queryParam, tenantKey); + List noValueTaxDeclareEmployees = taxDeclareEmployeeService.list4NoValueByParam(queryParam); if (CollectionUtils.isNotEmpty(noValueTaxDeclareEmployees)) { - throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 160535, "瀛樺湪娌℃湁鐢虫姤鏁版嵁鐨勪汉锛岃閲嶆柊鏍哥畻杩欎簺浜虹殑钖祫鍚庡啀鏉ョ敵鎶ヤ釜绋")); + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(160535, "瀛樺湪娌℃湁鐢虫姤鏁版嵁鐨勪汉锛岃閲嶆柊鏍哥畻杩欎簺浜虹殑钖祫鍚庡啀鏉ョ敵鎶ヤ釜绋")); } // 鏌ヨ涓◣鐢虫姤琛ㄧ殑鐢虫姤鏁版嵁 Set taxDeclarationIds = SalaryEntityUtil.properties(taxDeclarations, TaxDeclarationPO::getId); - List taxDeclarationValues = taxDeclarationValueService.listByTaxDeclarationIds(taxDeclarationIds, tenantKey); + List taxDeclarationValues = taxDeclarationValueService.listByTaxDeclarationIds(taxDeclarationIds); // 鏌ヨ鏈◣娆炬墍灞炴湡鍐呮姤閫佹垚鍔熺殑浜哄憳 List employeeDeclares = employeeDeclareService.listByTaxCycleAndTaxAgentId(YearMonth.parse(taxDeclareRecord.getTaxCycle()), - taxDeclareRecord.getTaxAgentId(), tenantKey); + taxDeclareRecord.getTaxAgentId()); employeeDeclares = employeeDeclares.stream() .filter(e -> Objects.equals(e.getDeclareStatus(), DeclareStatusEnum.DECLARE_SUCCESS.getValue())) .collect(Collectors.toList()); @@ -716,7 +684,7 @@ public class TaxDeclareRecordServiceImpl extends Service implements TaxDeclareRe log.info("涓◣鐢虫姤杩斿洖鏁版嵁: {} , taxDeclareRecord: {}", res, taxDeclareRecord); DeclareTaxResponse declareTaxResponse = JsonUtil.parseObject(res, DeclareTaxResponse.class); if (Objects.isNull(declareTaxResponse) || Objects.isNull(declareTaxResponse.getHead())) { - throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 156449, "鏈嶅姟寮傚父")); + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(156449, "鏈嶅姟寮傚父")); } if (!Objects.equals(declareTaxResponse.getHead().getCode(), SzyhApiConstant.SUCCESS_CODE)) { throw new SalaryRunTimeException(declareTaxResponse.getHead().getMsg()); @@ -727,26 +695,25 @@ public class TaxDeclareRecordServiceImpl extends Service implements TaxDeclareRe taxDeclareRecord.setUpdateTime(LocalDateTime.now()); taxDeclareRecordMapper.updateById(taxDeclareRecord); // 鍒犻櫎涓◣鐢虫姤鐢虫姤澶辫触鐨勬暟鎹 - taxDeclareFailService.deleteByTaxDeclareRecordIds(Collections.singleton(taxDeclareRecord.getId()), tenantKey); + taxDeclareFailService.deleteByTaxDeclareRecordIds(Collections.singleton(taxDeclareRecord.getId())); // 璁板綍鏃ュ織 TaxAgentPO taxAgent = taxDeclareRequest.getTaxAgent(); LoggerContext loggerContext = new LoggerContext<>(); loggerContext.setTargetId(String.valueOf(taxDeclareRecord.getId())); - loggerContext.setTargetName(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 203562, "涓◣鎵g即涔夊姟浜恒寋0}銆嶇◣娆炬墍灞炴湡銆寋1}銆") + loggerContext.setTargetName(SalaryI18nUtil.getI18nLabel(203562, "涓◣鎵g即涔夊姟浜恒寋0}銆嶇◣娆炬墍灞炴湡銆寋1}銆") .replace("{0}", taxAgent.getName()) .replace("{1}", taxDeclareRecord.getTaxCycle())); loggerContext.setOperator(Util.null2String(employeeId)); loggerContext.setOperateType(OperateTypeEnum.ADD.getValue()); - loggerContext.setOperateTypeName(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 156454, "鍦ㄧ嚎鐢虫姤")); - loggerContext.setOperatedesc(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 156454, "鍦ㄧ嚎鐢虫姤")); + loggerContext.setOperateTypeName(SalaryI18nUtil.getI18nLabel(156454, "鍦ㄧ嚎鐢虫姤")); + loggerContext.setOperatedesc(SalaryI18nUtil.getI18nLabel(156454, "鍦ㄧ嚎鐢虫姤")); taxDeclarationLoggerTemplate.write(loggerContext); } @Override - @Transactional(rollbackFor = Exception.class) - public void getDeclareFeedback(Long id, TaxDeclarationRateDTO taxDeclarationRate, Long currentEmployeeId, String tenantKey) { - TaxDeclareRequest taxDeclareRequest = buildTaxDeclareRequest(id, currentEmployeeId, tenantKey); + public void getDeclareFeedback(Long id, TaxDeclarationRateDTO taxDeclarationRate, Long currentEmployeeId) { + TaxDeclareRequest taxDeclareRequest = buildTaxDeclareRequest(id, currentEmployeeId); TaxDeclareRecordPO taxDeclareRecord = taxDeclareRequest.getTaxDeclareRecord(); if (StringUtils.isEmpty(taxDeclareRecord.getRequestId()) || !Objects.equals(taxDeclareRecord.getTaxDeclareStatus(), TaxDeclareStatusEnum.DECLARING.getValue())) { throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(tenantKey, currentEmployeeId, 156496, "璇峰厛鐐瑰嚮銆屽湪绾跨敵鎶ャ嶅悗鍐嶇偣鍑汇岀敵鎶ュ弽棣堛嶈幏鍙栫敵鎶ョ粨鏋")); @@ -773,7 +740,7 @@ public class TaxDeclareRecordServiceImpl extends Service implements TaxDeclareRe } // 鏌ヨ鎶ラ佺殑浜哄憳 List employeeDeclares = employeeDeclareService.listByTaxCycleAndTaxAgentId(YearMonth.parse(taxDeclareRecord.getTaxCycle()), - taxDeclareRecord.getTaxAgentId(), tenantKey); + taxDeclareRecord.getTaxAgentId()); Map employeeInfoMap = SalaryEntityUtil.convert2Map(employeeDeclares, e -> e.getEmployeeName() + "-" + e.getCardNum()); // 娴侀噺缁熻 @@ -887,17 +854,17 @@ public class TaxDeclareRecordServiceImpl extends Service implements TaxDeclareRe } @Override - public void cancelDeclare(Long id, Long employeeId, String tenantKey) { - TaxDeclareRequest taxDeclareRequest = buildTaxDeclareRequest(id, employeeId, tenantKey); + public void cancelDeclare(Long id) { + TaxDeclareRequest taxDeclareRequest = buildTaxDeclareRequest(id); TaxDeclareRecordPO taxDeclareRecord = taxDeclareRequest.getTaxDeclareRecord(); // 鏇存鐢虫姤鎴愬姛鍚庝笉鑳戒綔搴 if (Objects.equals(taxDeclareRecord.getTaxDeclareType(), TaxDeclareTypeEnum.UPDATE_DECLARE.getValue())) { - throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 182701, "鏇存鐢虫姤鍚庝笉鍏佽浣滃簾")); + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(182701, "鏇存鐢虫姤鍚庝笉鍏佽浣滃簾")); } // 鍙湁鐢虫姤鎴愬姛锛屾棤闇缂存/鐢虫姤鎴愬姛锛屾湭缂存鐨勭姸鎬佹墠鑳戒綔搴 if (!Objects.equals(taxDeclareRecord.getTaxDeclareStatus(), TaxDeclareStatusEnum.DECLARE_SUCCESS_NO_PAY.getValue()) && !Objects.equals(taxDeclareRecord.getTaxDeclareStatus(), TaxDeclareStatusEnum.DECLARE_SUCCESS_UNPAID.getValue())) { - throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 156497, "鍙湁鐢虫姤鎴愬姛锛屾棤闇缂存/鐢虫姤鎴愬姛锛屾湭缂存鐨勭姸鎬佹墠鑳戒綔搴")); + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(156497, "鍙湁鐢虫姤鎴愬姛锛屾棤闇缂存/鐢虫姤鎴愬姛锛屾湭缂存鐨勭姸鎬佹墠鑳戒綔搴")); } // 渚涘簲鍟嗕俊鎭 TaxDeclarationApiConfigPO apiConfig = taxDeclareRequest.getTaxDeclarationApiConfig(); @@ -908,7 +875,7 @@ public class TaxDeclareRecordServiceImpl extends Service implements TaxDeclareRe // 鐢虫姤绫诲瀷 requestParam.put("sblx", "1"); // 浣滃簾閾惰仈缂存鍑瘉 - taxPaymentServiceFactory.get(TaxPaymentServiceTypeEnum.WITHHOLDING_VOUCHER.getValue()).cancelWithholdingVoucher(employeeId, tenantKey, apiConfig, taxDeclareRecord, requestParam); + taxPaymentServiceFactory.get(TaxPaymentServiceTypeEnum.WITHHOLDING_VOUCHER.getValue()).cancelWithholdingVoucher(employeeId, apiConfig, taxDeclareRecord, requestParam); // 鏄惁娓呯┖鎵寰 requestParam.put("sfqksd", "0"); // 璇锋眰 @@ -920,7 +887,7 @@ public class TaxDeclareRecordServiceImpl extends Service implements TaxDeclareRe log.info("浣滃簾鐢虫姤杩斿洖鏁版嵁锛" + res); DeclareTaxResponse declareTaxResponse = JsonUtil.parseObject(res, DeclareTaxResponse.class); if (Objects.isNull(declareTaxResponse) || Objects.isNull(declareTaxResponse.getHead())) { - throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 156449, "鏈嶅姟寮傚父")); + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(156449, "鏈嶅姟寮傚父")); } if (!Objects.equals(declareTaxResponse.getHead().getCode(), SzyhApiConstant.SUCCESS_CODE)) { throw new SalaryRunTimeException(declareTaxResponse.getHead().getMsg()); @@ -935,23 +902,23 @@ public class TaxDeclareRecordServiceImpl extends Service implements TaxDeclareRe TaxAgentPO taxAgent = taxDeclareRequest.getTaxAgent(); LoggerContext loggerContext = new LoggerContext<>(); loggerContext.setTargetId(String.valueOf(taxDeclareRecord.getId())); - loggerContext.setTargetName(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 203562, "涓◣鎵g即涔夊姟浜恒寋0}銆嶇◣娆炬墍灞炴湡銆寋1}銆") + loggerContext.setTargetName(SalaryI18nUtil.getI18nLabel(203562, "涓◣鎵g即涔夊姟浜恒寋0}銆嶇◣娆炬墍灞炴湡銆寋1}銆") .replace("{0}", taxAgent.getName()) .replace("{1}", taxDeclareRecord.getTaxCycle())); loggerContext.setOperator(Util.null2String(employeeId)); loggerContext.setOperateType(OperateTypeEnum.UPDATE.getValue()); - loggerContext.setOperateTypeName(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 156456, "鐢虫姤浣滃簾")); - loggerContext.setOperatedesc(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 156456, "鐢虫姤浣滃簾")); + loggerContext.setOperateTypeName(SalaryI18nUtil.getI18nLabel(156456, "鐢虫姤浣滃簾")); + loggerContext.setOperatedesc(SalaryI18nUtil.getI18nLabel(156456, "鐢虫姤浣滃簾")); taxDeclarationLoggerTemplate.write(loggerContext); } @Override - public void getCancelFeedback(Long id, TaxDeclarationRateDTO taxDeclarationRate, Long employeeId, String tenantKey) { - TaxDeclareRequest taxDeclareRequest = buildTaxDeclareRequest(id, employeeId, tenantKey); + public void getCancelFeedback(Long id, TaxDeclarationRateDTO taxDeclarationRate) { + TaxDeclareRequest taxDeclareRequest = buildTaxDeclareRequest(id); TaxDeclareRecordPO taxDeclareRecord = taxDeclareRequest.getTaxDeclareRecord(); if (!Objects.equals(taxDeclareRecord.getTaxDeclareStatus(), TaxDeclareStatusEnum.DECLARE_CANCELLING.getValue()) || StringUtils.isEmpty(taxDeclareRecord.getRequestId())) { - throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 156500, "璇峰厛鐐瑰嚮銆屼綔搴熺敵鎶ャ嶅悗鍐嶆潵鐐瑰嚮銆岀敵鎶ュ弽棣堛嶆寜閽幏鍙栫粨鏋")); + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(156500, "璇峰厛鐐瑰嚮銆屼綔搴熺敵鎶ャ嶅悗鍐嶆潵鐐瑰嚮銆岀敵鎶ュ弽棣堛嶆寜閽幏鍙栫粨鏋")); } // 渚涘簲鍟嗕俊鎭 TaxDeclarationApiConfigPO apiConfig = taxDeclareRequest.getTaxDeclarationApiConfig(); @@ -962,7 +929,7 @@ public class TaxDeclareRecordServiceImpl extends Service implements TaxDeclareRe log.info("浣滃簾鍙嶉杩斿洖鏁版嵁锛" + res); CancelDeclareFeedbackResponse cancelDeclareFeedbackResponse = JsonUtil.parseObject(res, CancelDeclareFeedbackResponse.class); if (Objects.isNull(cancelDeclareFeedbackResponse) || Objects.isNull(cancelDeclareFeedbackResponse.getHead())) { - throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 156449, "鏈嶅姟寮傚父")); + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(156449, "鏈嶅姟寮傚父")); } if (!Objects.equals(cancelDeclareFeedbackResponse.getHead().getCode(), SzyhApiConstant.SUCCESS_CODE)) { throw new SalaryRunTimeException(cancelDeclareFeedbackResponse.getHead().getMsg()); @@ -975,12 +942,12 @@ public class TaxDeclareRecordServiceImpl extends Service implements TaxDeclareRe List errorMsgList = JsonUtil.parseList(feedbackBody, Map.class).stream() .map(e -> Util.null2String(e.get("msg"))) .collect(Collectors.toList()); - taxDeclarationRate.setStatus(false).setMsg(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 156508, "浣滃簾澶辫触锛") + StringUtils.join(errorMsgList, ",")); + taxDeclarationRate.setStatus(false).setMsg(SalaryI18nUtil.getI18nLabel(156508, "浣滃簾澶辫触锛") + StringUtils.join(errorMsgList, ",")); } TaxDeclareStatusEnum taxDeclareStatusEnum = SalaryEnumUtil.enumMatchByValue( SalaryEntityUtil.getIntValue(cancelDeclareFeedbackResponse.getBody().get("sbztbj"), 1), TaxDeclareStatusEnum.class); if (taxDeclareStatusEnum == null) { - throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 156509, "鏈嶅姟寮傚父锛屾帴鍙h繑鍥炴暟鎹湁璇")); + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(156509, "鏈嶅姟寮傚父锛屾帴鍙h繑鍥炴暟鎹湁璇")); } taxDeclareRecord.setTaxDeclareStatus(taxDeclareStatusEnum.getValue()); taxDeclareRecord.setRequestId(""); @@ -991,19 +958,19 @@ public class TaxDeclareRecordServiceImpl extends Service implements TaxDeclareRe TaxAgentPO taxAgent = taxDeclareRequest.getTaxAgent(); LoggerContext loggerContext = new LoggerContext<>(); loggerContext.setTargetId(String.valueOf(taxDeclareRecord.getId())); - loggerContext.setTargetName(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 203562, "涓◣鎵g即涔夊姟浜恒寋0}銆嶇◣娆炬墍灞炴湡銆寋1}銆") + loggerContext.setTargetName(SalaryI18nUtil.getI18nLabel(203562, "涓◣鎵g即涔夊姟浜恒寋0}銆嶇◣娆炬墍灞炴湡銆寋1}銆") .replace("{0}", taxAgent.getName()) .replace("{1}", taxDeclareRecord.getTaxCycle())); loggerContext.setOperator(Util.null2String(employeeId)); loggerContext.setOperateType(OperateTypeEnum.UPDATE.getValue()); - loggerContext.setOperateTypeName(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 156457, "鑾峰彇鐢虫姤浣滃簾鐨勫弽棣")); - loggerContext.setOperatedesc(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 156457, "鑾峰彇鐢虫姤浣滃簾鐨勫弽棣")); + loggerContext.setOperateTypeName(SalaryI18nUtil.getI18nLabel(156457, "鑾峰彇鐢虫姤浣滃簾鐨勫弽棣")); + loggerContext.setOperatedesc(SalaryI18nUtil.getI18nLabel(156457, "鑾峰彇鐢虫姤浣滃簾鐨勫弽棣")); taxDeclarationLoggerTemplate.write(loggerContext); } @Override - public void updateDeclare(Long id, Long employeeId, String tenantKey) { - TaxDeclareRequest taxDeclareRequest = buildTaxDeclareRequest(id, employeeId, tenantKey); + public void updateDeclare(Long id) { + TaxDeclareRequest taxDeclareRequest = buildTaxDeclareRequest(id); TaxDeclareRecordPO taxDeclareRecord = taxDeclareRequest.getTaxDeclareRecord(); List taxDeclareStatusEnumValueList = Lists.newArrayList( TaxDeclareStatusEnum.DECLARE_SUCCESS_UNPAID.getValue(), @@ -1011,7 +978,7 @@ public class TaxDeclareRecordServiceImpl extends Service implements TaxDeclareRe TaxDeclareStatusEnum.DECLARE_SUCCESS_PAID.getValue(), TaxDeclareStatusEnum.DECLARE_SUCCESS_PAYING.getValue()); if (!taxDeclareStatusEnumValueList.contains(taxDeclareRecord.getTaxDeclareStatus())) { - throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 182702, "瀵逛笉璧凤紝鍙湁鐢虫姤鎴愬姛鍚庢墠鍏佽鏇存鐢虫姤")); + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(182702, "瀵逛笉璧凤紝鍙湁鐢虫姤鎴愬姛鍚庢墠鍏佽鏇存鐢虫姤")); } // 渚涘簲鍟嗕俊鎭 TaxDeclarationApiConfigPO apiConfig = taxDeclareRequest.getTaxDeclarationApiConfig(); @@ -1031,7 +998,7 @@ public class TaxDeclareRecordServiceImpl extends Service implements TaxDeclareRe log.info("鏇存鐢虫姤杩斿洖鏁版嵁锛" + res); UpdateDeclareResponse updateDeclareResponse = JsonUtil.parseObject(res, UpdateDeclareResponse.class); if (Objects.isNull(updateDeclareResponse) || Objects.isNull(updateDeclareResponse.getHead())) { - throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 156449, "鏈嶅姟寮傚父")); + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(156449, "鏈嶅姟寮傚父")); } if (!Objects.equals(updateDeclareResponse.getHead().getCode(), SzyhApiConstant.SUCCESS_CODE)) { throw new SalaryRunTimeException(updateDeclareResponse.getHead().getMsg()); @@ -1046,19 +1013,19 @@ public class TaxDeclareRecordServiceImpl extends Service implements TaxDeclareRe TaxAgentPO taxAgent = taxDeclareRequest.getTaxAgent(); LoggerContext loggerContext = new LoggerContext<>(); loggerContext.setTargetId(String.valueOf(taxDeclareRecord.getId())); - loggerContext.setTargetName(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 203562, "涓◣鎵g即涔夊姟浜恒寋0}銆嶇◣娆炬墍灞炴湡銆寋1}銆") + loggerContext.setTargetName(SalaryI18nUtil.getI18nLabel(203562, "涓◣鎵g即涔夊姟浜恒寋0}銆嶇◣娆炬墍灞炴湡銆寋1}銆") .replace("{0}", taxAgent.getName()) .replace("{1}", taxDeclareRecord.getTaxCycle())); loggerContext.setOperator(Util.null2String(employeeId)); loggerContext.setOperateType(OperateTypeEnum.UPDATE.getValue()); - loggerContext.setOperateTypeName(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 177637, "鏇存鐢虫姤")); - loggerContext.setOperatedesc(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 177637, "鏇存鐢虫姤")); + loggerContext.setOperateTypeName(SalaryI18nUtil.getI18nLabel(177637, "鏇存鐢虫姤")); + loggerContext.setOperatedesc(SalaryI18nUtil.getI18nLabel(177637, "鏇存鐢虫姤")); taxDeclarationLoggerTemplate.write(loggerContext); } @Override - public String queryDeclareStatus(Long id, Long employeeId, String tenantKey) { - TaxDeclareRequest taxDeclareRequest = buildTaxDeclareRequest(id, employeeId, tenantKey); + public String queryDeclareStatus(Long id) { + TaxDeclareRequest taxDeclareRequest = buildTaxDeclareRequest(id); TaxDeclarationApiConfigPO apiConfig = taxDeclareRequest.getTaxDeclarationApiConfig(); TaxDeclareRecordPO taxDeclareRecord = taxDeclareRequest.getTaxDeclareRecord(); Map requestParam = taxDeclareRequest.getRequestParam(); @@ -1077,8 +1044,8 @@ public class TaxDeclareRecordServiceImpl extends Service implements TaxDeclareRe } @Override - public String queryCompanyIncomes(Long id, Long employeeId, String tenantKey) { - TaxDeclareRequest taxDeclareRequest = buildTaxDeclareRequest(id, employeeId, tenantKey); + public String queryCompanyIncomes(Long id) { + TaxDeclareRequest taxDeclareRequest = buildTaxDeclareRequest(id); TaxDeclarationApiConfigPO apiConfig = taxDeclareRequest.getTaxDeclarationApiConfig(); TaxDeclareRecordPO taxDeclareRecord = taxDeclareRequest.getTaxDeclareRecord(); Map requestParam = taxDeclareRequest.getRequestParam(); @@ -1100,23 +1067,23 @@ public class TaxDeclareRecordServiceImpl extends Service implements TaxDeclareRe return res; } - private TaxDeclareRequest buildTaxDeclareRequest(Long id, Long employeeId, String tenantKey) { + private TaxDeclareRequest buildTaxDeclareRequest(Long id) { // 鏌ヨ渚涘簲鍟嗕俊鎭 - TaxDeclarationApiConfigPO apiConfig = taxDeclarationApiConfigService.getConfig(tenantKey, employeeId, true); + TaxDeclarationApiConfigPO apiConfig = taxDeclarationApiConfigService.getConfig(true); if (apiConfig == null) { - throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 160525, "鎺ュ彛娴侀噺涓嶈冻锛屾殏鏃犳硶浣跨敤璇ュ姛鑳斤紝璇峰厛璐拱鏅鸿兘绠楄柂鎺ュ彛娴侀噺")); + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(160525, "鎺ュ彛娴侀噺涓嶈冻锛屾殏鏃犳硶浣跨敤璇ュ姛鑳斤紝璇峰厛璐拱鏅鸿兘绠楄柂鎺ュ彛娴侀噺")); } // 鏌ヨ涓◣鐢虫姤璁板綍 - TaxDeclareRecordPO taxDeclareRecord = getById(id, tenantKey); + TaxDeclareRecordPO taxDeclareRecord = getById(id); if (Objects.isNull(taxDeclareRecord)) { - throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 156495, "鍙傛暟寮傚父锛屼釜绋庣敵鎶ヨ褰曚笉瀛樺湪鎴栧凡琚垹闄")); + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(156495, "鍙傛暟寮傚父锛屼釜绋庣敵鎶ヨ褰曚笉瀛樺湪鎴栧凡琚垹闄")); } // 鏌ヨ涓◣鎵g即涔夊姟浜 - TaxAgentPO taxAgent = taxAgentService.getById(taxDeclareRecord.getTaxAgentId(), tenantKey); + TaxAgentPO taxAgent = taxAgentService.getById(taxDeclareRecord.getTaxAgentId()); // 鏌ヨ涓◣鎵g即涔夊姟浜哄叧鑱旂殑浼佷笟淇℃伅 - TaxAgentTaxReturnPO taxAgentTaxReturn = taxAgentTaxReturnService.getByTaxAgentId(taxDeclareRecord.getTaxAgentId(), tenantKey); + TaxAgentTaxReturnPO taxAgentTaxReturn = taxAgentTaxReturnService.getByTaxAgentId(taxDeclareRecord.getTaxAgentId()); if (Objects.isNull(taxAgentTaxReturn) || !Objects.equals(taxAgentTaxReturn.getCheckStatus(), TaxAgentTaxReturnStatusEnum.SUCCESS.getValue())) { - throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 156469, "涓◣鎵g即涔夊姟浜虹殑鎶ョ◣淇℃伅楠岃瘉鏈氳繃锛岃鍏堢淮鎶ゅソ涓◣鎵g即涔夊姟浜虹殑鎶ョ◣淇℃伅")); + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(156469, "涓◣鎵g即涔夊姟浜虹殑鎶ョ◣淇℃伅楠岃瘉鏈氳繃锛岃鍏堢淮鎶ゅソ涓◣鎵g即涔夊姟浜虹殑鎶ョ◣淇℃伅")); } // 娉ㄥ唽鐨勪紒涓氫俊鎭-->璇锋眰鍙傛暟 Map requestParam = TaxAgentTaxReturnBO.convert2RequestMap(taxAgent, taxAgentTaxReturn); diff --git a/src/com/engine/salary/service/impl/TaxReportColumnServiceImpl.java b/src/com/engine/salary/service/impl/TaxReportColumnServiceImpl.java new file mode 100644 index 000000000..4cc852653 --- /dev/null +++ b/src/com/engine/salary/service/impl/TaxReportColumnServiceImpl.java @@ -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 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 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(); + } +} diff --git a/src/com/engine/salary/web/TaxDeclarationController.java b/src/com/engine/salary/web/TaxDeclarationController.java index 4f1d319df..838b498a5 100644 --- a/src/com/engine/salary/web/TaxDeclarationController.java +++ b/src/com/engine/salary/web/TaxDeclarationController.java @@ -166,7 +166,7 @@ public class TaxDeclarationController { taxDeclareRecordWrapper.updateIcon(param.getTaxDeclareRecordId(), UserContext.getCurrentEmployeeId(), TenantContext.getCurrentTenantKey()); return WeaResult.success(null); User user = HrmUserVarify.getUser(request, response); - return new ResponseResult(user).run(getTaxDeclarationWrapper(user)::getTaxDeclarationInfoById, taxDeclarationId); + return new ResponseResult(user).run(getTaxDeclareRecordWrapper(user)::updateIcon, taxDeclarationId); } /** diff --git a/src/com/engine/salary/wrapper/TaxDeclareRecordWrapper.java b/src/com/engine/salary/wrapper/TaxDeclareRecordWrapper.java index ae77b1f61..39f67ef2e 100644 --- a/src/com/engine/salary/wrapper/TaxDeclareRecordWrapper.java +++ b/src/com/engine/salary/wrapper/TaxDeclareRecordWrapper.java @@ -1,50 +1,38 @@ package com.engine.salary.wrapper; import com.engine.core.impl.Service; -import com.engine.salary.service.SalaryCacheService; -import com.engine.salary.service.TaxAgentService; -import com.engine.salary.service.TaxDeclarationExcelService; -import com.engine.salary.service.TaxDeclarationService; -import com.weaver.common.component.form.WeaForm; -import com.weaver.common.component.table.WeaTable; -import com.weaver.common.component.table.page.Page; -import com.weaver.common.component.table.permission.Permission; -import com.weaver.common.distribution.genid.IdGenerator; -import com.weaver.common.hr.util.Util; -import com.weaver.common.hrm.service.HrmCommonEmployeeService; -import com.weaver.common.threadPool.ThreadPoolUtil; -import com.weaver.common.threadPool.constant.ModulePoolEnum; -import com.weaver.common.threadPool.entity.LocalRunnable; -import com.weaver.datasecurity.interceptor.DSTenantKeyThreadVar; -import com.weaver.framework.util.JsonUtil; -import com.weaver.hrm.salary.cache.SalaryCacheKey; -import com.weaver.hrm.salary.common.excel.ExcelExportParam; -import com.weaver.hrm.salary.constant.SalaryConstant; -import com.weaver.hrm.salary.entity.taxagent.po.TaxAgentPO; -import com.weaver.hrm.salary.entity.taxdeclaration.dto.*; -import com.weaver.hrm.salary.entity.taxdeclaration.param.AbnormalEmployeeListQueryParam; -import com.weaver.hrm.salary.entity.taxdeclaration.param.TaxDeclarationListQueryParam; -import com.weaver.hrm.salary.entity.taxdeclaration.param.TaxDeclarationSaveParam; -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 com.engine.salary.cache.SalaryCacheKey; +import com.engine.salary.entity.datacollection.DataCollectionEmployee; +import com.engine.salary.entity.taxagent.po.TaxAgentPO; +import com.engine.salary.entity.taxdeclaration.dto.*; +import com.engine.salary.entity.taxdeclaration.param.AbnormalEmployeeListQueryParam; +import com.engine.salary.entity.taxdeclaration.param.TaxDeclarationListQueryParam; +import com.engine.salary.entity.taxdeclaration.param.TaxDeclarationSaveParam; +import com.engine.salary.entity.taxdeclaration.param.TaxDeclarationValueListQueryParam; +import com.engine.salary.entity.taxdeclaration.po.*; +import com.engine.salary.enums.salarysob.IncomeCategoryEnum; +import com.engine.salary.enums.taxdeclaration.TaxDeclareStatusEnum; +import com.engine.salary.enums.taxdeclaration.TaxDeclareTypeEnum; +import com.engine.salary.exception.SalaryRunTimeException; +import com.engine.salary.service.*; +import com.engine.salary.util.SalaryDateUtil; +import com.engine.salary.util.SalaryEntityUtil; +import com.engine.salary.util.SalaryEnumUtil; +import com.engine.salary.util.SalaryI18nUtil; +import com.engine.salary.util.page.PageInfo; +import com.engine.salary.util.page.SalaryPageUtil; +import com.weaver.util.threadPool.ThreadPoolUtil; +import com.weaver.util.threadPool.constant.ModulePoolEnum; +import com.weaver.util.threadPool.entity.LocalRunnable; +import dm.jdbc.util.IdGenerator; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.compress.utils.Lists; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.math.NumberUtils; import org.springframework.stereotype.Component; +import weaver.general.Util; -import java.time.YearMonth; import java.util.*; import java.util.stream.Collectors; @@ -59,48 +47,48 @@ import java.util.stream.Collectors; @Component public class TaxDeclareRecordWrapper extends Service { - + private TaxDeclareRecordService taxDeclareRecordService; - + private TaxAgentService taxAgentService; - - private HrmCommonEmployeeService hrmCommonEmployeeService; - + + private SalaryEmployeeService hrmCommonEmployeeService; + private SalaryCacheService salaryCacheService; - + private TaxDeclarationService taxDeclarationService; - + private TaxDeclarationValueService taxDeclarationValueService; - + private TaxDeclarationExcelService taxDeclarationExcelService; - + private TaxDeclareEmployeeService taxDeclareEmployeeService; - + private TaxDeclareFailService taxDeclareFailService; /** * 涓◣鐢虫姤璁板綍鍒楄〃 * * @param queryParam - * @param employeeId - * @param tenantKey * @return */ - public WeaTable listPage(TaxDeclarationListQueryParam queryParam, Long employeeId, String tenantKey) { - Page page = taxDeclareRecordService.listPageByParam(queryParam, employeeId, tenantKey); - Page dtoPage = new Page<>(page.getCurrent(), page.getSize(), page.getTotal(), page.isSearchCount()); - if (CollectionUtils.isNotEmpty(page.getRecords())) { + public PageInfo listPage(TaxDeclarationListQueryParam queryParam) { + PageInfo page = taxDeclareRecordService.listPageByParam(queryParam); + List list = page.getList(); + + PageInfo dtoPage = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), TaxDeclareRecordListDTO.class); + if (CollectionUtils.isNotEmpty(list)) { // 鏌ヨ涓◣鎵g即涔夊姟浜 - Set taxAgentIds = SalaryEntityUtil.properties(page.getRecords(), TaxDeclareRecordPO::getTaxAgentId); - List taxAgents = taxAgentService.listByIds(taxAgentIds, tenantKey); + Set taxAgentIds = SalaryEntityUtil.properties(list, TaxDeclareRecordPO::getTaxAgentId); + List taxAgents = taxAgentService.listByIds(taxAgentIds); // 鏌ヨ浜哄憳濮撳悕 - List employeeIds = SalaryEntityUtil.properties(page.getRecords(), TaxDeclareRecordPO::getCreator, Collectors.toList()); - List simpleEmployees = hrmCommonEmployeeService.getEmployeeByIds(employeeIds, tenantKey); + List employeeIds = SalaryEntityUtil.properties(list, TaxDeclareRecordPO::getCreator, Collectors.toList()); + List simpleEmployees = hrmCommonEmployeeService.getEmployeeByIds(employeeIds); List dtoList = Lists.newArrayList(); Map taxAgentNameMap = SalaryEntityUtil.convert2Map(taxAgents, TaxAgentPO::getId, TaxAgentPO::getName); - Map simpleEmployeeNameMap = SalaryEntityUtil.convert2Map(simpleEmployees, SimpleEmployee::getEmployeeId, SimpleEmployee::getName); - for (TaxDeclareRecordPO taxDeclareRecord : page.getRecords()) { + Map simpleEmployeeNameMap = SalaryEntityUtil.convert2Map(simpleEmployees, DataCollectionEmployee::getEmployeeId, DataCollectionEmployee::getUsername); + for (TaxDeclareRecordPO taxDeclareRecord : list) { TaxDeclareTypeEnum taxDeclareTypeEnum = SalaryEnumUtil.enumMatchByValue(taxDeclareRecord.getTaxDeclareType(), TaxDeclareTypeEnum.class); TaxDeclareStatusEnum taxDeclareStatusEnum = SalaryEnumUtil.enumMatchByValue(taxDeclareRecord.getTaxDeclareStatus(), TaxDeclareStatusEnum.class); TaxDeclareRecordListDTO taxDeclareRecordListDTO = new TaxDeclareRecordListDTO() @@ -121,195 +109,152 @@ public class TaxDeclareRecordWrapper extends Service { .setDisplayIcon(Objects.equals(taxDeclareRecord.getDisplayUpdateIcon(), 1)); dtoList.add(taxDeclareRecordListDTO); } - dtoPage.setRecords(dtoList); + dtoPage.setList(dtoList); } - // 杞崲鎴愬墠绔墍闇鐨勬暟鎹牸寮 - WeaTable weaTable = SalaryFormatUtil.getInstance() - .buildTable(TaxDeclareRecordListDTO.class, dtoPage); - for (int i = 0; i < dtoPage.getRecords().size(); i++) { - TaxDeclareRecordListDTO dto = dtoPage.getRecords().get(i); - List 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; + return dtoPage; } /** * 涓◣鐢虫姤琛ㄦ槑缁嗗垪琛 * * @param queryParam 鍒楄〃鏌ヨ鏉′欢 - * @param tenantKey 绉熸埛key * @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) { throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(156515, "瀵逛笉璧凤紝鎮ㄦ殏鏃舵病鏈夋潈闄愭煡鐪")); } - String pageUid = "taxDeclarationValueList"; - SalaryPageUtil.handlePageSize(pageUid, queryParam); // 鏌ヨ涓◣鐢虫姤琛ㄨ鎯 - Page page = taxDeclarationValueService.listPageByTaxDeclarationIds( - new Page<>(queryParam.getCurrent(), queryParam.getPageSize(), true), Collections.singleton(queryParam.getTaxDeclarationId()), tenantKey); - TaxDeclarationValueListDTO taxDeclarationValueListDTO = taxDeclarationValueService.convert2List(taxDeclaration, page.getRecords(), tenantKey); - Page> dtoPage = new Page<>(page.getCurrent(), page.getSize(), page.getTotal(), page.isSearchCount()); - dtoPage.setRecords(taxDeclarationValueListDTO.getData()); - // 杞垚鍓嶇鎵闇鐨勬牸寮 - WeaTable> weaTable = new WeaTable<>(); - weaTable.setColumns(taxDeclarationValueListDTO.getColumns()); - weaTable.setPage(dtoPage); - weaTable.setModule(SalaryConstant.MODULE); - weaTable.setPageUid(pageUid); - return weaTable; + PageInfo page = taxDeclarationValueService.listPageByTaxDeclarationIds(Collections.singleton(queryParam.getTaxDeclarationId())); + TaxDeclarationValueListDTO taxDeclarationValueListDTO = taxDeclarationValueService.convert2List(taxDeclaration, page.getList()); + PageInfo> dtoPage = new PageInfo(); + dtoPage.setList(taxDeclarationValueListDTO.getData()); + return dtoPage; } /** * 鏈姤閫佺殑浜哄憳鍒楄〃 * * @param queryParam - * @param tenantKey * @return */ - public WeaTable listEmployeePage4NotDeclare(AbnormalEmployeeListQueryParam queryParam, String tenantKey) { - String pageUid = "abnormalEmployeeList4NoDeclare"; - SalaryPageUtil.handlePageSize(pageUid, queryParam); - WeaTable weaTable = listEmployeePage("NotDeclare", queryParam, tenantKey); - weaTable.setPageUid(pageUid); - return weaTable; + public PageInfo listEmployeePage4NotDeclare(AbnormalEmployeeListQueryParam queryParam) { + return listEmployeePage("NotDeclare", queryParam); } /** * 娌℃湁鐢虫姤鏁版嵁鐨勪汉鍛樺垪琛 * * @param queryParam - * @param tenantKey * @return */ - public WeaTable listEmployeePage4NoValue(AbnormalEmployeeListQueryParam queryParam, String tenantKey) { - String pageUid = "abnormalEmployeeList4NoValue"; - SalaryPageUtil.handlePageSize(pageUid, queryParam); - WeaTable weaTable = listEmployeePage("NoValue", queryParam, tenantKey); - weaTable.setPageUid(pageUid); - return weaTable; + public PageInfo listEmployeePage4NoValue(AbnormalEmployeeListQueryParam queryParam) { + return listEmployeePage("NoValue", queryParam); } /** * 鐢虫姤澶辫触鐨勪汉鍛樺垪琛 * * @param queryParam - * @param tenantKey * @return */ - public WeaTable listEmployeePage4Fail(AbnormalEmployeeListQueryParam queryParam, String tenantKey) { - String pageUid = "failEmployeeList"; - SalaryPageUtil.handlePageSize(pageUid, queryParam); + public PageInfo listEmployeePage4Fail(AbnormalEmployeeListQueryParam queryParam) { // 鏌ヨ涓◣鐢虫姤璁板綍 - TaxDeclareRecordPO taxDeclareRecord = taxDeclareRecordService.getById(queryParam.getTaxDeclareRecordId(), tenantKey); + TaxDeclareRecordPO taxDeclareRecord = taxDeclareRecordService.getById(queryParam.getTaxDeclareRecordId()); // 鏌ヨ鐢虫姤澶辫触鐨勬暟鎹 - Page page = new Page<>(queryParam.getCurrent(), queryParam.getPageSize(), true); - page = taxDeclareFailService.listPageByTaxDeclareRecordIds(page, Collections.singleton(taxDeclareRecord.getId()), tenantKey); + PageInfo taxDeclareFailPOPageInfo = taxDeclareFailService.listPageByTaxDeclareRecordIds(Collections.singleton(taxDeclareRecord.getId())); + List list = taxDeclareFailPOPageInfo.getList(); // 杞崲鎴恉to - Page dtoPage = new Page<>(page.getCurrent(), page.getSize(), page.getTotal(), page.isSearchCount()); - dtoPage.setRecords(taxDeclareFailService.convert2FailEmployeeList(taxDeclareRecord, page.getRecords(), tenantKey)); + PageInfo dtoPage = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), FailEmployeeListDTO.class); + dtoPage.setList(taxDeclareFailService.convert2FailEmployeeList(taxDeclareRecord, list)); // 杞垚鍓嶇鎵闇鐨勬牸寮 - return SalaryFormatUtil.getInstance().buildTable(FailEmployeeListDTO.class, dtoPage); + return dtoPage; } - private WeaTable listEmployeePage(String key, AbnormalEmployeeListQueryParam queryParam, String tenantKey) { - WeaTable weaTable; + private PageInfo listEmployeePage(String key, AbnormalEmployeeListQueryParam queryParam) { // 鏌ヨ涓◣鐢虫姤璁板綍 - TaxDeclareRecordPO taxDeclareRecord = taxDeclareRecordService.getById(queryParam.getTaxDeclareRecordId(), tenantKey); + TaxDeclareRecordPO taxDeclareRecord = taxDeclareRecordService.getById(queryParam.getTaxDeclareRecordId()); queryParam.setTaxAgentId(taxDeclareRecord.getTaxAgentId()); queryParam.setTaxCycle(taxDeclareRecord.getTaxCycle()); if (StringUtils.isEmpty(queryParam.getKeyword())) { // 鏌ヨ涓◣鐢虫姤璁板綍鐨勪汉鍛 - Page page = new Page<>(queryParam.getCurrent(), queryParam.getPageSize(), true); + PageInfo page = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), TaxDeclareEmployeePO.class); if (StringUtils.equals("NotDeclare", key)) { - page = taxDeclareEmployeeService.listPage4NotDeclareByParam(queryParam, tenantKey); + page = taxDeclareEmployeeService.listPage4NotDeclareByParam(queryParam); } else if (StringUtils.equals("NoValue", key)) { - page = taxDeclareEmployeeService.listPage4NoValueByParam(queryParam, tenantKey); + page = taxDeclareEmployeeService.listPage4NoValueByParam(queryParam); } - Page dtoPage = new Page<>(page.getCurrent(), page.getSize(), page.getTotal(), page.isSearchCount()); - dtoPage.setRecords(taxDeclareEmployeeService.convert2AbnormalEmployeeList(taxDeclareRecord, page.getRecords(), tenantKey)); - // 杞崲鎴愬墠绔墍闇鐨勬牸寮 - weaTable = SalaryFormatUtil.getInstance().buildTable(AbnormalEmployeeListDTO.class, dtoPage); + PageInfo dtoPage = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), AbnormalEmployeeListDTO.class); + dtoPage.setList(taxDeclareEmployeeService.convert2AbnormalEmployeeList(taxDeclareRecord, page.getList())); + return dtoPage; } else { // 鏌ヨ鏉′欢涓寘鍚"keyword"鏃讹紝涓嶅ソ閫氳繃SQL鍒嗛〉锛屾墍浠ュ湪鍐呭瓨涓垎椤 List taxDeclareEmployees = Collections.emptyList(); if (StringUtils.equals("NotDeclare", key)) { - taxDeclareEmployees = taxDeclareEmployeeService.list4NotDeclareByParam(queryParam, tenantKey); + taxDeclareEmployees = taxDeclareEmployeeService.list4NotDeclareByParam(queryParam); } else if (StringUtils.equals("NoValue", key)) { - taxDeclareEmployees = taxDeclareEmployeeService.list4NoValueByParam(queryParam, tenantKey); + taxDeclareEmployees = taxDeclareEmployeeService.list4NoValueByParam(queryParam); } - List dtos = taxDeclareEmployeeService.convert2AbnormalEmployeeList(taxDeclareRecord, taxDeclareEmployees, tenantKey) + List dtos = taxDeclareEmployeeService.convert2AbnormalEmployeeList(taxDeclareRecord, taxDeclareEmployees) .stream() .filter(e -> StringUtils.contains(e.getEmployeeName(), queryParam.getKeyword()) || StringUtils.contains(e.getJobNum(), queryParam.getKeyword()) || StringUtils.contains(e.getCardNum(), queryParam.getKeyword())) .collect(Collectors.toList()); - Page dtoPage = new Page<>(queryParam.getCurrent(), queryParam.getPageSize(), dtos.size(), true); - dtoPage.setRecords(SalaryPageUtil.subList((int) dtoPage.getCurrent(), (int) dtoPage.getSize(), dtos)); - // 杞崲鎴愬墠绔墍闇鐨勬牸寮 - weaTable = SalaryFormatUtil.getInstance().buildTable(AbnormalEmployeeListDTO.class, dtoPage); + PageInfo dtoPage = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), dtos, AbnormalEmployeeListDTO.class); + return dtoPage; } - return weaTable; } - /** - * 鑾峰彇涓◣鐢虫姤璁板綍鐨勮〃鍗 - * - * @param id - * @param tenantKey - * @return - */ - public WeaForm getForm(Long id, Long employeeId, String tenantKey) { - TaxDeclareRecordFormDTO formDTO = new TaxDeclareRecordFormDTO(); - formDTO.setTaxAgentRange(TaxAgentRangeEnum.SELECT_TAX_AGENT); - // 鍒ゆ柇褰撳墠鏄惁寮鍚簡鍒嗘潈 - Boolean openDevolution = taxAgentService.isOpenDevolution(tenantKey); - Boolean isChief = taxAgentService.isChief(employeeId, tenantKey); - // 杞崲鎴愬墠绔墍闇鐨勬暟鎹牸寮 - WeaForm weaForm = SalaryFormatUtil.getInstance().buildForm(TaxDeclareRecordFormDTO.class, formDTO); - weaForm.getItems().forEach((k, v) -> { - if (StringUtils.equals("salaryMonth", k)) { - Map otherParams = new HashMap<>(); - otherParams.put("type", "month"); - v.setOtherParams(otherParams); - } - // 鏈紑鍚垎鏉冿紝娌℃湁"浣滀负绠$悊鍛樼殑涓◣鎵g即涔夊姟浜" - if (!openDevolution && StringUtils.equals("taxAgentRange", k)) { - v.getOptions().remove(1); - } - // 寮鍚垎鏉冿紝浣嗕笉鏄荤鐞嗗憳锛屾病鏈"鎵鏈変釜绋庢墸缂翠箟鍔′汉" - if (openDevolution && !isChief && StringUtils.equals("taxAgentRange", k)) { - v.getOptions().remove(0); - } - }); - return weaForm; - } +// /** +// * 鑾峰彇涓◣鐢虫姤璁板綍鐨勮〃鍗 +// * +// * @param id +// * @param tenantKey +// * @return +// */ +// public WeaForm getForm(Long id) { +// TaxDeclareRecordFormDTO formDTO = new TaxDeclareRecordFormDTO(); +// formDTO.setTaxAgentRange(TaxAgentRangeEnum.SELECT_TAX_AGENT); +// // 鍒ゆ柇褰撳墠鏄惁寮鍚簡鍒嗘潈 +// Boolean openDevolution = taxAgentService.isOpenDevolution(tenantKey); +// Boolean isChief = taxAgentService.isChief(employeeId); +// // 杞崲鎴愬墠绔墍闇鐨勬暟鎹牸寮 +// WeaForm weaForm = SalaryFormatUtil.getInstance().buildForm(TaxDeclareRecordFormDTO.class, formDTO); +// weaForm.getItems().forEach((k, v) -> { +// if (StringUtils.equals("salaryMonth", k)) { +// Map otherParams = new HashMap<>(); +// otherParams.put("type", "month"); +// v.setOtherParams(otherParams); +// } +// // 鏈紑鍚垎鏉冿紝娌℃湁"浣滀负绠$悊鍛樼殑涓◣鎵g即涔夊姟浜" +// if (!openDevolution && StringUtils.equals("taxAgentRange", k)) { +// v.getOptions().remove(1); +// } +// // 寮鍚垎鏉冿紝浣嗕笉鏄荤鐞嗗憳锛屾病鏈"鎵鏈変釜绋庢墸缂翠箟鍔′汉" +// if (openDevolution && !isChief && StringUtils.equals("taxAgentRange", k)) { +// v.getOptions().remove(0); +// } +// }); +// return weaForm; +// } /** * 鑾峰彇涓◣鐢虫姤璁板綍涓嬬殑涓◣鐢虫姤琛═AB * * @param id - * @param tenantKey * @return */ - public List getTaxDeclarationTab(Long id, Long employeeId, String tenantKey) { + public List getTaxDeclarationTab(Long id, Long employeeId) { // 鏌ヨ涓◣鐢虫姤璁板綍 - TaxDeclareRecordPO taxDeclareRecord = taxDeclareRecordService.getById(id, tenantKey); + TaxDeclareRecordPO taxDeclareRecord = taxDeclareRecordService.getById(id); // 鏌ヨ涓◣鐢虫姤璁板綍涓嬬殑涓◣鐢虫姤琛 - List taxDeclarations = taxDeclarationService.listByTaxCycleAndTaxAgentIds(YearMonth.parse(taxDeclareRecord.getTaxCycle()), - Collections.singleton(taxDeclareRecord.getTaxAgentId()), tenantKey); + List taxDeclarations = taxDeclarationService.listByTaxCycleAndTaxAgentIds(SalaryDateUtil.localDate2YearMonth(taxDeclareRecord.getTaxCycle()), + Collections.singleton(taxDeclareRecord.getTaxAgentId())); taxDeclarations = taxDeclarations.stream() .filter(e -> Objects.equals(e.getControlView(), 0) || Objects.equals(e.getCreator(), employeeId)) .collect(Collectors.toList()); @@ -332,12 +277,11 @@ public class TaxDeclareRecordWrapper extends Service { * 鏌ヨ涓◣鐢虫姤琛ㄧ殑鍩烘湰淇℃伅 * * @param id 涓◣鐢虫姤琛╥d - * @param tenantKey 绉熸埛key * @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)) { throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98877, "涓◣鐢虫姤琛ㄤ笉瀛樺湪鎴栧凡鍒犻櫎")); } @@ -346,58 +290,55 @@ public class TaxDeclareRecordWrapper extends Service { .setTaxAgentId(taxDeclareRecord.getTaxAgentId()) .setTaxCycle(taxDeclareRecord.getTaxCycle()); // 鏌ヨ鏄惁瀛樺湪鏈夋湭鎶ラ佺殑浜 - List notDeclareTaxDeclareEmployees = taxDeclareEmployeeService.list4NotDeclareByParam(queryParam, tenantKey); + List notDeclareTaxDeclareEmployees = taxDeclareEmployeeService.list4NotDeclareByParam(queryParam); // 鏌ヨ鏄惁瀛樺湪娌℃湁鐢虫姤鏁版嵁鐨勪汉 - List noValueTaxDeclareEmployees = taxDeclareEmployeeService.list4NoValueByParam(queryParam, tenantKey); + List noValueTaxDeclareEmployees = taxDeclareEmployeeService.list4NoValueByParam(queryParam); // 鏌ヨ鏄惁瀛樺湪鐢虫姤澶辫触鐨勪汉 - List taxDeclareFails = taxDeclareFailService.listByTaxDeclareRecordIds(Collections.singleton(taxDeclareRecord.getId()), tenantKey); + List taxDeclareFails = taxDeclareFailService.listByTaxDeclareRecordIds(Collections.singleton(taxDeclareRecord.getId())); // 鏌ヨ涓◣鎵g即涔夊姟浜 - TaxAgentPO taxAgentPO = taxAgentService.getById(taxDeclareRecord.getTaxAgentId(), tenantKey); + TaxAgentPO taxAgentPO = taxAgentService.getById(taxDeclareRecord.getTaxAgentId()); TaxDeclareTypeEnum taxDeclareTypeEnum = SalaryEnumUtil.enumMatchByValue(taxDeclareRecord.getTaxDeclareType(), TaxDeclareTypeEnum.class); TaxDeclareStatusEnum taxDeclareStatusEnum = SalaryEnumUtil.enumMatchByValue(taxDeclareRecord.getTaxDeclareStatus(), TaxDeclareStatusEnum.class); - return new TaxDeclarationInfoDTO() - .setSalaryMonth(taxDeclareRecord.getSalaryMonth()) - .setTaxCycle(taxDeclareRecord.getTaxCycle()) - .setTaxAgentId(taxDeclareRecord.getTaxAgentId()) - .setTaxAgentName(Optional.ofNullable(taxAgentPO).map(TaxAgentPO::getName).orElse("")) - .setDeclareType(taxDeclareTypeEnum) - .setDeclareTypeDesc(taxDeclareTypeEnum == null ? "" : SalaryI18nUtil.getI18nLabel(taxDeclareTypeEnum.getLabelId(), taxDeclareTypeEnum.getDefaultLabel())) - .setDeclareStatus(taxDeclareStatusEnum) - .setDeclareStatusDesc(taxDeclareStatusEnum == null ? "" : SalaryI18nUtil.getI18nLabel(taxDeclareStatusEnum.getLabelId(), taxDeclareStatusEnum.getDefaultLabel())) - .setDeclareErrorMsg(taxDeclareRecord.getTaxDeclareErrorMsg()) - .setDisplayIcon(Objects.equals(taxDeclareRecord.getDisplayUpdateIcon(), 1)) - .setDeclareFailSize(taxDeclareFails.size()) - .setAbnormalSize(notDeclareTaxDeclareEmployees.size() + noValueTaxDeclareEmployees.size()) - .setTaxPaidAmount(SalaryEntityUtil.thousandthConvert(taxDeclareRecord.getTaxPaidAmount())); + return TaxDeclarationInfoDTO.builder() + .salaryMonth(taxDeclareRecord.getSalaryMonth()) + .taxCycle(taxDeclareRecord.getTaxCycle()) + .taxAgentId(taxDeclareRecord.getTaxAgentId()) + .taxAgentName(Optional.ofNullable(taxAgentPO).map(TaxAgentPO::getName).orElse("")) + .declareType(taxDeclareTypeEnum) + .declareTypeDesc(taxDeclareTypeEnum == null ? "" : SalaryI18nUtil.getI18nLabel(taxDeclareTypeEnum.getLabelId(), taxDeclareTypeEnum.getDefaultLabel())) + .declareStatus(taxDeclareStatusEnum) + .declareStatusDesc(taxDeclareStatusEnum == null ? "" : SalaryI18nUtil.getI18nLabel(taxDeclareStatusEnum.getLabelId(), taxDeclareStatusEnum.getDefaultLabel())) + .declareErrorMsg(taxDeclareRecord.getTaxDeclareErrorMsg()) + .displayIcon(Objects.equals(taxDeclareRecord.getDisplayUpdateIcon(), 1)) + .declareFailSize(taxDeclareFails.size()) + .abnormalSize(notDeclareTaxDeclareEmployees.size() + noValueTaxDeclareEmployees.size()) + .taxPaidAmount(SalaryEntityUtil.thousandthConvert(taxDeclareRecord.getTaxPaidAmount())) + .build(); } /** * 淇濆瓨 * - * @param saveParam 淇濆瓨鍙傛暟 - * @param employeeId 浜哄憳id - * @param tenantKey 绉熸埛key + * @param saveParam 淇濆瓨鍙傛暟 */ - public String save(TaxDeclarationSaveParam saveParam, Long employeeId, String tenantKey) { + public String save(TaxDeclarationSaveParam saveParam) { TaxDeclarationRateDTO taxDeclarationRate = new TaxDeclarationRateDTO().setStatus(true) .setIndex(Util.null2String(IdGenerator.generate())) - .setMsg(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 95836, "鐢熸垚鐢虫姤琛")); - salaryCacheService.set(SalaryCacheKey.TAX_DECLARATION, taxDeclarationRate.getIndex(), taxDeclarationRate); + .setMsg(SalaryI18nUtil.getI18nLabel(95836, "鐢熸垚鐢虫姤琛")); + salaryCacheService.set(SalaryCacheKey.TAX_DECLARATION + taxDeclarationRate.getIndex(), taxDeclarationRate); LocalRunnable localRunnable = new LocalRunnable() { @Override public void execute() { try { - DSTenantKeyThreadVar.tenantKey.set(tenantKey); - taxDeclareRecordService.save(saveParam, employeeId, tenantKey); + taxDeclareRecordService.save(saveParam); taxDeclarationRate.setStatus(true).setFinish(true); } catch (SalaryRunTimeException e) { taxDeclarationRate.setStatus(false).setFinish(true).setMsg(e.getMessage()); } catch (Exception 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 { - 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 employeeId - * @param tenantKey */ - public void updateIcon(Long id, Long employeeId, String tenantKey) { - taxDeclareRecordService.updateIcon(id, NumberUtils.INTEGER_ZERO, employeeId, tenantKey); + public void updateIcon(Long id) { + taxDeclareRecordService.updateIcon(id, NumberUtils.INTEGER_ZERO); } /** * 鍒犻櫎涓◣鐢虫姤琛 * * @param ids - * @param employeeId - * @param tenantKey */ - public void delete(Collection ids, Long employeeId, String tenantKey) { - taxDeclareRecordService.deleteByIds(ids, tenantKey); + public void delete(Collection ids) { + taxDeclareRecordService.deleteByIds(ids); } /** * 鑾峰彇涓◣鐢虫姤琛ㄦ槸鍚﹀凡缁忕敓鎴 * * @param index - * @param tenantKey * @return */ - public TaxDeclarationRateDTO getRate(String index, String tenantKey) { - return salaryCacheService.get(SalaryCacheKey.TAX_DECLARATION, index, TaxDeclarationRateDTO.class); + public TaxDeclarationRateDTO getRate(String index) { + return salaryCacheService.get(SalaryCacheKey.TAX_DECLARATION + index); } /** * 鐢虫姤 * * @param id - * @param tenantKey */ - public String declare(Long id, Long employeeId, String tenantKey) { + public String declare(Long id) { checkBefore(id); TaxDeclarationRateDTO taxDeclarationRate = new TaxDeclarationRateDTO().setStatus(true).setIndex(Util.null2String(id)) - .setMsg(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 156454, "鍦ㄧ嚎鐢虫姤")); - salaryCacheService.set(SalaryCacheKey.TAX_DECLARATION, taxDeclarationRate.getIndex(), taxDeclarationRate); + .setMsg(SalaryI18nUtil.getI18nLabel(156454, "鍦ㄧ嚎鐢虫姤")); + salaryCacheService.set(SalaryCacheKey.TAX_DECLARATION + taxDeclarationRate.getIndex(), taxDeclarationRate); LocalRunnable localRunnable = new LocalRunnable() { @Override public void execute() { try { - DSTenantKeyThreadVar.tenantKey.set(tenantKey); - taxDeclareRecordService.declare(id, employeeId, tenantKey); + taxDeclareRecordService.declare(id); taxDeclarationRate.setFinish(true); - } catch (SalaryRunTimeException | SalaryNullException e) { + } catch (SalaryRunTimeException e) { taxDeclarationRate.setStatus(false).setFinish(true).setMsg(e.getMessage()); } catch (Exception 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 { - 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 tenantKey */ - public String getDeclareFeedback(Long id, Long employeeId, String tenantKey) { + public String getDeclareFeedback(Long id, Long employeeId) { checkBefore(id); TaxDeclarationRateDTO taxDeclarationRate = new TaxDeclarationRateDTO().setStatus(true).setIndex(Util.null2String(id)) - .setMsg(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 182680, "鑾峰彇鐢虫姤鍙嶉")); - salaryCacheService.set(SalaryCacheKey.TAX_DECLARATION, taxDeclarationRate.getIndex(), taxDeclarationRate); + .setMsg(SalaryI18nUtil.getI18nLabel(182680, "鑾峰彇鐢虫姤鍙嶉")); + salaryCacheService.set(SalaryCacheKey.TAX_DECLARATION + taxDeclarationRate.getIndex(), taxDeclarationRate); LocalRunnable localRunnable = new LocalRunnable() { @Override public void execute() { try { - taxDeclareRecordService.getDeclareFeedback(id, taxDeclarationRate, employeeId, tenantKey); + taxDeclareRecordService.getDeclareFeedback(id, taxDeclarationRate); taxDeclarationRate.setFinish(true); - } catch (SalaryRunTimeException | SalaryNullException e) { + } catch (SalaryRunTimeException e) { taxDeclarationRate.setStatus(false).setFinish(true).setMsg(e.getMessage()); } catch (Exception 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 { - 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 tenantKey */ - public String cancelDeclare(Long id, Long employeeId, String tenantKey) { + public String cancelDeclare(Long id, Long employeeId) { checkBefore(id); TaxDeclarationRateDTO taxDeclarationRate = new TaxDeclarationRateDTO().setStatus(true).setIndex(Util.null2String(id)) - .setMsg(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 158842, "浣滃簾鐢虫姤")); - salaryCacheService.set(SalaryCacheKey.TAX_DECLARATION, taxDeclarationRate.getIndex(), taxDeclarationRate); + .setMsg(SalaryI18nUtil.getI18nLabel(158842, "浣滃簾鐢虫姤")); + salaryCacheService.set(SalaryCacheKey.TAX_DECLARATION + taxDeclarationRate.getIndex(), taxDeclarationRate); LocalRunnable localRunnable = new LocalRunnable() { @Override public void execute() { try { - taxDeclareRecordService.cancelDeclare(id, employeeId, tenantKey); + taxDeclareRecordService.cancelDeclare(id); taxDeclarationRate.setFinish(true); - } catch (SalaryRunTimeException | SalaryNullException e) { + } catch (SalaryRunTimeException e) { taxDeclarationRate.setStatus(false).setFinish(true).setMsg(e.getMessage()); } catch (Exception 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 { - 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 tenantKey */ - public String getCancelFeedback(Long id, Long employeeId, String tenantKey) { + public String getCancelFeedback(Long id, Long employeeId) { checkBefore(id); TaxDeclarationRateDTO taxDeclarationRate = new TaxDeclarationRateDTO().setStatus(true).setIndex(Util.null2String(id)) - .setMsg(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 182681, "鑾峰彇浣滃簾鐢虫姤鍙嶉")); - salaryCacheService.set(SalaryCacheKey.TAX_DECLARATION, taxDeclarationRate.getIndex(), taxDeclarationRate); + .setMsg(SalaryI18nUtil.getI18nLabel(182681, "鑾峰彇浣滃簾鐢虫姤鍙嶉")); + salaryCacheService.set(SalaryCacheKey.TAX_DECLARATION + taxDeclarationRate.getIndex(), taxDeclarationRate); LocalRunnable localRunnable = new LocalRunnable() { @Override public void execute() { try { - taxDeclareRecordService.getCancelFeedback(id, taxDeclarationRate, employeeId, tenantKey); + taxDeclareRecordService.getCancelFeedback(id, taxDeclarationRate); taxDeclarationRate.setFinish(true); - } catch (SalaryRunTimeException | SalaryNullException e) { + } catch (SalaryRunTimeException e) { taxDeclarationRate.setStatus(false).setFinish(true).setMsg(e.getMessage()); } catch (Exception 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 { - 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 employeeId - * @param tenantKey * @return */ - public String updateDeclare(Long id, Long employeeId, String tenantKey) { + public String updateDeclare(Long id, Long employeeId) { checkBefore(id); TaxDeclarationRateDTO taxDeclarationRate = new TaxDeclarationRateDTO().setStatus(true).setIndex(Util.null2String(id)) - .setMsg(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 177637, "鏇存鐢虫姤")); - salaryCacheService.set(SalaryCacheKey.TAX_DECLARATION, taxDeclarationRate.getIndex(), taxDeclarationRate); + .setMsg(SalaryI18nUtil.getI18nLabel(177637, "鏇存鐢虫姤")); + salaryCacheService.set(SalaryCacheKey.TAX_DECLARATION + taxDeclarationRate.getIndex(), taxDeclarationRate); LocalRunnable localRunnable = new LocalRunnable() { @Override public void execute() { try { - taxDeclareRecordService.updateDeclare(id, employeeId, tenantKey); + taxDeclareRecordService.updateDeclare(id); taxDeclarationRate.setFinish(true); - } catch (SalaryRunTimeException | SalaryNullException e) { + } catch (SalaryRunTimeException e) { taxDeclarationRate.setStatus(false).setFinish(true).setMsg(e.getMessage()); } catch (Exception 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 { - 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 employeeId - * @param tenantKey * @return */ - public String queryDeclareStatus(Long id, Long employeeId, String tenantKey) { - return taxDeclareRecordService.queryDeclareStatus(id, employeeId, tenantKey); + public String queryDeclareStatus(Long id) { + return taxDeclareRecordService.queryDeclareStatus(id); } /** * 绋庡眬绔敵鎶ユ槑缁嗘煡璇 * * @param id - * @param employeeId - * @param tenantKey * @return */ - public String queryCompanyIncomes(Long id, Long employeeId, String tenantKey) { - return taxDeclareRecordService.queryCompanyIncomes(id, employeeId, tenantKey); + public String queryCompanyIncomes(Long id) { + return taxDeclareRecordService.queryCompanyIncomes(id); } /** * 鍒锋柊鏁版嵁 * * @param id - * @param employeeId - * @param tenantKey * @return */ - public String refreshData(Long id, Long employeeId, String tenantKey) { + public String refreshData(Long id) { checkBefore(id); TaxDeclarationRateDTO taxDeclarationRate = new TaxDeclarationRateDTO().setStatus(true).setIndex(Util.null2String(id)) - .setMsg(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 156447, "鍒锋柊鏁版嵁")); - salaryCacheService.set(SalaryCacheKey.TAX_DECLARATION, taxDeclarationRate.getIndex(), taxDeclarationRate); + .setMsg(SalaryI18nUtil.getI18nLabel(156447, "鍒锋柊鏁版嵁")); + salaryCacheService.set(SalaryCacheKey.TAX_DECLARATION + taxDeclarationRate.getIndex(), taxDeclarationRate); LocalRunnable localRunnable = new LocalRunnable() { @Override public void execute() { try { - DSTenantKeyThreadVar.tenantKey.set(tenantKey); - taxDeclareRecordService.refreshData(id, employeeId, tenantKey); + taxDeclareRecordService.refreshData(id); taxDeclarationRate.setFinish(true); - } catch (SalaryRunTimeException | SalaryNullException e) { + } catch (SalaryRunTimeException e) { taxDeclarationRate.setStatus(false).setFinish(true).setMsg(e.getMessage()); } catch (Exception 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 { - 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) { - 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()) { throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(182691, "褰撳墠姝e浜庛寋0}銆嶄腑锛岃绋嶅悗鍐嶈瘯").replace("{0}", taxDeclarationRate.getMsg())); } } - /** - * 瀵煎嚭涓◣鐢虫姤鏄庣粏鍒楄〃 - * - * @param queryParam - * @param simpleEmployee - * @return - */ - public Map exportTaxDeclarationValue(TaxDeclarationValueListQueryParam queryParam, SimpleEmployee simpleEmployee) { - ExcelExportParam excelExportParam = new ExcelExportParam() - .setBiz(String.valueOf(IdGenerator.generate())) - .setModule(EntityType.hrmsalary.name()) - .setFunction("exportTaxDeclarationValue"); - LocalRunnable localRunnable = new LocalRunnable() { - @Override - public void execute() { - taxDeclarationExcelService.exportTaxDeclarationValue(excelExportParam, queryParam, simpleEmployee); - } - }; - ThreadPoolUtil.fixedPoolExecute(ModulePoolEnum.OTHER, "exportTaxDeclarationValue", localRunnable); - return JsonUtil.parseMap(excelExportParam, Object.class); - } - - /** - * 瀵煎嚭鏈姤閫佺殑浜哄憳鍒楄〃 - * - * @param queryParam - * @param simpleEmployee - * @return - */ - public Map exportEmployee4NotDeclare(AbnormalEmployeeListQueryParam queryParam, SimpleEmployee simpleEmployee) { - ExcelExportParam excelExportParam = new ExcelExportParam() - .setBiz(String.valueOf(IdGenerator.generate())) - .setModule(EntityType.hrmsalary.name()) - .setFunction("exportEmployee4NotDeclare"); - LocalRunnable localRunnable = new LocalRunnable() { - @Override - public void execute() { - taxDeclarationExcelService.exportEmployee4NotDeclare(excelExportParam, queryParam, simpleEmployee); - } - }; - ThreadPoolUtil.fixedPoolExecute(ModulePoolEnum.OTHER, "exportEmployee4NotDeclare", localRunnable); - return JsonUtil.parseMap(excelExportParam, Object.class); - } - - /** - * 瀵煎嚭娌℃湁鐢虫姤鏁版嵁鐨勪汉鍛樺垪琛 - * - * @param queryParam - * @param simpleEmployee - * @return - */ - public Map exportEmployee4NoValue(AbnormalEmployeeListQueryParam queryParam, SimpleEmployee simpleEmployee) { - ExcelExportParam excelExportParam = new ExcelExportParam() - .setBiz(String.valueOf(IdGenerator.generate())) - .setModule(EntityType.hrmsalary.name()) - .setFunction("exportEmployee4NoValue"); - LocalRunnable localRunnable = new LocalRunnable() { - @Override - public void execute() { - taxDeclarationExcelService.exportEmployee4NoValue(excelExportParam, queryParam, simpleEmployee); - } - }; - ThreadPoolUtil.fixedPoolExecute(ModulePoolEnum.OTHER, "exportEmployee4NoValue", localRunnable); - return JsonUtil.parseMap(excelExportParam, Object.class); - } - - /** - * 瀵煎嚭鐢虫姤澶辫触鐨勪汉鍛樺垪琛 - * - * @param queryParam - * @param simpleEmployee - * @return - */ - public Map exportEmployee4Fail(AbnormalEmployeeListQueryParam queryParam, SimpleEmployee simpleEmployee) { - ExcelExportParam excelExportParam = new ExcelExportParam() - .setBiz(String.valueOf(IdGenerator.generate())) - .setModule(EntityType.hrmsalary.name()) - .setFunction("exportEmployee4Fail"); - LocalRunnable localRunnable = new LocalRunnable() { - @Override - public void execute() { - taxDeclarationExcelService.exportEmployee4Fail(excelExportParam, queryParam, simpleEmployee); - } - }; - ThreadPoolUtil.fixedPoolExecute(ModulePoolEnum.OTHER, "exportEmployee4Fail", localRunnable); - return JsonUtil.parseMap(excelExportParam, Object.class); - } +// /** +// * 瀵煎嚭涓◣鐢虫姤鏄庣粏鍒楄〃 +// * +// * @param queryParam +// * @return +// */ +// public Map exportTaxDeclarationValue(TaxDeclarationValueListQueryParam queryParam) { +// ExcelExportParam excelExportParam = new ExcelExportParam() +// .setBiz(String.valueOf(IdGenerator.generate())) +// .setModule(EntityType.hrmsalary.name()) +// .setFunction("exportTaxDeclarationValue"); +// LocalRunnable localRunnable = new LocalRunnable() { +// @Override +// public void execute() { +// taxDeclarationExcelService.exportTaxDeclarationValue(excelExportParam, queryParam, simpleEmployee); +// } +// }; +// ThreadPoolUtil.fixedPoolExecute(ModulePoolEnum.OTHER, "exportTaxDeclarationValue", localRunnable); +// return JsonUtil.parseMap(excelExportParam, Object.class); +// } +// +// /** +// * 瀵煎嚭鏈姤閫佺殑浜哄憳鍒楄〃 +// * +// * @param queryParam +// * @param simpleEmployee +// * @return +// */ +// public Map exportEmployee4NotDeclare(AbnormalEmployeeListQueryParam queryParam) { +// ExcelExportParam excelExportParam = new ExcelExportParam() +// .setBiz(String.valueOf(IdGenerator.generate())) +// .setModule(EntityType.hrmsalary.name()) +// .setFunction("exportEmployee4NotDeclare"); +// LocalRunnable localRunnable = new LocalRunnable() { +// @Override +// public void execute() { +// taxDeclarationExcelService.exportEmployee4NotDeclare(excelExportParam, queryParam, simpleEmployee); +// } +// }; +// ThreadPoolUtil.fixedPoolExecute(ModulePoolEnum.OTHER, "exportEmployee4NotDeclare", localRunnable); +// return JsonUtil.parseMap(excelExportParam, Object.class); +// } +// +// /** +// * 瀵煎嚭娌℃湁鐢虫姤鏁版嵁鐨勪汉鍛樺垪琛 +// * +// * @param queryParam +// * @param simpleEmployee +// * @return +// */ +// public Map exportEmployee4NoValue(AbnormalEmployeeListQueryParam queryParam, SimpleEmployee simpleEmployee) { +// ExcelExportParam excelExportParam = new ExcelExportParam() +// .setBiz(String.valueOf(IdGenerator.generate())) +// .setModule(EntityType.hrmsalary.name()) +// .setFunction("exportEmployee4NoValue"); +// LocalRunnable localRunnable = new LocalRunnable() { +// @Override +// public void execute() { +// taxDeclarationExcelService.exportEmployee4NoValue(excelExportParam, queryParam, simpleEmployee); +// } +// }; +// ThreadPoolUtil.fixedPoolExecute(ModulePoolEnum.OTHER, "exportEmployee4NoValue", localRunnable); +// return JsonUtil.parseMap(excelExportParam, Object.class); +// } +// +// /** +// * 瀵煎嚭鐢虫姤澶辫触鐨勪汉鍛樺垪琛 +// * +// * @param queryParam +// * @param simpleEmployee +// * @return +// */ +// public Map exportEmployee4Fail(AbnormalEmployeeListQueryParam queryParam, SimpleEmployee simpleEmployee) { +// ExcelExportParam excelExportParam = new ExcelExportParam() +// .setBiz(String.valueOf(IdGenerator.generate())) +// .setModule(EntityType.hrmsalary.name()) +// .setFunction("exportEmployee4Fail"); +// LocalRunnable localRunnable = new LocalRunnable() { +// @Override +// public void execute() { +// taxDeclarationExcelService.exportEmployee4Fail(excelExportParam, queryParam, simpleEmployee); +// } +// }; +// ThreadPoolUtil.fixedPoolExecute(ModulePoolEnum.OTHER, "exportEmployee4Fail", localRunnable); +// return JsonUtil.parseMap(excelExportParam, Object.class); +// } }