From fa4d605c8d459524d041a733cc2579b7180e4653 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=92=B1=E6=B6=9B?= <15850646081@163.com> Date: Wed, 18 May 2022 09:19:50 +0800 Subject: [PATCH 01/20] =?UTF-8?q?=E6=9A=82=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- resource/sql/分权.sql | 89 +++ .../constant/TaxAgentPermissionConstant.java | 24 + .../salary/entity/taxagent/bo/TaxAgentBO.java | 437 +++++++++++ ...AdjustRecordForFormSearchConditionDTO.java | 99 +++ .../dto/TaxAgentAdjustRecordListDTO.java | 136 ++++ ...axAgentAdjustRecordSearchConditionDTO.java | 139 ++++ .../taxagent/dto/TaxAgentBaseFormDTO.java | 34 + .../taxagent/dto/TaxAgentEmployeeDTO.java | 41 + .../dto/TaxAgentEmployeeOptionDTO.java | 24 + .../dto/TaxAgentEmployeeTaxAgentDTO.java | 32 + .../entity/taxagent/dto/TaxAgentFormDTO.java | 53 ++ .../entity/taxagent/dto/TaxAgentListDTO.java | 52 ++ .../dto/TaxAgentManageRangeEmployeeDTO.java | 47 ++ .../dto/TaxAgentManageRangeFormDTO.java | 55 ++ .../dto/TaxAgentManageRangeListDTO.java | 58 ++ .../dto/TaxAgentSubAdminBaseFormDTO.java | 45 ++ .../taxagent/dto/TaxAgentSubAdminListDTO.java | 60 ++ .../param/TaxAgentAdjustRecordQueryParam.java | 65 ++ .../param/TaxAgentAdminChangeCheckParam.java | 27 + .../taxagent/param/TaxAgentEmpSaveParam.java | 30 + .../TaxAgentManageRangeEmpQueryParam.java | 30 + .../param/TaxAgentManageRangeQueryParam.java | 23 + .../param/TaxAgentManageRangeSaveParam.java | 57 ++ .../taxagent/param/TaxAgentQueryParam.java | 29 + .../param/TaxAgentRangeQueryParam.java | 25 + .../param/TaxAgentRangeSaveParam.java | 22 + .../taxagent/param/TaxAgentSaveBaseParam.java | 22 + .../taxagent/param/TaxAgentSaveParam.java | 46 ++ .../param/TaxAgentSubAdminBaseFormParam.java | 27 + .../param/TaxAgentSubAdminBaseSaveParam.java | 33 + .../param/TaxAgentSubAdminEmpSaveParam.java | 33 + .../param/TaxAgentSubAdminQueryParam.java | 25 + .../TaxAgentSubAdminRangeQueryParam.java | 24 + .../param/TaxAgentSubAdminRangeSaveParam.java | 22 + .../entity/taxagent/po/TaxAgentAdminPO.java | 67 ++ .../entity/taxagent/po/TaxAgentBasePO.java | 56 ++ .../taxagent/po/TaxAgentEmpChangePO.java | 82 ++ .../entity/taxagent/po/TaxAgentEmpPO.java | 69 ++ .../taxagent/po/TaxAgentEmployeePO.java | 33 + .../taxagent/po/TaxAgentManageRangePO.java | 94 +++ .../salary/entity/taxagent/po/TaxAgentPO.java | 67 ++ .../taxagent/po/TaxAgentSubAdminEmpPO.java | 71 ++ .../taxagent/po/TaxAgentSubAdminPO.java | 67 ++ .../salary/enums/SalaryJobFlagEnum.java | 31 + .../enums/salarysob/TargetTypeEnum.java | 5 +- .../taxagent/TaxAgentEmpChangeModuleEnum.java | 32 + .../taxagent/TaxAgentEmpChangeTypeEnum.java | 29 + .../enums/taxagent/TaxAgentRangeTypeEnum.java | 46 ++ .../enums/taxagent/TaxAgentRoleTypeEnum.java | 31 + .../mapper/datacollection/EmployMapper.java | 2 + .../mapper/datacollection/EmployMapper.xml | 21 + .../mapper/taxagent/TaxAgentAdminMapper.java | 67 ++ .../mapper/taxagent/TaxAgentAdminMapper.xml | 209 +++++ .../mapper/taxagent/TaxAgentBaseMapper.java | 68 ++ .../mapper/taxagent/TaxAgentBaseMapper.xml | 180 +++++ .../taxagent/TaxAgentEmpChangeMapper.java | 77 ++ .../taxagent/TaxAgentEmpChangeMapper.xml | 344 +++++++++ .../mapper/taxagent/TaxAgentEmpMapper.java | 78 ++ .../mapper/taxagent/TaxAgentEmpMapper.xml | 297 +++++++ .../taxagent/TaxAgentManageRangeMapper.java | 67 ++ .../taxagent/TaxAgentManageRangeMapper.xml | 285 +++++++ .../service/SalaryAcctRecordService.java | 8 + .../salary/service/TaxAgentAdminService.java | 57 ++ .../salary/service/TaxAgentBaseService.java | 37 + .../service/TaxAgentEmpChangeService.java | 39 + .../salary/service/TaxAgentEmpService.java | 43 ++ .../service/TaxAgentManageRangeService.java | 118 +++ .../salary/service/TaxAgentService.java | 233 +++++- .../AttendQuoteFieldSettingServiceImpl.java | 4 +- .../impl/SalaryAcctRecordServiceImpl.java | 5 + .../service/impl/SalarySendServiceImpl.java | 4 +- .../impl/TaxAgentAdminServiceImpl.java | 78 ++ .../service/impl/TaxAgentBaseServiceImpl.java | 103 +++ .../impl/TaxAgentEmpChangeServiceImpl.java | 50 ++ .../service/impl/TaxAgentEmpServiceImpl.java | 148 ++++ .../impl/TaxAgentManageRangeServiceImpl.java | 724 ++++++++++++++++++ .../service/impl/TaxAgentServiceImpl.java | 646 +++++++++++++++- src/com/engine/salary/util/aes/AESUtils.java | 198 +++++ .../engine/salary/web/TaxAgentController.java | 25 + .../wrapper/SalaryArchiveTaxAgentWrapper.java | 2 +- .../salary/wrapper/SalarySendWrapper.java | 2 +- .../salary/wrapper/TaxAgentWrapper.java | 418 ++++++++++ src/demo.java | 71 ++ 83 files changed, 7440 insertions(+), 13 deletions(-) create mode 100644 resource/sql/分权.sql create mode 100644 src/com/engine/salary/constant/TaxAgentPermissionConstant.java create mode 100644 src/com/engine/salary/entity/taxagent/bo/TaxAgentBO.java create mode 100644 src/com/engine/salary/entity/taxagent/dto/TaxAgentAdjustRecordForFormSearchConditionDTO.java create mode 100644 src/com/engine/salary/entity/taxagent/dto/TaxAgentAdjustRecordListDTO.java create mode 100644 src/com/engine/salary/entity/taxagent/dto/TaxAgentAdjustRecordSearchConditionDTO.java create mode 100644 src/com/engine/salary/entity/taxagent/dto/TaxAgentBaseFormDTO.java create mode 100644 src/com/engine/salary/entity/taxagent/dto/TaxAgentEmployeeDTO.java create mode 100644 src/com/engine/salary/entity/taxagent/dto/TaxAgentEmployeeOptionDTO.java create mode 100644 src/com/engine/salary/entity/taxagent/dto/TaxAgentEmployeeTaxAgentDTO.java create mode 100644 src/com/engine/salary/entity/taxagent/dto/TaxAgentFormDTO.java create mode 100644 src/com/engine/salary/entity/taxagent/dto/TaxAgentListDTO.java create mode 100644 src/com/engine/salary/entity/taxagent/dto/TaxAgentManageRangeEmployeeDTO.java create mode 100644 src/com/engine/salary/entity/taxagent/dto/TaxAgentManageRangeFormDTO.java create mode 100644 src/com/engine/salary/entity/taxagent/dto/TaxAgentManageRangeListDTO.java create mode 100644 src/com/engine/salary/entity/taxagent/dto/TaxAgentSubAdminBaseFormDTO.java create mode 100644 src/com/engine/salary/entity/taxagent/dto/TaxAgentSubAdminListDTO.java create mode 100644 src/com/engine/salary/entity/taxagent/param/TaxAgentAdjustRecordQueryParam.java create mode 100644 src/com/engine/salary/entity/taxagent/param/TaxAgentAdminChangeCheckParam.java create mode 100644 src/com/engine/salary/entity/taxagent/param/TaxAgentEmpSaveParam.java create mode 100644 src/com/engine/salary/entity/taxagent/param/TaxAgentManageRangeEmpQueryParam.java create mode 100644 src/com/engine/salary/entity/taxagent/param/TaxAgentManageRangeQueryParam.java create mode 100644 src/com/engine/salary/entity/taxagent/param/TaxAgentManageRangeSaveParam.java create mode 100644 src/com/engine/salary/entity/taxagent/param/TaxAgentQueryParam.java create mode 100644 src/com/engine/salary/entity/taxagent/param/TaxAgentRangeQueryParam.java create mode 100644 src/com/engine/salary/entity/taxagent/param/TaxAgentRangeSaveParam.java create mode 100644 src/com/engine/salary/entity/taxagent/param/TaxAgentSaveBaseParam.java create mode 100644 src/com/engine/salary/entity/taxagent/param/TaxAgentSaveParam.java create mode 100644 src/com/engine/salary/entity/taxagent/param/TaxAgentSubAdminBaseFormParam.java create mode 100644 src/com/engine/salary/entity/taxagent/param/TaxAgentSubAdminBaseSaveParam.java create mode 100644 src/com/engine/salary/entity/taxagent/param/TaxAgentSubAdminEmpSaveParam.java create mode 100644 src/com/engine/salary/entity/taxagent/param/TaxAgentSubAdminQueryParam.java create mode 100644 src/com/engine/salary/entity/taxagent/param/TaxAgentSubAdminRangeQueryParam.java create mode 100644 src/com/engine/salary/entity/taxagent/param/TaxAgentSubAdminRangeSaveParam.java create mode 100644 src/com/engine/salary/entity/taxagent/po/TaxAgentAdminPO.java create mode 100644 src/com/engine/salary/entity/taxagent/po/TaxAgentBasePO.java create mode 100644 src/com/engine/salary/entity/taxagent/po/TaxAgentEmpChangePO.java create mode 100644 src/com/engine/salary/entity/taxagent/po/TaxAgentEmpPO.java create mode 100644 src/com/engine/salary/entity/taxagent/po/TaxAgentEmployeePO.java create mode 100644 src/com/engine/salary/entity/taxagent/po/TaxAgentManageRangePO.java create mode 100644 src/com/engine/salary/entity/taxagent/po/TaxAgentPO.java create mode 100644 src/com/engine/salary/entity/taxagent/po/TaxAgentSubAdminEmpPO.java create mode 100644 src/com/engine/salary/entity/taxagent/po/TaxAgentSubAdminPO.java create mode 100644 src/com/engine/salary/enums/SalaryJobFlagEnum.java create mode 100644 src/com/engine/salary/enums/taxagent/TaxAgentEmpChangeModuleEnum.java create mode 100644 src/com/engine/salary/enums/taxagent/TaxAgentEmpChangeTypeEnum.java create mode 100644 src/com/engine/salary/enums/taxagent/TaxAgentRangeTypeEnum.java create mode 100644 src/com/engine/salary/enums/taxagent/TaxAgentRoleTypeEnum.java create mode 100644 src/com/engine/salary/mapper/taxagent/TaxAgentAdminMapper.java create mode 100644 src/com/engine/salary/mapper/taxagent/TaxAgentAdminMapper.xml create mode 100644 src/com/engine/salary/mapper/taxagent/TaxAgentBaseMapper.java create mode 100644 src/com/engine/salary/mapper/taxagent/TaxAgentBaseMapper.xml create mode 100644 src/com/engine/salary/mapper/taxagent/TaxAgentEmpChangeMapper.java create mode 100644 src/com/engine/salary/mapper/taxagent/TaxAgentEmpChangeMapper.xml create mode 100644 src/com/engine/salary/mapper/taxagent/TaxAgentEmpMapper.java create mode 100644 src/com/engine/salary/mapper/taxagent/TaxAgentEmpMapper.xml create mode 100644 src/com/engine/salary/mapper/taxagent/TaxAgentManageRangeMapper.java create mode 100644 src/com/engine/salary/mapper/taxagent/TaxAgentManageRangeMapper.xml create mode 100644 src/com/engine/salary/service/TaxAgentAdminService.java create mode 100644 src/com/engine/salary/service/TaxAgentBaseService.java create mode 100644 src/com/engine/salary/service/TaxAgentEmpChangeService.java create mode 100644 src/com/engine/salary/service/TaxAgentEmpService.java create mode 100644 src/com/engine/salary/service/TaxAgentManageRangeService.java create mode 100644 src/com/engine/salary/service/impl/TaxAgentAdminServiceImpl.java create mode 100644 src/com/engine/salary/service/impl/TaxAgentBaseServiceImpl.java create mode 100644 src/com/engine/salary/service/impl/TaxAgentEmpChangeServiceImpl.java create mode 100644 src/com/engine/salary/service/impl/TaxAgentEmpServiceImpl.java create mode 100644 src/com/engine/salary/service/impl/TaxAgentManageRangeServiceImpl.java create mode 100644 src/com/engine/salary/util/aes/AESUtils.java create mode 100644 src/com/engine/salary/wrapper/TaxAgentWrapper.java create mode 100644 src/demo.java diff --git a/resource/sql/分权.sql b/resource/sql/分权.sql new file mode 100644 index 000000000..308137347 --- /dev/null +++ b/resource/sql/分权.sql @@ -0,0 +1,89 @@ +DROP TABLE IF EXISTS hrsa_tax_agent_emp; +CREATE TABLE hrsa_tax_agent_emp +( + id bigint(20) NOT NULL COMMENT 'ID', + create_time datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + update_time datetime(0) NULL DEFAULT NULL COMMENT '修改时间', + creator bigint(20) NULL DEFAULT NULL COMMENT '创建人id', + delete_type int(11) NULL DEFAULT 0, + tenant_key varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '租户KEY', + tax_agent_id bigint(20) NULL DEFAULT NULL COMMENT '个税扣缴义务人的主键id', + employee_id bigint(20) NULL DEFAULT NULL COMMENT '人员信息表的主键id', + employee_name varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, + PRIMARY KEY (id) USING BTREE, + INDEX idx_tenant_key(tenant_key) USING BTREE, + INDEX idx_tax_agent(tax_agent_id) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; + +DROP TABLE IF EXISTS hrsa_tax_agent_emp_change; +CREATE TABLE hrsa_tax_agent_emp_change +( + id bigint(20) NOT NULL COMMENT 'ID', + create_time datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + update_time datetime(0) NULL DEFAULT NULL COMMENT '修改时间', + creator bigint(20) NULL DEFAULT NULL COMMENT '创建人id', + delete_type int(11) NULL DEFAULT 0 COMMENT '是否删除', + tenant_key varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '租户KEY', + tax_agent_id bigint(20) NOT NULL COMMENT '个税扣缴义务人的主键id', + employee_id bigint(20) NOT NULL COMMENT '人员信息表的主键id', + change_type int(11) NOT NULL DEFAULT 0 COMMENT '增量类型。1:新增、2:删除', + employee_name varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, + module_type int(4) NOT NULL DEFAULT 0, + PRIMARY KEY (id) USING BTREE, + INDEX idx_tenant_key(tenant_key) USING BTREE, + INDEX idx_tax_agent(tax_agent_id) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; + + +DROP TABLE IF EXISTS hrsa_tax_agent_admin; +CREATE TABLE hrsa_tax_agent_admin +( + id bigint(20) NOT NULL COMMENT '主键', + tax_agent_id bigint(20) NOT NULL COMMENT '个税扣缴义务人的主键id', + employee_id bigint(20) NOT NULL COMMENT '人员信息表的主键id', + create_time datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP (0) COMMENT '创建时间', + update_time datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP (0) ON UPDATE CURRENT_TIMESTAMP (0) COMMENT '更新时间', + creator bigint(20) NOT NULL DEFAULT 0 COMMENT '创建人', + delete_type int(11) NOT NULL DEFAULT 0 COMMENT '是否已删除。0:未删除、1:已删除', + tenant_key varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '租户ID', + PRIMARY KEY (id) USING BTREE, + INDEX idx_tenant_key(tenant_key) USING BTREE, + INDEX idx_employee_id(employee_id) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '个税扣缴义务人管理员表' ROW_FORMAT = Dynamic; + +DROP TABLE IF EXISTS hrsa_tax_agent_manage_range; +CREATE TABLE hrsa_tax_agent_manage_range +( + id bigint(20) NOT NULL COMMENT '主键id', + tax_agent_id bigint(20) NOT NULL DEFAULT 0 COMMENT '个税扣缴义务人的id', + employee_id bigint(20) NOT NULL DEFAULT 0 COMMENT '人员表的主键id', + tax_agent_sub_admin_id bigint(20) NOT NULL DEFAULT 0 COMMENT '个税扣缴义务人的分管理员的id', + target_type tinyint(4) NOT NULL DEFAULT 1 COMMENT '对象类型。1:人员、2:部门、3:岗位', + target_id bigint(20) NOT NULL DEFAULT 0 COMMENT '对象id', + employee_status varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + include_type int(4) NOT NULL DEFAULT 1, + creator bigint(20) NOT NULL DEFAULT 0 COMMENT '创建人', + create_time datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP (0) COMMENT '创建时间', + update_time datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP (0) ON UPDATE CURRENT_TIMESTAMP (0) COMMENT '更新时间', + delete_type int(11) NOT NULL DEFAULT 0 COMMENT '是否已删除。0:未删除、1:已删除', + tenant_key varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '租户ID', + range_type int(4) NOT NULL DEFAULT 0, + PRIMARY KEY (id) USING BTREE, + INDEX idx_tenant(tenant_key) USING BTREE, + INDEX idx_tax_agent_sub_admin_id(tax_agent_sub_admin_id) USING BTREE, + INDEX idx_tenant_key(tenant_key) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '个税扣缴义务人的管理范围表' ROW_FORMAT = Dynamic; + +DROP TABLE IF EXISTS hrsa_tax_agent_base; +CREATE TABLE hrsa_tax_agent_base +( + id bigint(20) NOT NULL COMMENT '主键', + devolution_status int(11) NOT NULL DEFAULT 0 COMMENT '分权开启状态。0:关、1:开', + create_time datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP (0) COMMENT '创建时间', + update_time datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP (0) ON UPDATE CURRENT_TIMESTAMP (0) COMMENT '更新时间', + creator bigint(20) NOT NULL DEFAULT 0 COMMENT '创建人', + delete_type int(11) NOT NULL DEFAULT 0 COMMENT '是否已删除。0:未删除、1:已删除', + tenant_key varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '租户ID', + PRIMARY KEY (id) USING BTREE, + INDEX idx_tenant_key(tenant_key) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '个税扣缴义务人基础信息表' ROW_FORMAT = Dynamic; diff --git a/src/com/engine/salary/constant/TaxAgentPermissionConstant.java b/src/com/engine/salary/constant/TaxAgentPermissionConstant.java new file mode 100644 index 000000000..85f16ec74 --- /dev/null +++ b/src/com/engine/salary/constant/TaxAgentPermissionConstant.java @@ -0,0 +1,24 @@ +package com.engine.salary.constant; + +/** + * @Description: 个税扣缴义务人分权 + * @Author: wangxiangzhong + * @Date: 2022/5/2 10:09 + */ +public class TaxAgentPermissionConstant { + + /** + * 菜单编码 + */ + public static final String MENU_CODE = "TaxAgent"; + + /** + * 权限编码-默认权限项 + */ + public static final String ITEM_CODE_DEFAULT = "TaxAgent.default"; + + /** + * 权限编码-分权开关 + */ + public static final String ITEM_CODE_DEVOLUTION = "TaxAgent.devolution"; +} diff --git a/src/com/engine/salary/entity/taxagent/bo/TaxAgentBO.java b/src/com/engine/salary/entity/taxagent/bo/TaxAgentBO.java new file mode 100644 index 000000000..83d8d59a7 --- /dev/null +++ b/src/com/engine/salary/entity/taxagent/bo/TaxAgentBO.java @@ -0,0 +1,437 @@ +package com.engine.salary.entity.taxagent.bo; + +import com.engine.salary.constant.SalaryDefaultTenantConstant; +import com.engine.salary.entity.datacollection.DataCollectionEmployee; +import com.engine.salary.entity.taxagent.dto.TaxAgentEmployeeDTO; +import com.engine.salary.entity.taxagent.dto.TaxAgentManageRangeListDTO; +import com.engine.salary.entity.taxagent.dto.TaxAgentSubAdminListDTO; +import com.engine.salary.entity.taxagent.param.TaxAgentManageRangeSaveParam; +import com.engine.salary.entity.taxagent.param.TaxAgentSaveParam; +import com.engine.salary.entity.taxagent.param.TaxAgentSubAdminRangeSaveParam; +import com.engine.salary.entity.taxagent.po.TaxAgentManageRangePO; +import com.engine.salary.entity.taxagent.po.TaxAgentPO; +import com.engine.salary.entity.taxagent.po.TaxAgentSubAdminPO; +import com.engine.salary.enums.salarysob.TargetTypeEnum; +import com.engine.salary.enums.taxagent.TaxAgentRangeTypeEnum; +import com.engine.salary.util.JsonUtil; +import com.engine.salary.util.SalaryEntityUtil; +import com.engine.salary.util.SalaryI18nUtil; +import com.google.common.base.Joiner; +import com.google.common.collect.Lists; +import com.weaver.common.component.table.WeaTable; +import com.weaver.common.component.table.column.WeaTableColumn; +import com.weaver.common.component.table.operate.WeaTableOperate; +import com.weaver.common.component.table.permission.Permission; +import com.weaver.common.distribution.genid.IdGenerator; +import com.weaver.common.hrm.cache.HrmDepartmentComInfo; +import com.weaver.common.hrm.cache.HrmEmployeeComInfo; +import com.weaver.common.hrm.cache.HrmPositionComInfo; +import com.weaver.common.hrm.domain.employee.HrmStatus; +import com.weaver.hrm.salary.entity.agency.po.PaymentAgencyPO; +import com.weaver.hrm.salary.entity.taxagent.dto.TaxAgentListDTO; +import com.weaver.hrm.salary.entity.taxagent.po.TaxAgentAdminPO; +import com.weaver.teams.domain.user.SimpleEmployee; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang3.StringUtils; + +import java.time.LocalDateTime; +import java.util.*; +import java.util.stream.Collectors; + +/** + * @Description: 个税扣缴义务人 + * @Author: wangxiangzhong + * @Date: 2021/10/29 18:04 + */ +public class TaxAgentBO { + + @Override + public String toString() { + return "TaxAgentBO{}"; + } + + /** + * 根据个税扣缴义务人id和用户id判断是否匹配 + * + * @param taxAgentEmployees + * @param taxAgentId + * @param employeeId + * @return + */ + public static boolean checkTaxAgentAndEmployee(List taxAgentEmployees, Long taxAgentId, Long employeeId) { + if (CollectionUtils.isEmpty(taxAgentEmployees) && taxAgentId == null) { + return false; + } + return taxAgentEmployees.stream().anyMatch(t -> t.getTaxAgentId().equals(taxAgentId) && employeeId.equals(t.getEmployeeId())); + } + + /** + * 构建表格 + * + * @param weaTable + * @param isOpenDevolution + * @param employeeId + * @param tenantKey + * @param size + */ + public static void buildTaxAgentTable(WeaTable weaTable, boolean isOpenDevolution, Long employeeId, String tenantKey, int size) { + // 表格表头 + List columns = new ArrayList<>(); + String name = SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 91558, "个税扣缴义务人名称"); + String employeeRange = SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 86125, "人员范围"); + String admins = SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 106259, "管理员"); + String subAdmins = SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 106283, "分管理员"); + String paymentAgency = SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 112448, "社保福利代缴机构"); + String description = SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 84961, "备注"); + if (isOpenDevolution) { + columns.add(new WeaTableColumn(name, "name", "20%")); + columns.add(new WeaTableColumn(employeeRange, "employeeRange", "20%")); + columns.add(new WeaTableColumn(admins, "admins", "20%")); +// columns.add(new WeaTableColumn(subAdmins, "subAdmins", "20%")); + columns.add(new WeaTableColumn(paymentAgency, "paymentAgency", "30%")); + columns.add(new WeaTableColumn(description, "description", "20%")); + } else { + columns.add(new WeaTableColumn(name, "name", "40%")); + columns.add(new WeaTableColumn(employeeRange, "employeeRange", "20%")); + columns.add(new WeaTableColumn(paymentAgency, "paymentAgency", "30%")); + columns.add(new WeaTableColumn(description, "description", "40%")); + } + weaTable.setColumns(columns); + + List operates = weaTable.getOperates(); + operates.add(new WeaTableOperate(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 59943, "编辑"), 0)); + operates.add(new WeaTableOperate(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 59942, "删除"), 1)); +// if (isOpenDevolution) { +// operates.add(new WeaTableOperate(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 106247, "管理范围及分权设置"), 2)); +// } + weaTable.setOperatesPermission(getDefaultOperatesPermission(operates.size(), size)); +// weaTable.setCheckBoxPermission(getDefaultCheckBoxPermission(size)); +// +// weaTable.setTableType(WeaTableTypeEnum.CHECKBOX); + } + + private static List> getDefaultOperatesPermission(int operateSize, int recordSize) { + List> permissionList = Lists.newArrayList(); + for (int i = 0; i < recordSize; i++) { + List permissions = Lists.newArrayList(); + for (int j = 0; j < operateSize; j++) { + permissions.add(new Permission(true, false)); + } + permissionList.add(permissions); + } + return permissionList; + } + + private static List getDefaultCheckBoxPermission(int recordSize) { + List permissionList = Lists.newArrayList(); + for (int i = 0; i < recordSize; i++) { + permissionList.add(new Permission(true, false)); + } + return permissionList; + } + + /** + * 表数据转列表数据 + * + * @param taxAgents + * @param tenantKey + * @return + */ + public static List convertToListDTO(Collection taxAgents, String tenantKey) { + if (CollectionUtils.isEmpty(taxAgents)) { + return Collections.emptyList(); + } + return taxAgents.stream() + .map(e -> TaxAgentListDTO.builder() + .id(e.getId()) + .name(e.getName()) + .description(e.getDescription()) + .build()) + .collect(Collectors.toList()); + } + + /** + * 表数据转列表数据 + * + * @param taxAgents + * @return + */ + public static List> convertToTableListDTO(List taxAgents, List paymentAgencyPOS, String setLabel) { + return convertToTableListDTO(Boolean.FALSE, taxAgents, paymentAgencyPOS, null, null, setLabel); + } + + /** + * 表数据转列表数据 + * + * @param taxAgents + * @return + */ + public static List> convertToTableListDTO(List taxAgents, List paymentAgencyPOS, List taxAgentAdmins, + List adminList, + String setLabel) { + return convertToTableListDTO(Boolean.TRUE, taxAgents, paymentAgencyPOS, taxAgentAdmins, adminList, setLabel); + } + + /** + * 表数据转列表数据 + * + * @param taxAgents + * @param adminList + * @return + */ + public static List> convertToTableListDTO(Boolean isDevolution, List taxAgents, List paymentAgencyPOS, + List taxAgentAdmins, + List adminList, String setLabel) { + if (CollectionUtils.isEmpty(taxAgents)) { + return Collections.emptyList(); + } + return taxAgents.stream() + .map(e -> { + Map map = new LinkedHashMap<>(); + map.put("id", e.getId()); + map.put("name", e.getName()); + map.put("employeeRange", setLabel); + if (isDevolution) { + List empIds = taxAgentAdmins.stream().filter(t -> t.getTaxAgentId().equals(e.getId())).map(TaxAgentAdminPO::getEmployeeId).collect(Collectors.toList()); + List admins = adminList.stream().filter(a -> empIds.contains(a.getId())).map(SimpleEmployee::getUsername).collect(Collectors.toList()); + map.put("admins", CollectionUtils.isEmpty(admins) ? "" : Joiner.on(",").join(admins)); + map.put("subAdmins", setLabel); + } + map.put("paymentAgency", buildPaymentAgency(e.getPaymentAgency(), paymentAgencyPOS)); + map.put("description", e.getDescription()); + return map; + }).collect(Collectors.toList()); + } + + public static List> buildPaymentAgency(String originStr, List paymentAgencyPOS) { + List> paymentAgencyList = new ArrayList<>(); + if (CollectionUtils.isEmpty(paymentAgencyPOS)) { + return paymentAgencyList; + } + originStr = StringUtils.isBlank(originStr) ? "" : originStr; + String finalOriginStr = originStr; + return paymentAgencyPOS.stream().map(e -> { + HashMap temp = new HashMap<>(); + temp.put("id", e.getId()); + temp.put("agencyName", e.getAgencyName()); + if (finalOriginStr.contains(String.valueOf(e.getId()))) { + temp.put("status", true); + } else { + temp.put("status", false); + } + return temp; + }).collect(Collectors.toList()); + } + + /** + * 保存参数转表数据 + * + * @param saveParam + * @param employeeId + * @return + */ + public static TaxAgentPO convertToPO(TaxAgentSaveParam saveParam, Long employeeId) { + if (saveParam == null) { + return null; + } + Date now = new Date(); + return TaxAgentPO.builder() + .id(saveParam.getId()) + .name(saveParam.getName()) + .description(saveParam.getDescription()) + .createTime(now) + .updateTime(now) + .creator(employeeId) + .tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY) + .build(); + } + + /** + * 表数据转列表数据(分管理员) + * + * @param list + * @param range + * @param subAdminList + * @return + */ + public static List convertToSubAdminListDTO(List list, String range, List subAdminList) { + if (CollectionUtils.isEmpty(list)) { + return Collections.emptyList(); + } + return list.stream() + .map(e -> { + Optional optionalUsername = subAdminList.stream().filter(a -> e.getEmployeeId().equals(a.getEmployeeId())).map(DataCollectionEmployee::getUsername).findFirst(); + return TaxAgentSubAdminListDTO.builder() + .id(e.getId()) + .subAdmin(optionalUsername.isPresent() ? optionalUsername.get() : "") + .range(range) + .description(e.getRemark()) + .build(); + }) + .collect(Collectors.toList()); + } + + /** + * 管理范围列表转换 + * + * @param taxAgentManageRanges + * @param employeeComInfos + * @param departmentComInfos + * @param subDepartmentComInfos + * @param positionComInfos + * @param hrmStatusList + * @return + */ + public static List convert2ListDTO(List taxAgentManageRanges, List employeeComInfos, + List departmentComInfos, List subDepartmentComInfos, + List positionComInfos, List hrmStatusList) { + if (CollectionUtils.isEmpty(taxAgentManageRanges)) { + return Collections.emptyList(); + } + Map employeeComInfoMap = SalaryEntityUtil.convert2Map(employeeComInfos, HrmEmployeeComInfo::getId, HrmEmployeeComInfo::getUsername); + Map departmentComInfoMap = SalaryEntityUtil.convert2Map(departmentComInfos, HrmDepartmentComInfo::getId, HrmDepartmentComInfo::getName); + Map subDepartmentComInfoMap = SalaryEntityUtil.convert2Map(subDepartmentComInfos, HrmDepartmentComInfo::getId, HrmDepartmentComInfo::getName); + Map positionComInfoMap = SalaryEntityUtil.convert2Map(positionComInfos, HrmPositionComInfo::getId, HrmPositionComInfo::getName); + + Map hrmStatusNameMap = SalaryEntityUtil.convert2Map(hrmStatusList, hrmStatus -> String.valueOf(hrmStatus.getCodeId()), HrmStatus::getName); + + return taxAgentManageRanges.stream() + .map(taxAgentManageRange -> { + TargetTypeEnum targetTypeEnum = TargetTypeEnum.parseByValue(taxAgentManageRange.getTargetType()); + return TaxAgentManageRangeListDTO.builder() + .id(taxAgentManageRange.getId()) + .targetType(targetTypeEnum) + .targetTypeName(Optional.ofNullable(targetTypeEnum) + .map(e -> SalaryI18nUtil.getI18nLabel(e.getLabelId(), e.getDefaultLabel())) + .orElse(StringUtils.EMPTY)) + .targetId(taxAgentManageRange.getTargetId()) + .targetName(buildTargetName(taxAgentManageRange, employeeComInfoMap, departmentComInfoMap, subDepartmentComInfoMap, positionComInfoMap)) + .employeeStatus(buildEmployeeStatus(hrmStatusNameMap, taxAgentManageRange.getEmployeeStatus())) + .build(); + }) + .collect(Collectors.toList()); + } + + private static String buildEmployeeStatus(Map hrmStatusNameMap, String employeeStatus) { + List employeeStatusList = JsonUtil.parseList(employeeStatus, String.class); + if (CollectionUtils.isEmpty(employeeStatusList)) { + return StringUtils.EMPTY; + } + return employeeStatusList.stream() + .map(hrmStatusNameMap::get) + .collect(Collectors.joining(",")); + } + + /** + * 构建对象名 + * + * @param taxAgentManageRange + * @param employeeComInfoMap + * @param departmentComInfoMap + * @param subDepartmentComInfoMap + * @param positionComInfoMap + * @return + */ + private static String buildTargetName(TaxAgentManageRangePO taxAgentManageRange, Map employeeComInfoMap, Map departmentComInfoMap, + Map subDepartmentComInfoMap, Map positionComInfoMap) { + TargetTypeEnum targetTypeEnum = TargetTypeEnum.parseByValue(taxAgentManageRange.getTargetType()); + if (Objects.isNull(targetTypeEnum)) { + return StringUtils.EMPTY; + } + switch (targetTypeEnum) { + case EMPLOYEE: + return employeeComInfoMap.getOrDefault(taxAgentManageRange.getTargetId(), StringUtils.EMPTY); + case DEPT: + return departmentComInfoMap.getOrDefault(taxAgentManageRange.getTargetId(), StringUtils.EMPTY); + case SUBCOMPANY: + return subDepartmentComInfoMap.getOrDefault(taxAgentManageRange.getTargetId(), StringUtils.EMPTY); + case POSITION: + return positionComInfoMap.getOrDefault(taxAgentManageRange.getTargetId(), StringUtils.EMPTY); + default: + return StringUtils.EMPTY; + } + } + + public static Result handleTaxAgentRange(List taxAgentManageRanges, TaxAgentManageRangeSaveParam saveParam, Long taxAgentId, Long employeeId, + String tenantKey) { + return handleManageRange(taxAgentManageRanges, saveParam, TaxAgentRangeTypeEnum.TAXAGENT, taxAgentId, 0L, employeeId, tenantKey); + } + + public static Result handleSubAdminRange(List taxAgentManageRanges, TaxAgentManageRangeSaveParam saveParam, Long taxAgentId, Long subAdminId, + Long employeeId, String tenantKey) { + return handleManageRange(taxAgentManageRanges, saveParam, TaxAgentRangeTypeEnum.SUBADMIN, taxAgentId, subAdminId, employeeId, tenantKey); + } + + /** + * 处理前端传回的保存参数,转换成对应的po(如果保存参数中的人员、部门、岗位等之前就已经添加过了,就不需要再次保存了) + * + * @param taxAgentManageRanges + * @param saveParam + * @param taxAgentId + * @param subAdminId + * @param employeeId + * @param tenantKey + * @return + */ + private static Result handleManageRange(List taxAgentManageRanges, TaxAgentManageRangeSaveParam saveParam, + TaxAgentRangeTypeEnum rangeTypeEnum, Long taxAgentId, Long subAdminId, Long employeeId, String tenantKey) { + Date now = new Date(); + Result handleResult = Result.builder() + .needInsertTaxAgentManageRanges(Lists.newArrayList()) + .needUpdateTaxAgentManageRanges(Lists.newArrayList()) + .build(); + if (CollectionUtils.isEmpty(saveParam.getTargetParams())) { + return handleResult; + } + Map taxAgentManageRangeMap = SalaryEntityUtil.convert2Map(taxAgentManageRanges, + e -> e.getIncludeType() + "-" + e.getTargetType() + "-" + e.getTargetId() + "-" + e.getRangeType()); + for (TaxAgentSubAdminRangeSaveParam.TaxAgentSubAdminRangeTargetParam targetParam : saveParam.getTargetParams()) { + String key = saveParam.getIncludeType() + "-" + targetParam.getTargetType().getValue() + "-" + targetParam.getTargetId() + "-" + rangeTypeEnum.getValue(); + if (taxAgentManageRangeMap.containsKey(key)) { + TaxAgentManageRangePO taxAgentManageRange = taxAgentManageRangeMap.get(key); + taxAgentManageRange.setEmployeeStatus(JsonUtil.toJsonString(saveParam.getEmployeeStatus())); + taxAgentManageRange.setUpdateTime(now); + handleResult.getNeedUpdateTaxAgentManageRanges().add(taxAgentManageRange); + continue; + } + TaxAgentManageRangePO taxAgentManageRange = TaxAgentManageRangePO.builder() + .id(IdGenerator.generate()) + .taxAgentId(taxAgentId) + .taxAgentSubAdminId(subAdminId) + .rangeType(rangeTypeEnum.getValue()) + .targetType(targetParam.getTargetType().getValue()) + .targetId(targetParam.getTargetId()) + .employeeStatus(JsonUtil.toJsonString(saveParam.getEmployeeStatus())) + .includeType(saveParam.getIncludeType()) + .creator(employeeId) + .createTime(now) + .updateTime(now) + .tenantKey(tenantKey) + .deleteType(0) + .build(); + handleResult.getNeedInsertTaxAgentManageRanges().add(taxAgentManageRange); + } + return handleResult; + } + + @Data + @Builder + @NoArgsConstructor + @AllArgsConstructor + public static class Result { + + /** + * 需要更新的人员范围 + */ + private Collection needUpdateTaxAgentManageRanges; + + /** + * 需要新增的人员范围 + */ + private Collection needInsertTaxAgentManageRanges; + } +} diff --git a/src/com/engine/salary/entity/taxagent/dto/TaxAgentAdjustRecordForFormSearchConditionDTO.java b/src/com/engine/salary/entity/taxagent/dto/TaxAgentAdjustRecordForFormSearchConditionDTO.java new file mode 100644 index 000000000..954c6bfd1 --- /dev/null +++ b/src/com/engine/salary/entity/taxagent/dto/TaxAgentAdjustRecordForFormSearchConditionDTO.java @@ -0,0 +1,99 @@ +package com.engine.salary.entity.taxagent.dto; + +import com.weaver.common.component.search.item.WeaSearchConditionItemType; +import com.weaver.common.component.search.item.WeaSearchConditionOption; +import com.weaver.hrm.salary.annotation.SalarySearchCondition; +import com.weaver.hrm.salary.annotation.SalarySearchConditionItem; +import com.weaver.hrm.salary.enums.SalaryUserStatusEnum; +import com.weaver.hrm.salary.enums.salaryarchive.SalaryArchiveTaxAgentAdjustReasonEnum; +import com.weaver.hrm.salary.util.SalaryI18nUtil; +import com.weaver.teams.security.context.TenantContext; +import com.weaver.teams.security.context.UserContext; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.Arrays; +import java.util.List; +import java.util.stream.Collectors; + +/** + * @Description: 薪资档案操作记录 + * @Author: wangxiangzhong + * @Date: 2021/11/24 17:09 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class TaxAgentAdjustRecordForFormSearchConditionDTO { + + @SalarySearchCondition( + label = "个税扣缴义务人", + labelId = 86184, + needQuickSearch = true, + items = { + @SalarySearchConditionItem(itemType = WeaSearchConditionItemType.SELECT, name = "taxAgent", options = "getTaxAgentOptions()"), + } + ) + private String taxAgent; + + /** + * 个税扣缴义务人选项 + */ + private List taxAgentOptions; + + @SalarySearchCondition( + label = "调整原因", + labelId = 85431, + items = { + @SalarySearchConditionItem(itemType = WeaSearchConditionItemType.SELECT, name = "adjustReason", options = "getAdjustReasonOptions()"), + } + ) + private SalaryArchiveTaxAgentAdjustReasonEnum adjustReason; + + @SalarySearchCondition( + label = "生效日期", + labelId = 85904, + items = { + @SalarySearchConditionItem(itemType = WeaSearchConditionItemType.DATEPICKER, name = "effectiveTime") + } + ) + private String effectiveTime; + + @SalarySearchCondition( + label = "操作日期", + labelId = 91058, + items = { + @SalarySearchConditionItem(itemType = WeaSearchConditionItemType.DATEPICKER, name = "operateTime") + } + ) + private String operateTime; + + @SalarySearchCondition( + label = "操作人", + labelId = 85435, + items = { + @SalarySearchConditionItem(itemType = WeaSearchConditionItemType.BROWSER, browserType = "resource", browserMultiple = true, name = "operator", browserModule = "hrmsalary") + } + ) + private String operator; + + @SalarySearchCondition( + label = "备注", + labelId = 84961, + items = { + @SalarySearchConditionItem(itemType = WeaSearchConditionItemType.INPUT, name = "description"), + } + ) + private String description; + + private List getUserStatus(){ + return Arrays.stream(SalaryUserStatusEnum.values()).map(m->new WeaSearchConditionOption(m.name(), SalaryI18nUtil.getI18nLabel(TenantContext.getCurrentTenantKey(), UserContext.getCurrentEmployeeId(), m.getLabelId(), m.getDefaultLabel()))).collect(Collectors.toList()); + } + + private List getAdjustReasonOptions(){ + return Arrays.stream(SalaryArchiveTaxAgentAdjustReasonEnum.values()).map(m->new WeaSearchConditionOption(m.name(), SalaryI18nUtil.getI18nLabel(TenantContext.getCurrentTenantKey(), UserContext.getCurrentEmployeeId(), m.getLabelId(), m.getDefaultLabel()))).collect(Collectors.toList()); + } +} diff --git a/src/com/engine/salary/entity/taxagent/dto/TaxAgentAdjustRecordListDTO.java b/src/com/engine/salary/entity/taxagent/dto/TaxAgentAdjustRecordListDTO.java new file mode 100644 index 000000000..747e091e8 --- /dev/null +++ b/src/com/engine/salary/entity/taxagent/dto/TaxAgentAdjustRecordListDTO.java @@ -0,0 +1,136 @@ +package com.engine.salary.entity.taxagent.dto; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import com.weaver.common.authority.format.TableColumn; +import com.weaver.common.authority.format.TableOperates; +import com.weaver.common.authority.format.WeaFormat; +import com.weaver.common.component.table.type.WeaTableTypeEnum; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.time.LocalDate; +import java.util.Date; + +/** + * @Description: 个税扣缴义务人调整记录列表 + * @Author: wangxiangzhong + * @Date: 2021/11/1 16:34 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@ApiModel("个税扣缴义务人调整记录列表") +@TableOperates(tableType = WeaTableTypeEnum.CHECKBOX) +public class TaxAgentAdjustRecordListDTO { + @ApiModelProperty("主键id") + @JsonSerialize(using = ToStringSerializer.class) + private Long id; + + /** + * 人员信息表的主键id + */ + private Long employeeId; + + @ApiModelProperty("姓名") + @WeaFormat( + label = "姓名", + labelId = 85429, + tableColumn = @TableColumn(width = "100") + ) + private String username; + + @ApiModelProperty("部门") + @WeaFormat( + label = "部门", + labelId = 86185, + tableColumn = @TableColumn(width = "100") + ) + private String departmentName; + + @ApiModelProperty("员工状态") + @WeaFormat( + label = "员工状态", + labelId = 86187, + tableColumn = @TableColumn(width = "100") + ) + private String employeeStatus; + + @ApiModelProperty("调整前") + @WeaFormat( + label = "调整前", + labelId = 85433, + tableColumn = @TableColumn(width = "100") + ) + private String adjustBefore; + + @ApiModelProperty("调整后") + @WeaFormat( + label = "调整后", + labelId = 85434, + tableColumn = @TableColumn(width = "100") + ) + private String adjustAfter; + + @ApiModelProperty("调整原因") + @WeaFormat( + label = "调整原因", + labelId = 85431, + tableColumn = @TableColumn(width = "100") + ) + private String adjustReason; + + @ApiModelProperty("生效日期") + @WeaFormat( + label = "生效日期", + labelId = 85904, + tableColumn = @TableColumn(width = "100") + ) + @JsonFormat(pattern = "yyyy-MM-dd") + private LocalDate effectiveTime; + + @ApiModelProperty("操作人") + @WeaFormat( + label = "操作人", + labelId = 85435, + tableColumn = @TableColumn(width = "100") + ) + private String operator; + + @ApiModelProperty("操作时间") + @WeaFormat( + label = "操作时间", + labelId = 85436, + tableColumn = @TableColumn(width = "150") + ) + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date operateTime; + + @ApiModelProperty("备注") + @WeaFormat( + label = "备注", + labelId = 84961, + tableColumn = @TableColumn(width = "100") + ) + private String description; + + /** + * 薪资档案id + */ + @JsonIgnore + private Long salaryArchiveId; + + /** + * 个税扣缴义务人id + */ + @JsonIgnore + private Long taxAgentId; + +} diff --git a/src/com/engine/salary/entity/taxagent/dto/TaxAgentAdjustRecordSearchConditionDTO.java b/src/com/engine/salary/entity/taxagent/dto/TaxAgentAdjustRecordSearchConditionDTO.java new file mode 100644 index 000000000..04ef727f2 --- /dev/null +++ b/src/com/engine/salary/entity/taxagent/dto/TaxAgentAdjustRecordSearchConditionDTO.java @@ -0,0 +1,139 @@ +package com.engine.salary.entity.taxagent.dto; + +import com.weaver.common.component.search.item.WeaSearchConditionItemType; +import com.weaver.common.component.search.item.WeaSearchConditionOption; +import com.weaver.hrm.salary.annotation.SalarySearchCondition; +import com.weaver.hrm.salary.annotation.SalarySearchConditionItem; +import com.weaver.hrm.salary.enums.SalaryUserStatusEnum; +import com.weaver.hrm.salary.enums.salaryarchive.SalaryArchiveTaxAgentAdjustReasonEnum; +import com.weaver.hrm.salary.util.SalaryI18nUtil; +import com.weaver.teams.api.user.UserStatus; +import com.weaver.teams.security.context.TenantContext; +import com.weaver.teams.security.context.UserContext; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.Arrays; +import java.util.List; +import java.util.stream.Collectors; + +/** + * @Description: 薪资档案操作记录 + * @Author: wangxiangzhong + * @Date: 2021/11/24 17:09 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class TaxAgentAdjustRecordSearchConditionDTO { + + @SalarySearchCondition( + label = "姓名", + labelId = 85429, + needQuickSearch = true, + quickSearchKey = "username", + items = { + @SalarySearchConditionItem(itemType = WeaSearchConditionItemType.INPUT, name = "username"), + } + ) + private String username; + + @SalarySearchCondition( + label = "岗位", + labelId = 90633, + items = { + @SalarySearchConditionItem(itemType = WeaSearchConditionItemType.BROWSER, browserType = "position", browserMultiple = true, name = "position", browserModule = "hrmsalary") + } + ) + private String position; + + @SalarySearchCondition( + label = "状态", + labelId = 91075, + items = { + @SalarySearchConditionItem(itemType = WeaSearchConditionItemType.SELECT, name = "status", options = "getUserStatus()") + } + ) + private UserStatus status; + + @SalarySearchCondition( + label = "部门", + labelId = 86185, + needQuickSearch = true, + items = { + @SalarySearchConditionItem(itemType = WeaSearchConditionItemType.BROWSER, browserType = "department", browserMultiple = true, name = "department", browserModule = "hrmsalary") + } + ) + private String department; + + @SalarySearchCondition( + label = "个税扣缴义务人", + labelId = 86184, + needQuickSearch = true, + items = { + @SalarySearchConditionItem(itemType = WeaSearchConditionItemType.SELECT, name = "taxAgent", options = "getTaxAgentOptions()"), + } + ) + private String taxAgent; + + /** + * 个税扣缴义务人选项 + */ + private List taxAgentOptions; + + @SalarySearchCondition( + label = "调整原因", + labelId = 85431, + items = { + @SalarySearchConditionItem(itemType = WeaSearchConditionItemType.SELECT, name = "adjustReason", options = "getAdjustReasonOptions()"), + } + ) + private SalaryArchiveTaxAgentAdjustReasonEnum adjustReason; + + @SalarySearchCondition( + label = "生效日期", + labelId = 85904, + items = { + @SalarySearchConditionItem(itemType = WeaSearchConditionItemType.DATEPICKER, name = "effectiveTime") + } + ) + private String effectiveTime; + + @SalarySearchCondition( + label = "操作日期", + labelId = 91058, + items = { + @SalarySearchConditionItem(itemType = WeaSearchConditionItemType.DATEPICKER, name = "operateTime") + } + ) + private String operateTime; + + @SalarySearchCondition( + label = "操作人", + labelId = 85435, + items = { + @SalarySearchConditionItem(itemType = WeaSearchConditionItemType.BROWSER, browserType = "resource", browserMultiple = true, name = "operator", browserModule = "hrmsalary") + } + ) + private String operator; + + @SalarySearchCondition( + label = "备注", + labelId = 84961, + items = { + @SalarySearchConditionItem(itemType = WeaSearchConditionItemType.INPUT, name = "description"), + } + ) + private String description; + + private List getUserStatus(){ + return Arrays.stream(SalaryUserStatusEnum.values()).map(m->new WeaSearchConditionOption(m.name(), SalaryI18nUtil.getI18nLabel(TenantContext.getCurrentTenantKey(), UserContext.getCurrentEmployeeId(), m.getLabelId(), m.getDefaultLabel()))).collect(Collectors.toList()); + } + + private List getAdjustReasonOptions(){ + return Arrays.stream(SalaryUserStatusEnum.values()).map(m->new WeaSearchConditionOption(m.name(), SalaryI18nUtil.getI18nLabel(TenantContext.getCurrentTenantKey(), UserContext.getCurrentEmployeeId(), m.getLabelId(), m.getDefaultLabel()))).collect(Collectors.toList()); + } +} diff --git a/src/com/engine/salary/entity/taxagent/dto/TaxAgentBaseFormDTO.java b/src/com/engine/salary/entity/taxagent/dto/TaxAgentBaseFormDTO.java new file mode 100644 index 000000000..d5f193b3d --- /dev/null +++ b/src/com/engine/salary/entity/taxagent/dto/TaxAgentBaseFormDTO.java @@ -0,0 +1,34 @@ +package com.engine.salary.entity.taxagent.dto; + +import com.weaver.common.component.form.item.WeaFormItemType; +import com.weaver.hrm.salary.annotation.SalaryForm; +import com.weaver.hrm.salary.annotation.SalaryFormItem; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @Description: 个税扣缴义务人基础信息 + * @Author: wangxiangzhong + * @Date: 2022/3/21 10:00 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@ApiModel("个税扣缴义务人基础信息表单") +public class TaxAgentBaseFormDTO { + + @SalaryForm( + label = "启用分权", + labelId = 106270, + items = { + @SalaryFormItem(itemType = WeaFormItemType.SWITCH) + } + ) + @ApiModelProperty("启用分权") + private Boolean devolutionStatus; +} diff --git a/src/com/engine/salary/entity/taxagent/dto/TaxAgentEmployeeDTO.java b/src/com/engine/salary/entity/taxagent/dto/TaxAgentEmployeeDTO.java new file mode 100644 index 000000000..1081993c3 --- /dev/null +++ b/src/com/engine/salary/entity/taxagent/dto/TaxAgentEmployeeDTO.java @@ -0,0 +1,41 @@ +package com.engine.salary.entity.taxagent.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Builder; +import lombok.Data; + +/** + * @Description: 个税扣缴义务人以及管理范围中的人员 + * @Author: wangxiangzhong + * @Date: 2022/3/24 14:44 + */ +@Data +@Builder +@ApiModel("个税扣缴义务人以及管理范围中的人员") +public class TaxAgentEmployeeDTO { + + /** + * 个税扣缴义务人id + */ + @ApiModelProperty("个税扣缴义务人id") + private Long taxAgentId; + + /** + * 名称 + */ + @ApiModelProperty("个税扣缴义务人名称") + private String taxAgentName; + + /** + * 人员id + */ + @ApiModelProperty("人员id") + private Long employeeId; + + /** + * 名字 + */ + @ApiModelProperty("名字") + private String username; +} diff --git a/src/com/engine/salary/entity/taxagent/dto/TaxAgentEmployeeOptionDTO.java b/src/com/engine/salary/entity/taxagent/dto/TaxAgentEmployeeOptionDTO.java new file mode 100644 index 000000000..9ed1d2b4f --- /dev/null +++ b/src/com/engine/salary/entity/taxagent/dto/TaxAgentEmployeeOptionDTO.java @@ -0,0 +1,24 @@ +package com.engine.salary.entity.taxagent.dto; + +import io.swagger.annotations.ApiModel; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @Description: 个税扣缴义务人人员选项 + * @Author: wangxiangzhong + * @Date: 2022/3/28 17:30 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@ApiModel("个税扣缴义务人人员选项") +public class TaxAgentEmployeeOptionDTO { + + private Long id; + + private String content; +} diff --git a/src/com/engine/salary/entity/taxagent/dto/TaxAgentEmployeeTaxAgentDTO.java b/src/com/engine/salary/entity/taxagent/dto/TaxAgentEmployeeTaxAgentDTO.java new file mode 100644 index 000000000..88253b492 --- /dev/null +++ b/src/com/engine/salary/entity/taxagent/dto/TaxAgentEmployeeTaxAgentDTO.java @@ -0,0 +1,32 @@ +package com.engine.salary.entity.taxagent.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Builder; +import lombok.Data; + +import java.util.List; + +/** + * @description: 管理范围的人员与个税扣缴义务人的关联数据 + * @Author: wangxiangzhong + * @Date: 2022/3/22 17:08 + * @version:v1.0 + */ +@Data +@Builder +@ApiModel("管理范围的人员与个税扣缴义务人的关联数据") +public class TaxAgentEmployeeTaxAgentDTO { + + /** + * 人员id + */ + @ApiModelProperty("人员id") + private Long employeeId; + + /** + * 个税扣缴义务人id列表 + */ + @ApiModelProperty("个税扣缴义务人id列表") + private List taxAgentIds; +} diff --git a/src/com/engine/salary/entity/taxagent/dto/TaxAgentFormDTO.java b/src/com/engine/salary/entity/taxagent/dto/TaxAgentFormDTO.java new file mode 100644 index 000000000..d9961282a --- /dev/null +++ b/src/com/engine/salary/entity/taxagent/dto/TaxAgentFormDTO.java @@ -0,0 +1,53 @@ +package com.engine.salary.entity.taxagent.dto; + +import com.weaver.common.authority.format.Form; +import com.weaver.common.authority.format.WeaFormat; +import com.weaver.common.component.form.item.WeaFormItemType; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.List; + +/** + * @Description: 个税扣缴义务人表单 + * @Author: wangxiangzhong + * @Date: 2021/10/29 16:12 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@ApiModel("个税扣缴义务人表单") +public class TaxAgentFormDTO { + + @ApiModelProperty("主键id") + private Long id; + + @WeaFormat( + label = "名称", + labelId = 1252, + from = @Form(itemType = WeaFormItemType.INPUT, required = true, maxLength = "20") + ) + @ApiModelProperty("名称") + private String name; + + @WeaFormat( + label = "管理员", + labelId = 106259, + from = @Form(itemType = WeaFormItemType.BROWSER, required = true, browserModule = "hrmsalary", browserType = "resource") + ) + @ApiModelProperty("管理员") + private List adminUser; + + @WeaFormat( + label = "备注", + labelId = 84961, + from = @Form(itemType = WeaFormItemType.INPUT, maxLength = "20") + ) + @ApiModelProperty("备注") + private String description; +} diff --git a/src/com/engine/salary/entity/taxagent/dto/TaxAgentListDTO.java b/src/com/engine/salary/entity/taxagent/dto/TaxAgentListDTO.java new file mode 100644 index 000000000..ff7d55bb0 --- /dev/null +++ b/src/com/engine/salary/entity/taxagent/dto/TaxAgentListDTO.java @@ -0,0 +1,52 @@ +package com.engine.salary.entity.taxagent.dto; + +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import com.weaver.common.authority.format.Operates; +import com.weaver.common.authority.format.TableColumn; +import com.weaver.common.authority.format.TableOperates; +import com.weaver.common.authority.format.WeaFormat; +import com.weaver.common.component.table.type.WeaTableTypeEnum; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @Description: 个税扣缴义务人列表 + * @Author: wangxiangzhong + * @Date: 2021/10/29 15:39 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@ApiModel("个税扣缴义务人列表") +@TableOperates(value = { + @Operates(index = 0, text = "编辑" ,labelId = 59943), + @Operates(index = 1, text = "删除" ,labelId = 59942) +}, tableType = WeaTableTypeEnum.NONE) +public class TaxAgentListDTO { + + @ApiModelProperty("主键id") + @JsonSerialize(using = ToStringSerializer.class) + private Long id; + + @ApiModelProperty("个税扣缴义务人名称") + @WeaFormat( + label = "个税扣缴义务人名称", + labelId = 91558, + tableColumn = @TableColumn(width = "40%") + ) + private String name; + + @ApiModelProperty("备注") + @WeaFormat( + label = "备注", + labelId = 84961, + tableColumn = @TableColumn(width = "40%") + ) + private String description; +} diff --git a/src/com/engine/salary/entity/taxagent/dto/TaxAgentManageRangeEmployeeDTO.java b/src/com/engine/salary/entity/taxagent/dto/TaxAgentManageRangeEmployeeDTO.java new file mode 100644 index 000000000..367f71d53 --- /dev/null +++ b/src/com/engine/salary/entity/taxagent/dto/TaxAgentManageRangeEmployeeDTO.java @@ -0,0 +1,47 @@ +package com.engine.salary.entity.taxagent.dto; + +import lombok.Builder; +import lombok.Data; + +import java.util.List; + +/** + * 个税扣缴义务人以及管理范围中的人员 + *

Copyright: Copyright (c) 2022

+ *

Company: 泛微软件

+ * + * @author qiantao + * @version 1.0 + **/ +@Data +@Builder +public class TaxAgentManageRangeEmployeeDTO { + + /** + * 个税扣缴义务人id + */ + private Long taxAgentId; + + /** + * 名称 + */ + private String taxAgentName; + + /** + * 人员列表 + */ + private List employeeList; + + @Data + public static class TaxAgentEmployee { + /** + * 人员id + */ + private Long employeeId; + + /** + * 名字 + */ + private String username; + } +} diff --git a/src/com/engine/salary/entity/taxagent/dto/TaxAgentManageRangeFormDTO.java b/src/com/engine/salary/entity/taxagent/dto/TaxAgentManageRangeFormDTO.java new file mode 100644 index 000000000..7711d9d99 --- /dev/null +++ b/src/com/engine/salary/entity/taxagent/dto/TaxAgentManageRangeFormDTO.java @@ -0,0 +1,55 @@ +package com.engine.salary.entity.taxagent.dto; + +import com.weaver.common.component.browser.combination.TypesBrowserOption; +import com.weaver.common.component.form.item.WeaFormItemType; +import com.weaver.hrm.salary.annotation.SalaryForm; +import com.weaver.hrm.salary.annotation.SalaryFormItem; +import com.weaver.hrm.salary.enums.salarysob.TargetTypeEnum; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.Collection; +import java.util.List; + +/** + * @description: 范围表单 + * @Author: wangxiangzhong + * @Date: 2022/03/23 09:15 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@ApiModel("范围表单") +public class TaxAgentManageRangeFormDTO { + + @SalaryForm( + label = "对象类型", + labelId = 90394, + items = { + @SalaryFormItem(required = true, itemType = WeaFormItemType.TYPESBROWSER, options = "getTargetOptions()", + browserModule = "hrmsalary", browserType = "hrmcombination", browserMultiple = true) + } + ) + @ApiModelProperty("对象类型") + private TargetTypeEnum targetType; + + private List targetOptions; + + @ApiModelProperty("对象id") + private Long targetId; + + @SalaryForm( + label = "选择人员状态", + labelId = 87825, + items = { + @SalaryFormItem(required = true, itemType = WeaFormItemType.CHECKBOX) + } + ) + @ApiModelProperty("人员状态") + private Collection employeeStatus; +} diff --git a/src/com/engine/salary/entity/taxagent/dto/TaxAgentManageRangeListDTO.java b/src/com/engine/salary/entity/taxagent/dto/TaxAgentManageRangeListDTO.java new file mode 100644 index 000000000..30842d62e --- /dev/null +++ b/src/com/engine/salary/entity/taxagent/dto/TaxAgentManageRangeListDTO.java @@ -0,0 +1,58 @@ +package com.engine.salary.entity.taxagent.dto; + +import com.engine.salary.annotation.SalaryTableColumn; +import com.engine.salary.enums.salarysob.TargetTypeEnum; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * 个税扣缴义务人管理范围列表 + *

Copyright: Copyright (c) 2022

+ *

Company: 泛微软件

+ * + * @author qiantao + * @version 1.0 + **/ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class TaxAgentManageRangeListDTO { + + //主键id + private Long id; + + //对象类型 + private TargetTypeEnum targetType; + + @SalaryTableColumn( + text = "对象类型", + labelId = 90394, + width = "30%", + column="targetTypeName" + ) + //对象类型") + private String targetTypeName; + + @SalaryTableColumn( + text = "对象", + labelId = 90396, + width = "30%", + column="targetName" + ) + //对象") + private String targetName; + + //对象id") + private Long targetId; + + @SalaryTableColumn( + text = "员工状态", + labelId = 86187, + width = "30%", + column="employeeStatus" + ) + private String employeeStatus; +} diff --git a/src/com/engine/salary/entity/taxagent/dto/TaxAgentSubAdminBaseFormDTO.java b/src/com/engine/salary/entity/taxagent/dto/TaxAgentSubAdminBaseFormDTO.java new file mode 100644 index 000000000..ee958a12b --- /dev/null +++ b/src/com/engine/salary/entity/taxagent/dto/TaxAgentSubAdminBaseFormDTO.java @@ -0,0 +1,45 @@ +package com.engine.salary.entity.taxagent.dto; + +import com.weaver.common.authority.format.Form; +import com.weaver.common.authority.format.WeaFormat; +import com.weaver.common.component.form.item.WeaFormItemType; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.List; + +/** + * @Description: 个税扣缴义务人分管理员基础设置表单 + * @Author: wangxiangzhong + * @Date: 2021/10/29 16:12 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@ApiModel("个税扣缴义务人分管理员基础设置表单") +public class TaxAgentSubAdminBaseFormDTO { + + @ApiModelProperty("主键id") + private Long id; + + @WeaFormat( + label = "分管理员", + labelId = 106283, + from = @Form(itemType = WeaFormItemType.BROWSER, required = true, browserModule = "hrmsalary", browserType = "resource") + ) + @ApiModelProperty("分管理员") + private List subAdminUser; + + @WeaFormat( + label = "备注", + labelId = 84961, + from = @Form(itemType = WeaFormItemType.INPUT, maxLength = "20") + ) + @ApiModelProperty("备注") + private String description; +} diff --git a/src/com/engine/salary/entity/taxagent/dto/TaxAgentSubAdminListDTO.java b/src/com/engine/salary/entity/taxagent/dto/TaxAgentSubAdminListDTO.java new file mode 100644 index 000000000..a2227b4bc --- /dev/null +++ b/src/com/engine/salary/entity/taxagent/dto/TaxAgentSubAdminListDTO.java @@ -0,0 +1,60 @@ +package com.engine.salary.entity.taxagent.dto; + +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import com.weaver.common.authority.format.Operates; +import com.weaver.common.authority.format.TableColumn; +import com.weaver.common.authority.format.TableOperates; +import com.weaver.common.authority.format.WeaFormat; +import com.weaver.common.component.table.type.WeaTableTypeEnum; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @Description: 个税扣缴义务人分管理员列表 + * @Author: wangxiangzhong + * @Date: 2022/03/21 15:39 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@ApiModel("个税扣缴义务人分管理员列表") +@TableOperates(value = { + @Operates(index = 0, text = "编辑" ,labelId = 59943), + @Operates(index = 1, text = "删除" ,labelId = 59942) +}, tableType = WeaTableTypeEnum.NONE) +public class TaxAgentSubAdminListDTO { + + @ApiModelProperty("主键id") + @JsonSerialize(using = ToStringSerializer.class) + private Long id; + + @ApiModelProperty("分管理员") + @WeaFormat( + label = "分管理员", + labelId = 106283, + tableColumn = @TableColumn(width = "30%") + ) + private String subAdmin; + + @ApiModelProperty("管理范围") + @WeaFormat( + label = "管理范围", + labelId = 106250, + tableColumn = @TableColumn(width = "30%") + ) + private String range; + + @ApiModelProperty("备注") + @WeaFormat( + label = "备注", + labelId = 84961, + tableColumn = @TableColumn(width = "40%") + ) + private String description; +} diff --git a/src/com/engine/salary/entity/taxagent/param/TaxAgentAdjustRecordQueryParam.java b/src/com/engine/salary/entity/taxagent/param/TaxAgentAdjustRecordQueryParam.java new file mode 100644 index 000000000..b1e62bdc2 --- /dev/null +++ b/src/com/engine/salary/entity/taxagent/param/TaxAgentAdjustRecordQueryParam.java @@ -0,0 +1,65 @@ +package com.engine.salary.entity.taxagent.param; + +import com.weaver.hrm.salary.common.BaseQueryParam; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.time.LocalDate; +import java.util.Collection; +import java.util.List; + +/** + * @Description: 个税扣缴义务人调整记录查询参数 + * @Author: wangxiangzhong + * @Date: 2021/11/1 16:35 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@ApiModel("个税扣缴义务人调整记录查询参数") +public class TaxAgentAdjustRecordQueryParam extends BaseQueryParam { + + @ApiModelProperty("主键id") + private Collection ids; + + @ApiModelProperty("薪资档案id") + private Long salaryArchiveId; + + @ApiModelProperty("关键字(姓名、部门、个税扣缴义务人)") + private String keyword; + + @ApiModelProperty("姓名") + private String username; + + @ApiModelProperty("部门id") + private List departmentIds; + + @ApiModelProperty("岗位id") + private List positionIds; + + @ApiModelProperty("状态") + private String userstatus; + + @ApiModelProperty("个税扣缴义务人id") + private Long taxAgentId; + + @ApiModelProperty("调整原因") + private String adjustReason; + + @ApiModelProperty("生效日期") + private List effectiveTime; + + @ApiModelProperty("操作日期") + private List operateTime; + + @ApiModelProperty("操作人id") + private List operatorIds; + + @ApiModelProperty("备注") + private String description; +} diff --git a/src/com/engine/salary/entity/taxagent/param/TaxAgentAdminChangeCheckParam.java b/src/com/engine/salary/entity/taxagent/param/TaxAgentAdminChangeCheckParam.java new file mode 100644 index 000000000..5341d5d6b --- /dev/null +++ b/src/com/engine/salary/entity/taxagent/param/TaxAgentAdminChangeCheckParam.java @@ -0,0 +1,27 @@ +package com.engine.salary.entity.taxagent.param; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @Description: 个税扣缴义务人保存参数 + * @Author: wangxiangzhong + * @Date: 2021/10/29 16:28 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@ApiModel("个税扣缴义务人更改管理员校验参数") +public class TaxAgentAdminChangeCheckParam { + + @ApiModelProperty("个税扣缴义务人id") + private Long taxAgentId; + + @ApiModelProperty("管理员主键id") + private Long adminUserId; +} diff --git a/src/com/engine/salary/entity/taxagent/param/TaxAgentEmpSaveParam.java b/src/com/engine/salary/entity/taxagent/param/TaxAgentEmpSaveParam.java new file mode 100644 index 000000000..259580ee3 --- /dev/null +++ b/src/com/engine/salary/entity/taxagent/param/TaxAgentEmpSaveParam.java @@ -0,0 +1,30 @@ +package com.engine.salary.entity.taxagent.param; + +import com.engine.salary.entity.datacollection.DataCollectionEmployee; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.List; + +/** + * 个税扣缴义务人的关联人员保存参数 + *

Copyright: Copyright (c) 2022

+ *

Company: 泛微软件

+ * + * @author qiantao + * @version 1.0 + **/ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class TaxAgentEmpSaveParam { + + //个税口角义务人的主键id + private Long taxAgentId; + + //关联人员列表 + private List salaryEmployeeList; +} diff --git a/src/com/engine/salary/entity/taxagent/param/TaxAgentManageRangeEmpQueryParam.java b/src/com/engine/salary/entity/taxagent/param/TaxAgentManageRangeEmpQueryParam.java new file mode 100644 index 000000000..041fe8776 --- /dev/null +++ b/src/com/engine/salary/entity/taxagent/param/TaxAgentManageRangeEmpQueryParam.java @@ -0,0 +1,30 @@ +package com.engine.salary.entity.taxagent.param; + +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.Collection; + +/** + * @Description: 管理范围转人员-查询参数 + * @Author: wangxiangzhong + * @Date: 2022/3/24 16:40 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class TaxAgentManageRangeEmpQueryParam { + + @ApiModelProperty("对象类型") + private String targetType; + + @ApiModelProperty("对象id") + private Collection targetIds; + + @ApiModelProperty("人员状态") + private Collection employeeStatus; +} diff --git a/src/com/engine/salary/entity/taxagent/param/TaxAgentManageRangeQueryParam.java b/src/com/engine/salary/entity/taxagent/param/TaxAgentManageRangeQueryParam.java new file mode 100644 index 000000000..591aaa1c4 --- /dev/null +++ b/src/com/engine/salary/entity/taxagent/param/TaxAgentManageRangeQueryParam.java @@ -0,0 +1,23 @@ +package com.engine.salary.entity.taxagent.param; + +import com.engine.salary.common.BaseQueryParam; +import lombok.Data; + +/** + * 管理范围查询参数 + *

Copyright: Copyright (c) 2022

+ *

Company: 泛微软件

+ * + * @author qiantao + * @version 1.0 + **/ +@Data +//@Builder +//@NoArgsConstructor +//@AllArgsConstructor +//管理范围查询参数") +public class TaxAgentManageRangeQueryParam extends BaseQueryParam { + + //对象") + private String targetName; +} diff --git a/src/com/engine/salary/entity/taxagent/param/TaxAgentManageRangeSaveParam.java b/src/com/engine/salary/entity/taxagent/param/TaxAgentManageRangeSaveParam.java new file mode 100644 index 000000000..fdfc38396 --- /dev/null +++ b/src/com/engine/salary/entity/taxagent/param/TaxAgentManageRangeSaveParam.java @@ -0,0 +1,57 @@ +package com.engine.salary.entity.taxagent.param; + +import com.engine.salary.enums.salarysob.TargetTypeEnum; +import com.engine.salary.util.valid.DataCheck; +import lombok.Data; + +import java.util.Collection; +import java.util.List; + +/** + * 管理范围保存参数 + *

Copyright: Copyright (c) 2022

+ *

Company: 泛微软件

+ * + * @author qiantao + * @version 1.0 + **/ +@Data +public class TaxAgentManageRangeSaveParam { + + /** + * 只能选择 关联人员范围/从范围中排除 + */ + @DataCheck(require = true, max = 1, min = 0, message = "只能选择。0:排除、1:包含") + private Integer includeType; + + /** + * 对象不能为空 + */ + @DataCheck(require = true, message = "对象不能为空") + private List targetParams; + + /** + * 员工状态不允许为空 + */ + @DataCheck(require = true,message = "员工状态不允许为空") + private Collection employeeStatus; + + /** + * 个税扣缴义务人分管理员管理范围保存参数中的对象 + */ + @Data + public static class TaxAgentSubAdminRangeTargetParam { + + /** + * 对象类型不能为空 + */ + @DataCheck(require = true,message = "对象类型不能为空") + private TargetTypeEnum targetType; + + /** + * 对象不能为空 + */ + @DataCheck(require = true,message = "对象不能为空") + private Long targetId; + } +} diff --git a/src/com/engine/salary/entity/taxagent/param/TaxAgentQueryParam.java b/src/com/engine/salary/entity/taxagent/param/TaxAgentQueryParam.java new file mode 100644 index 000000000..96697ed0c --- /dev/null +++ b/src/com/engine/salary/entity/taxagent/param/TaxAgentQueryParam.java @@ -0,0 +1,29 @@ +package com.engine.salary.entity.taxagent.param; + +import com.weaver.hrm.salary.common.BaseQueryParam; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.Collection; + +/** + * @Description: 个税扣缴义务人查询参数 + * @Author: wangxiangzhong + * @Date: 2021/10/29 15:03 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@ApiModel("个税扣缴义务人查询参数") +public class TaxAgentQueryParam extends BaseQueryParam { + + private Collection ids; + + @ApiModelProperty("个税扣缴义务人名称") + private String name; +} diff --git a/src/com/engine/salary/entity/taxagent/param/TaxAgentRangeQueryParam.java b/src/com/engine/salary/entity/taxagent/param/TaxAgentRangeQueryParam.java new file mode 100644 index 000000000..f37187cc8 --- /dev/null +++ b/src/com/engine/salary/entity/taxagent/param/TaxAgentRangeQueryParam.java @@ -0,0 +1,25 @@ +package com.engine.salary.entity.taxagent.param; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * 个税扣缴义务人人员范围查询参数 + *

Copyright: Copyright (c) 2022

+ *

Company: 泛微软件

+ * + * @author qiantao + * @version 1.0 + **/ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +//个税扣缴义务人人员范围查询参数") +public class TaxAgentRangeQueryParam extends TaxAgentManageRangeQueryParam { + + //个税扣缴义务人id") + private Long taxAgentId; +} diff --git a/src/com/engine/salary/entity/taxagent/param/TaxAgentRangeSaveParam.java b/src/com/engine/salary/entity/taxagent/param/TaxAgentRangeSaveParam.java new file mode 100644 index 000000000..65903e463 --- /dev/null +++ b/src/com/engine/salary/entity/taxagent/param/TaxAgentRangeSaveParam.java @@ -0,0 +1,22 @@ +package com.engine.salary.entity.taxagent.param; + +import com.engine.salary.util.valid.DataCheck; +import lombok.Data; + +/** + * 个税扣缴义务人的人员范围保存参数 + *

Copyright: Copyright (c) 2022

+ *

Company: 泛微软件

+ * + * @author qiantao + * @version 1.0 + **/ +@Data +public class TaxAgentRangeSaveParam extends TaxAgentManageRangeSaveParam { + + /** + * 个税扣缴义务人的id不允许为空 + */ + @DataCheck(require = true,message = "个税扣缴义务人的id不允许为空") + private Long taxAgentId; +} diff --git a/src/com/engine/salary/entity/taxagent/param/TaxAgentSaveBaseParam.java b/src/com/engine/salary/entity/taxagent/param/TaxAgentSaveBaseParam.java new file mode 100644 index 000000000..d6b1ef205 --- /dev/null +++ b/src/com/engine/salary/entity/taxagent/param/TaxAgentSaveBaseParam.java @@ -0,0 +1,22 @@ +package com.engine.salary.entity.taxagent.param; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @Description: 个税扣缴义务人基础信息保存参数 + * @Author: wangxiangzhong + * @Date: 2022/3/21 9:55 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +//个税扣缴义务人基础信息保存参数") +public class TaxAgentSaveBaseParam { + + //"启用分权" + private Boolean devolutionStatus; +} diff --git a/src/com/engine/salary/entity/taxagent/param/TaxAgentSaveParam.java b/src/com/engine/salary/entity/taxagent/param/TaxAgentSaveParam.java new file mode 100644 index 000000000..7fec9dd40 --- /dev/null +++ b/src/com/engine/salary/entity/taxagent/param/TaxAgentSaveParam.java @@ -0,0 +1,46 @@ +package com.engine.salary.entity.taxagent.param; + +import com.weaver.common.base.entity.result.WeaResult; +import com.weaver.hrm.salary.util.SalaryI18nUtil; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.apache.commons.lang3.StringUtils; + +/** + * @Description: 个税扣缴义务人保存参数 + * @Author: wangxiangzhong + * @Date: 2021/10/29 16:28 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@ApiModel("个税扣缴义务人保存参数") +public class TaxAgentSaveParam { + + @ApiModelProperty("主键id") + private Long id; + + @ApiModelProperty(name = "名称") + private String name; + + @ApiModelProperty("管理员主键id") + private Long adminUserId; + + @ApiModelProperty("代缴机构") + private String paymentAgency; + + @ApiModelProperty(name = "备注") + private String description; + + public static WeaResult checkParam(TaxAgentSaveParam saveParam, Long employeeId, String tenantKey) { + if (StringUtils.isEmpty(saveParam.getName())) { + return WeaResult.fail(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 100318, "名称必填")); + } + return WeaResult.success(StringUtils.EMPTY); + } +} diff --git a/src/com/engine/salary/entity/taxagent/param/TaxAgentSubAdminBaseFormParam.java b/src/com/engine/salary/entity/taxagent/param/TaxAgentSubAdminBaseFormParam.java new file mode 100644 index 000000000..44c65ae09 --- /dev/null +++ b/src/com/engine/salary/entity/taxagent/param/TaxAgentSubAdminBaseFormParam.java @@ -0,0 +1,27 @@ +package com.engine.salary.entity.taxagent.param; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @Description: 分管理员基础设置表单参数 + * @Author: wangxiangzhong + * @Date: 2022/3/22 16:18 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@ApiModel("分管理员基础设置表单参数") +public class TaxAgentSubAdminBaseFormParam { + + @ApiModelProperty("分管理员的id") + private Long id; + + @ApiModelProperty("个税扣缴义务人的id") + private Long taxAgentId; +} diff --git a/src/com/engine/salary/entity/taxagent/param/TaxAgentSubAdminBaseSaveParam.java b/src/com/engine/salary/entity/taxagent/param/TaxAgentSubAdminBaseSaveParam.java new file mode 100644 index 000000000..b8fdb78ff --- /dev/null +++ b/src/com/engine/salary/entity/taxagent/param/TaxAgentSubAdminBaseSaveParam.java @@ -0,0 +1,33 @@ +package com.engine.salary.entity.taxagent.param; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @Description: 分管理员基础设置保存参数 + * @Author: wangxiangzhong + * @Date: 2022/3/22 15:28 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@ApiModel("分管理员基础设置保存参数") +public class TaxAgentSubAdminBaseSaveParam { + + @ApiModelProperty("主键id") + private Long id; + + @ApiModelProperty("个税扣缴义务人的id") + private Long taxAgentId; + + @ApiModelProperty(name = "分管理员的id") + private Long subAdminUserId; + + @ApiModelProperty(name = "备注") + private String description; +} diff --git a/src/com/engine/salary/entity/taxagent/param/TaxAgentSubAdminEmpSaveParam.java b/src/com/engine/salary/entity/taxagent/param/TaxAgentSubAdminEmpSaveParam.java new file mode 100644 index 000000000..441670894 --- /dev/null +++ b/src/com/engine/salary/entity/taxagent/param/TaxAgentSubAdminEmpSaveParam.java @@ -0,0 +1,33 @@ +package com.engine.salary.entity.taxagent.param; + +import com.weaver.hrm.salary.common.SalaryEmployee; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.List; + +/** + * @Description: 个税扣缴义务人分管理员的关联人员保存参数 + * @Author: wangxiangzhong + * @Date: 2021/10/29 16:28 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@ApiModel("个税扣缴义务人分管理员的关联人员保存参数") +public class TaxAgentSubAdminEmpSaveParam { + + @ApiModelProperty("个税口角义务人的主键id") + private Long taxAgentId; + + @ApiModelProperty("分管理员的主键id") + private Long subAdminId; + + @ApiModelProperty(name = "关联人员列表") + private List salaryEmployeeList; +} diff --git a/src/com/engine/salary/entity/taxagent/param/TaxAgentSubAdminQueryParam.java b/src/com/engine/salary/entity/taxagent/param/TaxAgentSubAdminQueryParam.java new file mode 100644 index 000000000..68607dd43 --- /dev/null +++ b/src/com/engine/salary/entity/taxagent/param/TaxAgentSubAdminQueryParam.java @@ -0,0 +1,25 @@ +package com.engine.salary.entity.taxagent.param; + +import com.weaver.hrm.salary.common.BaseQueryParam; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @Description: 个税扣缴义务人分管理员查询参数 + * @Author: wangxiangzhong + * @Date: 2021/10/29 15:03 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@ApiModel("个税扣缴义务人分管理员查询参数") +public class TaxAgentSubAdminQueryParam extends BaseQueryParam { + + @ApiModelProperty("个税扣缴义务人id") + private Long taxAgentId; +} diff --git a/src/com/engine/salary/entity/taxagent/param/TaxAgentSubAdminRangeQueryParam.java b/src/com/engine/salary/entity/taxagent/param/TaxAgentSubAdminRangeQueryParam.java new file mode 100644 index 000000000..0b867ccf2 --- /dev/null +++ b/src/com/engine/salary/entity/taxagent/param/TaxAgentSubAdminRangeQueryParam.java @@ -0,0 +1,24 @@ +package com.engine.salary.entity.taxagent.param; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @Description: 个税扣缴义务人分管理员管理范围查询参数 + * @Author: wangxiangzhong + * @Date: 2022/3/22 14:08 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@ApiModel("个税扣缴义务人分管理员管理范围查询参数") +public class TaxAgentSubAdminRangeQueryParam extends TaxAgentManageRangeQueryParam { + + @ApiModelProperty("分管理员id") + private Long subAdminId; +} diff --git a/src/com/engine/salary/entity/taxagent/param/TaxAgentSubAdminRangeSaveParam.java b/src/com/engine/salary/entity/taxagent/param/TaxAgentSubAdminRangeSaveParam.java new file mode 100644 index 000000000..2638a435a --- /dev/null +++ b/src/com/engine/salary/entity/taxagent/param/TaxAgentSubAdminRangeSaveParam.java @@ -0,0 +1,22 @@ +package com.engine.salary.entity.taxagent.param; + +import com.engine.salary.util.valid.DataCheck; +import lombok.Data; + +/** + * 个税扣缴义务人分管理员管理范围保存参数 + *

Copyright: Copyright (c) 2022

+ *

Company: 泛微软件

+ * + * @author qiantao + * @version 1.0 + **/ +@Data +public class TaxAgentSubAdminRangeSaveParam extends TaxAgentManageRangeSaveParam { + + /** + * 分管理员的id不允许为空 + */ + @DataCheck(require = true, message = "分管理员的id不允许为空") + private Long subAdminId; +} diff --git a/src/com/engine/salary/entity/taxagent/po/TaxAgentAdminPO.java b/src/com/engine/salary/entity/taxagent/po/TaxAgentAdminPO.java new file mode 100644 index 000000000..6537f5bfc --- /dev/null +++ b/src/com/engine/salary/entity/taxagent/po/TaxAgentAdminPO.java @@ -0,0 +1,67 @@ +package com.engine.salary.entity.taxagent.po; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.Collection; +import java.util.Date; + +/** + * @Description: 个税扣缴义务人管理员 + * @Author: wangxiangzhong + * @Date: 2022/3/21 13:16 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +//hrsa_tax_agent_admin") +public class TaxAgentAdminPO { + /** + * 主键id + */ + private Long id; + + /** + * 个税扣缴义务人的主键id + */ + private Long taxAgentId; + + /** + * 人员信息表的主键id + */ + private Long employeeId; + + /** + * 租户key + */ + private String tenantKey; + + /** + * 创建人id + */ + private Long creator; + + /** + * 是否删除 + */ + private Integer deleteType; + + /** + * 创建时间 + */ + private Date createTime; + + /** + * 更新时间 + */ + private Date updateTime; + + + + private Collection taxAgentIds; + + +} diff --git a/src/com/engine/salary/entity/taxagent/po/TaxAgentBasePO.java b/src/com/engine/salary/entity/taxagent/po/TaxAgentBasePO.java new file mode 100644 index 000000000..db260f0d8 --- /dev/null +++ b/src/com/engine/salary/entity/taxagent/po/TaxAgentBasePO.java @@ -0,0 +1,56 @@ +package com.engine.salary.entity.taxagent.po; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.Date; + +/** + * @Description: 个税扣缴义务人基础信息 + * @Author: wangxiangzhong + * @Date: 2022/3/21 9:33 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +//hrsa_tax_agent_base") +public class TaxAgentBasePO { + + /** + * 主键id + */ + private Long id; + + /** + * 分权开关 + */ + private Integer devolutionStatus; + + /** + * 租户key + */ + private String tenantKey; + + /** + * 创建人id + */ + private Long creator; + + /** + * 是否删除 + */ + private Integer deleteType; + + /** + * 创建时间 + */ + private Date createTime; + + /** + * 更新时间 + */ + private Date updateTime; +} diff --git a/src/com/engine/salary/entity/taxagent/po/TaxAgentEmpChangePO.java b/src/com/engine/salary/entity/taxagent/po/TaxAgentEmpChangePO.java new file mode 100644 index 000000000..b61740cdf --- /dev/null +++ b/src/com/engine/salary/entity/taxagent/po/TaxAgentEmpChangePO.java @@ -0,0 +1,82 @@ +package com.engine.salary.entity.taxagent.po; + +import com.engine.salary.enums.taxagent.TaxAgentEmpChangeModuleEnum; +import com.engine.salary.enums.taxagent.TaxAgentEmpChangeTypeEnum; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.Date; + +/** + * @Description: 个税扣缴义务人管理范围的增量人员 + * @Author: wangxiangzhong + * @Date: 2022/3/24 14:44 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +//hrsa_tax_agent_emp_change") +public class TaxAgentEmpChangePO { + + /** + * 主键id + */ + private Long id; + + /** + * 个税扣缴义务人的主键id + */ + private Long taxAgentId; + + /** + * 人员信息表的主键id + */ + private Long employeeId; + + /** + * 人员姓名 + */ + private String employeeName; + + /** + * 增量类型 + * + * @see TaxAgentEmpChangeTypeEnum + */ + private Integer changeType; + + /** + * 增量类型 + * + * @see TaxAgentEmpChangeModuleEnum + */ + private Integer moduleType; + + /** + * 租户key + */ + private String tenantKey; + + /** + * 创建人id + */ + private Long creator; + + /** + * 是否删除 + */ + private Integer deleteType; + + /** + * 创建时间 + */ + private Date createTime; + + /** + * 更新时间 + */ + private Date updateTime; +} diff --git a/src/com/engine/salary/entity/taxagent/po/TaxAgentEmpPO.java b/src/com/engine/salary/entity/taxagent/po/TaxAgentEmpPO.java new file mode 100644 index 000000000..4c7dc5923 --- /dev/null +++ b/src/com/engine/salary/entity/taxagent/po/TaxAgentEmpPO.java @@ -0,0 +1,69 @@ +package com.engine.salary.entity.taxagent.po; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.Collection; +import java.util.Date; + +/** + * @Description: 个税扣缴义务人管理范围的人员 + * @Author: wangxiangzhong + * @Date: 2022/3/24 14:44 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +//hrsa_tax_agent_emp", autoResultMap = true) +public class TaxAgentEmpPO { + + /** + * 主键id + */ + private Long id; + + /** + * 个税扣缴义务人的主键id + */ + private Long taxAgentId; + + /** + * 人员信息表的主键id + */ + private Long employeeId; + + /** + * 人员姓名 + */ + private String employeeName; + + /** + * 租户key + */ + private String tenantKey; + + /** + * 创建人id + */ + private Long creator; + + /** + * 是否删除 + */ + private Integer deleteType; + + /** + * 创建时间 + */ + private Date createTime; + + /** + * 更新时间 + */ + private Date updateTime; + + private Collection taxAgentIds; +} diff --git a/src/com/engine/salary/entity/taxagent/po/TaxAgentEmployeePO.java b/src/com/engine/salary/entity/taxagent/po/TaxAgentEmployeePO.java new file mode 100644 index 000000000..f7f5c0e98 --- /dev/null +++ b/src/com/engine/salary/entity/taxagent/po/TaxAgentEmployeePO.java @@ -0,0 +1,33 @@ +package com.engine.salary.entity.taxagent.po; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @Description: 员工基本信息 + * @Author: wangxiangzhong + * @Date: 2022/2/10 16:25 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class TaxAgentEmployeePO { + + //员工id") + private Long employeeId; + + //姓名") + private String username; + + //部门") + private String deparmentName; + + //状态") + private String status; + + //人事状态") + private String personnelStatus; +} diff --git a/src/com/engine/salary/entity/taxagent/po/TaxAgentManageRangePO.java b/src/com/engine/salary/entity/taxagent/po/TaxAgentManageRangePO.java new file mode 100644 index 000000000..cfbd8c0ca --- /dev/null +++ b/src/com/engine/salary/entity/taxagent/po/TaxAgentManageRangePO.java @@ -0,0 +1,94 @@ +package com.engine.salary.entity.taxagent.po; + +import com.engine.salary.enums.salarysob.TargetTypeEnum; +import com.engine.salary.enums.taxagent.TaxAgentRangeTypeEnum; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.Collection; +import java.util.Date; + +/** + * @Description: 个税扣缴义务人的管理范围表 + * @Author: wangxiangzhong + * @Date: 2022/3/23 15:41 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +//hrsa_tax_agent_manage_range +public class TaxAgentManageRangePO { + + /** + * 主键id + */ + private Long id; + + /** + * 分管理员的id + */ + private Long taxAgentSubAdminId; + + /** + * 个税扣缴义务人的主键id + */ + private Long taxAgentId; + + /** + * 范围类型 + * @see TaxAgentRangeTypeEnum + */ + private Integer rangeType; + + /** + * 对象类型 + * @see TargetTypeEnum + */ + private Integer targetType; + + /** + * 对象id + */ + private Long targetId; + + /** + * 人员状态 + */ + private String employeeStatus; + + /** + * 是包含还是排除 0:排除、1:包含 + */ + private Integer includeType; + + /** + * 租户key + */ + private String tenantKey; + + /** + * 创建人id + */ + private Long creator; + + /** + * 是否删除 + */ + private Integer deleteType; + + /** + * 创建时间 + */ + private Date createTime; + + /** + * 更新时间 + */ + private Date updateTime; + + + private Collection taxAgentIds; +} diff --git a/src/com/engine/salary/entity/taxagent/po/TaxAgentPO.java b/src/com/engine/salary/entity/taxagent/po/TaxAgentPO.java new file mode 100644 index 000000000..0e872326a --- /dev/null +++ b/src/com/engine/salary/entity/taxagent/po/TaxAgentPO.java @@ -0,0 +1,67 @@ +package com.engine.salary.entity.taxagent.po; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.Date; + +/** + * @Description: 个税扣缴义务人 + * @Author: wangxiangzhong + * @Date: 2021/10/29 11:14 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +//hrsa_tax_agent") +//个税扣缴义务人表") +public class TaxAgentPO { + + /** + * 主键id + */ + private Long id; + + /** + * 名称 + */ + private String name; + + /** + * 代缴机构 + */ + private String paymentAgency; + + /** + * 备注 + */ + private String description; + + /** + * 租户key + */ + private String tenantKey; + + /** + * 创建人id + */ + private Long creator; + + /** + * 是否删除 + */ + private Integer deleteType; + + /** + * 创建时间 + */ + private Date createTime; + + /** + * 更新时间 + */ + private Date updateTime; +} diff --git a/src/com/engine/salary/entity/taxagent/po/TaxAgentSubAdminEmpPO.java b/src/com/engine/salary/entity/taxagent/po/TaxAgentSubAdminEmpPO.java new file mode 100644 index 000000000..3f3c21754 --- /dev/null +++ b/src/com/engine/salary/entity/taxagent/po/TaxAgentSubAdminEmpPO.java @@ -0,0 +1,71 @@ +package com.engine.salary.entity.taxagent.po; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.Date; + +/** + * @Description: 个税扣缴义务人管理范围的人员 + * @Author: wangxiangzhong + * @Date: 2022/3/24 14:44 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +//hrsa_tax_agent_sub_admin_emp", autoResultMap = true) +public class TaxAgentSubAdminEmpPO { + + /** + * 主键id + */ + private Long id; + + /** + * 个税扣缴义务人的主键id + */ + private Long taxAgentId; + + /** + * 分管理员的id + */ + private Long taxAgentSubAdminId; + + /** + * 人员信息表的主键id + */ + private Long employeeId; + + /** + * 人员姓名 + */ + private String employeeName; + + /** + * 租户key + */ + private String tenantKey; + + /** + * 创建人id + */ + private Long creator; + + /** + * 是否删除 + */ + private Integer deleteType; + + /** + * 创建时间 + */ + private Date createTime; + + /** + * 更新时间 + */ + private Date updateTime; +} diff --git a/src/com/engine/salary/entity/taxagent/po/TaxAgentSubAdminPO.java b/src/com/engine/salary/entity/taxagent/po/TaxAgentSubAdminPO.java new file mode 100644 index 000000000..7f94e47a3 --- /dev/null +++ b/src/com/engine/salary/entity/taxagent/po/TaxAgentSubAdminPO.java @@ -0,0 +1,67 @@ +package com.engine.salary.entity.taxagent.po; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.Date; + +/** + * @Description: 个税扣缴义务人分管理员 + * @Author: wangxiangzhong + * @Date: 2022/3/21 13:16 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +//hrsa_tax_agent_sub_admin") +//个税扣缴义务人分管理员") +public class TaxAgentSubAdminPO { + + /** + * 主键id + */ + private Long id; + + /** + * 个税扣缴义务人的主键id + */ + private Long taxAgentId; + + /** + * 人员信息表的主键id + */ + private Long employeeId; + + /** + * 备注 + */ + private String remark; + + /** + * 租户key + */ + private String tenantKey; + + /** + * 创建人id + */ + private Long creator; + + /** + * 是否删除 + */ + private Integer deleteType; + + /** + * 创建时间 + */ + private Date createTime; + + /** + * 更新时间 + */ + private Date updateTime; +} diff --git a/src/com/engine/salary/enums/SalaryJobFlagEnum.java b/src/com/engine/salary/enums/SalaryJobFlagEnum.java new file mode 100644 index 000000000..6309c0b74 --- /dev/null +++ b/src/com/engine/salary/enums/SalaryJobFlagEnum.java @@ -0,0 +1,31 @@ +package com.engine.salary.enums; + +/** + * 个税扣缴义务人角色类型 + *

Copyright: Copyright (c) 2022

+ *

Company: 泛微软件

+ * + * @author qiantao + * @version 1.0 + **/ +public enum SalaryJobFlagEnum { + normal("normal", "在职"), + unavailable("unavailable", "非在职"); + + private String value; + + private String defaultLabel; + + SalaryJobFlagEnum(String value, String defaultLabel) { + this.value = value; + this.defaultLabel = defaultLabel; + } + + public String getValue() { + return value; + } + + public String getDefaultLabel() { + return defaultLabel; + } +} diff --git a/src/com/engine/salary/enums/salarysob/TargetTypeEnum.java b/src/com/engine/salary/enums/salarysob/TargetTypeEnum.java index 961865c72..dc006785a 100644 --- a/src/com/engine/salary/enums/salarysob/TargetTypeEnum.java +++ b/src/com/engine/salary/enums/salarysob/TargetTypeEnum.java @@ -16,9 +16,10 @@ import java.util.Objects; public enum TargetTypeEnum implements BaseEnum { EMPLOYEE(1, "人员", 100133), DEPT(2, "部门", 86185), + SUBCOMPANY(3, "分部", 107369), POSITION(4, "岗位", 90633), - ; - + ALL(5, "所有人", 107729), + EXT_EMPLOYEE(100, "外部人员", 0); private int value; private String defaultLabel; diff --git a/src/com/engine/salary/enums/taxagent/TaxAgentEmpChangeModuleEnum.java b/src/com/engine/salary/enums/taxagent/TaxAgentEmpChangeModuleEnum.java new file mode 100644 index 000000000..b1edea29d --- /dev/null +++ b/src/com/engine/salary/enums/taxagent/TaxAgentEmpChangeModuleEnum.java @@ -0,0 +1,32 @@ +package com.engine.salary.enums.taxagent; + +/** + * 模块类型 + *

Copyright: Copyright (c) 2022

+ *

Company: 泛微软件

+ * + * @author qiantao + * @version 1.0 + **/ +public enum TaxAgentEmpChangeModuleEnum { + + SALARY_ARCHIVE(1, "薪资档案"), + INSURANCE_ARCHIVE(2, "社保档案"); + + private int value; + + private String defaultLabel; + + TaxAgentEmpChangeModuleEnum(int value, String defaultLabel) { + this.value = value; + this.defaultLabel = defaultLabel; + } + + public int getValue() { + return value; + } + + public String getDefaultLabel() { + return defaultLabel; + } +} diff --git a/src/com/engine/salary/enums/taxagent/TaxAgentEmpChangeTypeEnum.java b/src/com/engine/salary/enums/taxagent/TaxAgentEmpChangeTypeEnum.java new file mode 100644 index 000000000..562439e76 --- /dev/null +++ b/src/com/engine/salary/enums/taxagent/TaxAgentEmpChangeTypeEnum.java @@ -0,0 +1,29 @@ +package com.engine.salary.enums.taxagent; + +/** + * @Description: 增量类型 + * @Author: wangxiangzhong + * @Date: 2021-11-17 14:37 + */ +public enum TaxAgentEmpChangeTypeEnum { + + ADD(1, "新增"), + DEL(2, "删除"); + + private int value; + + private String defaultLabel; + + TaxAgentEmpChangeTypeEnum(int value, String defaultLabel) { + this.value = value; + this.defaultLabel = defaultLabel; + } + + public int getValue() { + return value; + } + + public String getDefaultLabel() { + return defaultLabel; + } +} diff --git a/src/com/engine/salary/enums/taxagent/TaxAgentRangeTypeEnum.java b/src/com/engine/salary/enums/taxagent/TaxAgentRangeTypeEnum.java new file mode 100644 index 000000000..b9355967b --- /dev/null +++ b/src/com/engine/salary/enums/taxagent/TaxAgentRangeTypeEnum.java @@ -0,0 +1,46 @@ +package com.engine.salary.enums.taxagent; + +import com.weaver.hrm.salary.util.SalaryI18nUtil; + +import java.util.Arrays; +import java.util.Optional; + +/** + * @Description: 范围类型 + * @Author: wangxiangzhong + * @Date: 2021-11-17 14:37 + */ +public enum TaxAgentRangeTypeEnum { + + TAXAGENT(1, "个税扣缴义务人", 86184), + SUBADMIN(2, "分管理员", 106283); + + private int value; + + private String defaultLabel; + + private int labelId; + + TaxAgentRangeTypeEnum(int value, String defaultLabel, int labelId) { + this.value = value; + this.defaultLabel = defaultLabel; + this.labelId = labelId; + } + + public int getValue() { + return value; + } + + public String getDefaultLabel() { + return defaultLabel; + } + + public int getLabelId() { + return labelId; + } + + public static String getDefaultLabelByValue(Integer value, Long employeeId, String tenantKey) { + Optional optional = Arrays.stream(TaxAgentRangeTypeEnum.values()).filter(r->Integer.valueOf(r.getValue()).equals(value)).findFirst(); + return optional.isPresent()?SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, optional.get().getLabelId(), optional.get().getDefaultLabel()):""; + } +} diff --git a/src/com/engine/salary/enums/taxagent/TaxAgentRoleTypeEnum.java b/src/com/engine/salary/enums/taxagent/TaxAgentRoleTypeEnum.java new file mode 100644 index 000000000..f5cde5746 --- /dev/null +++ b/src/com/engine/salary/enums/taxagent/TaxAgentRoleTypeEnum.java @@ -0,0 +1,31 @@ +package com.engine.salary.enums.taxagent; + +/** + * @Description: 个税扣缴义务人角色类型 + * @Author: wangxiangzhong + * @Date: 2022-04-22 14:37 + */ +public enum TaxAgentRoleTypeEnum { + + CHIEF(0, "总管理员"), + ADMIN(1, "管理员"), + SUBADMIN(2, "分管理员"), + NONE(3, "其他"); + + private int value; + + private String defaultLabel; + + TaxAgentRoleTypeEnum(int value, String defaultLabel) { + this.value = value; + this.defaultLabel = defaultLabel; + } + + public int getValue() { + return value; + } + + public String getDefaultLabel() { + return defaultLabel; + } +} diff --git a/src/com/engine/salary/mapper/datacollection/EmployMapper.java b/src/com/engine/salary/mapper/datacollection/EmployMapper.java index 658a32c26..39e00fc10 100644 --- a/src/com/engine/salary/mapper/datacollection/EmployMapper.java +++ b/src/com/engine/salary/mapper/datacollection/EmployMapper.java @@ -36,4 +36,6 @@ public interface EmployMapper { List listByParams(@Param("params") Collection queryParams); DataCollectionEmployee getEmployeeById(Long employeeId); + + List listAll(); } \ No newline at end of file diff --git a/src/com/engine/salary/mapper/datacollection/EmployMapper.xml b/src/com/engine/salary/mapper/datacollection/EmployMapper.xml index 832152b2e..d1ac649b8 100644 --- a/src/com/engine/salary/mapper/datacollection/EmployMapper.xml +++ b/src/com/engine/salary/mapper/datacollection/EmployMapper.xml @@ -184,4 +184,25 @@ + + + \ No newline at end of file diff --git a/src/com/engine/salary/mapper/taxagent/TaxAgentAdminMapper.java b/src/com/engine/salary/mapper/taxagent/TaxAgentAdminMapper.java new file mode 100644 index 000000000..ebd54d390 --- /dev/null +++ b/src/com/engine/salary/mapper/taxagent/TaxAgentAdminMapper.java @@ -0,0 +1,67 @@ +package com.engine.salary.mapper.taxagent; + +import com.engine.salary.entity.taxagent.po.TaxAgentAdminPO; +import org.apache.ibatis.annotations.Param; + +import java.util.Collection; +import java.util.List; + +public interface TaxAgentAdminMapper { + + /** + * 查询所有记录 + * + * @return 返回集合,没有返回空List + */ + List listAll(); + + + /** + * 根据主键查询 + * + * @param id 主键 + * @return 返回记录,没有返回null + */ + TaxAgentAdminPO getById(Long id); + + /** + * 条件查询 + * + * @return 返回集合,没有返回空List + */ + List listSome(TaxAgentAdminPO taxAgentAdmin); + + /** + * 新增,忽略null字段 + * + * @param TaxAgentAdminPO 新增的记录 + * @return 返回影响行数 + */ + int insertIgnoreNull(TaxAgentAdminPO TaxAgentAdminPO); + + /** + * 修改,修改所有字段 + * + * @param TaxAgentAdminPO 修改的记录 + * @return 返回影响行数 + */ + int update(TaxAgentAdminPO TaxAgentAdminPO); + + /** + * 修改,忽略null字段 + * + * @param TaxAgentAdminPO 修改的记录 + * @return 返回影响行数 + */ + int updateIgnoreNull(TaxAgentAdminPO TaxAgentAdminPO); + + /** + * 删除记录 + * + * @param TaxAgentAdminPO 待删除的记录 + * @return 返回影响行数 + */ + int delete(TaxAgentAdminPO TaxAgentAdminPO); + + void deleteByTaxAgentIds(@Param("taxAgentIds") Collection taxAgentIds); +} \ No newline at end of file diff --git a/src/com/engine/salary/mapper/taxagent/TaxAgentAdminMapper.xml b/src/com/engine/salary/mapper/taxagent/TaxAgentAdminMapper.xml new file mode 100644 index 000000000..ad3e4b720 --- /dev/null +++ b/src/com/engine/salary/mapper/taxagent/TaxAgentAdminMapper.xml @@ -0,0 +1,209 @@ + + + + + + + + + + + + + + + + + t + . + create_time + , t.creator + , t.delete_type + , t.employee_id + , t.id + , t.tax_agent_id + , t.tenant_key + , t.update_time + + + + + + + + + + + + + + + INSERT INTO hrsa_tax_agent_admin + + + + create_time, + + + creator, + + + delete_type, + + + employee_id, + + + id, + + + tax_agent_id, + + + tenant_key, + + + update_time, + + + + + #{createTime}, + + + #{creator}, + + + #{deleteType}, + + + #{employeeId}, + + + #{id}, + + + #{taxAgentId}, + + + #{tenantKey}, + + + #{updateTime}, + + + + + + + UPDATE hrsa_tax_agent_admin + + create_time=#{createTime}, + creator=#{creator}, + delete_type=#{deleteType}, + employee_id=#{employeeId}, + tax_agent_id=#{taxAgentId}, + tenant_key=#{tenantKey}, + update_time=#{updateTime}, + + WHERE id = #{id} AND delete_type = 0 + + + + + + UPDATE hrsa_tax_agent_admin + + + create_time=#{createTime}, + + + creator=#{creator}, + + + delete_type=#{deleteType}, + + + employee_id=#{employeeId}, + + + tax_agent_id=#{taxAgentId}, + + + tenant_key=#{tenantKey}, + + + update_time=#{updateTime}, + + + WHERE id = #{id} AND delete_type = 0 + + + + + + UPDATE hrsa_tax_agent_admin + SET delete_type=1 + WHERE id = #{id} + AND delete_type = 0 + + + + + UPDATE hrsa_tax_agent_admin + SET delete_type=1 + WHERE delete_type = 0 + AND tax_agent_id IN + + #{taxAgentId} + + + + \ No newline at end of file diff --git a/src/com/engine/salary/mapper/taxagent/TaxAgentBaseMapper.java b/src/com/engine/salary/mapper/taxagent/TaxAgentBaseMapper.java new file mode 100644 index 000000000..e34dccc33 --- /dev/null +++ b/src/com/engine/salary/mapper/taxagent/TaxAgentBaseMapper.java @@ -0,0 +1,68 @@ +package com.engine.salary.mapper.taxagent; + +import com.engine.salary.entity.taxagent.po.TaxAgentBasePO; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +@Mapper +public interface TaxAgentBaseMapper { + + /** + * 查询所有记录 + * + * @return 返回集合,没有返回空List + */ + List listAll(); + + + /** + * 根据主键查询 + * + * @param id 主键 + * @return 返回记录,没有返回null + */ + TaxAgentBasePO getById(Long id); + + + + /** + * 条件查询 + * + * @return 返回集合,没有返回空List + */ + List listSome(TaxAgentBasePO taxAgentBase); + + /** + * 新增,忽略null字段 + * + * @param taxAgentBase 新增的记录 + * @return 返回影响行数 + */ + int insertIgnoreNull(TaxAgentBasePO taxAgentBase); + + /** + * 修改,修改所有字段 + * + * @param taxAgentBase 修改的记录 + * @return 返回影响行数 + */ + int update(TaxAgentBasePO taxAgentBase); + + /** + * 修改,忽略null字段 + * + * @param taxAgentBase 修改的记录 + * @return 返回影响行数 + */ + int updateIgnoreNull(TaxAgentBasePO taxAgentBase); + + /** + * 删除记录 + * + * @param taxAgentBase 待删除的记录 + * @return 返回影响行数 + */ + int delete(TaxAgentBasePO taxAgentBase); + +} \ No newline at end of file diff --git a/src/com/engine/salary/mapper/taxagent/TaxAgentBaseMapper.xml b/src/com/engine/salary/mapper/taxagent/TaxAgentBaseMapper.xml new file mode 100644 index 000000000..0d2cee524 --- /dev/null +++ b/src/com/engine/salary/mapper/taxagent/TaxAgentBaseMapper.xml @@ -0,0 +1,180 @@ + + + + + + + + + + + + + + + + t.create_time + , t.creator + , t.delete_type + , t.devolution_status + , t.id + , t.tenant_key + , t.update_time + + + + + + + + + + + + + + + INSERT INTO hrsa_tax_agent_base + + + + create_time, + + + creator, + + + delete_type, + + + devolution_status, + + + id, + + + tenant_key, + + + update_time, + + + + + #{createTime}, + + + #{creator}, + + + #{deleteType}, + + + #{devolutionStatus}, + + + #{id}, + + + #{tenantKey}, + + + #{updateTime}, + + + + + + + UPDATE hrsa_tax_agent_base + + create_time=#{createTime}, + creator=#{creator}, + delete_type=#{deleteType}, + devolution_status=#{devolutionStatus}, + tenant_key=#{tenantKey}, + update_time=#{updateTime}, + + WHERE id = #{id} AND delete_type = 0 + + + + + + UPDATE hrsa_tax_agent_base + + + create_time=#{createTime}, + + + creator=#{creator}, + + + delete_type=#{deleteType}, + + + devolution_status=#{devolutionStatus}, + + + tenant_key=#{tenantKey}, + + + update_time=#{updateTime}, + + + WHERE id = #{id} AND delete_type = 0 + + + + + + UPDATE hrsa_tax_agent_base + SET delete_type=1 + WHERE id = #{id} AND delete_type = 0 + + + + \ No newline at end of file diff --git a/src/com/engine/salary/mapper/taxagent/TaxAgentEmpChangeMapper.java b/src/com/engine/salary/mapper/taxagent/TaxAgentEmpChangeMapper.java new file mode 100644 index 000000000..3e3616e80 --- /dev/null +++ b/src/com/engine/salary/mapper/taxagent/TaxAgentEmpChangeMapper.java @@ -0,0 +1,77 @@ +package com.engine.salary.mapper.taxagent; + +import com.engine.salary.entity.taxagent.po.TaxAgentEmpChangePO; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.Collection; +import java.util.List; + +@Mapper +public interface TaxAgentEmpChangeMapper { + + /** + * 查询所有记录 + * + * @return 返回集合,没有返回空List + */ + List listAll(); + + + /** + * 根据主键查询 + * + * @param id 主键 + * @return 返回记录,没有返回null + */ + TaxAgentEmpChangePO getById(Long id); + + + /** + * 条件查询 + * + * @return 返回集合,没有返回空List + */ + List listSome(TaxAgentEmpChangePO taxAgentEmpChange); + + /** + * 新增,忽略null字段 + * + * @param taxAgentEmpChange 新增的记录 + * @return 返回影响行数 + */ + int insertIgnoreNull(TaxAgentEmpChangePO taxAgentEmpChange); + + /** + * 修改,修改所有字段 + * + * @param taxAgentEmpChange 修改的记录 + * @return 返回影响行数 + */ + int update(TaxAgentEmpChangePO taxAgentEmpChange); + + /** + * 修改,忽略null字段 + * + * @param taxAgentEmpChange 修改的记录 + * @return 返回影响行数 + */ + int updateIgnoreNull(TaxAgentEmpChangePO taxAgentEmpChange); + + /** + * 删除记录 + * + * @param taxAgentEmpChange 待删除的记录 + * @return 返回影响行数 + */ + int delete(TaxAgentEmpChangePO taxAgentEmpChange); + + void deleteByIds(@Param("ids") Collection ids); + + /** + * 批量插入 + * + * @param saves + */ + void batchInsert(@Param("collection") List saves); +} \ No newline at end of file diff --git a/src/com/engine/salary/mapper/taxagent/TaxAgentEmpChangeMapper.xml b/src/com/engine/salary/mapper/taxagent/TaxAgentEmpChangeMapper.xml new file mode 100644 index 000000000..65fb07266 --- /dev/null +++ b/src/com/engine/salary/mapper/taxagent/TaxAgentEmpChangeMapper.xml @@ -0,0 +1,344 @@ + + + + + + + + + + + + + + + + + + + + t + . + change_type + , t.create_time + , t.creator + , t.delete_type + , t.employee_id + , t.employee_name + , t.id + , t.module_type + , t.tax_agent_id + , t.tenant_key + , t.update_time + + + + + + + + + + + + + + + INSERT INTO hrsa_tax_agent_emp_change + + + + change_type, + + + create_time, + + + creator, + + + delete_type, + + + employee_id, + + + employee_name, + + + id, + + + module_type, + + + tax_agent_id, + + + tenant_key, + + + update_time, + + + + + #{changeType}, + + + #{createTime}, + + + #{creator}, + + + #{deleteType}, + + + #{employeeId}, + + + #{employeeName}, + + + #{id}, + + + #{moduleType}, + + + #{taxAgentId}, + + + #{tenantKey}, + + + #{updateTime}, + + + + + + + UPDATE hrsa_tax_agent_emp_change + + change_type=#{changeType}, + create_time=#{createTime}, + creator=#{creator}, + delete_type=#{deleteType}, + employee_id=#{employeeId}, + employee_name=#{employeeName}, + module_type=#{moduleType}, + tax_agent_id=#{taxAgentId}, + tenant_key=#{tenantKey}, + update_time=#{updateTime}, + + WHERE id = #{id} AND delete_type = 0 + + + + + + UPDATE hrsa_tax_agent_emp_change + + + change_type=#{changeType}, + + + create_time=#{createTime}, + + + creator=#{creator}, + + + delete_type=#{deleteType}, + + + employee_id=#{employeeId}, + + + employee_name=#{employeeName}, + + + module_type=#{moduleType}, + + + tax_agent_id=#{taxAgentId}, + + + tenant_key=#{tenantKey}, + + + update_time=#{updateTime}, + + + WHERE id = #{id} AND delete_type = 0 + + + + + + UPDATE hrsa_tax_agent_emp_change + SET delete_type=1 + WHERE id = #{id} + AND delete_type = 0 + + + + UPDATE hrsa_tax_agent_emp_change + SET delete_type=1 + WHERE delete_type = 0 + AND id IN + + #{id} + + + + + + INSERT INTO hrsa_tax_agent_emp_change( + id, + employee_id, + tax_agent_id, + employee_name, + change_type, + module_type, + create_time, + update_time, + creator, + tenant_key + ) + VALUES + + ( + #{item.id}, + #{item.employeeId}, + #{item.taxAgentId}, + #{item.employeeName}, + #{item.changeType}, + #{item.moduleType}, + #{item.createTime}, + #{item.updateTime}, + #{item.creator}, + #{item.tenantKey} + ) + + + + INSERT INTO hrsa_tax_agent_emp_change( + id, + employee_id, + tax_agent_id, + employee_name, + change_type, + module_type, + create_time, + update_time, + creator, + tenant_key + ) + + + select + #{item.id}, + #{item.employeeId}, + #{item.taxAgentId}, + #{item.employeeName}, + #{item.changeType}, + #{item.moduleType}, + #{item.createTime}, + #{item.updateTime}, + #{item.creator}, + #{item.tenantKey} + from dual + + + + + INSERT INTO hrsa_tax_agent_emp_change( + id, + employee_id, + tax_agent_id, + employee_name, + change_type, + module_type, + create_time, + update_time, + creator, + tenant_key + ) + VALUES + ( + #{item.id}, + #{item.employeeId}, + #{item.taxAgentId}, + #{item.employeeName}, + #{item.changeType}, + #{item.moduleType}, + #{item.operator}, + #{item.createTime}, + #{item.updateTime}, + #{item.creator}, + #{item.tenantKey} + ) + + + + \ No newline at end of file diff --git a/src/com/engine/salary/mapper/taxagent/TaxAgentEmpMapper.java b/src/com/engine/salary/mapper/taxagent/TaxAgentEmpMapper.java new file mode 100644 index 000000000..a885e3844 --- /dev/null +++ b/src/com/engine/salary/mapper/taxagent/TaxAgentEmpMapper.java @@ -0,0 +1,78 @@ +package com.engine.salary.mapper.taxagent; + +import com.engine.salary.entity.taxagent.po.TaxAgentEmpPO; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.Collection; +import java.util.List; + +@Mapper +public interface TaxAgentEmpMapper { + + /** + * 查询所有记录 + * + * @return 返回集合,没有返回空List + */ + List listAll(); + + + /** + * 根据主键查询 + * + * @param id 主键 + * @return 返回记录,没有返回null + */ + TaxAgentEmpPO getById(Long id); + + + /** + * 条件查询 + * + * @return 返回集合,没有返回空List + */ + List listSome(TaxAgentEmpPO taxAgentEmp); + + /** + * 新增,忽略null字段 + * + * @param taxAgentEmp 新增的记录 + * @return 返回影响行数 + */ + int insertIgnoreNull(TaxAgentEmpPO taxAgentEmp); + + /** + * 修改,修改所有字段 + * + * @param taxAgentEmp 修改的记录 + * @return 返回影响行数 + */ + int update(TaxAgentEmpPO taxAgentEmp); + + /** + * 修改,忽略null字段 + * + * @param taxAgentEmp 修改的记录 + * @return 返回影响行数 + */ + int updateIgnoreNull(TaxAgentEmpPO taxAgentEmp); + + /** + * 删除记录 + * + * @param taxAgentEmp 待删除的记录 + * @return 返回影响行数 + */ + int delete(TaxAgentEmpPO taxAgentEmp); + + void deleteByIds(@Param("ids") Collection ids); + + /** + * 批量插入 + * + * @param saves + */ + void batchInsert(@Param("collection") List saves); + +} \ No newline at end of file diff --git a/src/com/engine/salary/mapper/taxagent/TaxAgentEmpMapper.xml b/src/com/engine/salary/mapper/taxagent/TaxAgentEmpMapper.xml new file mode 100644 index 000000000..68d2bd744 --- /dev/null +++ b/src/com/engine/salary/mapper/taxagent/TaxAgentEmpMapper.xml @@ -0,0 +1,297 @@ + + + + + + + + + + + + + + + + + + t.create_time + , t.creator + , t.delete_type + , t.employee_id + , t.employee_name + , t.id + , t.tax_agent_id + , t.tenant_key + , t.update_time + + + + + + + + + + + + + + + INSERT INTO hrsa_tax_agent_emp + + + + create_time, + + + creator, + + + delete_type, + + + employee_id, + + + employee_name, + + + id, + + + tax_agent_id, + + + tenant_key, + + + update_time, + + + + + #{createTime}, + + + #{creator}, + + + #{deleteType}, + + + #{employeeId}, + + + #{employeeName}, + + + #{id}, + + + #{taxAgentId}, + + + #{tenantKey}, + + + #{updateTime}, + + + + + + + UPDATE hrsa_tax_agent_emp + + create_time=#{createTime}, + creator=#{creator}, + delete_type=#{deleteType}, + employee_id=#{employeeId}, + employee_name=#{employeeName}, + tax_agent_id=#{taxAgentId}, + tenant_key=#{tenantKey}, + update_time=#{updateTime}, + + WHERE id = #{id} AND delete_type = 0 + + + + + + UPDATE hrsa_tax_agent_emp + + + create_time=#{createTime}, + + + creator=#{creator}, + + + delete_type=#{deleteType}, + + + employee_id=#{employeeId}, + + + employee_name=#{employeeName}, + + + tax_agent_id=#{taxAgentId}, + + + tenant_key=#{tenantKey}, + + + update_time=#{updateTime}, + + + WHERE id = #{id} AND delete_type = 0 + + + + + + UPDATE hrsa_tax_agent_emp + SET delete_type=1 + WHERE id = #{id} AND delete_type = 0 + + + + UPDATE hrsa_tax_agent_emp + SET delete_type=1 + WHERE delete_type = 0 + AND id IN + + #{id} + + + + + INSERT INTO hrsa_tax_agent_emp( + id, + employee_id, + tax_agent_id, + employee_name, + create_time, + update_time, + creator, + tenant_key + ) + VALUES + + ( + #{item.id}, + #{item.employeeId}, + #{item.taxAgentId}, + #{item.employeeName}, + #{item.createTime}, + #{item.updateTime}, + #{item.creator}, + #{item.tenantKey} + ) + + + + INSERT INTO hrsa_tax_agent_emp( + id, + employee_id, + tax_agent_id, + employee_name, + create_time, + update_time, + creator, + tenant_key + ) + + + select + #{item.id}, + #{item.employeeId}, + #{item.taxAgentId}, + #{item.employeeName}, + #{item.createTime}, + #{item.updateTime}, + #{item.creator}, + #{item.tenantKey} + from dual + + + + + INSERT INTO hrsa_tax_agent_emp( + id, + employee_id, + tax_agent_id, + employee_name, + create_time, + update_time, + creator, + tenant_key + ) + VALUES + ( + #{item.id}, + #{item.employeeId}, + #{item.taxAgentId}, + #{item.employeeName}, + #{item.operator}, + #{item.createTime}, + #{item.updateTime}, + #{item.creator}, + #{item.tenantKey} + ) + + + + + \ No newline at end of file diff --git a/src/com/engine/salary/mapper/taxagent/TaxAgentManageRangeMapper.java b/src/com/engine/salary/mapper/taxagent/TaxAgentManageRangeMapper.java new file mode 100644 index 000000000..1bbeff56e --- /dev/null +++ b/src/com/engine/salary/mapper/taxagent/TaxAgentManageRangeMapper.java @@ -0,0 +1,67 @@ +package com.engine.salary.mapper.taxagent; + +import com.engine.salary.entity.taxagent.po.TaxAgentManageRangePO; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +@Mapper +public interface TaxAgentManageRangeMapper { + + /** + * 查询所有记录 + * + * @return 返回集合,没有返回空List + */ + List listAll(); + + + /** + * 根据主键查询 + * + * @param id 主键 + * @return 返回记录,没有返回null + */ + TaxAgentManageRangePO getById(Long id); + + /** + * 条件查询 + * + * @return 返回集合,没有返回空List + */ + List listSome(TaxAgentManageRangePO taxAgentManageRange); + + + /** + * 新增,忽略null字段 + * + * @param taxAgentManageRange 新增的记录 + * @return 返回影响行数 + */ + int insertIgnoreNull(TaxAgentManageRangePO taxAgentManageRange); + + /** + * 修改,修改所有字段 + * + * @param taxAgentManageRange 修改的记录 + * @return 返回影响行数 + */ + int update(TaxAgentManageRangePO taxAgentManageRange); + + /** + * 修改,忽略null字段 + * + * @param taxAgentManageRange 修改的记录 + * @return 返回影响行数 + */ + int updateIgnoreNull(TaxAgentManageRangePO taxAgentManageRange); + + /** + * 删除记录 + * + * @param taxAgentManageRange 待删除的记录 + * @return 返回影响行数 + */ + int delete(TaxAgentManageRangePO taxAgentManageRange); + +} \ No newline at end of file diff --git a/src/com/engine/salary/mapper/taxagent/TaxAgentManageRangeMapper.xml b/src/com/engine/salary/mapper/taxagent/TaxAgentManageRangeMapper.xml new file mode 100644 index 000000000..46b4ed3da --- /dev/null +++ b/src/com/engine/salary/mapper/taxagent/TaxAgentManageRangeMapper.xml @@ -0,0 +1,285 @@ + + + + + + + + + + + + + + + + + + + + + + + t.create_time + , t.creator + , t.delete_type + , t.employee_id + , t.employee_status + , t.id + , t.include_type + , t.range_type + , t.target_id + , t.target_type + , t.tax_agent_id + , t.tax_agent_sub_admin_id + , t.tenant_key + , t.update_time + + + + + + + + + + + + + + + INSERT INTO hrsa_tax_agent_manage_range + + + + create_time, + + + creator, + + + delete_type, + + + employee_id, + + + employee_status, + + + id, + + + include_type, + + + range_type, + + + target_id, + + + target_type, + + + tax_agent_id, + + + tax_agent_sub_admin_id, + + + tenant_key, + + + update_time, + + + + + #{createTime}, + + + #{creator}, + + + #{deleteType}, + + + #{employeeId}, + + + #{employeeStatus}, + + + #{id}, + + + #{includeType}, + + + #{rangeType}, + + + #{targetId}, + + + #{targetType}, + + + #{taxAgentId}, + + + #{taxAgentSubAdminId}, + + + #{tenantKey}, + + + #{updateTime}, + + + + + + + UPDATE hrsa_tax_agent_manage_range + + create_time=#{createTime}, + creator=#{creator}, + delete_type=#{deleteType}, + employee_id=#{employeeId}, + employee_status=#{employeeStatus}, + include_type=#{includeType}, + range_type=#{rangeType}, + target_id=#{targetId}, + target_type=#{targetType}, + tax_agent_id=#{taxAgentId}, + tax_agent_sub_admin_id=#{taxAgentSubAdminId}, + tenant_key=#{tenantKey}, + update_time=#{updateTime}, + + WHERE id = #{id} AND delete_type = 0 + + + + + + UPDATE hrsa_tax_agent_manage_range + + + create_time=#{createTime}, + + + creator=#{creator}, + + + delete_type=#{deleteType}, + + + employee_id=#{employeeId}, + + + employee_status=#{employeeStatus}, + + + include_type=#{includeType}, + + + range_type=#{rangeType}, + + + target_id=#{targetId}, + + + target_type=#{targetType}, + + + tax_agent_id=#{taxAgentId}, + + + tax_agent_sub_admin_id=#{taxAgentSubAdminId}, + + + tenant_key=#{tenantKey}, + + + update_time=#{updateTime}, + + + WHERE id = #{id} AND delete_type = 0 + + + + + + UPDATE hrsa_tax_agent_manage_range + SET delete_type=1 + WHERE id = #{id} AND delete_type = 0 + + + + \ No newline at end of file diff --git a/src/com/engine/salary/service/SalaryAcctRecordService.java b/src/com/engine/salary/service/SalaryAcctRecordService.java index 146a2f2ab..641e3c357 100644 --- a/src/com/engine/salary/service/SalaryAcctRecordService.java +++ b/src/com/engine/salary/service/SalaryAcctRecordService.java @@ -155,4 +155,12 @@ public interface SalaryAcctRecordService { * @return */ String getLogTargetNameById(Long id); + + /** + * 根据状态查询薪资核算记录 + * + * @param status + * @return + */ + List listByStatus(SalaryAcctRecordStatusEnum status); } diff --git a/src/com/engine/salary/service/TaxAgentAdminService.java b/src/com/engine/salary/service/TaxAgentAdminService.java new file mode 100644 index 000000000..9c370fa98 --- /dev/null +++ b/src/com/engine/salary/service/TaxAgentAdminService.java @@ -0,0 +1,57 @@ +package com.engine.salary.service; + +import com.engine.salary.entity.taxagent.po.TaxAgentAdminPO; + +import java.util.Collection; +import java.util.List; + +/** + * 个税扣缴义务人管理员 + *

Copyright: Copyright (c) 2022

+ *

Company: 泛微软件

+ * + * @author qiantao + * @version 1.0 + **/ +public interface TaxAgentAdminService { + + /** + * 根据个税扣缴义务人id删除管理员 + * + * @param taxAgentIds + */ + void deleteByTaxAgentIds(Collection taxAgentIds); + + /** + * 批量新增管理员 + * + * @param taxAgentId + * @param admins + */ + void batchInsert(Long taxAgentId, Collection admins); + + /** + * 根据个税扣缴义务人id查询管理员 + * + * @param taxAgentIds + * @return + */ + List listByTaxAgentIds(Collection taxAgentIds); + + /** + * 根据个税扣缴义务人id查询管理员 + * + * @param taxAgentIds + * @param currentEmployeeId + * @return + */ + List listByTaxAgentIdsAndEmployeeId(Collection taxAgentIds, Long currentEmployeeId); + + /** + * 根据当前登录人查询管理员 + * + * @param currentEmployeeId + * @return + */ + List listByEmployeeId(Long currentEmployeeId); +} diff --git a/src/com/engine/salary/service/TaxAgentBaseService.java b/src/com/engine/salary/service/TaxAgentBaseService.java new file mode 100644 index 000000000..ab795d52c --- /dev/null +++ b/src/com/engine/salary/service/TaxAgentBaseService.java @@ -0,0 +1,37 @@ +package com.engine.salary.service; + +import com.engine.salary.entity.taxagent.param.TaxAgentSaveBaseParam; +import com.engine.salary.entity.taxagent.po.TaxAgentBasePO; + +/** + * 个税扣缴义务人基础信息 + *

Copyright: Copyright (c) 2022

+ *

Company: 泛微软件

+ * + * @author qiantao + * @version 1.0 + **/ +public interface TaxAgentBaseService { + + /** + * 是否开启分权 + * + * @return + */ + Boolean isOpenDevolution(); + + /** + * 获取个税扣缴义务人基本信息 + * + * @return + */ + TaxAgentBasePO getBaseInfo(); + + /** + * 保存个税扣缴义务人信息 + * + * @param saveBaseParam + * @return + */ + String save(TaxAgentSaveBaseParam saveBaseParam); +} diff --git a/src/com/engine/salary/service/TaxAgentEmpChangeService.java b/src/com/engine/salary/service/TaxAgentEmpChangeService.java new file mode 100644 index 000000000..80a9f67c6 --- /dev/null +++ b/src/com/engine/salary/service/TaxAgentEmpChangeService.java @@ -0,0 +1,39 @@ +package com.engine.salary.service; + +import com.engine.salary.entity.taxagent.po.TaxAgentEmpChangePO; +import com.engine.salary.enums.taxagent.TaxAgentEmpChangeModuleEnum; + +import java.util.Collection; +import java.util.List; + +/** + * 个税扣缴义务人管理范围的增量人员 + *

Copyright: Copyright (c) 2022

+ *

Company: 泛微软件

+ * + * @author qiantao + * @version 1.0 + **/ +public interface TaxAgentEmpChangeService { + + /** + * 获取所有增量数据 + * + */ + List listAll(); + + /** + * 根据模块类型获取所有增量数据 + */ + List listAllByModule(TaxAgentEmpChangeModuleEnum moduleTypeEnum); + + /** + * 删除增量数据 + * + * @param ids + * @return + */ + boolean deleleByIds(Collection ids); + + void batchInsert(List taxAgentEmpChangeList); +} diff --git a/src/com/engine/salary/service/TaxAgentEmpService.java b/src/com/engine/salary/service/TaxAgentEmpService.java new file mode 100644 index 000000000..5edfab2e5 --- /dev/null +++ b/src/com/engine/salary/service/TaxAgentEmpService.java @@ -0,0 +1,43 @@ +package com.engine.salary.service; + +import com.engine.salary.entity.taxagent.param.TaxAgentEmpSaveParam; +import com.engine.salary.entity.taxagent.po.TaxAgentEmpPO; + +import java.util.Collection; +import java.util.List; + +/** + * 个税扣缴义务人管理范围的人员 + *

Copyright: Copyright (c) 2022

+ *

Company: 泛微软件

+ * + * @author qiantao + * @version 1.0 + **/ +public interface TaxAgentEmpService{ + + /** + * 根据个税扣缴义务人id删除管理范围的人员 + * + * @param taxAgentIds + */ + void deleteByTaxAgentIds(Collection taxAgentIds); + + /** + * 根据个税扣缴义务人id获取管理范围中的人员 + * + * @param taxAgentIds + * @param tenantKey + * @return + */ + List listByTaxAgentIds(List taxAgentIds); + + /** + * 同步人员到本地关联表 + * + * @param taxAgentEmpSaveParamList + * @param currentEmployeeId + * @param tenantKey + */ + void syncTaxAgentEmployee(List taxAgentEmpSaveParamList, Long currentEmployeeId); +} diff --git a/src/com/engine/salary/service/TaxAgentManageRangeService.java b/src/com/engine/salary/service/TaxAgentManageRangeService.java new file mode 100644 index 000000000..06e780a00 --- /dev/null +++ b/src/com/engine/salary/service/TaxAgentManageRangeService.java @@ -0,0 +1,118 @@ +package com.engine.salary.service; + +import com.engine.salary.entity.taxagent.dto.TaxAgentManageRangeEmployeeDTO; +import com.engine.salary.entity.taxagent.param.TaxAgentRangeSaveParam; +import com.engine.salary.entity.taxagent.param.TaxAgentSubAdminRangeSaveParam; +import com.engine.salary.enums.salarysob.SalaryEmployeeStatusEnum; + +import java.util.Collection; +import java.util.List; + +/** + * 个税扣缴义务人的管理范围 + *

Copyright: Copyright (c) 2022

+ *

Company: 泛微软件

+ * + * @author qiantao + * @version 1.0 + **/ +public interface TaxAgentManageRangeService { + + /** + * 根据个税扣缴义务人ID和当前账户查询人员 + * + * @param taxAgentIds + * @return + */ + List listSalaryEmployeeByTaxAgentIds(List taxAgentIds); + + /** + * 根据人员状态、个税扣缴义务人ID和当前账户查询人员 + * + * @param employeeStatus + * @param taxAgentIds + * @return + */ + List listSalaryEmployeeByTaxAgentIds(SalaryEmployeeStatusEnum employeeStatus, List taxAgentIds); + + /** + * 根据分管理员ID和当前账户查询人员 + * + * @param taxAgentSubAdminIds + * @return + */ + List listSalaryEmployeeBySubAdminIds(List taxAgentSubAdminIds); + + /** + * 根据人员状态、分管理员ID和当前账户查询人员 + * + * @param employeeStatus + * @param taxAgentSubAdminIds + * @return + */ +// List listSalaryEmployeeBySubAdminIds(SalaryEmployeeStatusEnum employeeStatus, List taxAgentSubAdminIds); + + /** + * 根据查询条件查询分管理员的人员范围 + * + * @param queryParam 查询条件 + * @param includeType 0-从范围中排除/1-关联人员范围 + * @return + */ +// Page listPageByParamAndIncludeType(TaxAgentSubAdminRangeQueryParam queryParam, Integer includeType); + + /** + * 根据查询条件查询个税扣缴义务人的人员范围 + * + * @param queryParam 查询条件 + * @param includeType 0-从范围中排除/1-关联人员范围 + * @return + */ +// PageInfo listPageByParamAndIncludeType(TaxAgentRangeQueryParam queryParam, Integer includeType); + + /** + * 根据分管理员id集合查询范围列表 + * + * @param taxAgentSubAdminIds + * @return + */ +// List listBySubAdminIds(Collection taxAgentSubAdminIds); + + /** + * 保存 + * + * @param saveParam 保存参数 + * @param employeeId 人员id + */ + void save(TaxAgentRangeSaveParam saveParam, Long employeeId); + + /** + * 保存分管理员的管理范围 + * + * @param saveParam + * @param employeeId + */ + void save4SubAdmin(TaxAgentSubAdminRangeSaveParam saveParam, Long employeeId); + + /** + * 根据主键id删除管理范围 + * + * @param ids + * @param employeeId + */ + void deleteByIds(Collection ids, Long employeeId); + + /** + * 根据个税扣缴义务人的id删除管理范围 + * + * @param taxAgentIds 个税扣缴义务人的id + */ + void deleteByTaxAgentIds(Collection taxAgentIds); + + /** + * 根据分管理员的id删除管理范围 + * + * @param subAdminIds 分管理员列表 + */ + void deleteBySubAdmins(Collection subAdminIds); +} diff --git a/src/com/engine/salary/service/TaxAgentService.java b/src/com/engine/salary/service/TaxAgentService.java index cc6776731..e2513973b 100644 --- a/src/com/engine/salary/service/TaxAgentService.java +++ b/src/com/engine/salary/service/TaxAgentService.java @@ -1,9 +1,19 @@ package com.engine.salary.service; -import com.engine.salary.entity.salaryarchive.po.TaxAgentPO; +import com.engine.salary.entity.taxagent.dto.TaxAgentEmployeeDTO; +import com.engine.salary.entity.taxagent.dto.TaxAgentEmployeeTaxAgentDTO; +import com.engine.salary.entity.taxagent.dto.TaxAgentListDTO; +import com.engine.salary.entity.taxagent.dto.TaxAgentManageRangeEmployeeDTO; +import com.engine.salary.entity.taxagent.param.TaxAgentAdminChangeCheckParam; +import com.engine.salary.entity.taxagent.param.TaxAgentQueryParam; +import com.engine.salary.entity.taxagent.param.TaxAgentSaveParam; +import com.engine.salary.entity.taxagent.po.TaxAgentPO; import com.engine.salary.entity.taxrate.TaxAgent; +import com.engine.salary.enums.salarysob.SalaryEmployeeStatusEnum; +import com.engine.salary.enums.taxagent.TaxAgentRoleTypeEnum; import java.util.Collection; +import java.util.List; import java.util.Map; public interface TaxAgentService { @@ -30,4 +40,225 @@ public interface TaxAgentService { */ TaxAgent getById(Long id); + /** + * 获取当前登录人角色(返回最大角色,优先级为:总管理员-》管理员-》分管理员) + * + * @param currentEmployeeId + * @param currentTenantKey + * @return + */ + TaxAgentRoleTypeEnum getRoleType(Long currentEmployeeId, String currentTenantKey); + + /** + * 是否是薪酬模块总管理员 + * + * @param currentEmployeeId + * @param currentTenantKey + * @return + */ + Boolean isChief(Long currentEmployeeId); + + /** + * 默认权限是否开启 + * + * @param currentEmployeeId + * @param currentTenantKey + * @return + */ + Boolean isDefaultOpen(Long currentEmployeeId, String currentTenantKey); + + /** + * 管理员是否有权限 + * + * @param currentEmployeeId + * @param currentTenantKey + * @return + */ + Boolean isAdminEnable(Long currentEmployeeId, String currentTenantKey); + + /** + * 个税扣缴义务人列表(分页) + * + * @param page + * @param queryParam + * @param currentTenantKey + * @return + */ + Page listPage(Page page, TaxAgentQueryParam queryParam, String currentTenantKey); + + /** + * 个税扣缴义务人列表(不分页) + * + * @param queryParam + * @param currentTenantKey + * @return + */ + List list(TaxAgentQueryParam queryParam, String currentTenantKey); + + /** + * 根据id查询个税扣缴义务人 + * + * @param ids + * @param tenantKey + * @return + */ + List listByIds(Collection ids, String tenantKey); + + /** + * 查询租户下的所有个税扣缴义务人 + * + * @param tenantKey + * @return + */ + List listAll(String tenantKey); + + /** + * 根据id获取单个个税扣缴义务人 + * + * @param id + * @param tenantKey + * @return + */ + TaxAgentPO getById(Long id, String tenantKey); + + /** + * 获取所有个税扣缴义务人 + * + * @param tenantKey + * @return + */ + Collection findAll(String tenantKey); + + /** + * 获取作为管理员或分管理员的个税扣缴义务人列表 + * + * @param currentEmployeeId 当前登录人id + * @param tenantKey + * @return + */ + Collection listAllTaxAgents(Long currentEmployeeId, String tenantKey); + + /** + * 获取作为管理员的所有个税扣缴义务人列表 + * + * @param currentEmployeeId 当前登录人id + * @param tenantKey + * @return + */ + Collection listAllTaxAgentsAsAdmin(Long currentEmployeeId, String tenantKey); + + /** + * 获取作为人员范围中的个税扣缴义务人列表 + * + * @param employeeIds 被管理的人员id + * @param tenantKey + * @return + */ + Collection listAllTaxAgentsAsRange(List employeeIds, String tenantKey); + + /** + * 新建个税扣缴义务人 + * + * @param saveParam + * @param employeeId + * @param tenantKey + * @return + */ + String save(TaxAgentSaveParam saveParam, Long employeeId, String tenantKey); + + /** + * 更新代缴机构 + * + * @param taxAgentPO + * @param employeeId + * @param tenantKey + * @return + */ + String paymentAgencyUpdate(TaxAgentPO taxAgentPO, Long employeeId, String tenantKey); + + /** + * 编辑个税扣缴义务人 + * + * @param saveParam + * @param employeeId + * @param tenantKey + * @return + */ + String update(TaxAgentSaveParam saveParam, Long employeeId, String tenantKey); + + /** + * 删除个税扣缴义务人 + * + * @param ids + * @param employeeId + * @param tenantKey + * @return + */ + String delete(Collection ids, Long employeeId, String tenantKey); + + /** + * 获取个税扣缴义务人下拉列表 + * + * @param currentEmployeeId + * @param currentTenantKey + * @return + */ + List> selectList(Long currentEmployeeId, String currentTenantKey); + + /** + * 是否开启分权 + * + * @param tenantKey + * @return + */ + Boolean isOpenDevolution(String tenantKey); + + /** + * 获取个税扣缴义务人和可查看的人员列表(树型) + * + * @param employeeId + * @param tenantKey + * @return + */ + List listTaxAgentAndEmployeeTree(Long employeeId, String tenantKey); + + /** + * 获取个税扣缴义务人和可查看的人员列表(扁平型) + * + * @param employeeId + * @param tenantKey + * @return + */ + List listTaxAgentAndEmployee(Long employeeId, String tenantKey); + + /** + * 获取个税扣缴义务人和可查看的人员列表(树型) + * + * @param employeeStatus + * @param employeeId + * @param tenantKey + * @return + */ + List listTaxAgentAndEmployeeTree(SalaryEmployeeStatusEnum employeeStatus, Long employeeId, String tenantKey); + + /** + * 获取个税扣缴义务人和可查看的人员列表(扁平型) + * + * @param employeeStatus + * @param employeeId + * @param tenantKey + * @return + */ + List listTaxAgentAndEmployee(SalaryEmployeeStatusEnum employeeStatus, Long employeeId, String tenantKey); + + /** + * 更换管理员校验是否有核算数据 + * + * @param checkParam + * @param currentEmployeeId + * @param currentTenantKey + * @return + */ + Boolean adminChangeCheck(TaxAgentAdminChangeCheckParam checkParam, Long currentEmployeeId, String currentTenantKey); + } diff --git a/src/com/engine/salary/service/impl/AttendQuoteFieldSettingServiceImpl.java b/src/com/engine/salary/service/impl/AttendQuoteFieldSettingServiceImpl.java index 08f156c54..7ed945ff0 100644 --- a/src/com/engine/salary/service/impl/AttendQuoteFieldSettingServiceImpl.java +++ b/src/com/engine/salary/service/impl/AttendQuoteFieldSettingServiceImpl.java @@ -45,9 +45,9 @@ public class AttendQuoteFieldSettingServiceImpl extends Service implements Atten private AttendQuoteFieldBiz fieldBiz = new AttendQuoteFieldBiz(); - // @Resource + // // private AttendQuoteFieldSettingMapper mapper; -// @Resource +// // private AttendQuoteFieldMapper attendQuoteFieldMapper; // @Autowired // private LoggerTemplate attendQuoteFieldSettingLoggerTemplate; diff --git a/src/com/engine/salary/service/impl/SalaryAcctRecordServiceImpl.java b/src/com/engine/salary/service/impl/SalaryAcctRecordServiceImpl.java index d2ec29776..49a7b2579 100644 --- a/src/com/engine/salary/service/impl/SalaryAcctRecordServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalaryAcctRecordServiceImpl.java @@ -463,4 +463,9 @@ public class SalaryAcctRecordServiceImpl extends Service implements SalaryAcctRe } return salarySobPO.getName() + SalaryDateUtil.localDate2YearMonth(salaryAcctRecordPO.getSalaryMonth()); } + + @Override + public List listByStatus(SalaryAcctRecordStatusEnum status) { + return getSalaryAcctRecordMapper().listSome(SalaryAcctRecordPO.builder().status(status.getValue()).build()); + } } diff --git a/src/com/engine/salary/service/impl/SalarySendServiceImpl.java b/src/com/engine/salary/service/impl/SalarySendServiceImpl.java index 9a93311e2..68f5083f5 100644 --- a/src/com/engine/salary/service/impl/SalarySendServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalarySendServiceImpl.java @@ -88,7 +88,7 @@ public class SalarySendServiceImpl extends Service implements SalarySendService return SqlProxyHandle.getProxy(SalaryAcctEmployeeMapper.class); } -// @Resource +// private SalaryAcctResultMapper getSalaryAcctResultMapper() { return SqlProxyHandle.getProxy(SalaryAcctResultMapper.class); } @@ -119,7 +119,7 @@ public class SalarySendServiceImpl extends Service implements SalarySendService // private AsyncSystemMessageRest asyncSystemMessageRest; // @RpcReference // private MailBaseService mailBaseService; -// @Resource +// // private SalaryBatchService salaryBatchService; // @Autowired // private LoggerTemplate salarySendLoggerTemplate; diff --git a/src/com/engine/salary/service/impl/TaxAgentAdminServiceImpl.java b/src/com/engine/salary/service/impl/TaxAgentAdminServiceImpl.java new file mode 100644 index 000000000..a2042aa99 --- /dev/null +++ b/src/com/engine/salary/service/impl/TaxAgentAdminServiceImpl.java @@ -0,0 +1,78 @@ +package com.engine.salary.service.impl; + +import com.engine.core.impl.Service; +import com.engine.salary.constant.SalaryDefaultTenantConstant; +import com.engine.salary.entity.taxagent.po.TaxAgentAdminPO; +import com.engine.salary.mapper.taxagent.TaxAgentAdminMapper; +import com.engine.salary.service.TaxAgentAdminService; +import com.google.common.collect.Lists; +import dm.jdbc.util.IdGenerator; +import org.apache.commons.collections4.CollectionUtils; + +import java.util.Collection; +import java.util.Date; +import java.util.List; + +/** + * 个税扣缴义务人管理员 + *

Copyright: Copyright (c) 2022

+ *

Company: 泛微软件

+ * + * @author qiantao + * @version 1.0 + **/ +public class TaxAgentAdminServiceImpl extends Service implements TaxAgentAdminService { + + private TaxAgentAdminMapper taxAgentAdminMapper; + + @Override + public void deleteByTaxAgentIds(Collection taxAgentIds) { + if (CollectionUtils.isEmpty(taxAgentIds)) { + return; + } + taxAgentAdminMapper.deleteByTaxAgentIds(taxAgentIds); + } + + @Override + public void batchInsert(Long taxAgentId, Collection admins) { + if (taxAgentId == null || CollectionUtils.isEmpty(admins)) { + return; + } + Date now = new Date(); + admins.stream() + .map(e -> TaxAgentAdminPO.builder() + .id(IdGenerator.generate()) + .taxAgentId(taxAgentId) + .employeeId(e) + .createTime(now) + .updateTime(now) + .creator((long) user.getUID()) + .tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY) + .build()) + .forEach(taxAgentAdminMapper::insertIgnoreNull); + } + + @Override + public List listByTaxAgentIds(Collection taxAgentIds) { + List list = Lists.newArrayList(); + if (CollectionUtils.isEmpty(taxAgentIds)) { + return list; + } + return taxAgentAdminMapper.listSome(TaxAgentAdminPO.builder().taxAgentIds(taxAgentIds).build()); + + } + + @Override + public List listByTaxAgentIdsAndEmployeeId(Collection taxAgentIds, Long currentEmployeeId) { + List list = Lists.newArrayList(); + if (CollectionUtils.isEmpty(taxAgentIds) || currentEmployeeId == null) { + return list; + } + return taxAgentAdminMapper.listSome(TaxAgentAdminPO.builder().taxAgentIds(taxAgentIds).employeeId(currentEmployeeId).build()); + } + + @Override + public List listByEmployeeId(Long currentEmployeeId) { + return taxAgentAdminMapper.listSome(TaxAgentAdminPO.builder().employeeId(currentEmployeeId).build()); + } +} diff --git a/src/com/engine/salary/service/impl/TaxAgentBaseServiceImpl.java b/src/com/engine/salary/service/impl/TaxAgentBaseServiceImpl.java new file mode 100644 index 000000000..2a0f11299 --- /dev/null +++ b/src/com/engine/salary/service/impl/TaxAgentBaseServiceImpl.java @@ -0,0 +1,103 @@ +package com.engine.salary.service.impl; + +import com.engine.core.impl.Service; +import com.engine.salary.constant.SalaryDefaultTenantConstant; +import com.engine.salary.entity.salaryacct.po.SalaryAcctRecordPO; +import com.engine.salary.entity.taxagent.param.TaxAgentSaveBaseParam; +import com.engine.salary.entity.taxagent.po.TaxAgentBasePO; +import com.engine.salary.enums.SalaryOnOffEnum; +import com.engine.salary.enums.salaryaccounting.SalaryAcctRecordStatusEnum; +import com.engine.salary.exception.SalaryRunTimeException; +import com.engine.salary.mapper.taxagent.TaxAgentBaseMapper; +import com.engine.salary.service.SIAccountService; +import com.engine.salary.service.SalaryAcctRecordService; +import com.engine.salary.service.TaxAgentBaseService; +import com.engine.salary.util.SalaryI18nUtil; +import dm.jdbc.util.IdGenerator; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang.StringUtils; + +import java.util.Date; +import java.util.List; + +/** + * 个税扣缴义务人基本信息 + *

Copyright: Copyright (c) 2022

+ *

Company: 泛微软件

+ * + * @author qiantao + * @version 1.0 + **/ +public class TaxAgentBaseServiceImpl extends Service implements TaxAgentBaseService { + + private TaxAgentBaseMapper taxAgentBaseMapper; + private SalaryAcctRecordService salaryAcctRecordService; + private SIAccountService siAccountService; + + public TaxAgentBaseServiceImpl() { + } + + @Override + public Boolean isOpenDevolution() { + TaxAgentBasePO base = getBaseInfo(); + return (base != null && base.getDevolutionStatus() == 1) ? Boolean.TRUE : Boolean.FALSE; + } + + @Override + public TaxAgentBasePO getBaseInfo() { + List list = taxAgentBaseMapper.listAll(); + return CollectionUtils.isEmpty(list) ? null : list.get(0); + } + + @Override + public String save(TaxAgentSaveBaseParam saveBaseParam) { + if (saveBaseParam.getDevolutionStatus() == null) { + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(84026, "参数错误")); + } + // 检查使用中的数据 + boolean isUnable = checkUsedData(); + if (isUnable) { + if (saveBaseParam.getDevolutionStatus()) { + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(117395, "当前有未归档的核算数据,全部归档后才可以启用分权")); + } else { + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(117396, "当前有未归档的核算数据,全部归档后才可以停用分权")); + } + } + TaxAgentBasePO base = getBaseInfo(); + Date now = new Date(); + Integer devolutionStatus = saveBaseParam.getDevolutionStatus() ? SalaryOnOffEnum.ON.getValue() : SalaryOnOffEnum.OFF.getValue(); + if (base == null) { + taxAgentBaseMapper.insertIgnoreNull( + TaxAgentBasePO.builder() + .id(IdGenerator.generate()) + .devolutionStatus(devolutionStatus) + .createTime(now) + .updateTime(now) + .creator((long) user.getUID()) + .tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY) + .build()); + } else { + base.setUpdateTime(now); + base.setDevolutionStatus(devolutionStatus); + taxAgentBaseMapper.updateIgnoreNull(base); + } + return StringUtils.EMPTY; + } + + /** + * 检查是否有未归档数据 + * + * @return + */ + private boolean checkUsedData() { + // 检查是否核算 + // todo 1.社保福利档案是否有核算未归档 + Boolean checkedValue = false;//= siAccountService.changeAdminUnfiledCheck(); + // todo 2.薪资核算是否有核算未归档 + List salaryAcctRecords = salaryAcctRecordService.listByStatus(SalaryAcctRecordStatusEnum.NOT_ARCHIVED);// salaryAcctRecordService.listByStatusAndEmployeeId(SalaryAcctRecordStatusEnum.NOT_ARCHIVED, currentTenantKey); + if (CollectionUtils.isNotEmpty(salaryAcctRecords) || checkedValue) { + return Boolean.TRUE; + } + return Boolean.FALSE; + } +} diff --git a/src/com/engine/salary/service/impl/TaxAgentEmpChangeServiceImpl.java b/src/com/engine/salary/service/impl/TaxAgentEmpChangeServiceImpl.java new file mode 100644 index 000000000..03627d015 --- /dev/null +++ b/src/com/engine/salary/service/impl/TaxAgentEmpChangeServiceImpl.java @@ -0,0 +1,50 @@ +package com.engine.salary.service.impl; + +import com.engine.core.impl.Service; +import com.engine.salary.entity.taxagent.po.TaxAgentEmpChangePO; +import com.engine.salary.enums.taxagent.TaxAgentEmpChangeModuleEnum; +import com.engine.salary.mapper.taxagent.TaxAgentEmpChangeMapper; +import com.engine.salary.service.TaxAgentEmpChangeService; +import org.apache.commons.collections4.CollectionUtils; + +import javax.annotation.Resource; +import java.util.Collection; +import java.util.List; + +/** + * 个税扣缴义务人管理范围的增量人员 + *

Copyright: Copyright (c) 2022

+ *

Company: 泛微软件

+ * + * @author qiantao + * @version 1.0 + **/ +public class TaxAgentEmpChangeServiceImpl extends Service implements TaxAgentEmpChangeService { + + @Resource + private TaxAgentEmpChangeMapper taxAgentEmpChangeMapper; + + @Override + public List listAll() { + return taxAgentEmpChangeMapper.listAll(); + } + + @Override + public List listAllByModule(TaxAgentEmpChangeModuleEnum moduleTypeEnum) { + return taxAgentEmpChangeMapper.listSome(TaxAgentEmpChangePO.builder().moduleType(moduleTypeEnum.getValue()).build()); + } + + @Override + public boolean deleleByIds(Collection ids) { + if (CollectionUtils.isEmpty(ids)) { + return Boolean.FALSE; + } + taxAgentEmpChangeMapper.deleteByIds(ids); + return Boolean.TRUE; + } + + @Override + public void batchInsert(List taxAgentEmpChangeList) { + taxAgentEmpChangeMapper.batchInsert(taxAgentEmpChangeList); + } +} diff --git a/src/com/engine/salary/service/impl/TaxAgentEmpServiceImpl.java b/src/com/engine/salary/service/impl/TaxAgentEmpServiceImpl.java new file mode 100644 index 000000000..7ac7060d9 --- /dev/null +++ b/src/com/engine/salary/service/impl/TaxAgentEmpServiceImpl.java @@ -0,0 +1,148 @@ +package com.engine.salary.service.impl; + +import com.engine.core.impl.Service; +import com.engine.salary.constant.SalaryDefaultTenantConstant; +import com.engine.salary.entity.datacollection.DataCollectionEmployee; +import com.engine.salary.entity.taxagent.param.TaxAgentEmpSaveParam; +import com.engine.salary.entity.taxagent.po.TaxAgentEmpChangePO; +import com.engine.salary.entity.taxagent.po.TaxAgentEmpPO; +import com.engine.salary.enums.taxagent.TaxAgentEmpChangeModuleEnum; +import com.engine.salary.enums.taxagent.TaxAgentEmpChangeTypeEnum; +import com.engine.salary.mapper.taxagent.TaxAgentEmpMapper; +import com.engine.salary.service.TaxAgentEmpChangeService; +import com.engine.salary.service.TaxAgentEmpService; +import com.engine.salary.util.SalaryEntityUtil; +import com.google.common.collect.Lists; +import dm.jdbc.util.IdGenerator; +import org.apache.commons.collections4.CollectionUtils; + +import java.util.*; +import java.util.stream.Collectors; + +/** + * 个税扣缴义务人管理范围的人员 + *

Copyright: Copyright (c) 2022

+ *

Company: 泛微软件

+ * + * @author qiantao + * @version 1.0 + **/ +public class TaxAgentEmpServiceImpl extends Service implements TaxAgentEmpService { + + + private TaxAgentEmpMapper taxAgentEmployeeMapper; + + private TaxAgentEmpChangeService taxAgentEmpChangeService; + + @Override + public void deleteByTaxAgentIds(Collection taxAgentIds) { + if (CollectionUtils.isEmpty(taxAgentIds)) { + return; + } + List taxAgentEmpList = taxAgentEmployeeMapper.listSome(TaxAgentEmpPO.builder().taxAgentIds(taxAgentIds).build()); + if (CollectionUtils.isEmpty(taxAgentEmpList)) { + return; + } + List idList = taxAgentEmpList.stream().map(TaxAgentEmpPO::getId).collect(Collectors.toList()); + taxAgentEmployeeMapper.deleteByIds(idList); + } + + @Override + public List listByTaxAgentIds(List taxAgentIds) { + if (CollectionUtils.isEmpty(taxAgentIds)) { + return Lists.newArrayList(); + } + return taxAgentEmployeeMapper.listSome(TaxAgentEmpPO.builder().taxAgentIds(taxAgentIds).build()); + } + + @Override + public void syncTaxAgentEmployee(List taxAgentEmpSaveParamList, Long currentEmployeeId) { + if (CollectionUtils.isEmpty(taxAgentEmpSaveParamList)) { + return; + } + List taxAgentIds = taxAgentEmpSaveParamList.stream().map(TaxAgentEmpSaveParam::getTaxAgentId).collect(Collectors.toList()); + List taxAgentEmployeeExistList = this.listByTaxAgentIds(taxAgentIds); + Date now = new Date(); + // 关联表 + List taxAgentEmployeeAddList = Lists.newArrayList(); + List taxAgentEmployeeDelIds = Lists.newArrayList(); + // 增量表 + List taxAgentEmpChangeList = Lists.newArrayList(); + + taxAgentEmpSaveParamList.forEach(saveParam -> { + List existList = taxAgentEmployeeExistList.stream().filter(f -> f.getTaxAgentId().equals(saveParam.getTaxAgentId())).collect(Collectors.toList()); + Map taxAgentEmployeeMap = SalaryEntityUtil.convert2Map(existList, e -> e.getTaxAgentId() + "-" + e.getEmployeeId()); + for (DataCollectionEmployee se : saveParam.getSalaryEmployeeList()) { + String key = saveParam.getTaxAgentId() + "-" + se.getEmployeeId(); + // 本地有的不动 + if (taxAgentEmployeeMap.containsKey(key)) { + taxAgentEmployeeMap.remove(key); + continue; + } + taxAgentEmployeeAddList.add(TaxAgentEmpPO.builder() + .id(IdGenerator.generate()) + .taxAgentId(saveParam.getTaxAgentId()) + .employeeId(se.getEmployeeId()) + .employeeName(se.getUsername()) + .creator(currentEmployeeId) + .createTime(now) + .updateTime(now) + .tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY) + .deleteType(0) + .build()); + + Arrays.stream(TaxAgentEmpChangeModuleEnum.values()).forEach(e -> { + taxAgentEmpChangeList.add(TaxAgentEmpChangePO.builder() + .id(IdGenerator.generate()) + .taxAgentId(saveParam.getTaxAgentId()) + .employeeId(se.getEmployeeId()) + .employeeName(se.getUsername()) + .changeType(TaxAgentEmpChangeTypeEnum.ADD.getValue()) + .moduleType(e.getValue()) + .creator(currentEmployeeId) + .createTime(now) + .updateTime(now) + .tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY) + .deleteType(0) + .build()); + }); + + } + //遍历剩余的就是删除的 + for (String key : taxAgentEmployeeMap.keySet()) { + TaxAgentEmpPO value = taxAgentEmployeeMap.get(key); + taxAgentEmployeeDelIds.add(value.getId()); + + Arrays.stream(TaxAgentEmpChangeModuleEnum.values()).forEach(e -> { + taxAgentEmpChangeList.add(TaxAgentEmpChangePO.builder() + .id(IdGenerator.generate()) + .taxAgentId(saveParam.getTaxAgentId()) + .employeeId(value.getEmployeeId()) + .employeeName(value.getEmployeeName()) + .changeType(TaxAgentEmpChangeTypeEnum.DEL.getValue()) + .moduleType(e.getValue()) + .creator(currentEmployeeId) + .createTime(now) + .updateTime(now) + .tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY) + .deleteType(0) + .build()); + }); + } + }); + + // 关联表==================================================== + // 新增 + if (CollectionUtils.isNotEmpty(taxAgentEmployeeAddList)) { + taxAgentEmployeeMapper.batchInsert(taxAgentEmployeeAddList); + } + // 删除 + if (CollectionUtils.isNotEmpty(taxAgentEmployeeDelIds)) { + taxAgentEmployeeMapper.deleteByIds(taxAgentEmployeeDelIds); + } + // 增量表==================================================== + if (CollectionUtils.isNotEmpty(taxAgentEmpChangeList)) { + taxAgentEmpChangeService.batchInsert(taxAgentEmpChangeList); + } + } +} diff --git a/src/com/engine/salary/service/impl/TaxAgentManageRangeServiceImpl.java b/src/com/engine/salary/service/impl/TaxAgentManageRangeServiceImpl.java new file mode 100644 index 000000000..dfc2b7ea1 --- /dev/null +++ b/src/com/engine/salary/service/impl/TaxAgentManageRangeServiceImpl.java @@ -0,0 +1,724 @@ +package com.engine.salary.service.impl; + +import com.alibaba.fastjson.JSONObject; +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.datacollection.DataCollectionEmployee; +import com.engine.salary.entity.taxagent.dto.TaxAgentManageRangeEmployeeDTO; +import com.engine.salary.entity.taxagent.dto.TaxAgentManageRangeListDTO; +import com.engine.salary.entity.taxagent.param.TaxAgentManageRangeQueryParam; +import com.engine.salary.entity.taxagent.param.TaxAgentRangeQueryParam; +import com.engine.salary.entity.taxagent.param.TaxAgentRangeSaveParam; +import com.engine.salary.entity.taxagent.po.TaxAgentManageRangePO; +import com.engine.salary.enums.SalaryJobFlagEnum; +import com.engine.salary.enums.salarysob.SalaryEmployeeStatusEnum; +import com.engine.salary.enums.salarysob.TargetTypeEnum; +import com.engine.salary.enums.taxagent.TaxAgentRangeTypeEnum; +import com.engine.salary.mapper.datacollection.EmployMapper; +import com.engine.salary.mapper.taxagent.TaxAgentManageRangeMapper; +import com.engine.salary.service.TaxAgentEmpService; +import com.engine.salary.service.TaxAgentManageRangeService; +import com.engine.salary.service.TaxAgentService; +import com.engine.salary.util.JsonUtil; +import com.engine.salary.util.SalaryEntityUtil; +import com.engine.salary.util.page.PageInfo; +import com.google.common.collect.Lists; +import com.weaver.common.async.bean.AsyncBean; +import com.weaver.common.async.consumer.anno.method.AsyncListener; +import com.weaver.common.cache.tablecache.impl.ComInfoCache; +import com.weaver.common.component.table.page.Page; +import com.weaver.common.hrm.cache.HrmDepartmentComInfo; +import com.weaver.common.hrm.cache.HrmEmployeeComInfo; +import com.weaver.common.hrm.cache.HrmPositionComInfo; +import com.weaver.common.hrm.domain.employee.HrmStatus; +import com.weaver.common.hrm.domain.queue.HrmCommonQueue; +import com.weaver.common.hrm.service.employee.HrmCommonHrmStatusService; +import com.weaver.datasecurity.interceptor.DSTenantKeyThreadVar; +import com.weaver.hrm.salary.common.SalaryEmployee; +import com.weaver.hrm.salary.entity.taxagent.bo.TaxAgentBO; +import com.weaver.hrm.salary.entity.taxagent.param.*; +import com.weaver.hrm.salary.entity.taxagent.po.TaxAgentPO; +import com.weaver.hrm.salary.entity.taxagent.po.TaxAgentSubAdminPO; +import com.weaver.hrm.salary.exception.SalaryRunTimeException; +import com.weaver.hrm.salary.service.*; +import com.weaver.hrm.salary.util.SalaryI18nUtil; +import com.weaver.hrm.salary.util.SalaryPageUtil; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.math.NumberUtils; +import org.springframework.transaction.annotation.Transactional; + +import java.util.*; +import java.util.concurrent.ExecutorService; +import java.util.stream.Collectors; + +/** + * 个税扣缴义务人的管理范围 + *

Copyright: Copyright (c) 2022

+ *

Company: 泛微软件

+ * + * @author qiantao + * @version 1.0 + **/ +@Slf4j +public class TaxAgentManageRangeServiceImpl extends Service implements TaxAgentManageRangeService { + + private TaxAgentManageRangeMapper taxAgentManageRangeMapper; + + private TaxAgentService taxAgentService; + + private TaxAgentSubAdminService taxAgentSubAdminService; + + private TaxAgentEmpService taxAgentEmployeeService; + + private TaxAgentSubAdminEmpService taxAgentSubAdminEmployeeService; + + private ComInfoCache comInfoCache; + + private EmployMapper employeeMapper; + + private ExecutorService taskExecutor; + + private HrmCommonHrmStatusService hrmCommonHrmStatusService; + + private List listByTaxAgentIds(List taxAgentIds) { + if (CollectionUtils.isEmpty(taxAgentIds)) { + return Lists.newArrayList(); + } + return taxAgentManageRangeMapper.listSome(TaxAgentManageRangePO.builder().rangeType(TaxAgentRangeTypeEnum.TAXAGENT.getValue()).taxAgentIds(taxAgentIds).build()); + } + + @Override + public List listSalaryEmployeeByTaxAgentIds(List taxAgentIds) { + return listSalaryEmployeeByTaxAgentIds(null, taxAgentIds); + } + + @Override + public List listSalaryEmployeeByTaxAgentIds(SalaryEmployeeStatusEnum employeeStatus, List taxAgentIds) { + List allTaxAgentManageRanges = this.listByTaxAgentIds(taxAgentIds); + return convertTaxAgentEmployee(employeeStatus, taxAgentIds, allTaxAgentManageRanges); + } + +// @Override +// public List listBySubAdminIds(Collection taxAgentSubAdminIds) { +// if (CollectionUtils.isEmpty(taxAgentSubAdminIds)) { +// return Lists.newArrayList(); +// } +// return new LambdaQueryChainWrapper<>(taxAgentManageRangeMapper) +// .eq(TaxAgentManageRangePO::getTenantKey, tenantKey) +// .eq(TaxAgentManageRangePO::getDeleteType, 0) +// .eq(TaxAgentManageRangePO::getRangeType, TaxAgentRangeTypeEnum.SUBADMIN.getValue()) +// .in(TaxAgentManageRangePO::getTaxAgentSubAdminId, taxAgentSubAdminIds) +// .orderByDesc(TaxAgentManageRangePO::getId) +// .list(); +// } + +// @Override +// public List listSalaryEmployeeBySubAdminIds(List taxAgentIds) { +// return listSalaryEmployeeBySubAdminIds(null, taxAgentIds); +// } + +// @Override +// public List listSalaryEmployeeBySubAdminIds(SalaryEmployeeStatusEnum employeeStatus, List taxAgentSubAdminIds) { +// List allTaxAgentManageRanges = this.listBySubAdminIds(taxAgentSubAdminIds); +// List taxAgentIds = allTaxAgentManageRanges.stream().map(TaxAgentManageRangePO::getTaxAgentId).distinct().collect(Collectors.toList()); +// +// return convertTaxAgentEmployee(employeeStatus, taxAgentIds, allTaxAgentManageRanges); +// } + + private List convertTaxAgentEmployee(SalaryEmployeeStatusEnum employeeStatus, List taxAgentIds, List allTaxAgentManageRanges) { + return taxAgentIds.stream().distinct().map(e -> { + // 获取范围下的人员 + List salaryEmployees = getManageRangeSalaryEmployees(employeeStatus, e, allTaxAgentManageRanges); + if (CollectionUtils.isEmpty(salaryEmployees)) { + return null; + } + List taxAgentEmployees = salaryEmployees.stream().map(m -> { + TaxAgentManageRangeEmployeeDTO.TaxAgentEmployee taxAgentEmployee = new TaxAgentManageRangeEmployeeDTO.TaxAgentEmployee(); + taxAgentEmployee.setEmployeeId(m.getEmployeeId()); + taxAgentEmployee.setUsername(m.getUsername()); + return taxAgentEmployee; + }).collect(Collectors.toList()); + + return TaxAgentManageRangeEmployeeDTO.builder() + .taxAgentId(e) + .taxAgentName("") + .employeeList(taxAgentEmployees) + .build(); + }).filter(Objects::nonNull).collect(Collectors.toList()); + } + + /** + * 获取范围下的人员 + * + * @param employeeStatus + * @param taxAgentId + * @param allTaxAgentManageRanges + * @return + */ + private List getManageRangeSalaryEmployees(SalaryEmployeeStatusEnum employeeStatus, Long taxAgentId, + List allTaxAgentManageRanges) { + List includeAllTaxAgentManageRanges = allTaxAgentManageRanges.stream().filter(f -> f.getIncludeType().equals(NumberUtils.INTEGER_ONE)).collect(Collectors.toList()); + if (CollectionUtils.isEmpty(includeAllTaxAgentManageRanges)) { + return Collections.emptyList(); + } + List excludeAllTaxAgentManageRanges = allTaxAgentManageRanges.stream().filter(f -> f.getIncludeType().equals(NumberUtils.INTEGER_ZERO)).collect(Collectors.toList()); + + List includeSalaryEmployees = Lists.newArrayList(); + List includeTaxAgentManageRanges = includeAllTaxAgentManageRanges.stream().filter(f -> f.getTaxAgentId().equals(taxAgentId)).collect(Collectors.toList()); + if (CollectionUtils.isEmpty(includeTaxAgentManageRanges)) { + return includeSalaryEmployees; + } + // 如果需要状态过滤 + List personnelStatuss = Lists.newArrayList(); + if (employeeStatus != null) { + // 查询人员状态 + List hrmStatusList = hrmCommonHrmStatusService.list(); + if (employeeStatus.equals(SalaryEmployeeStatusEnum.NORMAL)) { + personnelStatuss = hrmStatusList.stream().filter(f -> f.getJobflag().equals(SalaryJobFlagEnum.normal.getValue())).map(m -> m.getCodeId() + "").collect(Collectors.toList()); + } else if (employeeStatus.equals(SalaryEmployeeStatusEnum.UNAVAILABLE)) { + personnelStatuss = hrmStatusList.stream().filter(f -> f.getJobflag().equals(SalaryJobFlagEnum.unavailable.getValue())).map(m -> m.getCodeId() + "").collect(Collectors.toList()); + } + } + // 根据上一步的查询参数查询人员 + includeSalaryEmployees = listSalaryEmployeeByManageRange(includeTaxAgentManageRanges, personnelStatuss); + if (CollectionUtils.isEmpty(includeSalaryEmployees)) { + return includeSalaryEmployees; + } + // 查询管理范围(从范围中排除) + List excludeTaxAgentManageRanges = excludeAllTaxAgentManageRanges.stream().filter(f -> f.getTaxAgentId().equals(taxAgentId)).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(excludeTaxAgentManageRanges)) { + // 根据上一步的查询参数查询人员 + List excludeSalaryEmployees = listSalaryEmployeeByManageRange(excludeTaxAgentManageRanges, personnelStatuss); + // 需要排除的人员范围 + Set excludeEmployeeIds = SalaryEntityUtil.properties(excludeSalaryEmployees, DataCollectionEmployee::getEmployeeId); + // 过滤人员 + includeSalaryEmployees = includeSalaryEmployees.stream() + .filter(salaryEmployee -> !excludeEmployeeIds.contains(salaryEmployee.getEmployeeId())) + .collect(Collectors.toList()); + } + return includeSalaryEmployees; + } + + /** + * 根据范围加载人员 + * + * @param taxAgentManageRanges + * @return + */ + private List listSalaryEmployeeByManageRange(List taxAgentManageRanges, List personnelStatuss) { + if (CollectionUtils.isEmpty(taxAgentManageRanges)) { + return Collections.emptyList(); + } + List salaryEmployees = employeeMapper.listAll(); + List salaryEmployeeList = Lists.newArrayList(); + for (TaxAgentManageRangePO manageRange : taxAgentManageRanges) { + salaryEmployeeList.addAll(salaryEmployees.stream() + .filter(salaryEmployee -> { + // 判断人员状态 + List hrmStatusList = JsonUtil.parseList(manageRange.getEmployeeStatus(), String.class); + // 有状态过滤则取交集 + if (CollectionUtils.isNotEmpty(personnelStatuss)) { + hrmStatusList = hrmStatusList.stream().filter(personnelStatuss::contains).collect(Collectors.toList()); + } + if (CollectionUtils.isNotEmpty(hrmStatusList) && !hrmStatusList.contains(salaryEmployee.getPersonnelStatus())) { + return false; + } + if (Objects.equals(manageRange.getTargetType(), TargetTypeEnum.ALL.getValue())) { + return true; + } + if (Objects.equals(manageRange.getTargetType(), TargetTypeEnum.EMPLOYEE.getValue()) + && Objects.equals(manageRange.getTargetId(), salaryEmployee.getEmployeeId())) { + return true; + } + if (Objects.equals(manageRange.getTargetType(), TargetTypeEnum.DEPT.getValue()) + && Objects.equals(manageRange.getTargetId(), salaryEmployee.getDepartmentId())) { + return true; + } + if (Objects.equals(manageRange.getTargetType(), TargetTypeEnum.SUBCOMPANY.getValue()) + && Objects.equals(manageRange.getTargetId(), salaryEmployee.getDepartmentId())) { + return true; + } + if (Objects.equals(manageRange.getTargetType(), TargetTypeEnum.POSITION.getValue()) + && Objects.equals(manageRange.getTargetId(), salaryEmployee.getJobtitleId())) { + return true; + } + return false; + }).collect(Collectors.toList())); + } + // 去重 + salaryEmployeeList = salaryEmployeeList.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(DataCollectionEmployee::getEmployeeId))), ArrayList::new)); + return salaryEmployeeList; + } + +// /** +// * 根据分管理员id获取管理范围列表 +// * +// * @param subAdminId +// * @param includeType +// * @return +// */ +// private List listBySubAdminIdAndIncludeType(Long subAdminId, Integer includeType) { +// +// return new LambdaQueryChainWrapper<>(taxAgentManageRangeMapper) +// .eq(TaxAgentManageRangePO::getTenantKey, tenantKey) +// .eq(TaxAgentManageRangePO::getDeleteType, 0) +// .eq(TaxAgentManageRangePO::getTaxAgentSubAdminId, subAdminId) +// .eq(TaxAgentManageRangePO::getRangeType, TaxAgentRangeTypeEnum.SUBADMIN.getValue()) +// .eq(TaxAgentManageRangePO::getIncludeType, includeType) +// .orderByDesc(TaxAgentManageRangePO::getId) +// .list(); +// } + + /** + * 获取个税口角义务人的管理范围 + * + * @param taxAgentId + * @param includeType + * @return + */ + private List listByTaxAgentIdAndIncludeType(Long taxAgentId, Integer includeType) { + return taxAgentManageRangeMapper.listSome(TaxAgentManageRangePO.builder().taxAgentId(taxAgentId).rangeType(TaxAgentRangeTypeEnum.TAXAGENT.getValue()).includeType(includeType).build()); + } + +// @Override +// public Page listPageByParamAndIncludeType(TaxAgentSubAdminRangeQueryParam queryParam, Integer includeType) { +// // 查询已有的管理范围 +// List taxAgentManageRanges = listBySubAdminIdAndIncludeType(queryParam.getSubAdminId(), includeType); +// return listPageByParamAndIncludeType(taxAgentManageRanges, queryParam, includeType); +// } + + @Override + public PageInfo listPageByParamAndIncludeType(TaxAgentRangeQueryParam queryParam, Integer includeType) { + // 查询已有的管理范围 + List taxAgentManageRanges = listByTaxAgentIdAndIncludeType(queryParam.getTaxAgentId(), includeType); + return listPageByParamAndIncludeType(taxAgentManageRanges, queryParam, includeType); + } + + private PageInfo listPageByParamAndIncludeType(List taxAgentManageRanges, TaxAgentManageRangeQueryParam queryParam, Integer includeType) { + + // 查询人员信息 + List employeeIds = taxAgentManageRanges.stream() + .filter(e -> Objects.equals(e.getTargetType(), TargetTypeEnum.EMPLOYEE.getValue())) + .map(TaxAgentManageRangePO::getTargetId) + .collect(Collectors.toList()); + List employeeComInfos = comInfoCache.getCacheList(HrmEmployeeComInfo.class, employeeIds); + // 查询部门信息 + List departmentIds = taxAgentManageRanges.stream() + .filter(e -> Objects.equals(e.getTargetType(), TargetTypeEnum.DEPT.getValue())) + .map(TaxAgentManageRangePO::getTargetId) + .collect(Collectors.toList()); + List departmentComInfos = comInfoCache.getCacheList(HrmDepartmentComInfo.class, departmentIds); + // 查询分部信息 + List subDepartmentIds = taxAgentManageRanges.stream() + .filter(e -> Objects.equals(e.getTargetType(), TargetTypeEnum.SUBCOMPANY.getValue())) + .map(TaxAgentManageRangePO::getTargetId) + .collect(Collectors.toList()); + List subDepartmentComInfos = comInfoCache.getCacheList(HrmDepartmentComInfo.class, subDepartmentIds); + // 查询岗位信息 + List positionIds = taxAgentManageRanges.stream() + .filter(e -> Objects.equals(e.getTargetType(), TargetTypeEnum.POSITION.getValue())) + .map(TaxAgentManageRangePO::getTargetId) + .collect(Collectors.toList()); + List positionComInfos = comInfoCache.getCacheList(HrmPositionComInfo.class, positionIds); + // 分页参数 + Page dtoPage = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize()); + // 查询人员状态 + List hrmStatusList = hrmCommonHrmStatusService.list(tenantKey); + // 薪资账套的人员范围po转换成列表dto + List taxAgentManageRangeList = TaxAgentBO.convert2ListDTO(taxAgentManageRanges, employeeComInfos, departmentComInfos, subDepartmentComInfos, positionComInfos, hrmStatusList); + // 根据对象名称过滤 + if (StringUtils.isNotEmpty(queryParam.getTargetName())) { + taxAgentManageRangeList = taxAgentManageRangeList.stream() + .filter(f -> f.getTargetName().contains(queryParam.getTargetName())) + .collect(Collectors.toList()); + } + // 填充总数和当页数据 + dtoPage.setTotal(taxAgentManageRangeList.size()); + dtoPage.setRecords(SalaryPageUtil.subList((int) dtoPage.getCurrent(), (int) dtoPage.getSize(), taxAgentManageRangeList)); + return dtoPage; + } + + /** + * 根据个税口角义务人id保存管理范围 + * + * @param saveParam 保存参数 + * @param employeeId 人员id + * @param tenantKey 租户key + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void save(TaxAgentRangeSaveParam saveParam, Long employeeId, String tenantKey) { + // 查询薪资账套 + TaxAgentPO taxAgent = taxAgentService.getById(saveParam.getTaxAgentId(), tenantKey); + if (Objects.isNull(taxAgent)) { + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 108605, "参数错误,个税扣缴义务人不存在或者已被删除")); + } + // 查询已有的管理范围 + List taxAgentManageAllRanges = listByTaxAgentId(saveParam.getTaxAgentId(), tenantKey); + + List taxAgentManageRanges = taxAgentManageAllRanges.stream().filter(f -> f.getIncludeType().equals(saveParam.getIncludeType())).collect(Collectors.toList()); + // 处理一下本次的保存参数(如果原来添加过对应的人员(/部门/岗位),那么本次不需要新增,只需要更新) + TaxAgentBO.Result result = TaxAgentBO.handleTaxAgentRange(taxAgentManageRanges, saveParam, taxAgent.getId(), employeeId, tenantKey); + + /** 检查当前个税扣缴义务人的所有人员范围与所有分管理员的管理范围===========================start */ + List allRanges = Lists.newArrayList(taxAgentManageAllRanges); + allRanges.addAll(result.getNeedInsertTaxAgentManageRanges()); + allRanges.addAll(result.getNeedUpdateTaxAgentManageRanges()); + // 去重 + allRanges = allRanges.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>( + Comparator.comparing(f -> f.getTaxAgentId() + "." + f.getRangeType() + "." + f.getTargetType() + "." + f.getTargetId() + "." + f.getEmployeeStatus() + "." + f.getIncludeType())) + ), ArrayList::new)); + List allSalaryEmployees = this.getManageRangeSalaryEmployees(null, saveParam.getTaxAgentId(), allRanges, tenantKey); + // 如果是排除是否会对分管理范围产生影响 + List allSubAdminRanges = listSunAdminRangeByTaxAgentId(saveParam.getTaxAgentId(), tenantKey); + if (saveParam.getIncludeType().equals(NumberUtils.INTEGER_ZERO)) { + List allSubAdminSalaryEmployees = this.getManageRangeSalaryEmployees(null, saveParam.getTaxAgentId(), allSubAdminRanges, tenantKey); + + List allSalaryEmployeeIds = allSalaryEmployees.stream().map(SalaryEmployee::getEmployeeId).collect(Collectors.toList()); + allSubAdminSalaryEmployees.removeIf(a -> allSalaryEmployeeIds.contains(a.getEmployeeId())); + + if (CollectionUtils.isNotEmpty(allSubAdminSalaryEmployees)) { + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 110122, "分管理员包含该范围,不能删除")); + } + } + /** 检查当前个税扣缴义务人的所有人员范围与所有分管理员的管理范围===========================end */ + // 保存 + if (CollectionUtils.isNotEmpty(result.getNeedInsertTaxAgentManageRanges())) { + this.saveBatch(result.getNeedInsertTaxAgentManageRanges()); + } + if (CollectionUtils.isNotEmpty(result.getNeedUpdateTaxAgentManageRanges())) { + this.updateBatchById(result.getNeedUpdateTaxAgentManageRanges()); + } + + /** 同步本地人员范围的关联人员=========================== */ + taskExecutor.execute(() -> { + try { + DSTenantKeyThreadVar.tenantKey.set(tenantKey); + syncLocalEmp(saveParam.getTaxAgentId(), allSalaryEmployees, allSubAdminRanges, employeeId, tenantKey); + } finally { + DSTenantKeyThreadVar.tenantKey.remove(); + } + }); + + // 记录日志 todo + } + + /** + * 获取个税口角义务人的管理范围 + * + * @param taxAgentId + * @param tenantKey + * @return + */ + private List listByTaxAgentId(Long taxAgentId, String tenantKey) { + return new LambdaQueryChainWrapper<>(taxAgentManageRangeMapper) + .eq(TaxAgentManageRangePO::getTenantKey, tenantKey) + .eq(TaxAgentManageRangePO::getDeleteType, 0) + .eq(TaxAgentManageRangePO::getTaxAgentId, taxAgentId) + .eq(TaxAgentManageRangePO::getRangeType, TaxAgentRangeTypeEnum.TAXAGENT.getValue()) + .orderByDesc(TaxAgentManageRangePO::getId) + .list(); + } + + private List listSunAdminRangeByTaxAgentId(Long taxAgentId, String tenantKey) { + return new LambdaQueryChainWrapper<>(taxAgentManageRangeMapper) + .eq(TaxAgentManageRangePO::getTenantKey, tenantKey) + .eq(TaxAgentManageRangePO::getDeleteType, 0) + .eq(TaxAgentManageRangePO::getTaxAgentId, taxAgentId) + .eq(TaxAgentManageRangePO::getRangeType, TaxAgentRangeTypeEnum.SUBADMIN.getValue()) + .orderByDesc(TaxAgentManageRangePO::getId) + .list(); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save4SubAdmin(TaxAgentSubAdminRangeSaveParam saveParam, Long employeeId, String tenantKey) { + // 查询薪资账套 + TaxAgentSubAdminPO taxAgentSubAdmin = taxAgentSubAdminService.getById(saveParam.getSubAdminId(), tenantKey); + if (Objects.isNull(taxAgentSubAdmin)) { + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 106687, "参数错误,分管理员不存在或者已被删除")); + } + // 查询已有的管理范围 + List taxAgentManageAllRanges = listBySubAdminId(saveParam.getSubAdminId(), tenantKey); + List taxAgentManageRanges = taxAgentManageAllRanges.stream().filter(f -> f.getIncludeType().equals(saveParam.getIncludeType())).collect(Collectors.toList()); + // 处理一下本次的保存参数(如果原来添加过对应的人员(/部门/岗位),那么本次不需要新增,只需要更新) + TaxAgentBO.Result result = TaxAgentBO.handleSubAdminRange(taxAgentManageRanges, saveParam, taxAgentSubAdmin.getTaxAgentId(), taxAgentSubAdmin.getId(), employeeId, tenantKey); + + // 当前库中所有分管理员的管理范围 + List allSubAdminRangesExist = listSunAdminRangeByTaxAgentId(taxAgentSubAdmin.getTaxAgentId(), tenantKey); + /** 检查当前分管理员的范围与其他分管理员人员范围===========================start */ + // 当前分管理员的范围 + List allSubAdminRangesCuttent = Lists.newArrayList(taxAgentManageAllRanges); + // 其他分管理员的范围 + List otherSubAdminRangesExist = allSubAdminRangesExist.stream().filter(f -> !f.getTaxAgentSubAdminId().equals(saveParam.getSubAdminId())).collect(Collectors.toList()); + allSubAdminRangesCuttent.addAll(result.getNeedInsertTaxAgentManageRanges()); + allSubAdminRangesCuttent.addAll(result.getNeedUpdateTaxAgentManageRanges()); + + // 当前分管理员的所有人员 + List currentSubAdminSalaryEmployees = this.getManageRangeSalaryEmployees(null, taxAgentSubAdmin.getTaxAgentId(), allSubAdminRangesCuttent, tenantKey); + // 其他分管理员的所有人员 + List otherSubAdminSalaryEmployees = this.getManageRangeSalaryEmployees(null, taxAgentSubAdmin.getTaxAgentId(), otherSubAdminRangesExist, tenantKey); + for (SalaryEmployee se : currentSubAdminSalaryEmployees) { + Optional optionalSe = otherSubAdminSalaryEmployees.stream().filter(f -> f.getEmployeeId().equals(se.getEmployeeId())).findFirst(); + if (optionalSe.isPresent()) { + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 110149, "不可包含其他分管理员的人员")); + } + } + /** 检查当前分管理员的范围与其他分管理员人员范围===========================end */ + + /** 检查当前分管理员的范围与所属个税扣缴义务人的人员范围===========================start */ + // 所属个税扣缴义务人的所有分管理员的管理范围 + List allSubAdminRanges = Lists.newArrayList(allSubAdminRangesExist); + allSubAdminRanges.addAll(result.getNeedInsertTaxAgentManageRanges()); + allSubAdminRanges.addAll(result.getNeedUpdateTaxAgentManageRanges()); + // 去重 + allSubAdminRanges = allSubAdminRanges.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>( + Comparator.comparing(f -> f.getTaxAgentSubAdminId() + "." + f.getRangeType() + "." + f.getTargetType() + "." + f.getTargetId() + "." + f.getEmployeeStatus() + "." + f.getIncludeType())) + ), ArrayList::new)); + // 所属个税扣缴义务人的所有人员 + List allRanges = listByTaxAgentId(taxAgentSubAdmin.getTaxAgentId(), tenantKey); + List allSalaryEmployees = this.getManageRangeSalaryEmployees(null, taxAgentSubAdmin.getTaxAgentId(), allRanges, tenantKey); + // 所有分管理员的所有人员 + List allSubAdminSalaryEmployees = this.getManageRangeSalaryEmployees(null, taxAgentSubAdmin.getTaxAgentId(), allSubAdminRanges, tenantKey); + List allSalaryEmployeeIds = allSalaryEmployees.stream().map(SalaryEmployee::getEmployeeId).collect(Collectors.toList()); + allSubAdminSalaryEmployees.removeIf(a -> allSalaryEmployeeIds.contains(a.getEmployeeId())); + if (CollectionUtils.isNotEmpty(allSubAdminSalaryEmployees)) { + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 110125, "超出了整体人员范围")); + } + /** 检查当前分管理员的范围与所属个税扣缴义务人的人员范围===========================end */ + + // 保存 + if (CollectionUtils.isNotEmpty(result.getNeedInsertTaxAgentManageRanges())) { + this.saveBatch(result.getNeedInsertTaxAgentManageRanges()); + } + if (CollectionUtils.isNotEmpty(result.getNeedUpdateTaxAgentManageRanges())) { + this.updateBatchById(result.getNeedUpdateTaxAgentManageRanges()); + } + /** 同步本地人员范围的关联人员=========================== */ + List finalAllSubAdminRanges = allSubAdminRanges; + taskExecutor.execute(() -> { + try { + DSTenantKeyThreadVar.tenantKey.set(tenantKey); + syncLocalEmp(taxAgentSubAdmin.getTaxAgentId(), allSalaryEmployees, finalAllSubAdminRanges, employeeId, tenantKey); + } finally { + DSTenantKeyThreadVar.tenantKey.remove(); + } + }); + // 记录日志 todo + } + + /** + * 根据分管理员id获取管理范围列表 + * + * @param subAdminId + * @param tenantKey + * @return + */ + private List listBySubAdminId(Long subAdminId, String tenantKey) { + return new LambdaQueryChainWrapper<>(taxAgentManageRangeMapper) + .eq(TaxAgentManageRangePO::getTenantKey, tenantKey) + .eq(TaxAgentManageRangePO::getDeleteType, 0) + .eq(TaxAgentManageRangePO::getTaxAgentSubAdminId, subAdminId) + .eq(TaxAgentManageRangePO::getRangeType, TaxAgentRangeTypeEnum.SUBADMIN.getValue()) + .orderByDesc(TaxAgentManageRangePO::getId) + .list(); + } + + private List listByIds(Collection ids, String tenantKey) { + if (CollectionUtils.isEmpty(ids)) { + return Collections.emptyList(); + } + return new LambdaQueryChainWrapper<>(taxAgentManageRangeMapper) + .eq(TaxAgentManageRangePO::getTenantKey, tenantKey) + .eq(TaxAgentManageRangePO::getDeleteType, 0) + .in(TaxAgentManageRangePO::getId, ids) + .orderByDesc(TaxAgentManageRangePO::getId) + .list(); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void deleteByIds(Collection ids, Long employeeId, String tenantKey) { + // 查询管理范围 + List taxAgentManageRanges = listByIds(ids, tenantKey); + if (CollectionUtils.isEmpty(taxAgentManageRanges)) { + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98604, "数据不存在或已被删除")); + } + List taxAgentIds = taxAgentManageRanges.stream().map(TaxAgentManageRangePO::getTaxAgentId).distinct().collect(Collectors.toList()); + if (taxAgentIds.size() > 1) { + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(110159, "一次只能删一个个税个税扣缴义务人的范围")); + } + Collection finalIds = ids; + taxAgentManageRanges = this.listByTaxAgentIds(taxAgentIds, tenantKey); + List allManageRanges = taxAgentManageRanges.stream().filter(f -> !finalIds.contains(f.getId())).collect(Collectors.toList()); + List allRanges = allManageRanges.stream().filter(f -> f.getRangeType().equals(TaxAgentRangeTypeEnum.TAXAGENT.getValue())).collect(Collectors.toList()); + List allSubAdminRanges = allManageRanges.stream().filter(f -> f.getRangeType().equals(TaxAgentRangeTypeEnum.SUBADMIN.getValue())).collect(Collectors.toList()); + Long taxAgentId = taxAgentIds.get(0); + List allSalaryEmployees = this.getManageRangeSalaryEmployees(null, taxAgentId, allRanges, tenantKey); + + List allSubAdminSalaryEmployees = this.getManageRangeSalaryEmployees(null, taxAgentId, allSubAdminRanges, tenantKey); + allSalaryEmployees.forEach(f -> { + allSubAdminSalaryEmployees.removeIf(a -> a.getEmployeeId().equals(f.getEmployeeId())); + }); + if (CollectionUtils.isNotEmpty(allSubAdminSalaryEmployees)) { + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 110160, "分管理员存在超出整体人员范围以外的人员,不可删除")); + } + // 删除管理范围 + new LambdaUpdateChainWrapper<>(taxAgentManageRangeMapper) + .eq(TaxAgentManageRangePO::getDeleteType, 0) + .eq(TaxAgentManageRangePO::getTenantKey, tenantKey) + .in(TaxAgentManageRangePO::getId, ids) + .set(TaxAgentManageRangePO::getDeleteType, 1) + .update(); + /** 同步本地人员范围的关联人员=========================== */ + taskExecutor.execute(() -> { + try { + DSTenantKeyThreadVar.tenantKey.set(tenantKey); + syncLocalEmp(taxAgentId, allSalaryEmployees, allSubAdminRanges, employeeId, tenantKey); + } finally { + DSTenantKeyThreadVar.tenantKey.remove(); + } + }); + // 记录日志 todo + } + + @Override + public void deleteByTaxAgentIds(Collection taxAgentIds, String tenantKey) { + new LambdaUpdateChainWrapper<>(taxAgentManageRangeMapper) + .eq(TaxAgentManageRangePO::getDeleteType, 0) + .eq(TaxAgentManageRangePO::getTenantKey, tenantKey) + .in(TaxAgentManageRangePO::getTaxAgentId, taxAgentIds) + .set(TaxAgentManageRangePO::getDeleteType, 1) + .update(); + // 删除管理范围下的所有人员 + taxAgentEmployeeService.deleteByTaxAgentIds(taxAgentIds, tenantKey); + } + + @Override + public void deleteBySubAdmins(Collection subAdminIds, String tenantKey) { + if (CollectionUtils.isEmpty(subAdminIds)) { + return; + } + new LambdaUpdateChainWrapper<>(taxAgentManageRangeMapper) + .eq(TaxAgentManageRangePO::getDeleteType, 0) + .eq(TaxAgentManageRangePO::getTenantKey, tenantKey) + .in(TaxAgentManageRangePO::getTaxAgentSubAdminId, subAdminIds) + .set(TaxAgentManageRangePO::getDeleteType, 1) + .update(); + // 删除管理范围下的所有人员 + taxAgentSubAdminEmployeeService.deleteBySubAdminIds(subAdminIds, tenantKey); + } + + @AsyncListener(topic = "hrm_resource_queue") + public void receiveHrmResourceQueue(AsyncBean asyncBean) { + log.info("接受到人员变动的结果:{}", JSONObject.toJSONString(asyncBean)); + // todo 过滤必要性事件类型进行处理,后续加上时间间隔,避免人事批量操作时,监听事件过多 + if (asyncBean == null || asyncBean.getMessage() == null) { + log.error("接受到人员变动的结果失败"); + } + String tenantKey = asyncBean.getMessage().getTenantKey(); + // 开始同步 + taskExecutor.execute(() -> { + try { + DSTenantKeyThreadVar.tenantKey.set(tenantKey); + handleSyncTaxAgentEmpData(tenantKey); + } finally { + DSTenantKeyThreadVar.tenantKey.remove(); + } + }); + } + + /** + * 同步处理所有人员泛微 + * + * @param tenantKey + */ + private void handleSyncTaxAgentEmpData(String tenantKey) { + List allManageRanges = new LambdaQueryChainWrapper<>(taxAgentManageRangeMapper) + .eq(TaxAgentManageRangePO::getTenantKey, tenantKey) + .eq(TaxAgentManageRangePO::getDeleteType, 0) + .orderByDesc(TaxAgentManageRangePO::getId) + .list(); + if (CollectionUtils.isEmpty(allManageRanges)) { + return; + } + List taxAgentIds = allManageRanges.stream().map(m -> m.getTaxAgentId()).distinct().collect(Collectors.toList()); + + List taxAgentEmpSaveParamList = Lists.newArrayList(); + List subAdminEmpSaveParamList = Lists.newArrayList(); + taxAgentIds.forEach(taxAgentId -> { + // 当前个税扣缴义务人的所有范围 + List allRanges = allManageRanges.stream().filter(f -> f.getTaxAgentId().equals(taxAgentId) && f.getRangeType().equals(TaxAgentRangeTypeEnum.TAXAGENT.getValue())).collect(Collectors.toList()); + List allSalaryEmployees = this.getManageRangeSalaryEmployees(null, taxAgentId, allRanges, tenantKey); + taxAgentEmpSaveParamList.add(getTaxAgentEmpSyncParam(taxAgentId, allSalaryEmployees)); + List allSubAdminRanges = allManageRanges.stream().filter(f -> f.getTaxAgentId().equals(taxAgentId) && f.getRangeType().equals(TaxAgentRangeTypeEnum.SUBADMIN.getValue())).collect(Collectors.toList()); + + subAdminEmpSaveParamList.addAll(getTaxAgentSubAdminEmpSyncParam(taxAgentId, allSubAdminRanges, tenantKey)); + }); + Long employeeId = 0L; + // 同步管理员的人员 + taxAgentEmployeeService.syncTaxAgentEmployee(taxAgentEmpSaveParamList, employeeId, tenantKey); + // 同步分管理员的人员 + taxAgentSubAdminEmployeeService.syncTaxAgentSubAdminEmployee(subAdminEmpSaveParamList, employeeId, tenantKey); + } + + /** + * 获取个税扣缴义务人的同步参数 + * + * @param taxAgentId + * @param allSalaryEmployees + * @return + */ + private TaxAgentEmpSaveParam getTaxAgentEmpSyncParam(Long taxAgentId, List allSalaryEmployees) { + return TaxAgentEmpSaveParam.builder() + .taxAgentId(taxAgentId) + .salaryEmployeeList(allSalaryEmployees) + .build(); + } + + /** + * 获取分管理员的同步参数 + * + * @param taxAgentId + * @param allSubAdminRanges + * @param tenantKey + * @return + */ + private List getTaxAgentSubAdminEmpSyncParam(Long taxAgentId, List allSubAdminRanges, String tenantKey) { + List allSubAdminIds = allSubAdminRanges.stream().map(TaxAgentManageRangePO::getTaxAgentSubAdminId).distinct().collect(Collectors.toList()); + List subAdminEmpSaveParamList = Lists.newArrayList(); + allSubAdminIds.forEach(e -> { + List singSubAdminRanges = allSubAdminRanges.stream().filter(r -> e.equals(r.getTaxAgentSubAdminId())).collect(Collectors.toList()); + List subAdminSalaryEmployees = this.getManageRangeSalaryEmployees(null, taxAgentId, singSubAdminRanges, tenantKey); + + subAdminEmpSaveParamList.add(TaxAgentSubAdminEmpSaveParam.builder() + .taxAgentId(taxAgentId) + .subAdminId(e) + .salaryEmployeeList(subAdminSalaryEmployees) + .build()); + }); + return subAdminEmpSaveParamList; + } + + /** + * 同步本地范围关联人员 + * + * @param taxAgentId + * @param allSalaryEmployees 个税扣缴义务人下的所有人员 + * @param allSubAdminRanges + * @param employeeId + * @param tenantKey + */ + private void syncLocalEmp(Long taxAgentId, List allSalaryEmployees, List allSubAdminRanges, Long employeeId, String tenantKey) { + List taxAgentEmpSaveParamList = Collections.singletonList(getTaxAgentEmpSyncParam(taxAgentId, allSalaryEmployees)); + // 同步个税扣缴义务人的人员 + taxAgentEmployeeService.syncTaxAgentEmployee(taxAgentEmpSaveParamList, employeeId, tenantKey); + + List subAdminEmpSaveParamList = getTaxAgentSubAdminEmpSyncParam(taxAgentId, allSubAdminRanges, tenantKey); + // 同步分管理员的人员 + taxAgentSubAdminEmployeeService.syncTaxAgentSubAdminEmployee(subAdminEmpSaveParamList, employeeId, tenantKey); + } +} diff --git a/src/com/engine/salary/service/impl/TaxAgentServiceImpl.java b/src/com/engine/salary/service/impl/TaxAgentServiceImpl.java index 044f688ea..9ac383d39 100644 --- a/src/com/engine/salary/service/impl/TaxAgentServiceImpl.java +++ b/src/com/engine/salary/service/impl/TaxAgentServiceImpl.java @@ -3,27 +3,34 @@ package com.engine.salary.service.impl; import com.engine.core.impl.Service; import com.engine.salary.biz.TaxAgentBiz; import com.engine.salary.cmd.TaxAgent.*; +import com.engine.salary.constant.TaxAgentPermissionConstant; import com.engine.salary.entity.datacollection.AddUpDeduction; import com.engine.salary.entity.datacollection.AddUpSituation; import com.engine.salary.entity.datacollection.po.OtherDeductionPO; import com.engine.salary.entity.salaryarchive.po.SalaryArchiveTaxAgentPO; +import com.engine.salary.entity.taxagent.po.TaxAgentAdminPO; +import com.engine.salary.entity.taxagent.po.TaxAgentPO; import com.engine.salary.entity.taxrate.TaxAgent; import com.engine.salary.entity.taxrate.param.TaxAgentQueryParam; +import com.engine.salary.enums.taxagent.TaxAgentRoleTypeEnum; import com.engine.salary.exception.SalaryRunTimeException; import com.engine.salary.mapper.TaxAgentMapper; +import com.engine.salary.mapper.archive.SalaryArchiveMapper; import com.engine.salary.mapper.archive.SalaryArchiveTaxAgentMapper; import com.engine.salary.mapper.datacollection.AddUpDeductionMapper; import com.engine.salary.mapper.datacollection.AddUpSituationMapper; import com.engine.salary.mapper.datacollection.OtherDeductionMapper; -import com.engine.salary.service.TaxAgentService; +import com.engine.salary.service.*; import com.engine.salary.util.SalaryI18nUtil; import com.engine.salary.util.db.MapperProxyFactory; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.BeanUtils; +import org.springframework.transaction.annotation.Transactional; -import java.util.Collection; -import java.util.List; -import java.util.Map; +import java.time.LocalDateTime; +import java.util.*; +import java.util.stream.Collectors; public class TaxAgentServiceImpl extends Service implements TaxAgentService { @@ -139,4 +146,635 @@ public class TaxAgentServiceImpl extends Service implements TaxAgentService { public TaxAgent getById(Long id) { return getTaxAgentMapper().getById(id); } + + + private TaxAgentMapper taxAgentMapper; +// +// private ExtEmployeeService extEmployeeService; + + private TaxAgentBaseService taxAgentBaseService; + + private TaxAgentAdminService taxAgentAdminService; + +// private TaxAgentSubAdminService taxAgentSubAdminService; + +// private TaxAgentManageRangeService taxAgentManageRangeService; + + private TaxAgentEmpService taxAgentEmpService; + +// private TaxAgentSubAdminEmpService taxAgentSubAdminEmpService; + + private SalaryArchiveMapper salaryArchiveMapper; + + private AddUpDeductionMapper addUpDeductionMapper; + + private OtherDeductionMapper otherDeductionMapper; + + private AddUpSituationMapper addUpSituationMapper; + + +// private PaymentAgencyMapper paymentAgencyMapper; + +// private SIArchivesSocialMapper siArchivesSocialMapper; + +// private SIArchivesFundMapper siArchivesFundMapper; + +// private SIArchivesOtherMapper siArchivesOtherMapper; + +// private AuthorityService authorityService; + + private SalaryAcctRecordService salaryAcctRecordService; + + private SIAccountService siAccountService; + + private HrmCommonHrmStatusService hrmCommonHrmStatusService; + + @Override + public TaxAgentRoleTypeEnum getRoleType(Long currentEmployeeId) { + TaxAgentRoleTypeEnum roleType = TaxAgentRoleTypeEnum.NONE; + if (isChief(currentEmployeeId)) { + return TaxAgentRoleTypeEnum.CHIEF; + } + // 是否开启分权 + boolean isOpenDevolution = taxAgentBaseService.isOpenDevolution(); + if (!isOpenDevolution) { + List taxAgentAdmins = taxAgentAdminService.listByEmployeeId(currentEmployeeId, currentTenantKey); + if (CollectionUtils.isNotEmpty(taxAgentAdmins)) { + return TaxAgentRoleTypeEnum.ADMIN; + } + List taxAgentSubAdmins = taxAgentSubAdminService.listByAndEmployeeId(currentEmployeeId, currentTenantKey); + if (CollectionUtils.isNotEmpty(taxAgentSubAdmins)) { + return TaxAgentRoleTypeEnum.SUBADMIN; + } + } + return roleType; + } + + @Override + public Boolean isChief(Long currentEmployeeId) { + + return currentEmployeeId == 1; + + //return authorityService.checkPermissionSet(TaxAgentPermissionConstant.MENU_CODE, TaxAgentPermissionConstant.ITEM_CODE_DEVOLUTION, currentEmployeeId); + } + + @Override + public Boolean isDefaultOpen(Long currentEmployeeId, String currentTenantKey) { + return authorityService.checkPermissionSet(TaxAgentPermissionConstant.MENU_CODE, TaxAgentPermissionConstant.ITEM_CODE_DEFAULT, currentEmployeeId); + } + + @Override + public Boolean isAdminEnable(Long currentEmployeeId, String currentTenantKey) { + // 如果不是超管,是管理员 + if (!isChief(currentEmployeeId)) { + // 没有开启分权 + if (!isOpenDevolution(currentTenantKey)) { + return Boolean.FALSE; + } else { + // 自己有没有被分配为管理员 + List taxAgentAdminList = taxAgentAdminService.listByEmployeeId(currentEmployeeId); + return CollectionUtils.isNotEmpty(taxAgentAdminList); + } + } + return Boolean.TRUE; + } + + @Override + public Page listPage(Page page, TaxAgentQueryParam queryParam, String currentTenantKey) { + taxAgentMapper.list(page, queryParam, currentTenantKey); + return page; + } + + @Override + public List list(TaxAgentQueryParam queryParam, String currentTenantKey) { + return taxAgentMapper.list(queryParam, currentTenantKey); + } + + @Override + public List listByIds(Collection ids, String tenantKey) { + return new LambdaQueryChainWrapper<>(taxAgentMapper) + .eq(TaxAgentPO::getTenantKey, tenantKey) + .eq(TaxAgentPO::getDeleteType, 0) + .in(TaxAgentPO::getId, ids) + .list(); + } + + @Override + public List listAll(String tenantKey) { + return new LambdaQueryChainWrapper<>(taxAgentMapper) + .eq(TaxAgentPO::getTenantKey, tenantKey) + .eq(TaxAgentPO::getDeleteType, 0) + .list(); + } + + @Override + public TaxAgentPO getById(Long id, String tenantKey) { + return new LambdaQueryChainWrapper<>(taxAgentMapper) + .eq(TaxAgentPO::getTenantKey, tenantKey) + .eq(TaxAgentPO::getDeleteType, 0) + .eq(TaxAgentPO::getId, id) + .one(); + } + + @Override + public Collection findAll(String tenantKey) { + List taxAgents = taxAgentMapper.list(TaxAgentQueryParam.builder().build(), tenantKey); + return TaxAgentBO.convertToListDTO(taxAgents, tenantKey); + } + + @Override + public Collection listAllTaxAgents(Long employeeId, String tenantKey) { + List taxAgents = taxAgentMapper.list(TaxAgentQueryParam.builder().build(), tenantKey); + return handleForDevolution(taxAgents, employeeId, tenantKey); + } + + @Override + public Collection listAllTaxAgentsAsAdmin(Long employeeId, String tenantKey) { + List taxAgents = taxAgentMapper.list(TaxAgentQueryParam.builder().build(), tenantKey); + // 是否开启分权 + boolean isOpenDevolution = taxAgentBaseService.isOpenDevolution(tenantKey); + if (!isOpenDevolution) { + return taxAgents; + } + List taxAgentIds = taxAgents.stream().map(TaxAgentPO::getId).collect(Collectors.toList()); + List enableTaxAgentIds = Lists.newArrayList(); + // 1.判断自己是否是管理员, 如果是管理员,就是能够查看所属个税扣缴义务人 + List taxAgentAdminList = taxAgentAdminService.listByTaxAgentIds(taxAgentIds, tenantKey); + // 是管理员的列表 + List adminTaxAgentIds = taxAgentAdminList.stream().filter(f -> f.getEmployeeId().equals(employeeId)).map(TaxAgentAdminPO::getTaxAgentId).collect(Collectors.toList()); + + enableTaxAgentIds.addAll(adminTaxAgentIds); + return taxAgents.stream().filter(f -> enableTaxAgentIds.contains(f.getId())).collect(Collectors.toList()); + } + + @Override + public Collection listAllTaxAgentsAsRange(List employeeIds, String tenantKey) { + List taxAgents = taxAgentMapper.list(TaxAgentQueryParam.builder().build(), tenantKey); + List taxAgentIds = taxAgents.stream().map(TaxAgentPO::getId).collect(Collectors.toList()); + + List taxAgentEmployees = taxAgentEmpService.listByTaxAgentIds(taxAgentIds, tenantKey); + + if (CollectionUtils.isEmpty(taxAgentEmployees)) { + return Lists.newArrayList(); + } + + // 转换数据结构 + List allemployeeIds = taxAgentEmployees.stream().map(TaxAgentEmpPO::getEmployeeId).distinct().collect(Collectors.toList()); + + return allemployeeIds.stream().map(m -> { + List enableTaxAgentIds = taxAgentEmployees.stream().filter(f -> f.getEmployeeId().equals(m)).map(TaxAgentEmpPO::getTaxAgentId).distinct() + .collect(Collectors.toList()); + return TaxAgentEmployeeTaxAgentDTO.builder() + .employeeId(m) + .taxAgentIds(enableTaxAgentIds) + .build(); + }).collect(Collectors.toList()); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public String save(TaxAgentSaveParam saveParam, Long employeeId, String tenantKey) { + // 是否开启分权 + boolean isOpenDevolution = taxAgentBaseService.isOpenDevolution(tenantKey); + if (isOpenDevolution && saveParam.getAdminUserId() == null) { + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 106271, "请选择管理员")); + } + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("tenant_key", tenantKey) + .eq("delete_type", 0) + .eq("name", saveParam.getName()); + List taxAgents = taxAgentMapper.selectList(queryWrapper); + if (CollectionUtils.isNotEmpty(taxAgents)) { + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 98080, "名称不允许重复")); + } + PaymentAgencyPO paymentAgencyPO = new LambdaQueryChainWrapper<>(paymentAgencyMapper) + .eq(PaymentAgencyPO::getTenantKey, tenantKey) + .eq(PaymentAgencyPO::getDeleteType, DeleteTypeEnum.NOT_DELETED.getValue()) + .eq(PaymentAgencyPO::getAgencyName, saveParam.getName()) + .one(); + if (paymentAgencyPO != null) { + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 115130, "名称不允许与社保福利代缴机构名称重复")); + } + // 保存 + saveParam.setId(IdGenerator.generate()); + TaxAgentPO taxAgent = TaxAgentBO.convertToPO(saveParam, employeeId, tenantKey); + taxAgentMapper.insert(taxAgent); + if (isOpenDevolution) { + taxAgentAdminService.batchInsert(saveParam.getId(), Collections.singletonList(saveParam.getAdminUserId()), employeeId, tenantKey); + } + // 记录日志 + SalaryLoggerUtil.recordAddSingleLog(taxAgentLoggerTemplate, + taxAgent.getId(), + taxAgent.getName(), + SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 93766, "新增个税扣缴义务人"), + SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 93766, "新增个税扣缴义务人"), + taxAgent); + + return StringUtils.EMPTY + taxAgent.getId(); + } + + @Override + public String paymentAgencyUpdate(TaxAgentPO taxAgentPO, Long employeeId, String tenantKey) { + taxAgentMapper.updateById(taxAgentPO); + return ""; + } + + @Override + @Transactional(rollbackFor = Exception.class) + public String update(TaxAgentSaveParam saveParam, Long employeeId, String tenantKey) { + TaxAgentPO taxAgent = getById(saveParam.getId(), tenantKey); + if (taxAgent == null) { + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 100545, "个税扣缴义务人不存在")); + } + // 是否开启分权 + boolean isOpenDevolution = taxAgentBaseService.isOpenDevolution(tenantKey); + if (isOpenDevolution && saveParam.getAdminUserId() == null) { + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 106271, "请选择管理员")); + } + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("tenant_key", tenantKey) + .eq("delete_type", 0) + .eq("name", saveParam.getName()); + List individualTaxWithholdingAgents = taxAgentMapper.selectList(queryWrapper); + boolean nameExist = CollectionUtils.emptyIfNull(individualTaxWithholdingAgents).stream().anyMatch(e -> !Objects.equals(e.getId(), saveParam.getId())); + if (nameExist) { + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 98080, "名称不允许重复")); + } + TaxAgentPO taxAgentNew = new TaxAgentPO(); + BeanUtils.copyProperties(taxAgent, taxAgentNew); + BeanUtils.copyProperties(saveParam, taxAgentNew); + taxAgentNew.setUpdateTime(LocalDateTime.now()); + taxAgentMapper.updateById(taxAgentNew); + if (isOpenDevolution) { + Boolean isUnEnableChange = adminChangeCheck(TaxAgentAdminChangeCheckParam.builder() + .taxAgentId(saveParam.getId()) + .adminUserId(saveParam.getAdminUserId()) + .build(), employeeId, tenantKey); + if (isUnEnableChange) { + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 115937, "该管理员有未归档核算数据,不可更换管理员")); + } + // 删除管理员 + taxAgentAdminService.deleteByTaxAgentIds(Collections.singletonList(taxAgent.getId()), tenantKey); + // 新增管理员 + taxAgentAdminService.batchInsert(saveParam.getId(), Collections.singletonList(saveParam.getAdminUserId()), employeeId, tenantKey); + } + // 记录日志 + SalaryLoggerUtil.recordUpdateSingleLog(taxAgentLoggerTemplate, + taxAgent.getId(), + taxAgentNew.getName(), + SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 93767, "编辑个税扣缴义务人"), + SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 93767, "编辑个税扣缴义务人"), + taxAgent, + taxAgentNew); + + return StringUtils.EMPTY; + } + + @Override + public Boolean adminChangeCheck(TaxAgentAdminChangeCheckParam checkParam, Long currentEmployeeId, String currentTenantKey) { + List taxAgentAdminList = taxAgentAdminService.listByTaxAgentIds(Collections.singletonList(checkParam.getTaxAgentId()), currentTenantKey); + Long adminUserId = CollectionUtils.isNotEmpty(taxAgentAdminList) ? taxAgentAdminList.get(0).getEmployeeId() : 0L; + boolean isChanged = checkParam.getAdminUserId() != null && !adminUserId.equals(checkParam.getAdminUserId()); + // 更换了管理员 + if (isChanged) { + // 检查是否核算 + // 1.社保福利档案是否有核算未归档 + Boolean checkedValue = siAccountService.changeAdminUnfiledCheck(adminUserId, currentTenantKey); + // 2.薪资核算是否有核算未归档 + List salaryAcctRecords = salaryAcctRecordService.listByStatusAndEmployeeId(SalaryAcctRecordStatusEnum.NOT_ARCHIVED, adminUserId, currentTenantKey); + if (CollectionUtils.isNotEmpty(salaryAcctRecords) || checkedValue) { + return Boolean.TRUE; + } + } + return Boolean.FALSE; + } + + @Override + @Transactional(rollbackFor = Exception.class) + public String delete(Collection ids, Long employeeId, String tenantKey) { + + List taxAgents = taxAgentMapper.list(TaxAgentQueryParam.builder().ids(ids).build(), tenantKey); + if (CollectionUtils.isEmpty(taxAgents)) { + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 85382, "要删除的个税扣缴义务人在不存在或已删除")); + } + // 正在使用的记录不允许删除 + boolean checkUsed = checkUsed(ids, tenantKey); + if (checkUsed) { + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(tenantKey, UserContext.getCurrentEmployeeId(), 100570, "正在使用的记录不允许删除")); + } + // 删除管理员 + taxAgentAdminService.deleteByTaxAgentIds(ids, tenantKey); + // 删除分管理员和对应管理范围 + taxAgentSubAdminService.deleteByTaxAgentIds(ids, tenantKey); + // 删除人员范围 + taxAgentManageRangeService.deleteByTaxAgentIds(ids, tenantKey); + + new LambdaUpdateChainWrapper<>(taxAgentMapper) + .eq(TaxAgentPO::getDeleteType, 0) + .eq(TaxAgentPO::getTenantKey, tenantKey) + .in(TaxAgentPO::getId, ids) + .set(TaxAgentPO::getDeleteType, 1) + .update(); + // 记录日志 + taxAgents.forEach(e -> SalaryLoggerUtil.recordDeleteSingleLog(taxAgentLoggerTemplate, + e.getId(), + e.getName(), + SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 100546, "删除个税扣缴义务人"), + SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 100546, "删除个税扣缴义务人") + ":" + e.getName(), + e)); + + return StringUtils.EMPTY; + } + + /** + * 检查正在被使用的记录 + * + * @param ids + * @param tenantKey + * @return + */ + private boolean checkUsed(Collection ids, String tenantKey) { + // 被薪资档案引用 + List salaryArchiveList = new LambdaQueryChainWrapper<>(salaryArchiveMapper) + .eq(SalaryArchivePO::getDeleteType, 0) + .eq(SalaryArchivePO::getTenantKey, tenantKey) + .in(SalaryArchivePO::getTaxAgentId, ids) + .list(); + if (CollectionUtils.isNotEmpty(salaryArchiveList)) { + return Boolean.TRUE; + } + // 被社保福利档案引用 + List socialSchemePOList = new LambdaQueryChainWrapper<>(siArchivesSocialMapper) + .eq(InsuranceArchivesSocialSchemePO::getTenantKey, tenantKey) + .eq(InsuranceArchivesSocialSchemePO::getDeleteType, DeleteTypeEnum.NOT_DELETED.getValue()) + .in(InsuranceArchivesSocialSchemePO::getPaymentOrganization, ids) + .list(); + if (CollectionUtils.isNotEmpty(socialSchemePOList)) { + return Boolean.TRUE; + } + List fundSchemePOList = new LambdaQueryChainWrapper<>(siArchivesFundMapper) + .eq(InsuranceArchivesFundSchemePO::getTenantKey, tenantKey) + .eq(InsuranceArchivesFundSchemePO::getDeleteType, DeleteTypeEnum.NOT_DELETED.getValue()) + .in(InsuranceArchivesFundSchemePO::getPaymentOrganization, ids) + .list(); + if (CollectionUtils.isNotEmpty(fundSchemePOList)) { + return Boolean.TRUE; + } + List otherSchemePOList = new LambdaQueryChainWrapper<>(siArchivesOtherMapper) + .eq(InsuranceArchivesOtherSchemePO::getTenantKey, tenantKey) + .eq(InsuranceArchivesOtherSchemePO::getDeleteType, DeleteTypeEnum.NOT_DELETED.getValue()) + .in(InsuranceArchivesOtherSchemePO::getPaymentOrganization, ids) + .list(); + if (CollectionUtils.isNotEmpty(otherSchemePOList)) { + return Boolean.TRUE; + } + + // 被外部人员引用 + List extEmployeeList = extEmployeeService.listAll(tenantKey); + List extTaxAgentIds = extEmployeeList.stream().map(ExtEmployeePO::getTaxAgentId).distinct().collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(extTaxAgentIds)) { + return ids.stream().anyMatch(e -> extTaxAgentIds.stream().anyMatch(f -> f.equals(e))); + } + + // 被累计专项附加扣除引用 + List addUpDeductionList = new LambdaQueryChainWrapper<>(addUpDeductionMapper) + .eq(AddUpDeductionPO::getDeleteType, 0) + .eq(AddUpDeductionPO::getTenantKey, tenantKey) + .in(AddUpDeductionPO::getTaxAgentId, ids) + .list(); + if (CollectionUtils.isNotEmpty(addUpDeductionList)) { + return Boolean.TRUE; + } + // 被其他免税扣除引用 + List otherDeductionList = new LambdaQueryChainWrapper<>(otherDeductionMapper) + .eq(OtherDeductionPO::getDeleteType, 0) + .eq(OtherDeductionPO::getTenantKey, tenantKey) + .in(OtherDeductionPO::getTaxAgentId, ids) + .list(); + if (CollectionUtils.isNotEmpty(otherDeductionList)) { + return Boolean.TRUE; + } + // 被往期累计情况引用 + List addUpSituationList = new LambdaQueryChainWrapper<>(addUpSituationMapper) + .eq(AddUpSituationPO::getDeleteType, 0) + .eq(AddUpSituationPO::getTenantKey, tenantKey) + .in(AddUpSituationPO::getTaxAgentId, ids) + .list(); + if (CollectionUtils.isNotEmpty(addUpSituationList)) { + return Boolean.TRUE; + } + + return Boolean.FALSE; + } + + @Override + public List> selectList(Long currentEmployeeId, String currentTenantKey) { + List taxAgents = taxAgentMapper.list(TaxAgentQueryParam.builder().build(), currentTenantKey); + taxAgents = handleForDevolution(taxAgents, currentEmployeeId, currentTenantKey); + return CollectionUtils.emptyIfNull(taxAgents).stream().map(m -> { + Map map = new HashMap<>(2); + map.put("id", String.valueOf(m.getId())); + map.put("content", m.getName()); + return map; + }).collect(Collectors.toList()); + } + + /** + * 分权处理 + * + * @param taxAgents + * @param currentEmployeeId + * @param currentTenantKey + * @return + */ + private List handleForDevolution(List taxAgents, Long currentEmployeeId, String currentTenantKey) { + // 是否开启分权 + boolean isOpenDevolution = taxAgentBaseService.isOpenDevolution(currentTenantKey); + if (!isOpenDevolution || isChief(currentEmployeeId, currentTenantKey)) { + return taxAgents; + } + List taxAgentIds = taxAgents.stream().map(TaxAgentPO::getId).collect(Collectors.toList()); + List enableTaxAgentIds = Lists.newArrayList(); + // 1.判断自己是否是管理员, 如果是管理员,就是能够查看所属个税扣缴义务人 + List taxAgentAdminList = taxAgentAdminService.listByTaxAgentIdsAndEmployeeId(taxAgentIds, currentEmployeeId, currentTenantKey); + // 是管理员的列表 + List adminTaxAgentIds = taxAgentAdminList.stream().map(TaxAgentAdminPO::getTaxAgentId).collect(Collectors.toList()); + + enableTaxAgentIds.addAll(adminTaxAgentIds); + // 2.根据作为非管理员查找自己作为分管理员的个税扣缴义务人id + List noAdminTaxAgentIds = taxAgents.stream() + .map(TaxAgentPO::getId) + .filter(id -> !adminTaxAgentIds.contains(id)).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(noAdminTaxAgentIds)) { + List taxAgentSubAdmins = taxAgentSubAdminService.listByTaxAgentIdsAndEmployeeId(noAdminTaxAgentIds, currentEmployeeId, currentTenantKey); + List sunAdminTaxAgentIds = taxAgentSubAdmins.stream().map(TaxAgentSubAdminPO::getTaxAgentId).collect(Collectors.toList()); + enableTaxAgentIds.addAll(sunAdminTaxAgentIds); + } + return taxAgents.stream().filter(f -> enableTaxAgentIds.contains(f.getId())).collect(Collectors.toList()); + } + + @Override + public Boolean isOpenDevolution(String tenantKey) { + return taxAgentBaseService.isOpenDevolution(tenantKey); + } + + @Override + public List listTaxAgentAndEmployeeTree(Long employeeId, String tenantKey) { + return listTaxAgentAndEmployeeTree(null, employeeId, tenantKey); + } + + @Override + public List listTaxAgentAndEmployee(Long employeeId, String tenantKey) { + return listTaxAgentAndEmployee(null, employeeId, tenantKey); + } + + @Override + public List listTaxAgentAndEmployeeTree(SalaryEmployeeStatusEnum employeeStatus, Long employeeId, String tenantKey) { + List taxAgentManageRangeEmployeeList = Lists.newArrayList(); + // 所有个税扣缴义务人 + List allTaxAgents = listAll(tenantKey); + if (CollectionUtils.isEmpty(allTaxAgents)) { + return taxAgentManageRangeEmployeeList; + } + + List taxAgentIds = allTaxAgents.stream().map(TaxAgentPO::getId).collect(Collectors.toList()); + List allEmployees = taxAgentMapper.listEmployee(tenantKey); + if (employeeStatus != null) { + List personnelStatusList; + // 查询人员状态 + List hrmStatusList = hrmCommonHrmStatusService.list(tenantKey); + if (employeeStatus.equals(SalaryEmployeeStatusEnum.NORMAL)) { + personnelStatusList = hrmStatusList.stream().filter(f -> f.getJobflag().equals(SalaryJobFlagEnum.normal.getValue())).map(m -> m.getCodeId() + "").collect(Collectors.toList()); + List finalPersonnelStatus1 = personnelStatusList; + allEmployees = allEmployees.stream().filter(f -> finalPersonnelStatus1.contains(f.getPersonnelStatus())).collect(Collectors.toList()); + } else if (employeeStatus.equals(SalaryEmployeeStatusEnum.UNAVAILABLE)) { + personnelStatusList = hrmStatusList.stream().filter(f -> f.getJobflag().equals(SalaryJobFlagEnum.unavailable.getValue())).map(m -> m.getCodeId() + "").collect(Collectors.toList()); + List finalPersonnelStatuss2 = personnelStatusList; + allEmployees = allEmployees.stream().filter(f -> finalPersonnelStatuss2.contains(f.getPersonnelStatus())).collect(Collectors.toList()); + } + } + + // 是否开启分权 + if (!isOpenDevolution(tenantKey) || isChief(employeeId, tenantKey)) { + return getTaxAgentEmp(allTaxAgents, taxAgentIds, allEmployees, tenantKey); + } + + // 1.判断自己是否是管理员, 如果是管理员,就是能够操作所属个税扣缴义务人下的所有人的数据 + List taxAgentAdminList = taxAgentAdminService.listByTaxAgentIdsAndEmployeeId(taxAgentIds, employeeId, tenantKey); + // 是管理员的列表 + List adminTaxAgentIds = taxAgentAdminList.stream().map(TaxAgentAdminPO::getTaxAgentId).collect(Collectors.toList()); + + if (CollectionUtils.isNotEmpty(adminTaxAgentIds)) { + taxAgentManageRangeEmployeeList.addAll(getTaxAgentEmp(allTaxAgents, adminTaxAgentIds, allEmployees, tenantKey)); + } + // 2.根据作为非管理员查找自己作为分管理员, 对应的管理范围人员 + List noAdminTaxAgentIds = allTaxAgents.stream() + .map(TaxAgentPO::getId) + .filter(id -> !adminTaxAgentIds.contains(id)).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(noAdminTaxAgentIds)) { + taxAgentManageRangeEmployeeList.addAll(getTaxAgentSubAdminEmp(allTaxAgents, noAdminTaxAgentIds, allEmployees, tenantKey)); + } + + return taxAgentManageRangeEmployeeList; + } + + /** + * 获取分管理员的关联人员 + * + * @param allTaxAgents + * @param noAdminTaxAgentIds + * @param allEmployees + * @param tenantKey + * @return + */ + private List getTaxAgentSubAdminEmp(List allTaxAgents, List noAdminTaxAgentIds, List allEmployees, String tenantKey) { + List taxAgentManageRangeEmployeeList = Lists.newArrayList(); + List taxAgentEmps = taxAgentSubAdminEmpService.listByTaxAgentIds(noAdminTaxAgentIds, tenantKey); + + taxAgentEmps = taxAgentEmps.stream().filter(f -> allEmployees.stream().anyMatch(e -> e.getEmployeeId().equals(f.getEmployeeId()))).collect(Collectors.toList()); + + List finalTaxAgentEmps = taxAgentEmps; + noAdminTaxAgentIds.forEach(e -> { + Optional optionalTaxAgent = allTaxAgents.stream().filter(t -> t.getId().equals(e)).findFirst(); + String taxAgentName = (optionalTaxAgent.isPresent() ? optionalTaxAgent.get().getName() : ""); + List taxAgentEmployees = finalTaxAgentEmps.stream().filter(f -> f.getTaxAgentId().equals(e)).map(m -> { + TaxAgentManageRangeEmployeeDTO.TaxAgentEmployee taxAgentEmployee = new TaxAgentManageRangeEmployeeDTO.TaxAgentEmployee(); + taxAgentEmployee.setEmployeeId(m.getEmployeeId()); + taxAgentEmployee.setUsername(m.getEmployeeName()); + return taxAgentEmployee; + }).collect(Collectors.toList()); + taxAgentManageRangeEmployeeList.add( + TaxAgentManageRangeEmployeeDTO.builder() + .taxAgentId(e) + .taxAgentName(taxAgentName) + .employeeList(taxAgentEmployees) + .build() + ); + }); + return taxAgentManageRangeEmployeeList; + } + + /** + * 获取个税口角义务人的关联人员 + * + * @param allTaxAgents + * @param taxAgentIds + * @param tenantKey + * @return + */ + private List getTaxAgentEmp(List allTaxAgents, List taxAgentIds, List allEmployees, String tenantKey) { + List taxAgentManageRangeEmployeeList = Lists.newArrayList(); + List taxAgentEmps = taxAgentEmpService.listByTaxAgentIds(taxAgentIds, tenantKey); + + taxAgentEmps = taxAgentEmps.stream().filter(f -> allEmployees.stream().anyMatch(e -> e.getEmployeeId().equals(f.getEmployeeId()))).collect(Collectors.toList()); + + List finalTaxAgentEmps = taxAgentEmps; + taxAgentIds.forEach(e -> { + Optional optionalTaxAgent = allTaxAgents.stream().filter(t -> t.getId().equals(e)).findFirst(); + String taxAgentName = (optionalTaxAgent.isPresent() ? optionalTaxAgent.get().getName() : ""); + List taxAgentEmployees = finalTaxAgentEmps.stream().filter(f -> f.getTaxAgentId().equals(e)).map(m -> { + TaxAgentManageRangeEmployeeDTO.TaxAgentEmployee taxAgentEmployee = new TaxAgentManageRangeEmployeeDTO.TaxAgentEmployee(); + taxAgentEmployee.setEmployeeId(m.getEmployeeId()); + taxAgentEmployee.setUsername(m.getEmployeeName()); + return taxAgentEmployee; + }).collect(Collectors.toList()); + taxAgentManageRangeEmployeeList.add( + TaxAgentManageRangeEmployeeDTO.builder() + .taxAgentId(e) + .taxAgentName(taxAgentName) + .employeeList(taxAgentEmployees) + .build() + ); + }); + return taxAgentManageRangeEmployeeList; + } + + @Override + public List listTaxAgentAndEmployee(SalaryEmployeeStatusEnum employeeStatus, Long employeeId, String tenantKey) { + List taxAgentEmployeeList = Lists.newArrayList(); + + List taxAgentManageRangeEmployeeList = listTaxAgentAndEmployeeTree(employeeStatus, employeeId, tenantKey); + taxAgentManageRangeEmployeeList.forEach(m -> { + List employeeList = m.getEmployeeList(); + if (CollectionUtils.isEmpty(employeeList)) { + taxAgentEmployeeList.add(TaxAgentEmployeeDTO.builder() + .taxAgentId(m.getTaxAgentId()) + .taxAgentName(m.getTaxAgentName()) + .employeeId(null) + .username(null) + .build()); + } else { + employeeList.forEach(f -> taxAgentEmployeeList.add(TaxAgentEmployeeDTO.builder() + .taxAgentId(m.getTaxAgentId()) + .taxAgentName(m.getTaxAgentName()) + .employeeId(f.getEmployeeId()) + .username(f.getUsername()) + .build())); + } + }); + + return taxAgentEmployeeList; + } + + } diff --git a/src/com/engine/salary/util/aes/AESUtils.java b/src/com/engine/salary/util/aes/AESUtils.java new file mode 100644 index 000000000..f36ddc001 --- /dev/null +++ b/src/com/engine/salary/util/aes/AESUtils.java @@ -0,0 +1,198 @@ +package com.engine.salary.util.aes; + +import com.weaver.formmodel.util.StringHelper; +import org.apache.commons.codec.binary.Base64; +import org.apache.commons.lang3.StringUtils; +import sun.misc.BASE64Decoder; +import weaver.general.Util; + +import javax.crypto.Cipher; +import javax.crypto.KeyGenerator; +import javax.crypto.spec.SecretKeySpec; +import java.io.UnsupportedEncodingException; +import java.math.BigInteger; + + +public class AESUtils { + + /** + * 密钥 + */ + public static String KEY = "123"; + + /** + * 算法 + */ + private static final String ALGORITHMSTR = "AES/ECB/PKCS5Padding"; + + public static void main(String[] args) throws Exception { + String content = " {&} bt1|17379|1|1|1=";//啊啊 + //System.out.println("加密前:" + content); + + String encrypt = aesEncrypt(content); + //System.out.println("加密后:" + encrypt); + + String decrypt = aesDecrypt(encrypt); + //System.out.println("解密后===>" + decrypt+"<==="); + } + + /** + * aes解密 + * @param encrypt 内容 + * @return + * @throws Exception + */ + public static String aesDecrypt(String encrypt) throws Exception { + if(StringHelper.isEmpty(encrypt)){ + return ""; + } + + encrypt = encrypt.replace("_ADD_","+"); + encrypt = encrypt.replace("_EQU_","="); + encrypt = encrypt.replace("_SEP_","/"); + return aesDecrypt(encrypt, KEY); + } + + /** + * aes加密 + * @param content + * @return + * @throws Exception + */ + public static String aesEncrypt(String content) throws Exception { + if(StringHelper.isEmpty(content)){ + return ""; + } + + String str = aesEncrypt(content, KEY); + str = str.replace("+", "_ADD_"); + str = str.replace("=", "_EQU_"); + str = str.replace("/", "_SEP_"); + return str; + } + + /** + * 将byte[]转为各种进制的字符串 + * @param bytes byte[] + * @param radix 可以转换进制的范围,从Character.MIN_RADIX到Character.MAX_RADIX,超出范围后变为10进制 + * @return 转换后的字符串 + */ + public static String binary(byte[] bytes, int radix){ + return new BigInteger(1, bytes).toString(radix);// 这里的1代表正数 + } + + /** + * base 64 encode + * @param bytes 待编码的byte[] + * @return 编码后的base 64 code + */ + public static String base64Encode(byte[] bytes){ + byte[] b = Base64.encodeBase64(bytes); + String str = ""; + try { + str = new String(b,"UTF-8"); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } + return str; + } + + /** + * base 64 decode + * @param base64Code 待解码的base 64 code + * @return 解码后的byte[] + * @throws Exception + */ + public static byte[] base64Decode(String base64Code) throws Exception{ + return StringUtils.isEmpty(base64Code) ? null : new BASE64Decoder().decodeBuffer(base64Code); + } + + + /** + * 将base64_编码解密 + * @param s + * @return + */ + public static String base64DecodeForMultilang(String s) { + if (s == null) { + return s; + } + if(Util.isEnableMultiLang()){ + try { + BASE64Decoder base64Decoder = new BASE64Decoder(); + return new String(base64Decoder.decodeBuffer(s.replaceAll("base64_", "")),"utf-8"); + } catch (Exception e) { + e.printStackTrace(); + return s; + } + }else{ + return s; + } + + } + + /** + * AES加密 + * @param content 待加密的内容 + * @param encryptKey 加密密钥 + * @return 加密后的byte[] + * @throws Exception + */ + public static byte[] aesEncryptToBytes(String content, String encryptKey) throws Exception { + KeyGenerator kgen = KeyGenerator.getInstance("AES"); + kgen.init(128); + Cipher cipher = Cipher.getInstance(ALGORITHMSTR); + cipher.init(Cipher.ENCRYPT_MODE, new SecretKeySpec(encryptKey.getBytes(), "AES")); + + return cipher.doFinal(content.getBytes("utf-8")); + } + + + /** + * AES加密为base 64 code + * @param content 待加密的内容 + * @param encryptKey 加密密钥 + * @return 加密后的base 64 code + * @throws Exception + */ + public static String aesEncrypt(String content, String encryptKey) throws Exception { + if(StringHelper.isEmpty(content)){ + return ""; + } + return base64Encode(aesEncryptToBytes(content, encryptKey)); + } + + /** + * AES解密 + * @param encryptBytes 待解密的byte[] + * @param decryptKey 解密密钥 + * @return 解密后的String + * @throws Exception + */ + public static String aesDecryptByBytes(byte[] encryptBytes, String decryptKey) throws Exception { + KeyGenerator kgen = KeyGenerator.getInstance("AES"); + kgen.init(128); + + Cipher cipher = Cipher.getInstance(ALGORITHMSTR); + cipher.init(Cipher.DECRYPT_MODE, new SecretKeySpec(decryptKey.getBytes(), "AES")); + byte[] decryptBytes = cipher.doFinal(encryptBytes); + + return new String(decryptBytes,"UTF-8"); + } + + + /** + * 将base 64 code AES解密 + * @param encryptStr 待解密的base 64 code + * @param decryptKey 解密密钥 + * @return 解密后的string + * @throws Exception + */ + public static String aesDecrypt(String encryptStr, String decryptKey) throws Exception { + if(StringHelper.isEmpty(encryptStr)){ + return ""; + } + return StringHelper.isEmpty(encryptStr) ? "" : aesDecryptByBytes(base64Decode(encryptStr), decryptKey); + } + +} diff --git a/src/com/engine/salary/web/TaxAgentController.java b/src/com/engine/salary/web/TaxAgentController.java index 9597d4e15..a0f09b47f 100644 --- a/src/com/engine/salary/web/TaxAgentController.java +++ b/src/com/engine/salary/web/TaxAgentController.java @@ -5,6 +5,7 @@ import com.engine.common.util.ServiceUtil; import com.engine.salary.service.TaxAgentService; import com.engine.salary.service.impl.TaxAgentServiceImpl; import com.engine.salary.util.ResponseResult; +import io.swagger.annotations.ApiOperation; import io.swagger.v3.oas.annotations.parameters.RequestBody; import weaver.general.BaseBean; import weaver.hrm.HrmUserVarify; @@ -29,6 +30,30 @@ public class TaxAgentController { return (TaxAgentService) ServiceUtil.getService(TaxAgentServiceImpl.class, user); } + private TaxAgentWrapper taxAgentWrapper; + + /** + * 是否是薪酬模块总管理员 + */ + @GET + @Path("/isChief") + @Produces(MediaType.APPLICATION_JSON) + public String isChief() { + User user = HrmUserVarify.getUser(request, response); + return new ResponseResult, Map>(user).run(getService(user)::list,ParamUtil.request2Map(request)); + return WeaResult.success(taxAgentWrapper.isChief(UserContext.getCurrentEmployeeId(), TenantContext.getCurrentTenantKey())); + } + + @GetMapping("/permission") + @ApiOperation("权限信息") + @WeaPermission(publicPermission = true) + public WeaResult> permission() { + return WeaResult.success(taxAgentWrapper.permission(UserContext.getCurrentEmployeeId(), TenantContext.getCurrentTenantKey())); + } + + + //------------------------------------------------------------------------------------------ + //个税扣缴义务人列表 @GET @Path("/list") diff --git a/src/com/engine/salary/wrapper/SalaryArchiveTaxAgentWrapper.java b/src/com/engine/salary/wrapper/SalaryArchiveTaxAgentWrapper.java index c44a6ae57..3a53de115 100644 --- a/src/com/engine/salary/wrapper/SalaryArchiveTaxAgentWrapper.java +++ b/src/com/engine/salary/wrapper/SalaryArchiveTaxAgentWrapper.java @@ -46,7 +46,7 @@ public class SalaryArchiveTaxAgentWrapper extends Service { return (TaxAgentService) ServiceUtil.getService(TaxAgentServiceImpl.class, user); } -// @Resource +// // private SalaryBatchService salaryBatchService; // @Autowired // private ExecutorService taskExecutor; diff --git a/src/com/engine/salary/wrapper/SalarySendWrapper.java b/src/com/engine/salary/wrapper/SalarySendWrapper.java index 1b2392a5e..e4f02ea7e 100644 --- a/src/com/engine/salary/wrapper/SalarySendWrapper.java +++ b/src/com/engine/salary/wrapper/SalarySendWrapper.java @@ -65,7 +65,7 @@ public class SalarySendWrapper extends Service { // } -// @Resource +// // private SalaryBatchService salaryBatchService; // @Autowired // private ExecutorService taskExecutor; diff --git a/src/com/engine/salary/wrapper/TaxAgentWrapper.java b/src/com/engine/salary/wrapper/TaxAgentWrapper.java new file mode 100644 index 000000000..f8464a8bf --- /dev/null +++ b/src/com/engine/salary/wrapper/TaxAgentWrapper.java @@ -0,0 +1,418 @@ +package com.engine.salary.wrapper; + +import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; +import com.google.common.collect.Maps; +import com.weaver.common.authority.format.FormatManager; +import com.weaver.common.component.browser.combination.TypesBrowserOption; +import com.weaver.common.component.form.WeaForm; +import com.weaver.common.component.form.item.WeaFormItem; +import com.weaver.common.component.form.item.WeaFormOption; +import com.weaver.common.component.table.WeaTable; +import com.weaver.common.component.table.page.Page; +import com.weaver.common.hrm.cache.HrmConfigSetCache; +import com.weaver.common.hrm.domain.employee.HrmStatus; +import com.weaver.common.hrm.service.HrmCommonEmployeeService; +import com.weaver.common.hrm.service.employee.HrmCommonHrmStatusService; +import com.weaver.framework.util.JsonUtil; +import com.weaver.hrm.salary.dao.SIEmployeeStatusMapper; +import com.weaver.hrm.salary.entity.agency.po.PaymentAgencyPO; +import com.weaver.hrm.salary.entity.siarchives.po.InsuranceEmployeeStatusPO; +import com.weaver.hrm.salary.entity.taxagent.bo.TaxAgentBO; +import com.weaver.hrm.salary.entity.taxagent.dto.TaxAgentEmployeeOptionDTO; +import com.weaver.hrm.salary.entity.taxagent.dto.TaxAgentFormDTO; +import com.weaver.hrm.salary.entity.taxagent.dto.TaxAgentManageRangeFormDTO; +import com.weaver.hrm.salary.entity.taxagent.dto.TaxAgentManageRangeListDTO; +import com.weaver.hrm.salary.entity.taxagent.param.*; +import com.weaver.hrm.salary.entity.taxagent.po.TaxAgentAdminPO; +import com.weaver.hrm.salary.entity.taxagent.po.TaxAgentPO; +import com.weaver.hrm.salary.exception.SalaryRunTimeException; +import com.weaver.hrm.salary.service.*; +import com.weaver.hrm.salary.util.SalaryAssert; +import com.weaver.hrm.salary.util.SalaryFormatUtil; +import com.weaver.hrm.salary.util.SalaryI18nUtil; +import com.weaver.hrm.salary.util.SalaryPageUtil; +import com.weaver.teams.domain.user.SimpleEmployee; +import com.weaver.teams.security.context.UserContext; +import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.math.NumberUtils; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.util.*; +import java.util.stream.Collectors; + +/** + * @Description: 个税扣缴义务人 + * @Author: wangxiangzhong + * @Date: 2022/3/11 14:09 + */ +@Component +public class TaxAgentWrapper { + + @Autowired + private TaxAgentBaseService taxAgentBaseService; + @Autowired + private TaxAgentAdminService taxAgentAdminService; + @Autowired + private TaxAgentService taxAgentService; +// +// private HrmCommonEmployeeService employeeService; +// @Autowired +// private TaxAgentManageRangeService taxAgentManageRangeService; +// @Autowired +// private PaymentAgencyService paymentAgencyService; +// @Autowired +// private SIEmployeeStatusMapper siEmployeeStatusMapper; +// @Autowired +// private HrmCommonHrmStatusService hrmCommonHrmStatusService; +// @Autowired +// private HrmConfigSetCache hrmConfigSetCache; + + /** + * 是否是薪酬模块总管理员 + * + * @param currentEmployeeId + * @param currentTenantKey + * @return + */ + public Boolean isChief(Long currentEmployeeId, String currentTenantKey) { + return taxAgentService.isChief(currentEmployeeId, currentTenantKey); + } + + /** + * 权限信息 + * + * @param currentEmployeeId + * @param currentTenantKey + * @return + */ + public Map permission(Long currentEmployeeId, String currentTenantKey) { + Map resultMap = Maps.newHashMap(); + Boolean isChief = isChief(currentEmployeeId, currentTenantKey); + Boolean isDefaultOpen = taxAgentService.isDefaultOpen(currentEmployeeId, currentTenantKey); + Boolean isAdminEnable = taxAgentService.isAdminEnable(currentEmployeeId, currentTenantKey); + resultMap.put("isChief", isChief); + resultMap.put("isDefaultOpen", isDefaultOpen); + resultMap.put("isAdminEnable", isAdminEnable); + return resultMap; + } + + /** + * 个税口角义务人列表 + * + * @param queryParam + * @param currentEmployeeId + * @param currentTenantKey + * @return + */ + public WeaTable list(TaxAgentQueryParam queryParam, Long currentEmployeeId, String currentTenantKey) { + // 是否是总管理员 + Boolean isChief = taxAgentService.isChief(currentEmployeeId, currentTenantKey); + // 是否开启分权 + boolean isOpenDevolution = taxAgentBaseService.isOpenDevolution(currentTenantKey); + + List paymentAgencyPOS = paymentAgencyService.listAll(currentTenantKey); + + Page page = new Page<>(queryParam.getCurrent(), queryParam.getPageSize(), true); + if (isChief) { + page = taxAgentService.listPage(page, queryParam, currentTenantKey); + } else { + // 分权情况下,根据自己作为管理员过滤列表 + if (isOpenDevolution) { + List list = taxAgentService.list(queryParam, currentTenantKey); + // 1.判断自己是否是管理员, 如果是管理员,就是能够操作所属个税扣缴义务人下的所有人的数据 + List taxAgentAdminList = taxAgentAdminService.listByTaxAgentIdsAndEmployeeId(list.stream().map(TaxAgentPO::getId).collect(Collectors.toList()), + currentEmployeeId, currentTenantKey); + // 是管理员的列表 + List adminTaxAgentIds = taxAgentAdminList.stream().map(TaxAgentAdminPO::getTaxAgentId).collect(Collectors.toList()); + // 分页参数 + Page dtoPage = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize()); + list = list.stream().filter(f -> adminTaxAgentIds.contains(f.getId())).collect(Collectors.toList()); + // 填充总数和当页数据 + dtoPage.setTotal(list.size()); + dtoPage.setRecords(SalaryPageUtil.subList((int) dtoPage.getCurrent(), (int) dtoPage.getSize(), list)); + page = dtoPage; + } + } + + Page> listPage = new Page<>(page.getCurrent(), page.getSize(), page.getTotal(), page.isSearchCount()); + + String setLabel = SalaryI18nUtil.getI18nLabel(currentTenantKey, currentEmployeeId, 94614, "设置"); + if (isOpenDevolution) { + List taxAgentIds = page.getRecords().stream().map(TaxAgentPO::getId).collect(Collectors.toList()); + List taxAgentAdmins = taxAgentAdminService.listByTaxAgentIds(taxAgentIds, currentTenantKey); + List adminList = employeeService.getEmployeeByIds(taxAgentAdmins.stream().map(TaxAgentAdminPO::getEmployeeId).distinct().collect(Collectors.toList()), + currentTenantKey); + listPage.setRecords(TaxAgentBO.convertToTableListDTO(page.getRecords(), paymentAgencyPOS, taxAgentAdmins, adminList, setLabel)); + } else { + listPage.setRecords(TaxAgentBO.convertToTableListDTO(page.getRecords(), paymentAgencyPOS, setLabel)); + } + WeaTable weaTable = FormatManager.getInstance().genTable(LinkedHashMap.class, listPage); + //构造表格 + TaxAgentBO.buildTaxAgentTable(weaTable, isOpenDevolution, currentEmployeeId, currentTenantKey, listPage.getRecords().size()); + if (isChief) { + // 在外展示操作按钮 + weaTable.getOperates().get(0).setOuter(Boolean.TRUE); + } else { + // 去掉增删改权限 + weaTable.getOperates().clear(); + weaTable.getCheckBoxPermission().clear(); + } + + weaTable.setModule("hrmsalary"); + return weaTable; + } + + public List> paymentAgencyList(TaxAgentQueryParam queryParam, Long currentEmployeeId, String currentTenantKey) { + List taxAgentPOS = taxAgentService.listByIds(queryParam.getIds(), currentTenantKey); + List paymentAgencyPOS = paymentAgencyService.listAll(currentTenantKey); + SalaryAssert.notEmpty(taxAgentPOS, "taxagent data is not exist"); + TaxAgentPO taxAgentPO = taxAgentPOS.get(0); + return TaxAgentBO.buildPaymentAgency(taxAgentPO.getPaymentAgency(), paymentAgencyPOS); + } + + public String paymentAgencySave(TaxAgentSaveParam param, Long currentEmploueeId, String currentTenantKey) { + List taxAgentPOS = taxAgentService.listByIds(Collections.singletonList(param.getId()), currentTenantKey); + SalaryAssert.notEmpty(taxAgentPOS, "data is not exist"); + TaxAgentPO taxAgentPO = taxAgentPOS.get(0); + List errorList = new ArrayList<>(); + List resultList = new ArrayList<>(); + if (StringUtils.isNotBlank(taxAgentPO.getPaymentAgency())) { + List originList = new ArrayList<>(Arrays.asList(taxAgentPO.getPaymentAgency().split(","))); + List list = new ArrayList<>(Arrays.asList(param.getPaymentAgency().split(","))); + originList.removeAll(list); + if (CollectionUtils.isNotEmpty(originList)) { + originList.stream().forEach(e -> { + List employeeStatusPOS = new LambdaQueryChainWrapper<>(siEmployeeStatusMapper) + .eq(InsuranceEmployeeStatusPO::getTenantKey, currentTenantKey) + .eq(InsuranceEmployeeStatusPO::getPaymentAgency, Long.valueOf(e)) + .eq(InsuranceEmployeeStatusPO::getPaymentOrganization, param.getId()) + .list(); + if (CollectionUtils.isNotEmpty(employeeStatusPOS)) { + errorList.add(e); + } + }); + } + if (CollectionUtils.isNotEmpty(errorList)) { + List paymentAgencyPOS = paymentAgencyService.listAll(currentTenantKey); + errorList.forEach(e -> { + Optional optionalPaymentAgencyPO = paymentAgencyPOS.stream().filter(po -> Objects.equals(e, String.valueOf(po.getId()))).findFirst(); + optionalPaymentAgencyPO.ifPresent(paymentAgencyPO -> resultList.add(paymentAgencyPO.getAgencyName())); + }); + } + } + if (CollectionUtils.isNotEmpty(resultList)) { + return SalaryI18nUtil.getI18nLabel(currentTenantKey, currentEmploueeId, 115128, "有员工在") + String.join(",", resultList) + SalaryI18nUtil.getI18nLabel(currentTenantKey, + currentEmploueeId, 115129, "缴纳社保福利,不可取消关联"); + } else { + taxAgentPO.setPaymentAgency(param.getPaymentAgency()); + taxAgentService.paymentAgencyUpdate(taxAgentPO, currentEmploueeId, currentTenantKey); + } + return ""; + } + + /** + * 获取个税扣缴义务人表单 + * + * @param id + * @param currentEmployeeId + * @param currentTenantKey + * @return + */ + public WeaForm getFrom(Long id, Long currentEmployeeId, String currentTenantKey) { + TaxAgentFormDTO taxAgentFromDTO = new TaxAgentFormDTO(); + if (id != null) { + TaxAgentPO taxAgent = taxAgentService.getById(id, currentTenantKey); + if (taxAgent == null) { + throw new SalaryRunTimeException(String.format(SalaryI18nUtil.getI18nLabel(currentTenantKey, currentEmployeeId, 100543, "个税扣缴人不存在") + "[id:%s]", id)); + } + BeanUtils.copyProperties(taxAgent, taxAgentFromDTO); + } + WeaForm weaForm = FormatManager.getInstance().genForm(TaxAgentFormDTO.class, taxAgentFromDTO); + // 是否开启分权 + boolean isOpenDevolution = taxAgentBaseService.isOpenDevolution(currentTenantKey); + if (isOpenDevolution) { + List admins = taxAgentAdminService.listByTaxAgentIds(Collections.singletonList(id), currentTenantKey); + // 目前是一个 + TaxAgentEmployeeOptionDTO taxAgentEmployee = new TaxAgentEmployeeOptionDTO(); + taxAgentEmployee.setId(CollectionUtils.isEmpty(admins) ? null : admins.get(0).getEmployeeId()); + if (taxAgentEmployee.getId() != null) { + SimpleEmployee employee = employeeService.getEmployeeById(taxAgentEmployee.getId(), currentTenantKey); + taxAgentEmployee.setContent(employee == null ? "" : employee.getUsername()); + } + taxAgentFromDTO.setAdminUser(Collections.singletonList(taxAgentEmployee)); + } else { + weaForm.getLayout().remove(1); + weaForm.getItems().remove("adminUser"); + taxAgentFromDTO.setAdminUser(null); + } + weaForm.setData(JsonUtil.parseMap(taxAgentFromDTO, Object.class)); + + WeaFormItem nameItem = weaForm.getItems().get("name"); + Map otherParams = Maps.newHashMap(); + otherParams.put("showCount", true); + otherParams.put("placeholder", SalaryI18nUtil.getI18nLabel(currentTenantKey, currentEmployeeId, 85987, "请输入")); + nameItem.setOtherParams(otherParams); + weaForm.getItems().put("name", nameItem); + + WeaFormItem descriptionItem = weaForm.getItems().get("description"); + otherParams = Maps.newHashMap(); + otherParams.put("showCount", true); + otherParams.put("placeholder", SalaryI18nUtil.getI18nLabel(currentTenantKey, currentEmployeeId, 85987, "请输入")); + descriptionItem.setOtherParams(otherParams); + weaForm.getItems().put("description", descriptionItem); + + return weaForm; + } + + /** + * 保存个税扣缴义务人 + * + * @param saveParam + * @param currentEmployeeId + * @param currentTenantKey + * @return + */ + public String save(TaxAgentSaveParam saveParam, Long currentEmployeeId, String currentTenantKey) { + return taxAgentService.save(saveParam, currentEmployeeId, currentTenantKey); + } + + /** + * 编辑个税扣缴义务人 + * + * @param saveParam + * @param currentEmployeeId + * @param currentTenantKey + * @return + */ + public String update(TaxAgentSaveParam saveParam, Long currentEmployeeId, String currentTenantKey) { + return taxAgentService.update(saveParam, currentEmployeeId, currentTenantKey); + } + + /** + * 更换管理员校验 + * + * @param checkParam + * @param currentEmployeeId + * @param currentTenantKey + * @return + */ + public Boolean adminChangeCheck(TaxAgentAdminChangeCheckParam checkParam, Long currentEmployeeId, String currentTenantKey) { + return taxAgentService.adminChangeCheck(checkParam, currentEmployeeId, currentTenantKey); + } + + /** + * 删除个税扣缴义务人 + * + * @param ids + * @param currentEmployeeId + * @param currentTenantKey + * @return + */ + public String delete(Collection ids, Long currentEmployeeId, String currentTenantKey) { + return taxAgentService.delete(ids, currentEmployeeId, currentTenantKey); + } + + /** + * 个税扣缴义务人下拉列表 + * + * @param currentEmployeeId + * @param currentTenantKey + * @return + */ + public List> selectList(Long currentEmployeeId, String currentTenantKey) { + return taxAgentService.selectList(currentEmployeeId, currentTenantKey); + } + + /** + * 范围列表 + * + * @param queryParam + * @param employeeId + * @param tenantKey + * @return + */ + public WeaTable listRangeInclude(TaxAgentRangeQueryParam queryParam, Long employeeId, String tenantKey) { + Page listPage = taxAgentManageRangeService.listPageByParamAndIncludeType(queryParam, NumberUtils.INTEGER_ONE, tenantKey); + WeaTable weaTable = SalaryFormatUtil.getInstance().buildTable(TaxAgentManageRangeListDTO.class, listPage); + weaTable.setModule("hrmsalary"); + weaTable.setPageUid("taxAgentRangeIncludeList"); + return weaTable; + } + + /** + * 范围排除列表 + * + * @param queryParam + * @param employeeId + * @param tenantKey + * @return + */ + public WeaTable listRangeExclude(TaxAgentRangeQueryParam queryParam, Long employeeId, String tenantKey) { + Page listPage = taxAgentManageRangeService.listPageByParamAndIncludeType(queryParam, NumberUtils.INTEGER_ZERO, tenantKey); + WeaTable weaTable = SalaryFormatUtil.getInstance().buildTable(TaxAgentManageRangeListDTO.class, listPage); + weaTable.setModule("hrmsalary"); + weaTable.setPageUid("taxAgentRangeExcludeList"); + return weaTable; + } + + /** + * 获取管理范围表单 + * + * @return + */ + public WeaForm getRangeFrom(String tenantKey) { + // 查询人员状态 + List hrmStatusList = hrmCommonHrmStatusService.list(tenantKey); + List weaFormOptions = hrmStatusList.stream().map(hrmStatus -> { + WeaFormOption weaFormOption = new WeaFormOption(); + weaFormOption.setId("" + hrmStatus.getCodeId()); + weaFormOption.setContent(hrmStatus.getName()); + return weaFormOption; + }).collect(Collectors.toList()); + Long employeeId = UserContext.getCurrentEmployeeId(); + List browserOptions = new ArrayList<>(); + browserOptions.add(new TypesBrowserOption("user", SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 1869, "人员"))); + browserOptions.add(new TypesBrowserOption("dept", SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 1250, "部门"))); + if(hrmConfigSetCache.isSubcompanySupport(tenantKey)) { + browserOptions.add(new TypesBrowserOption("subcompany", SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 107369, "分部"))); + } + browserOptions.add(new TypesBrowserOption("position", SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 1245, "岗位"))); + + WeaForm weaForm = SalaryFormatUtil.getInstance().buildForm(TaxAgentManageRangeFormDTO.class, TaxAgentManageRangeFormDTO.builder().targetOptions(browserOptions).build()); + weaForm.getItems().forEach((key, value) -> { + if (StringUtils.equals("employeeStatus", key)) { + value.setOptions(weaFormOptions); + } + }); + return weaForm; + } + + /** + * 保存管理范围 + * + * @param saveParam + * @param employeeId + * @param tenantKey + * @return + */ + public String saveRange(TaxAgentRangeSaveParam saveParam, Long employeeId, String tenantKey) { + taxAgentManageRangeService.save(saveParam, employeeId, tenantKey); + return StringUtils.EMPTY; + } + + /** + * 删除管理范围 + * + * @param ids + * @param tenantKey + * @return + */ + public String deleteRange(Collection ids, Long employeeId, String tenantKey) { + taxAgentManageRangeService.deleteByIds(ids, employeeId, tenantKey); + return StringUtils.EMPTY; + } +} diff --git a/src/demo.java b/src/demo.java new file mode 100644 index 000000000..70fb668eb --- /dev/null +++ b/src/demo.java @@ -0,0 +1,71 @@ +import java.text.SimpleDateFormat; +import java.time.LocalTime; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.stream.Collectors; + +public class demo { + + public static void main(String[] args) { + + //全天会议可用的时间点,9:00-18:00,每15min。 + List allTime = new ArrayList() {{ + //初始化全天可用的时间点集合,可以仿照下面splitTimeRange()写个。 + add(LocalTime.of(9, 0)); + add(LocalTime.of(9, 15)); + add(LocalTime.of(9, 30)); + add(LocalTime.of(9, 45)); + add(LocalTime.of(10, 0)); + //..... + add(LocalTime.of(17, 45)); + add(LocalTime.of(18, 0)); + }}; + + //占用的时间点,(从数据库里查的) + List takeUpStringList = new ArrayList(){{ + + }}; + List takeUpTimeList = takeUpStringList.stream().map(LocalTime::parse).collect(Collectors.toList()); + + //比较两个时间点数组,将全天的时间点分割 + List indexList = new ArrayList<>(); + for (int i = 0; i < allTime.size(); i++) { + //比较 + for (int j = 0; j < takeUpTimeList.size(); j++) { + if (allTime.get(i).equals(takeUpTimeList.get(j))) { + indexList.add(i); + } + } + } + + //按indexList下标分割allTime,获取list + List> list = new ArrayList<>(); + for (int i = 0; i < indexList.size(); i++) { + if (indexList.get(i) != 0 && (i + 1) != indexList.size()) { + list.add(allTime.subList(indexList.get(i), indexList.get(i + 1))); + } else { + list.add(allTime.subList(0, indexList.get(i))); + } + } + + //获取超出1小时的时间段,就是集合里时间点大于等于5的集合 + + //取出集合返回,接口要求可能就是返回时间-时间,取集合第一个-集合末尾 + + } + + private static void splitTimeRange() { + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm");//设置时间格式 + Date end = new Date(); + Date start = new Date(); + List list = new ArrayList();//用来接收划分后的时间 + //进行循环将时间按照分钟进行划分 + for (Date i = start; i.before(end); ) { + list.add(simpleDateFormat.format(i)); + i.setMinutes(i.getMinutes() + 1); + } + } + + +} From ed0ba7ed6d1d2e154f9aff617378aed19857bffb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=92=B1=E6=B6=9B?= <15850646081@163.com> Date: Thu, 19 May 2022 14:50:01 +0800 Subject: [PATCH 02/20] =?UTF-8?q?=E6=9A=82=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../salary/entity/taxagent/bo/TaxAgentBO.java | 16 +- .../param/TaxAgentAdjustRecordQueryParam.java | 48 +- .../param/TaxAgentAdminChangeCheckParam.java | 18 +- .../TaxAgentManageRangeEmpQueryParam.java | 18 +- .../param/TaxAgentManageRangeQueryParam.java | 1 - .../taxagent/param/TaxAgentQueryParam.java | 18 +- .../param/TaxAgentRangeQueryParam.java | 4 +- .../taxagent/param/TaxAgentSaveParam.java | 36 +- .../param/TaxAgentSubAdminBaseFormParam.java | 19 +- .../param/TaxAgentSubAdminBaseSaveParam.java | 22 +- .../param/TaxAgentSubAdminEmpSaveParam.java | 24 +- .../param/TaxAgentSubAdminQueryParam.java | 18 +- .../TaxAgentSubAdminRangeQueryParam.java | 16 +- .../entity/taxagent/po/TaxAgentAdminPO.java | 11 +- .../entity/taxagent/po/TaxAgentBasePO.java | 11 +- .../taxagent/po/TaxAgentEmpChangePO.java | 11 +- .../entity/taxagent/po/TaxAgentEmpPO.java | 11 +- .../taxagent/po/TaxAgentEmployeePO.java | 13 +- .../taxagent/po/TaxAgentManageRangePO.java | 11 +- .../salary/entity/taxagent/po/TaxAgentPO.java | 11 +- .../taxagent/po/TaxAgentSubAdminEmpPO.java | 11 +- .../taxagent/po/TaxAgentSubAdminPO.java | 11 +- .../engine/salary/enums/UserStatusEnum.java | 18 + .../datacollection/AddUpDeductionMapper.xml | 2 +- .../mapper/taxagent/TaxAgentMapper.java | 96 +++ .../salary/mapper/taxagent/TaxAgentMapper.xml | 230 +++++++ .../service/SalaryAcctRecordService.java | 9 + .../salary/service/TaxAgentEmpService.java | 2 - .../salary/service/TaxAgentService.java | 233 ------- .../service/TaxAgentSubAdminEmpService.java | 52 ++ .../service/TaxAgentSubAdminService.java | 84 +++ .../salary/service/TaxAgentV2Service.java | 217 ++++++ .../service/TaxDeclarationExcelService.java | 3 - .../salary/service/TaxDeclarationService.java | 1 - .../impl/SalaryAcctRecordServiceImpl.java | 5 + .../service/impl/TaxAgentServiceImpl.java | 646 +----------------- .../service/impl/TaxAgentV2ServiceImpl.java | 641 +++++++++++++++++ .../salary/wrapper/TaxAgentWrapper.java | 148 ++-- 38 files changed, 1621 insertions(+), 1125 deletions(-) create mode 100644 src/com/engine/salary/mapper/taxagent/TaxAgentMapper.java create mode 100644 src/com/engine/salary/mapper/taxagent/TaxAgentMapper.xml create mode 100644 src/com/engine/salary/service/TaxAgentSubAdminEmpService.java create mode 100644 src/com/engine/salary/service/TaxAgentSubAdminService.java create mode 100644 src/com/engine/salary/service/TaxAgentV2Service.java create mode 100644 src/com/engine/salary/service/impl/TaxAgentV2ServiceImpl.java diff --git a/src/com/engine/salary/entity/taxagent/bo/TaxAgentBO.java b/src/com/engine/salary/entity/taxagent/bo/TaxAgentBO.java index 83d8d59a7..2b08cd5a7 100644 --- a/src/com/engine/salary/entity/taxagent/bo/TaxAgentBO.java +++ b/src/com/engine/salary/entity/taxagent/bo/TaxAgentBO.java @@ -3,6 +3,7 @@ package com.engine.salary.entity.taxagent.bo; import com.engine.salary.constant.SalaryDefaultTenantConstant; import com.engine.salary.entity.datacollection.DataCollectionEmployee; import com.engine.salary.entity.taxagent.dto.TaxAgentEmployeeDTO; +import com.engine.salary.entity.taxagent.dto.TaxAgentListDTO; import com.engine.salary.entity.taxagent.dto.TaxAgentManageRangeListDTO; import com.engine.salary.entity.taxagent.dto.TaxAgentSubAdminListDTO; import com.engine.salary.entity.taxagent.param.TaxAgentManageRangeSaveParam; @@ -28,7 +29,6 @@ import com.weaver.common.hrm.cache.HrmEmployeeComInfo; import com.weaver.common.hrm.cache.HrmPositionComInfo; import com.weaver.common.hrm.domain.employee.HrmStatus; import com.weaver.hrm.salary.entity.agency.po.PaymentAgencyPO; -import com.weaver.hrm.salary.entity.taxagent.dto.TaxAgentListDTO; import com.weaver.hrm.salary.entity.taxagent.po.TaxAgentAdminPO; import com.weaver.teams.domain.user.SimpleEmployee; import lombok.AllArgsConstructor; @@ -38,15 +38,17 @@ import lombok.NoArgsConstructor; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; -import java.time.LocalDateTime; import java.util.*; import java.util.stream.Collectors; /** - * @Description: 个税扣缴义务人 - * @Author: wangxiangzhong - * @Date: 2021/10/29 18:04 - */ + * 个税扣缴义务人 + *

Copyright: Copyright (c) 2022

+ *

Company: 泛微软件

+ * + * @author qiantao + * @version 1.0 + **/ public class TaxAgentBO { @Override @@ -141,7 +143,7 @@ public class TaxAgentBO { * @param tenantKey * @return */ - public static List convertToListDTO(Collection taxAgents, String tenantKey) { + public static List convertToListDTO(Collection taxAgents) { if (CollectionUtils.isEmpty(taxAgents)) { return Collections.emptyList(); } diff --git a/src/com/engine/salary/entity/taxagent/param/TaxAgentAdjustRecordQueryParam.java b/src/com/engine/salary/entity/taxagent/param/TaxAgentAdjustRecordQueryParam.java index b1e62bdc2..3c3bce1d5 100644 --- a/src/com/engine/salary/entity/taxagent/param/TaxAgentAdjustRecordQueryParam.java +++ b/src/com/engine/salary/entity/taxagent/param/TaxAgentAdjustRecordQueryParam.java @@ -1,65 +1,65 @@ package com.engine.salary.entity.taxagent.param; -import com.weaver.hrm.salary.common.BaseQueryParam; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import com.engine.salary.common.BaseQueryParam; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; -import java.time.LocalDate; import java.util.Collection; +import java.util.Date; import java.util.List; /** - * @Description: 个税扣缴义务人调整记录查询参数 - * @Author: wangxiangzhong - * @Date: 2021/11/1 16:35 - */ + * 个税扣缴义务人调整记录查询参数 + *

Copyright: Copyright (c) 2022

+ *

Company: 泛微软件

+ * + * @author qiantao + * @version 1.0 + **/ @Data @Builder @NoArgsConstructor @AllArgsConstructor -@ApiModel("个税扣缴义务人调整记录查询参数") public class TaxAgentAdjustRecordQueryParam extends BaseQueryParam { - @ApiModelProperty("主键id") + //主键id private Collection ids; - @ApiModelProperty("薪资档案id") + //薪资档案id private Long salaryArchiveId; - @ApiModelProperty("关键字(姓名、部门、个税扣缴义务人)") + //关键字(姓名、部门、个税扣缴义务人) private String keyword; - @ApiModelProperty("姓名") + //姓名 private String username; - @ApiModelProperty("部门id") + //部门id private List departmentIds; - @ApiModelProperty("岗位id") + //岗位id private List positionIds; - @ApiModelProperty("状态") + //状态 private String userstatus; - @ApiModelProperty("个税扣缴义务人id") + //个税扣缴义务人id private Long taxAgentId; - @ApiModelProperty("调整原因") + //调整原因 private String adjustReason; - @ApiModelProperty("生效日期") - private List effectiveTime; + //生效日期 + private List effectiveTime; - @ApiModelProperty("操作日期") - private List operateTime; + //操作日期 + private List operateTime; - @ApiModelProperty("操作人id") + //操作人id private List operatorIds; - @ApiModelProperty("备注") + //备注 private String description; } diff --git a/src/com/engine/salary/entity/taxagent/param/TaxAgentAdminChangeCheckParam.java b/src/com/engine/salary/entity/taxagent/param/TaxAgentAdminChangeCheckParam.java index 5341d5d6b..7c32d296f 100644 --- a/src/com/engine/salary/entity/taxagent/param/TaxAgentAdminChangeCheckParam.java +++ b/src/com/engine/salary/entity/taxagent/param/TaxAgentAdminChangeCheckParam.java @@ -1,27 +1,27 @@ package com.engine.salary.entity.taxagent.param; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; /** - * @Description: 个税扣缴义务人保存参数 - * @Author: wangxiangzhong - * @Date: 2021/10/29 16:28 - */ + * 个税扣缴义务人保存参数 + *

Copyright: Copyright (c) 2022

+ *

Company: 泛微软件

+ * + * @author qiantao + * @version 1.0 + **/ @Data @Builder @NoArgsConstructor @AllArgsConstructor -@ApiModel("个税扣缴义务人更改管理员校验参数") public class TaxAgentAdminChangeCheckParam { - @ApiModelProperty("个税扣缴义务人id") + //个税扣缴义务人id private Long taxAgentId; - @ApiModelProperty("管理员主键id") + //管理员主键id private Long adminUserId; } diff --git a/src/com/engine/salary/entity/taxagent/param/TaxAgentManageRangeEmpQueryParam.java b/src/com/engine/salary/entity/taxagent/param/TaxAgentManageRangeEmpQueryParam.java index 041fe8776..9a21b9ee8 100644 --- a/src/com/engine/salary/entity/taxagent/param/TaxAgentManageRangeEmpQueryParam.java +++ b/src/com/engine/salary/entity/taxagent/param/TaxAgentManageRangeEmpQueryParam.java @@ -1,6 +1,5 @@ package com.engine.salary.entity.taxagent.param; -import io.swagger.annotations.ApiModelProperty; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; @@ -9,22 +8,25 @@ import lombok.NoArgsConstructor; import java.util.Collection; /** - * @Description: 管理范围转人员-查询参数 - * @Author: wangxiangzhong - * @Date: 2022/3/24 16:40 - */ + * 管理范围转人员-查询参数 + *

Copyright: Copyright (c) 2022

+ *

Company: 泛微软件

+ * + * @author qiantao + * @version 1.0 + **/ @Data @Builder @NoArgsConstructor @AllArgsConstructor public class TaxAgentManageRangeEmpQueryParam { - @ApiModelProperty("对象类型") + //对象类型 private String targetType; - @ApiModelProperty("对象id") + //对象id private Collection targetIds; - @ApiModelProperty("人员状态") + //人员状态 private Collection employeeStatus; } diff --git a/src/com/engine/salary/entity/taxagent/param/TaxAgentManageRangeQueryParam.java b/src/com/engine/salary/entity/taxagent/param/TaxAgentManageRangeQueryParam.java index 591aaa1c4..e7f5020f1 100644 --- a/src/com/engine/salary/entity/taxagent/param/TaxAgentManageRangeQueryParam.java +++ b/src/com/engine/salary/entity/taxagent/param/TaxAgentManageRangeQueryParam.java @@ -15,7 +15,6 @@ import lombok.Data; //@Builder //@NoArgsConstructor //@AllArgsConstructor -//管理范围查询参数") public class TaxAgentManageRangeQueryParam extends BaseQueryParam { //对象") diff --git a/src/com/engine/salary/entity/taxagent/param/TaxAgentQueryParam.java b/src/com/engine/salary/entity/taxagent/param/TaxAgentQueryParam.java index 96697ed0c..410b0b2b4 100644 --- a/src/com/engine/salary/entity/taxagent/param/TaxAgentQueryParam.java +++ b/src/com/engine/salary/entity/taxagent/param/TaxAgentQueryParam.java @@ -1,8 +1,6 @@ package com.engine.salary.entity.taxagent.param; -import com.weaver.hrm.salary.common.BaseQueryParam; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import com.engine.salary.common.BaseQueryParam; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; @@ -11,19 +9,21 @@ import lombok.NoArgsConstructor; import java.util.Collection; /** - * @Description: 个税扣缴义务人查询参数 - * @Author: wangxiangzhong - * @Date: 2021/10/29 15:03 - */ + * 个税扣缴义务人查询参数 + *

Copyright: Copyright (c) 2022

+ *

Company: 泛微软件

+ * + * @author qiantao + * @version 1.0 + **/ @Data @Builder @NoArgsConstructor @AllArgsConstructor -@ApiModel("个税扣缴义务人查询参数") public class TaxAgentQueryParam extends BaseQueryParam { private Collection ids; - @ApiModelProperty("个税扣缴义务人名称") + //个税扣缴义务人名称 private String name; } diff --git a/src/com/engine/salary/entity/taxagent/param/TaxAgentRangeQueryParam.java b/src/com/engine/salary/entity/taxagent/param/TaxAgentRangeQueryParam.java index f37187cc8..f6c2a34aa 100644 --- a/src/com/engine/salary/entity/taxagent/param/TaxAgentRangeQueryParam.java +++ b/src/com/engine/salary/entity/taxagent/param/TaxAgentRangeQueryParam.java @@ -17,9 +17,9 @@ import lombok.NoArgsConstructor; @Builder @NoArgsConstructor @AllArgsConstructor -//个税扣缴义务人人员范围查询参数") +//个税扣缴义务人人员范围查询参数 public class TaxAgentRangeQueryParam extends TaxAgentManageRangeQueryParam { - //个税扣缴义务人id") + //个税扣缴义务人id private Long taxAgentId; } diff --git a/src/com/engine/salary/entity/taxagent/param/TaxAgentSaveParam.java b/src/com/engine/salary/entity/taxagent/param/TaxAgentSaveParam.java index 7fec9dd40..21da60aae 100644 --- a/src/com/engine/salary/entity/taxagent/param/TaxAgentSaveParam.java +++ b/src/com/engine/salary/entity/taxagent/param/TaxAgentSaveParam.java @@ -1,46 +1,38 @@ package com.engine.salary.entity.taxagent.param; -import com.weaver.common.base.entity.result.WeaResult; -import com.weaver.hrm.salary.util.SalaryI18nUtil; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import com.engine.salary.util.valid.DataCheck; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; -import org.apache.commons.lang3.StringUtils; /** - * @Description: 个税扣缴义务人保存参数 - * @Author: wangxiangzhong - * @Date: 2021/10/29 16:28 - */ + * 个税扣缴义务人保存参数 + *

Copyright: Copyright (c) 2022

+ *

Company: 泛微软件

+ * + * @author qiantao + * @version 1.0 + **/ @Data @Builder @NoArgsConstructor @AllArgsConstructor -@ApiModel("个税扣缴义务人保存参数") public class TaxAgentSaveParam { - @ApiModelProperty("主键id") + //主键id private Long id; - @ApiModelProperty(name = "名称") + //名称 + @DataCheck(require = true, message = "名称必填") private String name; - @ApiModelProperty("管理员主键id") + //管理员主键id private Long adminUserId; - @ApiModelProperty("代缴机构") + //代缴机构 private String paymentAgency; - @ApiModelProperty(name = "备注") + //备注 private String description; - - public static WeaResult checkParam(TaxAgentSaveParam saveParam, Long employeeId, String tenantKey) { - if (StringUtils.isEmpty(saveParam.getName())) { - return WeaResult.fail(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 100318, "名称必填")); - } - return WeaResult.success(StringUtils.EMPTY); - } } diff --git a/src/com/engine/salary/entity/taxagent/param/TaxAgentSubAdminBaseFormParam.java b/src/com/engine/salary/entity/taxagent/param/TaxAgentSubAdminBaseFormParam.java index 44c65ae09..f44919dc9 100644 --- a/src/com/engine/salary/entity/taxagent/param/TaxAgentSubAdminBaseFormParam.java +++ b/src/com/engine/salary/entity/taxagent/param/TaxAgentSubAdminBaseFormParam.java @@ -1,27 +1,28 @@ package com.engine.salary.entity.taxagent.param; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; /** - * @Description: 分管理员基础设置表单参数 - * @Author: wangxiangzhong - * @Date: 2022/3/22 16:18 - */ + * 分管理员基础设置表单参数 + *

Copyright: Copyright (c) 2022

+ *

Company: 泛微软件

+ * + * @author qiantao + * @version 1.0 + **/ @Data @Builder @NoArgsConstructor @AllArgsConstructor -@ApiModel("分管理员基础设置表单参数") +//分管理员基础设置表单参数 public class TaxAgentSubAdminBaseFormParam { - @ApiModelProperty("分管理员的id") + //分管理员的id private Long id; - @ApiModelProperty("个税扣缴义务人的id") + //个税扣缴义务人的id private Long taxAgentId; } diff --git a/src/com/engine/salary/entity/taxagent/param/TaxAgentSubAdminBaseSaveParam.java b/src/com/engine/salary/entity/taxagent/param/TaxAgentSubAdminBaseSaveParam.java index b8fdb78ff..40e6c35b9 100644 --- a/src/com/engine/salary/entity/taxagent/param/TaxAgentSubAdminBaseSaveParam.java +++ b/src/com/engine/salary/entity/taxagent/param/TaxAgentSubAdminBaseSaveParam.java @@ -1,33 +1,33 @@ package com.engine.salary.entity.taxagent.param; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; /** - * @Description: 分管理员基础设置保存参数 - * @Author: wangxiangzhong - * @Date: 2022/3/22 15:28 - */ + * 分管理员基础设置保存参数 + *

Copyright: Copyright (c) 2022

+ *

Company: 泛微软件

+ * + * @author qiantao + * @version 1.0 + **/ @Data @Builder @NoArgsConstructor @AllArgsConstructor -@ApiModel("分管理员基础设置保存参数") public class TaxAgentSubAdminBaseSaveParam { - @ApiModelProperty("主键id") + //主键id private Long id; - @ApiModelProperty("个税扣缴义务人的id") + //个税扣缴义务人的id private Long taxAgentId; - @ApiModelProperty(name = "分管理员的id") + //分管理员的id private Long subAdminUserId; - @ApiModelProperty(name = "备注") + //备注 private String description; } diff --git a/src/com/engine/salary/entity/taxagent/param/TaxAgentSubAdminEmpSaveParam.java b/src/com/engine/salary/entity/taxagent/param/TaxAgentSubAdminEmpSaveParam.java index 441670894..66dfaa868 100644 --- a/src/com/engine/salary/entity/taxagent/param/TaxAgentSubAdminEmpSaveParam.java +++ b/src/com/engine/salary/entity/taxagent/param/TaxAgentSubAdminEmpSaveParam.java @@ -1,8 +1,6 @@ package com.engine.salary.entity.taxagent.param; -import com.weaver.hrm.salary.common.SalaryEmployee; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import com.engine.salary.entity.datacollection.DataCollectionEmployee; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; @@ -11,23 +9,25 @@ import lombok.NoArgsConstructor; import java.util.List; /** - * @Description: 个税扣缴义务人分管理员的关联人员保存参数 - * @Author: wangxiangzhong - * @Date: 2021/10/29 16:28 - */ + * 个税扣缴义务人分管理员的关联人员保存参数 + *

Copyright: Copyright (c) 2022

+ *

Company: 泛微软件

+ * + * @author qiantao + * @version 1.0 + **/ @Data @Builder @NoArgsConstructor @AllArgsConstructor -@ApiModel("个税扣缴义务人分管理员的关联人员保存参数") public class TaxAgentSubAdminEmpSaveParam { - @ApiModelProperty("个税口角义务人的主键id") + //个税口角义务人的主键id private Long taxAgentId; - @ApiModelProperty("分管理员的主键id") + //分管理员的主键id private Long subAdminId; - @ApiModelProperty(name = "关联人员列表") - private List salaryEmployeeList; + //关联人员列表 + private List salaryEmployeeList; } diff --git a/src/com/engine/salary/entity/taxagent/param/TaxAgentSubAdminQueryParam.java b/src/com/engine/salary/entity/taxagent/param/TaxAgentSubAdminQueryParam.java index 68607dd43..8ec169683 100644 --- a/src/com/engine/salary/entity/taxagent/param/TaxAgentSubAdminQueryParam.java +++ b/src/com/engine/salary/entity/taxagent/param/TaxAgentSubAdminQueryParam.java @@ -1,25 +1,25 @@ package com.engine.salary.entity.taxagent.param; -import com.weaver.hrm.salary.common.BaseQueryParam; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import com.engine.salary.common.BaseQueryParam; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; /** - * @Description: 个税扣缴义务人分管理员查询参数 - * @Author: wangxiangzhong - * @Date: 2021/10/29 15:03 - */ + * 个税扣缴义务人分管理员查询参数 + *

Copyright: Copyright (c) 2022

+ *

Company: 泛微软件

+ * + * @author qiantao + * @version 1.0 + **/ @Data @Builder @NoArgsConstructor @AllArgsConstructor -@ApiModel("个税扣缴义务人分管理员查询参数") public class TaxAgentSubAdminQueryParam extends BaseQueryParam { - @ApiModelProperty("个税扣缴义务人id") + //个税扣缴义务人id private Long taxAgentId; } diff --git a/src/com/engine/salary/entity/taxagent/param/TaxAgentSubAdminRangeQueryParam.java b/src/com/engine/salary/entity/taxagent/param/TaxAgentSubAdminRangeQueryParam.java index 0b867ccf2..493d99d35 100644 --- a/src/com/engine/salary/entity/taxagent/param/TaxAgentSubAdminRangeQueryParam.java +++ b/src/com/engine/salary/entity/taxagent/param/TaxAgentSubAdminRangeQueryParam.java @@ -1,24 +1,24 @@ package com.engine.salary.entity.taxagent.param; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; /** - * @Description: 个税扣缴义务人分管理员管理范围查询参数 - * @Author: wangxiangzhong - * @Date: 2022/3/22 14:08 - */ + * 个税扣缴义务人分管理员管理范围查询参数 + *

Copyright: Copyright (c) 2022

+ *

Company: 泛微软件

+ * + * @author qiantao + * @version 1.0 + **/ @Data @Builder @NoArgsConstructor @AllArgsConstructor -@ApiModel("个税扣缴义务人分管理员管理范围查询参数") public class TaxAgentSubAdminRangeQueryParam extends TaxAgentManageRangeQueryParam { - @ApiModelProperty("分管理员id") + //分管理员id private Long subAdminId; } diff --git a/src/com/engine/salary/entity/taxagent/po/TaxAgentAdminPO.java b/src/com/engine/salary/entity/taxagent/po/TaxAgentAdminPO.java index 6537f5bfc..97864a19c 100644 --- a/src/com/engine/salary/entity/taxagent/po/TaxAgentAdminPO.java +++ b/src/com/engine/salary/entity/taxagent/po/TaxAgentAdminPO.java @@ -9,10 +9,13 @@ import java.util.Collection; import java.util.Date; /** - * @Description: 个税扣缴义务人管理员 - * @Author: wangxiangzhong - * @Date: 2022/3/21 13:16 - */ + * 个税扣缴义务人管理员 + *

Copyright: Copyright (c) 2022

+ *

Company: 泛微软件

+ * + * @author qiantao + * @version 1.0 + **/ @Data @Builder @NoArgsConstructor diff --git a/src/com/engine/salary/entity/taxagent/po/TaxAgentBasePO.java b/src/com/engine/salary/entity/taxagent/po/TaxAgentBasePO.java index db260f0d8..f19e421b2 100644 --- a/src/com/engine/salary/entity/taxagent/po/TaxAgentBasePO.java +++ b/src/com/engine/salary/entity/taxagent/po/TaxAgentBasePO.java @@ -8,10 +8,13 @@ import lombok.NoArgsConstructor; import java.util.Date; /** - * @Description: 个税扣缴义务人基础信息 - * @Author: wangxiangzhong - * @Date: 2022/3/21 9:33 - */ + * 个税扣缴义务人基础信息 + *

Copyright: Copyright (c) 2022

+ *

Company: 泛微软件

+ * + * @author qiantao + * @version 1.0 + **/ @Data @Builder @NoArgsConstructor diff --git a/src/com/engine/salary/entity/taxagent/po/TaxAgentEmpChangePO.java b/src/com/engine/salary/entity/taxagent/po/TaxAgentEmpChangePO.java index b61740cdf..3d52b0cce 100644 --- a/src/com/engine/salary/entity/taxagent/po/TaxAgentEmpChangePO.java +++ b/src/com/engine/salary/entity/taxagent/po/TaxAgentEmpChangePO.java @@ -10,10 +10,13 @@ import lombok.NoArgsConstructor; import java.util.Date; /** - * @Description: 个税扣缴义务人管理范围的增量人员 - * @Author: wangxiangzhong - * @Date: 2022/3/24 14:44 - */ + * 个税扣缴义务人管理范围的增量人员 + *

Copyright: Copyright (c) 2022

+ *

Company: 泛微软件

+ * + * @author qiantao + * @version 1.0 + **/ @Data @Builder @NoArgsConstructor diff --git a/src/com/engine/salary/entity/taxagent/po/TaxAgentEmpPO.java b/src/com/engine/salary/entity/taxagent/po/TaxAgentEmpPO.java index 4c7dc5923..9c716f0a4 100644 --- a/src/com/engine/salary/entity/taxagent/po/TaxAgentEmpPO.java +++ b/src/com/engine/salary/entity/taxagent/po/TaxAgentEmpPO.java @@ -9,10 +9,13 @@ import java.util.Collection; import java.util.Date; /** - * @Description: 个税扣缴义务人管理范围的人员 - * @Author: wangxiangzhong - * @Date: 2022/3/24 14:44 - */ + * 个税扣缴义务人管理范围的人员 + *

Copyright: Copyright (c) 2022

+ *

Company: 泛微软件

+ * + * @author qiantao + * @version 1.0 + **/ @Data @Builder @NoArgsConstructor diff --git a/src/com/engine/salary/entity/taxagent/po/TaxAgentEmployeePO.java b/src/com/engine/salary/entity/taxagent/po/TaxAgentEmployeePO.java index f7f5c0e98..b6b615580 100644 --- a/src/com/engine/salary/entity/taxagent/po/TaxAgentEmployeePO.java +++ b/src/com/engine/salary/entity/taxagent/po/TaxAgentEmployeePO.java @@ -6,10 +6,13 @@ import lombok.Data; import lombok.NoArgsConstructor; /** - * @Description: 员工基本信息 - * @Author: wangxiangzhong - * @Date: 2022/2/10 16:25 - */ + * 员工基本信息 + *

Copyright: Copyright (c) 2022

+ *

Company: 泛微软件

+ * + * @author qiantao + * @version 1.0 + **/ @Data @Builder @NoArgsConstructor @@ -23,7 +26,7 @@ public class TaxAgentEmployeePO { private String username; //部门") - private String deparmentName; + private String departmentName; //状态") private String status; diff --git a/src/com/engine/salary/entity/taxagent/po/TaxAgentManageRangePO.java b/src/com/engine/salary/entity/taxagent/po/TaxAgentManageRangePO.java index cfbd8c0ca..16fb07c19 100644 --- a/src/com/engine/salary/entity/taxagent/po/TaxAgentManageRangePO.java +++ b/src/com/engine/salary/entity/taxagent/po/TaxAgentManageRangePO.java @@ -11,10 +11,13 @@ import java.util.Collection; import java.util.Date; /** - * @Description: 个税扣缴义务人的管理范围表 - * @Author: wangxiangzhong - * @Date: 2022/3/23 15:41 - */ + * 个税扣缴义务人的管理范围表 + *

Copyright: Copyright (c) 2022

+ *

Company: 泛微软件

+ * + * @author qiantao + * @version 1.0 + **/ @Data @Builder @NoArgsConstructor diff --git a/src/com/engine/salary/entity/taxagent/po/TaxAgentPO.java b/src/com/engine/salary/entity/taxagent/po/TaxAgentPO.java index 0e872326a..255d8c88b 100644 --- a/src/com/engine/salary/entity/taxagent/po/TaxAgentPO.java +++ b/src/com/engine/salary/entity/taxagent/po/TaxAgentPO.java @@ -8,10 +8,13 @@ import lombok.NoArgsConstructor; import java.util.Date; /** - * @Description: 个税扣缴义务人 - * @Author: wangxiangzhong - * @Date: 2021/10/29 11:14 - */ + * 个税扣缴义务人 + *

Copyright: Copyright (c) 2022

+ *

Company: 泛微软件

+ * + * @author qiantao + * @version 1.0 + **/ @Data @Builder @NoArgsConstructor diff --git a/src/com/engine/salary/entity/taxagent/po/TaxAgentSubAdminEmpPO.java b/src/com/engine/salary/entity/taxagent/po/TaxAgentSubAdminEmpPO.java index 3f3c21754..a55fd7140 100644 --- a/src/com/engine/salary/entity/taxagent/po/TaxAgentSubAdminEmpPO.java +++ b/src/com/engine/salary/entity/taxagent/po/TaxAgentSubAdminEmpPO.java @@ -8,10 +8,13 @@ import lombok.NoArgsConstructor; import java.util.Date; /** - * @Description: 个税扣缴义务人管理范围的人员 - * @Author: wangxiangzhong - * @Date: 2022/3/24 14:44 - */ + * 个税扣缴义务人管理范围的人员 + *

Copyright: Copyright (c) 2022

+ *

Company: 泛微软件

+ * + * @author qiantao + * @version 1.0 + **/ @Data @Builder @NoArgsConstructor diff --git a/src/com/engine/salary/entity/taxagent/po/TaxAgentSubAdminPO.java b/src/com/engine/salary/entity/taxagent/po/TaxAgentSubAdminPO.java index 7f94e47a3..c35cdcfb6 100644 --- a/src/com/engine/salary/entity/taxagent/po/TaxAgentSubAdminPO.java +++ b/src/com/engine/salary/entity/taxagent/po/TaxAgentSubAdminPO.java @@ -8,10 +8,13 @@ import lombok.NoArgsConstructor; import java.util.Date; /** - * @Description: 个税扣缴义务人分管理员 - * @Author: wangxiangzhong - * @Date: 2022/3/21 13:16 - */ + * 个税扣缴义务人分管理员 + *

Copyright: Copyright (c) 2022

+ *

Company: 泛微软件

+ * + * @author qiantao + * @version 1.0 + **/ @Data @Builder @NoArgsConstructor diff --git a/src/com/engine/salary/enums/UserStatusEnum.java b/src/com/engine/salary/enums/UserStatusEnum.java index 3c1556d46..e21fdf1cb 100644 --- a/src/com/engine/salary/enums/UserStatusEnum.java +++ b/src/com/engine/salary/enums/UserStatusEnum.java @@ -59,5 +59,23 @@ public enum UserStatusEnum { }).collect(Collectors.toList()); } + /** + * 在职状态 + * + * @return + */ + public static List getNormalStatus() { + return Arrays.asList(TRIAL.getValue().toString(), FORMAL.getValue().toString(), TEMPORARY.getValue().toString(), DELAY.getValue().toString()); + } + + /** + * 在职状态 + * + * @return + */ + public static List getUnavailableStatus() { + return Arrays.asList(FIRE.getValue().toString(), DEPARTURE.getValue().toString(), RETIRED.getValue().toString()); + } + } diff --git a/src/com/engine/salary/mapper/datacollection/AddUpDeductionMapper.xml b/src/com/engine/salary/mapper/datacollection/AddUpDeductionMapper.xml index 61d4f350a..2ed205693 100644 --- a/src/com/engine/salary/mapper/datacollection/AddUpDeductionMapper.xml +++ b/src/com/engine/salary/mapper/datacollection/AddUpDeductionMapper.xml @@ -271,7 +271,7 @@ + SELECT + + FROM hrsa_tax_agent t + WHERE delete_type = 0 + + ORDER BY id DESC + + + + + + + + + + + INSERT INTO hrsa_tax_agent + + create_time, + creator, + delete_type, + description, + id, + name, + tenant_key, + update_time, + + + #{createTime}, + #{creator}, + #{deleteType}, + #{description}, + #{id}, + #{name}, + #{tenantKey}, + #{updateTime}, + + + + + + INSERT INTO hrsa_tax_agent + + + + create_time, + + + creator, + + + delete_type, + + + description, + + + id, + + + name, + + + tenant_key, + + + update_time, + + + + + #{createTime}, + + + #{creator}, + + + #{deleteType}, + + + #{description}, + + + #{id}, + + + #{name}, + + + #{tenantKey}, + + + #{updateTime}, + + + + + + + UPDATE hrsa_tax_agent + + create_time=#{createTime}, + creator=#{creator}, + delete_type=#{deleteType}, + description=#{description}, + name=#{name}, + tenant_key=#{tenantKey}, + update_time=#{updateTime}, + + WHERE id = #{id} AND delete_type = 0 + + + + + + UPDATE hrsa_tax_agent + + + create_time=#{createTime}, + + + creator=#{creator}, + + + delete_type=#{deleteType}, + + + description=#{description}, + + + name=#{name}, + + + tenant_key=#{tenantKey}, + + + update_time=#{updateTime}, + + + WHERE id = #{id} AND delete_type = 0 + + + + + + UPDATE hrsa_tax_agent + SET delete_type=1 + WHERE id = #{id} + AND delete_type = 0 + + + + UPDATE hrsa_tax_agent + 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/SalaryAcctRecordService.java b/src/com/engine/salary/service/SalaryAcctRecordService.java index 641e3c357..81880dca6 100644 --- a/src/com/engine/salary/service/SalaryAcctRecordService.java +++ b/src/com/engine/salary/service/SalaryAcctRecordService.java @@ -163,4 +163,13 @@ public interface SalaryAcctRecordService { * @return */ List listByStatus(SalaryAcctRecordStatusEnum status); + + /** + * 根据核算人和核算状态查询核算记录 + * + * @param status + * @param employeeId + * @return + */ + List listByStatusAndEmployeeId(SalaryAcctRecordStatusEnum status, Long employeeId); } diff --git a/src/com/engine/salary/service/TaxAgentEmpService.java b/src/com/engine/salary/service/TaxAgentEmpService.java index 5edfab2e5..d5c9f6127 100644 --- a/src/com/engine/salary/service/TaxAgentEmpService.java +++ b/src/com/engine/salary/service/TaxAgentEmpService.java @@ -27,7 +27,6 @@ public interface TaxAgentEmpService{ * 根据个税扣缴义务人id获取管理范围中的人员 * * @param taxAgentIds - * @param tenantKey * @return */ List listByTaxAgentIds(List taxAgentIds); @@ -37,7 +36,6 @@ public interface TaxAgentEmpService{ * * @param taxAgentEmpSaveParamList * @param currentEmployeeId - * @param tenantKey */ void syncTaxAgentEmployee(List taxAgentEmpSaveParamList, Long currentEmployeeId); } diff --git a/src/com/engine/salary/service/TaxAgentService.java b/src/com/engine/salary/service/TaxAgentService.java index e2513973b..79c011601 100644 --- a/src/com/engine/salary/service/TaxAgentService.java +++ b/src/com/engine/salary/service/TaxAgentService.java @@ -1,19 +1,8 @@ package com.engine.salary.service; -import com.engine.salary.entity.taxagent.dto.TaxAgentEmployeeDTO; -import com.engine.salary.entity.taxagent.dto.TaxAgentEmployeeTaxAgentDTO; -import com.engine.salary.entity.taxagent.dto.TaxAgentListDTO; -import com.engine.salary.entity.taxagent.dto.TaxAgentManageRangeEmployeeDTO; -import com.engine.salary.entity.taxagent.param.TaxAgentAdminChangeCheckParam; -import com.engine.salary.entity.taxagent.param.TaxAgentQueryParam; -import com.engine.salary.entity.taxagent.param.TaxAgentSaveParam; -import com.engine.salary.entity.taxagent.po.TaxAgentPO; import com.engine.salary.entity.taxrate.TaxAgent; -import com.engine.salary.enums.salarysob.SalaryEmployeeStatusEnum; -import com.engine.salary.enums.taxagent.TaxAgentRoleTypeEnum; import java.util.Collection; -import java.util.List; import java.util.Map; public interface TaxAgentService { @@ -39,226 +28,4 @@ public interface TaxAgentService { * @return */ TaxAgent getById(Long id); - - /** - * 获取当前登录人角色(返回最大角色,优先级为:总管理员-》管理员-》分管理员) - * - * @param currentEmployeeId - * @param currentTenantKey - * @return - */ - TaxAgentRoleTypeEnum getRoleType(Long currentEmployeeId, String currentTenantKey); - - /** - * 是否是薪酬模块总管理员 - * - * @param currentEmployeeId - * @param currentTenantKey - * @return - */ - Boolean isChief(Long currentEmployeeId); - - /** - * 默认权限是否开启 - * - * @param currentEmployeeId - * @param currentTenantKey - * @return - */ - Boolean isDefaultOpen(Long currentEmployeeId, String currentTenantKey); - - /** - * 管理员是否有权限 - * - * @param currentEmployeeId - * @param currentTenantKey - * @return - */ - Boolean isAdminEnable(Long currentEmployeeId, String currentTenantKey); - - /** - * 个税扣缴义务人列表(分页) - * - * @param page - * @param queryParam - * @param currentTenantKey - * @return - */ - Page listPage(Page page, TaxAgentQueryParam queryParam, String currentTenantKey); - - /** - * 个税扣缴义务人列表(不分页) - * - * @param queryParam - * @param currentTenantKey - * @return - */ - List list(TaxAgentQueryParam queryParam, String currentTenantKey); - - /** - * 根据id查询个税扣缴义务人 - * - * @param ids - * @param tenantKey - * @return - */ - List listByIds(Collection ids, String tenantKey); - - /** - * 查询租户下的所有个税扣缴义务人 - * - * @param tenantKey - * @return - */ - List listAll(String tenantKey); - - /** - * 根据id获取单个个税扣缴义务人 - * - * @param id - * @param tenantKey - * @return - */ - TaxAgentPO getById(Long id, String tenantKey); - - /** - * 获取所有个税扣缴义务人 - * - * @param tenantKey - * @return - */ - Collection findAll(String tenantKey); - - /** - * 获取作为管理员或分管理员的个税扣缴义务人列表 - * - * @param currentEmployeeId 当前登录人id - * @param tenantKey - * @return - */ - Collection listAllTaxAgents(Long currentEmployeeId, String tenantKey); - - /** - * 获取作为管理员的所有个税扣缴义务人列表 - * - * @param currentEmployeeId 当前登录人id - * @param tenantKey - * @return - */ - Collection listAllTaxAgentsAsAdmin(Long currentEmployeeId, String tenantKey); - - /** - * 获取作为人员范围中的个税扣缴义务人列表 - * - * @param employeeIds 被管理的人员id - * @param tenantKey - * @return - */ - Collection listAllTaxAgentsAsRange(List employeeIds, String tenantKey); - - /** - * 新建个税扣缴义务人 - * - * @param saveParam - * @param employeeId - * @param tenantKey - * @return - */ - String save(TaxAgentSaveParam saveParam, Long employeeId, String tenantKey); - - /** - * 更新代缴机构 - * - * @param taxAgentPO - * @param employeeId - * @param tenantKey - * @return - */ - String paymentAgencyUpdate(TaxAgentPO taxAgentPO, Long employeeId, String tenantKey); - - /** - * 编辑个税扣缴义务人 - * - * @param saveParam - * @param employeeId - * @param tenantKey - * @return - */ - String update(TaxAgentSaveParam saveParam, Long employeeId, String tenantKey); - - /** - * 删除个税扣缴义务人 - * - * @param ids - * @param employeeId - * @param tenantKey - * @return - */ - String delete(Collection ids, Long employeeId, String tenantKey); - - /** - * 获取个税扣缴义务人下拉列表 - * - * @param currentEmployeeId - * @param currentTenantKey - * @return - */ - List> selectList(Long currentEmployeeId, String currentTenantKey); - - /** - * 是否开启分权 - * - * @param tenantKey - * @return - */ - Boolean isOpenDevolution(String tenantKey); - - /** - * 获取个税扣缴义务人和可查看的人员列表(树型) - * - * @param employeeId - * @param tenantKey - * @return - */ - List listTaxAgentAndEmployeeTree(Long employeeId, String tenantKey); - - /** - * 获取个税扣缴义务人和可查看的人员列表(扁平型) - * - * @param employeeId - * @param tenantKey - * @return - */ - List listTaxAgentAndEmployee(Long employeeId, String tenantKey); - - /** - * 获取个税扣缴义务人和可查看的人员列表(树型) - * - * @param employeeStatus - * @param employeeId - * @param tenantKey - * @return - */ - List listTaxAgentAndEmployeeTree(SalaryEmployeeStatusEnum employeeStatus, Long employeeId, String tenantKey); - - /** - * 获取个税扣缴义务人和可查看的人员列表(扁平型) - * - * @param employeeStatus - * @param employeeId - * @param tenantKey - * @return - */ - List listTaxAgentAndEmployee(SalaryEmployeeStatusEnum employeeStatus, Long employeeId, String tenantKey); - - /** - * 更换管理员校验是否有核算数据 - * - * @param checkParam - * @param currentEmployeeId - * @param currentTenantKey - * @return - */ - Boolean adminChangeCheck(TaxAgentAdminChangeCheckParam checkParam, Long currentEmployeeId, String currentTenantKey); - } diff --git a/src/com/engine/salary/service/TaxAgentSubAdminEmpService.java b/src/com/engine/salary/service/TaxAgentSubAdminEmpService.java new file mode 100644 index 000000000..a5a4cad17 --- /dev/null +++ b/src/com/engine/salary/service/TaxAgentSubAdminEmpService.java @@ -0,0 +1,52 @@ +package com.engine.salary.service; + +import com.engine.salary.entity.taxagent.param.TaxAgentSubAdminEmpSaveParam; +import com.engine.salary.entity.taxagent.po.TaxAgentSubAdminEmpPO; + +import java.util.Collection; +import java.util.List; + +/** + * 个税扣缴义务人的分管理员的管理范围人员 + *

Copyright: Copyright (c) 2022

+ *

Company: 泛微软件

+ * + * @author qiantao + * @version 1.0 + **/ +public interface TaxAgentSubAdminEmpService{ + + /** + * 同步分管理员的人员 + * + * @param subAdminEmpSaveParamList + * @param employeeId + * @param tenantKey + */ + void syncTaxAgentSubAdminEmployee(List subAdminEmpSaveParamList, Long employeeId); + + /** + * 根据分管理员id获取人员 + * + * @param subAdminIds + * @param tenantKey + * @return + */ + List listBySubAdminIds(List subAdminIds); + + /** + * 根据分管理员id删除人员 + * + * @param subAdminIds + * @param tenantKey + */ + void deleteBySubAdminIds(Collection subAdminIds); + + /** + * 根据个税扣缴义务人id获取关联人员 + * + * @param noAdminTaxAgentIds + * @return + */ + List listByTaxAgentIds(List noAdminTaxAgentIds); +} diff --git a/src/com/engine/salary/service/TaxAgentSubAdminService.java b/src/com/engine/salary/service/TaxAgentSubAdminService.java new file mode 100644 index 000000000..f428ede25 --- /dev/null +++ b/src/com/engine/salary/service/TaxAgentSubAdminService.java @@ -0,0 +1,84 @@ +package com.engine.salary.service; + +import com.engine.salary.entity.taxagent.param.TaxAgentSubAdminBaseSaveParam; +import com.engine.salary.entity.taxagent.po.TaxAgentSubAdminPO; + +import java.util.Collection; +import java.util.List; + +/** + * 个税扣缴义务人分管理员 + *

Copyright: Copyright (c) 2022

+ *

Company: 泛微软件

+ * + * @author qiantao + * @version 1.0 + **/ +public interface TaxAgentSubAdminService { + + /** + * 根据个税扣缴义务人id删除分管理员 + * + * @param taxAgentIds + */ + void deleteByTaxAgentIds(Collection taxAgentIds); + + /** + * 根据id获取列表 + * + * @param ids + * @return + */ + List listByIds(Collection ids); + + /** + * 根据个税扣缴义务人id查询分管理员 + * + * @param taxAgentIds + * @return + */ + List listByTaxAgentIds(Collection taxAgentIds); + + /** + * 根据个税扣缴义务人id和人员id查询分管理员 + * + * @param taxAgentIds + * @param currentEmployeeId + * @return + */ + List listByTaxAgentIdsAndEmployeeId(List taxAgentIds, Long currentEmployeeId); + + /** + * 根据当前登录人id查询分管理员 + * + * @param currentEmployeeId + * @return + */ + List listByAndEmployeeId(Long currentEmployeeId); + + /** + * 根据id删除分管理员 + * + * @param ids + * @param employeeId + * @return + */ + String deleteByIds(Collection ids, Long employeeId); + + /** + * 根据分管理员id和个税扣缴义务人id获取分管理员 + * + * @param id + * @return + */ + TaxAgentSubAdminPO getById(Long id); + + /** + * 保存基础设置 + * + * @param saveParam + * @param employeeId + * @return + */ + String saveBase(TaxAgentSubAdminBaseSaveParam saveParam, Long employeeId); +} diff --git a/src/com/engine/salary/service/TaxAgentV2Service.java b/src/com/engine/salary/service/TaxAgentV2Service.java new file mode 100644 index 000000000..523c2f18d --- /dev/null +++ b/src/com/engine/salary/service/TaxAgentV2Service.java @@ -0,0 +1,217 @@ +package com.engine.salary.service; + +import com.engine.salary.entity.taxagent.dto.TaxAgentEmployeeDTO; +import com.engine.salary.entity.taxagent.dto.TaxAgentEmployeeTaxAgentDTO; +import com.engine.salary.entity.taxagent.dto.TaxAgentListDTO; +import com.engine.salary.entity.taxagent.dto.TaxAgentManageRangeEmployeeDTO; +import com.engine.salary.entity.taxagent.param.TaxAgentAdminChangeCheckParam; +import com.engine.salary.entity.taxagent.param.TaxAgentQueryParam; +import com.engine.salary.entity.taxagent.param.TaxAgentSaveParam; +import com.engine.salary.entity.taxagent.po.TaxAgentPO; +import com.engine.salary.enums.salarysob.SalaryEmployeeStatusEnum; +import com.engine.salary.enums.taxagent.TaxAgentRoleTypeEnum; +import com.engine.salary.util.page.PageInfo; + +import java.util.Collection; +import java.util.List; +import java.util.Map; + +public interface TaxAgentV2Service { + + /** + * 获取当前登录人角色(返回最大角色,优先级为:总管理员-》管理员-》分管理员) + * + * @param currentEmployeeId + * @return + */ + TaxAgentRoleTypeEnum getRoleType(Long currentEmployeeId); + + /** + * 是否是薪酬模块总管理员 + * + * @param currentEmployeeId + * @return + */ + Boolean isChief(Long currentEmployeeId); + + /** + * 默认权限是否开启 + * + * @param currentEmployeeId + * @return + */ + Boolean isDefaultOpen(Long currentEmployeeId); + + /** + * 管理员是否有权限 + * + * @param currentEmployeeId + * @return + */ + Boolean isAdminEnable(Long currentEmployeeId); + + /** + * 个税扣缴义务人列表(分页) + * + * @param queryParam + * @return + */ + PageInfo listPage(TaxAgentQueryParam queryParam); + + /** + * 个税扣缴义务人列表(不分页) + * + * @param queryParam + * @return + */ + List list(TaxAgentQueryParam queryParam); + + + /** + * 根据id查询个税扣缴义务人 + * + * @param ids + * @return + */ + List listByIds(Collection ids); + + /** + * 查询租户下的所有个税扣缴义务人 + * + * @return + */ + List listAll(); + + /** + * 根据id获取单个个税扣缴义务人 + * + * @param id + * @return + */ + TaxAgentPO getById(Long id); + + /** + * 获取所有个税扣缴义务人 + * + * @return + */ + Collection findAll(); + + /** + * 获取作为管理员或分管理员的个税扣缴义务人列表 + * + * @param currentEmployeeId 当前登录人id + * @return + */ + Collection listAllTaxAgents(Long currentEmployeeId); + + /** + * 获取作为管理员的所有个税扣缴义务人列表 + * + * @param currentEmployeeId 当前登录人id + * @return + */ + Collection listAllTaxAgentsAsAdmin(Long currentEmployeeId); + + /** + * 获取作为人员范围中的个税扣缴义务人列表 + * + * @param employeeIds 被管理的人员id + * @return + */ + Collection listAllTaxAgentsAsRange(List employeeIds); + + /** + * 新建个税扣缴义务人 + * + * @param saveParam + * @param employeeId + * @return + */ + String save(TaxAgentSaveParam saveParam, Long employeeId); + + /** + * 更新代缴机构 + * + * @param taxAgentPO + * @param employeeId + * @return + */ + String paymentAgencyUpdate(TaxAgentPO taxAgentPO, Long employeeId); + + /** + * 编辑个税扣缴义务人 + * + * @param saveParam + * @param employeeId + * @return + */ + String update(TaxAgentSaveParam saveParam, Long employeeId); + + /** + * 删除个税扣缴义务人 + * + * @param ids + * @param employeeId + * @return + */ + String delete(Collection ids, Long employeeId); + + /** + * 获取个税扣缴义务人下拉列表 + * + * @param currentEmployeeId + * @return + */ + List> selectList(Long currentEmployeeId); + + /** + * 是否开启分权 + * + * @return + */ + Boolean isOpenDevolution(); + + /** + * 获取个税扣缴义务人和可查看的人员列表(树型) + * + * @param employeeId + * @return + */ + List listTaxAgentAndEmployeeTree(Long employeeId); + + /** + * 获取个税扣缴义务人和可查看的人员列表(扁平型) + * + * @param employeeId + * @return + */ + List listTaxAgentAndEmployee(Long employeeId); + + /** + * 获取个税扣缴义务人和可查看的人员列表(树型) + * + * @param employeeStatus + * @param employeeId + * @return + */ + List listTaxAgentAndEmployeeTree(SalaryEmployeeStatusEnum employeeStatus, Long employeeId); + + /** + * 获取个税扣缴义务人和可查看的人员列表(扁平型) + * + * @param employeeStatus + * @param employeeId + * @return + */ + List listTaxAgentAndEmployee(SalaryEmployeeStatusEnum employeeStatus, Long employeeId); + + /** + * 更换管理员校验是否有核算数据 + * + * @param checkParam + * @param currentEmployeeId + * @return + */ + Boolean adminChangeCheck(TaxAgentAdminChangeCheckParam checkParam, Long currentEmployeeId); +} diff --git a/src/com/engine/salary/service/TaxDeclarationExcelService.java b/src/com/engine/salary/service/TaxDeclarationExcelService.java index 54f8644a1..11202ba55 100644 --- a/src/com/engine/salary/service/TaxDeclarationExcelService.java +++ b/src/com/engine/salary/service/TaxDeclarationExcelService.java @@ -2,8 +2,6 @@ package com.engine.salary.service; import org.apache.poi.xssf.usermodel.XSSFWorkbook; -import java.util.Map; - /** * @description: 个税申报表导出 * @author: xiajun @@ -17,7 +15,6 @@ public interface TaxDeclarationExcelService { * 导出个税申报表 * * @param taxDeclarationId - * @param tenantKey */ XSSFWorkbook exportTaxDeclaration(Long taxDeclarationId); } diff --git a/src/com/engine/salary/service/TaxDeclarationService.java b/src/com/engine/salary/service/TaxDeclarationService.java index 96696b4cf..7aaf8dd5e 100644 --- a/src/com/engine/salary/service/TaxDeclarationService.java +++ b/src/com/engine/salary/service/TaxDeclarationService.java @@ -40,7 +40,6 @@ public interface TaxDeclarationService { * 删除个税申报表 * * @param salaryMonth - * @param tenantKey */ void deleteBySalaryMonth(YearMonth salaryMonth); diff --git a/src/com/engine/salary/service/impl/SalaryAcctRecordServiceImpl.java b/src/com/engine/salary/service/impl/SalaryAcctRecordServiceImpl.java index 49a7b2579..78f0f1649 100644 --- a/src/com/engine/salary/service/impl/SalaryAcctRecordServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalaryAcctRecordServiceImpl.java @@ -468,4 +468,9 @@ public class SalaryAcctRecordServiceImpl extends Service implements SalaryAcctRe public List listByStatus(SalaryAcctRecordStatusEnum status) { return getSalaryAcctRecordMapper().listSome(SalaryAcctRecordPO.builder().status(status.getValue()).build()); } + + @Override + public List listByStatusAndEmployeeId(SalaryAcctRecordStatusEnum status, Long employeeId) { + return getSalaryAcctRecordMapper().listSome(SalaryAcctRecordPO.builder().status(status.getValue()).creator(employeeId).build()); + } } diff --git a/src/com/engine/salary/service/impl/TaxAgentServiceImpl.java b/src/com/engine/salary/service/impl/TaxAgentServiceImpl.java index 9ac383d39..044f688ea 100644 --- a/src/com/engine/salary/service/impl/TaxAgentServiceImpl.java +++ b/src/com/engine/salary/service/impl/TaxAgentServiceImpl.java @@ -3,34 +3,27 @@ package com.engine.salary.service.impl; import com.engine.core.impl.Service; import com.engine.salary.biz.TaxAgentBiz; import com.engine.salary.cmd.TaxAgent.*; -import com.engine.salary.constant.TaxAgentPermissionConstant; import com.engine.salary.entity.datacollection.AddUpDeduction; import com.engine.salary.entity.datacollection.AddUpSituation; import com.engine.salary.entity.datacollection.po.OtherDeductionPO; import com.engine.salary.entity.salaryarchive.po.SalaryArchiveTaxAgentPO; -import com.engine.salary.entity.taxagent.po.TaxAgentAdminPO; -import com.engine.salary.entity.taxagent.po.TaxAgentPO; import com.engine.salary.entity.taxrate.TaxAgent; import com.engine.salary.entity.taxrate.param.TaxAgentQueryParam; -import com.engine.salary.enums.taxagent.TaxAgentRoleTypeEnum; import com.engine.salary.exception.SalaryRunTimeException; import com.engine.salary.mapper.TaxAgentMapper; -import com.engine.salary.mapper.archive.SalaryArchiveMapper; import com.engine.salary.mapper.archive.SalaryArchiveTaxAgentMapper; import com.engine.salary.mapper.datacollection.AddUpDeductionMapper; import com.engine.salary.mapper.datacollection.AddUpSituationMapper; import com.engine.salary.mapper.datacollection.OtherDeductionMapper; -import com.engine.salary.service.*; +import com.engine.salary.service.TaxAgentService; import com.engine.salary.util.SalaryI18nUtil; import com.engine.salary.util.db.MapperProxyFactory; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; -import org.springframework.beans.BeanUtils; -import org.springframework.transaction.annotation.Transactional; -import java.time.LocalDateTime; -import java.util.*; -import java.util.stream.Collectors; +import java.util.Collection; +import java.util.List; +import java.util.Map; public class TaxAgentServiceImpl extends Service implements TaxAgentService { @@ -146,635 +139,4 @@ public class TaxAgentServiceImpl extends Service implements TaxAgentService { public TaxAgent getById(Long id) { return getTaxAgentMapper().getById(id); } - - - private TaxAgentMapper taxAgentMapper; -// -// private ExtEmployeeService extEmployeeService; - - private TaxAgentBaseService taxAgentBaseService; - - private TaxAgentAdminService taxAgentAdminService; - -// private TaxAgentSubAdminService taxAgentSubAdminService; - -// private TaxAgentManageRangeService taxAgentManageRangeService; - - private TaxAgentEmpService taxAgentEmpService; - -// private TaxAgentSubAdminEmpService taxAgentSubAdminEmpService; - - private SalaryArchiveMapper salaryArchiveMapper; - - private AddUpDeductionMapper addUpDeductionMapper; - - private OtherDeductionMapper otherDeductionMapper; - - private AddUpSituationMapper addUpSituationMapper; - - -// private PaymentAgencyMapper paymentAgencyMapper; - -// private SIArchivesSocialMapper siArchivesSocialMapper; - -// private SIArchivesFundMapper siArchivesFundMapper; - -// private SIArchivesOtherMapper siArchivesOtherMapper; - -// private AuthorityService authorityService; - - private SalaryAcctRecordService salaryAcctRecordService; - - private SIAccountService siAccountService; - - private HrmCommonHrmStatusService hrmCommonHrmStatusService; - - @Override - public TaxAgentRoleTypeEnum getRoleType(Long currentEmployeeId) { - TaxAgentRoleTypeEnum roleType = TaxAgentRoleTypeEnum.NONE; - if (isChief(currentEmployeeId)) { - return TaxAgentRoleTypeEnum.CHIEF; - } - // 是否开启分权 - boolean isOpenDevolution = taxAgentBaseService.isOpenDevolution(); - if (!isOpenDevolution) { - List taxAgentAdmins = taxAgentAdminService.listByEmployeeId(currentEmployeeId, currentTenantKey); - if (CollectionUtils.isNotEmpty(taxAgentAdmins)) { - return TaxAgentRoleTypeEnum.ADMIN; - } - List taxAgentSubAdmins = taxAgentSubAdminService.listByAndEmployeeId(currentEmployeeId, currentTenantKey); - if (CollectionUtils.isNotEmpty(taxAgentSubAdmins)) { - return TaxAgentRoleTypeEnum.SUBADMIN; - } - } - return roleType; - } - - @Override - public Boolean isChief(Long currentEmployeeId) { - - return currentEmployeeId == 1; - - //return authorityService.checkPermissionSet(TaxAgentPermissionConstant.MENU_CODE, TaxAgentPermissionConstant.ITEM_CODE_DEVOLUTION, currentEmployeeId); - } - - @Override - public Boolean isDefaultOpen(Long currentEmployeeId, String currentTenantKey) { - return authorityService.checkPermissionSet(TaxAgentPermissionConstant.MENU_CODE, TaxAgentPermissionConstant.ITEM_CODE_DEFAULT, currentEmployeeId); - } - - @Override - public Boolean isAdminEnable(Long currentEmployeeId, String currentTenantKey) { - // 如果不是超管,是管理员 - if (!isChief(currentEmployeeId)) { - // 没有开启分权 - if (!isOpenDevolution(currentTenantKey)) { - return Boolean.FALSE; - } else { - // 自己有没有被分配为管理员 - List taxAgentAdminList = taxAgentAdminService.listByEmployeeId(currentEmployeeId); - return CollectionUtils.isNotEmpty(taxAgentAdminList); - } - } - return Boolean.TRUE; - } - - @Override - public Page listPage(Page page, TaxAgentQueryParam queryParam, String currentTenantKey) { - taxAgentMapper.list(page, queryParam, currentTenantKey); - return page; - } - - @Override - public List list(TaxAgentQueryParam queryParam, String currentTenantKey) { - return taxAgentMapper.list(queryParam, currentTenantKey); - } - - @Override - public List listByIds(Collection ids, String tenantKey) { - return new LambdaQueryChainWrapper<>(taxAgentMapper) - .eq(TaxAgentPO::getTenantKey, tenantKey) - .eq(TaxAgentPO::getDeleteType, 0) - .in(TaxAgentPO::getId, ids) - .list(); - } - - @Override - public List listAll(String tenantKey) { - return new LambdaQueryChainWrapper<>(taxAgentMapper) - .eq(TaxAgentPO::getTenantKey, tenantKey) - .eq(TaxAgentPO::getDeleteType, 0) - .list(); - } - - @Override - public TaxAgentPO getById(Long id, String tenantKey) { - return new LambdaQueryChainWrapper<>(taxAgentMapper) - .eq(TaxAgentPO::getTenantKey, tenantKey) - .eq(TaxAgentPO::getDeleteType, 0) - .eq(TaxAgentPO::getId, id) - .one(); - } - - @Override - public Collection findAll(String tenantKey) { - List taxAgents = taxAgentMapper.list(TaxAgentQueryParam.builder().build(), tenantKey); - return TaxAgentBO.convertToListDTO(taxAgents, tenantKey); - } - - @Override - public Collection listAllTaxAgents(Long employeeId, String tenantKey) { - List taxAgents = taxAgentMapper.list(TaxAgentQueryParam.builder().build(), tenantKey); - return handleForDevolution(taxAgents, employeeId, tenantKey); - } - - @Override - public Collection listAllTaxAgentsAsAdmin(Long employeeId, String tenantKey) { - List taxAgents = taxAgentMapper.list(TaxAgentQueryParam.builder().build(), tenantKey); - // 是否开启分权 - boolean isOpenDevolution = taxAgentBaseService.isOpenDevolution(tenantKey); - if (!isOpenDevolution) { - return taxAgents; - } - List taxAgentIds = taxAgents.stream().map(TaxAgentPO::getId).collect(Collectors.toList()); - List enableTaxAgentIds = Lists.newArrayList(); - // 1.判断自己是否是管理员, 如果是管理员,就是能够查看所属个税扣缴义务人 - List taxAgentAdminList = taxAgentAdminService.listByTaxAgentIds(taxAgentIds, tenantKey); - // 是管理员的列表 - List adminTaxAgentIds = taxAgentAdminList.stream().filter(f -> f.getEmployeeId().equals(employeeId)).map(TaxAgentAdminPO::getTaxAgentId).collect(Collectors.toList()); - - enableTaxAgentIds.addAll(adminTaxAgentIds); - return taxAgents.stream().filter(f -> enableTaxAgentIds.contains(f.getId())).collect(Collectors.toList()); - } - - @Override - public Collection listAllTaxAgentsAsRange(List employeeIds, String tenantKey) { - List taxAgents = taxAgentMapper.list(TaxAgentQueryParam.builder().build(), tenantKey); - List taxAgentIds = taxAgents.stream().map(TaxAgentPO::getId).collect(Collectors.toList()); - - List taxAgentEmployees = taxAgentEmpService.listByTaxAgentIds(taxAgentIds, tenantKey); - - if (CollectionUtils.isEmpty(taxAgentEmployees)) { - return Lists.newArrayList(); - } - - // 转换数据结构 - List allemployeeIds = taxAgentEmployees.stream().map(TaxAgentEmpPO::getEmployeeId).distinct().collect(Collectors.toList()); - - return allemployeeIds.stream().map(m -> { - List enableTaxAgentIds = taxAgentEmployees.stream().filter(f -> f.getEmployeeId().equals(m)).map(TaxAgentEmpPO::getTaxAgentId).distinct() - .collect(Collectors.toList()); - return TaxAgentEmployeeTaxAgentDTO.builder() - .employeeId(m) - .taxAgentIds(enableTaxAgentIds) - .build(); - }).collect(Collectors.toList()); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public String save(TaxAgentSaveParam saveParam, Long employeeId, String tenantKey) { - // 是否开启分权 - boolean isOpenDevolution = taxAgentBaseService.isOpenDevolution(tenantKey); - if (isOpenDevolution && saveParam.getAdminUserId() == null) { - throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 106271, "请选择管理员")); - } - QueryWrapper queryWrapper = new QueryWrapper<>(); - queryWrapper.eq("tenant_key", tenantKey) - .eq("delete_type", 0) - .eq("name", saveParam.getName()); - List taxAgents = taxAgentMapper.selectList(queryWrapper); - if (CollectionUtils.isNotEmpty(taxAgents)) { - throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 98080, "名称不允许重复")); - } - PaymentAgencyPO paymentAgencyPO = new LambdaQueryChainWrapper<>(paymentAgencyMapper) - .eq(PaymentAgencyPO::getTenantKey, tenantKey) - .eq(PaymentAgencyPO::getDeleteType, DeleteTypeEnum.NOT_DELETED.getValue()) - .eq(PaymentAgencyPO::getAgencyName, saveParam.getName()) - .one(); - if (paymentAgencyPO != null) { - throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 115130, "名称不允许与社保福利代缴机构名称重复")); - } - // 保存 - saveParam.setId(IdGenerator.generate()); - TaxAgentPO taxAgent = TaxAgentBO.convertToPO(saveParam, employeeId, tenantKey); - taxAgentMapper.insert(taxAgent); - if (isOpenDevolution) { - taxAgentAdminService.batchInsert(saveParam.getId(), Collections.singletonList(saveParam.getAdminUserId()), employeeId, tenantKey); - } - // 记录日志 - SalaryLoggerUtil.recordAddSingleLog(taxAgentLoggerTemplate, - taxAgent.getId(), - taxAgent.getName(), - SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 93766, "新增个税扣缴义务人"), - SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 93766, "新增个税扣缴义务人"), - taxAgent); - - return StringUtils.EMPTY + taxAgent.getId(); - } - - @Override - public String paymentAgencyUpdate(TaxAgentPO taxAgentPO, Long employeeId, String tenantKey) { - taxAgentMapper.updateById(taxAgentPO); - return ""; - } - - @Override - @Transactional(rollbackFor = Exception.class) - public String update(TaxAgentSaveParam saveParam, Long employeeId, String tenantKey) { - TaxAgentPO taxAgent = getById(saveParam.getId(), tenantKey); - if (taxAgent == null) { - throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 100545, "个税扣缴义务人不存在")); - } - // 是否开启分权 - boolean isOpenDevolution = taxAgentBaseService.isOpenDevolution(tenantKey); - if (isOpenDevolution && saveParam.getAdminUserId() == null) { - throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 106271, "请选择管理员")); - } - QueryWrapper queryWrapper = new QueryWrapper<>(); - queryWrapper.eq("tenant_key", tenantKey) - .eq("delete_type", 0) - .eq("name", saveParam.getName()); - List individualTaxWithholdingAgents = taxAgentMapper.selectList(queryWrapper); - boolean nameExist = CollectionUtils.emptyIfNull(individualTaxWithholdingAgents).stream().anyMatch(e -> !Objects.equals(e.getId(), saveParam.getId())); - if (nameExist) { - throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 98080, "名称不允许重复")); - } - TaxAgentPO taxAgentNew = new TaxAgentPO(); - BeanUtils.copyProperties(taxAgent, taxAgentNew); - BeanUtils.copyProperties(saveParam, taxAgentNew); - taxAgentNew.setUpdateTime(LocalDateTime.now()); - taxAgentMapper.updateById(taxAgentNew); - if (isOpenDevolution) { - Boolean isUnEnableChange = adminChangeCheck(TaxAgentAdminChangeCheckParam.builder() - .taxAgentId(saveParam.getId()) - .adminUserId(saveParam.getAdminUserId()) - .build(), employeeId, tenantKey); - if (isUnEnableChange) { - throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 115937, "该管理员有未归档核算数据,不可更换管理员")); - } - // 删除管理员 - taxAgentAdminService.deleteByTaxAgentIds(Collections.singletonList(taxAgent.getId()), tenantKey); - // 新增管理员 - taxAgentAdminService.batchInsert(saveParam.getId(), Collections.singletonList(saveParam.getAdminUserId()), employeeId, tenantKey); - } - // 记录日志 - SalaryLoggerUtil.recordUpdateSingleLog(taxAgentLoggerTemplate, - taxAgent.getId(), - taxAgentNew.getName(), - SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 93767, "编辑个税扣缴义务人"), - SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 93767, "编辑个税扣缴义务人"), - taxAgent, - taxAgentNew); - - return StringUtils.EMPTY; - } - - @Override - public Boolean adminChangeCheck(TaxAgentAdminChangeCheckParam checkParam, Long currentEmployeeId, String currentTenantKey) { - List taxAgentAdminList = taxAgentAdminService.listByTaxAgentIds(Collections.singletonList(checkParam.getTaxAgentId()), currentTenantKey); - Long adminUserId = CollectionUtils.isNotEmpty(taxAgentAdminList) ? taxAgentAdminList.get(0).getEmployeeId() : 0L; - boolean isChanged = checkParam.getAdminUserId() != null && !adminUserId.equals(checkParam.getAdminUserId()); - // 更换了管理员 - if (isChanged) { - // 检查是否核算 - // 1.社保福利档案是否有核算未归档 - Boolean checkedValue = siAccountService.changeAdminUnfiledCheck(adminUserId, currentTenantKey); - // 2.薪资核算是否有核算未归档 - List salaryAcctRecords = salaryAcctRecordService.listByStatusAndEmployeeId(SalaryAcctRecordStatusEnum.NOT_ARCHIVED, adminUserId, currentTenantKey); - if (CollectionUtils.isNotEmpty(salaryAcctRecords) || checkedValue) { - return Boolean.TRUE; - } - } - return Boolean.FALSE; - } - - @Override - @Transactional(rollbackFor = Exception.class) - public String delete(Collection ids, Long employeeId, String tenantKey) { - - List taxAgents = taxAgentMapper.list(TaxAgentQueryParam.builder().ids(ids).build(), tenantKey); - if (CollectionUtils.isEmpty(taxAgents)) { - throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 85382, "要删除的个税扣缴义务人在不存在或已删除")); - } - // 正在使用的记录不允许删除 - boolean checkUsed = checkUsed(ids, tenantKey); - if (checkUsed) { - throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(tenantKey, UserContext.getCurrentEmployeeId(), 100570, "正在使用的记录不允许删除")); - } - // 删除管理员 - taxAgentAdminService.deleteByTaxAgentIds(ids, tenantKey); - // 删除分管理员和对应管理范围 - taxAgentSubAdminService.deleteByTaxAgentIds(ids, tenantKey); - // 删除人员范围 - taxAgentManageRangeService.deleteByTaxAgentIds(ids, tenantKey); - - new LambdaUpdateChainWrapper<>(taxAgentMapper) - .eq(TaxAgentPO::getDeleteType, 0) - .eq(TaxAgentPO::getTenantKey, tenantKey) - .in(TaxAgentPO::getId, ids) - .set(TaxAgentPO::getDeleteType, 1) - .update(); - // 记录日志 - taxAgents.forEach(e -> SalaryLoggerUtil.recordDeleteSingleLog(taxAgentLoggerTemplate, - e.getId(), - e.getName(), - SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 100546, "删除个税扣缴义务人"), - SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 100546, "删除个税扣缴义务人") + ":" + e.getName(), - e)); - - return StringUtils.EMPTY; - } - - /** - * 检查正在被使用的记录 - * - * @param ids - * @param tenantKey - * @return - */ - private boolean checkUsed(Collection ids, String tenantKey) { - // 被薪资档案引用 - List salaryArchiveList = new LambdaQueryChainWrapper<>(salaryArchiveMapper) - .eq(SalaryArchivePO::getDeleteType, 0) - .eq(SalaryArchivePO::getTenantKey, tenantKey) - .in(SalaryArchivePO::getTaxAgentId, ids) - .list(); - if (CollectionUtils.isNotEmpty(salaryArchiveList)) { - return Boolean.TRUE; - } - // 被社保福利档案引用 - List socialSchemePOList = new LambdaQueryChainWrapper<>(siArchivesSocialMapper) - .eq(InsuranceArchivesSocialSchemePO::getTenantKey, tenantKey) - .eq(InsuranceArchivesSocialSchemePO::getDeleteType, DeleteTypeEnum.NOT_DELETED.getValue()) - .in(InsuranceArchivesSocialSchemePO::getPaymentOrganization, ids) - .list(); - if (CollectionUtils.isNotEmpty(socialSchemePOList)) { - return Boolean.TRUE; - } - List fundSchemePOList = new LambdaQueryChainWrapper<>(siArchivesFundMapper) - .eq(InsuranceArchivesFundSchemePO::getTenantKey, tenantKey) - .eq(InsuranceArchivesFundSchemePO::getDeleteType, DeleteTypeEnum.NOT_DELETED.getValue()) - .in(InsuranceArchivesFundSchemePO::getPaymentOrganization, ids) - .list(); - if (CollectionUtils.isNotEmpty(fundSchemePOList)) { - return Boolean.TRUE; - } - List otherSchemePOList = new LambdaQueryChainWrapper<>(siArchivesOtherMapper) - .eq(InsuranceArchivesOtherSchemePO::getTenantKey, tenantKey) - .eq(InsuranceArchivesOtherSchemePO::getDeleteType, DeleteTypeEnum.NOT_DELETED.getValue()) - .in(InsuranceArchivesOtherSchemePO::getPaymentOrganization, ids) - .list(); - if (CollectionUtils.isNotEmpty(otherSchemePOList)) { - return Boolean.TRUE; - } - - // 被外部人员引用 - List extEmployeeList = extEmployeeService.listAll(tenantKey); - List extTaxAgentIds = extEmployeeList.stream().map(ExtEmployeePO::getTaxAgentId).distinct().collect(Collectors.toList()); - if (CollectionUtils.isNotEmpty(extTaxAgentIds)) { - return ids.stream().anyMatch(e -> extTaxAgentIds.stream().anyMatch(f -> f.equals(e))); - } - - // 被累计专项附加扣除引用 - List addUpDeductionList = new LambdaQueryChainWrapper<>(addUpDeductionMapper) - .eq(AddUpDeductionPO::getDeleteType, 0) - .eq(AddUpDeductionPO::getTenantKey, tenantKey) - .in(AddUpDeductionPO::getTaxAgentId, ids) - .list(); - if (CollectionUtils.isNotEmpty(addUpDeductionList)) { - return Boolean.TRUE; - } - // 被其他免税扣除引用 - List otherDeductionList = new LambdaQueryChainWrapper<>(otherDeductionMapper) - .eq(OtherDeductionPO::getDeleteType, 0) - .eq(OtherDeductionPO::getTenantKey, tenantKey) - .in(OtherDeductionPO::getTaxAgentId, ids) - .list(); - if (CollectionUtils.isNotEmpty(otherDeductionList)) { - return Boolean.TRUE; - } - // 被往期累计情况引用 - List addUpSituationList = new LambdaQueryChainWrapper<>(addUpSituationMapper) - .eq(AddUpSituationPO::getDeleteType, 0) - .eq(AddUpSituationPO::getTenantKey, tenantKey) - .in(AddUpSituationPO::getTaxAgentId, ids) - .list(); - if (CollectionUtils.isNotEmpty(addUpSituationList)) { - return Boolean.TRUE; - } - - return Boolean.FALSE; - } - - @Override - public List> selectList(Long currentEmployeeId, String currentTenantKey) { - List taxAgents = taxAgentMapper.list(TaxAgentQueryParam.builder().build(), currentTenantKey); - taxAgents = handleForDevolution(taxAgents, currentEmployeeId, currentTenantKey); - return CollectionUtils.emptyIfNull(taxAgents).stream().map(m -> { - Map map = new HashMap<>(2); - map.put("id", String.valueOf(m.getId())); - map.put("content", m.getName()); - return map; - }).collect(Collectors.toList()); - } - - /** - * 分权处理 - * - * @param taxAgents - * @param currentEmployeeId - * @param currentTenantKey - * @return - */ - private List handleForDevolution(List taxAgents, Long currentEmployeeId, String currentTenantKey) { - // 是否开启分权 - boolean isOpenDevolution = taxAgentBaseService.isOpenDevolution(currentTenantKey); - if (!isOpenDevolution || isChief(currentEmployeeId, currentTenantKey)) { - return taxAgents; - } - List taxAgentIds = taxAgents.stream().map(TaxAgentPO::getId).collect(Collectors.toList()); - List enableTaxAgentIds = Lists.newArrayList(); - // 1.判断自己是否是管理员, 如果是管理员,就是能够查看所属个税扣缴义务人 - List taxAgentAdminList = taxAgentAdminService.listByTaxAgentIdsAndEmployeeId(taxAgentIds, currentEmployeeId, currentTenantKey); - // 是管理员的列表 - List adminTaxAgentIds = taxAgentAdminList.stream().map(TaxAgentAdminPO::getTaxAgentId).collect(Collectors.toList()); - - enableTaxAgentIds.addAll(adminTaxAgentIds); - // 2.根据作为非管理员查找自己作为分管理员的个税扣缴义务人id - List noAdminTaxAgentIds = taxAgents.stream() - .map(TaxAgentPO::getId) - .filter(id -> !adminTaxAgentIds.contains(id)).collect(Collectors.toList()); - if (CollectionUtils.isNotEmpty(noAdminTaxAgentIds)) { - List taxAgentSubAdmins = taxAgentSubAdminService.listByTaxAgentIdsAndEmployeeId(noAdminTaxAgentIds, currentEmployeeId, currentTenantKey); - List sunAdminTaxAgentIds = taxAgentSubAdmins.stream().map(TaxAgentSubAdminPO::getTaxAgentId).collect(Collectors.toList()); - enableTaxAgentIds.addAll(sunAdminTaxAgentIds); - } - return taxAgents.stream().filter(f -> enableTaxAgentIds.contains(f.getId())).collect(Collectors.toList()); - } - - @Override - public Boolean isOpenDevolution(String tenantKey) { - return taxAgentBaseService.isOpenDevolution(tenantKey); - } - - @Override - public List listTaxAgentAndEmployeeTree(Long employeeId, String tenantKey) { - return listTaxAgentAndEmployeeTree(null, employeeId, tenantKey); - } - - @Override - public List listTaxAgentAndEmployee(Long employeeId, String tenantKey) { - return listTaxAgentAndEmployee(null, employeeId, tenantKey); - } - - @Override - public List listTaxAgentAndEmployeeTree(SalaryEmployeeStatusEnum employeeStatus, Long employeeId, String tenantKey) { - List taxAgentManageRangeEmployeeList = Lists.newArrayList(); - // 所有个税扣缴义务人 - List allTaxAgents = listAll(tenantKey); - if (CollectionUtils.isEmpty(allTaxAgents)) { - return taxAgentManageRangeEmployeeList; - } - - List taxAgentIds = allTaxAgents.stream().map(TaxAgentPO::getId).collect(Collectors.toList()); - List allEmployees = taxAgentMapper.listEmployee(tenantKey); - if (employeeStatus != null) { - List personnelStatusList; - // 查询人员状态 - List hrmStatusList = hrmCommonHrmStatusService.list(tenantKey); - if (employeeStatus.equals(SalaryEmployeeStatusEnum.NORMAL)) { - personnelStatusList = hrmStatusList.stream().filter(f -> f.getJobflag().equals(SalaryJobFlagEnum.normal.getValue())).map(m -> m.getCodeId() + "").collect(Collectors.toList()); - List finalPersonnelStatus1 = personnelStatusList; - allEmployees = allEmployees.stream().filter(f -> finalPersonnelStatus1.contains(f.getPersonnelStatus())).collect(Collectors.toList()); - } else if (employeeStatus.equals(SalaryEmployeeStatusEnum.UNAVAILABLE)) { - personnelStatusList = hrmStatusList.stream().filter(f -> f.getJobflag().equals(SalaryJobFlagEnum.unavailable.getValue())).map(m -> m.getCodeId() + "").collect(Collectors.toList()); - List finalPersonnelStatuss2 = personnelStatusList; - allEmployees = allEmployees.stream().filter(f -> finalPersonnelStatuss2.contains(f.getPersonnelStatus())).collect(Collectors.toList()); - } - } - - // 是否开启分权 - if (!isOpenDevolution(tenantKey) || isChief(employeeId, tenantKey)) { - return getTaxAgentEmp(allTaxAgents, taxAgentIds, allEmployees, tenantKey); - } - - // 1.判断自己是否是管理员, 如果是管理员,就是能够操作所属个税扣缴义务人下的所有人的数据 - List taxAgentAdminList = taxAgentAdminService.listByTaxAgentIdsAndEmployeeId(taxAgentIds, employeeId, tenantKey); - // 是管理员的列表 - List adminTaxAgentIds = taxAgentAdminList.stream().map(TaxAgentAdminPO::getTaxAgentId).collect(Collectors.toList()); - - if (CollectionUtils.isNotEmpty(adminTaxAgentIds)) { - taxAgentManageRangeEmployeeList.addAll(getTaxAgentEmp(allTaxAgents, adminTaxAgentIds, allEmployees, tenantKey)); - } - // 2.根据作为非管理员查找自己作为分管理员, 对应的管理范围人员 - List noAdminTaxAgentIds = allTaxAgents.stream() - .map(TaxAgentPO::getId) - .filter(id -> !adminTaxAgentIds.contains(id)).collect(Collectors.toList()); - if (CollectionUtils.isNotEmpty(noAdminTaxAgentIds)) { - taxAgentManageRangeEmployeeList.addAll(getTaxAgentSubAdminEmp(allTaxAgents, noAdminTaxAgentIds, allEmployees, tenantKey)); - } - - return taxAgentManageRangeEmployeeList; - } - - /** - * 获取分管理员的关联人员 - * - * @param allTaxAgents - * @param noAdminTaxAgentIds - * @param allEmployees - * @param tenantKey - * @return - */ - private List getTaxAgentSubAdminEmp(List allTaxAgents, List noAdminTaxAgentIds, List allEmployees, String tenantKey) { - List taxAgentManageRangeEmployeeList = Lists.newArrayList(); - List taxAgentEmps = taxAgentSubAdminEmpService.listByTaxAgentIds(noAdminTaxAgentIds, tenantKey); - - taxAgentEmps = taxAgentEmps.stream().filter(f -> allEmployees.stream().anyMatch(e -> e.getEmployeeId().equals(f.getEmployeeId()))).collect(Collectors.toList()); - - List finalTaxAgentEmps = taxAgentEmps; - noAdminTaxAgentIds.forEach(e -> { - Optional optionalTaxAgent = allTaxAgents.stream().filter(t -> t.getId().equals(e)).findFirst(); - String taxAgentName = (optionalTaxAgent.isPresent() ? optionalTaxAgent.get().getName() : ""); - List taxAgentEmployees = finalTaxAgentEmps.stream().filter(f -> f.getTaxAgentId().equals(e)).map(m -> { - TaxAgentManageRangeEmployeeDTO.TaxAgentEmployee taxAgentEmployee = new TaxAgentManageRangeEmployeeDTO.TaxAgentEmployee(); - taxAgentEmployee.setEmployeeId(m.getEmployeeId()); - taxAgentEmployee.setUsername(m.getEmployeeName()); - return taxAgentEmployee; - }).collect(Collectors.toList()); - taxAgentManageRangeEmployeeList.add( - TaxAgentManageRangeEmployeeDTO.builder() - .taxAgentId(e) - .taxAgentName(taxAgentName) - .employeeList(taxAgentEmployees) - .build() - ); - }); - return taxAgentManageRangeEmployeeList; - } - - /** - * 获取个税口角义务人的关联人员 - * - * @param allTaxAgents - * @param taxAgentIds - * @param tenantKey - * @return - */ - private List getTaxAgentEmp(List allTaxAgents, List taxAgentIds, List allEmployees, String tenantKey) { - List taxAgentManageRangeEmployeeList = Lists.newArrayList(); - List taxAgentEmps = taxAgentEmpService.listByTaxAgentIds(taxAgentIds, tenantKey); - - taxAgentEmps = taxAgentEmps.stream().filter(f -> allEmployees.stream().anyMatch(e -> e.getEmployeeId().equals(f.getEmployeeId()))).collect(Collectors.toList()); - - List finalTaxAgentEmps = taxAgentEmps; - taxAgentIds.forEach(e -> { - Optional optionalTaxAgent = allTaxAgents.stream().filter(t -> t.getId().equals(e)).findFirst(); - String taxAgentName = (optionalTaxAgent.isPresent() ? optionalTaxAgent.get().getName() : ""); - List taxAgentEmployees = finalTaxAgentEmps.stream().filter(f -> f.getTaxAgentId().equals(e)).map(m -> { - TaxAgentManageRangeEmployeeDTO.TaxAgentEmployee taxAgentEmployee = new TaxAgentManageRangeEmployeeDTO.TaxAgentEmployee(); - taxAgentEmployee.setEmployeeId(m.getEmployeeId()); - taxAgentEmployee.setUsername(m.getEmployeeName()); - return taxAgentEmployee; - }).collect(Collectors.toList()); - taxAgentManageRangeEmployeeList.add( - TaxAgentManageRangeEmployeeDTO.builder() - .taxAgentId(e) - .taxAgentName(taxAgentName) - .employeeList(taxAgentEmployees) - .build() - ); - }); - return taxAgentManageRangeEmployeeList; - } - - @Override - public List listTaxAgentAndEmployee(SalaryEmployeeStatusEnum employeeStatus, Long employeeId, String tenantKey) { - List taxAgentEmployeeList = Lists.newArrayList(); - - List taxAgentManageRangeEmployeeList = listTaxAgentAndEmployeeTree(employeeStatus, employeeId, tenantKey); - taxAgentManageRangeEmployeeList.forEach(m -> { - List employeeList = m.getEmployeeList(); - if (CollectionUtils.isEmpty(employeeList)) { - taxAgentEmployeeList.add(TaxAgentEmployeeDTO.builder() - .taxAgentId(m.getTaxAgentId()) - .taxAgentName(m.getTaxAgentName()) - .employeeId(null) - .username(null) - .build()); - } else { - employeeList.forEach(f -> taxAgentEmployeeList.add(TaxAgentEmployeeDTO.builder() - .taxAgentId(m.getTaxAgentId()) - .taxAgentName(m.getTaxAgentName()) - .employeeId(f.getEmployeeId()) - .username(f.getUsername()) - .build())); - } - }); - - return taxAgentEmployeeList; - } - - } diff --git a/src/com/engine/salary/service/impl/TaxAgentV2ServiceImpl.java b/src/com/engine/salary/service/impl/TaxAgentV2ServiceImpl.java new file mode 100644 index 000000000..683812390 --- /dev/null +++ b/src/com/engine/salary/service/impl/TaxAgentV2ServiceImpl.java @@ -0,0 +1,641 @@ +package com.engine.salary.service.impl; + +import com.engine.core.impl.Service; +import com.engine.salary.constant.TaxAgentPermissionConstant; +import com.engine.salary.entity.datacollection.AddUpDeduction; +import com.engine.salary.entity.datacollection.AddUpSituation; +import com.engine.salary.entity.datacollection.po.OtherDeductionPO; +import com.engine.salary.entity.salaryacct.po.SalaryAcctRecordPO; +import com.engine.salary.entity.salaryarchive.po.SalaryArchivePO; +import com.engine.salary.entity.taxagent.bo.TaxAgentBO; +import com.engine.salary.entity.taxagent.dto.TaxAgentEmployeeDTO; +import com.engine.salary.entity.taxagent.dto.TaxAgentEmployeeTaxAgentDTO; +import com.engine.salary.entity.taxagent.dto.TaxAgentListDTO; +import com.engine.salary.entity.taxagent.dto.TaxAgentManageRangeEmployeeDTO; +import com.engine.salary.entity.taxagent.param.TaxAgentAdminChangeCheckParam; +import com.engine.salary.entity.taxagent.param.TaxAgentQueryParam; +import com.engine.salary.entity.taxagent.param.TaxAgentSaveParam; +import com.engine.salary.entity.taxagent.po.*; +import com.engine.salary.enums.SalaryJobFlagEnum; +import com.engine.salary.enums.UserStatusEnum; +import com.engine.salary.enums.salaryaccounting.SalaryAcctRecordStatusEnum; +import com.engine.salary.enums.salarysob.SalaryEmployeeStatusEnum; +import com.engine.salary.enums.taxagent.TaxAgentRoleTypeEnum; +import com.engine.salary.exception.SalaryRunTimeException; +import com.engine.salary.mapper.archive.SalaryArchiveMapper; +import com.engine.salary.mapper.datacollection.AddUpDeductionMapper; +import com.engine.salary.mapper.datacollection.AddUpSituationMapper; +import com.engine.salary.mapper.datacollection.EmployMapper; +import com.engine.salary.mapper.datacollection.OtherDeductionMapper; +import com.engine.salary.mapper.taxagent.TaxAgentMapper; +import com.engine.salary.service.*; +import com.engine.salary.util.SalaryI18nUtil; +import com.engine.salary.util.page.PageInfo; +import com.engine.salary.util.page.PageUtil; +import com.google.common.collect.Lists; +import dm.jdbc.util.IdGenerator; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.BeanUtils; +import org.springframework.transaction.annotation.Transactional; + +import java.util.*; +import java.util.stream.Collectors; + +public class TaxAgentV2ServiceImpl extends Service implements TaxAgentV2Service { + + private TaxAgentMapper taxAgentMapper; + + + private EmployMapper employMapper; + + +// +// private ExtEmployeeService extEmployeeService; + + private TaxAgentBaseService taxAgentBaseService; + + private TaxAgentAdminService taxAgentAdminService; + + private TaxAgentSubAdminService taxAgentSubAdminService; + + private TaxAgentManageRangeService taxAgentManageRangeService; + + private TaxAgentEmpService taxAgentEmpService; + + private TaxAgentSubAdminEmpService taxAgentSubAdminEmpService; + + private SalaryArchiveMapper salaryArchiveMapper; + + private AddUpDeductionMapper addUpDeductionMapper; + + private OtherDeductionMapper otherDeductionMapper; + + private AddUpSituationMapper addUpSituationMapper; + + +// private PaymentAgencyMapper paymentAgencyMapper; + +// private SIArchivesSocialMapper siArchivesSocialMapper; + +// private SIArchivesFundMapper siArchivesFundMapper; + +// private SIArchivesOtherMapper siArchivesOtherMapper; + +// private AuthorityService authorityService; + + private SalaryAcctRecordService salaryAcctRecordService; + + private SIAccountService siAccountService; + + private HrmCommonHrmStatusService hrmCommonHrmStatusService; + + @Override + public TaxAgentRoleTypeEnum getRoleType(Long currentEmployeeId) { + TaxAgentRoleTypeEnum roleType = TaxAgentRoleTypeEnum.NONE; + if (isChief(currentEmployeeId)) { + return TaxAgentRoleTypeEnum.CHIEF; + } + // 是否开启分权 + boolean isOpenDevolution = taxAgentBaseService.isOpenDevolution(); + if (!isOpenDevolution) { + List taxAgentAdmins = taxAgentAdminService.listByEmployeeId(currentEmployeeId); + if (CollectionUtils.isNotEmpty(taxAgentAdmins)) { + return TaxAgentRoleTypeEnum.ADMIN; + } + List taxAgentSubAdmins = taxAgentSubAdminService.listByAndEmployeeId(currentEmployeeId); + if (CollectionUtils.isNotEmpty(taxAgentSubAdmins)) { + return TaxAgentRoleTypeEnum.SUBADMIN; + } + } + return roleType; + } + + @Override + public Boolean isChief(Long currentEmployeeId) { + + return currentEmployeeId == 1; + + //return authorityService.checkPermissionSet(TaxAgentPermissionConstant.MENU_CODE, TaxAgentPermissionConstant.ITEM_CODE_DEVOLUTION, currentEmployeeId); + } + + @Override + public Boolean isDefaultOpen(Long currentEmployeeId) { + return authorityService.checkPermissionSet(TaxAgentPermissionConstant.MENU_CODE, TaxAgentPermissionConstant.ITEM_CODE_DEFAULT, currentEmployeeId); + } + + @Override + public Boolean isAdminEnable(Long currentEmployeeId) { + // 如果不是超管,是管理员 + if (!isChief(currentEmployeeId)) { + // 没有开启分权 + if (!isOpenDevolution()) { + return Boolean.FALSE; + } else { + // 自己有没有被分配为管理员 + List taxAgentAdminList = taxAgentAdminService.listByEmployeeId(currentEmployeeId); + return CollectionUtils.isNotEmpty(taxAgentAdminList); + } + } + return Boolean.TRUE; + } + + + @Override + public PageInfo listPage(TaxAgentQueryParam queryParam) { + PageUtil.start(queryParam.getCurrent(), queryParam.getPageSize()); + List taxAgentPOS = taxAgentMapper.listBySome(queryParam); + return new PageInfo<>(taxAgentPOS); + } + + @Override + public List list(TaxAgentQueryParam queryParam) { + return taxAgentMapper.listBySome(queryParam); + } + + + @Override + public List listByIds(Collection ids) { + return taxAgentMapper.listBySome(TaxAgentQueryParam.builder().ids(ids).build()); + } + + @Override + public List listAll() { + return taxAgentMapper.listAll(); + } + + @Override + public TaxAgentPO getById(Long id) { + return taxAgentMapper.getById(id); + } + + @Override + public Collection findAll() { + List taxAgents = taxAgentMapper.listAll(); + return TaxAgentBO.convertToListDTO(taxAgents); + } + + @Override + public Collection listAllTaxAgents(Long employeeId) { + List taxAgents = taxAgentMapper.listAll(); + return handleForDevolution(taxAgents, employeeId); + } + + @Override + public Collection listAllTaxAgentsAsAdmin(Long employeeId) { + List taxAgents = taxAgentMapper.listAll(); + // 是否开启分权 + boolean isOpenDevolution = taxAgentBaseService.isOpenDevolution(); + if (!isOpenDevolution) { + return taxAgents; + } + List taxAgentIds = taxAgents.stream().map(TaxAgentPO::getId).collect(Collectors.toList()); + List enableTaxAgentIds = Lists.newArrayList(); + // 1.判断自己是否是管理员, 如果是管理员,就是能够查看所属个税扣缴义务人 + List taxAgentAdminList = taxAgentAdminService.listByTaxAgentIds(taxAgentIds); + // 是管理员的列表 + List adminTaxAgentIds = taxAgentAdminList.stream().filter(f -> f.getEmployeeId().equals(employeeId)).map(TaxAgentAdminPO::getTaxAgentId).collect(Collectors.toList()); + + enableTaxAgentIds.addAll(adminTaxAgentIds); + return taxAgents.stream().filter(f -> enableTaxAgentIds.contains(f.getId())).collect(Collectors.toList()); + } + + @Override + public Collection listAllTaxAgentsAsRange(List employeeIds) { + List taxAgents = taxAgentMapper.listAll(); + List taxAgentIds = taxAgents.stream().map(TaxAgentPO::getId).collect(Collectors.toList()); + + List taxAgentEmployees = taxAgentEmpService.listByTaxAgentIds(taxAgentIds); + + if (CollectionUtils.isEmpty(taxAgentEmployees)) { + return Lists.newArrayList(); + } + + // 转换数据结构 + List allemployeeIds = taxAgentEmployees.stream().map(TaxAgentEmpPO::getEmployeeId).distinct().collect(Collectors.toList()); + + return allemployeeIds.stream().map(m -> { + List enableTaxAgentIds = taxAgentEmployees.stream().filter(f -> f.getEmployeeId().equals(m)).map(TaxAgentEmpPO::getTaxAgentId).distinct() + .collect(Collectors.toList()); + return TaxAgentEmployeeTaxAgentDTO.builder() + .employeeId(m) + .taxAgentIds(enableTaxAgentIds) + .build(); + }).collect(Collectors.toList()); + } + + @Override + public String save(TaxAgentSaveParam saveParam, Long employeeId) { + // 是否开启分权 + boolean isOpenDevolution = taxAgentBaseService.isOpenDevolution(); + if (isOpenDevolution && saveParam.getAdminUserId() == null) { + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(106271, "请选择管理员")); + } + List taxAgents = taxAgentMapper.listByName(saveParam.getName()); + if (CollectionUtils.isNotEmpty(taxAgents)) { + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98080, "名称不允许重复")); + } +// PaymentAgencyPO paymentAgencyPO = new LambdaQueryChainWrapper<>(paymentAgencyMapper) +// .eq(PaymentAgencyPO::getTenantKey) +// .eq(PaymentAgencyPO::getDeleteType, DeleteTypeEnum.NOT_DELETED.getValue()) +// .eq(PaymentAgencyPO::getAgencyName, saveParam.getName()) +// .one(); +// if (paymentAgencyPO != null) { +// throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(115130, "名称不允许与社保福利代缴机构名称重复")); +// } + // 保存 + saveParam.setId(IdGenerator.generate()); + TaxAgentPO taxAgent = TaxAgentBO.convertToPO(saveParam, employeeId); + taxAgentMapper.insert(taxAgent); + if (isOpenDevolution) { + taxAgentAdminService.batchInsert(saveParam.getId(), Collections.singletonList(saveParam.getAdminUserId())); + } + // 记录日志 +// SalaryLoggerUtil.recordAddSingleLog(taxAgentLoggerTemplate, +// taxAgent.getId(), +// taxAgent.getName(), +// SalaryI18nUtil.getI18nLabel( 93766, "新增个税扣缴义务人"), +// SalaryI18nUtil.getI18nLabel( 93766, "新增个税扣缴义务人"), +// taxAgent); + + return StringUtils.EMPTY + taxAgent.getId(); + } + +// @Override +// public String paymentAgencyUpdate(TaxAgentPO taxAgentPO, Long employeeId) { +// taxAgentMapper.updateById(taxAgentPO); +// return ""; +// } + + @Override + @Transactional(rollbackFor = Exception.class) + public String update(TaxAgentSaveParam saveParam, Long employeeId) { + TaxAgentPO taxAgent = getById(saveParam.getId()); + if (taxAgent == null) { + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(100545, "个税扣缴义务人不存在")); + } + // 是否开启分权 + boolean isOpenDevolution = taxAgentBaseService.isOpenDevolution(); + if (isOpenDevolution && saveParam.getAdminUserId() == null) { + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(106271, "请选择管理员")); + } + + List individualTaxWithholdingAgents = taxAgentMapper.listByName(saveParam.getName()); + boolean nameExist = individualTaxWithholdingAgents.stream().anyMatch(e -> !Objects.equals(e.getId(), saveParam.getId())); + if (nameExist) { + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98080, "名称不允许重复")); + } + TaxAgentPO taxAgentNew = new TaxAgentPO(); + BeanUtils.copyProperties(taxAgent, taxAgentNew); + BeanUtils.copyProperties(saveParam, taxAgentNew); + taxAgentNew.setUpdateTime(new Date()); + taxAgentMapper.update(taxAgentNew); + if (isOpenDevolution) { + Boolean isUnEnableChange = adminChangeCheck(TaxAgentAdminChangeCheckParam.builder() + .taxAgentId(saveParam.getId()) + .adminUserId(saveParam.getAdminUserId()) + .build(), employeeId); + if (isUnEnableChange) { + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(115937, "该管理员有未归档核算数据,不可更换管理员")); + } + // 删除管理员 + taxAgentAdminService.deleteByTaxAgentIds(Collections.singletonList(taxAgent.getId())); + // 新增管理员 + taxAgentAdminService.batchInsert(saveParam.getId(), Collections.singletonList(saveParam.getAdminUserId())); + } + // 记录日志 +// SalaryLoggerUtil.recordUpdateSingleLog(taxAgentLoggerTemplate, +// taxAgent.getId(), +// taxAgentNew.getName(), +// SalaryI18nUtil.getI18nLabel(93767, "编辑个税扣缴义务人"), +// SalaryI18nUtil.getI18nLabel(93767, "编辑个税扣缴义务人"), +// taxAgent, +// taxAgentNew); + + return StringUtils.EMPTY; + } + + @Override + public Boolean adminChangeCheck(TaxAgentAdminChangeCheckParam checkParam, Long currentEmployeeId) { + List taxAgentAdminList = taxAgentAdminService.listByTaxAgentIds(Collections.singletonList(checkParam.getTaxAgentId())); + Long adminUserId = CollectionUtils.isNotEmpty(taxAgentAdminList) ? taxAgentAdminList.get(0).getEmployeeId() : 0L; + boolean isChanged = checkParam.getAdminUserId() != null && !adminUserId.equals(checkParam.getAdminUserId()); + // 更换了管理员 + if (isChanged) { + // 检查是否核算 + //todo 1.社保福利档案是否有核算未归档 + Boolean checkedValue = false;// siAccountService.changeAdminUnfiledCheck(adminUserId); + // 2.薪资核算是否有核算未归档 + List salaryAcctRecords = salaryAcctRecordService.listByStatusAndEmployeeId(SalaryAcctRecordStatusEnum.NOT_ARCHIVED, adminUserId); + if (CollectionUtils.isNotEmpty(salaryAcctRecords) || checkedValue) { + return Boolean.TRUE; + } + } + return Boolean.FALSE; + } + + @Override + @Transactional(rollbackFor = Exception.class) + public String delete(Collection ids, Long employeeId) { + + List taxAgents = taxAgentMapper.listBySome(TaxAgentQueryParam.builder().ids(ids).build()); + if (CollectionUtils.isEmpty(taxAgents)) { + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(85382, "要删除的个税扣缴义务人在不存在或已删除")); + } + // 正在使用的记录不允许删除 + boolean checkUsed = checkUsed(ids); + if (checkUsed) { + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(100570, "正在使用的记录不允许删除")); + } + // 删除管理员 + taxAgentAdminService.deleteByTaxAgentIds(ids); + // 删除分管理员和对应管理范围 + taxAgentSubAdminService.deleteByTaxAgentIds(ids); + // 删除人员范围 + taxAgentManageRangeService.deleteByTaxAgentIds(ids); + + taxAgentMapper.deleteByIds(ids); + + // 记录日志 +// taxAgents.forEach(e -> SalaryLoggerUtil.recordDeleteSingleLog(taxAgentLoggerTemplate, +// e.getId(), +// e.getName(), +// SalaryI18nUtil.getI18nLabel(100546, "删除个税扣缴义务人"), +// SalaryI18nUtil.getI18nLabel(100546, "删除个税扣缴义务人") + ":" + e.getName(), +// e)); + + return StringUtils.EMPTY; + } + + /** + * 检查正在被使用的记录 + * + * @param ids + * @return + */ + private boolean checkUsed(Collection ids) { + // 被薪资档案引用 + List salaryArchiveList = new LambdaQueryChainWrapper<>(salaryArchiveMapper) + .eq(SalaryArchivePO::getDeleteType, 0) + .eq(SalaryArchivePO::getTenantKey) + .in(SalaryArchivePO::getTaxAgentId, ids) + .list(); + salaryArchiveMapper.listSome(SalaryArchivePO.builder().t) + if (CollectionUtils.isNotEmpty(salaryArchiveList)) { + return Boolean.TRUE; + } + // todo 被社保福利档案引用 +// List socialSchemePOList = new LambdaQueryChainWrapper<>(siArchivesSocialMapper) +// .eq(InsuranceArchivesSocialSchemePO::getTenantKey) +// .eq(InsuranceArchivesSocialSchemePO::getDeleteType, DeleteTypeEnum.NOT_DELETED.getValue()) +// .in(InsuranceArchivesSocialSchemePO::getPaymentOrganization, ids) +// .list(); +// if (CollectionUtils.isNotEmpty(socialSchemePOList)) { +// return Boolean.TRUE; +// } +// List fundSchemePOList = new LambdaQueryChainWrapper<>(siArchivesFundMapper) +// .eq(InsuranceArchivesFundSchemePO::getTenantKey) +// .eq(InsuranceArchivesFundSchemePO::getDeleteType, DeleteTypeEnum.NOT_DELETED.getValue()) +// .in(InsuranceArchivesFundSchemePO::getPaymentOrganization, ids) +// .list(); +// if (CollectionUtils.isNotEmpty(fundSchemePOList)) { +// return Boolean.TRUE; +// } +// List otherSchemePOList = new LambdaQueryChainWrapper<>(siArchivesOtherMapper) +// .eq(InsuranceArchivesOtherSchemePO::getTenantKey) +// .eq(InsuranceArchivesOtherSchemePO::getDeleteType, DeleteTypeEnum.NOT_DELETED.getValue()) +// .in(InsuranceArchivesOtherSchemePO::getPaymentOrganization, ids) +// .list(); +// if (CollectionUtils.isNotEmpty(otherSchemePOList)) { +// return Boolean.TRUE; +// } + + // 被外部人员引用 +// List extEmployeeList = extEmployeeService.listAll(tenantKey); +// List extTaxAgentIds = extEmployeeList.stream().map(ExtEmployeePO::getTaxAgentId).distinct().collect(Collectors.toList()); +// if (CollectionUtils.isNotEmpty(extTaxAgentIds)) { +// return ids.stream().anyMatch(e -> extTaxAgentIds.stream().anyMatch(f -> f.equals(e))); +// } + + // 被累计专项附加扣除引用 + List addUpDeductionList = addUpDeductionMapper.listSome(AddUpDeduction.builder().taxAgentIds(ids).build()); + if (CollectionUtils.isNotEmpty(addUpDeductionList)) { + return Boolean.TRUE; + } + // 被其他免税扣除引用 + List otherDeductionList = otherDeductionMapper.listSome(OtherDeductionPO.builder().taxAgentIds(ids).build()); + if (CollectionUtils.isNotEmpty(otherDeductionList)) { + return Boolean.TRUE; + } + // 被往期累计情况引用 + List addUpSituationList = addUpSituationMapper.listSome(AddUpSituation.builder().taxAgentIds(ids).build()); + if (CollectionUtils.isNotEmpty(addUpSituationList)) { + return Boolean.TRUE; + } + + return Boolean.FALSE; + } + + @Override + public List> selectList(Long currentEmployeeId) { + List taxAgents = taxAgentMapper.listAll(); + taxAgents = handleForDevolution(taxAgents, currentEmployeeId); + return taxAgents.stream().map(m -> { + Map map = new HashMap<>(2); + map.put("id", String.valueOf(m.getId())); + map.put("content", m.getName()); + return map; + }).collect(Collectors.toList()); + } + + /** + * 分权处理 + * + * @param taxAgents + * @param currentEmployeeId + * @return + */ + private List handleForDevolution(List taxAgents, Long currentEmployeeId) { + // 是否开启分权 + boolean isOpenDevolution = taxAgentBaseService.isOpenDevolution(); + if (!isOpenDevolution || isChief(currentEmployeeId)) { + return taxAgents; + } + List taxAgentIds = taxAgents.stream().map(TaxAgentPO::getId).collect(Collectors.toList()); + List enableTaxAgentIds = Lists.newArrayList(); + // 1.判断自己是否是管理员, 如果是管理员,就是能够查看所属个税扣缴义务人 + List taxAgentAdminList = taxAgentAdminService.listByTaxAgentIdsAndEmployeeId(taxAgentIds, currentEmployeeId); + // 是管理员的列表 + List adminTaxAgentIds = taxAgentAdminList.stream().map(TaxAgentAdminPO::getTaxAgentId).collect(Collectors.toList()); + + enableTaxAgentIds.addAll(adminTaxAgentIds); + // 2.根据作为非管理员查找自己作为分管理员的个税扣缴义务人id + List noAdminTaxAgentIds = taxAgents.stream() + .map(TaxAgentPO::getId) + .filter(id -> !adminTaxAgentIds.contains(id)).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(noAdminTaxAgentIds)) { + List taxAgentSubAdmins = taxAgentSubAdminService.listByTaxAgentIdsAndEmployeeId(noAdminTaxAgentIds, currentEmployeeId); + List sunAdminTaxAgentIds = taxAgentSubAdmins.stream().map(TaxAgentSubAdminPO::getTaxAgentId).collect(Collectors.toList()); + enableTaxAgentIds.addAll(sunAdminTaxAgentIds); + } + return taxAgents.stream().filter(f -> enableTaxAgentIds.contains(f.getId())).collect(Collectors.toList()); + } + + @Override + public Boolean isOpenDevolution() { + return taxAgentBaseService.isOpenDevolution(); + } + + @Override + public List listTaxAgentAndEmployeeTree(Long employeeId) { + return listTaxAgentAndEmployeeTree(null, employeeId); + } + + @Override + public List listTaxAgentAndEmployee(Long employeeId) { + return listTaxAgentAndEmployee(null, employeeId); + } + + @Override + public List listTaxAgentAndEmployeeTree(SalaryEmployeeStatusEnum employeeStatus, Long employeeId) { + List taxAgentManageRangeEmployeeList = Lists.newArrayList(); + // 所有个税扣缴义务人 + List allTaxAgents = listAll(); + if (CollectionUtils.isEmpty(allTaxAgents)) { + return taxAgentManageRangeEmployeeList; + } + + List taxAgentIds = allTaxAgents.stream().map(TaxAgentPO::getId).collect(Collectors.toList()); + List allEmployees = taxAgentMapper.listEmployee(); + if (employeeStatus != null) { + List personnelStatusList; + // 查询人员状态 + if (employeeStatus.equals(SalaryEmployeeStatusEnum.NORMAL)) { + allEmployees = allEmployees.stream().filter(f -> UserStatusEnum.getNormalStatus().contains(f.getStatus())).collect(Collectors.toList()); + } else if (employeeStatus.equals(SalaryEmployeeStatusEnum.UNAVAILABLE)) { + allEmployees = allEmployees.stream().filter(f -> UserStatusEnum.getUnavailableStatus().contains(f.getStatus())).collect(Collectors.toList()); + } + } + + // 是否开启分权 + if (!isOpenDevolution() || isChief(employeeId)) { + return getTaxAgentEmp(allTaxAgents, taxAgentIds, allEmployees); + } + + // 1.判断自己是否是管理员, 如果是管理员,就是能够操作所属个税扣缴义务人下的所有人的数据 + List taxAgentAdminList = taxAgentAdminService.listByTaxAgentIdsAndEmployeeId(taxAgentIds, employeeId); + // 是管理员的列表 + List adminTaxAgentIds = taxAgentAdminList.stream().map(TaxAgentAdminPO::getTaxAgentId).collect(Collectors.toList()); + + if (CollectionUtils.isNotEmpty(adminTaxAgentIds)) { + taxAgentManageRangeEmployeeList.addAll(getTaxAgentEmp(allTaxAgents, adminTaxAgentIds, allEmployees)); + } + // 2.根据作为非管理员查找自己作为分管理员, 对应的管理范围人员 + List noAdminTaxAgentIds = allTaxAgents.stream() + .map(TaxAgentPO::getId) + .filter(id -> !adminTaxAgentIds.contains(id)).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(noAdminTaxAgentIds)) { + taxAgentManageRangeEmployeeList.addAll(getTaxAgentSubAdminEmp(allTaxAgents, noAdminTaxAgentIds, allEmployees)); + } + + return taxAgentManageRangeEmployeeList; + } + + /** + * 获取分管理员的关联人员 + * + * @param allTaxAgents + * @param noAdminTaxAgentIds + * @param allEmployees + * @return + */ + private List getTaxAgentSubAdminEmp(List allTaxAgents, List noAdminTaxAgentIds, List allEmployees) { + List taxAgentManageRangeEmployeeList = Lists.newArrayList(); + List taxAgentEmps = taxAgentSubAdminEmpService.listByTaxAgentIds(noAdminTaxAgentIds); + + taxAgentEmps = taxAgentEmps.stream().filter(f -> allEmployees.stream().anyMatch(e -> e.getEmployeeId().equals(f.getEmployeeId()))).collect(Collectors.toList()); + + List finalTaxAgentEmps = taxAgentEmps; + noAdminTaxAgentIds.forEach(e -> { + Optional optionalTaxAgent = allTaxAgents.stream().filter(t -> t.getId().equals(e)).findFirst(); + String taxAgentName = (optionalTaxAgent.isPresent() ? optionalTaxAgent.get().getName() : ""); + List taxAgentEmployees = finalTaxAgentEmps.stream().filter(f -> f.getTaxAgentId().equals(e)).map(m -> { + TaxAgentManageRangeEmployeeDTO.TaxAgentEmployee taxAgentEmployee = new TaxAgentManageRangeEmployeeDTO.TaxAgentEmployee(); + taxAgentEmployee.setEmployeeId(m.getEmployeeId()); + taxAgentEmployee.setUsername(m.getEmployeeName()); + return taxAgentEmployee; + }).collect(Collectors.toList()); + taxAgentManageRangeEmployeeList.add( + TaxAgentManageRangeEmployeeDTO.builder() + .taxAgentId(e) + .taxAgentName(taxAgentName) + .employeeList(taxAgentEmployees) + .build() + ); + }); + return taxAgentManageRangeEmployeeList; + } + + /** + * 获取个税口角义务人的关联人员 + * + * @param allTaxAgents + * @param taxAgentIds + * @return + */ + private List getTaxAgentEmp(List allTaxAgents, List taxAgentIds, List allEmployees) { + List taxAgentManageRangeEmployeeList = Lists.newArrayList(); + List taxAgentEmps = taxAgentEmpService.listByTaxAgentIds(taxAgentIds); + + taxAgentEmps = taxAgentEmps.stream().filter(f -> allEmployees.stream().anyMatch(e -> e.getEmployeeId().equals(f.getEmployeeId()))).collect(Collectors.toList()); + + List finalTaxAgentEmps = taxAgentEmps; + taxAgentIds.forEach(e -> { + Optional optionalTaxAgent = allTaxAgents.stream().filter(t -> t.getId().equals(e)).findFirst(); + String taxAgentName = (optionalTaxAgent.isPresent() ? optionalTaxAgent.get().getName() : ""); + List taxAgentEmployees = finalTaxAgentEmps.stream().filter(f -> f.getTaxAgentId().equals(e)).map(m -> { + TaxAgentManageRangeEmployeeDTO.TaxAgentEmployee taxAgentEmployee = new TaxAgentManageRangeEmployeeDTO.TaxAgentEmployee(); + taxAgentEmployee.setEmployeeId(m.getEmployeeId()); + taxAgentEmployee.setUsername(m.getEmployeeName()); + return taxAgentEmployee; + }).collect(Collectors.toList()); + taxAgentManageRangeEmployeeList.add( + TaxAgentManageRangeEmployeeDTO.builder() + .taxAgentId(e) + .taxAgentName(taxAgentName) + .employeeList(taxAgentEmployees) + .build() + ); + }); + return taxAgentManageRangeEmployeeList; + } + + @Override + public List listTaxAgentAndEmployee(SalaryEmployeeStatusEnum employeeStatus, Long employeeId) { + List taxAgentEmployeeList = Lists.newArrayList(); + + List taxAgentManageRangeEmployeeList = listTaxAgentAndEmployeeTree(employeeStatus, employeeId); + taxAgentManageRangeEmployeeList.forEach(m -> { + List employeeList = m.getEmployeeList(); + if (CollectionUtils.isEmpty(employeeList)) { + taxAgentEmployeeList.add(TaxAgentEmployeeDTO.builder() + .taxAgentId(m.getTaxAgentId()) + .taxAgentName(m.getTaxAgentName()) + .employeeId(null) + .username(null) + .build()); + } else { + employeeList.forEach(f -> taxAgentEmployeeList.add(TaxAgentEmployeeDTO.builder() + .taxAgentId(m.getTaxAgentId()) + .taxAgentName(m.getTaxAgentName()) + .employeeId(f.getEmployeeId()) + .username(f.getUsername()) + .build())); + } + }); + + return taxAgentEmployeeList; + } + + +} diff --git a/src/com/engine/salary/wrapper/TaxAgentWrapper.java b/src/com/engine/salary/wrapper/TaxAgentWrapper.java index f8464a8bf..ebd2fe737 100644 --- a/src/com/engine/salary/wrapper/TaxAgentWrapper.java +++ b/src/com/engine/salary/wrapper/TaxAgentWrapper.java @@ -1,6 +1,14 @@ package com.engine.salary.wrapper; import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; +import com.engine.salary.entity.taxagent.param.TaxAgentQueryParam; +import com.engine.salary.entity.taxagent.po.TaxAgentAdminPO; +import com.engine.salary.entity.taxagent.po.TaxAgentPO; +import com.engine.salary.service.TaxAgentAdminService; +import com.engine.salary.service.TaxAgentBaseService; +import com.engine.salary.service.TaxAgentManageRangeService; +import com.engine.salary.service.TaxAgentV2Service; +import com.engine.salary.util.page.PageInfo; import com.google.common.collect.Maps; import com.weaver.common.authority.format.FormatManager; import com.weaver.common.component.browser.combination.TypesBrowserOption; @@ -9,12 +17,8 @@ import com.weaver.common.component.form.item.WeaFormItem; import com.weaver.common.component.form.item.WeaFormOption; import com.weaver.common.component.table.WeaTable; import com.weaver.common.component.table.page.Page; -import com.weaver.common.hrm.cache.HrmConfigSetCache; import com.weaver.common.hrm.domain.employee.HrmStatus; -import com.weaver.common.hrm.service.HrmCommonEmployeeService; -import com.weaver.common.hrm.service.employee.HrmCommonHrmStatusService; import com.weaver.framework.util.JsonUtil; -import com.weaver.hrm.salary.dao.SIEmployeeStatusMapper; import com.weaver.hrm.salary.entity.agency.po.PaymentAgencyPO; import com.weaver.hrm.salary.entity.siarchives.po.InsuranceEmployeeStatusPO; import com.weaver.hrm.salary.entity.taxagent.bo.TaxAgentBO; @@ -23,8 +27,6 @@ import com.weaver.hrm.salary.entity.taxagent.dto.TaxAgentFormDTO; import com.weaver.hrm.salary.entity.taxagent.dto.TaxAgentManageRangeFormDTO; import com.weaver.hrm.salary.entity.taxagent.dto.TaxAgentManageRangeListDTO; import com.weaver.hrm.salary.entity.taxagent.param.*; -import com.weaver.hrm.salary.entity.taxagent.po.TaxAgentAdminPO; -import com.weaver.hrm.salary.entity.taxagent.po.TaxAgentPO; import com.weaver.hrm.salary.exception.SalaryRunTimeException; import com.weaver.hrm.salary.service.*; import com.weaver.hrm.salary.util.SalaryAssert; @@ -37,63 +39,60 @@ import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.math.NumberUtils; import org.springframework.beans.BeanUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; -import javax.annotation.Resource; import java.util.*; import java.util.stream.Collectors; /** - * @Description: 个税扣缴义务人 - * @Author: wangxiangzhong - * @Date: 2022/3/11 14:09 - */ -@Component + * 个税扣缴义务人 + *

Copyright: Copyright (c) 2022

+ *

Company: 泛微软件

+ * + * @author qiantao + * @version 1.0 + **/ public class TaxAgentWrapper { - @Autowired + private TaxAgentBaseService taxAgentBaseService; - @Autowired + private TaxAgentAdminService taxAgentAdminService; - @Autowired - private TaxAgentService taxAgentService; -// -// private HrmCommonEmployeeService employeeService; -// @Autowired -// private TaxAgentManageRangeService taxAgentManageRangeService; -// @Autowired -// private PaymentAgencyService paymentAgencyService; -// @Autowired -// private SIEmployeeStatusMapper siEmployeeStatusMapper; -// @Autowired -// private HrmCommonHrmStatusService hrmCommonHrmStatusService; -// @Autowired -// private HrmConfigSetCache hrmConfigSetCache; + + private TaxAgentV2Service taxAgentService; + + private HrmCommonEmployeeService employeeService; + + private TaxAgentManageRangeService taxAgentManageRangeService; + + private PaymentAgencyService paymentAgencyService; + + private SIEmployeeStatusMapper siEmployeeStatusMapper; + + private HrmCommonHrmStatusService hrmCommonHrmStatusService; + + private HrmConfigSetCache hrmConfigSetCache; /** * 是否是薪酬模块总管理员 * * @param currentEmployeeId - * @param currentTenantKey * @return */ - public Boolean isChief(Long currentEmployeeId, String currentTenantKey) { - return taxAgentService.isChief(currentEmployeeId, currentTenantKey); + public Boolean isChief(Long currentEmployeeId) { + return taxAgentService.isChief(currentEmployeeId); } /** * 权限信息 * * @param currentEmployeeId - * @param currentTenantKey * @return */ - public Map permission(Long currentEmployeeId, String currentTenantKey) { + public Map permission(Long currentEmployeeId) { Map resultMap = Maps.newHashMap(); - Boolean isChief = isChief(currentEmployeeId, currentTenantKey); - Boolean isDefaultOpen = taxAgentService.isDefaultOpen(currentEmployeeId, currentTenantKey); - Boolean isAdminEnable = taxAgentService.isAdminEnable(currentEmployeeId, currentTenantKey); + Boolean isChief = isChief(currentEmployeeId); + Boolean isDefaultOpen = taxAgentService.isDefaultOpen(currentEmployeeId); + Boolean isAdminEnable = taxAgentService.isAdminEnable(currentEmployeeId); resultMap.put("isChief", isChief); resultMap.put("isDefaultOpen", isDefaultOpen); resultMap.put("isAdminEnable", isAdminEnable); @@ -105,27 +104,26 @@ public class TaxAgentWrapper { * * @param queryParam * @param currentEmployeeId - * @param currentTenantKey * @return */ - public WeaTable list(TaxAgentQueryParam queryParam, Long currentEmployeeId, String currentTenantKey) { + public WeaTable list(TaxAgentQueryParam queryParam, Long currentEmployeeId) { // 是否是总管理员 - Boolean isChief = taxAgentService.isChief(currentEmployeeId, currentTenantKey); + Boolean isChief = taxAgentService.isChief(currentEmployeeId); // 是否开启分权 - boolean isOpenDevolution = taxAgentBaseService.isOpenDevolution(currentTenantKey); + boolean isOpenDevolution = taxAgentBaseService.isOpenDevolution(); - List paymentAgencyPOS = paymentAgencyService.listAll(currentTenantKey); +// List paymentAgencyPOS = paymentAgencyService.listAll(currentTenantKey); - Page page = new Page<>(queryParam.getCurrent(), queryParam.getPageSize(), true); + PageInfo page = null; if (isChief) { - page = taxAgentService.listPage(page, queryParam, currentTenantKey); + page = taxAgentService.listPage(queryParam); } else { // 分权情况下,根据自己作为管理员过滤列表 if (isOpenDevolution) { - List list = taxAgentService.list(queryParam, currentTenantKey); + List list = taxAgentService.list(queryParam); // 1.判断自己是否是管理员, 如果是管理员,就是能够操作所属个税扣缴义务人下的所有人的数据 List taxAgentAdminList = taxAgentAdminService.listByTaxAgentIdsAndEmployeeId(list.stream().map(TaxAgentPO::getId).collect(Collectors.toList()), - currentEmployeeId, currentTenantKey); + currentEmployeeId); // 是管理员的列表 List adminTaxAgentIds = taxAgentAdminList.stream().map(TaxAgentAdminPO::getTaxAgentId).collect(Collectors.toList()); // 分页参数 @@ -143,16 +141,16 @@ public class TaxAgentWrapper { String setLabel = SalaryI18nUtil.getI18nLabel(currentTenantKey, currentEmployeeId, 94614, "设置"); if (isOpenDevolution) { List taxAgentIds = page.getRecords().stream().map(TaxAgentPO::getId).collect(Collectors.toList()); - List taxAgentAdmins = taxAgentAdminService.listByTaxAgentIds(taxAgentIds, currentTenantKey); + List taxAgentAdmins = taxAgentAdminService.listByTaxAgentIds(taxAgentIds); List adminList = employeeService.getEmployeeByIds(taxAgentAdmins.stream().map(TaxAgentAdminPO::getEmployeeId).distinct().collect(Collectors.toList()), - currentTenantKey); + currentTenantKey); listPage.setRecords(TaxAgentBO.convertToTableListDTO(page.getRecords(), paymentAgencyPOS, taxAgentAdmins, adminList, setLabel)); } else { listPage.setRecords(TaxAgentBO.convertToTableListDTO(page.getRecords(), paymentAgencyPOS, setLabel)); } WeaTable weaTable = FormatManager.getInstance().genTable(LinkedHashMap.class, listPage); //构造表格 - TaxAgentBO.buildTaxAgentTable(weaTable, isOpenDevolution, currentEmployeeId, currentTenantKey, listPage.getRecords().size()); + TaxAgentBO.buildTaxAgentTable(weaTable, isOpenDevolution, currentEmployeeId, listPage.getRecords().size()); if (isChief) { // 在外展示操作按钮 weaTable.getOperates().get(0).setOuter(Boolean.TRUE); @@ -166,16 +164,16 @@ public class TaxAgentWrapper { return weaTable; } - public List> paymentAgencyList(TaxAgentQueryParam queryParam, Long currentEmployeeId, String currentTenantKey) { - List taxAgentPOS = taxAgentService.listByIds(queryParam.getIds(), currentTenantKey); + public List> paymentAgencyList(TaxAgentQueryParam queryParam, Long currentEmployeeId) { + List taxAgentPOS = taxAgentService.listByIds(queryParam.getIds()); List paymentAgencyPOS = paymentAgencyService.listAll(currentTenantKey); SalaryAssert.notEmpty(taxAgentPOS, "taxagent data is not exist"); TaxAgentPO taxAgentPO = taxAgentPOS.get(0); return TaxAgentBO.buildPaymentAgency(taxAgentPO.getPaymentAgency(), paymentAgencyPOS); } - public String paymentAgencySave(TaxAgentSaveParam param, Long currentEmploueeId, String currentTenantKey) { - List taxAgentPOS = taxAgentService.listByIds(Collections.singletonList(param.getId()), currentTenantKey); + public String paymentAgencySave(TaxAgentSaveParam param, Long currentEmploueeId) { + List taxAgentPOS = taxAgentService.listByIds(Collections.singletonList(param.getId())); SalaryAssert.notEmpty(taxAgentPOS, "data is not exist"); TaxAgentPO taxAgentPO = taxAgentPOS.get(0); List errorList = new ArrayList<>(); @@ -187,10 +185,10 @@ public class TaxAgentWrapper { if (CollectionUtils.isNotEmpty(originList)) { originList.stream().forEach(e -> { List employeeStatusPOS = new LambdaQueryChainWrapper<>(siEmployeeStatusMapper) - .eq(InsuranceEmployeeStatusPO::getTenantKey, currentTenantKey) - .eq(InsuranceEmployeeStatusPO::getPaymentAgency, Long.valueOf(e)) - .eq(InsuranceEmployeeStatusPO::getPaymentOrganization, param.getId()) - .list(); + .eq(InsuranceEmployeeStatusPO::getTenantKey) + .eq(InsuranceEmployeeStatusPO::getPaymentAgency, Long.valueOf(e)) + .eq(InsuranceEmployeeStatusPO::getPaymentOrganization, param.getId()) + .list(); if (CollectionUtils.isNotEmpty(employeeStatusPOS)) { errorList.add(e); } @@ -206,10 +204,10 @@ public class TaxAgentWrapper { } if (CollectionUtils.isNotEmpty(resultList)) { return SalaryI18nUtil.getI18nLabel(currentTenantKey, currentEmploueeId, 115128, "有员工在") + String.join(",", resultList) + SalaryI18nUtil.getI18nLabel(currentTenantKey, - currentEmploueeId, 115129, "缴纳社保福利,不可取消关联"); + currentEmploueeId, 115129, "缴纳社保福利,不可取消关联"); } else { taxAgentPO.setPaymentAgency(param.getPaymentAgency()); - taxAgentService.paymentAgencyUpdate(taxAgentPO, currentEmploueeId, currentTenantKey); + taxAgentService.paymentAgencyUpdate(taxAgentPO, currentEmploueeId); } return ""; } @@ -222,10 +220,10 @@ public class TaxAgentWrapper { * @param currentTenantKey * @return */ - public WeaForm getFrom(Long id, Long currentEmployeeId, String currentTenantKey) { + public WeaForm getFrom(Long id, Long currentEmployeeId) { TaxAgentFormDTO taxAgentFromDTO = new TaxAgentFormDTO(); if (id != null) { - TaxAgentPO taxAgent = taxAgentService.getById(id, currentTenantKey); + TaxAgentPO taxAgent = taxAgentService.getById(id); if (taxAgent == null) { throw new SalaryRunTimeException(String.format(SalaryI18nUtil.getI18nLabel(currentTenantKey, currentEmployeeId, 100543, "个税扣缴人不存在") + "[id:%s]", id)); } @@ -235,12 +233,12 @@ public class TaxAgentWrapper { // 是否开启分权 boolean isOpenDevolution = taxAgentBaseService.isOpenDevolution(currentTenantKey); if (isOpenDevolution) { - List admins = taxAgentAdminService.listByTaxAgentIds(Collections.singletonList(id), currentTenantKey); + List admins = taxAgentAdminService.listByTaxAgentIds(Collections.singletonList(id)); // 目前是一个 TaxAgentEmployeeOptionDTO taxAgentEmployee = new TaxAgentEmployeeOptionDTO(); taxAgentEmployee.setId(CollectionUtils.isEmpty(admins) ? null : admins.get(0).getEmployeeId()); if (taxAgentEmployee.getId() != null) { - SimpleEmployee employee = employeeService.getEmployeeById(taxAgentEmployee.getId(), currentTenantKey); + SimpleEmployee employee = employeeService.getEmployeeById(taxAgentEmployee.getId()); taxAgentEmployee.setContent(employee == null ? "" : employee.getUsername()); } taxAgentFromDTO.setAdminUser(Collections.singletonList(taxAgentEmployee)); @@ -276,8 +274,8 @@ public class TaxAgentWrapper { * @param currentTenantKey * @return */ - public String save(TaxAgentSaveParam saveParam, Long currentEmployeeId, String currentTenantKey) { - return taxAgentService.save(saveParam, currentEmployeeId, currentTenantKey); + public String save(TaxAgentSaveParam saveParam, Long currentEmployeeId) { + return taxAgentService.save(saveParam, currentEmployeeId); } /** @@ -288,8 +286,8 @@ public class TaxAgentWrapper { * @param currentTenantKey * @return */ - public String update(TaxAgentSaveParam saveParam, Long currentEmployeeId, String currentTenantKey) { - return taxAgentService.update(saveParam, currentEmployeeId, currentTenantKey); + public String update(TaxAgentSaveParam saveParam, Long currentEmployeeId) { + return taxAgentService.update(saveParam, currentEmployeeId); } /** @@ -300,8 +298,8 @@ public class TaxAgentWrapper { * @param currentTenantKey * @return */ - public Boolean adminChangeCheck(TaxAgentAdminChangeCheckParam checkParam, Long currentEmployeeId, String currentTenantKey) { - return taxAgentService.adminChangeCheck(checkParam, currentEmployeeId, currentTenantKey); + public Boolean adminChangeCheck(TaxAgentAdminChangeCheckParam checkParam, Long currentEmployeeId) { + return taxAgentService.adminChangeCheck(checkParam, currentEmployeeId); } /** @@ -312,8 +310,8 @@ public class TaxAgentWrapper { * @param currentTenantKey * @return */ - public String delete(Collection ids, Long currentEmployeeId, String currentTenantKey) { - return taxAgentService.delete(ids, currentEmployeeId, currentTenantKey); + public String delete(Collection ids, Long currentEmployeeId) { + return taxAgentService.delete(ids, currentEmployeeId); } /** @@ -323,8 +321,8 @@ public class TaxAgentWrapper { * @param currentTenantKey * @return */ - public List> selectList(Long currentEmployeeId, String currentTenantKey) { - return taxAgentService.selectList(currentEmployeeId, currentTenantKey); + public List> selectList(Long currentEmployeeId) { + return taxAgentService.selectList(currentEmployeeId); } /** @@ -377,7 +375,7 @@ public class TaxAgentWrapper { List browserOptions = new ArrayList<>(); browserOptions.add(new TypesBrowserOption("user", SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 1869, "人员"))); browserOptions.add(new TypesBrowserOption("dept", SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 1250, "部门"))); - if(hrmConfigSetCache.isSubcompanySupport(tenantKey)) { + if (hrmConfigSetCache.isSubcompanySupport(tenantKey)) { browserOptions.add(new TypesBrowserOption("subcompany", SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 107369, "分部"))); } browserOptions.add(new TypesBrowserOption("position", SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 1245, "岗位"))); From 2c03d4bc27b80eeaecfe662ca979ff67d1466e54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=92=B1=E6=B6=9B?= <15850646081@163.com> Date: Thu, 19 May 2022 16:36:18 +0800 Subject: [PATCH 03/20] =?UTF-8?q?=E6=9A=82=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../entity/agency/bo/PaymentAgencyBO.java | 65 +++++ .../agency/dto/PaymentAgencyFormDTO.java | 65 +++++ .../agency/dto/PaymentAgencyListDTO.java | 61 +++++ .../entity/agency/po/PaymentAgencyPO.java | 73 ++++++ .../salary/entity/taxagent/bo/TaxAgentBO.java | 242 +++++++++-------- .../taxagent/po/TaxAgentManageRangePO.java | 1 + .../taxagent/TaxAgentManageRangeMapper.java | 2 + .../taxagent/TaxAgentManageRangeMapper.xml | 11 + .../service/TaxAgentManageRangeService.java | 13 +- .../salary/service/TaxAgentV2Service.java | 3 +- .../impl/TaxAgentManageRangeServiceImpl.java | 244 +++++++----------- .../service/impl/TaxAgentV2ServiceImpl.java | 11 +- src/com/engine/salary/util/page/PageUtil.java | 17 +- .../salary/wrapper/TaxAgentWrapper.java | 158 ++++++------ 14 files changed, 606 insertions(+), 360 deletions(-) create mode 100644 src/com/engine/salary/entity/agency/bo/PaymentAgencyBO.java create mode 100644 src/com/engine/salary/entity/agency/dto/PaymentAgencyFormDTO.java create mode 100644 src/com/engine/salary/entity/agency/dto/PaymentAgencyListDTO.java create mode 100644 src/com/engine/salary/entity/agency/po/PaymentAgencyPO.java diff --git a/src/com/engine/salary/entity/agency/bo/PaymentAgencyBO.java b/src/com/engine/salary/entity/agency/bo/PaymentAgencyBO.java new file mode 100644 index 000000000..f16d65f33 --- /dev/null +++ b/src/com/engine/salary/entity/agency/bo/PaymentAgencyBO.java @@ -0,0 +1,65 @@ +package com.engine.salary.entity.agency.bo; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.weaver.common.distribution.genid.IdGenerator; +import com.weaver.hrm.salary.entity.agency.dto.PaymentAgencyFormDTO; +import com.weaver.hrm.salary.entity.agency.dto.PaymentAgencyListDTO; +import com.weaver.hrm.salary.entity.agency.po.PaymentAgencyPO; +import com.weaver.hrm.salary.enums.sicategory.DeleteTypeEnum; + +import java.time.LocalDateTime; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +/** + * @Description: + * @Author: zhangheng + * @CreateDate: 2022/4/20 20:59 + * @Version: v1.0 + */ +public class PaymentAgencyBO { + + public static Wrapper buildPaymentAgencyListWrapper(Long employeeId, String tenantKey) { + LambdaQueryWrapper lambdaQueryWrapper = Wrappers.lambdaQuery(); + lambdaQueryWrapper.eq(PaymentAgencyPO::getTenantKey, tenantKey); + lambdaQueryWrapper.eq(PaymentAgencyPO::getDeleteType, DeleteTypeEnum.NOT_DELETED.getValue()); + lambdaQueryWrapper.orderByDesc(PaymentAgencyPO::getUpdateTime); + return lambdaQueryWrapper; + } + + public static List buildPaymentAgencyDTOList(List paymentAgencyPOS, Long employeeId, String tenantKey) { + if (CollectionUtils.isEmpty(paymentAgencyPOS)) { + return Collections.emptyList(); + } + return paymentAgencyPOS.stream().map(e -> PaymentAgencyListDTO.builder() + .id(e.getId()) + .agencyName(e.getAgencyName()) + .remarks(e.getRemarks()).build() + ).collect(Collectors.toList()); + } + + public static PaymentAgencyFormDTO buildPaymentAgencyFormDTO(PaymentAgencyPO paymentAgencyPO, Long employeeId, String tenantKey) { + PaymentAgencyFormDTO paymentAgencyFormDTO = PaymentAgencyFormDTO.builder().build(); + paymentAgencyFormDTO.setId(paymentAgencyPO.getId()); + paymentAgencyFormDTO.setAgencyName(paymentAgencyPO.getAgencyName()); + paymentAgencyFormDTO.setRemarks(paymentAgencyFormDTO.getRemarks()); + return paymentAgencyFormDTO; + } + + public static PaymentAgencyPO buildPaymentAgencyPO(PaymentAgencyFormDTO paymentAgencyFormDTO, Long employeeId, String tenantKey) { + return PaymentAgencyPO.builder() + .id(IdGenerator.generate()) + .agencyName(paymentAgencyFormDTO.getAgencyName()) + .createTime(LocalDateTime.now()) + .creator(employeeId) + .tenantKey(tenantKey) + .deleteType(DeleteTypeEnum.NOT_DELETED.getValue()) + .updateTime(LocalDateTime.now()) + .remarks(paymentAgencyFormDTO.getRemarks()) + .build(); + } +} diff --git a/src/com/engine/salary/entity/agency/dto/PaymentAgencyFormDTO.java b/src/com/engine/salary/entity/agency/dto/PaymentAgencyFormDTO.java new file mode 100644 index 000000000..9200d1de8 --- /dev/null +++ b/src/com/engine/salary/entity/agency/dto/PaymentAgencyFormDTO.java @@ -0,0 +1,65 @@ +package com.engine.salary.entity.agency.dto; + +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import com.weaver.common.component.form.item.WeaFormItemType; +import com.weaver.hrm.salary.annotation.SalaryForm; +import com.weaver.hrm.salary.annotation.SalaryFormItem; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.Size; + +/** + * @Description: + * @Author: zhangheng + * @CreateDate: 2022/4/20 21:31 + * @Version: v1.0 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@ApiModel("代缴机构表单") +public class PaymentAgencyFormDTO { + + @ApiModelProperty("主键id") + @JsonSerialize(using = ToStringSerializer.class) + private Long id; + + @SalaryForm( + label = "名称", + labelId = 84756, + items = { + @SalaryFormItem( + itemType = WeaFormItemType.INPUT, + required = true, + maxLength = "50" + ) + } + ) + @NotBlank(message = "name is required") + @Size(max = 50, message = "the maximum lenth is 50") + @ApiModelProperty("名称") + private String agencyName; + + @SalaryForm( + label = "备注", + labelId = 84961, + items = { + @SalaryFormItem( + itemType = WeaFormItemType.TEXTAREA, + maxLength = "50" + ) + } + ) + @NotBlank(message = "name is required") + @Size(max = 60, message = "the maximum lenth is 60") + @ApiModelProperty("名称") + private String remarks; +} diff --git a/src/com/engine/salary/entity/agency/dto/PaymentAgencyListDTO.java b/src/com/engine/salary/entity/agency/dto/PaymentAgencyListDTO.java new file mode 100644 index 000000000..997e6c9f3 --- /dev/null +++ b/src/com/engine/salary/entity/agency/dto/PaymentAgencyListDTO.java @@ -0,0 +1,61 @@ +package com.engine.salary.entity.agency.dto; + +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import com.weaver.common.authority.format.Operates; +import com.weaver.common.authority.format.TableColumn; +import com.weaver.common.authority.format.TableOperates; +import com.weaver.common.authority.format.WeaFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @Description: + * @Author: zhangheng + * @CreateDate: 2022/4/20 20:41 + * @Version: v1.0 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@ApiModel("代缴机构列表") +@TableOperates(value = { + @Operates(index = 0, text = "编辑", labelId = 87058), + @Operates(index = 1, text = "删除", labelId = 87061) +}) +public class PaymentAgencyListDTO { + + /** + * 主键id + */ + @ApiModelProperty("主键id") + @JsonSerialize(using = ToStringSerializer.class) + private Long id; + + /** + * 社保福利代缴机构 + */ + @WeaFormat( + label = "社保福利代缴机构", + labelId = 112448, + tableColumn = @TableColumn(width = "200") + ) + @ApiModelProperty("社保福利代缴机构") + private String agencyName; + + /** + * 备注 + */ + @WeaFormat( + label = "备注", + labelId = 84961, + tableColumn = @TableColumn(width = "300") + ) + @ApiModelProperty("备注") + private String remarks; +} diff --git a/src/com/engine/salary/entity/agency/po/PaymentAgencyPO.java b/src/com/engine/salary/entity/agency/po/PaymentAgencyPO.java new file mode 100644 index 000000000..e9c394198 --- /dev/null +++ b/src/com/engine/salary/entity/agency/po/PaymentAgencyPO.java @@ -0,0 +1,73 @@ +package com.engine.salary.entity.agency.po; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.weaver.common.elog.annotation.ElogTransform; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.time.LocalDateTime; + +/** + * @Description: + * @Author: zhangheng + * @CreateDate: 2022/4/20 20:24 + * @Version: v1.0 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@TableName("hrsa_payment_agency") +@ElogTransform(name = "数据采集-累计专项附加扣除表") +public class PaymentAgencyPO { + + /** + * 主键id + */ + @ElogTransform(name = "主键id") + private Long id; + + /** + * 机构名称 + */ + @ElogTransform(name = "机构名称") + private String agencyName; + + /** + * 备注 + */ + @ElogTransform(name = "备注") + private String remarks; + + /** + * 创建时间 + */ + @ElogTransform(name = "创建时间", ignore = true) + private LocalDateTime createTime; + + /** + * 更新时间 + */ + @ElogTransform(name = "更新时间", ignore = true) + private LocalDateTime updateTime; + + /** + * 创建人 + */ + @ElogTransform(name = "创建人", ignore = true) + private Long creator; + + /** + * 是否已删除。0:未删除、1:已删除 + */ + @ElogTransform(name = "是否已删除", ignore = true) + private Integer deleteType; + + /** + * 租户ID + */ + @ElogTransform(name = "租户key", ignore = true) + private String tenantKey; +} diff --git a/src/com/engine/salary/entity/taxagent/bo/TaxAgentBO.java b/src/com/engine/salary/entity/taxagent/bo/TaxAgentBO.java index 2b08cd5a7..fcd6abcd2 100644 --- a/src/com/engine/salary/entity/taxagent/bo/TaxAgentBO.java +++ b/src/com/engine/salary/entity/taxagent/bo/TaxAgentBO.java @@ -1,7 +1,13 @@ package com.engine.salary.entity.taxagent.bo; +import com.cloudstore.eccom.pc.table.WeaTable; +import com.cloudstore.eccom.pc.table.WeaTableColumn; +import com.cloudstore.eccom.pc.table.WeaTableOperate; +import com.cloudstore.eccom.pc.table.WeaTableOperates; import com.engine.salary.constant.SalaryDefaultTenantConstant; +import com.engine.salary.entity.agency.po.PaymentAgencyPO; import com.engine.salary.entity.datacollection.DataCollectionEmployee; +import com.engine.salary.entity.hrm.PositionInfo; import com.engine.salary.entity.taxagent.dto.TaxAgentEmployeeDTO; import com.engine.salary.entity.taxagent.dto.TaxAgentListDTO; import com.engine.salary.entity.taxagent.dto.TaxAgentManageRangeListDTO; @@ -9,6 +15,7 @@ import com.engine.salary.entity.taxagent.dto.TaxAgentSubAdminListDTO; import com.engine.salary.entity.taxagent.param.TaxAgentManageRangeSaveParam; import com.engine.salary.entity.taxagent.param.TaxAgentSaveParam; import com.engine.salary.entity.taxagent.param.TaxAgentSubAdminRangeSaveParam; +import com.engine.salary.entity.taxagent.po.TaxAgentAdminPO; import com.engine.salary.entity.taxagent.po.TaxAgentManageRangePO; import com.engine.salary.entity.taxagent.po.TaxAgentPO; import com.engine.salary.entity.taxagent.po.TaxAgentSubAdminPO; @@ -19,18 +26,11 @@ import com.engine.salary.util.SalaryEntityUtil; import com.engine.salary.util.SalaryI18nUtil; import com.google.common.base.Joiner; import com.google.common.collect.Lists; -import com.weaver.common.component.table.WeaTable; -import com.weaver.common.component.table.column.WeaTableColumn; -import com.weaver.common.component.table.operate.WeaTableOperate; import com.weaver.common.component.table.permission.Permission; -import com.weaver.common.distribution.genid.IdGenerator; import com.weaver.common.hrm.cache.HrmDepartmentComInfo; -import com.weaver.common.hrm.cache.HrmEmployeeComInfo; import com.weaver.common.hrm.cache.HrmPositionComInfo; import com.weaver.common.hrm.domain.employee.HrmStatus; -import com.weaver.hrm.salary.entity.agency.po.PaymentAgencyPO; -import com.weaver.hrm.salary.entity.taxagent.po.TaxAgentAdminPO; -import com.weaver.teams.domain.user.SimpleEmployee; +import dm.jdbc.util.IdGenerator; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; @@ -76,71 +76,67 @@ public class TaxAgentBO { * * @param weaTable * @param isOpenDevolution - * @param employeeId - * @param tenantKey - * @param size */ - public static void buildTaxAgentTable(WeaTable weaTable, boolean isOpenDevolution, Long employeeId, String tenantKey, int size) { + public static void buildTaxAgentTable(WeaTable weaTable, boolean isOpenDevolution) { // 表格表头 List columns = new ArrayList<>(); - String name = SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 91558, "个税扣缴义务人名称"); - String employeeRange = SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 86125, "人员范围"); - String admins = SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 106259, "管理员"); - String subAdmins = SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 106283, "分管理员"); - String paymentAgency = SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 112448, "社保福利代缴机构"); - String description = SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 84961, "备注"); + String name = SalaryI18nUtil.getI18nLabel(91558, "个税扣缴义务人名称"); + String employeeRange = SalaryI18nUtil.getI18nLabel(86125, "人员范围"); + String admins = SalaryI18nUtil.getI18nLabel(106259, "管理员"); + String subAdmins = SalaryI18nUtil.getI18nLabel(106283, "分管理员"); +// String paymentAgency = SalaryI18nUtil.getI18nLabel(112448, "社保福利代缴机构"); + String description = SalaryI18nUtil.getI18nLabel(84961, "备注"); if (isOpenDevolution) { columns.add(new WeaTableColumn(name, "name", "20%")); columns.add(new WeaTableColumn(employeeRange, "employeeRange", "20%")); columns.add(new WeaTableColumn(admins, "admins", "20%")); // columns.add(new WeaTableColumn(subAdmins, "subAdmins", "20%")); - columns.add(new WeaTableColumn(paymentAgency, "paymentAgency", "30%")); +// columns.add(new WeaTableColumn(paymentAgency, "paymentAgency", "30%")); columns.add(new WeaTableColumn(description, "description", "20%")); } else { columns.add(new WeaTableColumn(name, "name", "40%")); columns.add(new WeaTableColumn(employeeRange, "employeeRange", "20%")); - columns.add(new WeaTableColumn(paymentAgency, "paymentAgency", "30%")); +// columns.add(new WeaTableColumn(paymentAgency, "paymentAgency", "30%")); columns.add(new WeaTableColumn(description, "description", "40%")); } weaTable.setColumns(columns); - List operates = weaTable.getOperates(); - operates.add(new WeaTableOperate(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 59943, "编辑"), 0)); - operates.add(new WeaTableOperate(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 59942, "删除"), 1)); + WeaTableOperates operates = weaTable.getOperates(); + operates.getOperate().add(new WeaTableOperate(SalaryI18nUtil.getI18nLabel(59943, "编辑"), null, "0")); + operates.getOperate().add(new WeaTableOperate(SalaryI18nUtil.getI18nLabel(59942, "删除"), null, "1")); // if (isOpenDevolution) { -// operates.add(new WeaTableOperate(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 106247, "管理范围及分权设置"), 2)); +// operates.add(new WeaTableOperate(SalaryI18nUtil.getI18nLabel( 106247, "管理范围及分权设置"), 2)); // } - weaTable.setOperatesPermission(getDefaultOperatesPermission(operates.size(), size)); +// weaTable.setOperatesPermission(getDefaultOperatesPermission(operates.getOperate().size(), size)); // weaTable.setCheckBoxPermission(getDefaultCheckBoxPermission(size)); // // weaTable.setTableType(WeaTableTypeEnum.CHECKBOX); } - private static List> getDefaultOperatesPermission(int operateSize, int recordSize) { - List> permissionList = Lists.newArrayList(); - for (int i = 0; i < recordSize; i++) { - List permissions = Lists.newArrayList(); - for (int j = 0; j < operateSize; j++) { - permissions.add(new Permission(true, false)); - } - permissionList.add(permissions); - } - return permissionList; - } - - private static List getDefaultCheckBoxPermission(int recordSize) { - List permissionList = Lists.newArrayList(); - for (int i = 0; i < recordSize; i++) { - permissionList.add(new Permission(true, false)); - } - return permissionList; - } +// private static List> getDefaultOperatesPermission(int operateSize, int recordSize) { +// List> permissionList = Lists.newArrayList(); +// for (int i = 0; i < recordSize; i++) { +// List permissions = Lists.newArrayList(); +// for (int j = 0; j < operateSize; j++) { +// permissions.add(new Permission(true, false)); +// } +// permissionList.add(permissions); +// } +// return permissionList; +// } +// +// private static List getDefaultCheckBoxPermission(int recordSize) { +// List permissionList = Lists.newArrayList(); +// for (int i = 0; i < recordSize; i++) { +// permissionList.add(new Permission(true, false)); +// } +// return permissionList; +// } /** * 表数据转列表数据 * * @param taxAgents - * @param tenantKey * @return */ public static List convertToListDTO(Collection taxAgents) { @@ -148,12 +144,12 @@ public class TaxAgentBO { return Collections.emptyList(); } return taxAgents.stream() - .map(e -> TaxAgentListDTO.builder() - .id(e.getId()) - .name(e.getName()) - .description(e.getDescription()) - .build()) - .collect(Collectors.toList()); + .map(e -> TaxAgentListDTO.builder() + .id(e.getId()) + .name(e.getName()) + .description(e.getDescription()) + .build()) + .collect(Collectors.toList()); } /** @@ -173,7 +169,7 @@ public class TaxAgentBO { * @return */ public static List> convertToTableListDTO(List taxAgents, List paymentAgencyPOS, List taxAgentAdmins, - List adminList, + List adminList, String setLabel) { return convertToTableListDTO(Boolean.TRUE, taxAgents, paymentAgencyPOS, taxAgentAdmins, adminList, setLabel); } @@ -187,26 +183,26 @@ public class TaxAgentBO { */ public static List> convertToTableListDTO(Boolean isDevolution, List taxAgents, List paymentAgencyPOS, List taxAgentAdmins, - List adminList, String setLabel) { + List adminList, String setLabel) { if (CollectionUtils.isEmpty(taxAgents)) { return Collections.emptyList(); } return taxAgents.stream() - .map(e -> { - Map map = new LinkedHashMap<>(); - map.put("id", e.getId()); - map.put("name", e.getName()); - map.put("employeeRange", setLabel); - if (isDevolution) { - List empIds = taxAgentAdmins.stream().filter(t -> t.getTaxAgentId().equals(e.getId())).map(TaxAgentAdminPO::getEmployeeId).collect(Collectors.toList()); - List admins = adminList.stream().filter(a -> empIds.contains(a.getId())).map(SimpleEmployee::getUsername).collect(Collectors.toList()); - map.put("admins", CollectionUtils.isEmpty(admins) ? "" : Joiner.on(",").join(admins)); - map.put("subAdmins", setLabel); - } - map.put("paymentAgency", buildPaymentAgency(e.getPaymentAgency(), paymentAgencyPOS)); - map.put("description", e.getDescription()); - return map; - }).collect(Collectors.toList()); + .map(e -> { + Map map = new LinkedHashMap<>(); + map.put("id", e.getId()); + map.put("name", e.getName()); + map.put("employeeRange", setLabel); + if (isDevolution) { + List empIds = taxAgentAdmins.stream().filter(t -> t.getTaxAgentId().equals(e.getId())).map(TaxAgentAdminPO::getEmployeeId).collect(Collectors.toList()); + List admins = adminList.stream().filter(a -> empIds.contains(a.getEmployeeId())).map(DataCollectionEmployee::getUsername).collect(Collectors.toList()); + map.put("admins", CollectionUtils.isEmpty(admins) ? "" : Joiner.on(",").join((Iterable) admins)); + map.put("subAdmins", setLabel); + } + map.put("paymentAgency", buildPaymentAgency(e.getPaymentAgency(), paymentAgencyPOS)); + map.put("description", e.getDescription()); + return map; + }).collect(Collectors.toList()); } public static List> buildPaymentAgency(String originStr, List paymentAgencyPOS) { @@ -242,14 +238,14 @@ public class TaxAgentBO { } Date now = new Date(); return TaxAgentPO.builder() - .id(saveParam.getId()) - .name(saveParam.getName()) - .description(saveParam.getDescription()) - .createTime(now) - .updateTime(now) - .creator(employeeId) - .tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY) - .build(); + .id(saveParam.getId()) + .name(saveParam.getName()) + .description(saveParam.getDescription()) + .createTime(now) + .updateTime(now) + .creator(employeeId) + .tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY) + .build(); } /** @@ -265,16 +261,16 @@ public class TaxAgentBO { return Collections.emptyList(); } return list.stream() - .map(e -> { - Optional optionalUsername = subAdminList.stream().filter(a -> e.getEmployeeId().equals(a.getEmployeeId())).map(DataCollectionEmployee::getUsername).findFirst(); - return TaxAgentSubAdminListDTO.builder() - .id(e.getId()) - .subAdmin(optionalUsername.isPresent() ? optionalUsername.get() : "") - .range(range) - .description(e.getRemark()) - .build(); - }) - .collect(Collectors.toList()); + .map(e -> { + Optional optionalUsername = subAdminList.stream().filter(a -> e.getEmployeeId().equals(a.getEmployeeId())).map(DataCollectionEmployee::getUsername).findFirst(); + return TaxAgentSubAdminListDTO.builder() + .id(e.getId()) + .subAdmin(optionalUsername.isPresent() ? optionalUsername.get() : "") + .range(range) + .description(e.getRemark()) + .build(); + }) + .collect(Collectors.toList()); } /** @@ -288,13 +284,13 @@ public class TaxAgentBO { * @param hrmStatusList * @return */ - public static List convert2ListDTO(List taxAgentManageRanges, List employeeComInfos, + public static List convert2ListDTO(List taxAgentManageRanges, List employeeComInfos, List departmentComInfos, List subDepartmentComInfos, - List positionComInfos, List hrmStatusList) { + List positionComInfos, List hrmStatusList) { if (CollectionUtils.isEmpty(taxAgentManageRanges)) { return Collections.emptyList(); } - Map employeeComInfoMap = SalaryEntityUtil.convert2Map(employeeComInfos, HrmEmployeeComInfo::getId, HrmEmployeeComInfo::getUsername); + Map employeeComInfoMap = SalaryEntityUtil.convert2Map(employeeComInfos, DataCollectionEmployee::getEmployeeId, DataCollectionEmployee::getUsername); Map departmentComInfoMap = SalaryEntityUtil.convert2Map(departmentComInfos, HrmDepartmentComInfo::getId, HrmDepartmentComInfo::getName); Map subDepartmentComInfoMap = SalaryEntityUtil.convert2Map(subDepartmentComInfos, HrmDepartmentComInfo::getId, HrmDepartmentComInfo::getName); Map positionComInfoMap = SalaryEntityUtil.convert2Map(positionComInfos, HrmPositionComInfo::getId, HrmPositionComInfo::getName); @@ -302,20 +298,20 @@ public class TaxAgentBO { Map hrmStatusNameMap = SalaryEntityUtil.convert2Map(hrmStatusList, hrmStatus -> String.valueOf(hrmStatus.getCodeId()), HrmStatus::getName); return taxAgentManageRanges.stream() - .map(taxAgentManageRange -> { - TargetTypeEnum targetTypeEnum = TargetTypeEnum.parseByValue(taxAgentManageRange.getTargetType()); - return TaxAgentManageRangeListDTO.builder() - .id(taxAgentManageRange.getId()) - .targetType(targetTypeEnum) - .targetTypeName(Optional.ofNullable(targetTypeEnum) - .map(e -> SalaryI18nUtil.getI18nLabel(e.getLabelId(), e.getDefaultLabel())) - .orElse(StringUtils.EMPTY)) - .targetId(taxAgentManageRange.getTargetId()) - .targetName(buildTargetName(taxAgentManageRange, employeeComInfoMap, departmentComInfoMap, subDepartmentComInfoMap, positionComInfoMap)) - .employeeStatus(buildEmployeeStatus(hrmStatusNameMap, taxAgentManageRange.getEmployeeStatus())) - .build(); - }) - .collect(Collectors.toList()); + .map(taxAgentManageRange -> { + TargetTypeEnum targetTypeEnum = TargetTypeEnum.parseByValue(taxAgentManageRange.getTargetType()); + return TaxAgentManageRangeListDTO.builder() + .id(taxAgentManageRange.getId()) + .targetType(targetTypeEnum) + .targetTypeName(Optional.ofNullable(targetTypeEnum) + .map(e -> SalaryI18nUtil.getI18nLabel(e.getLabelId(), e.getDefaultLabel())) + .orElse(StringUtils.EMPTY)) + .targetId(taxAgentManageRange.getTargetId()) + .targetName(buildTargetName(taxAgentManageRange, employeeComInfoMap, departmentComInfoMap, subDepartmentComInfoMap, positionComInfoMap)) + .employeeStatus(buildEmployeeStatus(hrmStatusNameMap, taxAgentManageRange.getEmployeeStatus())) + .build(); + }) + .collect(Collectors.toList()); } private static String buildEmployeeStatus(Map hrmStatusNameMap, String employeeStatus) { @@ -364,7 +360,7 @@ public class TaxAgentBO { } public static Result handleSubAdminRange(List taxAgentManageRanges, TaxAgentManageRangeSaveParam saveParam, Long taxAgentId, Long subAdminId, - Long employeeId, String tenantKey) { + Long employeeId, String tenantKey) { return handleManageRange(taxAgentManageRanges, saveParam, TaxAgentRangeTypeEnum.SUBADMIN, taxAgentId, subAdminId, employeeId, tenantKey); } @@ -380,17 +376,17 @@ public class TaxAgentBO { * @return */ private static Result handleManageRange(List taxAgentManageRanges, TaxAgentManageRangeSaveParam saveParam, - TaxAgentRangeTypeEnum rangeTypeEnum, Long taxAgentId, Long subAdminId, Long employeeId, String tenantKey) { + TaxAgentRangeTypeEnum rangeTypeEnum, Long taxAgentId, Long subAdminId, Long employeeId, String tenantKey) { Date now = new Date(); Result handleResult = Result.builder() - .needInsertTaxAgentManageRanges(Lists.newArrayList()) - .needUpdateTaxAgentManageRanges(Lists.newArrayList()) - .build(); + .needInsertTaxAgentManageRanges(Lists.newArrayList()) + .needUpdateTaxAgentManageRanges(Lists.newArrayList()) + .build(); if (CollectionUtils.isEmpty(saveParam.getTargetParams())) { return handleResult; } Map taxAgentManageRangeMap = SalaryEntityUtil.convert2Map(taxAgentManageRanges, - e -> e.getIncludeType() + "-" + e.getTargetType() + "-" + e.getTargetId() + "-" + e.getRangeType()); + e -> e.getIncludeType() + "-" + e.getTargetType() + "-" + e.getTargetId() + "-" + e.getRangeType()); for (TaxAgentSubAdminRangeSaveParam.TaxAgentSubAdminRangeTargetParam targetParam : saveParam.getTargetParams()) { String key = saveParam.getIncludeType() + "-" + targetParam.getTargetType().getValue() + "-" + targetParam.getTargetId() + "-" + rangeTypeEnum.getValue(); if (taxAgentManageRangeMap.containsKey(key)) { @@ -401,20 +397,20 @@ public class TaxAgentBO { continue; } TaxAgentManageRangePO taxAgentManageRange = TaxAgentManageRangePO.builder() - .id(IdGenerator.generate()) - .taxAgentId(taxAgentId) - .taxAgentSubAdminId(subAdminId) - .rangeType(rangeTypeEnum.getValue()) - .targetType(targetParam.getTargetType().getValue()) - .targetId(targetParam.getTargetId()) - .employeeStatus(JsonUtil.toJsonString(saveParam.getEmployeeStatus())) - .includeType(saveParam.getIncludeType()) - .creator(employeeId) - .createTime(now) - .updateTime(now) - .tenantKey(tenantKey) - .deleteType(0) - .build(); + .id(IdGenerator.generate()) + .taxAgentId(taxAgentId) + .taxAgentSubAdminId(subAdminId) + .rangeType(rangeTypeEnum.getValue()) + .targetType(targetParam.getTargetType().getValue()) + .targetId(targetParam.getTargetId()) + .employeeStatus(JsonUtil.toJsonString(saveParam.getEmployeeStatus())) + .includeType(saveParam.getIncludeType()) + .creator(employeeId) + .createTime(now) + .updateTime(now) + .tenantKey(tenantKey) + .deleteType(0) + .build(); handleResult.getNeedInsertTaxAgentManageRanges().add(taxAgentManageRange); } return handleResult; diff --git a/src/com/engine/salary/entity/taxagent/po/TaxAgentManageRangePO.java b/src/com/engine/salary/entity/taxagent/po/TaxAgentManageRangePO.java index 16fb07c19..815ba6d22 100644 --- a/src/com/engine/salary/entity/taxagent/po/TaxAgentManageRangePO.java +++ b/src/com/engine/salary/entity/taxagent/po/TaxAgentManageRangePO.java @@ -94,4 +94,5 @@ public class TaxAgentManageRangePO { private Collection taxAgentIds; + private Collection ids; } diff --git a/src/com/engine/salary/mapper/taxagent/TaxAgentManageRangeMapper.java b/src/com/engine/salary/mapper/taxagent/TaxAgentManageRangeMapper.java index 1bbeff56e..6e22e36b1 100644 --- a/src/com/engine/salary/mapper/taxagent/TaxAgentManageRangeMapper.java +++ b/src/com/engine/salary/mapper/taxagent/TaxAgentManageRangeMapper.java @@ -3,6 +3,7 @@ package com.engine.salary.mapper.taxagent; import com.engine.salary.entity.taxagent.po.TaxAgentManageRangePO; import org.apache.ibatis.annotations.Mapper; +import java.util.Collection; import java.util.List; @Mapper @@ -64,4 +65,5 @@ public interface TaxAgentManageRangeMapper { */ int delete(TaxAgentManageRangePO taxAgentManageRange); + void deleteByIds(Collection ids); } \ No newline at end of file diff --git a/src/com/engine/salary/mapper/taxagent/TaxAgentManageRangeMapper.xml b/src/com/engine/salary/mapper/taxagent/TaxAgentManageRangeMapper.xml index 46b4ed3da..d4497453e 100644 --- a/src/com/engine/salary/mapper/taxagent/TaxAgentManageRangeMapper.xml +++ b/src/com/engine/salary/mapper/taxagent/TaxAgentManageRangeMapper.xml @@ -281,5 +281,16 @@ WHERE id = #{id} AND delete_type = 0 + + UPDATE hrsa_tax_agent_manage_range + SET delete_type=1 + WHERE + id IN + + #{id} + + AND delete_type = 0 + + \ No newline at end of file diff --git a/src/com/engine/salary/service/TaxAgentManageRangeService.java b/src/com/engine/salary/service/TaxAgentManageRangeService.java index 06e780a00..33b1e6c31 100644 --- a/src/com/engine/salary/service/TaxAgentManageRangeService.java +++ b/src/com/engine/salary/service/TaxAgentManageRangeService.java @@ -1,9 +1,14 @@ package com.engine.salary.service; import com.engine.salary.entity.taxagent.dto.TaxAgentManageRangeEmployeeDTO; +import com.engine.salary.entity.taxagent.dto.TaxAgentManageRangeListDTO; +import com.engine.salary.entity.taxagent.param.TaxAgentRangeQueryParam; import com.engine.salary.entity.taxagent.param.TaxAgentRangeSaveParam; +import com.engine.salary.entity.taxagent.param.TaxAgentSubAdminRangeQueryParam; import com.engine.salary.entity.taxagent.param.TaxAgentSubAdminRangeSaveParam; +import com.engine.salary.entity.taxagent.po.TaxAgentManageRangePO; import com.engine.salary.enums.salarysob.SalaryEmployeeStatusEnum; +import com.engine.salary.util.page.PageInfo; import java.util.Collection; import java.util.List; @@ -50,7 +55,7 @@ public interface TaxAgentManageRangeService { * @param taxAgentSubAdminIds * @return */ -// List listSalaryEmployeeBySubAdminIds(SalaryEmployeeStatusEnum employeeStatus, List taxAgentSubAdminIds); + List listSalaryEmployeeBySubAdminIds(SalaryEmployeeStatusEnum employeeStatus, List taxAgentSubAdminIds); /** * 根据查询条件查询分管理员的人员范围 @@ -59,7 +64,7 @@ public interface TaxAgentManageRangeService { * @param includeType 0-从范围中排除/1-关联人员范围 * @return */ -// Page listPageByParamAndIncludeType(TaxAgentSubAdminRangeQueryParam queryParam, Integer includeType); + PageInfo listPageByParamAndIncludeType(TaxAgentSubAdminRangeQueryParam queryParam, Integer includeType); /** * 根据查询条件查询个税扣缴义务人的人员范围 @@ -68,7 +73,7 @@ public interface TaxAgentManageRangeService { * @param includeType 0-从范围中排除/1-关联人员范围 * @return */ -// PageInfo listPageByParamAndIncludeType(TaxAgentRangeQueryParam queryParam, Integer includeType); + PageInfo listPageByParamAndIncludeType(TaxAgentRangeQueryParam queryParam, Integer includeType); /** * 根据分管理员id集合查询范围列表 @@ -76,7 +81,7 @@ public interface TaxAgentManageRangeService { * @param taxAgentSubAdminIds * @return */ -// List listBySubAdminIds(Collection taxAgentSubAdminIds); + List listBySubAdminIds(Collection taxAgentSubAdminIds); /** * 保存 diff --git a/src/com/engine/salary/service/TaxAgentV2Service.java b/src/com/engine/salary/service/TaxAgentV2Service.java index 523c2f18d..29bce7029 100644 --- a/src/com/engine/salary/service/TaxAgentV2Service.java +++ b/src/com/engine/salary/service/TaxAgentV2Service.java @@ -134,10 +134,9 @@ public interface TaxAgentV2Service { * 更新代缴机构 * * @param taxAgentPO - * @param employeeId * @return */ - String paymentAgencyUpdate(TaxAgentPO taxAgentPO, Long employeeId); + String paymentAgencyUpdate(TaxAgentPO taxAgentPO); /** * 编辑个税扣缴义务人 diff --git a/src/com/engine/salary/service/impl/TaxAgentManageRangeServiceImpl.java b/src/com/engine/salary/service/impl/TaxAgentManageRangeServiceImpl.java index dfc2b7ea1..1dea5e269 100644 --- a/src/com/engine/salary/service/impl/TaxAgentManageRangeServiceImpl.java +++ b/src/com/engine/salary/service/impl/TaxAgentManageRangeServiceImpl.java @@ -5,29 +5,30 @@ import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapp import com.baomidou.mybatisplus.extension.conditions.update.LambdaUpdateChainWrapper; import com.engine.core.impl.Service; import com.engine.salary.entity.datacollection.DataCollectionEmployee; +import com.engine.salary.entity.taxagent.bo.TaxAgentBO; import com.engine.salary.entity.taxagent.dto.TaxAgentManageRangeEmployeeDTO; import com.engine.salary.entity.taxagent.dto.TaxAgentManageRangeListDTO; -import com.engine.salary.entity.taxagent.param.TaxAgentManageRangeQueryParam; -import com.engine.salary.entity.taxagent.param.TaxAgentRangeQueryParam; -import com.engine.salary.entity.taxagent.param.TaxAgentRangeSaveParam; +import com.engine.salary.entity.taxagent.param.*; import com.engine.salary.entity.taxagent.po.TaxAgentManageRangePO; +import com.engine.salary.entity.taxagent.po.TaxAgentPO; +import com.engine.salary.entity.taxagent.po.TaxAgentSubAdminPO; import com.engine.salary.enums.SalaryJobFlagEnum; import com.engine.salary.enums.salarysob.SalaryEmployeeStatusEnum; import com.engine.salary.enums.salarysob.TargetTypeEnum; import com.engine.salary.enums.taxagent.TaxAgentRangeTypeEnum; +import com.engine.salary.exception.SalaryRunTimeException; import com.engine.salary.mapper.datacollection.EmployMapper; import com.engine.salary.mapper.taxagent.TaxAgentManageRangeMapper; -import com.engine.salary.service.TaxAgentEmpService; -import com.engine.salary.service.TaxAgentManageRangeService; -import com.engine.salary.service.TaxAgentService; +import com.engine.salary.service.*; import com.engine.salary.util.JsonUtil; 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.PageUtil; import com.google.common.collect.Lists; import com.weaver.common.async.bean.AsyncBean; import com.weaver.common.async.consumer.anno.method.AsyncListener; import com.weaver.common.cache.tablecache.impl.ComInfoCache; -import com.weaver.common.component.table.page.Page; import com.weaver.common.hrm.cache.HrmDepartmentComInfo; import com.weaver.common.hrm.cache.HrmEmployeeComInfo; import com.weaver.common.hrm.cache.HrmPositionComInfo; @@ -36,14 +37,8 @@ import com.weaver.common.hrm.domain.queue.HrmCommonQueue; import com.weaver.common.hrm.service.employee.HrmCommonHrmStatusService; import com.weaver.datasecurity.interceptor.DSTenantKeyThreadVar; import com.weaver.hrm.salary.common.SalaryEmployee; -import com.weaver.hrm.salary.entity.taxagent.bo.TaxAgentBO; import com.weaver.hrm.salary.entity.taxagent.param.*; -import com.weaver.hrm.salary.entity.taxagent.po.TaxAgentPO; -import com.weaver.hrm.salary.entity.taxagent.po.TaxAgentSubAdminPO; -import com.weaver.hrm.salary.exception.SalaryRunTimeException; import com.weaver.hrm.salary.service.*; -import com.weaver.hrm.salary.util.SalaryI18nUtil; -import com.weaver.hrm.salary.util.SalaryPageUtil; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; @@ -67,7 +62,7 @@ public class TaxAgentManageRangeServiceImpl extends Service implements TaxAgentM private TaxAgentManageRangeMapper taxAgentManageRangeMapper; - private TaxAgentService taxAgentService; + private TaxAgentV2Service taxAgentService; private TaxAgentSubAdminService taxAgentSubAdminService; @@ -101,32 +96,33 @@ public class TaxAgentManageRangeServiceImpl extends Service implements TaxAgentM return convertTaxAgentEmployee(employeeStatus, taxAgentIds, allTaxAgentManageRanges); } -// @Override -// public List listBySubAdminIds(Collection taxAgentSubAdminIds) { -// if (CollectionUtils.isEmpty(taxAgentSubAdminIds)) { -// return Lists.newArrayList(); -// } -// return new LambdaQueryChainWrapper<>(taxAgentManageRangeMapper) -// .eq(TaxAgentManageRangePO::getTenantKey, tenantKey) -// .eq(TaxAgentManageRangePO::getDeleteType, 0) -// .eq(TaxAgentManageRangePO::getRangeType, TaxAgentRangeTypeEnum.SUBADMIN.getValue()) -// .in(TaxAgentManageRangePO::getTaxAgentSubAdminId, taxAgentSubAdminIds) -// .orderByDesc(TaxAgentManageRangePO::getId) -// .list(); -// } + @Override + public List listBySubAdminIds(Collection taxAgentSubAdminIds) { + if (CollectionUtils.isEmpty(taxAgentSubAdminIds)) { + return Lists.newArrayList(); + } + taxAgentManageRangeMapper.listSome(TaxAgentManageRangePO.builder().rangeType(TaxAgentRangeTypeEnum.SUBADMIN.getValue()).build()) + return new LambdaQueryChainWrapper<>(taxAgentManageRangeMapper) + .eq(TaxAgentManageRangePO::getTenantKey) + .eq(TaxAgentManageRangePO::getDeleteType, 0) + .eq(TaxAgentManageRangePO::getRangeType, TaxAgentRangeTypeEnum.SUBADMIN.getValue()) + .in(TaxAgentManageRangePO::getTaxAgentSubAdminId, taxAgentSubAdminIds) + .orderByDesc(TaxAgentManageRangePO::getId) + .list(); + } -// @Override -// public List listSalaryEmployeeBySubAdminIds(List taxAgentIds) { -// return listSalaryEmployeeBySubAdminIds(null, taxAgentIds); -// } + @Override + public List listSalaryEmployeeBySubAdminIds(List taxAgentIds) { + return listSalaryEmployeeBySubAdminIds(null, taxAgentIds); + } -// @Override -// public List listSalaryEmployeeBySubAdminIds(SalaryEmployeeStatusEnum employeeStatus, List taxAgentSubAdminIds) { -// List allTaxAgentManageRanges = this.listBySubAdminIds(taxAgentSubAdminIds); -// List taxAgentIds = allTaxAgentManageRanges.stream().map(TaxAgentManageRangePO::getTaxAgentId).distinct().collect(Collectors.toList()); -// -// return convertTaxAgentEmployee(employeeStatus, taxAgentIds, allTaxAgentManageRanges); -// } + @Override + public List listSalaryEmployeeBySubAdminIds(SalaryEmployeeStatusEnum employeeStatus, List taxAgentSubAdminIds) { + List allTaxAgentManageRanges = this.listBySubAdminIds(taxAgentSubAdminIds); + List taxAgentIds = allTaxAgentManageRanges.stream().map(TaxAgentManageRangePO::getTaxAgentId).distinct().collect(Collectors.toList()); + + return convertTaxAgentEmployee(employeeStatus, taxAgentIds, allTaxAgentManageRanges); + } private List convertTaxAgentEmployee(SalaryEmployeeStatusEnum employeeStatus, List taxAgentIds, List allTaxAgentManageRanges) { return taxAgentIds.stream().distinct().map(e -> { @@ -159,7 +155,7 @@ public class TaxAgentManageRangeServiceImpl extends Service implements TaxAgentM * @return */ private List getManageRangeSalaryEmployees(SalaryEmployeeStatusEnum employeeStatus, Long taxAgentId, - List allTaxAgentManageRanges) { + List allTaxAgentManageRanges) { List includeAllTaxAgentManageRanges = allTaxAgentManageRanges.stream().filter(f -> f.getIncludeType().equals(NumberUtils.INTEGER_ONE)).collect(Collectors.toList()); if (CollectionUtils.isEmpty(includeAllTaxAgentManageRanges)) { return Collections.emptyList(); @@ -263,7 +259,7 @@ public class TaxAgentManageRangeServiceImpl extends Service implements TaxAgentM // private List listBySubAdminIdAndIncludeType(Long subAdminId, Integer includeType) { // // return new LambdaQueryChainWrapper<>(taxAgentManageRangeMapper) -// .eq(TaxAgentManageRangePO::getTenantKey, tenantKey) +// .eq(TaxAgentManageRangePO::getTenantKey) // .eq(TaxAgentManageRangePO::getDeleteType, 0) // .eq(TaxAgentManageRangePO::getTaxAgentSubAdminId, subAdminId) // .eq(TaxAgentManageRangePO::getRangeType, TaxAgentRangeTypeEnum.SUBADMIN.getValue()) @@ -324,9 +320,9 @@ public class TaxAgentManageRangeServiceImpl extends Service implements TaxAgentM .collect(Collectors.toList()); List positionComInfos = comInfoCache.getCacheList(HrmPositionComInfo.class, positionIds); // 分页参数 - Page dtoPage = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize()); + PageInfo dtoPage = PageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), TaxAgentManageRangeListDTO.class); // 查询人员状态 - List hrmStatusList = hrmCommonHrmStatusService.list(tenantKey); + List hrmStatusList = hrmCommonHrmStatusService.list(); // 薪资账套的人员范围po转换成列表dto List taxAgentManageRangeList = TaxAgentBO.convert2ListDTO(taxAgentManageRanges, employeeComInfos, departmentComInfos, subDepartmentComInfos, positionComInfos, hrmStatusList); // 根据对象名称过滤 @@ -337,7 +333,7 @@ public class TaxAgentManageRangeServiceImpl extends Service implements TaxAgentM } // 填充总数和当页数据 dtoPage.setTotal(taxAgentManageRangeList.size()); - dtoPage.setRecords(SalaryPageUtil.subList((int) dtoPage.getCurrent(), (int) dtoPage.getSize(), taxAgentManageRangeList)); + dtoPage.setList(PageUtil.subList(dtoPage.getPageNum(), dtoPage.getSize(), taxAgentManageRangeList)); return dtoPage; } @@ -346,22 +342,20 @@ public class TaxAgentManageRangeServiceImpl extends Service implements TaxAgentM * * @param saveParam 保存参数 * @param employeeId 人员id - * @param tenantKey 租户key */ @Override - @Transactional(rollbackFor = Exception.class) - public void save(TaxAgentRangeSaveParam saveParam, Long employeeId, String tenantKey) { + public void save(TaxAgentRangeSaveParam saveParam, Long employeeId) { // 查询薪资账套 - TaxAgentPO taxAgent = taxAgentService.getById(saveParam.getTaxAgentId(), tenantKey); + TaxAgentPO taxAgent = taxAgentService.getById(saveParam.getTaxAgentId()); if (Objects.isNull(taxAgent)) { - throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 108605, "参数错误,个税扣缴义务人不存在或者已被删除")); + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(108605, "参数错误,个税扣缴义务人不存在或者已被删除")); } // 查询已有的管理范围 - List taxAgentManageAllRanges = listByTaxAgentId(saveParam.getTaxAgentId(), tenantKey); + List taxAgentManageAllRanges = listByTaxAgentId(saveParam.getTaxAgentId()); List taxAgentManageRanges = taxAgentManageAllRanges.stream().filter(f -> f.getIncludeType().equals(saveParam.getIncludeType())).collect(Collectors.toList()); // 处理一下本次的保存参数(如果原来添加过对应的人员(/部门/岗位),那么本次不需要新增,只需要更新) - TaxAgentBO.Result result = TaxAgentBO.handleTaxAgentRange(taxAgentManageRanges, saveParam, taxAgent.getId(), employeeId, tenantKey); + TaxAgentBO.Result result = TaxAgentBO.handleTaxAgentRange(taxAgentManageRanges, saveParam, taxAgent.getId(), employeeId); /** 检查当前个税扣缴义务人的所有人员范围与所有分管理员的管理范围===========================start */ List allRanges = Lists.newArrayList(taxAgentManageAllRanges); @@ -371,17 +365,17 @@ public class TaxAgentManageRangeServiceImpl extends Service implements TaxAgentM allRanges = allRanges.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>( Comparator.comparing(f -> f.getTaxAgentId() + "." + f.getRangeType() + "." + f.getTargetType() + "." + f.getTargetId() + "." + f.getEmployeeStatus() + "." + f.getIncludeType())) ), ArrayList::new)); - List allSalaryEmployees = this.getManageRangeSalaryEmployees(null, saveParam.getTaxAgentId(), allRanges, tenantKey); + List allSalaryEmployees = this.getManageRangeSalaryEmployees(null, saveParam.getTaxAgentId(), allRanges); // 如果是排除是否会对分管理范围产生影响 - List allSubAdminRanges = listSunAdminRangeByTaxAgentId(saveParam.getTaxAgentId(), tenantKey); + List allSubAdminRanges = listSunAdminRangeByTaxAgentId(saveParam.getTaxAgentId()); if (saveParam.getIncludeType().equals(NumberUtils.INTEGER_ZERO)) { - List allSubAdminSalaryEmployees = this.getManageRangeSalaryEmployees(null, saveParam.getTaxAgentId(), allSubAdminRanges, tenantKey); + List allSubAdminSalaryEmployees = this.getManageRangeSalaryEmployees(null, saveParam.getTaxAgentId(), allSubAdminRanges); - List allSalaryEmployeeIds = allSalaryEmployees.stream().map(SalaryEmployee::getEmployeeId).collect(Collectors.toList()); + List allSalaryEmployeeIds = allSalaryEmployees.stream().map(DataCollectionEmployee::getEmployeeId).collect(Collectors.toList()); allSubAdminSalaryEmployees.removeIf(a -> allSalaryEmployeeIds.contains(a.getEmployeeId())); if (CollectionUtils.isNotEmpty(allSubAdminSalaryEmployees)) { - throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 110122, "分管理员包含该范围,不能删除")); + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(110122, "分管理员包含该范围,不能删除")); } } /** 检查当前个税扣缴义务人的所有人员范围与所有分管理员的管理范围===========================end */ @@ -396,10 +390,8 @@ public class TaxAgentManageRangeServiceImpl extends Service implements TaxAgentM /** 同步本地人员范围的关联人员=========================== */ taskExecutor.execute(() -> { try { - DSTenantKeyThreadVar.tenantKey.set(tenantKey); - syncLocalEmp(saveParam.getTaxAgentId(), allSalaryEmployees, allSubAdminRanges, employeeId, tenantKey); + syncLocalEmp(saveParam.getTaxAgentId(), allSalaryEmployees, allSubAdminRanges, employeeId); } finally { - DSTenantKeyThreadVar.tenantKey.remove(); } }); @@ -410,45 +402,32 @@ public class TaxAgentManageRangeServiceImpl extends Service implements TaxAgentM * 获取个税口角义务人的管理范围 * * @param taxAgentId - * @param tenantKey * @return */ - private List listByTaxAgentId(Long taxAgentId, String tenantKey) { - return new LambdaQueryChainWrapper<>(taxAgentManageRangeMapper) - .eq(TaxAgentManageRangePO::getTenantKey, tenantKey) - .eq(TaxAgentManageRangePO::getDeleteType, 0) - .eq(TaxAgentManageRangePO::getTaxAgentId, taxAgentId) - .eq(TaxAgentManageRangePO::getRangeType, TaxAgentRangeTypeEnum.TAXAGENT.getValue()) - .orderByDesc(TaxAgentManageRangePO::getId) - .list(); + private List listByTaxAgentId(Long taxAgentId) { + return taxAgentManageRangeMapper.listSome(TaxAgentManageRangePO.builder().taxAgentId(taxAgentId).rangeType(TaxAgentRangeTypeEnum.TAXAGENT.getValue()).build()); } - private List listSunAdminRangeByTaxAgentId(Long taxAgentId, String tenantKey) { - return new LambdaQueryChainWrapper<>(taxAgentManageRangeMapper) - .eq(TaxAgentManageRangePO::getTenantKey, tenantKey) - .eq(TaxAgentManageRangePO::getDeleteType, 0) - .eq(TaxAgentManageRangePO::getTaxAgentId, taxAgentId) - .eq(TaxAgentManageRangePO::getRangeType, TaxAgentRangeTypeEnum.SUBADMIN.getValue()) - .orderByDesc(TaxAgentManageRangePO::getId) - .list(); + private List listSunAdminRangeByTaxAgentId(Long taxAgentId) { + return taxAgentManageRangeMapper.listSome(TaxAgentManageRangePO.builder().taxAgentId(taxAgentId).rangeType(TaxAgentRangeTypeEnum.SUBADMIN.getValue()).build()); } @Override @Transactional(rollbackFor = Exception.class) - public void save4SubAdmin(TaxAgentSubAdminRangeSaveParam saveParam, Long employeeId, String tenantKey) { + public void save4SubAdmin(TaxAgentSubAdminRangeSaveParam saveParam, Long employeeId) { // 查询薪资账套 - TaxAgentSubAdminPO taxAgentSubAdmin = taxAgentSubAdminService.getById(saveParam.getSubAdminId(), tenantKey); + TaxAgentSubAdminPO taxAgentSubAdmin = taxAgentSubAdminService.getById(saveParam.getSubAdminId()); if (Objects.isNull(taxAgentSubAdmin)) { - throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 106687, "参数错误,分管理员不存在或者已被删除")); + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(106687, "参数错误,分管理员不存在或者已被删除")); } // 查询已有的管理范围 - List taxAgentManageAllRanges = listBySubAdminId(saveParam.getSubAdminId(), tenantKey); + List taxAgentManageAllRanges = listBySubAdminId(saveParam.getSubAdminId()); List taxAgentManageRanges = taxAgentManageAllRanges.stream().filter(f -> f.getIncludeType().equals(saveParam.getIncludeType())).collect(Collectors.toList()); // 处理一下本次的保存参数(如果原来添加过对应的人员(/部门/岗位),那么本次不需要新增,只需要更新) - TaxAgentBO.Result result = TaxAgentBO.handleSubAdminRange(taxAgentManageRanges, saveParam, taxAgentSubAdmin.getTaxAgentId(), taxAgentSubAdmin.getId(), employeeId, tenantKey); + TaxAgentBO.Result result = TaxAgentBO.handleSubAdminRange(taxAgentManageRanges, saveParam, taxAgentSubAdmin.getTaxAgentId(), taxAgentSubAdmin.getId(), employeeId); // 当前库中所有分管理员的管理范围 - List allSubAdminRangesExist = listSunAdminRangeByTaxAgentId(taxAgentSubAdmin.getTaxAgentId(), tenantKey); + List allSubAdminRangesExist = listSunAdminRangeByTaxAgentId(taxAgentSubAdmin.getTaxAgentId()); /** 检查当前分管理员的范围与其他分管理员人员范围===========================start */ // 当前分管理员的范围 List allSubAdminRangesCuttent = Lists.newArrayList(taxAgentManageAllRanges); @@ -458,13 +437,13 @@ public class TaxAgentManageRangeServiceImpl extends Service implements TaxAgentM allSubAdminRangesCuttent.addAll(result.getNeedUpdateTaxAgentManageRanges()); // 当前分管理员的所有人员 - List currentSubAdminSalaryEmployees = this.getManageRangeSalaryEmployees(null, taxAgentSubAdmin.getTaxAgentId(), allSubAdminRangesCuttent, tenantKey); + List currentSubAdminSalaryEmployees = this.getManageRangeSalaryEmployees(null, taxAgentSubAdmin.getTaxAgentId(), allSubAdminRangesCuttent); // 其他分管理员的所有人员 - List otherSubAdminSalaryEmployees = this.getManageRangeSalaryEmployees(null, taxAgentSubAdmin.getTaxAgentId(), otherSubAdminRangesExist, tenantKey); + List otherSubAdminSalaryEmployees = this.getManageRangeSalaryEmployees(null, taxAgentSubAdmin.getTaxAgentId(), otherSubAdminRangesExist); for (SalaryEmployee se : currentSubAdminSalaryEmployees) { Optional optionalSe = otherSubAdminSalaryEmployees.stream().filter(f -> f.getEmployeeId().equals(se.getEmployeeId())).findFirst(); if (optionalSe.isPresent()) { - throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 110149, "不可包含其他分管理员的人员")); + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(110149, "不可包含其他分管理员的人员")); } } /** 检查当前分管理员的范围与其他分管理员人员范围===========================end */ @@ -479,14 +458,14 @@ public class TaxAgentManageRangeServiceImpl extends Service implements TaxAgentM Comparator.comparing(f -> f.getTaxAgentSubAdminId() + "." + f.getRangeType() + "." + f.getTargetType() + "." + f.getTargetId() + "." + f.getEmployeeStatus() + "." + f.getIncludeType())) ), ArrayList::new)); // 所属个税扣缴义务人的所有人员 - List allRanges = listByTaxAgentId(taxAgentSubAdmin.getTaxAgentId(), tenantKey); - List allSalaryEmployees = this.getManageRangeSalaryEmployees(null, taxAgentSubAdmin.getTaxAgentId(), allRanges, tenantKey); + List allRanges = listByTaxAgentId(taxAgentSubAdmin.getTaxAgentId()); + List allSalaryEmployees = this.getManageRangeSalaryEmployees(null, taxAgentSubAdmin.getTaxAgentId(), allRanges); // 所有分管理员的所有人员 - List allSubAdminSalaryEmployees = this.getManageRangeSalaryEmployees(null, taxAgentSubAdmin.getTaxAgentId(), allSubAdminRanges, tenantKey); + List allSubAdminSalaryEmployees = this.getManageRangeSalaryEmployees(null, taxAgentSubAdmin.getTaxAgentId(), allSubAdminRanges); List allSalaryEmployeeIds = allSalaryEmployees.stream().map(SalaryEmployee::getEmployeeId).collect(Collectors.toList()); allSubAdminSalaryEmployees.removeIf(a -> allSalaryEmployeeIds.contains(a.getEmployeeId())); if (CollectionUtils.isNotEmpty(allSubAdminSalaryEmployees)) { - throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 110125, "超出了整体人员范围")); + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(110125, "超出了整体人员范围")); } /** 检查当前分管理员的范围与所属个税扣缴义务人的人员范围===========================end */ @@ -502,7 +481,7 @@ public class TaxAgentManageRangeServiceImpl extends Service implements TaxAgentM taskExecutor.execute(() -> { try { DSTenantKeyThreadVar.tenantKey.set(tenantKey); - syncLocalEmp(taxAgentSubAdmin.getTaxAgentId(), allSalaryEmployees, finalAllSubAdminRanges, employeeId, tenantKey); + syncLocalEmp(taxAgentSubAdmin.getTaxAgentId(), allSalaryEmployees, finalAllSubAdminRanges, employeeId); } finally { DSTenantKeyThreadVar.tenantKey.remove(); } @@ -514,36 +493,23 @@ public class TaxAgentManageRangeServiceImpl extends Service implements TaxAgentM * 根据分管理员id获取管理范围列表 * * @param subAdminId - * @param tenantKey * @return */ - private List listBySubAdminId(Long subAdminId, String tenantKey) { - return new LambdaQueryChainWrapper<>(taxAgentManageRangeMapper) - .eq(TaxAgentManageRangePO::getTenantKey, tenantKey) - .eq(TaxAgentManageRangePO::getDeleteType, 0) - .eq(TaxAgentManageRangePO::getTaxAgentSubAdminId, subAdminId) - .eq(TaxAgentManageRangePO::getRangeType, TaxAgentRangeTypeEnum.SUBADMIN.getValue()) - .orderByDesc(TaxAgentManageRangePO::getId) - .list(); + private List listBySubAdminId(Long subAdminId) { + return taxAgentManageRangeMapper.listSome(TaxAgentManageRangePO.builder().taxAgentSubAdminId(subAdminId).rangeType(TaxAgentRangeTypeEnum.SUBADMIN.getValue()).build()); } - private List listByIds(Collection ids, String tenantKey) { + private List listByIds(Collection ids) { if (CollectionUtils.isEmpty(ids)) { return Collections.emptyList(); } - return new LambdaQueryChainWrapper<>(taxAgentManageRangeMapper) - .eq(TaxAgentManageRangePO::getTenantKey, tenantKey) - .eq(TaxAgentManageRangePO::getDeleteType, 0) - .in(TaxAgentManageRangePO::getId, ids) - .orderByDesc(TaxAgentManageRangePO::getId) - .list(); + return taxAgentManageRangeMapper.listSome(TaxAgentManageRangePO.builder().ids(ids).build()); } @Override - @Transactional(rollbackFor = Exception.class) - public void deleteByIds(Collection ids, Long employeeId, String tenantKey) { + public void deleteByIds(Collection ids, Long employeeId) { // 查询管理范围 - List taxAgentManageRanges = listByIds(ids, tenantKey); + List taxAgentManageRanges = listByIds(ids); if (CollectionUtils.isEmpty(taxAgentManageRanges)) { throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98604, "数据不存在或已被删除")); } @@ -552,34 +518,28 @@ public class TaxAgentManageRangeServiceImpl extends Service implements TaxAgentM throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(110159, "一次只能删一个个税个税扣缴义务人的范围")); } Collection finalIds = ids; - taxAgentManageRanges = this.listByTaxAgentIds(taxAgentIds, tenantKey); + taxAgentManageRanges = this.listByTaxAgentIds(taxAgentIds); List allManageRanges = taxAgentManageRanges.stream().filter(f -> !finalIds.contains(f.getId())).collect(Collectors.toList()); List allRanges = allManageRanges.stream().filter(f -> f.getRangeType().equals(TaxAgentRangeTypeEnum.TAXAGENT.getValue())).collect(Collectors.toList()); List allSubAdminRanges = allManageRanges.stream().filter(f -> f.getRangeType().equals(TaxAgentRangeTypeEnum.SUBADMIN.getValue())).collect(Collectors.toList()); Long taxAgentId = taxAgentIds.get(0); - List allSalaryEmployees = this.getManageRangeSalaryEmployees(null, taxAgentId, allRanges, tenantKey); + List allSalaryEmployees = this.getManageRangeSalaryEmployees(null, taxAgentId, allRanges); - List allSubAdminSalaryEmployees = this.getManageRangeSalaryEmployees(null, taxAgentId, allSubAdminRanges, tenantKey); + List allSubAdminSalaryEmployees = this.getManageRangeSalaryEmployees(null, taxAgentId, allSubAdminRanges); allSalaryEmployees.forEach(f -> { allSubAdminSalaryEmployees.removeIf(a -> a.getEmployeeId().equals(f.getEmployeeId())); }); if (CollectionUtils.isNotEmpty(allSubAdminSalaryEmployees)) { - throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 110160, "分管理员存在超出整体人员范围以外的人员,不可删除")); + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(110160, "分管理员存在超出整体人员范围以外的人员,不可删除")); } // 删除管理范围 - new LambdaUpdateChainWrapper<>(taxAgentManageRangeMapper) - .eq(TaxAgentManageRangePO::getDeleteType, 0) - .eq(TaxAgentManageRangePO::getTenantKey, tenantKey) - .in(TaxAgentManageRangePO::getId, ids) - .set(TaxAgentManageRangePO::getDeleteType, 1) - .update(); + taxAgentManageRangeMapper.deleteByIds(ids); + /** 同步本地人员范围的关联人员=========================== */ taskExecutor.execute(() -> { try { - DSTenantKeyThreadVar.tenantKey.set(tenantKey); - syncLocalEmp(taxAgentId, allSalaryEmployees, allSubAdminRanges, employeeId, tenantKey); + syncLocalEmp(taxAgentId, allSalaryEmployees, allSubAdminRanges, employeeId); } finally { - DSTenantKeyThreadVar.tenantKey.remove(); } }); // 记录日志 todo @@ -589,12 +549,12 @@ public class TaxAgentManageRangeServiceImpl extends Service implements TaxAgentM public void deleteByTaxAgentIds(Collection taxAgentIds, String tenantKey) { new LambdaUpdateChainWrapper<>(taxAgentManageRangeMapper) .eq(TaxAgentManageRangePO::getDeleteType, 0) - .eq(TaxAgentManageRangePO::getTenantKey, tenantKey) + .eq(TaxAgentManageRangePO::getTenantKey) .in(TaxAgentManageRangePO::getTaxAgentId, taxAgentIds) .set(TaxAgentManageRangePO::getDeleteType, 1) .update(); // 删除管理范围下的所有人员 - taxAgentEmployeeService.deleteByTaxAgentIds(taxAgentIds, tenantKey); + taxAgentEmployeeService.deleteByTaxAgentIds(taxAgentIds); } @Override @@ -604,12 +564,12 @@ public class TaxAgentManageRangeServiceImpl extends Service implements TaxAgentM } new LambdaUpdateChainWrapper<>(taxAgentManageRangeMapper) .eq(TaxAgentManageRangePO::getDeleteType, 0) - .eq(TaxAgentManageRangePO::getTenantKey, tenantKey) + .eq(TaxAgentManageRangePO::getTenantKey) .in(TaxAgentManageRangePO::getTaxAgentSubAdminId, subAdminIds) .set(TaxAgentManageRangePO::getDeleteType, 1) .update(); // 删除管理范围下的所有人员 - taxAgentSubAdminEmployeeService.deleteBySubAdminIds(subAdminIds, tenantKey); + taxAgentSubAdminEmployeeService.deleteBySubAdminIds(subAdminIds); } @AsyncListener(topic = "hrm_resource_queue") @@ -623,10 +583,8 @@ public class TaxAgentManageRangeServiceImpl extends Service implements TaxAgentM // 开始同步 taskExecutor.execute(() -> { try { - DSTenantKeyThreadVar.tenantKey.set(tenantKey); - handleSyncTaxAgentEmpData(tenantKey); + handleSyncTaxAgentEmpData(); } finally { - DSTenantKeyThreadVar.tenantKey.remove(); } }); } @@ -634,11 +592,11 @@ public class TaxAgentManageRangeServiceImpl extends Service implements TaxAgentM /** * 同步处理所有人员泛微 * - * @param tenantKey + * @param */ - private void handleSyncTaxAgentEmpData(String tenantKey) { + private void handleSyncTaxAgentEmpData() { List allManageRanges = new LambdaQueryChainWrapper<>(taxAgentManageRangeMapper) - .eq(TaxAgentManageRangePO::getTenantKey, tenantKey) + .eq(TaxAgentManageRangePO::getTenantKey) .eq(TaxAgentManageRangePO::getDeleteType, 0) .orderByDesc(TaxAgentManageRangePO::getId) .list(); @@ -652,17 +610,17 @@ public class TaxAgentManageRangeServiceImpl extends Service implements TaxAgentM taxAgentIds.forEach(taxAgentId -> { // 当前个税扣缴义务人的所有范围 List allRanges = allManageRanges.stream().filter(f -> f.getTaxAgentId().equals(taxAgentId) && f.getRangeType().equals(TaxAgentRangeTypeEnum.TAXAGENT.getValue())).collect(Collectors.toList()); - List allSalaryEmployees = this.getManageRangeSalaryEmployees(null, taxAgentId, allRanges, tenantKey); + List allSalaryEmployees = this.getManageRangeSalaryEmployees(null, taxAgentId, allRanges); taxAgentEmpSaveParamList.add(getTaxAgentEmpSyncParam(taxAgentId, allSalaryEmployees)); List allSubAdminRanges = allManageRanges.stream().filter(f -> f.getTaxAgentId().equals(taxAgentId) && f.getRangeType().equals(TaxAgentRangeTypeEnum.SUBADMIN.getValue())).collect(Collectors.toList()); - subAdminEmpSaveParamList.addAll(getTaxAgentSubAdminEmpSyncParam(taxAgentId, allSubAdminRanges, tenantKey)); + subAdminEmpSaveParamList.addAll(getTaxAgentSubAdminEmpSyncParam(taxAgentId, allSubAdminRanges)); }); Long employeeId = 0L; // 同步管理员的人员 - taxAgentEmployeeService.syncTaxAgentEmployee(taxAgentEmpSaveParamList, employeeId, tenantKey); + taxAgentEmployeeService.syncTaxAgentEmployee(taxAgentEmpSaveParamList, employeeId); // 同步分管理员的人员 - taxAgentSubAdminEmployeeService.syncTaxAgentSubAdminEmployee(subAdminEmpSaveParamList, employeeId, tenantKey); + taxAgentSubAdminEmployeeService.syncTaxAgentSubAdminEmployee(subAdminEmpSaveParamList, employeeId); } /** @@ -672,7 +630,7 @@ public class TaxAgentManageRangeServiceImpl extends Service implements TaxAgentM * @param allSalaryEmployees * @return */ - private TaxAgentEmpSaveParam getTaxAgentEmpSyncParam(Long taxAgentId, List allSalaryEmployees) { + private TaxAgentEmpSaveParam getTaxAgentEmpSyncParam(Long taxAgentId, List allSalaryEmployees) { return TaxAgentEmpSaveParam.builder() .taxAgentId(taxAgentId) .salaryEmployeeList(allSalaryEmployees) @@ -684,15 +642,14 @@ public class TaxAgentManageRangeServiceImpl extends Service implements TaxAgentM * * @param taxAgentId * @param allSubAdminRanges - * @param tenantKey * @return */ - private List getTaxAgentSubAdminEmpSyncParam(Long taxAgentId, List allSubAdminRanges, String tenantKey) { + private List getTaxAgentSubAdminEmpSyncParam(Long taxAgentId, List allSubAdminRanges) { List allSubAdminIds = allSubAdminRanges.stream().map(TaxAgentManageRangePO::getTaxAgentSubAdminId).distinct().collect(Collectors.toList()); List subAdminEmpSaveParamList = Lists.newArrayList(); allSubAdminIds.forEach(e -> { List singSubAdminRanges = allSubAdminRanges.stream().filter(r -> e.equals(r.getTaxAgentSubAdminId())).collect(Collectors.toList()); - List subAdminSalaryEmployees = this.getManageRangeSalaryEmployees(null, taxAgentId, singSubAdminRanges, tenantKey); + List subAdminSalaryEmployees = this.getManageRangeSalaryEmployees(null, taxAgentId, singSubAdminRanges); subAdminEmpSaveParamList.add(TaxAgentSubAdminEmpSaveParam.builder() .taxAgentId(taxAgentId) @@ -710,15 +667,14 @@ public class TaxAgentManageRangeServiceImpl extends Service implements TaxAgentM * @param allSalaryEmployees 个税扣缴义务人下的所有人员 * @param allSubAdminRanges * @param employeeId - * @param tenantKey */ - private void syncLocalEmp(Long taxAgentId, List allSalaryEmployees, List allSubAdminRanges, Long employeeId, String tenantKey) { + private void syncLocalEmp(Long taxAgentId, List allSalaryEmployees, List allSubAdminRanges, Long employeeId) { List taxAgentEmpSaveParamList = Collections.singletonList(getTaxAgentEmpSyncParam(taxAgentId, allSalaryEmployees)); // 同步个税扣缴义务人的人员 - taxAgentEmployeeService.syncTaxAgentEmployee(taxAgentEmpSaveParamList, employeeId, tenantKey); + taxAgentEmployeeService.syncTaxAgentEmployee(taxAgentEmpSaveParamList, employeeId); - List subAdminEmpSaveParamList = getTaxAgentSubAdminEmpSyncParam(taxAgentId, allSubAdminRanges, tenantKey); + List subAdminEmpSaveParamList = getTaxAgentSubAdminEmpSyncParam(taxAgentId, allSubAdminRanges); // 同步分管理员的人员 - taxAgentSubAdminEmployeeService.syncTaxAgentSubAdminEmployee(subAdminEmpSaveParamList, employeeId, tenantKey); + taxAgentSubAdminEmployeeService.syncTaxAgentSubAdminEmployee(subAdminEmpSaveParamList, employeeId); } } diff --git a/src/com/engine/salary/service/impl/TaxAgentV2ServiceImpl.java b/src/com/engine/salary/service/impl/TaxAgentV2ServiceImpl.java index 683812390..60da8280f 100644 --- a/src/com/engine/salary/service/impl/TaxAgentV2ServiceImpl.java +++ b/src/com/engine/salary/service/impl/TaxAgentV2ServiceImpl.java @@ -50,7 +50,6 @@ public class TaxAgentV2ServiceImpl extends Service implements TaxAgentV2Service private EmployMapper employMapper; -// // private ExtEmployeeService extEmployeeService; private TaxAgentBaseService taxAgentBaseService; @@ -261,11 +260,11 @@ public class TaxAgentV2ServiceImpl extends Service implements TaxAgentV2Service return StringUtils.EMPTY + taxAgent.getId(); } -// @Override -// public String paymentAgencyUpdate(TaxAgentPO taxAgentPO, Long employeeId) { -// taxAgentMapper.updateById(taxAgentPO); -// return ""; -// } + @Override + public String paymentAgencyUpdate(TaxAgentPO taxAgentPO) { + taxAgentMapper.update(taxAgentPO); + return ""; + } @Override @Transactional(rollbackFor = Exception.class) diff --git a/src/com/engine/salary/util/page/PageUtil.java b/src/com/engine/salary/util/page/PageUtil.java index ab4aa5314..5bea08831 100644 --- a/src/com/engine/salary/util/page/PageUtil.java +++ b/src/com/engine/salary/util/page/PageUtil.java @@ -1,6 +1,5 @@ package com.engine.salary.util.page; -import com.github.pagehelper.Page; import com.github.pagehelper.PageHelper; import org.apache.commons.collections4.CollectionUtils; @@ -17,10 +16,22 @@ public class PageUtil { } - public static Page buildPage(Integer pageNo, Integer pageSize) { + public static PageInfo buildPage(Integer pageNo, Integer pageSize) { pageNo = pageNo == null || pageNo <= 0 ? 1 : pageNo; pageSize = pageSize == null || pageSize <= 0 ? 10 : pageSize; - return new Page(pageNo, pageSize, true); + PageInfo pageInfo = new PageInfo<>(); + pageInfo.setPageNum(pageNo); + pageInfo.setPageSize(pageSize); + return pageInfo; + } + + public static PageInfo buildPage(Integer pageNo, Integer pageSize,Class clazz) { + pageNo = pageNo == null || pageNo <= 0 ? 1 : pageNo; + pageSize = pageSize == null || pageSize <= 0 ? 10 : pageSize; + PageInfo pageInfo = new PageInfo<>(clazz); + pageInfo.setPageNum(pageNo); + pageInfo.setPageSize(pageSize); + return pageInfo; } /** diff --git a/src/com/engine/salary/wrapper/TaxAgentWrapper.java b/src/com/engine/salary/wrapper/TaxAgentWrapper.java index ebd2fe737..c050a9f33 100644 --- a/src/com/engine/salary/wrapper/TaxAgentWrapper.java +++ b/src/com/engine/salary/wrapper/TaxAgentWrapper.java @@ -1,38 +1,38 @@ package com.engine.salary.wrapper; -import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; +import com.cloudstore.eccom.pc.table.WeaTable; +import com.cloudstore.eccom.result.WeaResultMsg; +import com.engine.salary.entity.agency.po.PaymentAgencyPO; +import com.engine.salary.entity.datacollection.DataCollectionEmployee; +import com.engine.salary.entity.taxagent.bo.TaxAgentBO; +import com.engine.salary.entity.taxagent.dto.TaxAgentManageRangeListDTO; +import com.engine.salary.entity.taxagent.param.TaxAgentAdminChangeCheckParam; import com.engine.salary.entity.taxagent.param.TaxAgentQueryParam; +import com.engine.salary.entity.taxagent.param.TaxAgentRangeQueryParam; +import com.engine.salary.entity.taxagent.param.TaxAgentSaveParam; import com.engine.salary.entity.taxagent.po.TaxAgentAdminPO; import com.engine.salary.entity.taxagent.po.TaxAgentPO; -import com.engine.salary.service.TaxAgentAdminService; -import com.engine.salary.service.TaxAgentBaseService; -import com.engine.salary.service.TaxAgentManageRangeService; -import com.engine.salary.service.TaxAgentV2Service; +import com.engine.salary.service.*; +import com.engine.salary.util.SalaryAssert; +import com.engine.salary.util.SalaryI18nUtil; import com.engine.salary.util.page.PageInfo; +import com.engine.salary.util.page.PageUtil; import com.google.common.collect.Maps; import com.weaver.common.authority.format.FormatManager; import com.weaver.common.component.browser.combination.TypesBrowserOption; import com.weaver.common.component.form.WeaForm; import com.weaver.common.component.form.item.WeaFormItem; import com.weaver.common.component.form.item.WeaFormOption; -import com.weaver.common.component.table.WeaTable; import com.weaver.common.component.table.page.Page; import com.weaver.common.hrm.domain.employee.HrmStatus; import com.weaver.framework.util.JsonUtil; -import com.weaver.hrm.salary.entity.agency.po.PaymentAgencyPO; -import com.weaver.hrm.salary.entity.siarchives.po.InsuranceEmployeeStatusPO; -import com.weaver.hrm.salary.entity.taxagent.bo.TaxAgentBO; import com.weaver.hrm.salary.entity.taxagent.dto.TaxAgentEmployeeOptionDTO; import com.weaver.hrm.salary.entity.taxagent.dto.TaxAgentFormDTO; import com.weaver.hrm.salary.entity.taxagent.dto.TaxAgentManageRangeFormDTO; -import com.weaver.hrm.salary.entity.taxagent.dto.TaxAgentManageRangeListDTO; import com.weaver.hrm.salary.entity.taxagent.param.*; import com.weaver.hrm.salary.exception.SalaryRunTimeException; import com.weaver.hrm.salary.service.*; -import com.weaver.hrm.salary.util.SalaryAssert; import com.weaver.hrm.salary.util.SalaryFormatUtil; -import com.weaver.hrm.salary.util.SalaryI18nUtil; -import com.weaver.hrm.salary.util.SalaryPageUtil; import com.weaver.teams.domain.user.SimpleEmployee; import com.weaver.teams.security.context.UserContext; import org.apache.commons.collections.CollectionUtils; @@ -60,7 +60,7 @@ public class TaxAgentWrapper { private TaxAgentV2Service taxAgentService; - private HrmCommonEmployeeService employeeService; + private SalaryEmployeeService employeeService; private TaxAgentManageRangeService taxAgentManageRangeService; @@ -106,7 +106,7 @@ public class TaxAgentWrapper { * @param currentEmployeeId * @return */ - public WeaTable list(TaxAgentQueryParam queryParam, Long currentEmployeeId) { + public Map list(TaxAgentQueryParam queryParam, Long currentEmployeeId) { // 是否是总管理员 Boolean isChief = taxAgentService.isChief(currentEmployeeId); // 是否开启分权 @@ -122,46 +122,54 @@ public class TaxAgentWrapper { if (isOpenDevolution) { List list = taxAgentService.list(queryParam); // 1.判断自己是否是管理员, 如果是管理员,就是能够操作所属个税扣缴义务人下的所有人的数据 - List taxAgentAdminList = taxAgentAdminService.listByTaxAgentIdsAndEmployeeId(list.stream().map(TaxAgentPO::getId).collect(Collectors.toList()), - currentEmployeeId); + List taxAgentAdminList = taxAgentAdminService.listByTaxAgentIdsAndEmployeeId(list.stream().map(TaxAgentPO::getId).collect(Collectors.toList()), currentEmployeeId); // 是管理员的列表 List adminTaxAgentIds = taxAgentAdminList.stream().map(TaxAgentAdminPO::getTaxAgentId).collect(Collectors.toList()); - // 分页参数 - Page dtoPage = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize()); list = list.stream().filter(f -> adminTaxAgentIds.contains(f.getId())).collect(Collectors.toList()); + // 分页参数 // 填充总数和当页数据 + PageInfo dtoPage = PageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize()); dtoPage.setTotal(list.size()); - dtoPage.setRecords(SalaryPageUtil.subList((int) dtoPage.getCurrent(), (int) dtoPage.getSize(), list)); + dtoPage.setList(PageUtil.subList(dtoPage.getPageNum(), dtoPage.getSize(), list)); page = dtoPage; } } - Page> listPage = new Page<>(page.getCurrent(), page.getSize(), page.getTotal(), page.isSearchCount()); + PageInfo> listPage = new PageInfo<>(); - String setLabel = SalaryI18nUtil.getI18nLabel(currentTenantKey, currentEmployeeId, 94614, "设置"); + String setLabel = SalaryI18nUtil.getI18nLabel(94614, "设置"); if (isOpenDevolution) { - List taxAgentIds = page.getRecords().stream().map(TaxAgentPO::getId).collect(Collectors.toList()); + List list = page.getList(); + List taxAgentIds = list.stream().map(TaxAgentPO::getId).collect(Collectors.toList()); List taxAgentAdmins = taxAgentAdminService.listByTaxAgentIds(taxAgentIds); - List adminList = employeeService.getEmployeeByIds(taxAgentAdmins.stream().map(TaxAgentAdminPO::getEmployeeId).distinct().collect(Collectors.toList()), - currentTenantKey); - listPage.setRecords(TaxAgentBO.convertToTableListDTO(page.getRecords(), paymentAgencyPOS, taxAgentAdmins, adminList, setLabel)); + List adminList = employeeService.listByIds(taxAgentAdmins.stream().map(TaxAgentAdminPO::getEmployeeId).distinct().collect(Collectors.toList())); + listPage.setList(TaxAgentBO.convertToTableListDTO(page.getList(), null, taxAgentAdmins, adminList, setLabel)); } else { - listPage.setRecords(TaxAgentBO.convertToTableListDTO(page.getRecords(), paymentAgencyPOS, setLabel)); + listPage.setList(TaxAgentBO.convertToTableListDTO(page.getList(), null, setLabel)); } - WeaTable weaTable = FormatManager.getInstance().genTable(LinkedHashMap.class, listPage); + //构造表格 - TaxAgentBO.buildTaxAgentTable(weaTable, isOpenDevolution, currentEmployeeId, listPage.getRecords().size()); + WeaTable weaTable =new WeaTable(); + TaxAgentBO.buildTaxAgentTable(weaTable, isOpenDevolution); if (isChief) { // 在外展示操作按钮 - weaTable.getOperates().get(0).setOuter(Boolean.TRUE); +// weaTable.getOperates().get(0).setOuter(Boolean.TRUE); } else { // 去掉增删改权限 - weaTable.getOperates().clear(); - weaTable.getCheckBoxPermission().clear(); + weaTable.getOperates().getOperate().clear(); +// weaTable.getCheckBoxPermission().clear(); } - weaTable.setModule("hrmsalary"); - return weaTable; + WeaResultMsg result = new WeaResultMsg(false); + result.putAll(weaTable.makeDataResult()); + result.success(); + + Map datas = new HashMap<>(); + datas.put("pageInfo", listPage); + datas.put("dataKey", result.getResultMap()); + + return datas; + } public List> paymentAgencyList(TaxAgentQueryParam queryParam, Long currentEmployeeId) { @@ -173,42 +181,42 @@ public class TaxAgentWrapper { } public String paymentAgencySave(TaxAgentSaveParam param, Long currentEmploueeId) { - List taxAgentPOS = taxAgentService.listByIds(Collections.singletonList(param.getId())); - SalaryAssert.notEmpty(taxAgentPOS, "data is not exist"); - TaxAgentPO taxAgentPO = taxAgentPOS.get(0); - List errorList = new ArrayList<>(); - List resultList = new ArrayList<>(); - if (StringUtils.isNotBlank(taxAgentPO.getPaymentAgency())) { - List originList = new ArrayList<>(Arrays.asList(taxAgentPO.getPaymentAgency().split(","))); - List list = new ArrayList<>(Arrays.asList(param.getPaymentAgency().split(","))); - originList.removeAll(list); - if (CollectionUtils.isNotEmpty(originList)) { - originList.stream().forEach(e -> { - List employeeStatusPOS = new LambdaQueryChainWrapper<>(siEmployeeStatusMapper) - .eq(InsuranceEmployeeStatusPO::getTenantKey) - .eq(InsuranceEmployeeStatusPO::getPaymentAgency, Long.valueOf(e)) - .eq(InsuranceEmployeeStatusPO::getPaymentOrganization, param.getId()) - .list(); - if (CollectionUtils.isNotEmpty(employeeStatusPOS)) { - errorList.add(e); - } - }); - } - if (CollectionUtils.isNotEmpty(errorList)) { - List paymentAgencyPOS = paymentAgencyService.listAll(currentTenantKey); - errorList.forEach(e -> { - Optional optionalPaymentAgencyPO = paymentAgencyPOS.stream().filter(po -> Objects.equals(e, String.valueOf(po.getId()))).findFirst(); - optionalPaymentAgencyPO.ifPresent(paymentAgencyPO -> resultList.add(paymentAgencyPO.getAgencyName())); - }); - } - } - if (CollectionUtils.isNotEmpty(resultList)) { - return SalaryI18nUtil.getI18nLabel(currentTenantKey, currentEmploueeId, 115128, "有员工在") + String.join(",", resultList) + SalaryI18nUtil.getI18nLabel(currentTenantKey, - currentEmploueeId, 115129, "缴纳社保福利,不可取消关联"); - } else { - taxAgentPO.setPaymentAgency(param.getPaymentAgency()); - taxAgentService.paymentAgencyUpdate(taxAgentPO, currentEmploueeId); - } +// List taxAgentPOS = taxAgentService.listByIds(Collections.singletonList(param.getId())); +// SalaryAssert.notEmpty(taxAgentPOS, "data is not exist"); +// TaxAgentPO taxAgentPO = taxAgentPOS.get(0); +// List errorList = new ArrayList<>(); +// List resultList = new ArrayList<>(); +// if (StringUtils.isNotBlank(taxAgentPO.getPaymentAgency())) { +// List originList = new ArrayList<>(Arrays.asList(taxAgentPO.getPaymentAgency().split(","))); +// List list = new ArrayList<>(Arrays.asList(param.getPaymentAgency().split(","))); +// originList.removeAll(list); +// if (CollectionUtils.isNotEmpty(originList)) { +// originList.stream().forEach(e -> { +// List employeeStatusPOS = new LambdaQueryChainWrapper<>(siEmployeeStatusMapper) +// .eq(InsuranceEmployeeStatusPO::getTenantKey) +// .eq(InsuranceEmployeeStatusPO::getPaymentAgency, Long.valueOf(e)) +// .eq(InsuranceEmployeeStatusPO::getPaymentOrganization, param.getId()) +// .list(); +// if (CollectionUtils.isNotEmpty(employeeStatusPOS)) { +// errorList.add(e); +// } +// }); +// } +// if (CollectionUtils.isNotEmpty(errorList)) { +// List paymentAgencyPOS = paymentAgencyService.listAll(currentTenantKey); +// errorList.forEach(e -> { +// Optional optionalPaymentAgencyPO = paymentAgencyPOS.stream().filter(po -> Objects.equals(e, String.valueOf(po.getId()))).findFirst(); +// optionalPaymentAgencyPO.ifPresent(paymentAgencyPO -> resultList.add(paymentAgencyPO.getAgencyName())); +// }); +// } +// } +// if (CollectionUtils.isNotEmpty(resultList)) { +// return SalaryI18nUtil.getI18nLabel(currentTenantKey, currentEmploueeId, 115128, "有员工在") + String.join(",", resultList) + SalaryI18nUtil.getI18nLabel(currentTenantKey, +// currentEmploueeId, 115129, "缴纳社保福利,不可取消关联"); +// } else { +// taxAgentPO.setPaymentAgency(param.getPaymentAgency()); +// taxAgentService.paymentAgencyUpdate(taxAgentPO, currentEmploueeId); +// } return ""; } @@ -217,7 +225,6 @@ public class TaxAgentWrapper { * * @param id * @param currentEmployeeId - * @param currentTenantKey * @return */ public WeaForm getFrom(Long id, Long currentEmployeeId) { @@ -271,7 +278,6 @@ public class TaxAgentWrapper { * * @param saveParam * @param currentEmployeeId - * @param currentTenantKey * @return */ public String save(TaxAgentSaveParam saveParam, Long currentEmployeeId) { @@ -283,7 +289,6 @@ public class TaxAgentWrapper { * * @param saveParam * @param currentEmployeeId - * @param currentTenantKey * @return */ public String update(TaxAgentSaveParam saveParam, Long currentEmployeeId) { @@ -295,7 +300,6 @@ public class TaxAgentWrapper { * * @param checkParam * @param currentEmployeeId - * @param currentTenantKey * @return */ public Boolean adminChangeCheck(TaxAgentAdminChangeCheckParam checkParam, Long currentEmployeeId) { @@ -307,7 +311,6 @@ public class TaxAgentWrapper { * * @param ids * @param currentEmployeeId - * @param currentTenantKey * @return */ public String delete(Collection ids, Long currentEmployeeId) { @@ -318,7 +321,6 @@ public class TaxAgentWrapper { * 个税扣缴义务人下拉列表 * * @param currentEmployeeId - * @param currentTenantKey * @return */ public List> selectList(Long currentEmployeeId) { @@ -333,8 +335,8 @@ public class TaxAgentWrapper { * @param tenantKey * @return */ - public WeaTable listRangeInclude(TaxAgentRangeQueryParam queryParam, Long employeeId, String tenantKey) { - Page listPage = taxAgentManageRangeService.listPageByParamAndIncludeType(queryParam, NumberUtils.INTEGER_ONE, tenantKey); + public PageInfo listRangeInclude(TaxAgentRangeQueryParam queryParam) { + PageInfo listPage = taxAgentManageRangeService.listPageByParamAndIncludeType(queryParam, NumberUtils.INTEGER_ONE); WeaTable weaTable = SalaryFormatUtil.getInstance().buildTable(TaxAgentManageRangeListDTO.class, listPage); weaTable.setModule("hrmsalary"); weaTable.setPageUid("taxAgentRangeIncludeList"); From ac934c901caa9b53d586769872a83a42f7328e54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=92=B1=E6=B6=9B?= <15850646081@163.com> Date: Thu, 19 May 2022 16:56:57 +0800 Subject: [PATCH 04/20] =?UTF-8?q?=E6=9A=82=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../entity/taxagent/po/TaxAgentManageRangePO.java | 1 + .../mapper/taxagent/TaxAgentManageRangeMapper.xml | 14 +++++++++++++- .../impl/TaxAgentManageRangeServiceImpl.java | 9 +-------- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/com/engine/salary/entity/taxagent/po/TaxAgentManageRangePO.java b/src/com/engine/salary/entity/taxagent/po/TaxAgentManageRangePO.java index 815ba6d22..e34ffef53 100644 --- a/src/com/engine/salary/entity/taxagent/po/TaxAgentManageRangePO.java +++ b/src/com/engine/salary/entity/taxagent/po/TaxAgentManageRangePO.java @@ -95,4 +95,5 @@ public class TaxAgentManageRangePO { private Collection taxAgentIds; private Collection ids; + private Collection taxAgentSubAdminIds; } diff --git a/src/com/engine/salary/mapper/taxagent/TaxAgentManageRangeMapper.xml b/src/com/engine/salary/mapper/taxagent/TaxAgentManageRangeMapper.xml index d4497453e..b5de0a9e8 100644 --- a/src/com/engine/salary/mapper/taxagent/TaxAgentManageRangeMapper.xml +++ b/src/com/engine/salary/mapper/taxagent/TaxAgentManageRangeMapper.xml @@ -100,12 +100,24 @@ AND update_time = #{updateTime} - + AND tax_agent_id IN #{taxAgentId} + + AND id IN + + #{id} + + + + AND tax_agent_sub_admin_id IN + + #{taxAgentSubAdminId} + + ORDER BY id DESC diff --git a/src/com/engine/salary/service/impl/TaxAgentManageRangeServiceImpl.java b/src/com/engine/salary/service/impl/TaxAgentManageRangeServiceImpl.java index 1dea5e269..922ea07e6 100644 --- a/src/com/engine/salary/service/impl/TaxAgentManageRangeServiceImpl.java +++ b/src/com/engine/salary/service/impl/TaxAgentManageRangeServiceImpl.java @@ -101,14 +101,7 @@ public class TaxAgentManageRangeServiceImpl extends Service implements TaxAgentM if (CollectionUtils.isEmpty(taxAgentSubAdminIds)) { return Lists.newArrayList(); } - taxAgentManageRangeMapper.listSome(TaxAgentManageRangePO.builder().rangeType(TaxAgentRangeTypeEnum.SUBADMIN.getValue()).build()) - return new LambdaQueryChainWrapper<>(taxAgentManageRangeMapper) - .eq(TaxAgentManageRangePO::getTenantKey) - .eq(TaxAgentManageRangePO::getDeleteType, 0) - .eq(TaxAgentManageRangePO::getRangeType, TaxAgentRangeTypeEnum.SUBADMIN.getValue()) - .in(TaxAgentManageRangePO::getTaxAgentSubAdminId, taxAgentSubAdminIds) - .orderByDesc(TaxAgentManageRangePO::getId) - .list(); + return taxAgentManageRangeMapper.listSome(TaxAgentManageRangePO.builder().rangeType(TaxAgentRangeTypeEnum.SUBADMIN.getValue()).taxAgentSubAdminIds(taxAgentSubAdminIds).build()); } @Override From 49cd388df101c96030d31b1115cbe0cd362638cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=92=B1=E6=B6=9B?= <15850646081@163.com> Date: Fri, 20 May 2022 15:58:58 +0800 Subject: [PATCH 05/20] =?UTF-8?q?=E6=9A=82=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/TaxAgentEmployeeOptionDTO.java | 13 ++-- .../entity/taxagent/dto/TaxAgentFormDTO.java | 39 +++------- .../dto/TaxAgentManageRangeListDTO.java | 5 +- .../engine/salary/enums/UserStatusEnum.java | 20 +++-- .../salary/wrapper/TaxAgentWrapper.java | 75 ++++++------------- 5 files changed, 55 insertions(+), 97 deletions(-) diff --git a/src/com/engine/salary/entity/taxagent/dto/TaxAgentEmployeeOptionDTO.java b/src/com/engine/salary/entity/taxagent/dto/TaxAgentEmployeeOptionDTO.java index 9ed1d2b4f..3a1264cff 100644 --- a/src/com/engine/salary/entity/taxagent/dto/TaxAgentEmployeeOptionDTO.java +++ b/src/com/engine/salary/entity/taxagent/dto/TaxAgentEmployeeOptionDTO.java @@ -1,21 +1,22 @@ package com.engine.salary.entity.taxagent.dto; -import io.swagger.annotations.ApiModel; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; /** - * @Description: 个税扣缴义务人人员选项 - * @Author: wangxiangzhong - * @Date: 2022/3/28 17:30 - */ + * 个税扣缴义务人人员选项 + *

Copyright: Copyright (c) 2022

+ *

Company: 泛微软件

+ * + * @author qiantao + * @version 1.0 + **/ @Data @Builder @NoArgsConstructor @AllArgsConstructor -@ApiModel("个税扣缴义务人人员选项") public class TaxAgentEmployeeOptionDTO { private Long id; diff --git a/src/com/engine/salary/entity/taxagent/dto/TaxAgentFormDTO.java b/src/com/engine/salary/entity/taxagent/dto/TaxAgentFormDTO.java index d9961282a..959a3c7e0 100644 --- a/src/com/engine/salary/entity/taxagent/dto/TaxAgentFormDTO.java +++ b/src/com/engine/salary/entity/taxagent/dto/TaxAgentFormDTO.java @@ -1,10 +1,5 @@ package com.engine.salary.entity.taxagent.dto; -import com.weaver.common.authority.format.Form; -import com.weaver.common.authority.format.WeaFormat; -import com.weaver.common.component.form.item.WeaFormItemType; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; @@ -13,41 +8,27 @@ import lombok.NoArgsConstructor; import java.util.List; /** - * @Description: 个税扣缴义务人表单 - * @Author: wangxiangzhong - * @Date: 2021/10/29 16:12 - */ + * 个税扣缴义务人表单 + *

Copyright: Copyright (c) 2022

+ *

Company: 泛微软件

+ * + * @author qiantao + * @version 1.0 + **/ @Data @Builder @NoArgsConstructor @AllArgsConstructor -@ApiModel("个税扣缴义务人表单") public class TaxAgentFormDTO { - @ApiModelProperty("主键id") private Long id; - @WeaFormat( - label = "名称", - labelId = 1252, - from = @Form(itemType = WeaFormItemType.INPUT, required = true, maxLength = "20") - ) - @ApiModelProperty("名称") + //名称 private String name; - @WeaFormat( - label = "管理员", - labelId = 106259, - from = @Form(itemType = WeaFormItemType.BROWSER, required = true, browserModule = "hrmsalary", browserType = "resource") - ) - @ApiModelProperty("管理员") + //管理员 private List adminUser; - @WeaFormat( - label = "备注", - labelId = 84961, - from = @Form(itemType = WeaFormItemType.INPUT, maxLength = "20") - ) - @ApiModelProperty("备注") + //备注 private String description; } diff --git a/src/com/engine/salary/entity/taxagent/dto/TaxAgentManageRangeListDTO.java b/src/com/engine/salary/entity/taxagent/dto/TaxAgentManageRangeListDTO.java index 30842d62e..eb858a077 100644 --- a/src/com/engine/salary/entity/taxagent/dto/TaxAgentManageRangeListDTO.java +++ b/src/com/engine/salary/entity/taxagent/dto/TaxAgentManageRangeListDTO.java @@ -1,6 +1,7 @@ package com.engine.salary.entity.taxagent.dto; import com.engine.salary.annotation.SalaryTableColumn; +import com.engine.salary.annotation.TableTitle; import com.engine.salary.enums.salarysob.TargetTypeEnum; import lombok.AllArgsConstructor; import lombok.Builder; @@ -34,6 +35,7 @@ public class TaxAgentManageRangeListDTO { column="targetTypeName" ) //对象类型") + @TableTitle(title ="对象类型",key = "targetTypeName",dataIndex = "targetTypeName") private String targetTypeName; @SalaryTableColumn( @@ -42,7 +44,7 @@ public class TaxAgentManageRangeListDTO { width = "30%", column="targetName" ) - //对象") + @TableTitle(title ="对象",key = "targetName",dataIndex = "targetName") private String targetName; //对象id") @@ -54,5 +56,6 @@ public class TaxAgentManageRangeListDTO { width = "30%", column="employeeStatus" ) + @TableTitle(title ="员工状态",key = "employeeStatus",dataIndex = "employeeStatus") private String employeeStatus; } diff --git a/src/com/engine/salary/enums/UserStatusEnum.java b/src/com/engine/salary/enums/UserStatusEnum.java index e21fdf1cb..ac209eb22 100644 --- a/src/com/engine/salary/enums/UserStatusEnum.java +++ b/src/com/engine/salary/enums/UserStatusEnum.java @@ -51,12 +51,14 @@ public enum UserStatusEnum { } public static List> getList() { - return Arrays.stream(UserStatusEnum.values()).map(v -> { - Map m = new HashMap(); - m.put("id", v.value.toString()); - m.put("content", v.description); - return m; - }).collect(Collectors.toList()); + return Arrays.stream(UserStatusEnum.values()) + .filter(v -> v != INVALID) + .map(v -> { + Map m = new HashMap(); + m.put("id", v.value.toString()); + m.put("content", v.description); + return m; + }).collect(Collectors.toList()); } /** @@ -69,7 +71,7 @@ public enum UserStatusEnum { } /** - * 在职状态 + * 离职状态 * * @return */ @@ -77,5 +79,9 @@ public enum UserStatusEnum { return Arrays.asList(FIRE.getValue().toString(), DEPARTURE.getValue().toString(), RETIRED.getValue().toString()); } + public static List getEffectiveList() { + return Arrays.stream(UserStatusEnum.values()).filter(v -> v != INVALID).collect(Collectors.toList()); + } + } diff --git a/src/com/engine/salary/wrapper/TaxAgentWrapper.java b/src/com/engine/salary/wrapper/TaxAgentWrapper.java index c050a9f33..b8a3e46f2 100644 --- a/src/com/engine/salary/wrapper/TaxAgentWrapper.java +++ b/src/com/engine/salary/wrapper/TaxAgentWrapper.java @@ -5,6 +5,8 @@ import com.cloudstore.eccom.result.WeaResultMsg; import com.engine.salary.entity.agency.po.PaymentAgencyPO; import com.engine.salary.entity.datacollection.DataCollectionEmployee; import com.engine.salary.entity.taxagent.bo.TaxAgentBO; +import com.engine.salary.entity.taxagent.dto.TaxAgentEmployeeOptionDTO; +import com.engine.salary.entity.taxagent.dto.TaxAgentFormDTO; import com.engine.salary.entity.taxagent.dto.TaxAgentManageRangeListDTO; import com.engine.salary.entity.taxagent.param.TaxAgentAdminChangeCheckParam; import com.engine.salary.entity.taxagent.param.TaxAgentQueryParam; @@ -12,28 +14,22 @@ import com.engine.salary.entity.taxagent.param.TaxAgentRangeQueryParam; import com.engine.salary.entity.taxagent.param.TaxAgentSaveParam; import com.engine.salary.entity.taxagent.po.TaxAgentAdminPO; import com.engine.salary.entity.taxagent.po.TaxAgentPO; +import com.engine.salary.enums.UserStatusEnum; +import com.engine.salary.exception.SalaryRunTimeException; import com.engine.salary.service.*; import com.engine.salary.util.SalaryAssert; import com.engine.salary.util.SalaryI18nUtil; import com.engine.salary.util.page.PageInfo; import com.engine.salary.util.page.PageUtil; import com.google.common.collect.Maps; -import com.weaver.common.authority.format.FormatManager; import com.weaver.common.component.browser.combination.TypesBrowserOption; import com.weaver.common.component.form.WeaForm; -import com.weaver.common.component.form.item.WeaFormItem; import com.weaver.common.component.form.item.WeaFormOption; -import com.weaver.common.component.table.page.Page; import com.weaver.common.hrm.domain.employee.HrmStatus; -import com.weaver.framework.util.JsonUtil; -import com.weaver.hrm.salary.entity.taxagent.dto.TaxAgentEmployeeOptionDTO; -import com.weaver.hrm.salary.entity.taxagent.dto.TaxAgentFormDTO; import com.weaver.hrm.salary.entity.taxagent.dto.TaxAgentManageRangeFormDTO; import com.weaver.hrm.salary.entity.taxagent.param.*; -import com.weaver.hrm.salary.exception.SalaryRunTimeException; import com.weaver.hrm.salary.service.*; import com.weaver.hrm.salary.util.SalaryFormatUtil; -import com.weaver.teams.domain.user.SimpleEmployee; import com.weaver.teams.security.context.UserContext; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.StringUtils; @@ -106,7 +102,7 @@ public class TaxAgentWrapper { * @param currentEmployeeId * @return */ - public Map list(TaxAgentQueryParam queryParam, Long currentEmployeeId) { + public Map list(TaxAgentQueryParam queryParam, Long currentEmployeeId) { // 是否是总管理员 Boolean isChief = taxAgentService.isChief(currentEmployeeId); // 是否开启分权 @@ -149,7 +145,7 @@ public class TaxAgentWrapper { } //构造表格 - WeaTable weaTable =new WeaTable(); + WeaTable weaTable = new WeaTable(); TaxAgentBO.buildTaxAgentTable(weaTable, isOpenDevolution); if (isChief) { // 在外展示操作按钮 @@ -224,53 +220,34 @@ public class TaxAgentWrapper { * 获取个税扣缴义务人表单 * * @param id - * @param currentEmployeeId * @return */ - public WeaForm getFrom(Long id, Long currentEmployeeId) { + public TaxAgentFormDTO getFrom(Long id) { TaxAgentFormDTO taxAgentFromDTO = new TaxAgentFormDTO(); if (id != null) { TaxAgentPO taxAgent = taxAgentService.getById(id); if (taxAgent == null) { - throw new SalaryRunTimeException(String.format(SalaryI18nUtil.getI18nLabel(currentTenantKey, currentEmployeeId, 100543, "个税扣缴人不存在") + "[id:%s]", id)); + throw new SalaryRunTimeException(String.format(SalaryI18nUtil.getI18nLabel(100543, "个税扣缴人不存在") + "[id:%s]", id)); } BeanUtils.copyProperties(taxAgent, taxAgentFromDTO); } - WeaForm weaForm = FormatManager.getInstance().genForm(TaxAgentFormDTO.class, taxAgentFromDTO); // 是否开启分权 - boolean isOpenDevolution = taxAgentBaseService.isOpenDevolution(currentTenantKey); + boolean isOpenDevolution = taxAgentBaseService.isOpenDevolution(); if (isOpenDevolution) { List admins = taxAgentAdminService.listByTaxAgentIds(Collections.singletonList(id)); // 目前是一个 TaxAgentEmployeeOptionDTO taxAgentEmployee = new TaxAgentEmployeeOptionDTO(); taxAgentEmployee.setId(CollectionUtils.isEmpty(admins) ? null : admins.get(0).getEmployeeId()); if (taxAgentEmployee.getId() != null) { - SimpleEmployee employee = employeeService.getEmployeeById(taxAgentEmployee.getId()); + DataCollectionEmployee employee = employeeService.getEmployeeById(taxAgentEmployee.getId()); taxAgentEmployee.setContent(employee == null ? "" : employee.getUsername()); } taxAgentFromDTO.setAdminUser(Collections.singletonList(taxAgentEmployee)); } else { - weaForm.getLayout().remove(1); - weaForm.getItems().remove("adminUser"); taxAgentFromDTO.setAdminUser(null); } - weaForm.setData(JsonUtil.parseMap(taxAgentFromDTO, Object.class)); - WeaFormItem nameItem = weaForm.getItems().get("name"); - Map otherParams = Maps.newHashMap(); - otherParams.put("showCount", true); - otherParams.put("placeholder", SalaryI18nUtil.getI18nLabel(currentTenantKey, currentEmployeeId, 85987, "请输入")); - nameItem.setOtherParams(otherParams); - weaForm.getItems().put("name", nameItem); - - WeaFormItem descriptionItem = weaForm.getItems().get("description"); - otherParams = Maps.newHashMap(); - otherParams.put("showCount", true); - otherParams.put("placeholder", SalaryI18nUtil.getI18nLabel(currentTenantKey, currentEmployeeId, 85987, "请输入")); - descriptionItem.setOtherParams(otherParams); - weaForm.getItems().put("description", descriptionItem); - - return weaForm; + return taxAgentFromDTO; } /** @@ -331,32 +308,22 @@ public class TaxAgentWrapper { * 范围列表 * * @param queryParam - * @param employeeId - * @param tenantKey * @return */ public PageInfo listRangeInclude(TaxAgentRangeQueryParam queryParam) { PageInfo listPage = taxAgentManageRangeService.listPageByParamAndIncludeType(queryParam, NumberUtils.INTEGER_ONE); - WeaTable weaTable = SalaryFormatUtil.getInstance().buildTable(TaxAgentManageRangeListDTO.class, listPage); - weaTable.setModule("hrmsalary"); - weaTable.setPageUid("taxAgentRangeIncludeList"); - return weaTable; + return listPage; } /** * 范围排除列表 * * @param queryParam - * @param employeeId - * @param tenantKey * @return */ - public WeaTable listRangeExclude(TaxAgentRangeQueryParam queryParam, Long employeeId, String tenantKey) { - Page listPage = taxAgentManageRangeService.listPageByParamAndIncludeType(queryParam, NumberUtils.INTEGER_ZERO, tenantKey); - WeaTable weaTable = SalaryFormatUtil.getInstance().buildTable(TaxAgentManageRangeListDTO.class, listPage); - weaTable.setModule("hrmsalary"); - weaTable.setPageUid("taxAgentRangeExcludeList"); - return weaTable; + public PageInfo listRangeExclude(TaxAgentRangeQueryParam queryParam) { + PageInfo listPage = taxAgentManageRangeService.listPageByParamAndIncludeType(queryParam, NumberUtils.INTEGER_ZERO); + return listPage; } /** @@ -364,9 +331,9 @@ public class TaxAgentWrapper { * * @return */ - public WeaForm getRangeFrom(String tenantKey) { + public WeaForm getRangeFrom() { // 查询人员状态 - List hrmStatusList = hrmCommonHrmStatusService.list(tenantKey); + List hrmStatusList = UserStatusEnum.getEffectiveList(); List weaFormOptions = hrmStatusList.stream().map(hrmStatus -> { WeaFormOption weaFormOption = new WeaFormOption(); weaFormOption.setId("" + hrmStatus.getCodeId()); @@ -375,12 +342,12 @@ public class TaxAgentWrapper { }).collect(Collectors.toList()); Long employeeId = UserContext.getCurrentEmployeeId(); List browserOptions = new ArrayList<>(); - browserOptions.add(new TypesBrowserOption("user", SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 1869, "人员"))); - browserOptions.add(new TypesBrowserOption("dept", SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 1250, "部门"))); + browserOptions.add(new TypesBrowserOption("user", SalaryI18nUtil.getI18nLabel(1869, "人员"))); + browserOptions.add(new TypesBrowserOption("dept", SalaryI18nUtil.getI18nLabel(1250, "部门"))); if (hrmConfigSetCache.isSubcompanySupport(tenantKey)) { - browserOptions.add(new TypesBrowserOption("subcompany", SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 107369, "分部"))); + browserOptions.add(new TypesBrowserOption("subcompany", SalaryI18nUtil.getI18nLabel(107369, "分部"))); } - browserOptions.add(new TypesBrowserOption("position", SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 1245, "岗位"))); + browserOptions.add(new TypesBrowserOption("position", SalaryI18nUtil.getI18nLabel(1245, "岗位"))); WeaForm weaForm = SalaryFormatUtil.getInstance().buildForm(TaxAgentManageRangeFormDTO.class, TaxAgentManageRangeFormDTO.builder().targetOptions(browserOptions).build()); weaForm.getItems().forEach((key, value) -> { From cb1a53c649bd612d572ada811fcf028d53af9da2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=92=B1=E6=B6=9B?= <15850646081@163.com> Date: Tue, 24 May 2022 09:14:26 +0800 Subject: [PATCH 06/20] =?UTF-8?q?=E6=9A=82=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- resource/sql/分权.sql | 40 ++ src/com/engine/salary/biz/EmployBiz.java | 24 ++ src/com/engine/salary/biz/SalaryRoleBiz.java | 11 + .../entity/agency/bo/PaymentAgencyBO.java | 36 +- .../agency/dto/PaymentAgencyFormDTO.java | 77 ++-- .../agency/dto/PaymentAgencyListDTO.java | 58 ++- .../entity/agency/po/PaymentAgencyPO.java | 19 +- .../engine/salary/entity/hrm/HrmStatus.java | 16 + .../salary/entity/hrm/SubCompanyInfo.java | 28 ++ .../salary/entity/taxagent/bo/TaxAgentBO.java | 33 +- ...AdjustRecordForFormSearchConditionDTO.java | 198 ++++----- .../dto/TaxAgentAdjustRecordListDTO.java | 272 ++++++------- ...axAgentAdjustRecordSearchConditionDTO.java | 278 ++++++------- .../taxagent/dto/TaxAgentBaseFormDTO.java | 32 +- .../taxagent/dto/TaxAgentEmployeeDTO.java | 20 +- .../dto/TaxAgentEmployeeTaxAgentDTO.java | 17 +- .../entity/taxagent/dto/TaxAgentListDTO.java | 40 +- .../dto/TaxAgentManageRangeFormDTO.java | 46 +-- .../dto/TaxAgentSubAdminBaseFormDTO.java | 34 +- .../taxagent/dto/TaxAgentSubAdminListDTO.java | 50 +-- .../param/TaxAgentAdminChangeCheckParam.java | 3 + .../taxagent/param/TaxAgentSaveParam.java | 2 + .../param/TaxAgentSubAdminBaseFormParam.java | 2 + .../param/TaxAgentSubAdminQueryParam.java | 2 + .../entity/taxagent/po/TaxAgentAdminPO.java | 2 +- .../entity/taxagent/po/TaxAgentBasePO.java | 2 + .../taxagent/po/TaxAgentEmpChangePO.java | 3 + .../entity/taxagent/po/TaxAgentEmpPO.java | 1 + .../taxagent/po/TaxAgentEmployeePO.java | 4 + .../salary/entity/taxagent/po/TaxAgentPO.java | 3 + .../taxagent/po/TaxAgentSubAdminEmpPO.java | 4 + .../taxagent/po/TaxAgentSubAdminPO.java | 4 + .../engine/salary/enums/UserStatusEnum.java | 8 + .../enums/taxagent/TaxAgentRangeTypeEnum.java | 17 +- .../mapper/datacollection/EmployMapper.java | 45 ++- .../mapper/datacollection/EmployMapper.xml | 31 +- .../taxagent/TaxAgentManageRangeMapper.java | 7 +- .../taxagent/TaxAgentManageRangeMapper.xml | 21 + .../salary/service/TaxAgentAdminService.java | 1 - .../service/TaxAgentManageRangeService.java | 9 +- .../service/TaxAgentSubAdminEmpService.java | 3 - .../service/TaxAgentSubAdminService.java | 6 +- .../salary/service/TaxAgentV2Service.java | 15 +- .../impl/TaxAgentAdminServiceImpl.java | 15 +- .../service/impl/TaxAgentBaseServiceImpl.java | 27 +- .../service/impl/TaxAgentEmpServiceImpl.java | 23 +- .../impl/TaxAgentManageRangeServiceImpl.java | 250 ++++++------ .../service/impl/TaxAgentV2ServiceImpl.java | 222 +++++++---- .../engine/salary/web/TaxAgentController.java | 377 ++++++++++++++++-- .../engine/salary/web/TaxRateController.java | 2 - .../salary/wrapper/TaxAgentBaseWrapper.java | 44 ++ .../wrapper/TaxAgentSubAdminWrapper.java | 171 ++++++++ .../salary/wrapper/TaxAgentWrapper.java | 175 ++++---- 53 files changed, 1745 insertions(+), 1085 deletions(-) create mode 100644 src/com/engine/salary/biz/SalaryRoleBiz.java create mode 100644 src/com/engine/salary/entity/hrm/HrmStatus.java create mode 100644 src/com/engine/salary/entity/hrm/SubCompanyInfo.java create mode 100644 src/com/engine/salary/wrapper/TaxAgentBaseWrapper.java create mode 100644 src/com/engine/salary/wrapper/TaxAgentSubAdminWrapper.java diff --git a/resource/sql/分权.sql b/resource/sql/分权.sql index 308137347..00629e0ce 100644 --- a/resource/sql/分权.sql +++ b/resource/sql/分权.sql @@ -87,3 +87,43 @@ CREATE TABLE hrsa_tax_agent_base PRIMARY KEY (id) USING BTREE, INDEX idx_tenant_key(tenant_key) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '个税扣缴义务人基础信息表' ROW_FORMAT = Dynamic; + +DROP TABLE IF EXISTS hrsa_tax_agent_sub_admin; +CREATE TABLE hrsa_tax_agent_sub_admin +( + id bigint(20) NOT NULL COMMENT '主键', + tax_agent_id bigint(20) NOT NULL COMMENT '个税扣缴义务人的主键id', + employee_id bigint(20) NOT NULL COMMENT '人员信息表的主键id', + description varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '描述', + create_time datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + update_time datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP (0) COMMENT '更新时间', + creator bigint(20) NOT NULL DEFAULT 0 COMMENT '创建人', + delete_type int(11) NOT NULL DEFAULT 0 COMMENT '是否已删除。0:未删除、1:已删除', + tenant_key varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '租户ID', + remark text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL, + PRIMARY KEY (id) USING BTREE, + INDEX idx_tenant_key(tenant_key) USING BTREE, + INDEX idx_tax_agent_id(tax_agent_id) USING BTREE, + INDEX idx_employee_id(employee_id) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '个税扣缴义务人分管理员表' ROW_FORMAT = Dynamic; + +DROP TABLE IF EXISTS hrsa_tax_agent_sub_admin_emp; +CREATE TABLE hrsa_tax_agent_sub_admin_emp +( + id bigint(20) NOT NULL COMMENT 'ID', + create_time datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + update_time datetime(0) NULL DEFAULT NULL COMMENT '修改时间', + creator bigint(20) NULL DEFAULT NULL COMMENT '创建人id', + delete_type int(11) NULL DEFAULT 0 COMMENT '是否删除', + tenant_key varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '租户KEY', + tax_agent_id bigint(20) NOT NULL DEFAULT 0 COMMENT '个税扣缴义务人的主键id', + tax_agent_sub_admin_id bigint(20) NOT NULL DEFAULT 0 COMMENT '个税扣缴义务人的分管理员的id', + employee_id bigint(20) NOT NULL DEFAULT 0 COMMENT '人员信息表的主键id', + employee_name varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '人员姓名', + PRIMARY KEY (id) USING BTREE, + INDEX idx_tenant_key(tenant_key) USING BTREE, + INDEX idx_tax_agent(tax_agent_id) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; + +ALTER TABLE hrsa_add_up_deduction ADD COLUMN payment_agency varchar(255) NULL COMMENT '代缴机构' AFTER tenant_key; + diff --git a/src/com/engine/salary/biz/EmployBiz.java b/src/com/engine/salary/biz/EmployBiz.java index 08fdb9ec8..338738087 100644 --- a/src/com/engine/salary/biz/EmployBiz.java +++ b/src/com/engine/salary/biz/EmployBiz.java @@ -1,7 +1,9 @@ package com.engine.salary.biz; import com.engine.salary.entity.datacollection.DataCollectionEmployee; +import com.engine.salary.entity.hrm.DeptInfo; import com.engine.salary.entity.hrm.PositionInfo; +import com.engine.salary.entity.hrm.SubCompanyInfo; import com.engine.salary.entity.salarysob.param.SalarySobRangeEmpQueryParam; import com.engine.salary.mapper.datacollection.EmployMapper; import org.apache.ibatis.session.SqlSession; @@ -93,4 +95,26 @@ public class EmployBiz extends BaseBean { sqlSession.close(); } } + + public List getDeptInfoList(List departmentIds) { + + SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession(); + try { + EmployMapper mapper = sqlSession.getMapper(EmployMapper.class); + return mapper.getDeptInfoList(departmentIds); + } finally { + sqlSession.close(); + } + } + + + public List getSubCompanyInfoList(List subDepartmentIds) { + SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession(); + try { + EmployMapper mapper = sqlSession.getMapper(EmployMapper.class); + return mapper.getSubCompanyInfoList(subDepartmentIds); + } finally { + sqlSession.close(); + } + } } diff --git a/src/com/engine/salary/biz/SalaryRoleBiz.java b/src/com/engine/salary/biz/SalaryRoleBiz.java new file mode 100644 index 000000000..1da78f715 --- /dev/null +++ b/src/com/engine/salary/biz/SalaryRoleBiz.java @@ -0,0 +1,11 @@ +package com.engine.salary.biz; + +import weaver.general.BaseBean; + +public class SalaryRoleBiz { + public String getAllAdminRoleId() { + BaseBean baseBean = new BaseBean(); + String salaryAdminRoleId = baseBean.getPropValue("hrmSalary", "chiefAdminRoleId"); + return salaryAdminRoleId; + } +} diff --git a/src/com/engine/salary/entity/agency/bo/PaymentAgencyBO.java b/src/com/engine/salary/entity/agency/bo/PaymentAgencyBO.java index f16d65f33..0fbe29e78 100644 --- a/src/com/engine/salary/entity/agency/bo/PaymentAgencyBO.java +++ b/src/com/engine/salary/entity/agency/bo/PaymentAgencyBO.java @@ -1,35 +1,27 @@ package com.engine.salary.entity.agency.bo; -import com.baomidou.mybatisplus.core.conditions.Wrapper; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.weaver.common.distribution.genid.IdGenerator; -import com.weaver.hrm.salary.entity.agency.dto.PaymentAgencyFormDTO; -import com.weaver.hrm.salary.entity.agency.dto.PaymentAgencyListDTO; -import com.weaver.hrm.salary.entity.agency.po.PaymentAgencyPO; -import com.weaver.hrm.salary.enums.sicategory.DeleteTypeEnum; +import com.engine.salary.entity.agency.dto.PaymentAgencyFormDTO; +import com.engine.salary.entity.agency.dto.PaymentAgencyListDTO; +import com.engine.salary.entity.agency.po.PaymentAgencyPO; +import com.engine.salary.enums.sicategory.DeleteTypeEnum; +import dm.jdbc.util.IdGenerator; +import org.apache.commons.collections4.CollectionUtils; import java.time.LocalDateTime; import java.util.Collections; import java.util.List; import java.util.stream.Collectors; -/** - * @Description: - * @Author: zhangheng - * @CreateDate: 2022/4/20 20:59 - * @Version: v1.0 - */ + public class PaymentAgencyBO { - public static Wrapper buildPaymentAgencyListWrapper(Long employeeId, String tenantKey) { - LambdaQueryWrapper lambdaQueryWrapper = Wrappers.lambdaQuery(); - lambdaQueryWrapper.eq(PaymentAgencyPO::getTenantKey, tenantKey); - lambdaQueryWrapper.eq(PaymentAgencyPO::getDeleteType, DeleteTypeEnum.NOT_DELETED.getValue()); - lambdaQueryWrapper.orderByDesc(PaymentAgencyPO::getUpdateTime); - return lambdaQueryWrapper; - } +// public static Wrapper buildPaymentAgencyListWrapper(Long employeeId, String tenantKey) { +// LambdaQueryWrapper lambdaQueryWrapper = Wrappers.lambdaQuery(); +// lambdaQueryWrapper.eq(PaymentAgencyPO::getTenantKey, tenantKey); +// lambdaQueryWrapper.eq(PaymentAgencyPO::getDeleteType, DeleteTypeEnum.NOT_DELETED.getValue()); +// lambdaQueryWrapper.orderByDesc(PaymentAgencyPO::getUpdateTime); +// return lambdaQueryWrapper; +// } public static List buildPaymentAgencyDTOList(List paymentAgencyPOS, Long employeeId, String tenantKey) { if (CollectionUtils.isEmpty(paymentAgencyPOS)) { diff --git a/src/com/engine/salary/entity/agency/dto/PaymentAgencyFormDTO.java b/src/com/engine/salary/entity/agency/dto/PaymentAgencyFormDTO.java index 9200d1de8..d6fcbc80d 100644 --- a/src/com/engine/salary/entity/agency/dto/PaymentAgencyFormDTO.java +++ b/src/com/engine/salary/entity/agency/dto/PaymentAgencyFormDTO.java @@ -2,64 +2,57 @@ package com.engine.salary.entity.agency.dto; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; -import com.weaver.common.component.form.item.WeaFormItemType; -import com.weaver.hrm.salary.annotation.SalaryForm; -import com.weaver.hrm.salary.annotation.SalaryFormItem; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.Size; - /** - * @Description: - * @Author: zhangheng - * @CreateDate: 2022/4/20 21:31 - * @Version: v1.0 - */ + * 代缴机构表单 + *

Copyright: Copyright (c) 2022

+ *

Company: 泛微软件

+ * + * @author qiantao + * @version 1.0 + **/ @Data @Builder @NoArgsConstructor @AllArgsConstructor -@ApiModel("代缴机构表单") public class PaymentAgencyFormDTO { - @ApiModelProperty("主键id") + //主键id") @JsonSerialize(using = ToStringSerializer.class) private Long id; - @SalaryForm( - label = "名称", - labelId = 84756, - items = { - @SalaryFormItem( - itemType = WeaFormItemType.INPUT, - required = true, - maxLength = "50" - ) - } - ) - @NotBlank(message = "name is required") - @Size(max = 50, message = "the maximum lenth is 50") - @ApiModelProperty("名称") +// @SalaryForm( +// label = "名称", +// labelId = 84756, +// items = { +// @SalaryFormItem( +// itemType = WeaFormItemType.INPUT, +// required = true, +// maxLength = "50" +// ) +// } +// ) +// @NotBlank(message = "name is required") +// @Size(max = 50, message = "the maximum lenth is 50") +// //名称") private String agencyName; - @SalaryForm( - label = "备注", - labelId = 84961, - items = { - @SalaryFormItem( - itemType = WeaFormItemType.TEXTAREA, - maxLength = "50" - ) - } - ) - @NotBlank(message = "name is required") - @Size(max = 60, message = "the maximum lenth is 60") - @ApiModelProperty("名称") +// @SalaryForm( +// label = "备注", +// labelId = 84961, +// items = { +// @SalaryFormItem( +// itemType = WeaFormItemType.TEXTAREA, +// maxLength = "50" +// ) +// } +// ) +// @NotBlank(message = "name is required") +// @Size(max = 60, message = "the maximum lenth is 60") +// //名称") private String remarks; } diff --git a/src/com/engine/salary/entity/agency/dto/PaymentAgencyListDTO.java b/src/com/engine/salary/entity/agency/dto/PaymentAgencyListDTO.java index 997e6c9f3..8f554125d 100644 --- a/src/com/engine/salary/entity/agency/dto/PaymentAgencyListDTO.java +++ b/src/com/engine/salary/entity/agency/dto/PaymentAgencyListDTO.java @@ -1,61 +1,55 @@ package com.engine.salary.entity.agency.dto; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; -import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; -import com.weaver.common.authority.format.Operates; -import com.weaver.common.authority.format.TableColumn; -import com.weaver.common.authority.format.TableOperates; -import com.weaver.common.authority.format.WeaFormat; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; /** - * @Description: - * @Author: zhangheng - * @CreateDate: 2022/4/20 20:41 - * @Version: v1.0 - */ + * 代缴机构列表 + *

Copyright: Copyright (c) 2022

+ *

Company: 泛微软件

+ * + * @author qiantao + * @version 1.0 + **/ @Data @Builder @NoArgsConstructor @AllArgsConstructor -@ApiModel("代缴机构列表") -@TableOperates(value = { - @Operates(index = 0, text = "编辑", labelId = 87058), - @Operates(index = 1, text = "删除", labelId = 87061) -}) +//@ApiModel("") +//@TableOperates(value = { +// @Operates(index = 0, text = "编辑", labelId = 87058), +// @Operates(index = 1, text = "删除", labelId = 87061) +//}) public class PaymentAgencyListDTO { /** * 主键id */ - @ApiModelProperty("主键id") - @JsonSerialize(using = ToStringSerializer.class) +// @ApiModelProperty("主键id") +// @JsonSerialize(using = ToStringSerializer.class) private Long id; /** * 社保福利代缴机构 */ - @WeaFormat( - label = "社保福利代缴机构", - labelId = 112448, - tableColumn = @TableColumn(width = "200") - ) - @ApiModelProperty("社保福利代缴机构") +// @WeaFormat( +// label = "社保福利代缴机构", +// labelId = 112448, +// tableColumn = @TableColumn(width = "200") +// ) +// @ApiModelProperty("社保福利代缴机构") private String agencyName; /** * 备注 */ - @WeaFormat( - label = "备注", - labelId = 84961, - tableColumn = @TableColumn(width = "300") - ) - @ApiModelProperty("备注") +// @WeaFormat( +// label = "备注", +// labelId = 84961, +// tableColumn = @TableColumn(width = "300") +// ) +// @ApiModelProperty("备注") private String remarks; } diff --git a/src/com/engine/salary/entity/agency/po/PaymentAgencyPO.java b/src/com/engine/salary/entity/agency/po/PaymentAgencyPO.java index e9c394198..93045f86e 100644 --- a/src/com/engine/salary/entity/agency/po/PaymentAgencyPO.java +++ b/src/com/engine/salary/entity/agency/po/PaymentAgencyPO.java @@ -1,7 +1,5 @@ package com.engine.salary.entity.agency.po; -import com.baomidou.mybatisplus.annotation.TableName; -import com.weaver.common.elog.annotation.ElogTransform; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; @@ -9,65 +7,50 @@ import lombok.NoArgsConstructor; import java.time.LocalDateTime; -/** - * @Description: - * @Author: zhangheng - * @CreateDate: 2022/4/20 20:24 - * @Version: v1.0 - */ @Data @Builder @NoArgsConstructor @AllArgsConstructor -@TableName("hrsa_payment_agency") -@ElogTransform(name = "数据采集-累计专项附加扣除表") +//hrsa_payment_agency public class PaymentAgencyPO { /** * 主键id */ - @ElogTransform(name = "主键id") private Long id; /** * 机构名称 */ - @ElogTransform(name = "机构名称") private String agencyName; /** * 备注 */ - @ElogTransform(name = "备注") private String remarks; /** * 创建时间 */ - @ElogTransform(name = "创建时间", ignore = true) private LocalDateTime createTime; /** * 更新时间 */ - @ElogTransform(name = "更新时间", ignore = true) private LocalDateTime updateTime; /** * 创建人 */ - @ElogTransform(name = "创建人", ignore = true) private Long creator; /** * 是否已删除。0:未删除、1:已删除 */ - @ElogTransform(name = "是否已删除", ignore = true) private Integer deleteType; /** * 租户ID */ - @ElogTransform(name = "租户key", ignore = true) private String tenantKey; } diff --git a/src/com/engine/salary/entity/hrm/HrmStatus.java b/src/com/engine/salary/entity/hrm/HrmStatus.java new file mode 100644 index 000000000..26fbdb755 --- /dev/null +++ b/src/com/engine/salary/entity/hrm/HrmStatus.java @@ -0,0 +1,16 @@ +package com.engine.salary.entity.hrm; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class HrmStatus { + String id; + + String name; +} diff --git a/src/com/engine/salary/entity/hrm/SubCompanyInfo.java b/src/com/engine/salary/entity/hrm/SubCompanyInfo.java new file mode 100644 index 000000000..84fb417f9 --- /dev/null +++ b/src/com/engine/salary/entity/hrm/SubCompanyInfo.java @@ -0,0 +1,28 @@ +package com.engine.salary.entity.hrm; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * 分部信息 + *

Copyright: Copyright (c) 2022

+ *

Company: 泛微软件

+ * + * @author qiantao + * @version 1.0 + **/ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class SubCompanyInfo { + + private Long id; + + /** + * 名称 + */ + private String name; +} diff --git a/src/com/engine/salary/entity/taxagent/bo/TaxAgentBO.java b/src/com/engine/salary/entity/taxagent/bo/TaxAgentBO.java index fcd6abcd2..f1e97ac2e 100644 --- a/src/com/engine/salary/entity/taxagent/bo/TaxAgentBO.java +++ b/src/com/engine/salary/entity/taxagent/bo/TaxAgentBO.java @@ -7,7 +7,10 @@ import com.cloudstore.eccom.pc.table.WeaTableOperates; import com.engine.salary.constant.SalaryDefaultTenantConstant; import com.engine.salary.entity.agency.po.PaymentAgencyPO; import com.engine.salary.entity.datacollection.DataCollectionEmployee; +import com.engine.salary.entity.hrm.DeptInfo; +import com.engine.salary.entity.hrm.HrmStatus; import com.engine.salary.entity.hrm.PositionInfo; +import com.engine.salary.entity.hrm.SubCompanyInfo; import com.engine.salary.entity.taxagent.dto.TaxAgentEmployeeDTO; import com.engine.salary.entity.taxagent.dto.TaxAgentListDTO; import com.engine.salary.entity.taxagent.dto.TaxAgentManageRangeListDTO; @@ -26,10 +29,6 @@ import com.engine.salary.util.SalaryEntityUtil; import com.engine.salary.util.SalaryI18nUtil; import com.google.common.base.Joiner; import com.google.common.collect.Lists; -import com.weaver.common.component.table.permission.Permission; -import com.weaver.common.hrm.cache.HrmDepartmentComInfo; -import com.weaver.common.hrm.cache.HrmPositionComInfo; -import com.weaver.common.hrm.domain.employee.HrmStatus; import dm.jdbc.util.IdGenerator; import lombok.AllArgsConstructor; import lombok.Builder; @@ -244,6 +243,7 @@ public class TaxAgentBO { .createTime(now) .updateTime(now) .creator(employeeId) + .deleteType(0) .tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY) .build(); } @@ -285,17 +285,17 @@ public class TaxAgentBO { * @return */ public static List convert2ListDTO(List taxAgentManageRanges, List employeeComInfos, - List departmentComInfos, List subDepartmentComInfos, + List departmentComInfos, List subDepartmentComInfos, List positionComInfos, List hrmStatusList) { if (CollectionUtils.isEmpty(taxAgentManageRanges)) { return Collections.emptyList(); } Map employeeComInfoMap = SalaryEntityUtil.convert2Map(employeeComInfos, DataCollectionEmployee::getEmployeeId, DataCollectionEmployee::getUsername); - Map departmentComInfoMap = SalaryEntityUtil.convert2Map(departmentComInfos, HrmDepartmentComInfo::getId, HrmDepartmentComInfo::getName); - Map subDepartmentComInfoMap = SalaryEntityUtil.convert2Map(subDepartmentComInfos, HrmDepartmentComInfo::getId, HrmDepartmentComInfo::getName); - Map positionComInfoMap = SalaryEntityUtil.convert2Map(positionComInfos, HrmPositionComInfo::getId, HrmPositionComInfo::getName); + Map departmentComInfoMap = SalaryEntityUtil.convert2Map(departmentComInfos, DeptInfo::getId, DeptInfo::getName); + Map subDepartmentComInfoMap = SalaryEntityUtil.convert2Map(subDepartmentComInfos, SubCompanyInfo::getId, SubCompanyInfo::getName); + Map positionComInfoMap = SalaryEntityUtil.convert2Map(positionComInfos, PositionInfo::getId, PositionInfo::getName); - Map hrmStatusNameMap = SalaryEntityUtil.convert2Map(hrmStatusList, hrmStatus -> String.valueOf(hrmStatus.getCodeId()), HrmStatus::getName); + Map hrmStatusNameMap = SalaryEntityUtil.convert2Map(hrmStatusList, hrmStatus -> String.valueOf(hrmStatus.getId()), HrmStatus::getName); return taxAgentManageRanges.stream() .map(taxAgentManageRange -> { @@ -354,14 +354,14 @@ public class TaxAgentBO { } } - public static Result handleTaxAgentRange(List taxAgentManageRanges, TaxAgentManageRangeSaveParam saveParam, Long taxAgentId, Long employeeId, - String tenantKey) { - return handleManageRange(taxAgentManageRanges, saveParam, TaxAgentRangeTypeEnum.TAXAGENT, taxAgentId, 0L, employeeId, tenantKey); + public static Result handleTaxAgentRange(List taxAgentManageRanges, TaxAgentManageRangeSaveParam saveParam, Long taxAgentId, Long employeeId + ) { + return handleManageRange(taxAgentManageRanges, saveParam, TaxAgentRangeTypeEnum.TAXAGENT, taxAgentId, 0L, employeeId); } public static Result handleSubAdminRange(List taxAgentManageRanges, TaxAgentManageRangeSaveParam saveParam, Long taxAgentId, Long subAdminId, - Long employeeId, String tenantKey) { - return handleManageRange(taxAgentManageRanges, saveParam, TaxAgentRangeTypeEnum.SUBADMIN, taxAgentId, subAdminId, employeeId, tenantKey); + Long employeeId) { + return handleManageRange(taxAgentManageRanges, saveParam, TaxAgentRangeTypeEnum.SUBADMIN, taxAgentId, subAdminId, employeeId); } /** @@ -372,11 +372,10 @@ public class TaxAgentBO { * @param taxAgentId * @param subAdminId * @param employeeId - * @param tenantKey * @return */ private static Result handleManageRange(List taxAgentManageRanges, TaxAgentManageRangeSaveParam saveParam, - TaxAgentRangeTypeEnum rangeTypeEnum, Long taxAgentId, Long subAdminId, Long employeeId, String tenantKey) { + TaxAgentRangeTypeEnum rangeTypeEnum, Long taxAgentId, Long subAdminId, Long employeeId) { Date now = new Date(); Result handleResult = Result.builder() .needInsertTaxAgentManageRanges(Lists.newArrayList()) @@ -408,7 +407,7 @@ public class TaxAgentBO { .creator(employeeId) .createTime(now) .updateTime(now) - .tenantKey(tenantKey) + .tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY) .deleteType(0) .build(); handleResult.getNeedInsertTaxAgentManageRanges().add(taxAgentManageRange); diff --git a/src/com/engine/salary/entity/taxagent/dto/TaxAgentAdjustRecordForFormSearchConditionDTO.java b/src/com/engine/salary/entity/taxagent/dto/TaxAgentAdjustRecordForFormSearchConditionDTO.java index 954c6bfd1..0316a764b 100644 --- a/src/com/engine/salary/entity/taxagent/dto/TaxAgentAdjustRecordForFormSearchConditionDTO.java +++ b/src/com/engine/salary/entity/taxagent/dto/TaxAgentAdjustRecordForFormSearchConditionDTO.java @@ -1,99 +1,99 @@ -package com.engine.salary.entity.taxagent.dto; - -import com.weaver.common.component.search.item.WeaSearchConditionItemType; -import com.weaver.common.component.search.item.WeaSearchConditionOption; -import com.weaver.hrm.salary.annotation.SalarySearchCondition; -import com.weaver.hrm.salary.annotation.SalarySearchConditionItem; -import com.weaver.hrm.salary.enums.SalaryUserStatusEnum; -import com.weaver.hrm.salary.enums.salaryarchive.SalaryArchiveTaxAgentAdjustReasonEnum; -import com.weaver.hrm.salary.util.SalaryI18nUtil; -import com.weaver.teams.security.context.TenantContext; -import com.weaver.teams.security.context.UserContext; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.util.Arrays; -import java.util.List; -import java.util.stream.Collectors; - -/** - * @Description: 薪资档案操作记录 - * @Author: wangxiangzhong - * @Date: 2021/11/24 17:09 - */ -@Data -@Builder -@NoArgsConstructor -@AllArgsConstructor -public class TaxAgentAdjustRecordForFormSearchConditionDTO { - - @SalarySearchCondition( - label = "个税扣缴义务人", - labelId = 86184, - needQuickSearch = true, - items = { - @SalarySearchConditionItem(itemType = WeaSearchConditionItemType.SELECT, name = "taxAgent", options = "getTaxAgentOptions()"), - } - ) - private String taxAgent; - - /** - * 个税扣缴义务人选项 - */ - private List taxAgentOptions; - - @SalarySearchCondition( - label = "调整原因", - labelId = 85431, - items = { - @SalarySearchConditionItem(itemType = WeaSearchConditionItemType.SELECT, name = "adjustReason", options = "getAdjustReasonOptions()"), - } - ) - private SalaryArchiveTaxAgentAdjustReasonEnum adjustReason; - - @SalarySearchCondition( - label = "生效日期", - labelId = 85904, - items = { - @SalarySearchConditionItem(itemType = WeaSearchConditionItemType.DATEPICKER, name = "effectiveTime") - } - ) - private String effectiveTime; - - @SalarySearchCondition( - label = "操作日期", - labelId = 91058, - items = { - @SalarySearchConditionItem(itemType = WeaSearchConditionItemType.DATEPICKER, name = "operateTime") - } - ) - private String operateTime; - - @SalarySearchCondition( - label = "操作人", - labelId = 85435, - items = { - @SalarySearchConditionItem(itemType = WeaSearchConditionItemType.BROWSER, browserType = "resource", browserMultiple = true, name = "operator", browserModule = "hrmsalary") - } - ) - private String operator; - - @SalarySearchCondition( - label = "备注", - labelId = 84961, - items = { - @SalarySearchConditionItem(itemType = WeaSearchConditionItemType.INPUT, name = "description"), - } - ) - private String description; - - private List getUserStatus(){ - return Arrays.stream(SalaryUserStatusEnum.values()).map(m->new WeaSearchConditionOption(m.name(), SalaryI18nUtil.getI18nLabel(TenantContext.getCurrentTenantKey(), UserContext.getCurrentEmployeeId(), m.getLabelId(), m.getDefaultLabel()))).collect(Collectors.toList()); - } - - private List getAdjustReasonOptions(){ - return Arrays.stream(SalaryArchiveTaxAgentAdjustReasonEnum.values()).map(m->new WeaSearchConditionOption(m.name(), SalaryI18nUtil.getI18nLabel(TenantContext.getCurrentTenantKey(), UserContext.getCurrentEmployeeId(), m.getLabelId(), m.getDefaultLabel()))).collect(Collectors.toList()); - } -} +//package com.engine.salary.entity.taxagent.dto; +// +//import com.weaver.common.component.search.item.WeaSearchConditionItemType; +//import com.weaver.common.component.search.item.WeaSearchConditionOption; +//import com.weaver.hrm.salary.annotation.SalarySearchCondition; +//import com.weaver.hrm.salary.annotation.SalarySearchConditionItem; +//import com.weaver.hrm.salary.enums.SalaryUserStatusEnum; +//import com.weaver.hrm.salary.enums.salaryarchive.SalaryArchiveTaxAgentAdjustReasonEnum; +//import com.weaver.hrm.salary.util.SalaryI18nUtil; +//import com.weaver.teams.security.context.TenantContext; +//import com.weaver.teams.security.context.UserContext; +//import lombok.AllArgsConstructor; +//import lombok.Builder; +//import lombok.Data; +//import lombok.NoArgsConstructor; +// +//import java.util.Arrays; +//import java.util.List; +//import java.util.stream.Collectors; +// +///** +// * @Description: 薪资档案操作记录 +// * @Author: wangxiangzhong +// * @Date: 2021/11/24 17:09 +// */ +//@Data +//@Builder +//@NoArgsConstructor +//@AllArgsConstructor +//public class TaxAgentAdjustRecordForFormSearchConditionDTO { +// +// @SalarySearchCondition( +// label = "个税扣缴义务人", +// labelId = 86184, +// needQuickSearch = true, +// items = { +// @SalarySearchConditionItem(itemType = WeaSearchConditionItemType.SELECT, name = "taxAgent", options = "getTaxAgentOptions()"), +// } +// ) +// private String taxAgent; +// +// /** +// * 个税扣缴义务人选项 +// */ +// private List taxAgentOptions; +// +// @SalarySearchCondition( +// label = "调整原因", +// labelId = 85431, +// items = { +// @SalarySearchConditionItem(itemType = WeaSearchConditionItemType.SELECT, name = "adjustReason", options = "getAdjustReasonOptions()"), +// } +// ) +// private SalaryArchiveTaxAgentAdjustReasonEnum adjustReason; +// +// @SalarySearchCondition( +// label = "生效日期", +// labelId = 85904, +// items = { +// @SalarySearchConditionItem(itemType = WeaSearchConditionItemType.DATEPICKER, name = "effectiveTime") +// } +// ) +// private String effectiveTime; +// +// @SalarySearchCondition( +// label = "操作日期", +// labelId = 91058, +// items = { +// @SalarySearchConditionItem(itemType = WeaSearchConditionItemType.DATEPICKER, name = "operateTime") +// } +// ) +// private String operateTime; +// +// @SalarySearchCondition( +// label = "操作人", +// labelId = 85435, +// items = { +// @SalarySearchConditionItem(itemType = WeaSearchConditionItemType.BROWSER, browserType = "resource", browserMultiple = true, name = "operator", browserModule = "hrmsalary") +// } +// ) +// private String operator; +// +// @SalarySearchCondition( +// label = "备注", +// labelId = 84961, +// items = { +// @SalarySearchConditionItem(itemType = WeaSearchConditionItemType.INPUT, name = "description"), +// } +// ) +// private String description; +// +// private List getUserStatus(){ +// return Arrays.stream(SalaryUserStatusEnum.values()).map(m->new WeaSearchConditionOption(m.name(), SalaryI18nUtil.getI18nLabel(TenantContext.getCurrentTenantKey(), UserContext.getCurrentEmployeeId(), m.getLabelId(), m.getDefaultLabel()))).collect(Collectors.toList()); +// } +// +// private List getAdjustReasonOptions(){ +// return Arrays.stream(SalaryArchiveTaxAgentAdjustReasonEnum.values()).map(m->new WeaSearchConditionOption(m.name(), SalaryI18nUtil.getI18nLabel(TenantContext.getCurrentTenantKey(), UserContext.getCurrentEmployeeId(), m.getLabelId(), m.getDefaultLabel()))).collect(Collectors.toList()); +// } +//} diff --git a/src/com/engine/salary/entity/taxagent/dto/TaxAgentAdjustRecordListDTO.java b/src/com/engine/salary/entity/taxagent/dto/TaxAgentAdjustRecordListDTO.java index 747e091e8..36cb60e2b 100644 --- a/src/com/engine/salary/entity/taxagent/dto/TaxAgentAdjustRecordListDTO.java +++ b/src/com/engine/salary/entity/taxagent/dto/TaxAgentAdjustRecordListDTO.java @@ -1,136 +1,136 @@ -package com.engine.salary.entity.taxagent.dto; - -import com.fasterxml.jackson.annotation.JsonFormat; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; -import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; -import com.weaver.common.authority.format.TableColumn; -import com.weaver.common.authority.format.TableOperates; -import com.weaver.common.authority.format.WeaFormat; -import com.weaver.common.component.table.type.WeaTableTypeEnum; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.time.LocalDate; -import java.util.Date; - -/** - * @Description: 个税扣缴义务人调整记录列表 - * @Author: wangxiangzhong - * @Date: 2021/11/1 16:34 - */ -@Data -@Builder -@NoArgsConstructor -@AllArgsConstructor -@ApiModel("个税扣缴义务人调整记录列表") -@TableOperates(tableType = WeaTableTypeEnum.CHECKBOX) -public class TaxAgentAdjustRecordListDTO { - @ApiModelProperty("主键id") - @JsonSerialize(using = ToStringSerializer.class) - private Long id; - - /** - * 人员信息表的主键id - */ - private Long employeeId; - - @ApiModelProperty("姓名") - @WeaFormat( - label = "姓名", - labelId = 85429, - tableColumn = @TableColumn(width = "100") - ) - private String username; - - @ApiModelProperty("部门") - @WeaFormat( - label = "部门", - labelId = 86185, - tableColumn = @TableColumn(width = "100") - ) - private String departmentName; - - @ApiModelProperty("员工状态") - @WeaFormat( - label = "员工状态", - labelId = 86187, - tableColumn = @TableColumn(width = "100") - ) - private String employeeStatus; - - @ApiModelProperty("调整前") - @WeaFormat( - label = "调整前", - labelId = 85433, - tableColumn = @TableColumn(width = "100") - ) - private String adjustBefore; - - @ApiModelProperty("调整后") - @WeaFormat( - label = "调整后", - labelId = 85434, - tableColumn = @TableColumn(width = "100") - ) - private String adjustAfter; - - @ApiModelProperty("调整原因") - @WeaFormat( - label = "调整原因", - labelId = 85431, - tableColumn = @TableColumn(width = "100") - ) - private String adjustReason; - - @ApiModelProperty("生效日期") - @WeaFormat( - label = "生效日期", - labelId = 85904, - tableColumn = @TableColumn(width = "100") - ) - @JsonFormat(pattern = "yyyy-MM-dd") - private LocalDate effectiveTime; - - @ApiModelProperty("操作人") - @WeaFormat( - label = "操作人", - labelId = 85435, - tableColumn = @TableColumn(width = "100") - ) - private String operator; - - @ApiModelProperty("操作时间") - @WeaFormat( - label = "操作时间", - labelId = 85436, - tableColumn = @TableColumn(width = "150") - ) - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private Date operateTime; - - @ApiModelProperty("备注") - @WeaFormat( - label = "备注", - labelId = 84961, - tableColumn = @TableColumn(width = "100") - ) - private String description; - - /** - * 薪资档案id - */ - @JsonIgnore - private Long salaryArchiveId; - - /** - * 个税扣缴义务人id - */ - @JsonIgnore - private Long taxAgentId; - -} +//package com.engine.salary.entity.taxagent.dto; +// +//import com.fasterxml.jackson.annotation.JsonFormat; +//import com.fasterxml.jackson.annotation.JsonIgnore; +//import com.fasterxml.jackson.databind.annotation.JsonSerialize; +//import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +//import com.weaver.common.authority.format.TableColumn; +//import com.weaver.common.authority.format.TableOperates; +//import com.weaver.common.authority.format.WeaFormat; +//import com.weaver.common.component.table.type.WeaTableTypeEnum; +//import io.swagger.annotations.ApiModel; +//import io.swagger.annotations.ApiModelProperty; +//import lombok.AllArgsConstructor; +//import lombok.Builder; +//import lombok.Data; +//import lombok.NoArgsConstructor; +// +//import java.time.LocalDate; +//import java.util.Date; +// +///** +// * @Description: 个税扣缴义务人调整记录列表 +// * @Author: wangxiangzhong +// * @Date: 2021/11/1 16:34 +// */ +//@Data +//@Builder +//@NoArgsConstructor +//@AllArgsConstructor +//@ApiModel("个税扣缴义务人调整记录列表") +//@TableOperates(tableType = WeaTableTypeEnum.CHECKBOX) +//public class TaxAgentAdjustRecordListDTO { +// @ApiModelProperty("主键id") +// @JsonSerialize(using = ToStringSerializer.class) +// private Long id; +// +// /** +// * 人员信息表的主键id +// */ +// private Long employeeId; +// +// @ApiModelProperty("姓名") +// @WeaFormat( +// label = "姓名", +// labelId = 85429, +// tableColumn = @TableColumn(width = "100") +// ) +// private String username; +// +// @ApiModelProperty("部门") +// @WeaFormat( +// label = "部门", +// labelId = 86185, +// tableColumn = @TableColumn(width = "100") +// ) +// private String departmentName; +// +// @ApiModelProperty("员工状态") +// @WeaFormat( +// label = "员工状态", +// labelId = 86187, +// tableColumn = @TableColumn(width = "100") +// ) +// private String employeeStatus; +// +// @ApiModelProperty("调整前") +// @WeaFormat( +// label = "调整前", +// labelId = 85433, +// tableColumn = @TableColumn(width = "100") +// ) +// private String adjustBefore; +// +// @ApiModelProperty("调整后") +// @WeaFormat( +// label = "调整后", +// labelId = 85434, +// tableColumn = @TableColumn(width = "100") +// ) +// private String adjustAfter; +// +// @ApiModelProperty("调整原因") +// @WeaFormat( +// label = "调整原因", +// labelId = 85431, +// tableColumn = @TableColumn(width = "100") +// ) +// private String adjustReason; +// +// @ApiModelProperty("生效日期") +// @WeaFormat( +// label = "生效日期", +// labelId = 85904, +// tableColumn = @TableColumn(width = "100") +// ) +// @JsonFormat(pattern = "yyyy-MM-dd") +// private LocalDate effectiveTime; +// +// @ApiModelProperty("操作人") +// @WeaFormat( +// label = "操作人", +// labelId = 85435, +// tableColumn = @TableColumn(width = "100") +// ) +// private String operator; +// +// @ApiModelProperty("操作时间") +// @WeaFormat( +// label = "操作时间", +// labelId = 85436, +// tableColumn = @TableColumn(width = "150") +// ) +// @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") +// private Date operateTime; +// +// @ApiModelProperty("备注") +// @WeaFormat( +// label = "备注", +// labelId = 84961, +// tableColumn = @TableColumn(width = "100") +// ) +// private String description; +// +// /** +// * 薪资档案id +// */ +// @JsonIgnore +// private Long salaryArchiveId; +// +// /** +// * 个税扣缴义务人id +// */ +// @JsonIgnore +// private Long taxAgentId; +// +//} diff --git a/src/com/engine/salary/entity/taxagent/dto/TaxAgentAdjustRecordSearchConditionDTO.java b/src/com/engine/salary/entity/taxagent/dto/TaxAgentAdjustRecordSearchConditionDTO.java index 04ef727f2..e2e7ef399 100644 --- a/src/com/engine/salary/entity/taxagent/dto/TaxAgentAdjustRecordSearchConditionDTO.java +++ b/src/com/engine/salary/entity/taxagent/dto/TaxAgentAdjustRecordSearchConditionDTO.java @@ -1,139 +1,139 @@ -package com.engine.salary.entity.taxagent.dto; - -import com.weaver.common.component.search.item.WeaSearchConditionItemType; -import com.weaver.common.component.search.item.WeaSearchConditionOption; -import com.weaver.hrm.salary.annotation.SalarySearchCondition; -import com.weaver.hrm.salary.annotation.SalarySearchConditionItem; -import com.weaver.hrm.salary.enums.SalaryUserStatusEnum; -import com.weaver.hrm.salary.enums.salaryarchive.SalaryArchiveTaxAgentAdjustReasonEnum; -import com.weaver.hrm.salary.util.SalaryI18nUtil; -import com.weaver.teams.api.user.UserStatus; -import com.weaver.teams.security.context.TenantContext; -import com.weaver.teams.security.context.UserContext; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.util.Arrays; -import java.util.List; -import java.util.stream.Collectors; - -/** - * @Description: 薪资档案操作记录 - * @Author: wangxiangzhong - * @Date: 2021/11/24 17:09 - */ -@Data -@Builder -@NoArgsConstructor -@AllArgsConstructor -public class TaxAgentAdjustRecordSearchConditionDTO { - - @SalarySearchCondition( - label = "姓名", - labelId = 85429, - needQuickSearch = true, - quickSearchKey = "username", - items = { - @SalarySearchConditionItem(itemType = WeaSearchConditionItemType.INPUT, name = "username"), - } - ) - private String username; - - @SalarySearchCondition( - label = "岗位", - labelId = 90633, - items = { - @SalarySearchConditionItem(itemType = WeaSearchConditionItemType.BROWSER, browserType = "position", browserMultiple = true, name = "position", browserModule = "hrmsalary") - } - ) - private String position; - - @SalarySearchCondition( - label = "状态", - labelId = 91075, - items = { - @SalarySearchConditionItem(itemType = WeaSearchConditionItemType.SELECT, name = "status", options = "getUserStatus()") - } - ) - private UserStatus status; - - @SalarySearchCondition( - label = "部门", - labelId = 86185, - needQuickSearch = true, - items = { - @SalarySearchConditionItem(itemType = WeaSearchConditionItemType.BROWSER, browserType = "department", browserMultiple = true, name = "department", browserModule = "hrmsalary") - } - ) - private String department; - - @SalarySearchCondition( - label = "个税扣缴义务人", - labelId = 86184, - needQuickSearch = true, - items = { - @SalarySearchConditionItem(itemType = WeaSearchConditionItemType.SELECT, name = "taxAgent", options = "getTaxAgentOptions()"), - } - ) - private String taxAgent; - - /** - * 个税扣缴义务人选项 - */ - private List taxAgentOptions; - - @SalarySearchCondition( - label = "调整原因", - labelId = 85431, - items = { - @SalarySearchConditionItem(itemType = WeaSearchConditionItemType.SELECT, name = "adjustReason", options = "getAdjustReasonOptions()"), - } - ) - private SalaryArchiveTaxAgentAdjustReasonEnum adjustReason; - - @SalarySearchCondition( - label = "生效日期", - labelId = 85904, - items = { - @SalarySearchConditionItem(itemType = WeaSearchConditionItemType.DATEPICKER, name = "effectiveTime") - } - ) - private String effectiveTime; - - @SalarySearchCondition( - label = "操作日期", - labelId = 91058, - items = { - @SalarySearchConditionItem(itemType = WeaSearchConditionItemType.DATEPICKER, name = "operateTime") - } - ) - private String operateTime; - - @SalarySearchCondition( - label = "操作人", - labelId = 85435, - items = { - @SalarySearchConditionItem(itemType = WeaSearchConditionItemType.BROWSER, browserType = "resource", browserMultiple = true, name = "operator", browserModule = "hrmsalary") - } - ) - private String operator; - - @SalarySearchCondition( - label = "备注", - labelId = 84961, - items = { - @SalarySearchConditionItem(itemType = WeaSearchConditionItemType.INPUT, name = "description"), - } - ) - private String description; - - private List getUserStatus(){ - return Arrays.stream(SalaryUserStatusEnum.values()).map(m->new WeaSearchConditionOption(m.name(), SalaryI18nUtil.getI18nLabel(TenantContext.getCurrentTenantKey(), UserContext.getCurrentEmployeeId(), m.getLabelId(), m.getDefaultLabel()))).collect(Collectors.toList()); - } - - private List getAdjustReasonOptions(){ - return Arrays.stream(SalaryUserStatusEnum.values()).map(m->new WeaSearchConditionOption(m.name(), SalaryI18nUtil.getI18nLabel(TenantContext.getCurrentTenantKey(), UserContext.getCurrentEmployeeId(), m.getLabelId(), m.getDefaultLabel()))).collect(Collectors.toList()); - } -} +//package com.engine.salary.entity.taxagent.dto; +// +//import com.weaver.common.component.search.item.WeaSearchConditionItemType; +//import com.weaver.common.component.search.item.WeaSearchConditionOption; +//import com.weaver.hrm.salary.annotation.SalarySearchCondition; +//import com.weaver.hrm.salary.annotation.SalarySearchConditionItem; +//import com.weaver.hrm.salary.enums.SalaryUserStatusEnum; +//import com.weaver.hrm.salary.enums.salaryarchive.SalaryArchiveTaxAgentAdjustReasonEnum; +//import com.weaver.hrm.salary.util.SalaryI18nUtil; +//import com.weaver.teams.api.user.UserStatus; +//import com.weaver.teams.security.context.TenantContext; +//import com.weaver.teams.security.context.UserContext; +//import lombok.AllArgsConstructor; +//import lombok.Builder; +//import lombok.Data; +//import lombok.NoArgsConstructor; +// +//import java.util.Arrays; +//import java.util.List; +//import java.util.stream.Collectors; +// +///** +// * @Description: 薪资档案操作记录 +// * @Author: wangxiangzhong +// * @Date: 2021/11/24 17:09 +// */ +//@Data +//@Builder +//@NoArgsConstructor +//@AllArgsConstructor +//public class TaxAgentAdjustRecordSearchConditionDTO { +// +// @SalarySearchCondition( +// label = "姓名", +// labelId = 85429, +// needQuickSearch = true, +// quickSearchKey = "username", +// items = { +// @SalarySearchConditionItem(itemType = WeaSearchConditionItemType.INPUT, name = "username"), +// } +// ) +// private String username; +// +// @SalarySearchCondition( +// label = "岗位", +// labelId = 90633, +// items = { +// @SalarySearchConditionItem(itemType = WeaSearchConditionItemType.BROWSER, browserType = "position", browserMultiple = true, name = "position", browserModule = "hrmsalary") +// } +// ) +// private String position; +// +// @SalarySearchCondition( +// label = "状态", +// labelId = 91075, +// items = { +// @SalarySearchConditionItem(itemType = WeaSearchConditionItemType.SELECT, name = "status", options = "getUserStatus()") +// } +// ) +// private UserStatus status; +// +// @SalarySearchCondition( +// label = "部门", +// labelId = 86185, +// needQuickSearch = true, +// items = { +// @SalarySearchConditionItem(itemType = WeaSearchConditionItemType.BROWSER, browserType = "department", browserMultiple = true, name = "department", browserModule = "hrmsalary") +// } +// ) +// private String department; +// +// @SalarySearchCondition( +// label = "个税扣缴义务人", +// labelId = 86184, +// needQuickSearch = true, +// items = { +// @SalarySearchConditionItem(itemType = WeaSearchConditionItemType.SELECT, name = "taxAgent", options = "getTaxAgentOptions()"), +// } +// ) +// private String taxAgent; +// +// /** +// * 个税扣缴义务人选项 +// */ +// private List taxAgentOptions; +// +// @SalarySearchCondition( +// label = "调整原因", +// labelId = 85431, +// items = { +// @SalarySearchConditionItem(itemType = WeaSearchConditionItemType.SELECT, name = "adjustReason", options = "getAdjustReasonOptions()"), +// } +// ) +// private SalaryArchiveTaxAgentAdjustReasonEnum adjustReason; +// +// @SalarySearchCondition( +// label = "生效日期", +// labelId = 85904, +// items = { +// @SalarySearchConditionItem(itemType = WeaSearchConditionItemType.DATEPICKER, name = "effectiveTime") +// } +// ) +// private String effectiveTime; +// +// @SalarySearchCondition( +// label = "操作日期", +// labelId = 91058, +// items = { +// @SalarySearchConditionItem(itemType = WeaSearchConditionItemType.DATEPICKER, name = "operateTime") +// } +// ) +// private String operateTime; +// +// @SalarySearchCondition( +// label = "操作人", +// labelId = 85435, +// items = { +// @SalarySearchConditionItem(itemType = WeaSearchConditionItemType.BROWSER, browserType = "resource", browserMultiple = true, name = "operator", browserModule = "hrmsalary") +// } +// ) +// private String operator; +// +// @SalarySearchCondition( +// label = "备注", +// labelId = 84961, +// items = { +// @SalarySearchConditionItem(itemType = WeaSearchConditionItemType.INPUT, name = "description"), +// } +// ) +// private String description; +// +// private List getUserStatus(){ +// return Arrays.stream(SalaryUserStatusEnum.values()).map(m->new WeaSearchConditionOption(m.name(), SalaryI18nUtil.getI18nLabel(TenantContext.getCurrentTenantKey(), UserContext.getCurrentEmployeeId(), m.getLabelId(), m.getDefaultLabel()))).collect(Collectors.toList()); +// } +// +// private List getAdjustReasonOptions(){ +// return Arrays.stream(SalaryUserStatusEnum.values()).map(m->new WeaSearchConditionOption(m.name(), SalaryI18nUtil.getI18nLabel(TenantContext.getCurrentTenantKey(), UserContext.getCurrentEmployeeId(), m.getLabelId(), m.getDefaultLabel()))).collect(Collectors.toList()); +// } +//} diff --git a/src/com/engine/salary/entity/taxagent/dto/TaxAgentBaseFormDTO.java b/src/com/engine/salary/entity/taxagent/dto/TaxAgentBaseFormDTO.java index d5f193b3d..580ddd585 100644 --- a/src/com/engine/salary/entity/taxagent/dto/TaxAgentBaseFormDTO.java +++ b/src/com/engine/salary/entity/taxagent/dto/TaxAgentBaseFormDTO.java @@ -1,34 +1,30 @@ package com.engine.salary.entity.taxagent.dto; -import com.weaver.common.component.form.item.WeaFormItemType; -import com.weaver.hrm.salary.annotation.SalaryForm; -import com.weaver.hrm.salary.annotation.SalaryFormItem; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; /** - * @Description: 个税扣缴义务人基础信息 - * @Author: wangxiangzhong - * @Date: 2022/3/21 10:00 - */ + * 个税扣缴义务人基础信息表单 + *

Copyright: Copyright (c) 2022

+ *

Company: 泛微软件

+ * + * @author qiantao + * @version 1.0 + **/ @Data @Builder @NoArgsConstructor @AllArgsConstructor -@ApiModel("个税扣缴义务人基础信息表单") public class TaxAgentBaseFormDTO { - @SalaryForm( - label = "启用分权", - labelId = 106270, - items = { - @SalaryFormItem(itemType = WeaFormItemType.SWITCH) - } - ) - @ApiModelProperty("启用分权") +// @SalaryForm( +// label = "启用分权", +// labelId = 106270, +// items = { +// @SalaryFormItem(itemType = WeaFormItemType.SWITCH) +// } +// ) private Boolean devolutionStatus; } diff --git a/src/com/engine/salary/entity/taxagent/dto/TaxAgentEmployeeDTO.java b/src/com/engine/salary/entity/taxagent/dto/TaxAgentEmployeeDTO.java index 1081993c3..aae1dd4e9 100644 --- a/src/com/engine/salary/entity/taxagent/dto/TaxAgentEmployeeDTO.java +++ b/src/com/engine/salary/entity/taxagent/dto/TaxAgentEmployeeDTO.java @@ -1,41 +1,37 @@ package com.engine.salary.entity.taxagent.dto; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import lombok.Builder; import lombok.Data; /** - * @Description: 个税扣缴义务人以及管理范围中的人员 - * @Author: wangxiangzhong - * @Date: 2022/3/24 14:44 - */ + * 个税扣缴义务人以及管理范围中的人员 + *

Copyright: Copyright (c) 2022

+ *

Company: 泛微软件

+ * + * @author qiantao + * @version 1.0 + **/ @Data @Builder -@ApiModel("个税扣缴义务人以及管理范围中的人员") public class TaxAgentEmployeeDTO { /** * 个税扣缴义务人id */ - @ApiModelProperty("个税扣缴义务人id") private Long taxAgentId; /** - * 名称 + * 个税扣缴义务人名称 */ - @ApiModelProperty("个税扣缴义务人名称") private String taxAgentName; /** * 人员id */ - @ApiModelProperty("人员id") private Long employeeId; /** * 名字 */ - @ApiModelProperty("名字") private String username; } diff --git a/src/com/engine/salary/entity/taxagent/dto/TaxAgentEmployeeTaxAgentDTO.java b/src/com/engine/salary/entity/taxagent/dto/TaxAgentEmployeeTaxAgentDTO.java index 88253b492..976fcddc1 100644 --- a/src/com/engine/salary/entity/taxagent/dto/TaxAgentEmployeeTaxAgentDTO.java +++ b/src/com/engine/salary/entity/taxagent/dto/TaxAgentEmployeeTaxAgentDTO.java @@ -1,32 +1,29 @@ package com.engine.salary.entity.taxagent.dto; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import lombok.Builder; import lombok.Data; import java.util.List; /** - * @description: 管理范围的人员与个税扣缴义务人的关联数据 - * @Author: wangxiangzhong - * @Date: 2022/3/22 17:08 - * @version:v1.0 - */ + * 管理范围的人员与个税扣缴义务人的关联数据 + *

Copyright: Copyright (c) 2022

+ *

Company: 泛微软件

+ * + * @author qiantao + * @version 1.0 + **/ @Data @Builder -@ApiModel("管理范围的人员与个税扣缴义务人的关联数据") public class TaxAgentEmployeeTaxAgentDTO { /** * 人员id */ - @ApiModelProperty("人员id") private Long employeeId; /** * 个税扣缴义务人id列表 */ - @ApiModelProperty("个税扣缴义务人id列表") private List taxAgentIds; } diff --git a/src/com/engine/salary/entity/taxagent/dto/TaxAgentListDTO.java b/src/com/engine/salary/entity/taxagent/dto/TaxAgentListDTO.java index ff7d55bb0..78b35c633 100644 --- a/src/com/engine/salary/entity/taxagent/dto/TaxAgentListDTO.java +++ b/src/com/engine/salary/entity/taxagent/dto/TaxAgentListDTO.java @@ -2,13 +2,6 @@ package com.engine.salary.entity.taxagent.dto; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; -import com.weaver.common.authority.format.Operates; -import com.weaver.common.authority.format.TableColumn; -import com.weaver.common.authority.format.TableOperates; -import com.weaver.common.authority.format.WeaFormat; -import com.weaver.common.component.table.type.WeaTableTypeEnum; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; @@ -23,30 +16,27 @@ import lombok.NoArgsConstructor; @Builder @NoArgsConstructor @AllArgsConstructor -@ApiModel("个税扣缴义务人列表") -@TableOperates(value = { - @Operates(index = 0, text = "编辑" ,labelId = 59943), - @Operates(index = 1, text = "删除" ,labelId = 59942) -}, tableType = WeaTableTypeEnum.NONE) +//@ApiModel("个税扣缴义务人列表") +//@TableOperates(value = { +// @Operates(index = 0, text = "编辑" ,labelId = 59943), +// @Operates(index = 1, text = "删除" ,labelId = 59942) +//}, tableType = WeaTableTypeEnum.NONE) public class TaxAgentListDTO { - @ApiModelProperty("主键id") @JsonSerialize(using = ToStringSerializer.class) private Long id; - @ApiModelProperty("个税扣缴义务人名称") - @WeaFormat( - label = "个税扣缴义务人名称", - labelId = 91558, - tableColumn = @TableColumn(width = "40%") - ) +// @WeaFormat( +// label = "个税扣缴义务人名称", +// labelId = 91558, +// tableColumn = @TableColumn(width = "40%") +// ) private String name; - @ApiModelProperty("备注") - @WeaFormat( - label = "备注", - labelId = 84961, - tableColumn = @TableColumn(width = "40%") - ) +// @WeaFormat( +// label = "备注", +// labelId = 84961, +// tableColumn = @TableColumn(width = "40%") +// ) private String description; } diff --git a/src/com/engine/salary/entity/taxagent/dto/TaxAgentManageRangeFormDTO.java b/src/com/engine/salary/entity/taxagent/dto/TaxAgentManageRangeFormDTO.java index 7711d9d99..84fe665f3 100644 --- a/src/com/engine/salary/entity/taxagent/dto/TaxAgentManageRangeFormDTO.java +++ b/src/com/engine/salary/entity/taxagent/dto/TaxAgentManageRangeFormDTO.java @@ -1,55 +1,35 @@ package com.engine.salary.entity.taxagent.dto; -import com.weaver.common.component.browser.combination.TypesBrowserOption; -import com.weaver.common.component.form.item.WeaFormItemType; -import com.weaver.hrm.salary.annotation.SalaryForm; -import com.weaver.hrm.salary.annotation.SalaryFormItem; -import com.weaver.hrm.salary.enums.salarysob.TargetTypeEnum; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import com.engine.salary.entity.hrm.HrmStatus; +import com.engine.salary.enums.salarysob.TargetTypeEnum; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; import java.util.Collection; -import java.util.List; /** - * @description: 范围表单 - * @Author: wangxiangzhong - * @Date: 2022/03/23 09:15 - */ + * 范围表单 + *

Copyright: Copyright (c) 2022

+ *

Company: 泛微软件

+ * + * @author qiantao + * @version 1.0 + **/ @Data @Builder @NoArgsConstructor @AllArgsConstructor -@ApiModel("范围表单") public class TaxAgentManageRangeFormDTO { - @SalaryForm( - label = "对象类型", - labelId = 90394, - items = { - @SalaryFormItem(required = true, itemType = WeaFormItemType.TYPESBROWSER, options = "getTargetOptions()", - browserModule = "hrmsalary", browserType = "hrmcombination", browserMultiple = true) - } - ) - @ApiModelProperty("对象类型") + //对象类型 private TargetTypeEnum targetType; - private List targetOptions; +// private List targetOptions; - @ApiModelProperty("对象id") + //对象id") private Long targetId; - @SalaryForm( - label = "选择人员状态", - labelId = 87825, - items = { - @SalaryFormItem(required = true, itemType = WeaFormItemType.CHECKBOX) - } - ) - @ApiModelProperty("人员状态") - private Collection employeeStatus; + private Collection employeeStatus; } diff --git a/src/com/engine/salary/entity/taxagent/dto/TaxAgentSubAdminBaseFormDTO.java b/src/com/engine/salary/entity/taxagent/dto/TaxAgentSubAdminBaseFormDTO.java index ee958a12b..8fa634d4f 100644 --- a/src/com/engine/salary/entity/taxagent/dto/TaxAgentSubAdminBaseFormDTO.java +++ b/src/com/engine/salary/entity/taxagent/dto/TaxAgentSubAdminBaseFormDTO.java @@ -1,10 +1,5 @@ package com.engine.salary.entity.taxagent.dto; -import com.weaver.common.authority.format.Form; -import com.weaver.common.authority.format.WeaFormat; -import com.weaver.common.component.form.item.WeaFormItemType; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; @@ -13,33 +8,26 @@ import lombok.NoArgsConstructor; import java.util.List; /** - * @Description: 个税扣缴义务人分管理员基础设置表单 - * @Author: wangxiangzhong - * @Date: 2021/10/29 16:12 - */ + * 个税扣缴义务人分管理员基础设置表单 + *

Copyright: Copyright (c) 2022

+ *

Company: 泛微软件

+ * + * @author qiantao + * @version 1.0 + **/ @Data @Builder @NoArgsConstructor @AllArgsConstructor -@ApiModel("个税扣缴义务人分管理员基础设置表单") public class TaxAgentSubAdminBaseFormDTO { - @ApiModelProperty("主键id") + //主键id private Long id; - @WeaFormat( - label = "分管理员", - labelId = 106283, - from = @Form(itemType = WeaFormItemType.BROWSER, required = true, browserModule = "hrmsalary", browserType = "resource") - ) - @ApiModelProperty("分管理员") + + //分管理员 private List subAdminUser; - @WeaFormat( - label = "备注", - labelId = 84961, - from = @Form(itemType = WeaFormItemType.INPUT, maxLength = "20") - ) - @ApiModelProperty("备注") + //备注 private String description; } diff --git a/src/com/engine/salary/entity/taxagent/dto/TaxAgentSubAdminListDTO.java b/src/com/engine/salary/entity/taxagent/dto/TaxAgentSubAdminListDTO.java index a2227b4bc..3b7936356 100644 --- a/src/com/engine/salary/entity/taxagent/dto/TaxAgentSubAdminListDTO.java +++ b/src/com/engine/salary/entity/taxagent/dto/TaxAgentSubAdminListDTO.java @@ -1,60 +1,40 @@ package com.engine.salary.entity.taxagent.dto; +import com.engine.salary.annotation.TableTitle; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; -import com.weaver.common.authority.format.Operates; -import com.weaver.common.authority.format.TableColumn; -import com.weaver.common.authority.format.TableOperates; -import com.weaver.common.authority.format.WeaFormat; -import com.weaver.common.component.table.type.WeaTableTypeEnum; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; /** - * @Description: 个税扣缴义务人分管理员列表 - * @Author: wangxiangzhong - * @Date: 2022/03/21 15:39 - */ + * 个税扣缴义务人分管理员列表 + *

Copyright: Copyright (c) 2022

+ *

Company: 泛微软件

+ * + * @author qiantao + * @version 1.0 + **/ @Data @Builder @NoArgsConstructor @AllArgsConstructor -@ApiModel("个税扣缴义务人分管理员列表") -@TableOperates(value = { - @Operates(index = 0, text = "编辑" ,labelId = 59943), - @Operates(index = 1, text = "删除" ,labelId = 59942) -}, tableType = WeaTableTypeEnum.NONE) public class TaxAgentSubAdminListDTO { - @ApiModelProperty("主键id") + //主键id @JsonSerialize(using = ToStringSerializer.class) private Long id; - @ApiModelProperty("分管理员") - @WeaFormat( - label = "分管理员", - labelId = 106283, - tableColumn = @TableColumn(width = "30%") - ) + //分管理员 + @TableTitle(title = "分管理员", key = "subAdmin", dataIndex = "subAdmin") private String subAdmin; - @ApiModelProperty("管理范围") - @WeaFormat( - label = "管理范围", - labelId = 106250, - tableColumn = @TableColumn(width = "30%") - ) + //管理范围 + @TableTitle(title = "管理范围", key = "range", dataIndex = "range") private String range; - @ApiModelProperty("备注") - @WeaFormat( - label = "备注", - labelId = 84961, - tableColumn = @TableColumn(width = "40%") - ) + //备注 + @TableTitle(title = "备注", key = "description", dataIndex = "description") private String description; } diff --git a/src/com/engine/salary/entity/taxagent/param/TaxAgentAdminChangeCheckParam.java b/src/com/engine/salary/entity/taxagent/param/TaxAgentAdminChangeCheckParam.java index 7c32d296f..f25474c2b 100644 --- a/src/com/engine/salary/entity/taxagent/param/TaxAgentAdminChangeCheckParam.java +++ b/src/com/engine/salary/entity/taxagent/param/TaxAgentAdminChangeCheckParam.java @@ -1,5 +1,6 @@ package com.engine.salary.entity.taxagent.param; +import com.engine.salary.util.valid.DataCheck; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; @@ -20,8 +21,10 @@ import lombok.NoArgsConstructor; public class TaxAgentAdminChangeCheckParam { //个税扣缴义务人id + @DataCheck(require = true,message = "个税扣缴义务人id为空") private Long taxAgentId; //管理员主键id + @DataCheck(require = true,message = "管理员主键为空") private Long adminUserId; } diff --git a/src/com/engine/salary/entity/taxagent/param/TaxAgentSaveParam.java b/src/com/engine/salary/entity/taxagent/param/TaxAgentSaveParam.java index 21da60aae..747418046 100644 --- a/src/com/engine/salary/entity/taxagent/param/TaxAgentSaveParam.java +++ b/src/com/engine/salary/entity/taxagent/param/TaxAgentSaveParam.java @@ -1,6 +1,7 @@ package com.engine.salary.entity.taxagent.param; import com.engine.salary.util.valid.DataCheck; +import com.engine.salary.util.valid.RuntimeTypeEnum; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; @@ -21,6 +22,7 @@ import lombok.NoArgsConstructor; public class TaxAgentSaveParam { //主键id + @DataCheck(require = true, message = "id为空", runtime = {RuntimeTypeEnum.UPDATE}) private Long id; //名称 diff --git a/src/com/engine/salary/entity/taxagent/param/TaxAgentSubAdminBaseFormParam.java b/src/com/engine/salary/entity/taxagent/param/TaxAgentSubAdminBaseFormParam.java index f44919dc9..40278cc6b 100644 --- a/src/com/engine/salary/entity/taxagent/param/TaxAgentSubAdminBaseFormParam.java +++ b/src/com/engine/salary/entity/taxagent/param/TaxAgentSubAdminBaseFormParam.java @@ -1,5 +1,6 @@ package com.engine.salary.entity.taxagent.param; +import com.engine.salary.util.valid.DataCheck; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; @@ -24,5 +25,6 @@ public class TaxAgentSubAdminBaseFormParam { private Long id; //个税扣缴义务人的id + @DataCheck(require = true, message = "个税扣缴义务人的id为空") private Long taxAgentId; } diff --git a/src/com/engine/salary/entity/taxagent/param/TaxAgentSubAdminQueryParam.java b/src/com/engine/salary/entity/taxagent/param/TaxAgentSubAdminQueryParam.java index 8ec169683..6dec062b2 100644 --- a/src/com/engine/salary/entity/taxagent/param/TaxAgentSubAdminQueryParam.java +++ b/src/com/engine/salary/entity/taxagent/param/TaxAgentSubAdminQueryParam.java @@ -1,6 +1,7 @@ package com.engine.salary.entity.taxagent.param; import com.engine.salary.common.BaseQueryParam; +import com.engine.salary.util.valid.DataCheck; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; @@ -21,5 +22,6 @@ import lombok.NoArgsConstructor; public class TaxAgentSubAdminQueryParam extends BaseQueryParam { //个税扣缴义务人id + @DataCheck(require = true,message = "个税扣缴义务人id为空") private Long taxAgentId; } diff --git a/src/com/engine/salary/entity/taxagent/po/TaxAgentAdminPO.java b/src/com/engine/salary/entity/taxagent/po/TaxAgentAdminPO.java index 97864a19c..88859fe56 100644 --- a/src/com/engine/salary/entity/taxagent/po/TaxAgentAdminPO.java +++ b/src/com/engine/salary/entity/taxagent/po/TaxAgentAdminPO.java @@ -65,6 +65,6 @@ public class TaxAgentAdminPO { private Collection taxAgentIds; - + private Collection ids; } diff --git a/src/com/engine/salary/entity/taxagent/po/TaxAgentBasePO.java b/src/com/engine/salary/entity/taxagent/po/TaxAgentBasePO.java index f19e421b2..6930031f9 100644 --- a/src/com/engine/salary/entity/taxagent/po/TaxAgentBasePO.java +++ b/src/com/engine/salary/entity/taxagent/po/TaxAgentBasePO.java @@ -5,6 +5,7 @@ import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; +import java.util.Collection; import java.util.Date; /** @@ -56,4 +57,5 @@ public class TaxAgentBasePO { * 更新时间 */ private Date updateTime; + private Collection ids; } diff --git a/src/com/engine/salary/entity/taxagent/po/TaxAgentEmpChangePO.java b/src/com/engine/salary/entity/taxagent/po/TaxAgentEmpChangePO.java index 3d52b0cce..505112ce2 100644 --- a/src/com/engine/salary/entity/taxagent/po/TaxAgentEmpChangePO.java +++ b/src/com/engine/salary/entity/taxagent/po/TaxAgentEmpChangePO.java @@ -7,6 +7,7 @@ import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; +import java.util.Collection; import java.util.Date; /** @@ -82,4 +83,6 @@ public class TaxAgentEmpChangePO { * 更新时间 */ private Date updateTime; + + private Collection ids; } diff --git a/src/com/engine/salary/entity/taxagent/po/TaxAgentEmpPO.java b/src/com/engine/salary/entity/taxagent/po/TaxAgentEmpPO.java index 9c716f0a4..671adb4a6 100644 --- a/src/com/engine/salary/entity/taxagent/po/TaxAgentEmpPO.java +++ b/src/com/engine/salary/entity/taxagent/po/TaxAgentEmpPO.java @@ -69,4 +69,5 @@ public class TaxAgentEmpPO { private Date updateTime; private Collection taxAgentIds; + private Collection ids; } diff --git a/src/com/engine/salary/entity/taxagent/po/TaxAgentEmployeePO.java b/src/com/engine/salary/entity/taxagent/po/TaxAgentEmployeePO.java index b6b615580..f5c789c82 100644 --- a/src/com/engine/salary/entity/taxagent/po/TaxAgentEmployeePO.java +++ b/src/com/engine/salary/entity/taxagent/po/TaxAgentEmployeePO.java @@ -5,6 +5,8 @@ import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; +import java.util.Collection; + /** * 员工基本信息 *

Copyright: Copyright (c) 2022

@@ -33,4 +35,6 @@ public class TaxAgentEmployeePO { //人事状态") private String personnelStatus; + + private Collection ids; } diff --git a/src/com/engine/salary/entity/taxagent/po/TaxAgentPO.java b/src/com/engine/salary/entity/taxagent/po/TaxAgentPO.java index 255d8c88b..a5d695625 100644 --- a/src/com/engine/salary/entity/taxagent/po/TaxAgentPO.java +++ b/src/com/engine/salary/entity/taxagent/po/TaxAgentPO.java @@ -5,6 +5,7 @@ import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; +import java.util.Collection; import java.util.Date; /** @@ -67,4 +68,6 @@ public class TaxAgentPO { * 更新时间 */ private Date updateTime; + + private Collection ids; } diff --git a/src/com/engine/salary/entity/taxagent/po/TaxAgentSubAdminEmpPO.java b/src/com/engine/salary/entity/taxagent/po/TaxAgentSubAdminEmpPO.java index a55fd7140..b9134228e 100644 --- a/src/com/engine/salary/entity/taxagent/po/TaxAgentSubAdminEmpPO.java +++ b/src/com/engine/salary/entity/taxagent/po/TaxAgentSubAdminEmpPO.java @@ -5,6 +5,7 @@ import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; +import java.util.Collection; import java.util.Date; /** @@ -71,4 +72,7 @@ public class TaxAgentSubAdminEmpPO { * 更新时间 */ private Date updateTime; + + private Collection ids; + } diff --git a/src/com/engine/salary/entity/taxagent/po/TaxAgentSubAdminPO.java b/src/com/engine/salary/entity/taxagent/po/TaxAgentSubAdminPO.java index c35cdcfb6..60e2f9ff8 100644 --- a/src/com/engine/salary/entity/taxagent/po/TaxAgentSubAdminPO.java +++ b/src/com/engine/salary/entity/taxagent/po/TaxAgentSubAdminPO.java @@ -5,6 +5,7 @@ import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; +import java.util.Collection; import java.util.Date; /** @@ -67,4 +68,7 @@ public class TaxAgentSubAdminPO { * 更新时间 */ private Date updateTime; + + private Collection ids; + } diff --git a/src/com/engine/salary/enums/UserStatusEnum.java b/src/com/engine/salary/enums/UserStatusEnum.java index ac209eb22..9a439f30a 100644 --- a/src/com/engine/salary/enums/UserStatusEnum.java +++ b/src/com/engine/salary/enums/UserStatusEnum.java @@ -1,5 +1,7 @@ package com.engine.salary.enums; +import com.engine.salary.entity.hrm.HrmStatus; + import java.util.*; import java.util.stream.Collectors; @@ -83,5 +85,11 @@ public enum UserStatusEnum { return Arrays.stream(UserStatusEnum.values()).filter(v -> v != INVALID).collect(Collectors.toList()); } + public static List getHrmStatusList() { + return Arrays.stream(UserStatusEnum.values()) + .filter(v -> v != INVALID) + .map(v -> HrmStatus.builder().id(v.value.toString()).name(v.description).build()).collect(Collectors.toList()); + } + } diff --git a/src/com/engine/salary/enums/taxagent/TaxAgentRangeTypeEnum.java b/src/com/engine/salary/enums/taxagent/TaxAgentRangeTypeEnum.java index b9355967b..c89faa539 100644 --- a/src/com/engine/salary/enums/taxagent/TaxAgentRangeTypeEnum.java +++ b/src/com/engine/salary/enums/taxagent/TaxAgentRangeTypeEnum.java @@ -1,15 +1,18 @@ package com.engine.salary.enums.taxagent; -import com.weaver.hrm.salary.util.SalaryI18nUtil; +import com.engine.salary.util.SalaryI18nUtil; import java.util.Arrays; import java.util.Optional; /** - * @Description: 范围类型 - * @Author: wangxiangzhong - * @Date: 2021-11-17 14:37 - */ + * 范围类型 + *

Copyright: Copyright (c) 2022

+ *

Company: 泛微软件

+ * + * @author qiantao + * @version 1.0 + **/ public enum TaxAgentRangeTypeEnum { TAXAGENT(1, "个税扣缴义务人", 86184), @@ -40,7 +43,7 @@ public enum TaxAgentRangeTypeEnum { } public static String getDefaultLabelByValue(Integer value, Long employeeId, String tenantKey) { - Optional optional = Arrays.stream(TaxAgentRangeTypeEnum.values()).filter(r->Integer.valueOf(r.getValue()).equals(value)).findFirst(); - return optional.isPresent()?SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, optional.get().getLabelId(), optional.get().getDefaultLabel()):""; + Optional optional = Arrays.stream(TaxAgentRangeTypeEnum.values()).filter(r -> Integer.valueOf(r.getValue()).equals(value)).findFirst(); + return optional.isPresent() ? SalaryI18nUtil.getI18nLabel(optional.get().getLabelId(), optional.get().getDefaultLabel()) : ""; } } diff --git a/src/com/engine/salary/mapper/datacollection/EmployMapper.java b/src/com/engine/salary/mapper/datacollection/EmployMapper.java index 39e00fc10..1cd5b5688 100644 --- a/src/com/engine/salary/mapper/datacollection/EmployMapper.java +++ b/src/com/engine/salary/mapper/datacollection/EmployMapper.java @@ -1,7 +1,9 @@ package com.engine.salary.mapper.datacollection; import com.engine.salary.entity.datacollection.DataCollectionEmployee; +import com.engine.salary.entity.hrm.DeptInfo; import com.engine.salary.entity.hrm.PositionInfo; +import com.engine.salary.entity.hrm.SubCompanyInfo; import com.engine.salary.entity.salarysob.param.SalarySobRangeEmpQueryParam; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -11,31 +13,36 @@ import java.util.List; @Mapper public interface EmployMapper { - /** - * 获取所有员工 - * @return - */ - List listEmployee(); + /** + * 获取所有员工 + * + * @return + */ + List listEmployee(); - List getEmployeeByIds(@Param("collection") List ids); + List getEmployeeByIds(@Param("collection") List ids); - List getEmployeeByIdsAll(@Param("collection") List ids); + List getEmployeeByIdsAll(@Param("collection") List ids); - List listPositionInfo(@Param("collection") List ids); + List getAdminEmployeeByIds(@Param("collection") List list); - List getAdminEmployeeByIds(@Param("collection") List list); + List getEmployeeIdsByUserName(@Param("userName") String userName); - List getEmployeeIdsByUserName(@Param("userName") String userName); + /** + * 根据薪资账套的人员范围转换而成的查询参数查询人员 + * + * @param queryParams 薪资账套的人员范围转换而成的查询参数 + * @return + */ + List listByParams(@Param("params") Collection queryParams); - /** - * 根据薪资账套的人员范围转换而成的查询参数查询人员 - * - * @param queryParams 薪资账套的人员范围转换而成的查询参数 - * @return - */ - List listByParams(@Param("params") Collection queryParams); + DataCollectionEmployee getEmployeeById(Long employeeId); - DataCollectionEmployee getEmployeeById(Long employeeId); + List listAll(); - List listAll(); + List listPositionInfo(@Param("collection") List ids); + + List getDeptInfoList(@Param("departmentIds") List departmentIds); + + List getSubCompanyInfoList(List subDepartmentIds); } \ No newline at end of file diff --git a/src/com/engine/salary/mapper/datacollection/EmployMapper.xml b/src/com/engine/salary/mapper/datacollection/EmployMapper.xml index d1ac649b8..6ecdd03f3 100644 --- a/src/com/engine/salary/mapper/datacollection/EmployMapper.xml +++ b/src/com/engine/salary/mapper/datacollection/EmployMapper.xml @@ -162,7 +162,7 @@ AND ( - a.lastname like '%'||#{userName}||'%' + a.lastname like '%'||#{userName}||'%' ) @@ -177,7 +177,7 @@ + + + + + \ No newline at end of file diff --git a/src/com/engine/salary/mapper/taxagent/TaxAgentManageRangeMapper.java b/src/com/engine/salary/mapper/taxagent/TaxAgentManageRangeMapper.java index 6e22e36b1..58f7542ad 100644 --- a/src/com/engine/salary/mapper/taxagent/TaxAgentManageRangeMapper.java +++ b/src/com/engine/salary/mapper/taxagent/TaxAgentManageRangeMapper.java @@ -2,6 +2,7 @@ package com.engine.salary.mapper.taxagent; import com.engine.salary.entity.taxagent.po.TaxAgentManageRangePO; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; import java.util.Collection; import java.util.List; @@ -65,5 +66,9 @@ public interface TaxAgentManageRangeMapper { */ int delete(TaxAgentManageRangePO taxAgentManageRange); - void deleteByIds(Collection ids); + void deleteByIds(@Param("ids") Collection ids); + + void deleteByTaxAgentIds(@Param("taxAgentIds") Collection taxAgentIds); + + void deleteBySubAdminIds(Collection subAdminIds); } \ No newline at end of file diff --git a/src/com/engine/salary/mapper/taxagent/TaxAgentManageRangeMapper.xml b/src/com/engine/salary/mapper/taxagent/TaxAgentManageRangeMapper.xml index b5de0a9e8..c19c09421 100644 --- a/src/com/engine/salary/mapper/taxagent/TaxAgentManageRangeMapper.xml +++ b/src/com/engine/salary/mapper/taxagent/TaxAgentManageRangeMapper.xml @@ -304,5 +304,26 @@ AND delete_type = 0 + + UPDATE hrsa_tax_agent_manage_range + SET delete_type=1 + WHERE + tax_agent_id IN + + #{taxAgentId} + + AND delete_type = 0 + + + + UPDATE hrsa_tax_agent_manage_range + SET delete_type=1 + WHERE + tax_agent_sub_admin_id IN + + #{subAdminId} + + AND delete_type = 0 + \ No newline at end of file diff --git a/src/com/engine/salary/service/TaxAgentAdminService.java b/src/com/engine/salary/service/TaxAgentAdminService.java index 9c370fa98..274ba8c07 100644 --- a/src/com/engine/salary/service/TaxAgentAdminService.java +++ b/src/com/engine/salary/service/TaxAgentAdminService.java @@ -42,7 +42,6 @@ public interface TaxAgentAdminService { * 根据个税扣缴义务人id查询管理员 * * @param taxAgentIds - * @param currentEmployeeId * @return */ List listByTaxAgentIdsAndEmployeeId(Collection taxAgentIds, Long currentEmployeeId); diff --git a/src/com/engine/salary/service/TaxAgentManageRangeService.java b/src/com/engine/salary/service/TaxAgentManageRangeService.java index 33b1e6c31..88f6cf3b4 100644 --- a/src/com/engine/salary/service/TaxAgentManageRangeService.java +++ b/src/com/engine/salary/service/TaxAgentManageRangeService.java @@ -87,25 +87,22 @@ public interface TaxAgentManageRangeService { * 保存 * * @param saveParam 保存参数 - * @param employeeId 人员id */ - void save(TaxAgentRangeSaveParam saveParam, Long employeeId); + void save(TaxAgentRangeSaveParam saveParam); /** * 保存分管理员的管理范围 * * @param saveParam - * @param employeeId */ - void save4SubAdmin(TaxAgentSubAdminRangeSaveParam saveParam, Long employeeId); + void save4SubAdmin(TaxAgentSubAdminRangeSaveParam saveParam); /** * 根据主键id删除管理范围 * * @param ids - * @param employeeId */ - void deleteByIds(Collection ids, Long employeeId); + void deleteByIds(Collection ids); /** * 根据个税扣缴义务人的id删除管理范围 diff --git a/src/com/engine/salary/service/TaxAgentSubAdminEmpService.java b/src/com/engine/salary/service/TaxAgentSubAdminEmpService.java index a5a4cad17..88bee1f51 100644 --- a/src/com/engine/salary/service/TaxAgentSubAdminEmpService.java +++ b/src/com/engine/salary/service/TaxAgentSubAdminEmpService.java @@ -21,7 +21,6 @@ public interface TaxAgentSubAdminEmpService{ * * @param subAdminEmpSaveParamList * @param employeeId - * @param tenantKey */ void syncTaxAgentSubAdminEmployee(List subAdminEmpSaveParamList, Long employeeId); @@ -29,7 +28,6 @@ public interface TaxAgentSubAdminEmpService{ * 根据分管理员id获取人员 * * @param subAdminIds - * @param tenantKey * @return */ List listBySubAdminIds(List subAdminIds); @@ -38,7 +36,6 @@ public interface TaxAgentSubAdminEmpService{ * 根据分管理员id删除人员 * * @param subAdminIds - * @param tenantKey */ void deleteBySubAdminIds(Collection subAdminIds); diff --git a/src/com/engine/salary/service/TaxAgentSubAdminService.java b/src/com/engine/salary/service/TaxAgentSubAdminService.java index f428ede25..4ec62274a 100644 --- a/src/com/engine/salary/service/TaxAgentSubAdminService.java +++ b/src/com/engine/salary/service/TaxAgentSubAdminService.java @@ -60,10 +60,9 @@ public interface TaxAgentSubAdminService { * 根据id删除分管理员 * * @param ids - * @param employeeId * @return */ - String deleteByIds(Collection ids, Long employeeId); + String deleteByIds(Collection ids); /** * 根据分管理员id和个税扣缴义务人id获取分管理员 @@ -77,8 +76,7 @@ public interface TaxAgentSubAdminService { * 保存基础设置 * * @param saveParam - * @param employeeId * @return */ - String saveBase(TaxAgentSubAdminBaseSaveParam saveParam, Long employeeId); + String saveBase(TaxAgentSubAdminBaseSaveParam saveParam); } diff --git a/src/com/engine/salary/service/TaxAgentV2Service.java b/src/com/engine/salary/service/TaxAgentV2Service.java index 29bce7029..ab40411dc 100644 --- a/src/com/engine/salary/service/TaxAgentV2Service.java +++ b/src/com/engine/salary/service/TaxAgentV2Service.java @@ -125,10 +125,9 @@ public interface TaxAgentV2Service { * 新建个税扣缴义务人 * * @param saveParam - * @param employeeId * @return */ - String save(TaxAgentSaveParam saveParam, Long employeeId); + String save(TaxAgentSaveParam saveParam); /** * 更新代缴机构 @@ -142,27 +141,24 @@ public interface TaxAgentV2Service { * 编辑个税扣缴义务人 * * @param saveParam - * @param employeeId * @return */ - String update(TaxAgentSaveParam saveParam, Long employeeId); + String update(TaxAgentSaveParam saveParam); /** * 删除个税扣缴义务人 * * @param ids - * @param employeeId * @return */ - String delete(Collection ids, Long employeeId); + String delete(Collection ids); /** * 获取个税扣缴义务人下拉列表 * - * @param currentEmployeeId * @return */ - List> selectList(Long currentEmployeeId); + List> selectList(); /** * 是否开启分权 @@ -209,8 +205,7 @@ public interface TaxAgentV2Service { * 更换管理员校验是否有核算数据 * * @param checkParam - * @param currentEmployeeId * @return */ - Boolean adminChangeCheck(TaxAgentAdminChangeCheckParam checkParam, Long currentEmployeeId); + Boolean adminChangeCheck(TaxAgentAdminChangeCheckParam checkParam); } diff --git a/src/com/engine/salary/service/impl/TaxAgentAdminServiceImpl.java b/src/com/engine/salary/service/impl/TaxAgentAdminServiceImpl.java index a2042aa99..503421770 100644 --- a/src/com/engine/salary/service/impl/TaxAgentAdminServiceImpl.java +++ b/src/com/engine/salary/service/impl/TaxAgentAdminServiceImpl.java @@ -5,6 +5,7 @@ import com.engine.salary.constant.SalaryDefaultTenantConstant; import com.engine.salary.entity.taxagent.po.TaxAgentAdminPO; import com.engine.salary.mapper.taxagent.TaxAgentAdminMapper; import com.engine.salary.service.TaxAgentAdminService; +import com.engine.salary.util.db.MapperProxyFactory; import com.google.common.collect.Lists; import dm.jdbc.util.IdGenerator; import org.apache.commons.collections4.CollectionUtils; @@ -23,14 +24,16 @@ import java.util.List; **/ public class TaxAgentAdminServiceImpl extends Service implements TaxAgentAdminService { - private TaxAgentAdminMapper taxAgentAdminMapper; + private TaxAgentAdminMapper getTaxAgentAdminMapper() { + return MapperProxyFactory.getProxy(TaxAgentAdminMapper.class); + } @Override public void deleteByTaxAgentIds(Collection taxAgentIds) { if (CollectionUtils.isEmpty(taxAgentIds)) { return; } - taxAgentAdminMapper.deleteByTaxAgentIds(taxAgentIds); + getTaxAgentAdminMapper().deleteByTaxAgentIds(taxAgentIds); } @Override @@ -49,7 +52,7 @@ public class TaxAgentAdminServiceImpl extends Service implements TaxAgentAdminSe .creator((long) user.getUID()) .tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY) .build()) - .forEach(taxAgentAdminMapper::insertIgnoreNull); + .forEach(getTaxAgentAdminMapper()::insertIgnoreNull); } @Override @@ -58,7 +61,7 @@ public class TaxAgentAdminServiceImpl extends Service implements TaxAgentAdminSe if (CollectionUtils.isEmpty(taxAgentIds)) { return list; } - return taxAgentAdminMapper.listSome(TaxAgentAdminPO.builder().taxAgentIds(taxAgentIds).build()); + return getTaxAgentAdminMapper().listSome(TaxAgentAdminPO.builder().taxAgentIds(taxAgentIds).build()); } @@ -68,11 +71,11 @@ public class TaxAgentAdminServiceImpl extends Service implements TaxAgentAdminSe if (CollectionUtils.isEmpty(taxAgentIds) || currentEmployeeId == null) { return list; } - return taxAgentAdminMapper.listSome(TaxAgentAdminPO.builder().taxAgentIds(taxAgentIds).employeeId(currentEmployeeId).build()); + return getTaxAgentAdminMapper().listSome(TaxAgentAdminPO.builder().taxAgentIds(taxAgentIds).employeeId(currentEmployeeId).build()); } @Override public List listByEmployeeId(Long currentEmployeeId) { - return taxAgentAdminMapper.listSome(TaxAgentAdminPO.builder().employeeId(currentEmployeeId).build()); + return getTaxAgentAdminMapper().listSome(TaxAgentAdminPO.builder().employeeId(currentEmployeeId).build()); } } diff --git a/src/com/engine/salary/service/impl/TaxAgentBaseServiceImpl.java b/src/com/engine/salary/service/impl/TaxAgentBaseServiceImpl.java index 2a0f11299..25cae8472 100644 --- a/src/com/engine/salary/service/impl/TaxAgentBaseServiceImpl.java +++ b/src/com/engine/salary/service/impl/TaxAgentBaseServiceImpl.java @@ -1,5 +1,6 @@ package com.engine.salary.service.impl; +import com.engine.common.util.ServiceUtil; import com.engine.core.impl.Service; import com.engine.salary.constant.SalaryDefaultTenantConstant; import com.engine.salary.entity.salaryacct.po.SalaryAcctRecordPO; @@ -13,9 +14,11 @@ import com.engine.salary.service.SIAccountService; import com.engine.salary.service.SalaryAcctRecordService; import com.engine.salary.service.TaxAgentBaseService; import com.engine.salary.util.SalaryI18nUtil; +import com.engine.salary.util.db.MapperProxyFactory; import dm.jdbc.util.IdGenerator; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang.StringUtils; +import weaver.hrm.User; import java.util.Date; import java.util.List; @@ -30,9 +33,17 @@ import java.util.List; **/ public class TaxAgentBaseServiceImpl extends Service implements TaxAgentBaseService { - private TaxAgentBaseMapper taxAgentBaseMapper; - private SalaryAcctRecordService salaryAcctRecordService; - private SIAccountService siAccountService; + private TaxAgentBaseMapper getTaxAgentBaseMapper() { + return MapperProxyFactory.getProxy(TaxAgentBaseMapper.class); + } + + private SalaryAcctRecordService getSalaryAcctRecordService(User user) { + return ServiceUtil.getService(SalaryAcctRecordServiceImpl.class, user); + } + + private SIAccountService getSIAccountService(User user) { + return ServiceUtil.getService(SIAccountServiceImpl.class, user); + } public TaxAgentBaseServiceImpl() { } @@ -45,7 +56,7 @@ public class TaxAgentBaseServiceImpl extends Service implements TaxAgentBaseServ @Override public TaxAgentBasePO getBaseInfo() { - List list = taxAgentBaseMapper.listAll(); + List list = getTaxAgentBaseMapper().listAll(); return CollectionUtils.isEmpty(list) ? null : list.get(0); } @@ -67,7 +78,7 @@ public class TaxAgentBaseServiceImpl extends Service implements TaxAgentBaseServ Date now = new Date(); Integer devolutionStatus = saveBaseParam.getDevolutionStatus() ? SalaryOnOffEnum.ON.getValue() : SalaryOnOffEnum.OFF.getValue(); if (base == null) { - taxAgentBaseMapper.insertIgnoreNull( + getTaxAgentBaseMapper().insertIgnoreNull( TaxAgentBasePO.builder() .id(IdGenerator.generate()) .devolutionStatus(devolutionStatus) @@ -79,7 +90,7 @@ public class TaxAgentBaseServiceImpl extends Service implements TaxAgentBaseServ } else { base.setUpdateTime(now); base.setDevolutionStatus(devolutionStatus); - taxAgentBaseMapper.updateIgnoreNull(base); + getTaxAgentBaseMapper().updateIgnoreNull(base); } return StringUtils.EMPTY; } @@ -92,9 +103,9 @@ public class TaxAgentBaseServiceImpl extends Service implements TaxAgentBaseServ private boolean checkUsedData() { // 检查是否核算 // todo 1.社保福利档案是否有核算未归档 - Boolean checkedValue = false;//= siAccountService.changeAdminUnfiledCheck(); + Boolean checkedValue = false;//= getSIAccountService(user).changeAdminUnfiledCheck(); // todo 2.薪资核算是否有核算未归档 - List salaryAcctRecords = salaryAcctRecordService.listByStatus(SalaryAcctRecordStatusEnum.NOT_ARCHIVED);// salaryAcctRecordService.listByStatusAndEmployeeId(SalaryAcctRecordStatusEnum.NOT_ARCHIVED, currentTenantKey); + List salaryAcctRecords = getSalaryAcctRecordService(user).listByStatus(SalaryAcctRecordStatusEnum.NOT_ARCHIVED);// getSalaryAcctRecordService(user).listByStatusAndEmployeeId(SalaryAcctRecordStatusEnum.NOT_ARCHIVED, currentTenantKey); if (CollectionUtils.isNotEmpty(salaryAcctRecords) || checkedValue) { return Boolean.TRUE; } diff --git a/src/com/engine/salary/service/impl/TaxAgentEmpServiceImpl.java b/src/com/engine/salary/service/impl/TaxAgentEmpServiceImpl.java index 7ac7060d9..5808fb81d 100644 --- a/src/com/engine/salary/service/impl/TaxAgentEmpServiceImpl.java +++ b/src/com/engine/salary/service/impl/TaxAgentEmpServiceImpl.java @@ -1,5 +1,6 @@ package com.engine.salary.service.impl; +import com.engine.common.util.ServiceUtil; import com.engine.core.impl.Service; import com.engine.salary.constant.SalaryDefaultTenantConstant; import com.engine.salary.entity.datacollection.DataCollectionEmployee; @@ -12,9 +13,11 @@ import com.engine.salary.mapper.taxagent.TaxAgentEmpMapper; import com.engine.salary.service.TaxAgentEmpChangeService; import com.engine.salary.service.TaxAgentEmpService; import com.engine.salary.util.SalaryEntityUtil; +import com.engine.salary.util.db.MapperProxyFactory; import com.google.common.collect.Lists; import dm.jdbc.util.IdGenerator; import org.apache.commons.collections4.CollectionUtils; +import weaver.hrm.User; import java.util.*; import java.util.stream.Collectors; @@ -30,21 +33,25 @@ import java.util.stream.Collectors; public class TaxAgentEmpServiceImpl extends Service implements TaxAgentEmpService { - private TaxAgentEmpMapper taxAgentEmployeeMapper; + private TaxAgentEmpMapper getTaxAgentEmpMapper() { + return MapperProxyFactory.getProxy(TaxAgentEmpMapper.class); + } - private TaxAgentEmpChangeService taxAgentEmpChangeService; + public TaxAgentEmpChangeService getTaxAgentEmpChangeService(User user) { + return ServiceUtil.getService(TaxAgentEmpChangeServiceImpl.class, user); + } @Override public void deleteByTaxAgentIds(Collection taxAgentIds) { if (CollectionUtils.isEmpty(taxAgentIds)) { return; } - List taxAgentEmpList = taxAgentEmployeeMapper.listSome(TaxAgentEmpPO.builder().taxAgentIds(taxAgentIds).build()); + List taxAgentEmpList = getTaxAgentEmpMapper().listSome(TaxAgentEmpPO.builder().taxAgentIds(taxAgentIds).build()); if (CollectionUtils.isEmpty(taxAgentEmpList)) { return; } List idList = taxAgentEmpList.stream().map(TaxAgentEmpPO::getId).collect(Collectors.toList()); - taxAgentEmployeeMapper.deleteByIds(idList); + getTaxAgentEmpMapper().deleteByIds(idList); } @Override @@ -52,7 +59,7 @@ public class TaxAgentEmpServiceImpl extends Service implements TaxAgentEmpServic if (CollectionUtils.isEmpty(taxAgentIds)) { return Lists.newArrayList(); } - return taxAgentEmployeeMapper.listSome(TaxAgentEmpPO.builder().taxAgentIds(taxAgentIds).build()); + return getTaxAgentEmpMapper().listSome(TaxAgentEmpPO.builder().taxAgentIds(taxAgentIds).build()); } @Override @@ -134,15 +141,15 @@ public class TaxAgentEmpServiceImpl extends Service implements TaxAgentEmpServic // 关联表==================================================== // 新增 if (CollectionUtils.isNotEmpty(taxAgentEmployeeAddList)) { - taxAgentEmployeeMapper.batchInsert(taxAgentEmployeeAddList); + getTaxAgentEmpMapper().batchInsert(taxAgentEmployeeAddList); } // 删除 if (CollectionUtils.isNotEmpty(taxAgentEmployeeDelIds)) { - taxAgentEmployeeMapper.deleteByIds(taxAgentEmployeeDelIds); + getTaxAgentEmpMapper().deleteByIds(taxAgentEmployeeDelIds); } // 增量表==================================================== if (CollectionUtils.isNotEmpty(taxAgentEmpChangeList)) { - taxAgentEmpChangeService.batchInsert(taxAgentEmpChangeList); + getTaxAgentEmpChangeService(user).batchInsert(taxAgentEmpChangeList); } } } diff --git a/src/com/engine/salary/service/impl/TaxAgentManageRangeServiceImpl.java b/src/com/engine/salary/service/impl/TaxAgentManageRangeServiceImpl.java index 922ea07e6..021a6f7ad 100644 --- a/src/com/engine/salary/service/impl/TaxAgentManageRangeServiceImpl.java +++ b/src/com/engine/salary/service/impl/TaxAgentManageRangeServiceImpl.java @@ -1,10 +1,13 @@ package com.engine.salary.service.impl; -import com.alibaba.fastjson.JSONObject; -import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; -import com.baomidou.mybatisplus.extension.conditions.update.LambdaUpdateChainWrapper; +import com.engine.common.util.ServiceUtil; import com.engine.core.impl.Service; +import com.engine.salary.biz.EmployBiz; import com.engine.salary.entity.datacollection.DataCollectionEmployee; +import com.engine.salary.entity.hrm.DeptInfo; +import com.engine.salary.entity.hrm.HrmStatus; +import com.engine.salary.entity.hrm.PositionInfo; +import com.engine.salary.entity.hrm.SubCompanyInfo; import com.engine.salary.entity.taxagent.bo.TaxAgentBO; import com.engine.salary.entity.taxagent.dto.TaxAgentManageRangeEmployeeDTO; import com.engine.salary.entity.taxagent.dto.TaxAgentManageRangeListDTO; @@ -12,7 +15,7 @@ import com.engine.salary.entity.taxagent.param.*; import com.engine.salary.entity.taxagent.po.TaxAgentManageRangePO; import com.engine.salary.entity.taxagent.po.TaxAgentPO; import com.engine.salary.entity.taxagent.po.TaxAgentSubAdminPO; -import com.engine.salary.enums.SalaryJobFlagEnum; +import com.engine.salary.enums.UserStatusEnum; import com.engine.salary.enums.salarysob.SalaryEmployeeStatusEnum; import com.engine.salary.enums.salarysob.TargetTypeEnum; import com.engine.salary.enums.taxagent.TaxAgentRangeTypeEnum; @@ -23,27 +26,16 @@ import com.engine.salary.service.*; import com.engine.salary.util.JsonUtil; import com.engine.salary.util.SalaryEntityUtil; import com.engine.salary.util.SalaryI18nUtil; +import com.engine.salary.util.db.MapperProxyFactory; import com.engine.salary.util.page.PageInfo; import com.engine.salary.util.page.PageUtil; import com.google.common.collect.Lists; -import com.weaver.common.async.bean.AsyncBean; -import com.weaver.common.async.consumer.anno.method.AsyncListener; -import com.weaver.common.cache.tablecache.impl.ComInfoCache; -import com.weaver.common.hrm.cache.HrmDepartmentComInfo; -import com.weaver.common.hrm.cache.HrmEmployeeComInfo; -import com.weaver.common.hrm.cache.HrmPositionComInfo; -import com.weaver.common.hrm.domain.employee.HrmStatus; -import com.weaver.common.hrm.domain.queue.HrmCommonQueue; -import com.weaver.common.hrm.service.employee.HrmCommonHrmStatusService; -import com.weaver.datasecurity.interceptor.DSTenantKeyThreadVar; -import com.weaver.hrm.salary.common.SalaryEmployee; -import com.weaver.hrm.salary.entity.taxagent.param.*; -import com.weaver.hrm.salary.service.*; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.math.NumberUtils; import org.springframework.transaction.annotation.Transactional; +import weaver.hrm.User; import java.util.*; import java.util.concurrent.ExecutorService; @@ -60,29 +52,44 @@ import java.util.stream.Collectors; @Slf4j public class TaxAgentManageRangeServiceImpl extends Service implements TaxAgentManageRangeService { - private TaxAgentManageRangeMapper taxAgentManageRangeMapper; + private TaxAgentManageRangeMapper getTaxAgentManageRangeMapper() { + return MapperProxyFactory.getProxy(TaxAgentManageRangeMapper.class); + } - private TaxAgentV2Service taxAgentService; + private TaxAgentV2Service getTaxAgentV2Service(User user) { + return ServiceUtil.getService(TaxAgentV2ServiceImpl.class, user); + } private TaxAgentSubAdminService taxAgentSubAdminService; +// private TaxAgentSubAdminService getTaxAgentSubAdminService(User user) { +// return ServiceUtil.getService(TaxAgentSubAdminServiceImpl.class, user); +// } - private TaxAgentEmpService taxAgentEmployeeService; + private TaxAgentEmpService getTaxAgentEmpService(User user) { + return ServiceUtil.getService(TaxAgentEmpServiceImpl.class, user); + } private TaxAgentSubAdminEmpService taxAgentSubAdminEmployeeService; +// private TaxAgentSubAdminEmpService getTaxAgentSubAdminEmpService(User user) { +// return ServiceUtil.getService(TaxAgentSubAdminEmpServiceImpl.class, user); +// } - private ComInfoCache comInfoCache; +// private ComInfoCache comInfoCache; - private EmployMapper employeeMapper; + private EmployMapper getEmployMapper() { + return MapperProxyFactory.getProxy(EmployMapper.class); + } private ExecutorService taskExecutor; - private HrmCommonHrmStatusService hrmCommonHrmStatusService; + private EmployBiz employBiz = new EmployBiz(); +// private HrmCommonHrmStatusService hrmCommonHrmStatusService; private List listByTaxAgentIds(List taxAgentIds) { if (CollectionUtils.isEmpty(taxAgentIds)) { return Lists.newArrayList(); } - return taxAgentManageRangeMapper.listSome(TaxAgentManageRangePO.builder().rangeType(TaxAgentRangeTypeEnum.TAXAGENT.getValue()).taxAgentIds(taxAgentIds).build()); + return getTaxAgentManageRangeMapper().listSome(TaxAgentManageRangePO.builder().rangeType(TaxAgentRangeTypeEnum.TAXAGENT.getValue()).taxAgentIds(taxAgentIds).build()); } @Override @@ -101,7 +108,7 @@ public class TaxAgentManageRangeServiceImpl extends Service implements TaxAgentM if (CollectionUtils.isEmpty(taxAgentSubAdminIds)) { return Lists.newArrayList(); } - return taxAgentManageRangeMapper.listSome(TaxAgentManageRangePO.builder().rangeType(TaxAgentRangeTypeEnum.SUBADMIN.getValue()).taxAgentSubAdminIds(taxAgentSubAdminIds).build()); + return getTaxAgentManageRangeMapper().listSome(TaxAgentManageRangePO.builder().rangeType(TaxAgentRangeTypeEnum.SUBADMIN.getValue()).taxAgentSubAdminIds(taxAgentSubAdminIds).build()); } @Override @@ -164,11 +171,10 @@ public class TaxAgentManageRangeServiceImpl extends Service implements TaxAgentM List personnelStatuss = Lists.newArrayList(); if (employeeStatus != null) { // 查询人员状态 - List hrmStatusList = hrmCommonHrmStatusService.list(); if (employeeStatus.equals(SalaryEmployeeStatusEnum.NORMAL)) { - personnelStatuss = hrmStatusList.stream().filter(f -> f.getJobflag().equals(SalaryJobFlagEnum.normal.getValue())).map(m -> m.getCodeId() + "").collect(Collectors.toList()); + personnelStatuss = UserStatusEnum.getNormalStatus(); } else if (employeeStatus.equals(SalaryEmployeeStatusEnum.UNAVAILABLE)) { - personnelStatuss = hrmStatusList.stream().filter(f -> f.getJobflag().equals(SalaryJobFlagEnum.unavailable.getValue())).map(m -> m.getCodeId() + "").collect(Collectors.toList()); + personnelStatuss = UserStatusEnum.getUnavailableStatus(); } } // 根据上一步的查询参数查询人员 @@ -201,7 +207,7 @@ public class TaxAgentManageRangeServiceImpl extends Service implements TaxAgentM if (CollectionUtils.isEmpty(taxAgentManageRanges)) { return Collections.emptyList(); } - List salaryEmployees = employeeMapper.listAll(); + List salaryEmployees = getEmployMapper().listAll(); List salaryEmployeeList = Lists.newArrayList(); for (TaxAgentManageRangePO manageRange : taxAgentManageRanges) { salaryEmployeeList.addAll(salaryEmployees.stream() @@ -212,7 +218,7 @@ public class TaxAgentManageRangeServiceImpl extends Service implements TaxAgentM if (CollectionUtils.isNotEmpty(personnelStatuss)) { hrmStatusList = hrmStatusList.stream().filter(personnelStatuss::contains).collect(Collectors.toList()); } - if (CollectionUtils.isNotEmpty(hrmStatusList) && !hrmStatusList.contains(salaryEmployee.getPersonnelStatus())) { + if (CollectionUtils.isNotEmpty(hrmStatusList) && !hrmStatusList.contains(salaryEmployee.getStatus())) { return false; } if (Objects.equals(manageRange.getTargetType(), TargetTypeEnum.ALL.getValue())) { @@ -242,16 +248,17 @@ public class TaxAgentManageRangeServiceImpl extends Service implements TaxAgentM return salaryEmployeeList; } -// /** -// * 根据分管理员id获取管理范围列表 -// * -// * @param subAdminId -// * @param includeType -// * @return -// */ -// private List listBySubAdminIdAndIncludeType(Long subAdminId, Integer includeType) { -// -// return new LambdaQueryChainWrapper<>(taxAgentManageRangeMapper) + /** + * 根据分管理员id获取管理范围列表 + * + * @param subAdminId + * @param includeType + * @return + */ + private List listBySubAdminIdAndIncludeType(Long subAdminId, Integer includeType) { + + return getTaxAgentManageRangeMapper().listSome(TaxAgentManageRangePO.builder().taxAgentSubAdminId(subAdminId).rangeType(TaxAgentRangeTypeEnum.SUBADMIN.getValue()).includeType(includeType).build()); +// return new LambdaQueryChainWrapper<>(getTaxAgentManageRangeMapper()) // .eq(TaxAgentManageRangePO::getTenantKey) // .eq(TaxAgentManageRangePO::getDeleteType, 0) // .eq(TaxAgentManageRangePO::getTaxAgentSubAdminId, subAdminId) @@ -259,7 +266,7 @@ public class TaxAgentManageRangeServiceImpl extends Service implements TaxAgentM // .eq(TaxAgentManageRangePO::getIncludeType, includeType) // .orderByDesc(TaxAgentManageRangePO::getId) // .list(); -// } + } /** * 获取个税口角义务人的管理范围 @@ -269,15 +276,15 @@ public class TaxAgentManageRangeServiceImpl extends Service implements TaxAgentM * @return */ private List listByTaxAgentIdAndIncludeType(Long taxAgentId, Integer includeType) { - return taxAgentManageRangeMapper.listSome(TaxAgentManageRangePO.builder().taxAgentId(taxAgentId).rangeType(TaxAgentRangeTypeEnum.TAXAGENT.getValue()).includeType(includeType).build()); + return getTaxAgentManageRangeMapper().listSome(TaxAgentManageRangePO.builder().taxAgentId(taxAgentId).rangeType(TaxAgentRangeTypeEnum.TAXAGENT.getValue()).includeType(includeType).build()); } -// @Override -// public Page listPageByParamAndIncludeType(TaxAgentSubAdminRangeQueryParam queryParam, Integer includeType) { -// // 查询已有的管理范围 -// List taxAgentManageRanges = listBySubAdminIdAndIncludeType(queryParam.getSubAdminId(), includeType); -// return listPageByParamAndIncludeType(taxAgentManageRanges, queryParam, includeType); -// } + @Override + public PageInfo listPageByParamAndIncludeType(TaxAgentSubAdminRangeQueryParam queryParam, Integer includeType) { + // 查询已有的管理范围 + List taxAgentManageRanges = listBySubAdminIdAndIncludeType(queryParam.getSubAdminId(), includeType); + return listPageByParamAndIncludeType(taxAgentManageRanges, queryParam, includeType); + } @Override public PageInfo listPageByParamAndIncludeType(TaxAgentRangeQueryParam queryParam, Integer includeType) { @@ -289,33 +296,36 @@ public class TaxAgentManageRangeServiceImpl extends Service implements TaxAgentM private PageInfo listPageByParamAndIncludeType(List taxAgentManageRanges, TaxAgentManageRangeQueryParam queryParam, Integer includeType) { // 查询人员信息 - List employeeIds = taxAgentManageRanges.stream() + List employeeIds = taxAgentManageRanges.stream() .filter(e -> Objects.equals(e.getTargetType(), TargetTypeEnum.EMPLOYEE.getValue())) .map(TaxAgentManageRangePO::getTargetId) .collect(Collectors.toList()); - List employeeComInfos = comInfoCache.getCacheList(HrmEmployeeComInfo.class, employeeIds); +// List employeeComInfos = comInfoCache.getCacheList(HrmEmployeeComInfo.class, employeeIds); + List employeeComInfos = employBiz.getEmployeeByIdsAll(employeeIds); // 查询部门信息 - List departmentIds = taxAgentManageRanges.stream() + List departmentIds = taxAgentManageRanges.stream() .filter(e -> Objects.equals(e.getTargetType(), TargetTypeEnum.DEPT.getValue())) .map(TaxAgentManageRangePO::getTargetId) .collect(Collectors.toList()); - List departmentComInfos = comInfoCache.getCacheList(HrmDepartmentComInfo.class, departmentIds); + List departmentComInfos = employBiz.getDeptInfoList(departmentIds); // 查询分部信息 - List subDepartmentIds = taxAgentManageRanges.stream() + List subDepartmentIds = taxAgentManageRanges.stream() .filter(e -> Objects.equals(e.getTargetType(), TargetTypeEnum.SUBCOMPANY.getValue())) .map(TaxAgentManageRangePO::getTargetId) .collect(Collectors.toList()); - List subDepartmentComInfos = comInfoCache.getCacheList(HrmDepartmentComInfo.class, subDepartmentIds); + + List subDepartmentComInfos = employBiz.getSubCompanyInfoList(subDepartmentIds); // 查询岗位信息 - List positionIds = taxAgentManageRanges.stream() + List positionIds = taxAgentManageRanges.stream() .filter(e -> Objects.equals(e.getTargetType(), TargetTypeEnum.POSITION.getValue())) .map(TaxAgentManageRangePO::getTargetId) .collect(Collectors.toList()); - List positionComInfos = comInfoCache.getCacheList(HrmPositionComInfo.class, positionIds); + List positionComInfos = employBiz.listPositionInfo(positionIds); // 分页参数 PageInfo dtoPage = PageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), TaxAgentManageRangeListDTO.class); // 查询人员状态 - List hrmStatusList = hrmCommonHrmStatusService.list(); +// List hrmStatusList = hrmCommonHrmStatusService.list(); + List hrmStatusList = UserStatusEnum.getHrmStatusList(); // 薪资账套的人员范围po转换成列表dto List taxAgentManageRangeList = TaxAgentBO.convert2ListDTO(taxAgentManageRanges, employeeComInfos, departmentComInfos, subDepartmentComInfos, positionComInfos, hrmStatusList); // 根据对象名称过滤 @@ -333,13 +343,12 @@ public class TaxAgentManageRangeServiceImpl extends Service implements TaxAgentM /** * 根据个税口角义务人id保存管理范围 * - * @param saveParam 保存参数 - * @param employeeId 人员id + * @param saveParam 保存参数 */ @Override - public void save(TaxAgentRangeSaveParam saveParam, Long employeeId) { + public void save(TaxAgentRangeSaveParam saveParam) { // 查询薪资账套 - TaxAgentPO taxAgent = taxAgentService.getById(saveParam.getTaxAgentId()); + TaxAgentPO taxAgent = getTaxAgentV2Service(user).getById(saveParam.getTaxAgentId()); if (Objects.isNull(taxAgent)) { throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(108605, "参数错误,个税扣缴义务人不存在或者已被删除")); } @@ -348,7 +357,7 @@ public class TaxAgentManageRangeServiceImpl extends Service implements TaxAgentM List taxAgentManageRanges = taxAgentManageAllRanges.stream().filter(f -> f.getIncludeType().equals(saveParam.getIncludeType())).collect(Collectors.toList()); // 处理一下本次的保存参数(如果原来添加过对应的人员(/部门/岗位),那么本次不需要新增,只需要更新) - TaxAgentBO.Result result = TaxAgentBO.handleTaxAgentRange(taxAgentManageRanges, saveParam, taxAgent.getId(), employeeId); + TaxAgentBO.Result result = TaxAgentBO.handleTaxAgentRange(taxAgentManageRanges, saveParam, taxAgent.getId(), (long) user.getUID()); /** 检查当前个税扣缴义务人的所有人员范围与所有分管理员的管理范围===========================start */ List allRanges = Lists.newArrayList(taxAgentManageAllRanges); @@ -372,18 +381,20 @@ public class TaxAgentManageRangeServiceImpl extends Service implements TaxAgentM } } /** 检查当前个税扣缴义务人的所有人员范围与所有分管理员的管理范围===========================end */ - // 保存 + // todo 保存 if (CollectionUtils.isNotEmpty(result.getNeedInsertTaxAgentManageRanges())) { - this.saveBatch(result.getNeedInsertTaxAgentManageRanges()); +// this.saveBatch(result.getNeedInsertTaxAgentManageRanges()); + result.getNeedInsertTaxAgentManageRanges().forEach(range -> getTaxAgentManageRangeMapper().insertIgnoreNull(range)); } if (CollectionUtils.isNotEmpty(result.getNeedUpdateTaxAgentManageRanges())) { - this.updateBatchById(result.getNeedUpdateTaxAgentManageRanges()); + result.getNeedInsertTaxAgentManageRanges().forEach(range -> getTaxAgentManageRangeMapper().updateIgnoreNull(range)); +// this.updateBatchById(result.getNeedUpdateTaxAgentManageRanges()); } /** 同步本地人员范围的关联人员=========================== */ taskExecutor.execute(() -> { try { - syncLocalEmp(saveParam.getTaxAgentId(), allSalaryEmployees, allSubAdminRanges, employeeId); + syncLocalEmp(saveParam.getTaxAgentId(), allSalaryEmployees, allSubAdminRanges, (long) user.getUID()); } finally { } }); @@ -398,16 +409,16 @@ public class TaxAgentManageRangeServiceImpl extends Service implements TaxAgentM * @return */ private List listByTaxAgentId(Long taxAgentId) { - return taxAgentManageRangeMapper.listSome(TaxAgentManageRangePO.builder().taxAgentId(taxAgentId).rangeType(TaxAgentRangeTypeEnum.TAXAGENT.getValue()).build()); + return getTaxAgentManageRangeMapper().listSome(TaxAgentManageRangePO.builder().taxAgentId(taxAgentId).rangeType(TaxAgentRangeTypeEnum.TAXAGENT.getValue()).build()); } private List listSunAdminRangeByTaxAgentId(Long taxAgentId) { - return taxAgentManageRangeMapper.listSome(TaxAgentManageRangePO.builder().taxAgentId(taxAgentId).rangeType(TaxAgentRangeTypeEnum.SUBADMIN.getValue()).build()); + return getTaxAgentManageRangeMapper().listSome(TaxAgentManageRangePO.builder().taxAgentId(taxAgentId).rangeType(TaxAgentRangeTypeEnum.SUBADMIN.getValue()).build()); } @Override @Transactional(rollbackFor = Exception.class) - public void save4SubAdmin(TaxAgentSubAdminRangeSaveParam saveParam, Long employeeId) { + public void save4SubAdmin(TaxAgentSubAdminRangeSaveParam saveParam) { // 查询薪资账套 TaxAgentSubAdminPO taxAgentSubAdmin = taxAgentSubAdminService.getById(saveParam.getSubAdminId()); if (Objects.isNull(taxAgentSubAdmin)) { @@ -417,7 +428,7 @@ public class TaxAgentManageRangeServiceImpl extends Service implements TaxAgentM List taxAgentManageAllRanges = listBySubAdminId(saveParam.getSubAdminId()); List taxAgentManageRanges = taxAgentManageAllRanges.stream().filter(f -> f.getIncludeType().equals(saveParam.getIncludeType())).collect(Collectors.toList()); // 处理一下本次的保存参数(如果原来添加过对应的人员(/部门/岗位),那么本次不需要新增,只需要更新) - TaxAgentBO.Result result = TaxAgentBO.handleSubAdminRange(taxAgentManageRanges, saveParam, taxAgentSubAdmin.getTaxAgentId(), taxAgentSubAdmin.getId(), employeeId); + TaxAgentBO.Result result = TaxAgentBO.handleSubAdminRange(taxAgentManageRanges, saveParam, taxAgentSubAdmin.getTaxAgentId(), taxAgentSubAdmin.getId(), (long) user.getUID()); // 当前库中所有分管理员的管理范围 List allSubAdminRangesExist = listSunAdminRangeByTaxAgentId(taxAgentSubAdmin.getTaxAgentId()); @@ -430,11 +441,11 @@ public class TaxAgentManageRangeServiceImpl extends Service implements TaxAgentM allSubAdminRangesCuttent.addAll(result.getNeedUpdateTaxAgentManageRanges()); // 当前分管理员的所有人员 - List currentSubAdminSalaryEmployees = this.getManageRangeSalaryEmployees(null, taxAgentSubAdmin.getTaxAgentId(), allSubAdminRangesCuttent); + List currentSubAdminSalaryEmployees = this.getManageRangeSalaryEmployees(null, taxAgentSubAdmin.getTaxAgentId(), allSubAdminRangesCuttent); // 其他分管理员的所有人员 - List otherSubAdminSalaryEmployees = this.getManageRangeSalaryEmployees(null, taxAgentSubAdmin.getTaxAgentId(), otherSubAdminRangesExist); - for (SalaryEmployee se : currentSubAdminSalaryEmployees) { - Optional optionalSe = otherSubAdminSalaryEmployees.stream().filter(f -> f.getEmployeeId().equals(se.getEmployeeId())).findFirst(); + List otherSubAdminSalaryEmployees = this.getManageRangeSalaryEmployees(null, taxAgentSubAdmin.getTaxAgentId(), otherSubAdminRangesExist); + for (DataCollectionEmployee se : currentSubAdminSalaryEmployees) { + Optional optionalSe = otherSubAdminSalaryEmployees.stream().filter(f -> f.getEmployeeId().equals(se.getEmployeeId())).findFirst(); if (optionalSe.isPresent()) { throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(110149, "不可包含其他分管理员的人员")); } @@ -452,10 +463,10 @@ public class TaxAgentManageRangeServiceImpl extends Service implements TaxAgentM ), ArrayList::new)); // 所属个税扣缴义务人的所有人员 List allRanges = listByTaxAgentId(taxAgentSubAdmin.getTaxAgentId()); - List allSalaryEmployees = this.getManageRangeSalaryEmployees(null, taxAgentSubAdmin.getTaxAgentId(), allRanges); + List allSalaryEmployees = this.getManageRangeSalaryEmployees(null, taxAgentSubAdmin.getTaxAgentId(), allRanges); // 所有分管理员的所有人员 - List allSubAdminSalaryEmployees = this.getManageRangeSalaryEmployees(null, taxAgentSubAdmin.getTaxAgentId(), allSubAdminRanges); - List allSalaryEmployeeIds = allSalaryEmployees.stream().map(SalaryEmployee::getEmployeeId).collect(Collectors.toList()); + List allSubAdminSalaryEmployees = this.getManageRangeSalaryEmployees(null, taxAgentSubAdmin.getTaxAgentId(), allSubAdminRanges); + List allSalaryEmployeeIds = allSalaryEmployees.stream().map(DataCollectionEmployee::getEmployeeId).collect(Collectors.toList()); allSubAdminSalaryEmployees.removeIf(a -> allSalaryEmployeeIds.contains(a.getEmployeeId())); if (CollectionUtils.isNotEmpty(allSubAdminSalaryEmployees)) { throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(110125, "超出了整体人员范围")); @@ -464,19 +475,19 @@ public class TaxAgentManageRangeServiceImpl extends Service implements TaxAgentM // 保存 if (CollectionUtils.isNotEmpty(result.getNeedInsertTaxAgentManageRanges())) { - this.saveBatch(result.getNeedInsertTaxAgentManageRanges()); + result.getNeedInsertTaxAgentManageRanges().forEach(range -> getTaxAgentManageRangeMapper().insertIgnoreNull(range)); +// todo this.saveBatch(result.getNeedInsertTaxAgentManageRanges()); } if (CollectionUtils.isNotEmpty(result.getNeedUpdateTaxAgentManageRanges())) { - this.updateBatchById(result.getNeedUpdateTaxAgentManageRanges()); + result.getNeedUpdateTaxAgentManageRanges().forEach(range -> getTaxAgentManageRangeMapper().updateIgnoreNull(range)); +// todo this.updateBatchById(result.getNeedUpdateTaxAgentManageRanges()); } /** 同步本地人员范围的关联人员=========================== */ List finalAllSubAdminRanges = allSubAdminRanges; taskExecutor.execute(() -> { try { - DSTenantKeyThreadVar.tenantKey.set(tenantKey); - syncLocalEmp(taxAgentSubAdmin.getTaxAgentId(), allSalaryEmployees, finalAllSubAdminRanges, employeeId); + syncLocalEmp(taxAgentSubAdmin.getTaxAgentId(), allSalaryEmployees, finalAllSubAdminRanges, (long) user.getUID()); } finally { - DSTenantKeyThreadVar.tenantKey.remove(); } }); // 记录日志 todo @@ -489,18 +500,18 @@ public class TaxAgentManageRangeServiceImpl extends Service implements TaxAgentM * @return */ private List listBySubAdminId(Long subAdminId) { - return taxAgentManageRangeMapper.listSome(TaxAgentManageRangePO.builder().taxAgentSubAdminId(subAdminId).rangeType(TaxAgentRangeTypeEnum.SUBADMIN.getValue()).build()); + return getTaxAgentManageRangeMapper().listSome(TaxAgentManageRangePO.builder().taxAgentSubAdminId(subAdminId).rangeType(TaxAgentRangeTypeEnum.SUBADMIN.getValue()).build()); } private List listByIds(Collection ids) { if (CollectionUtils.isEmpty(ids)) { return Collections.emptyList(); } - return taxAgentManageRangeMapper.listSome(TaxAgentManageRangePO.builder().ids(ids).build()); + return getTaxAgentManageRangeMapper().listSome(TaxAgentManageRangePO.builder().ids(ids).build()); } @Override - public void deleteByIds(Collection ids, Long employeeId) { + public void deleteByIds(Collection ids) { // 查询管理范围 List taxAgentManageRanges = listByIds(ids); if (CollectionUtils.isEmpty(taxAgentManageRanges)) { @@ -526,12 +537,12 @@ public class TaxAgentManageRangeServiceImpl extends Service implements TaxAgentM throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(110160, "分管理员存在超出整体人员范围以外的人员,不可删除")); } // 删除管理范围 - taxAgentManageRangeMapper.deleteByIds(ids); + getTaxAgentManageRangeMapper().deleteByIds(ids); /** 同步本地人员范围的关联人员=========================== */ taskExecutor.execute(() -> { try { - syncLocalEmp(taxAgentId, allSalaryEmployees, allSubAdminRanges, employeeId); + syncLocalEmp(taxAgentId, allSalaryEmployees, allSubAdminRanges, (long) user.getUID()); } finally { } }); @@ -539,60 +550,47 @@ public class TaxAgentManageRangeServiceImpl extends Service implements TaxAgentM } @Override - public void deleteByTaxAgentIds(Collection taxAgentIds, String tenantKey) { - new LambdaUpdateChainWrapper<>(taxAgentManageRangeMapper) - .eq(TaxAgentManageRangePO::getDeleteType, 0) - .eq(TaxAgentManageRangePO::getTenantKey) - .in(TaxAgentManageRangePO::getTaxAgentId, taxAgentIds) - .set(TaxAgentManageRangePO::getDeleteType, 1) - .update(); + public void deleteByTaxAgentIds(Collection taxAgentIds) { + getTaxAgentManageRangeMapper().deleteByTaxAgentIds(taxAgentIds); // 删除管理范围下的所有人员 - taxAgentEmployeeService.deleteByTaxAgentIds(taxAgentIds); + getTaxAgentEmpService(user).deleteByTaxAgentIds(taxAgentIds); } @Override - public void deleteBySubAdmins(Collection subAdminIds, String tenantKey) { + public void deleteBySubAdmins(Collection subAdminIds) { if (CollectionUtils.isEmpty(subAdminIds)) { return; } - new LambdaUpdateChainWrapper<>(taxAgentManageRangeMapper) - .eq(TaxAgentManageRangePO::getDeleteType, 0) - .eq(TaxAgentManageRangePO::getTenantKey) - .in(TaxAgentManageRangePO::getTaxAgentSubAdminId, subAdminIds) - .set(TaxAgentManageRangePO::getDeleteType, 1) - .update(); + getTaxAgentManageRangeMapper().deleteBySubAdminIds(subAdminIds); // 删除管理范围下的所有人员 taxAgentSubAdminEmployeeService.deleteBySubAdminIds(subAdminIds); } - @AsyncListener(topic = "hrm_resource_queue") - public void receiveHrmResourceQueue(AsyncBean asyncBean) { - log.info("接受到人员变动的结果:{}", JSONObject.toJSONString(asyncBean)); - // todo 过滤必要性事件类型进行处理,后续加上时间间隔,避免人事批量操作时,监听事件过多 - if (asyncBean == null || asyncBean.getMessage() == null) { - log.error("接受到人员变动的结果失败"); - } - String tenantKey = asyncBean.getMessage().getTenantKey(); - // 开始同步 - taskExecutor.execute(() -> { - try { - handleSyncTaxAgentEmpData(); - } finally { - } - }); - } + //fixme +// @AsyncListener(topic = "hrm_resource_queue") +// public void receiveHrmResourceQueue(AsyncBean asyncBean) { +// log.info("接受到人员变动的结果:{}", JSONObject.toJSONString(asyncBean)); +// // todo 过滤必要性事件类型进行处理,后续加上时间间隔,避免人事批量操作时,监听事件过多 +// if (asyncBean == null || asyncBean.getMessage() == null) { +// log.error("接受到人员变动的结果失败"); +// } +// String tenantKey = asyncBean.getMessage().getTenantKey(); +// // 开始同步 +// taskExecutor.execute(() -> { +// try { +// handleSyncTaxAgentEmpData(); +// } finally { +// } +// }); +// } /** - * 同步处理所有人员泛微 + * 同步处理所有人员范围 * * @param */ private void handleSyncTaxAgentEmpData() { - List allManageRanges = new LambdaQueryChainWrapper<>(taxAgentManageRangeMapper) - .eq(TaxAgentManageRangePO::getTenantKey) - .eq(TaxAgentManageRangePO::getDeleteType, 0) - .orderByDesc(TaxAgentManageRangePO::getId) - .list(); + List allManageRanges = getTaxAgentManageRangeMapper().listAll(); if (CollectionUtils.isEmpty(allManageRanges)) { return; } @@ -611,7 +609,7 @@ public class TaxAgentManageRangeServiceImpl extends Service implements TaxAgentM }); Long employeeId = 0L; // 同步管理员的人员 - taxAgentEmployeeService.syncTaxAgentEmployee(taxAgentEmpSaveParamList, employeeId); + getTaxAgentEmpService(user).syncTaxAgentEmployee(taxAgentEmpSaveParamList, employeeId); // 同步分管理员的人员 taxAgentSubAdminEmployeeService.syncTaxAgentSubAdminEmployee(subAdminEmpSaveParamList, employeeId); } @@ -664,7 +662,7 @@ public class TaxAgentManageRangeServiceImpl extends Service implements TaxAgentM private void syncLocalEmp(Long taxAgentId, List allSalaryEmployees, List allSubAdminRanges, Long employeeId) { List taxAgentEmpSaveParamList = Collections.singletonList(getTaxAgentEmpSyncParam(taxAgentId, allSalaryEmployees)); // 同步个税扣缴义务人的人员 - taxAgentEmployeeService.syncTaxAgentEmployee(taxAgentEmpSaveParamList, employeeId); + getTaxAgentEmpService(user).syncTaxAgentEmployee(taxAgentEmpSaveParamList, employeeId); List subAdminEmpSaveParamList = getTaxAgentSubAdminEmpSyncParam(taxAgentId, allSubAdminRanges); // 同步分管理员的人员 diff --git a/src/com/engine/salary/service/impl/TaxAgentV2ServiceImpl.java b/src/com/engine/salary/service/impl/TaxAgentV2ServiceImpl.java index 60da8280f..e47dcf260 100644 --- a/src/com/engine/salary/service/impl/TaxAgentV2ServiceImpl.java +++ b/src/com/engine/salary/service/impl/TaxAgentV2ServiceImpl.java @@ -1,12 +1,14 @@ package com.engine.salary.service.impl; +import com.engine.common.service.HrmCommonService; +import com.engine.common.service.impl.HrmCommonServiceImpl; +import com.engine.common.util.ServiceUtil; import com.engine.core.impl.Service; -import com.engine.salary.constant.TaxAgentPermissionConstant; +import com.engine.salary.biz.SalaryRoleBiz; import com.engine.salary.entity.datacollection.AddUpDeduction; import com.engine.salary.entity.datacollection.AddUpSituation; import com.engine.salary.entity.datacollection.po.OtherDeductionPO; import com.engine.salary.entity.salaryacct.po.SalaryAcctRecordPO; -import com.engine.salary.entity.salaryarchive.po.SalaryArchivePO; import com.engine.salary.entity.taxagent.bo.TaxAgentBO; import com.engine.salary.entity.taxagent.dto.TaxAgentEmployeeDTO; import com.engine.salary.entity.taxagent.dto.TaxAgentEmployeeTaxAgentDTO; @@ -16,7 +18,6 @@ import com.engine.salary.entity.taxagent.param.TaxAgentAdminChangeCheckParam; import com.engine.salary.entity.taxagent.param.TaxAgentQueryParam; import com.engine.salary.entity.taxagent.param.TaxAgentSaveParam; import com.engine.salary.entity.taxagent.po.*; -import com.engine.salary.enums.SalaryJobFlagEnum; import com.engine.salary.enums.UserStatusEnum; import com.engine.salary.enums.salaryaccounting.SalaryAcctRecordStatusEnum; import com.engine.salary.enums.salarysob.SalaryEmployeeStatusEnum; @@ -30,47 +31,89 @@ import com.engine.salary.mapper.datacollection.OtherDeductionMapper; import com.engine.salary.mapper.taxagent.TaxAgentMapper; import com.engine.salary.service.*; import com.engine.salary.util.SalaryI18nUtil; +import com.engine.salary.util.db.MapperProxyFactory; import com.engine.salary.util.page.PageInfo; import com.engine.salary.util.page.PageUtil; +import com.engine.salary.util.valid.RuntimeTypeEnum; +import com.engine.salary.util.valid.ValidUtil; import com.google.common.collect.Lists; import dm.jdbc.util.IdGenerator; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.BeanUtils; import org.springframework.transaction.annotation.Transactional; +import weaver.hrm.User; import java.util.*; import java.util.stream.Collectors; public class TaxAgentV2ServiceImpl extends Service implements TaxAgentV2Service { - private TaxAgentMapper taxAgentMapper; + // private ExtEmployeeService extEmployeeService; + SalaryRoleBiz salaryRoleBiz = new SalaryRoleBiz(); + private TaxAgentBaseService getTaxAgentBaseService(User user) { + return ServiceUtil.getService(TaxAgentBaseServiceImpl.class, user); + } - private EmployMapper employMapper; - - -// private ExtEmployeeService extEmployeeService; - - private TaxAgentBaseService taxAgentBaseService; - - private TaxAgentAdminService taxAgentAdminService; + private TaxAgentAdminService getTaxAgentAdminService(User user) { + return ServiceUtil.getService(TaxAgentAdminServiceImpl.class, user); + } private TaxAgentSubAdminService taxAgentSubAdminService; +// private TaxAgentSubAdminService getTaxAgentSubAdminService(User user) { +// return ServiceUtil.getService(TaxAgentSubAdminServiceImpl.class, user); +// } - private TaxAgentManageRangeService taxAgentManageRangeService; + private TaxAgentManageRangeService getTaxAgentManageRangeService(User user) { + return ServiceUtil.getService(TaxAgentManageRangeServiceImpl.class, user); + } - private TaxAgentEmpService taxAgentEmpService; + private TaxAgentEmpService getTaxAgentEmpService(User user) { + return ServiceUtil.getService(TaxAgentEmpServiceImpl.class, user); + } private TaxAgentSubAdminEmpService taxAgentSubAdminEmpService; +// private TaxAgentSubAdminEmpService getTaxAgentSubAdminEmpService(User user) { +// return ServiceUtil.getService(TaxAgentSubAdminEmpServiceImpl.class, user); +// } - private SalaryArchiveMapper salaryArchiveMapper; + private HrmCommonService getHrmCommonService(User user) { + return ServiceUtil.getService(HrmCommonServiceImpl.class, user); + } - private AddUpDeductionMapper addUpDeductionMapper; - private OtherDeductionMapper otherDeductionMapper; + private SalaryAcctRecordService getSalaryAcctRecordService(User user) { + return ServiceUtil.getService(SalaryAcctRecordServiceImpl.class, user); + } - private AddUpSituationMapper addUpSituationMapper; + private SIAccountService getSIAccountService(User user) { + return ServiceUtil.getService(SIAccountServiceImpl.class, user); + } + + private SalaryArchiveMapper getSalaryArchiveMapper() { + return MapperProxyFactory.getProxy(SalaryArchiveMapper.class); + } + + private AddUpDeductionMapper getAddUpDeductionMapper() { + return MapperProxyFactory.getProxy(AddUpDeductionMapper.class); + } + + private OtherDeductionMapper getOtherDeductionMapper() { + return MapperProxyFactory.getProxy(OtherDeductionMapper.class); + } + + private AddUpSituationMapper getAddUpSituationMapper() { + return MapperProxyFactory.getProxy(AddUpSituationMapper.class); + } + + private TaxAgentMapper getTaxAgentMapper() { + return MapperProxyFactory.getProxy(TaxAgentMapper.class); + } + + private EmployMapper getEmployMapper() { + return MapperProxyFactory.getProxy(EmployMapper.class); + } // private PaymentAgencyMapper paymentAgencyMapper; @@ -83,11 +126,9 @@ public class TaxAgentV2ServiceImpl extends Service implements TaxAgentV2Service // private AuthorityService authorityService; - private SalaryAcctRecordService salaryAcctRecordService; - private SIAccountService siAccountService; - private HrmCommonHrmStatusService hrmCommonHrmStatusService; +// private HrmCommonHrmStatusService hrmCommonHrmStatusService; @Override public TaxAgentRoleTypeEnum getRoleType(Long currentEmployeeId) { @@ -96,9 +137,9 @@ public class TaxAgentV2ServiceImpl extends Service implements TaxAgentV2Service return TaxAgentRoleTypeEnum.CHIEF; } // 是否开启分权 - boolean isOpenDevolution = taxAgentBaseService.isOpenDevolution(); + boolean isOpenDevolution = getTaxAgentBaseService(user).isOpenDevolution(); if (!isOpenDevolution) { - List taxAgentAdmins = taxAgentAdminService.listByEmployeeId(currentEmployeeId); + List taxAgentAdmins = getTaxAgentAdminService(user).listByEmployeeId(currentEmployeeId); if (CollectionUtils.isNotEmpty(taxAgentAdmins)) { return TaxAgentRoleTypeEnum.ADMIN; } @@ -112,15 +153,18 @@ public class TaxAgentV2ServiceImpl extends Service implements TaxAgentV2Service @Override public Boolean isChief(Long currentEmployeeId) { + String allAdminRoleId = salaryRoleBiz.getAllAdminRoleId(); - return currentEmployeeId == 1; - + List roleInfo = getHrmCommonService(user).getRoleInfo(user.getUID()); + Map map = roleInfo.stream().map(m -> (Map) m).filter(m -> m.get("roleid") != null && m.get("roleid").toString().equals(allAdminRoleId)).findFirst().orElse(null); + return map != null; //return authorityService.checkPermissionSet(TaxAgentPermissionConstant.MENU_CODE, TaxAgentPermissionConstant.ITEM_CODE_DEVOLUTION, currentEmployeeId); } @Override public Boolean isDefaultOpen(Long currentEmployeeId) { - return authorityService.checkPermissionSet(TaxAgentPermissionConstant.MENU_CODE, TaxAgentPermissionConstant.ITEM_CODE_DEFAULT, currentEmployeeId); + return true; +// return authorityService.checkPermissionSet(TaxAgentPermissionConstant.MENU_CODE, TaxAgentPermissionConstant.ITEM_CODE_DEFAULT, currentEmployeeId); } @Override @@ -132,7 +176,7 @@ public class TaxAgentV2ServiceImpl extends Service implements TaxAgentV2Service return Boolean.FALSE; } else { // 自己有没有被分配为管理员 - List taxAgentAdminList = taxAgentAdminService.listByEmployeeId(currentEmployeeId); + List taxAgentAdminList = getTaxAgentAdminService(user).listByEmployeeId(currentEmployeeId); return CollectionUtils.isNotEmpty(taxAgentAdminList); } } @@ -143,55 +187,55 @@ public class TaxAgentV2ServiceImpl extends Service implements TaxAgentV2Service @Override public PageInfo listPage(TaxAgentQueryParam queryParam) { PageUtil.start(queryParam.getCurrent(), queryParam.getPageSize()); - List taxAgentPOS = taxAgentMapper.listBySome(queryParam); + List taxAgentPOS = getTaxAgentMapper().listBySome(queryParam); return new PageInfo<>(taxAgentPOS); } @Override public List list(TaxAgentQueryParam queryParam) { - return taxAgentMapper.listBySome(queryParam); + return getTaxAgentMapper().listBySome(queryParam); } @Override public List listByIds(Collection ids) { - return taxAgentMapper.listBySome(TaxAgentQueryParam.builder().ids(ids).build()); + return getTaxAgentMapper().listBySome(TaxAgentQueryParam.builder().ids(ids).build()); } @Override public List listAll() { - return taxAgentMapper.listAll(); + return getTaxAgentMapper().listAll(); } @Override public TaxAgentPO getById(Long id) { - return taxAgentMapper.getById(id); + return getTaxAgentMapper().getById(id); } @Override public Collection findAll() { - List taxAgents = taxAgentMapper.listAll(); + List taxAgents = getTaxAgentMapper().listAll(); return TaxAgentBO.convertToListDTO(taxAgents); } @Override public Collection listAllTaxAgents(Long employeeId) { - List taxAgents = taxAgentMapper.listAll(); + List taxAgents = getTaxAgentMapper().listAll(); return handleForDevolution(taxAgents, employeeId); } @Override public Collection listAllTaxAgentsAsAdmin(Long employeeId) { - List taxAgents = taxAgentMapper.listAll(); + List taxAgents = getTaxAgentMapper().listAll(); // 是否开启分权 - boolean isOpenDevolution = taxAgentBaseService.isOpenDevolution(); + boolean isOpenDevolution = getTaxAgentBaseService(user).isOpenDevolution(); if (!isOpenDevolution) { return taxAgents; } List taxAgentIds = taxAgents.stream().map(TaxAgentPO::getId).collect(Collectors.toList()); List enableTaxAgentIds = Lists.newArrayList(); // 1.判断自己是否是管理员, 如果是管理员,就是能够查看所属个税扣缴义务人 - List taxAgentAdminList = taxAgentAdminService.listByTaxAgentIds(taxAgentIds); + List taxAgentAdminList = getTaxAgentAdminService(user).listByTaxAgentIds(taxAgentIds); // 是管理员的列表 List adminTaxAgentIds = taxAgentAdminList.stream().filter(f -> f.getEmployeeId().equals(employeeId)).map(TaxAgentAdminPO::getTaxAgentId).collect(Collectors.toList()); @@ -201,10 +245,10 @@ public class TaxAgentV2ServiceImpl extends Service implements TaxAgentV2Service @Override public Collection listAllTaxAgentsAsRange(List employeeIds) { - List taxAgents = taxAgentMapper.listAll(); + List taxAgents = getTaxAgentMapper().listAll(); List taxAgentIds = taxAgents.stream().map(TaxAgentPO::getId).collect(Collectors.toList()); - List taxAgentEmployees = taxAgentEmpService.listByTaxAgentIds(taxAgentIds); + List taxAgentEmployees = getTaxAgentEmpService(user).listByTaxAgentIds(taxAgentIds); if (CollectionUtils.isEmpty(taxAgentEmployees)) { return Lists.newArrayList(); @@ -224,13 +268,15 @@ public class TaxAgentV2ServiceImpl extends Service implements TaxAgentV2Service } @Override - public String save(TaxAgentSaveParam saveParam, Long employeeId) { + public String save(TaxAgentSaveParam saveParam) { + ValidUtil.doValidator(saveParam); + // 是否开启分权 - boolean isOpenDevolution = taxAgentBaseService.isOpenDevolution(); + boolean isOpenDevolution = getTaxAgentBaseService(user).isOpenDevolution(); if (isOpenDevolution && saveParam.getAdminUserId() == null) { throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(106271, "请选择管理员")); } - List taxAgents = taxAgentMapper.listByName(saveParam.getName()); + List taxAgents = getTaxAgentMapper().listByName(saveParam.getName()); if (CollectionUtils.isNotEmpty(taxAgents)) { throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98080, "名称不允许重复")); } @@ -244,10 +290,10 @@ public class TaxAgentV2ServiceImpl extends Service implements TaxAgentV2Service // } // 保存 saveParam.setId(IdGenerator.generate()); - TaxAgentPO taxAgent = TaxAgentBO.convertToPO(saveParam, employeeId); - taxAgentMapper.insert(taxAgent); + TaxAgentPO taxAgent = TaxAgentBO.convertToPO(saveParam, (long) user.getUID()); + getTaxAgentMapper().insert(taxAgent); if (isOpenDevolution) { - taxAgentAdminService.batchInsert(saveParam.getId(), Collections.singletonList(saveParam.getAdminUserId())); + getTaxAgentAdminService(user).batchInsert(saveParam.getId(), Collections.singletonList(saveParam.getAdminUserId())); } // 记录日志 // SalaryLoggerUtil.recordAddSingleLog(taxAgentLoggerTemplate, @@ -262,24 +308,26 @@ public class TaxAgentV2ServiceImpl extends Service implements TaxAgentV2Service @Override public String paymentAgencyUpdate(TaxAgentPO taxAgentPO) { - taxAgentMapper.update(taxAgentPO); + getTaxAgentMapper().update(taxAgentPO); return ""; } @Override @Transactional(rollbackFor = Exception.class) - public String update(TaxAgentSaveParam saveParam, Long employeeId) { + public String update(TaxAgentSaveParam saveParam) { + ValidUtil.doValidator(saveParam, RuntimeTypeEnum.UPDATE); + TaxAgentPO taxAgent = getById(saveParam.getId()); if (taxAgent == null) { throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(100545, "个税扣缴义务人不存在")); } // 是否开启分权 - boolean isOpenDevolution = taxAgentBaseService.isOpenDevolution(); + boolean isOpenDevolution = getTaxAgentBaseService(user).isOpenDevolution(); if (isOpenDevolution && saveParam.getAdminUserId() == null) { throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(106271, "请选择管理员")); } - List individualTaxWithholdingAgents = taxAgentMapper.listByName(saveParam.getName()); + List individualTaxWithholdingAgents = getTaxAgentMapper().listByName(saveParam.getName()); boolean nameExist = individualTaxWithholdingAgents.stream().anyMatch(e -> !Objects.equals(e.getId(), saveParam.getId())); if (nameExist) { throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98080, "名称不允许重复")); @@ -288,19 +336,19 @@ public class TaxAgentV2ServiceImpl extends Service implements TaxAgentV2Service BeanUtils.copyProperties(taxAgent, taxAgentNew); BeanUtils.copyProperties(saveParam, taxAgentNew); taxAgentNew.setUpdateTime(new Date()); - taxAgentMapper.update(taxAgentNew); + getTaxAgentMapper().update(taxAgentNew); if (isOpenDevolution) { Boolean isUnEnableChange = adminChangeCheck(TaxAgentAdminChangeCheckParam.builder() .taxAgentId(saveParam.getId()) .adminUserId(saveParam.getAdminUserId()) - .build(), employeeId); + .build()); if (isUnEnableChange) { throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(115937, "该管理员有未归档核算数据,不可更换管理员")); } // 删除管理员 - taxAgentAdminService.deleteByTaxAgentIds(Collections.singletonList(taxAgent.getId())); + getTaxAgentAdminService(user).deleteByTaxAgentIds(Collections.singletonList(taxAgent.getId())); // 新增管理员 - taxAgentAdminService.batchInsert(saveParam.getId(), Collections.singletonList(saveParam.getAdminUserId())); + getTaxAgentAdminService(user).batchInsert(saveParam.getId(), Collections.singletonList(saveParam.getAdminUserId())); } // 记录日志 // SalaryLoggerUtil.recordUpdateSingleLog(taxAgentLoggerTemplate, @@ -315,17 +363,17 @@ public class TaxAgentV2ServiceImpl extends Service implements TaxAgentV2Service } @Override - public Boolean adminChangeCheck(TaxAgentAdminChangeCheckParam checkParam, Long currentEmployeeId) { - List taxAgentAdminList = taxAgentAdminService.listByTaxAgentIds(Collections.singletonList(checkParam.getTaxAgentId())); + public Boolean adminChangeCheck(TaxAgentAdminChangeCheckParam checkParam) { + List taxAgentAdminList = getTaxAgentAdminService(user).listByTaxAgentIds(Collections.singletonList(checkParam.getTaxAgentId())); Long adminUserId = CollectionUtils.isNotEmpty(taxAgentAdminList) ? taxAgentAdminList.get(0).getEmployeeId() : 0L; boolean isChanged = checkParam.getAdminUserId() != null && !adminUserId.equals(checkParam.getAdminUserId()); // 更换了管理员 if (isChanged) { // 检查是否核算 //todo 1.社保福利档案是否有核算未归档 - Boolean checkedValue = false;// siAccountService.changeAdminUnfiledCheck(adminUserId); + Boolean checkedValue = false;// getSIAccountService(user).changeAdminUnfiledCheck(adminUserId); // 2.薪资核算是否有核算未归档 - List salaryAcctRecords = salaryAcctRecordService.listByStatusAndEmployeeId(SalaryAcctRecordStatusEnum.NOT_ARCHIVED, adminUserId); + List salaryAcctRecords = getSalaryAcctRecordService(user).listByStatusAndEmployeeId(SalaryAcctRecordStatusEnum.NOT_ARCHIVED, adminUserId); if (CollectionUtils.isNotEmpty(salaryAcctRecords) || checkedValue) { return Boolean.TRUE; } @@ -335,9 +383,13 @@ public class TaxAgentV2ServiceImpl extends Service implements TaxAgentV2Service @Override @Transactional(rollbackFor = Exception.class) - public String delete(Collection ids, Long employeeId) { + public String delete(Collection ids) { - List taxAgents = taxAgentMapper.listBySome(TaxAgentQueryParam.builder().ids(ids).build()); + if (org.springframework.util.CollectionUtils.isEmpty(ids)) { + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(84026, "参数错误")); + } + + List taxAgents = getTaxAgentMapper().listBySome(TaxAgentQueryParam.builder().ids(ids).build()); if (CollectionUtils.isEmpty(taxAgents)) { throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(85382, "要删除的个税扣缴义务人在不存在或已删除")); } @@ -347,13 +399,13 @@ public class TaxAgentV2ServiceImpl extends Service implements TaxAgentV2Service throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(100570, "正在使用的记录不允许删除")); } // 删除管理员 - taxAgentAdminService.deleteByTaxAgentIds(ids); + getTaxAgentAdminService(user).deleteByTaxAgentIds(ids); // 删除分管理员和对应管理范围 - taxAgentSubAdminService.deleteByTaxAgentIds(ids); +// todo taxAgentSubAdminService.deleteByTaxAgentIds(ids); // 删除人员范围 - taxAgentManageRangeService.deleteByTaxAgentIds(ids); + getTaxAgentManageRangeService(user).deleteByTaxAgentIds(ids); - taxAgentMapper.deleteByIds(ids); + getTaxAgentMapper().deleteByIds(ids); // 记录日志 // taxAgents.forEach(e -> SalaryLoggerUtil.recordDeleteSingleLog(taxAgentLoggerTemplate, @@ -373,16 +425,16 @@ public class TaxAgentV2ServiceImpl extends Service implements TaxAgentV2Service * @return */ private boolean checkUsed(Collection ids) { - // 被薪资档案引用 - List salaryArchiveList = new LambdaQueryChainWrapper<>(salaryArchiveMapper) - .eq(SalaryArchivePO::getDeleteType, 0) - .eq(SalaryArchivePO::getTenantKey) - .in(SalaryArchivePO::getTaxAgentId, ids) - .list(); - salaryArchiveMapper.listSome(SalaryArchivePO.builder().t) - if (CollectionUtils.isNotEmpty(salaryArchiveList)) { - return Boolean.TRUE; - } + //fixme 被薪资档案引用 +// List salaryArchiveList = new LambdaQueryChainWrapper<>(getSalaryArchiveMapper()) +// .eq(SalaryArchivePO::getDeleteType, 0) +// .eq(SalaryArchivePO::getTenantKey) +// .in(SalaryArchivePO::getTaxAgentId, ids) +// .list(); +// getSalaryArchiveMapper().listSome(SalaryArchivePO.builder().t); +// if (CollectionUtils.isNotEmpty(salaryArchiveList)) { +// return Boolean.TRUE; +// } // todo 被社保福利档案引用 // List socialSchemePOList = new LambdaQueryChainWrapper<>(siArchivesSocialMapper) // .eq(InsuranceArchivesSocialSchemePO::getTenantKey) @@ -417,17 +469,17 @@ public class TaxAgentV2ServiceImpl extends Service implements TaxAgentV2Service // } // 被累计专项附加扣除引用 - List addUpDeductionList = addUpDeductionMapper.listSome(AddUpDeduction.builder().taxAgentIds(ids).build()); + List addUpDeductionList = getAddUpDeductionMapper().listSome(AddUpDeduction.builder().taxAgentIds(ids).build()); if (CollectionUtils.isNotEmpty(addUpDeductionList)) { return Boolean.TRUE; } // 被其他免税扣除引用 - List otherDeductionList = otherDeductionMapper.listSome(OtherDeductionPO.builder().taxAgentIds(ids).build()); + List otherDeductionList = getOtherDeductionMapper().listSome(OtherDeductionPO.builder().taxAgentIds(ids).build()); if (CollectionUtils.isNotEmpty(otherDeductionList)) { return Boolean.TRUE; } // 被往期累计情况引用 - List addUpSituationList = addUpSituationMapper.listSome(AddUpSituation.builder().taxAgentIds(ids).build()); + List addUpSituationList = getAddUpSituationMapper().listSome(AddUpSituation.builder().taxAgentIds(ids).build()); if (CollectionUtils.isNotEmpty(addUpSituationList)) { return Boolean.TRUE; } @@ -436,9 +488,9 @@ public class TaxAgentV2ServiceImpl extends Service implements TaxAgentV2Service } @Override - public List> selectList(Long currentEmployeeId) { - List taxAgents = taxAgentMapper.listAll(); - taxAgents = handleForDevolution(taxAgents, currentEmployeeId); + public List> selectList() { + List taxAgents = getTaxAgentMapper().listAll(); + taxAgents = handleForDevolution(taxAgents, (long) user.getUID()); return taxAgents.stream().map(m -> { Map map = new HashMap<>(2); map.put("id", String.valueOf(m.getId())); @@ -456,14 +508,14 @@ public class TaxAgentV2ServiceImpl extends Service implements TaxAgentV2Service */ private List handleForDevolution(List taxAgents, Long currentEmployeeId) { // 是否开启分权 - boolean isOpenDevolution = taxAgentBaseService.isOpenDevolution(); + boolean isOpenDevolution = getTaxAgentBaseService(user).isOpenDevolution(); if (!isOpenDevolution || isChief(currentEmployeeId)) { return taxAgents; } List taxAgentIds = taxAgents.stream().map(TaxAgentPO::getId).collect(Collectors.toList()); List enableTaxAgentIds = Lists.newArrayList(); // 1.判断自己是否是管理员, 如果是管理员,就是能够查看所属个税扣缴义务人 - List taxAgentAdminList = taxAgentAdminService.listByTaxAgentIdsAndEmployeeId(taxAgentIds, currentEmployeeId); + List taxAgentAdminList = getTaxAgentAdminService(user).listByTaxAgentIdsAndEmployeeId(taxAgentIds, currentEmployeeId); // 是管理员的列表 List adminTaxAgentIds = taxAgentAdminList.stream().map(TaxAgentAdminPO::getTaxAgentId).collect(Collectors.toList()); @@ -482,7 +534,7 @@ public class TaxAgentV2ServiceImpl extends Service implements TaxAgentV2Service @Override public Boolean isOpenDevolution() { - return taxAgentBaseService.isOpenDevolution(); + return getTaxAgentBaseService(user).isOpenDevolution(); } @Override @@ -505,7 +557,7 @@ public class TaxAgentV2ServiceImpl extends Service implements TaxAgentV2Service } List taxAgentIds = allTaxAgents.stream().map(TaxAgentPO::getId).collect(Collectors.toList()); - List allEmployees = taxAgentMapper.listEmployee(); + List allEmployees = getTaxAgentMapper().listEmployee(); if (employeeStatus != null) { List personnelStatusList; // 查询人员状态 @@ -522,7 +574,7 @@ public class TaxAgentV2ServiceImpl extends Service implements TaxAgentV2Service } // 1.判断自己是否是管理员, 如果是管理员,就是能够操作所属个税扣缴义务人下的所有人的数据 - List taxAgentAdminList = taxAgentAdminService.listByTaxAgentIdsAndEmployeeId(taxAgentIds, employeeId); + List taxAgentAdminList = getTaxAgentAdminService(user).listByTaxAgentIdsAndEmployeeId(taxAgentIds, (long) user.getUID()); // 是管理员的列表 List adminTaxAgentIds = taxAgentAdminList.stream().map(TaxAgentAdminPO::getTaxAgentId).collect(Collectors.toList()); @@ -584,7 +636,7 @@ public class TaxAgentV2ServiceImpl extends Service implements TaxAgentV2Service */ private List getTaxAgentEmp(List allTaxAgents, List taxAgentIds, List allEmployees) { List taxAgentManageRangeEmployeeList = Lists.newArrayList(); - List taxAgentEmps = taxAgentEmpService.listByTaxAgentIds(taxAgentIds); + List taxAgentEmps = getTaxAgentEmpService(user).listByTaxAgentIds(taxAgentIds); taxAgentEmps = taxAgentEmps.stream().filter(f -> allEmployees.stream().anyMatch(e -> e.getEmployeeId().equals(f.getEmployeeId()))).collect(Collectors.toList()); diff --git a/src/com/engine/salary/web/TaxAgentController.java b/src/com/engine/salary/web/TaxAgentController.java index a0f09b47f..d70e37106 100644 --- a/src/com/engine/salary/web/TaxAgentController.java +++ b/src/com/engine/salary/web/TaxAgentController.java @@ -1,13 +1,18 @@ package com.engine.salary.web; -import com.engine.common.util.ParamUtil; import com.engine.common.util.ServiceUtil; +import com.engine.salary.entity.taxagent.dto.*; +import com.engine.salary.entity.taxagent.param.*; +import com.engine.salary.entity.taxagent.po.TaxAgentBasePO; import com.engine.salary.service.TaxAgentService; import com.engine.salary.service.impl.TaxAgentServiceImpl; import com.engine.salary.util.ResponseResult; -import io.swagger.annotations.ApiOperation; +import com.engine.salary.util.page.PageInfo; +import com.engine.salary.wrapper.TaxAgentBaseWrapper; +import com.engine.salary.wrapper.TaxAgentSubAdminWrapper; +import com.engine.salary.wrapper.TaxAgentWrapper; import io.swagger.v3.oas.annotations.parameters.RequestBody; -import weaver.general.BaseBean; +import org.springframework.web.bind.annotation.RequestParam; import weaver.hrm.HrmUserVarify; import weaver.hrm.User; @@ -20,17 +25,27 @@ import javax.ws.rs.Produces; import javax.ws.rs.core.Context; import javax.ws.rs.core.MediaType; import java.util.Collection; +import java.util.Collections; +import java.util.List; import java.util.Map; public class TaxAgentController { - private BaseBean logger = new BaseBean(); - private TaxAgentService getService(User user) { return (TaxAgentService) ServiceUtil.getService(TaxAgentServiceImpl.class, user); } - private TaxAgentWrapper taxAgentWrapper; + private TaxAgentBaseWrapper getTaxAgentBaseWrapper(User user) { + return ServiceUtil.getService(TaxAgentBaseWrapper.class, user); + } + + private TaxAgentSubAdminWrapper getTaxAgentSubAdminWrapper(User user) { + return ServiceUtil.getService(TaxAgentSubAdminWrapper.class, user); + } + + private TaxAgentWrapper getTaxAgentWrapper(User user) { + return ServiceUtil.getService(TaxAgentWrapper.class, user); + } /** * 是否是薪酬模块总管理员 @@ -38,80 +53,374 @@ public class TaxAgentController { @GET @Path("/isChief") @Produces(MediaType.APPLICATION_JSON) - public String isChief() { + public String isChief(@Context HttpServletRequest request, @Context HttpServletResponse response) { User user = HrmUserVarify.getUser(request, response); - return new ResponseResult, Map>(user).run(getService(user)::list,ParamUtil.request2Map(request)); - return WeaResult.success(taxAgentWrapper.isChief(UserContext.getCurrentEmployeeId(), TenantContext.getCurrentTenantKey())); + return new ResponseResult(user).run(getTaxAgentWrapper(user)::isChief, (long) user.getUID()); } - @GetMapping("/permission") - @ApiOperation("权限信息") - @WeaPermission(publicPermission = true) - public WeaResult> permission() { - return WeaResult.success(taxAgentWrapper.permission(UserContext.getCurrentEmployeeId(), TenantContext.getCurrentTenantKey())); - } - - - //------------------------------------------------------------------------------------------ - - //个税扣缴义务人列表 + /** + * 权限信息 + * @param request + * @param response + * @return + */ @GET + @Path("/permission") + @Produces(MediaType.APPLICATION_JSON) + public String permission(@Context HttpServletRequest request, @Context HttpServletResponse response) { + User user = HrmUserVarify.getUser(request, response); + return new ResponseResult>(user).run(getTaxAgentWrapper(user)::permission, (long) user.getUID()); + } + + /* ****** 基础信息 start ***********************************************************************************************/ + + /** + * 获取个税扣缴义务人基础信息表单 + * + * @return + */ + @GET + @Path("/base/getForm") + @Produces(MediaType.APPLICATION_JSON) + public String getBaseFrom(@Context HttpServletRequest request, @Context HttpServletResponse response) { + User user = HrmUserVarify.getUser(request, response); + return new ResponseResult(user).run(getTaxAgentBaseWrapper(user)::getFrom); + } + + /** + * 保存个税扣缴义务人基础信息 + * + * @param saveBaseParam + * @return + */ + @POST + @Path("/base/save") + @Produces(MediaType.APPLICATION_JSON) + public String saveBase(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody TaxAgentSaveBaseParam saveBaseParam) { + User user = HrmUserVarify.getUser(request, response); + return new ResponseResult(user).run(getTaxAgentBaseWrapper(user)::save, saveBaseParam); + } + /* ******* 基础信息 end ***********************************************************************************************/ + + /* ******* 个税扣缴义务人 start ***********************************************************************************************/ + + /** + * 个税扣缴义务人列表 + * + * @param queryParam + * @return + */ + @POST @Path("/list") @Produces(MediaType.APPLICATION_JSON) - public String list(@Context HttpServletRequest request, @Context HttpServletResponse response) { + public String list(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody TaxAgentQueryParam queryParam) { User user = HrmUserVarify.getUser(request, response); - return new ResponseResult, Map>(user).run(getService(user)::list,ParamUtil.request2Map(request)); + return new ResponseResult>(user).run(getTaxAgentWrapper(user)::list, queryParam); } - //获取个税扣缴义务人表单 + //查询个税扣缴义务人下面的代缴机构") + @GET + @Path("/paymentAgency/list") + @Produces(MediaType.APPLICATION_JSON) + public String paymentAgencyList(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestParam(value = "id") Long id) { + User user = HrmUserVarify.getUser(request, response); + TaxAgentQueryParam queryParam = new TaxAgentQueryParam(); + queryParam.setIds(Collections.singleton(id)); + return new ResponseResult>>(user).run(getTaxAgentWrapper(user)::paymentAgencyList, queryParam); + } + + //保存个税扣缴义务人下的代缴机构") + @POST + @Path("/paymentAgency/save") + @Produces(MediaType.APPLICATION_JSON) + public String paymentAgencySave(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody TaxAgentSaveParam saveParam) { + User user = HrmUserVarify.getUser(request, response); + return new ResponseResult(user).run(getTaxAgentWrapper(user)::paymentAgencySave, saveParam); + } + + + /** + * 获取个税扣缴义务人表单 + * + * @param id + * @return + */ @GET @Path("/getForm") @Produces(MediaType.APPLICATION_JSON) - public String getForm(@Context HttpServletRequest request, @Context HttpServletResponse response) { + public String getFrom(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestParam(value = "id") Long id) { User user = HrmUserVarify.getUser(request, response); - return new ResponseResult, Map>(user).run(getService(user)::getForm,ParamUtil.request2Map(request)); + return new ResponseResult(user).run(getTaxAgentWrapper(user)::getFrom, id); } - //新建个税扣缴义务人 + /** + * 新建个税扣缴义务人 + * + * @param saveParam + * @return + */ @POST @Path("/save") @Produces(MediaType.APPLICATION_JSON) - public String getFrom(@Context HttpServletRequest request, @Context HttpServletResponse response) { + public String save(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody TaxAgentSaveParam saveParam) { User user = HrmUserVarify.getUser(request, response); - return new ResponseResult, Map>(user).run(getService(user)::save,ParamUtil.request2Map(request)); + return new ResponseResult(user).run(getTaxAgentWrapper(user)::save, saveParam); } /** * 编辑个税扣缴义务人 + * + * @param saveParam + * @return */ @POST @Path("/update") @Produces(MediaType.APPLICATION_JSON) - public String update(@Context HttpServletRequest request, @Context HttpServletResponse response) { + public String update(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody TaxAgentSaveParam saveParam) { User user = HrmUserVarify.getUser(request, response); - return new ResponseResult, Map>(user).run(getService(user)::update,ParamUtil.request2Map(request)); + return new ResponseResult(user).run(getTaxAgentWrapper(user)::update, saveParam); } /** - * 编辑个税扣缴义务人 + * 更换管理员校验 + * + * @param checkParam + * @return + */ + @POST + @Path("/adminChangeCheck") + @Produces(MediaType.APPLICATION_JSON) + public String adminChangeCheck(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody TaxAgentAdminChangeCheckParam checkParam) { + User user = HrmUserVarify.getUser(request, response); + return new ResponseResult(user).run(getTaxAgentWrapper(user)::adminChangeCheck, checkParam); + } + + /** + * 删除个税扣缴义务人 + * + * @param ids + * @return */ @POST @Path("/delete") @Produces(MediaType.APPLICATION_JSON) public String delete(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody Collection ids) { User user = HrmUserVarify.getUser(request, response); - return new ResponseResult, String>(user).run(getService(user)::delete, ids); + return new ResponseResult, String>(user).run(getTaxAgentWrapper(user)::delete, ids); + } + + /** + * 人员范围列表 + * + * @param queryParam + * @return + */ + @POST + @Path("/range/listInclude") + @Produces(MediaType.APPLICATION_JSON) + public String rangeListInclude(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody TaxAgentRangeQueryParam queryParam) { + User user = HrmUserVarify.getUser(request, response); + return new ResponseResult>(user).run(getTaxAgentWrapper(user)::listRangeInclude, queryParam); + } + + /** + * 分管理员管理范围排除列表 + * + * @param queryParam + * @return + */ + @POST + @Path("/range/listExclude") + @Produces(MediaType.APPLICATION_JSON) + public String rangeListExclude(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody TaxAgentRangeQueryParam queryParam) { + User user = HrmUserVarify.getUser(request, response); + return new ResponseResult>(user).run(getTaxAgentWrapper(user)::listRangeExclude, queryParam); + } + + //获取人员范围表单") + @POST + @Path("/range/getForm") + @Produces(MediaType.APPLICATION_JSON) + public String getRangeFrom(@Context HttpServletRequest request, @Context HttpServletResponse response) { + User user = HrmUserVarify.getUser(request, response); + return new ResponseResult(user).run(getTaxAgentWrapper(user)::getRangeFrom); + } + + //保存人员范围 + @POST + @Path("/range/save") + @Produces(MediaType.APPLICATION_JSON) + public String saveRange(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody TaxAgentRangeSaveParam saveParam) { + User user = HrmUserVarify.getUser(request, response); + return new ResponseResult(user).run(getTaxAgentWrapper(user)::saveRange, saveParam); + } + + //删除人员范围 + @POST + @Path("/range/delete") + @Produces(MediaType.APPLICATION_JSON) + public String deleteRange(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody Collection ids) { + User user = HrmUserVarify.getUser(request, response); + return new ResponseResult, String>(user).run(getTaxAgentWrapper(user)::deleteRange, ids); } /** * 个税扣缴义务人下拉列表 + * + * @return */ - @GET + @POST @Path("/selectList") @Produces(MediaType.APPLICATION_JSON) public String selectList(@Context HttpServletRequest request, @Context HttpServletResponse response) { User user = HrmUserVarify.getUser(request, response); - return new ResponseResult, Map>(user).run(getService(user)::selectList,ParamUtil.request2Map(request)); + return new ResponseResult, List>>(user).run(getTaxAgentWrapper(user)::selectList); + } + /* ******* 个税扣缴义务人 end ***********************************************************************************************/ + + /* ******* 分管理员 start ***********************************************************************************************/ + + /** + * 分管理员列表 + * + * @param queryParam + * @return + */ + @POST + @Path("/subAdmin/list") + @Produces(MediaType.APPLICATION_JSON) + public String subAdminList(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody TaxAgentSubAdminQueryParam queryParam) { + User user = HrmUserVarify.getUser(request, response); + return new ResponseResult>(user).run(getTaxAgentSubAdminWrapper(user)::list, queryParam); } + /** + * 获取分管理员基础设置表单 + * + * @return + */ + @POST + @Path("/subAdmin/getBaseForm") + @Produces(MediaType.APPLICATION_JSON) + public String getSubAdminBaseFrom(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody TaxAgentSubAdminBaseFormParam baseFormParam) { + User user = HrmUserVarify.getUser(request, response); + return new ResponseResult(user).run(getTaxAgentSubAdminWrapper(user)::getBaseFrom, baseFormParam); + } + + /** + * 分管理员基础设置保存 + * + * @param saveParam + * @return + */ + @POST + @Path("/subAdmin/saveBase") + @Produces(MediaType.APPLICATION_JSON) + public String saveSubAdminBase(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody TaxAgentSubAdminBaseSaveParam saveParam) { + User user = HrmUserVarify.getUser(request, response); + return new ResponseResult(user).run(getTaxAgentSubAdminWrapper(user)::saveBase, saveParam); + } + + /** + * 删除个税扣缴义务人分管理员 + * + * @param ids + * @return + */ + @POST + @Path("/subAdmin/delete") + @Produces(MediaType.APPLICATION_JSON) + public String deleteSubAdmin(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody Collection ids) { + User user = HrmUserVarify.getUser(request, response); + return new ResponseResult, String>(user).run(getTaxAgentSubAdminWrapper(user)::delete, ids); + } + + //分管理员的管理范围列表 + @POST + @Path("/subAdmin/range/listInclude") + @Produces(MediaType.APPLICATION_JSON) + public String subAdminRangeListInclude(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody TaxAgentSubAdminRangeQueryParam queryParam) { + User user = HrmUserVarify.getUser(request, response); + return new ResponseResult>(user).run(getTaxAgentSubAdminWrapper(user)::listRangeInclude, queryParam); + } + + //分管理员的管理范围排除列表 + @POST + @Path("/subAdmin/range/listExclude") + @Produces(MediaType.APPLICATION_JSON) + public String subAdminRangeListExclude(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody TaxAgentSubAdminRangeQueryParam queryParam) { + User user = HrmUserVarify.getUser(request, response); + return new ResponseResult>(user).run(getTaxAgentSubAdminWrapper(user)::listRangeExclude, queryParam); + } + + //获取分管理员的管理范围表单 + @POST + @Path("/subAdmin/range/getForm") + @Produces(MediaType.APPLICATION_JSON) + public String getSubAdminRangeFrom(@Context HttpServletRequest request, @Context HttpServletResponse response) { + User user = HrmUserVarify.getUser(request, response); + return new ResponseResult(user).run(getTaxAgentSubAdminWrapper(user)::getRangeFrom); + } + + //保存分管理员的管理范围 + @POST + @Path("/subAdmin/range/save") + @Produces(MediaType.APPLICATION_JSON) + public String saveSubAdminRange(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody TaxAgentSubAdminRangeSaveParam saveParam) { + User user = HrmUserVarify.getUser(request, response); + return new ResponseResult(user).run(getTaxAgentSubAdminWrapper(user)::saveRange, saveParam); + } + + //删除分管理员的管理范围 + @POST + @Path("/subAdmin/range/delete") + @Produces(MediaType.APPLICATION_JSON) + public String deleteSubAdminRange(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody Collection ids) { + User user = HrmUserVarify.getUser(request, response); + return new ResponseResult, String>(user).run(getTaxAgentSubAdminWrapper(user)::deleteRange, ids); + } + + /******** 分管理员 end ***********************************************************************************************/ + + +// //------------------------------------------------------------------------------------------ +// +// //个税扣缴义务人列表 +// @GET +// @Path("/list") +// @Produces(MediaType.APPLICATION_JSON) +// public String list(@Context HttpServletRequest request, @Context HttpServletResponse response) { +// User user = HrmUserVarify.getUser(request, response); +// return new ResponseResult, Map>(user).run(getService(user)::list, ParamUtil.request2Map(request)); +// } +// +// //获取个税扣缴义务人表单 +// @GET +// @Path("/getForm") +// @Produces(MediaType.APPLICATION_JSON) +// public String getForm(@Context HttpServletRequest request, @Context HttpServletResponse response) { +// User user = HrmUserVarify.getUser(request, response); +// return new ResponseResult, Map>(user).run(getService(user)::getForm, ParamUtil.request2Map(request)); +// } +// +// //新建个税扣缴义务人 +// @POST +// @Path("/save") +// @Produces(MediaType.APPLICATION_JSON) +// public String getFrom(@Context HttpServletRequest request, @Context HttpServletResponse response) { +// User user = HrmUserVarify.getUser(request, response); +// return new ResponseResult, Map>(user).run(getService(user)::save, ParamUtil.request2Map(request)); +// } +// +// /** +// * 编辑个税扣缴义务人 +// */ +// @POST +// @Path("/update") +// @Produces(MediaType.APPLICATION_JSON) +// public String update(@Context HttpServletRequest request, @Context HttpServletResponse response) { +// User user = HrmUserVarify.getUser(request, response); +// return new ResponseResult, Map>(user).run(getService(user)::update, ParamUtil.request2Map(request)); +// } + } diff --git a/src/com/engine/salary/web/TaxRateController.java b/src/com/engine/salary/web/TaxRateController.java index 242e46dda..b452332b4 100644 --- a/src/com/engine/salary/web/TaxRateController.java +++ b/src/com/engine/salary/web/TaxRateController.java @@ -89,6 +89,4 @@ public class TaxRateController { return new ResponseResult< Map, Map>(user).run(getService(user)::delete,map); } - - } diff --git a/src/com/engine/salary/wrapper/TaxAgentBaseWrapper.java b/src/com/engine/salary/wrapper/TaxAgentBaseWrapper.java new file mode 100644 index 000000000..f1e8423fa --- /dev/null +++ b/src/com/engine/salary/wrapper/TaxAgentBaseWrapper.java @@ -0,0 +1,44 @@ +package com.engine.salary.wrapper; + +import com.engine.common.util.ServiceUtil; +import com.engine.core.impl.Service; +import com.engine.salary.entity.taxagent.param.TaxAgentSaveBaseParam; +import com.engine.salary.entity.taxagent.po.TaxAgentBasePO; +import com.engine.salary.service.TaxAgentBaseService; +import com.engine.salary.service.impl.TaxAgentBaseServiceImpl; +import weaver.hrm.User; + +/** + * 个税扣缴义务人基础信息 + *

Copyright: Copyright (c) 2022

+ *

Company: 泛微软件

+ * + * @author qiantao + * @version 1.0 + **/ +public class TaxAgentBaseWrapper extends Service { + + private TaxAgentBaseService getTaxAgentBaseService(User user) { + return ServiceUtil.getService(TaxAgentBaseServiceImpl.class, user); + } + + /** + * 获取个税扣缴义务人基本信息表单 + * + * @return + */ + public TaxAgentBasePO getFrom() { + TaxAgentBasePO base = getTaxAgentBaseService(user).getBaseInfo(); + return base; + } + + /** + * 保存个税扣缴义务人基本信息 + * + * @param saveBaseParam + * @return + */ + public String save(TaxAgentSaveBaseParam saveBaseParam) { + return getTaxAgentBaseService(user).save(saveBaseParam); + } +} diff --git a/src/com/engine/salary/wrapper/TaxAgentSubAdminWrapper.java b/src/com/engine/salary/wrapper/TaxAgentSubAdminWrapper.java new file mode 100644 index 000000000..edf8381a3 --- /dev/null +++ b/src/com/engine/salary/wrapper/TaxAgentSubAdminWrapper.java @@ -0,0 +1,171 @@ +package com.engine.salary.wrapper; + +import com.engine.core.impl.Service; +import com.engine.salary.biz.EmployBiz; +import com.engine.salary.entity.datacollection.DataCollectionEmployee; +import com.engine.salary.entity.taxagent.bo.TaxAgentBO; +import com.engine.salary.entity.taxagent.dto.*; +import com.engine.salary.entity.taxagent.param.*; +import com.engine.salary.entity.taxagent.po.TaxAgentSubAdminPO; +import com.engine.salary.enums.UserStatusEnum; +import com.engine.salary.exception.SalaryRunTimeException; +import com.engine.salary.service.TaxAgentManageRangeService; +import com.engine.salary.service.TaxAgentSubAdminService; +import com.engine.salary.util.SalaryI18nUtil; +import com.engine.salary.util.page.PageInfo; +import com.engine.salary.util.page.PageUtil; +import com.engine.salary.util.valid.ValidUtil; +import com.google.common.collect.Lists; +import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.math.NumberUtils; + +import java.util.Collection; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +/** + * 个税义务人分管理员 + *

Copyright: Copyright (c) 2022

+ *

Company: 泛微软件

+ * + * @author qiantao + * @version 1.0 + **/ +public class TaxAgentSubAdminWrapper extends Service { + + private TaxAgentSubAdminService taxAgentSubAdminService; + private TaxAgentManageRangeService taxAgentManageRangeService; +// private HrmCommonEmployeeService hrmCommonEmployeeService; + + private EmployBiz employBiz = new EmployBiz(); + + /** + * 获取分管理员列表 + * + * @param queryParam + * @return + */ + public PageInfo list(TaxAgentSubAdminQueryParam queryParam) { + ValidUtil.doValidator(queryParam); + + List list = taxAgentSubAdminService.listByTaxAgentIds(Collections.singletonList(queryParam.getTaxAgentId())); + String range = SalaryI18nUtil.getI18nLabel(106290, "详情"); + List subAdminList = employBiz.getEmployeeByIds(list.stream().map(TaxAgentSubAdminPO::getEmployeeId).distinct().collect(Collectors.toList())); + + List records = TaxAgentBO.convertToSubAdminListDTO(list, range, subAdminList); + PageInfo listPage = PageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), TaxAgentSubAdminListDTO.class); + // 填充总数和当页数据 + listPage.setTotal(records.size()); + listPage.setList(PageUtil.subList(listPage.getPageNum(), listPage.getSize(), records)); + + return listPage; + } + + /** + * 删除分管理员 + * + * @param ids + * @return + */ + public String delete(Collection ids) { + return taxAgentSubAdminService.deleteByIds(ids); + } + + /** + * 获取基础设置表单 + * + * @param baseFormParam + * @return + */ + public TaxAgentSubAdminBaseFormDTO getBaseFrom(TaxAgentSubAdminBaseFormParam baseFormParam) { + ValidUtil.doValidator(baseFormParam); + + TaxAgentSubAdminBaseFormDTO taxAgentSubAdminBaseFormDTO = new TaxAgentSubAdminBaseFormDTO(); + Long id = baseFormParam.getId(); + if (id != null) { + TaxAgentSubAdminPO taxAgentSubAdmin = taxAgentSubAdminService.getById(id); + if (taxAgentSubAdmin == null) { + throw new SalaryRunTimeException(String.format(SalaryI18nUtil.getI18nLabel(106466, "分管理员不存在") + "[id:%s]", id)); + } + if (!baseFormParam.getTaxAgentId().equals(taxAgentSubAdmin.getTaxAgentId())) { + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(106685, "分管理员与所属个税扣缴义务人不匹配")); + } + taxAgentSubAdminBaseFormDTO.setId(taxAgentSubAdmin.getId()); + taxAgentSubAdminBaseFormDTO.setDescription(taxAgentSubAdmin.getRemark()); + TaxAgentEmployeeOptionDTO taxAgentEmployee = new TaxAgentEmployeeOptionDTO(); + taxAgentEmployee.setId(taxAgentSubAdmin.getEmployeeId()); + DataCollectionEmployee employee = employBiz.getEmployeeById(taxAgentEmployee.getId()); + taxAgentEmployee.setContent(employee == null ? "" : employee.getUsername()); + + taxAgentSubAdminBaseFormDTO.setSubAdminUser(Collections.singletonList(taxAgentEmployee)); + } else { + taxAgentSubAdminBaseFormDTO.setSubAdminUser(Lists.newArrayList()); + } + + return taxAgentSubAdminBaseFormDTO; + } + + /** + * 保存分管理员基础设置 + * + * @param saveParam + * @return + */ + public String saveBase(TaxAgentSubAdminBaseSaveParam saveParam) { + return taxAgentSubAdminService.saveBase(saveParam); + } + + /** + * 范围列表 + * + * @param queryParam + * @return + */ + public PageInfo listRangeInclude(TaxAgentSubAdminRangeQueryParam queryParam) { + PageInfo listPage = taxAgentManageRangeService.listPageByParamAndIncludeType(queryParam, NumberUtils.INTEGER_ONE); + return listPage; + } + + /** + * 范围排除列表 + * + * @param queryParam + * @return + */ + public PageInfo listRangeExclude(TaxAgentSubAdminRangeQueryParam queryParam) { + PageInfo listPage = taxAgentManageRangeService.listPageByParamAndIncludeType(queryParam, NumberUtils.INTEGER_ZERO); + return listPage; + } + + /** + * 获取管理范围表单 + * + * @return + */ + public TaxAgentManageRangeFormDTO getRangeFrom() { + return TaxAgentManageRangeFormDTO.builder().employeeStatus(UserStatusEnum.getHrmStatusList()).build(); + } + + /** + * 保存管理范围 + * + * @param saveParam + * @return + */ + public String saveRange(TaxAgentSubAdminRangeSaveParam saveParam) { + taxAgentManageRangeService.save4SubAdmin(saveParam); + return StringUtils.EMPTY; + } + + /** + * 删除管理范围 + * + * @param ids + * @return + */ + public String deleteRange(Collection ids) { + taxAgentManageRangeService.deleteByIds(ids); + return StringUtils.EMPTY; + } +} diff --git a/src/com/engine/salary/wrapper/TaxAgentWrapper.java b/src/com/engine/salary/wrapper/TaxAgentWrapper.java index b8a3e46f2..2878750d0 100644 --- a/src/com/engine/salary/wrapper/TaxAgentWrapper.java +++ b/src/com/engine/salary/wrapper/TaxAgentWrapper.java @@ -2,39 +2,31 @@ package com.engine.salary.wrapper; import com.cloudstore.eccom.pc.table.WeaTable; import com.cloudstore.eccom.result.WeaResultMsg; -import com.engine.salary.entity.agency.po.PaymentAgencyPO; +import com.engine.common.util.ServiceUtil; +import com.engine.core.impl.Service; import com.engine.salary.entity.datacollection.DataCollectionEmployee; +import com.engine.salary.entity.hrm.HrmStatus; import com.engine.salary.entity.taxagent.bo.TaxAgentBO; import com.engine.salary.entity.taxagent.dto.TaxAgentEmployeeOptionDTO; import com.engine.salary.entity.taxagent.dto.TaxAgentFormDTO; +import com.engine.salary.entity.taxagent.dto.TaxAgentManageRangeFormDTO; import com.engine.salary.entity.taxagent.dto.TaxAgentManageRangeListDTO; -import com.engine.salary.entity.taxagent.param.TaxAgentAdminChangeCheckParam; -import com.engine.salary.entity.taxagent.param.TaxAgentQueryParam; -import com.engine.salary.entity.taxagent.param.TaxAgentRangeQueryParam; -import com.engine.salary.entity.taxagent.param.TaxAgentSaveParam; +import com.engine.salary.entity.taxagent.param.*; import com.engine.salary.entity.taxagent.po.TaxAgentAdminPO; import com.engine.salary.entity.taxagent.po.TaxAgentPO; import com.engine.salary.enums.UserStatusEnum; import com.engine.salary.exception.SalaryRunTimeException; import com.engine.salary.service.*; -import com.engine.salary.util.SalaryAssert; +import com.engine.salary.service.impl.*; import com.engine.salary.util.SalaryI18nUtil; import com.engine.salary.util.page.PageInfo; import com.engine.salary.util.page.PageUtil; import com.google.common.collect.Maps; -import com.weaver.common.component.browser.combination.TypesBrowserOption; -import com.weaver.common.component.form.WeaForm; -import com.weaver.common.component.form.item.WeaFormOption; -import com.weaver.common.hrm.domain.employee.HrmStatus; -import com.weaver.hrm.salary.entity.taxagent.dto.TaxAgentManageRangeFormDTO; -import com.weaver.hrm.salary.entity.taxagent.param.*; -import com.weaver.hrm.salary.service.*; -import com.weaver.hrm.salary.util.SalaryFormatUtil; -import com.weaver.teams.security.context.UserContext; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.math.NumberUtils; import org.springframework.beans.BeanUtils; +import weaver.hrm.User; import java.util.*; import java.util.stream.Collectors; @@ -47,26 +39,35 @@ import java.util.stream.Collectors; * @author qiantao * @version 1.0 **/ -public class TaxAgentWrapper { +public class TaxAgentWrapper extends Service { + public TaxAgentBaseService getTaxAgentBaseService(User user) { + return ServiceUtil.getService(TaxAgentBaseServiceImpl.class, user); + } - private TaxAgentBaseService taxAgentBaseService; + public TaxAgentAdminService getTaxAgentAdminService(User user) { + return ServiceUtil.getService(TaxAgentAdminServiceImpl.class, user); + } - private TaxAgentAdminService taxAgentAdminService; + public TaxAgentV2Service getTaxAgentService(User user) { + return ServiceUtil.getService(TaxAgentV2ServiceImpl.class, user); + } - private TaxAgentV2Service taxAgentService; + public SalaryEmployeeService getSalaryEmployeeService(User user) { + return ServiceUtil.getService(SalaryEmployeeServiceImpl.class, user); + } - private SalaryEmployeeService employeeService; + public TaxAgentManageRangeService getTaxAgentManageRangeService(User user) { + return ServiceUtil.getService(TaxAgentManageRangeServiceImpl.class, user); + } - private TaxAgentManageRangeService taxAgentManageRangeService; - - private PaymentAgencyService paymentAgencyService; - - private SIEmployeeStatusMapper siEmployeeStatusMapper; - - private HrmCommonHrmStatusService hrmCommonHrmStatusService; - - private HrmConfigSetCache hrmConfigSetCache; +// private PaymentAgencyService paymentAgencyService; +// +// private SIEmployeeStatusMapper siEmployeeStatusMapper; +// +// private HrmCommonHrmStatusService hrmCommonHrmStatusService; +// +// private HrmConfigSetCache hrmConfigSetCache; /** * 是否是薪酬模块总管理员 @@ -75,7 +76,7 @@ public class TaxAgentWrapper { * @return */ public Boolean isChief(Long currentEmployeeId) { - return taxAgentService.isChief(currentEmployeeId); + return getTaxAgentService(user).isChief(currentEmployeeId); } /** @@ -87,8 +88,8 @@ public class TaxAgentWrapper { public Map permission(Long currentEmployeeId) { Map resultMap = Maps.newHashMap(); Boolean isChief = isChief(currentEmployeeId); - Boolean isDefaultOpen = taxAgentService.isDefaultOpen(currentEmployeeId); - Boolean isAdminEnable = taxAgentService.isAdminEnable(currentEmployeeId); + Boolean isDefaultOpen = getTaxAgentService(user).isDefaultOpen(currentEmployeeId); + Boolean isAdminEnable = getTaxAgentService(user).isAdminEnable(currentEmployeeId); resultMap.put("isChief", isChief); resultMap.put("isDefaultOpen", isDefaultOpen); resultMap.put("isAdminEnable", isAdminEnable); @@ -99,26 +100,25 @@ public class TaxAgentWrapper { * 个税口角义务人列表 * * @param queryParam - * @param currentEmployeeId * @return */ - public Map list(TaxAgentQueryParam queryParam, Long currentEmployeeId) { + public Map list(TaxAgentQueryParam queryParam) { // 是否是总管理员 - Boolean isChief = taxAgentService.isChief(currentEmployeeId); + Boolean isChief = getTaxAgentService(user).isChief((long) user.getUID()); // 是否开启分权 - boolean isOpenDevolution = taxAgentBaseService.isOpenDevolution(); + boolean isOpenDevolution = getTaxAgentBaseService(user).isOpenDevolution(); // List paymentAgencyPOS = paymentAgencyService.listAll(currentTenantKey); PageInfo page = null; if (isChief) { - page = taxAgentService.listPage(queryParam); + page = getTaxAgentService(user).listPage(queryParam); } else { // 分权情况下,根据自己作为管理员过滤列表 if (isOpenDevolution) { - List list = taxAgentService.list(queryParam); + List list = getTaxAgentService(user).list(queryParam); // 1.判断自己是否是管理员, 如果是管理员,就是能够操作所属个税扣缴义务人下的所有人的数据 - List taxAgentAdminList = taxAgentAdminService.listByTaxAgentIdsAndEmployeeId(list.stream().map(TaxAgentPO::getId).collect(Collectors.toList()), currentEmployeeId); + List taxAgentAdminList = getTaxAgentAdminService(user).listByTaxAgentIdsAndEmployeeId(list.stream().map(TaxAgentPO::getId).collect(Collectors.toList()), (long) user.getUID()); // 是管理员的列表 List adminTaxAgentIds = taxAgentAdminList.stream().map(TaxAgentAdminPO::getTaxAgentId).collect(Collectors.toList()); list = list.stream().filter(f -> adminTaxAgentIds.contains(f.getId())).collect(Collectors.toList()); @@ -137,8 +137,8 @@ public class TaxAgentWrapper { if (isOpenDevolution) { List list = page.getList(); List taxAgentIds = list.stream().map(TaxAgentPO::getId).collect(Collectors.toList()); - List taxAgentAdmins = taxAgentAdminService.listByTaxAgentIds(taxAgentIds); - List adminList = employeeService.listByIds(taxAgentAdmins.stream().map(TaxAgentAdminPO::getEmployeeId).distinct().collect(Collectors.toList())); + List taxAgentAdmins = getTaxAgentAdminService(user).listByTaxAgentIds(taxAgentIds); + List adminList = getSalaryEmployeeService(user).listByIds(taxAgentAdmins.stream().map(TaxAgentAdminPO::getEmployeeId).distinct().collect(Collectors.toList())); listPage.setList(TaxAgentBO.convertToTableListDTO(page.getList(), null, taxAgentAdmins, adminList, setLabel)); } else { listPage.setList(TaxAgentBO.convertToTableListDTO(page.getList(), null, setLabel)); @@ -168,16 +168,17 @@ public class TaxAgentWrapper { } - public List> paymentAgencyList(TaxAgentQueryParam queryParam, Long currentEmployeeId) { - List taxAgentPOS = taxAgentService.listByIds(queryParam.getIds()); - List paymentAgencyPOS = paymentAgencyService.listAll(currentTenantKey); - SalaryAssert.notEmpty(taxAgentPOS, "taxagent data is not exist"); - TaxAgentPO taxAgentPO = taxAgentPOS.get(0); - return TaxAgentBO.buildPaymentAgency(taxAgentPO.getPaymentAgency(), paymentAgencyPOS); + public List> paymentAgencyList(TaxAgentQueryParam queryParam) { +// List taxAgentPOS = getTaxAgentService(user).listByIds(queryParam.getIds()); +// List paymentAgencyPOS = paymentAgencyService.listAll(currentTenantKey); +// SalaryAssert.notEmpty(taxAgentPOS, "taxagent data is not exist"); +// TaxAgentPO taxAgentPO = taxAgentPOS.get(0); +// return TaxAgentBO.buildPaymentAgency(taxAgentPO.getPaymentAgency(), paymentAgencyPOS); + return null; } - public String paymentAgencySave(TaxAgentSaveParam param, Long currentEmploueeId) { -// List taxAgentPOS = taxAgentService.listByIds(Collections.singletonList(param.getId())); + public String paymentAgencySave(TaxAgentSaveParam param) { +// List taxAgentPOS = getTaxAgentService(user).listByIds(Collections.singletonList(param.getId())); // SalaryAssert.notEmpty(taxAgentPOS, "data is not exist"); // TaxAgentPO taxAgentPO = taxAgentPOS.get(0); // List errorList = new ArrayList<>(); @@ -211,7 +212,7 @@ public class TaxAgentWrapper { // currentEmploueeId, 115129, "缴纳社保福利,不可取消关联"); // } else { // taxAgentPO.setPaymentAgency(param.getPaymentAgency()); -// taxAgentService.paymentAgencyUpdate(taxAgentPO, currentEmploueeId); +// getTaxAgentService(user).paymentAgencyUpdate(taxAgentPO, currentEmploueeId); // } return ""; } @@ -225,21 +226,21 @@ public class TaxAgentWrapper { public TaxAgentFormDTO getFrom(Long id) { TaxAgentFormDTO taxAgentFromDTO = new TaxAgentFormDTO(); if (id != null) { - TaxAgentPO taxAgent = taxAgentService.getById(id); + TaxAgentPO taxAgent = getTaxAgentService(user).getById(id); if (taxAgent == null) { throw new SalaryRunTimeException(String.format(SalaryI18nUtil.getI18nLabel(100543, "个税扣缴人不存在") + "[id:%s]", id)); } BeanUtils.copyProperties(taxAgent, taxAgentFromDTO); } // 是否开启分权 - boolean isOpenDevolution = taxAgentBaseService.isOpenDevolution(); + boolean isOpenDevolution = getTaxAgentBaseService(user).isOpenDevolution(); if (isOpenDevolution) { - List admins = taxAgentAdminService.listByTaxAgentIds(Collections.singletonList(id)); + List admins = getTaxAgentAdminService(user).listByTaxAgentIds(Collections.singletonList(id)); // 目前是一个 TaxAgentEmployeeOptionDTO taxAgentEmployee = new TaxAgentEmployeeOptionDTO(); taxAgentEmployee.setId(CollectionUtils.isEmpty(admins) ? null : admins.get(0).getEmployeeId()); if (taxAgentEmployee.getId() != null) { - DataCollectionEmployee employee = employeeService.getEmployeeById(taxAgentEmployee.getId()); + DataCollectionEmployee employee = getSalaryEmployeeService(user).getEmployeeById(taxAgentEmployee.getId()); taxAgentEmployee.setContent(employee == null ? "" : employee.getUsername()); } taxAgentFromDTO.setAdminUser(Collections.singletonList(taxAgentEmployee)); @@ -254,54 +255,49 @@ public class TaxAgentWrapper { * 保存个税扣缴义务人 * * @param saveParam - * @param currentEmployeeId * @return */ - public String save(TaxAgentSaveParam saveParam, Long currentEmployeeId) { - return taxAgentService.save(saveParam, currentEmployeeId); + public String save(TaxAgentSaveParam saveParam) { + return getTaxAgentService(user).save(saveParam); } /** * 编辑个税扣缴义务人 * * @param saveParam - * @param currentEmployeeId * @return */ - public String update(TaxAgentSaveParam saveParam, Long currentEmployeeId) { - return taxAgentService.update(saveParam, currentEmployeeId); + public String update(TaxAgentSaveParam saveParam) { + return getTaxAgentService(user).update(saveParam); } /** * 更换管理员校验 * * @param checkParam - * @param currentEmployeeId * @return */ - public Boolean adminChangeCheck(TaxAgentAdminChangeCheckParam checkParam, Long currentEmployeeId) { - return taxAgentService.adminChangeCheck(checkParam, currentEmployeeId); + public Boolean adminChangeCheck(TaxAgentAdminChangeCheckParam checkParam) { + return getTaxAgentService(user).adminChangeCheck(checkParam); } /** * 删除个税扣缴义务人 * * @param ids - * @param currentEmployeeId * @return */ - public String delete(Collection ids, Long currentEmployeeId) { - return taxAgentService.delete(ids, currentEmployeeId); + public String delete(Collection ids) { + return getTaxAgentService(user).delete(ids); } /** * 个税扣缴义务人下拉列表 * - * @param currentEmployeeId * @return */ - public List> selectList(Long currentEmployeeId) { - return taxAgentService.selectList(currentEmployeeId); + public List> selectList() { + return getTaxAgentService(user).selectList(); } /** @@ -311,7 +307,7 @@ public class TaxAgentWrapper { * @return */ public PageInfo listRangeInclude(TaxAgentRangeQueryParam queryParam) { - PageInfo listPage = taxAgentManageRangeService.listPageByParamAndIncludeType(queryParam, NumberUtils.INTEGER_ONE); + PageInfo listPage = getTaxAgentManageRangeService(user).listPageByParamAndIncludeType(queryParam, NumberUtils.INTEGER_ONE); return listPage; } @@ -322,7 +318,7 @@ public class TaxAgentWrapper { * @return */ public PageInfo listRangeExclude(TaxAgentRangeQueryParam queryParam) { - PageInfo listPage = taxAgentManageRangeService.listPageByParamAndIncludeType(queryParam, NumberUtils.INTEGER_ZERO); + PageInfo listPage = getTaxAgentManageRangeService(user).listPageByParamAndIncludeType(queryParam, NumberUtils.INTEGER_ZERO); return listPage; } @@ -331,43 +327,21 @@ public class TaxAgentWrapper { * * @return */ - public WeaForm getRangeFrom() { + public TaxAgentManageRangeFormDTO getRangeFrom() { // 查询人员状态 - List hrmStatusList = UserStatusEnum.getEffectiveList(); - List weaFormOptions = hrmStatusList.stream().map(hrmStatus -> { - WeaFormOption weaFormOption = new WeaFormOption(); - weaFormOption.setId("" + hrmStatus.getCodeId()); - weaFormOption.setContent(hrmStatus.getName()); - return weaFormOption; - }).collect(Collectors.toList()); - Long employeeId = UserContext.getCurrentEmployeeId(); - List browserOptions = new ArrayList<>(); - browserOptions.add(new TypesBrowserOption("user", SalaryI18nUtil.getI18nLabel(1869, "人员"))); - browserOptions.add(new TypesBrowserOption("dept", SalaryI18nUtil.getI18nLabel(1250, "部门"))); - if (hrmConfigSetCache.isSubcompanySupport(tenantKey)) { - browserOptions.add(new TypesBrowserOption("subcompany", SalaryI18nUtil.getI18nLabel(107369, "分部"))); - } - browserOptions.add(new TypesBrowserOption("position", SalaryI18nUtil.getI18nLabel(1245, "岗位"))); + List hrmStatusList = UserStatusEnum.getHrmStatusList(); - WeaForm weaForm = SalaryFormatUtil.getInstance().buildForm(TaxAgentManageRangeFormDTO.class, TaxAgentManageRangeFormDTO.builder().targetOptions(browserOptions).build()); - weaForm.getItems().forEach((key, value) -> { - if (StringUtils.equals("employeeStatus", key)) { - value.setOptions(weaFormOptions); - } - }); - return weaForm; + return TaxAgentManageRangeFormDTO.builder().employeeStatus(hrmStatusList).build(); } /** * 保存管理范围 * * @param saveParam - * @param employeeId - * @param tenantKey * @return */ - public String saveRange(TaxAgentRangeSaveParam saveParam, Long employeeId, String tenantKey) { - taxAgentManageRangeService.save(saveParam, employeeId, tenantKey); + public String saveRange(TaxAgentRangeSaveParam saveParam) { + getTaxAgentManageRangeService(user).save(saveParam); return StringUtils.EMPTY; } @@ -375,11 +349,10 @@ public class TaxAgentWrapper { * 删除管理范围 * * @param ids - * @param tenantKey * @return */ - public String deleteRange(Collection ids, Long employeeId, String tenantKey) { - taxAgentManageRangeService.deleteByIds(ids, employeeId, tenantKey); + public String deleteRange(Collection ids) { + getTaxAgentManageRangeService(user).deleteByIds(ids); return StringUtils.EMPTY; } } From 895d258a44994c00768cd2ef9ac771005f4eaa7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=92=B1=E6=B6=9B?= <15850646081@163.com> Date: Tue, 24 May 2022 13:25:56 +0800 Subject: [PATCH 07/20] =?UTF-8?q?=E5=88=86=E6=9D=83=E5=9F=BA=E6=9C=AC?= =?UTF-8?q?=E6=8E=A7=E5=88=B6=E5=BC=80=E5=8F=91=E5=AE=8C=E6=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/com/engine/salary/wrapper/TaxAgentWrapper.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/com/engine/salary/wrapper/TaxAgentWrapper.java b/src/com/engine/salary/wrapper/TaxAgentWrapper.java index 2878750d0..54d09a860 100644 --- a/src/com/engine/salary/wrapper/TaxAgentWrapper.java +++ b/src/com/engine/salary/wrapper/TaxAgentWrapper.java @@ -126,7 +126,9 @@ public class TaxAgentWrapper extends Service { // 填充总数和当页数据 PageInfo dtoPage = PageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize()); dtoPage.setTotal(list.size()); - dtoPage.setList(PageUtil.subList(dtoPage.getPageNum(), dtoPage.getSize(), list)); + dtoPage.setPageNum(queryParam.getCurrent()); + dtoPage.setPageSize(queryParam.getPageSize()); + dtoPage.setList(PageUtil.subList(dtoPage.getPageNum(), dtoPage.getPageSize(), list)); page = dtoPage; } } From bf364a76398f319b0e78b8e2d261e786008923eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=92=B1=E6=B6=9B?= <15850646081@163.com> Date: Tue, 24 May 2022 15:20:12 +0800 Subject: [PATCH 08/20] =?UTF-8?q?=E6=9A=82=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../datacollection/dto/AddUpDeductionDTO.java | 21 ++++ .../param/AddUpDeductionQueryParam.java | 3 +- .../datacollection/AddUpDeductionMapper.xml | 1 + .../salary/service/AddUpDeductionService.java | 87 +++++++++++++- .../impl/AddUpDeductionServiceImpl.java | 113 +++++++++++++++++- 5 files changed, 221 insertions(+), 4 deletions(-) diff --git a/src/com/engine/salary/entity/datacollection/dto/AddUpDeductionDTO.java b/src/com/engine/salary/entity/datacollection/dto/AddUpDeductionDTO.java index 31ebcddbf..ca5424b51 100644 --- a/src/com/engine/salary/entity/datacollection/dto/AddUpDeductionDTO.java +++ b/src/com/engine/salary/entity/datacollection/dto/AddUpDeductionDTO.java @@ -4,6 +4,7 @@ import com.cloudstore.eccom.pc.table.WeaTableType; import com.engine.salary.annotation.SalaryTable; import com.engine.salary.annotation.SalaryTableColumn; import com.engine.salary.annotation.SalaryTableOperate; +import com.engine.salary.annotation.TableTitle; import com.engine.salary.util.excel.ExcelProperty; import com.fasterxml.jackson.annotation.JsonFormat; import lombok.AllArgsConstructor; @@ -46,6 +47,7 @@ public class AddUpDeductionDTO { */ @ExcelProperty(index = 0) @SalaryTableColumn(text = "姓名", width = "10%", column = "username") + @TableTitle(title = "姓名", dataIndex = "username", key = "username") private String username; /** @@ -53,13 +55,20 @@ public class AddUpDeductionDTO { */ @ExcelProperty(index = 1) @SalaryTableColumn(text = "个税扣缴义务人", width = "10%", column = "taxAgentName") + @TableTitle(title = "个税扣缴义务人", dataIndex = "taxAgentName", key = "taxAgentName") private String taxAgentName; + /** + * 个税扣缴义务人id + */ + private Long taxAgentId; + /** * 部门 */ @ExcelProperty(index = 2) @SalaryTableColumn(text = "部门", width = "10%", column = "departmentName") + @TableTitle(title = "部门", dataIndex = "departmentName", key = "departmentName") private String departmentName; /** @@ -67,6 +76,7 @@ public class AddUpDeductionDTO { */ @ExcelProperty(index = 3) @SalaryTableColumn(text = "手机号", width = "10%", column = "mobile") + @TableTitle(title = "手机号", dataIndex = "mobile", key = "mobile") private String mobile; /** @@ -74,6 +84,7 @@ public class AddUpDeductionDTO { */ @ExcelProperty(index = 4) @SalaryTableColumn(text = "工号", width = "10%", column = "jobNum") + @TableTitle(title = "工号", dataIndex = "jobNum", key = "jobNum") private String jobNum; /** @@ -81,6 +92,7 @@ public class AddUpDeductionDTO { */ @ExcelProperty(index = 5) @SalaryTableColumn(text = "证件号码", width = "10%", column = "idNo") + @TableTitle(title = "证件号码", dataIndex = "idNo", key = "idNo") private String idNo; /** @@ -89,6 +101,7 @@ public class AddUpDeductionDTO { @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") @ExcelProperty(index = 6, msg = "第7列,入职日期解析错误,标准格式应为yyyy-MM-dd,例如:2022-01-01") @SalaryTableColumn(text = "入职日期", width = "10%", column = "hiredate") + @TableTitle(title = "入职日期", dataIndex = "hiredate", key = "hiredate") private String hiredate; /** @@ -96,6 +109,7 @@ public class AddUpDeductionDTO { */ @ExcelProperty(index = 7, msg = "第8列,累计子女教育解析错误,请输入数字") @SalaryTableColumn(text = "累计子女教育", width = "10%", column = "addUpChildEducation") + @TableTitle(title = "累计子女教育", dataIndex = "addUpChildEducation", key = "addUpChildEducation") private BigDecimal addUpChildEducation; /** @@ -103,6 +117,7 @@ public class AddUpDeductionDTO { */ @ExcelProperty(index = 8, msg = "第9列,累计继续教育教育解析错误,请输入数字") @SalaryTableColumn(text = "累计继续教育", width = "10%", column = "addUpContinuingEducation") + @TableTitle(title = "累计继续教育", dataIndex = "addUpContinuingEducation", key = "addUpContinuingEducation") private BigDecimal addUpContinuingEducation; /** @@ -110,6 +125,7 @@ public class AddUpDeductionDTO { */ @ExcelProperty(index = 9, msg = "第10列,累计住房贷款利息解析错误,请输入数字") @SalaryTableColumn(text = "累计住房贷款利息", width = "10%", column = "addUpHousingLoanInterest") + @TableTitle(title = "累计住房贷款利息", dataIndex = "addUpHousingLoanInterest", key = "addUpHousingLoanInterest") private BigDecimal addUpHousingLoanInterest; /** @@ -117,6 +133,7 @@ public class AddUpDeductionDTO { */ @ExcelProperty(index = 10, msg = "第11列,累计住房租金解析错误,请输入数字") @SalaryTableColumn(text = "累计住房租金", width = "10%", column = "addUpHousingRent") + @TableTitle(title = "累计住房租金", dataIndex = "addUpHousingRent", key = "addUpHousingRent") private BigDecimal addUpHousingRent; /** @@ -124,6 +141,7 @@ public class AddUpDeductionDTO { */ @ExcelProperty(index = 11, msg = "第12列,累计赡养老人解析错误,请输入数字") @SalaryTableColumn(text = "累计赡养老人", width = "10%", column = "addUpSupportElderly") + @TableTitle(title = "累计赡养老人", dataIndex = "addUpSupportElderly", key = "addUpSupportElderly") private BigDecimal addUpSupportElderly; /** @@ -131,12 +149,15 @@ public class AddUpDeductionDTO { */ @ExcelProperty(index = 12, msg = "第13列,累计大病医疗解析错误,请输入数字") @SalaryTableColumn(text = "累计大病医疗", width = "10%", column = "addUpIllnessMedical") + @TableTitle(title = "累计大病医疗", dataIndex = "addUpIllnessMedical", key = "addUpIllnessMedical") private BigDecimal addUpIllnessMedical; @ExcelProperty(index = 13, msg = "第14列,累计婴幼儿照护解析错误,请输入数字") @SalaryTableColumn(text = "累计婴幼儿照护", width = "10%", column = "addUpInfantCare") + @TableTitle(title = "累计婴幼儿照护", dataIndex = "addUpInfantCare", key = "addUpInfantCare") private BigDecimal addUpInfantCare; @SalaryTableColumn(text = "操作", width = "20%", column = "operate") + @TableTitle(title = "操作", dataIndex = "operate", key = "operate") private String operate; } diff --git a/src/com/engine/salary/entity/datacollection/param/AddUpDeductionQueryParam.java b/src/com/engine/salary/entity/datacollection/param/AddUpDeductionQueryParam.java index 3d6c2ce3e..e3a68a51f 100644 --- a/src/com/engine/salary/entity/datacollection/param/AddUpDeductionQueryParam.java +++ b/src/com/engine/salary/entity/datacollection/param/AddUpDeductionQueryParam.java @@ -1,5 +1,6 @@ package com.engine.salary.entity.datacollection.param; +import com.engine.salary.common.BaseQueryParam; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; @@ -21,7 +22,7 @@ import java.util.List; @Builder @NoArgsConstructor @AllArgsConstructor -public class AddUpDeductionQueryParam { +public class AddUpDeductionQueryParam extends BaseQueryParam { /** * 主键id diff --git a/src/com/engine/salary/mapper/datacollection/AddUpDeductionMapper.xml b/src/com/engine/salary/mapper/datacollection/AddUpDeductionMapper.xml index 8860f0400..34b0855b1 100644 --- a/src/com/engine/salary/mapper/datacollection/AddUpDeductionMapper.xml +++ b/src/com/engine/salary/mapper/datacollection/AddUpDeductionMapper.xml @@ -86,6 +86,7 @@ e.workcode as job_num, e.companystartdate as hiredate, t2.name AS tax_agent_name, + t2.id AS tax_agent_name, t1.add_up_child_education, t1.add_up_continuing_education, t1.add_up_housing_loan_interest, diff --git a/src/com/engine/salary/service/AddUpDeductionService.java b/src/com/engine/salary/service/AddUpDeductionService.java index f9d04e82a..2909a3655 100644 --- a/src/com/engine/salary/service/AddUpDeductionService.java +++ b/src/com/engine/salary/service/AddUpDeductionService.java @@ -1,7 +1,11 @@ package com.engine.salary.service; import com.engine.salary.entity.datacollection.AddUpDeduction; +import com.engine.salary.entity.datacollection.dto.AddUpDeductionDTO; +import com.engine.salary.entity.datacollection.dto.AddUpDeductionRecordDTO; import com.engine.salary.entity.datacollection.param.AddUpDeductionQueryParam; +import com.engine.salary.entity.salaryacct.po.SalaryAcctEmployeePO; +import com.engine.salary.util.page.PageInfo; import org.apache.poi.xssf.usermodel.XSSFWorkbook; import java.time.YearMonth; @@ -24,6 +28,81 @@ public interface AddUpDeductionService { XSSFWorkbook exportDetail(Map map); + + XSSFWorkbook downloadTemplate(AddUpDeductionQueryParam queryParam); + + + + //-----------------------------------分权--------------------------------------------------- + + + + /** + * 通过id获取单条累计专项附加扣除记录 + * + * @param id + * @return + */ + AddUpDeduction getById(Long id); + + /** + * 数据采集-累计专项附加扣除列表(分页) + * + * @param queryParam + * @param employeeId + * @return + */ + PageInfo listPage(AddUpDeductionQueryParam queryParam, Long employeeId); + + /** + * 获取数据采集-累计专项附加扣除详情列表(分页) + * + * @param queryParam + * @param employeeId + * @return + */ + PageInfo recordListPage(AddUpDeductionQueryParam queryParam, Long employeeId); + + /** + * 导出 + * + * @param map + * @param username + * @param eteamsId + * @param isChief + * @param queryParam + * @param employeeId + * @param tenantKey + */ + void export(Map map, String username, String eteamsId, boolean isChief, AddUpDeductionQueryParam queryParam, Long employeeId, String tenantKey); + + /** + * 导出详情 + * + * @param map + * @param username + * @param eteamsId + * @param beLongEmployeeId + * @param isChief + * @param queryParam + * @param employeeId + * @param tenantKey + */ + void exportDetail(Map map, String username, String eteamsId, Long beLongEmployeeId, boolean isChief, AddUpDeductionQueryParam queryParam, Long employeeId, String tenantKey); + + /** + * 下载导入模板 + * + * @param map + * @param username + * @param eteamsId + * @param isChief + * @param queryParam + * @param employeeId + * @param tenantKey + */ + void downloadTemplate(Map map, String username, String eteamsId, boolean isChief, AddUpDeductionQueryParam queryParam, Long employeeId, String tenantKey); + /** * 获取累计专项附加扣除数据 * @@ -33,5 +112,11 @@ public interface AddUpDeductionService { */ List getAddUpDeductionList(YearMonth declareMonth, List employeeIds); - XSSFWorkbook downloadTemplate(AddUpDeductionQueryParam queryParam); + /** + * 根据年月获取已核算数据 + * + * @param yearMonth + * @return + */ + List getAccountedEmployeeData(String yearMonth); } diff --git a/src/com/engine/salary/service/impl/AddUpDeductionServiceImpl.java b/src/com/engine/salary/service/impl/AddUpDeductionServiceImpl.java index ee1405cd4..c61f5dd5c 100644 --- a/src/com/engine/salary/service/impl/AddUpDeductionServiceImpl.java +++ b/src/com/engine/salary/service/impl/AddUpDeductionServiceImpl.java @@ -8,16 +8,22 @@ import com.engine.salary.entity.datacollection.AddUpDeduction; import com.engine.salary.entity.datacollection.DataCollectionEmployee; import com.engine.salary.entity.datacollection.dto.AddUpDeductionDTO; import com.engine.salary.entity.datacollection.param.AddUpDeductionQueryParam; +import com.engine.salary.entity.taxagent.bo.TaxAgentBO; +import com.engine.salary.entity.taxagent.dto.TaxAgentEmployeeDTO; +import com.engine.salary.entity.taxagent.po.TaxAgentPO; import com.engine.salary.exception.SalaryRunTimeException; import com.engine.salary.mapper.datacollection.AddUpDeductionMapper; -import com.engine.salary.service.AddUpDeductionService; +import com.engine.salary.service.*; import com.engine.salary.util.SalaryDateUtil; import com.engine.salary.util.SalaryI18nUtil; import com.engine.salary.util.db.MapperProxyFactory; import com.engine.salary.util.excel.ExcelComment; import com.engine.salary.util.excel.ExcelUtil; +import com.engine.salary.util.page.PageInfo; +import com.engine.salary.util.page.PageUtil; import com.google.common.collect.Lists; import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang3.StringUtils; import org.apache.poi.xssf.usermodel.XSSFWorkbook; import weaver.general.Util; @@ -31,6 +37,12 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction return MapperProxyFactory.getProxy(AddUpDeductionMapper.class); } + private TaxAgentV2Service taxAgentService; + private SalaryAcctRecordService salaryAcctRecordService; + private SalaryAcctEmployeeService salaryAcctEmployeeService; + private SalaryEmployeeService salaryEmployeeService; + + @Override public Map list(Map params) { return commandExecutor.execute(new AddUpDeductionListCmd(params, user)); @@ -80,7 +92,7 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction AddUpDeduction po = biz.getById(id); if (po == null) { - throw new SalaryRunTimeException(String.format("累计专项附加扣除不存在"+"[id:%s]", id)); + throw new SalaryRunTimeException(String.format("累计专项附加扣除不存在" + "[id:%s]", id)); } List employeeList = employBiz.getEmployeeByIds(Collections.singletonList(po.getEmployeeId())); @@ -182,4 +194,101 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction return book; } + + + @Override + public AddUpDeduction getById(Long id) { + return getAddUpDeductionMapper().getById(id); + } + +// /** +// * 获取作为修改者的最新记录 +// * 说明:以人员id和个税口角义务人id去重 +// * +// * @param currentEmployeeId +// * @return +// */ +// private List getLastListByModifier(Long currentEmployeeId) { +// List list = new LambdaQueryChainWrapper<>(getAddUpDeductionMapper()) +// .eq(AddUpDeductionPO::getDeleteType, 0) +// .eq(AddUpDeductionPO::getTenantKey) +// .eq(AddUpDeductionPO::getModifier, currentEmployeeId) +// .orderByDesc(AddUpDeductionPO::getDeclareMonth) +// .list(); +// return list.stream() +// .collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(f -> f.getEmployeeId() + "-" + f.getTaxAgentId()))), ArrayList::new)); +// } + + @Override + public PageInfo listPage(AddUpDeductionQueryParam queryParam, Long employeeId) { + PageInfo dtoPage = PageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize()); + + // 未开启分权或是薪酬模块总管理员 + if (!taxAgentService.isOpenDevolution() || taxAgentService.isChief(employeeId)) { + PageUtil.start(queryParam.getCurrent(), queryParam.getPageSize()); + List list = getAddUpDeductionMapper().list(queryParam); + return new PageInfo<>(list, AddUpDeductionDTO.class); + } else { + List taxAgentEmployees = taxAgentService.listTaxAgentAndEmployee(employeeId); + List taxAgentIdsAsAdmin = taxAgentService.listAllTaxAgentsAsAdmin(employeeId).stream().map(TaxAgentPO::getId).collect(Collectors.toList()); +// List lastList = getLastListByModifier(employeeId); + List list = getAddUpDeductionMapper().list(queryParam); + list = list.stream().filter(f -> + // 作为管理员 + taxAgentIdsAsAdmin.contains(f.getTaxAgentId()) + // 作为分管理员 + || TaxAgentBO.checkTaxAgentAndEmployee(taxAgentEmployees, f.getTaxAgentId(), f.getEmployeeId()) + // 自己最后修改过的,则可以看到最新和其历史 +// || lastList.stream().anyMatch(l -> l.getEmployeeId().equals(f.getEmployeeId()) && l.getTaxAgentId().equals(f.getTaxAgentId()) && !l.getDeclareMonth().isBefore(f.getDeclareMonth())) + ).collect(Collectors.toList()); + // 填充总数和当页数据 + // 分页参数 + dtoPage.setTotal(list.size()); + dtoPage.setRecords(SalaryPageUtil.subList((int) dtoPage.getCurrent(), (int) dtoPage.getSize(), list)); + page = dtoPage; + } + return page; + } + + @Override + public Page recordListPage(Page page, AddUpDeductionQueryParam queryParam, Long employeeId, String tenantKey) { + // 未开启分权或是薪酬模块总管理员 + if (!taxAgentService.isOpenDevolution(tenantKey) || taxAgentService.isChief(employeeId, tenantKey)) { + getAddUpDeductionMapper().recordList(page, queryParam, tenantKey); + } else { + List taxAgentEmployees = taxAgentService.listTaxAgentAndEmployee(employeeId, tenantKey); + List taxAgentIdsAsAdmin = taxAgentService.listAllTaxAgentsAsAdmin(employeeId, tenantKey).stream().map(TaxAgentPO::getId).collect(Collectors.toList()); + List lastList = getLastListByModifier(employeeId, tenantKey); + List list = getAddUpDeductionMapper().recordList(queryParam, tenantKey); + // 分页参数 + Page dtoPage = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize()); + list = list.stream().filter(f -> + // 作为管理员 + taxAgentIdsAsAdmin.contains(f.getTaxAgentId()) + // 作为分管理员 + || TaxAgentBO.checkTaxAgentAndEmployee(taxAgentEmployees, f.getTaxAgentId(), f.getEmployeeId()) + // 自己最后修改过的,则可以看到最新和其历史 + || lastList.stream().anyMatch(l -> l.getEmployeeId().equals(f.getEmployeeId()) && l.getTaxAgentId().equals(f.getTaxAgentId()) && !l.getDeclareMonth().isBefore(f.getDeclareMonth())) + ).collect(Collectors.toList()); + // 填充总数和当页数据 + dtoPage.setTotal(list.size()); + dtoPage.setRecords(SalaryPageUtil.subList((int) dtoPage.getCurrent(), (int) dtoPage.getSize(), list)); + page = dtoPage; + } + return page; + } + + @Override + public List getAddUpDeductionList(YearMonth declareMonth, List employeeIds, String tenantKey) { + if (declareMonth == null || StringUtils.isEmpty(tenantKey)) { + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(tenantKey, UserContext.getCurrentEmployeeId(), 100342, "参数有误:申报月份、租户key必传")); + } + return new LambdaQueryChainWrapper<>(getAddUpDeductionMapper()) + .eq(AddUpDeductionPO::getDeleteType, 0) + .eq(AddUpDeductionPO::getTenantKey, tenantKey) + .eq(AddUpDeductionPO::getDeclareMonth, declareMonth.atDay(1)) + .in(CollectionUtils.isNotEmpty(employeeIds), AddUpDeductionPO::getEmployeeId, employeeIds).list(); + } + + } From e1b579d480af935b498cbc0436628bc6ce0bb53b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=92=B1=E6=B6=9B?= <15850646081@163.com> Date: Wed, 25 May 2022 13:10:03 +0800 Subject: [PATCH 09/20] =?UTF-8?q?=E6=9A=82=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../engine/salary/biz/AddUpDeductionBiz.java | 53 ---- src/com/engine/salary/biz/SIAccountBiz.java | 12 +- src/com/engine/salary/biz/SIArchivesBiz.java | 5 +- .../engine/salary/biz/SalaryArchiveBiz.java | 4 +- .../salary/biz/SalaryArchiveItemBiz.java | 4 +- src/com/engine/salary/biz/SalaryItemBiz.java | 4 +- .../salary/biz/SalarySobCheckRuleBiz.java | 4 +- .../dto/AddUpDeductionRecordDTO.java | 5 + .../datacollection/AddUpDeductionMapper.xml | 4 +- .../impl/AddUpDeductionServiceImpl.java | 272 ++++++++++++++++-- .../impl/AttendQuoteDataServiceImpl.java | 4 +- .../impl/AttendQuoteFieldServiceImpl.java | 4 +- .../service/impl/AttendQuoteServiceImpl.java | 4 +- .../service/impl/SIAccountServiceImpl.java | 10 +- .../service/impl/SIReportServiceImpl.java | 4 +- .../service/impl/SISchemeServiceImpl.java | 22 +- .../impl/SalaryAcctEmployeeServiceImpl.java | 8 +- .../impl/SalaryAcctRecordServiceImpl.java | 4 +- .../SalaryArchiveTaxAgentServiceImpl.java | 4 +- .../SalaryComparisonResultServiceImpl.java | 4 +- .../impl/SalarySobRangeServiceImpl.java | 4 +- .../impl/TaxAgentManageRangeServiceImpl.java | 6 +- .../service/impl/TaxAgentV2ServiceImpl.java | 4 +- .../impl/TaxDeclarationServiceImpl.java | 4 +- .../{PageUtil.java => SalaryPageUtil.java} | 2 +- .../salary/wrapper/SalarySendWrapper.java | 4 +- .../wrapper/TaxAgentSubAdminWrapper.java | 6 +- .../salary/wrapper/TaxAgentWrapper.java | 6 +- 28 files changed, 308 insertions(+), 163 deletions(-) rename src/com/engine/salary/util/page/{PageUtil.java => SalaryPageUtil.java} (98%) diff --git a/src/com/engine/salary/biz/AddUpDeductionBiz.java b/src/com/engine/salary/biz/AddUpDeductionBiz.java index 954cc157a..c04f34936 100644 --- a/src/com/engine/salary/biz/AddUpDeductionBiz.java +++ b/src/com/engine/salary/biz/AddUpDeductionBiz.java @@ -121,60 +121,7 @@ public class AddUpDeductionBiz extends BaseBean { } - /** - * 导出 - * - * @param param - * @return - */ - public XSSFWorkbook export(AddUpDeductionQueryParam param) { - //获取操作按钮资源 - List> rowList = getExcelRowList(param); - - //获取excel - return ExcelUtil.genWorkbook(rowList, "累计专项附加扣除"); - } - - - /** - * 获取excel数据行 - * - * @return 导出数据行集合 - */ - private List> getExcelRowList(AddUpDeductionQueryParam param) { - //excel标题 - List title = Arrays.asList("姓名", "个税扣缴义务人", "部门", "手机号", "工号", "证件号码", "入职日期", "累计子女教育", "累计继续教育", "累计住房贷款利息", "累计住房租金", "累计赡养老人", "累计大病医疗", "累计婴幼儿照护"); - - SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); - List list = list(param); - final List> dataRowList = Optional.ofNullable(list) - .map(List::stream) - .map(operatorStream -> operatorStream.map(dto -> { - List cellList = new ArrayList<>(); - cellList.add(Util.null2String(dto.getUsername())); - cellList.add(Util.null2String(dto.getTaxAgentName())); - cellList.add(Util.null2String(dto.getDepartmentName())); - cellList.add(Util.null2String(dto.getMobile())); - cellList.add(Util.null2String(dto.getJobNum())); - cellList.add(Util.null2String(dto.getIdNo())); - cellList.add(Util.null2String(dto.getHiredate())); - cellList.add(Util.null2String(dto.getAddUpChildEducation())); - cellList.add(Util.null2String(dto.getAddUpContinuingEducation())); - cellList.add(Util.null2String(dto.getAddUpHousingLoanInterest())); - cellList.add(Util.null2String(dto.getAddUpHousingRent())); - cellList.add(Util.null2String(dto.getAddUpSupportElderly())); - cellList.add(Util.null2String(dto.getAddUpIllnessMedical())); - cellList.add(Util.null2String(dto.getAddUpInfantCare())); - return cellList; - }).collect(Collectors.toList())) - .orElse(Collections.emptyList()); - - List> rowList = new ArrayList<>(); - rowList.add(title); - rowList.addAll(dataRowList); - return rowList; - } /** diff --git a/src/com/engine/salary/biz/SIAccountBiz.java b/src/com/engine/salary/biz/SIAccountBiz.java index d681581ac..519469b7e 100644 --- a/src/com/engine/salary/biz/SIAccountBiz.java +++ b/src/com/engine/salary/biz/SIAccountBiz.java @@ -27,15 +27,13 @@ import com.engine.salary.mapper.siaccount.SIAccountDetailTempMapper; import com.engine.salary.mapper.sicategory.ICategoryMapper; import com.engine.salary.mapper.sischeme.InsuranceSchemeDetailMapper; -import com.engine.salary.service.SIAccountService; -import com.engine.salary.service.impl.SIAccountServiceImpl; import com.engine.salary.util.SalaryAssert; import com.engine.salary.util.SalaryDateUtil; import com.engine.salary.util.SalaryEntityUtil; import com.engine.salary.util.SalaryI18nUtil; import com.engine.salary.util.db.MapperProxyFactory; import com.engine.salary.util.page.PageInfo; -import com.engine.salary.util.page.PageUtil; +import com.engine.salary.util.page.SalaryPageUtil; import com.google.common.collect.Lists; import dm.jdbc.util.IdGenerator; import org.apache.commons.collections4.CollectionUtils; @@ -43,9 +41,7 @@ import org.apache.commons.lang3.StringUtils; import org.apache.ibatis.session.SqlSession; import org.springframework.beans.BeanUtils; -import org.springframework.transaction.annotation.Transactional; import weaver.conn.mybatis.MyBatisFactory; -import weaver.hrm.User; import java.math.BigDecimal; import java.util.*; @@ -71,7 +67,7 @@ public class SIAccountBiz extends Service{ SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession(); try { InsuranceAccountBatchMapper insuranceAccountBatchMapper = sqlSession.getMapper(InsuranceAccountBatchMapper.class); - PageUtil.start(queryParam.getCurrent(), queryParam.getPageSize()); + SalaryPageUtil.start(queryParam.getCurrent(), queryParam.getPageSize()); List list = insuranceAccountBatchMapper.list(queryParam); PageInfo pageInfo = new PageInfo<>(list,InsuranceAccountBatchPO.class); return pageInfo; @@ -85,7 +81,7 @@ public class SIAccountBiz extends Service{ SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession(); try { InsuranceAccountDetailMapper insuranceAccountDetailMapper = sqlSession.getMapper(InsuranceAccountDetailMapper.class); - PageUtil.start(queryParam.getCurrent(), queryParam.getPageSize()); + SalaryPageUtil.start(queryParam.getCurrent(), queryParam.getPageSize()); queryParam.setPaymentStatus(PaymentStatusEnum.COMMON.getValue()); List list = insuranceAccountDetailMapper.list(queryParam); PageInfo pageInfo = new PageInfo<>(list,InsuranceAccountDetailPO.class); @@ -1304,7 +1300,7 @@ public class SIAccountBiz extends Service{ public PageInfo overView(InsuranceAccountDetailParam queryParam) { - PageUtil.start(queryParam.getCurrent(),queryParam.getPageSize()); + SalaryPageUtil.start(queryParam.getCurrent(),queryParam.getPageSize()); List insuranceAccountDetailPOS = MapperProxyFactory.getProxy(InsuranceAccountDetailMapper.class).selectList(queryParam.getBillMonth()); //获取扣缴义务人信息 diff --git a/src/com/engine/salary/biz/SIArchivesBiz.java b/src/com/engine/salary/biz/SIArchivesBiz.java index 0f37d2265..fae3d95fe 100644 --- a/src/com/engine/salary/biz/SIArchivesBiz.java +++ b/src/com/engine/salary/biz/SIArchivesBiz.java @@ -8,7 +8,6 @@ import com.api.browser.bean.SearchConditionItem; import com.api.browser.bean.SearchConditionOption; import com.api.browser.util.ConditionFactory; import com.api.browser.util.ConditionType; -import com.cloudstore.eccom.constant.WeaInputType; import com.cloudstore.eccom.pc.table.WeaTable; import com.cloudstore.eccom.pc.table.WeaTableCheckboxpopedom; import com.cloudstore.eccom.pc.table.WeaTableColumn; @@ -41,7 +40,7 @@ import com.engine.salary.util.SalaryEntityUtil; import com.engine.salary.util.SalaryFormItemUtil; import com.engine.salary.util.db.MapperProxyFactory; import com.engine.salary.util.page.PageInfo; -import com.engine.salary.util.page.PageUtil; +import com.engine.salary.util.page.SalaryPageUtil; import org.apache.commons.collections.CollectionUtils; import org.apache.ibatis.session.SqlSession; import weaver.conn.mybatis.MyBatisFactory; @@ -609,7 +608,7 @@ public class SIArchivesBiz { Map datas = new HashMap<>(16); try { SocialSchemeMapper socialSchemeMapper = sqlSession.getMapper(SocialSchemeMapper.class); - PageUtil.start(param.getCurrent(), param.getPageSize()); + SalaryPageUtil.start(param.getCurrent(), param.getPageSize()); // List page = socialSchemeMapper.listPageEmployeePOS(param); List page = socialSchemeMapper.queryEmployeeList(param); PageInfo pageInfo = new PageInfo<>(page, InsuranceArchivesEmployeePO.class); diff --git a/src/com/engine/salary/biz/SalaryArchiveBiz.java b/src/com/engine/salary/biz/SalaryArchiveBiz.java index bd2477c75..cbf8b4f41 100644 --- a/src/com/engine/salary/biz/SalaryArchiveBiz.java +++ b/src/com/engine/salary/biz/SalaryArchiveBiz.java @@ -5,7 +5,7 @@ import com.engine.salary.entity.salaryarchive.param.SalaryArchiveQueryParam; import com.engine.salary.entity.salaryarchive.po.SalaryArchivePO; import com.engine.salary.mapper.archive.SalaryArchiveMapper; import com.engine.salary.util.page.PageInfo; -import com.engine.salary.util.page.PageUtil; +import com.engine.salary.util.page.SalaryPageUtil; import org.apache.ibatis.session.SqlSession; import weaver.conn.mybatis.MyBatisFactory; @@ -28,7 +28,7 @@ public class SalaryArchiveBiz { SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession(); try { SalaryArchiveMapper mapper = sqlSession.getMapper(SalaryArchiveMapper.class); - PageUtil.start(param.getCurrent(), param.getPageSize()); + SalaryPageUtil.start(param.getCurrent(), param.getPageSize()); List list = mapper.list(param); PageInfo pageInfo = new PageInfo(list, SalaryArchiveListDTO.class); return pageInfo; diff --git a/src/com/engine/salary/biz/SalaryArchiveItemBiz.java b/src/com/engine/salary/biz/SalaryArchiveItemBiz.java index f74048490..a2f88b8d7 100644 --- a/src/com/engine/salary/biz/SalaryArchiveItemBiz.java +++ b/src/com/engine/salary/biz/SalaryArchiveItemBiz.java @@ -6,7 +6,7 @@ import com.engine.salary.entity.salaryarchive.param.SalaryItemAdjustRecordQueryP import com.engine.salary.entity.salaryarchive.po.SalaryArchiveItemPO; import com.engine.salary.mapper.archive.SalaryArchiveItemMapper; import com.engine.salary.util.page.PageInfo; -import com.engine.salary.util.page.PageUtil; +import com.engine.salary.util.page.SalaryPageUtil; import org.apache.ibatis.session.SqlSession; import weaver.conn.mybatis.MyBatisFactory; @@ -123,7 +123,7 @@ public class SalaryArchiveItemBiz { public PageInfo salaryItemAdjustRecordListPage(SalaryItemAdjustRecordQueryParam queryParam, List salaryItemIds) { SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession(); try { - PageUtil.start(queryParam.getCurrent(), queryParam.getPageSize()); + SalaryPageUtil.start(queryParam.getCurrent(), queryParam.getPageSize()); SalaryArchiveItemMapper mapper = sqlSession.getMapper(SalaryArchiveItemMapper.class); List salaryItemAdjustRecordListDTOS = mapper.salaryItemAdjustRecordList(queryParam, salaryItemIds); PageInfo page = new PageInfo(salaryItemAdjustRecordListDTOS,SalaryItemAdjustRecordListDTO.class); diff --git a/src/com/engine/salary/biz/SalaryItemBiz.java b/src/com/engine/salary/biz/SalaryItemBiz.java index fdf8ce1db..3a8b6083e 100644 --- a/src/com/engine/salary/biz/SalaryItemBiz.java +++ b/src/com/engine/salary/biz/SalaryItemBiz.java @@ -5,7 +5,7 @@ import com.engine.salary.entity.salaryitem.po.SalaryItemPO; import com.engine.salary.enums.SalaryOnOffEnum; import com.engine.salary.mapper.salaryitem.SalaryItemMapper; import com.engine.salary.util.page.PageInfo; -import com.engine.salary.util.page.PageUtil; +import com.engine.salary.util.page.SalaryPageUtil; import org.apache.ibatis.session.SqlSession; import weaver.conn.mybatis.MyBatisFactory; @@ -92,7 +92,7 @@ public class SalaryItemBiz { SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession(); try { SalaryItemMapper mapper = sqlSession.getMapper(SalaryItemMapper.class); - PageUtil.start(searchParam.getCurrent(), searchParam.getPageSize()); + SalaryPageUtil.start(searchParam.getCurrent(), searchParam.getPageSize()); List salaryItemPOList = mapper.listByParam(searchParam); return new PageInfo(salaryItemPOList); } finally { diff --git a/src/com/engine/salary/biz/SalarySobCheckRuleBiz.java b/src/com/engine/salary/biz/SalarySobCheckRuleBiz.java index 74d9abf9d..ee6a49edd 100644 --- a/src/com/engine/salary/biz/SalarySobCheckRuleBiz.java +++ b/src/com/engine/salary/biz/SalarySobCheckRuleBiz.java @@ -4,7 +4,7 @@ import com.engine.salary.entity.salarysob.param.SalarySobCheckRuleQueryParam; import com.engine.salary.entity.salarysob.po.SalarySobCheckRulePO; import com.engine.salary.mapper.salarysob.SalarySobCheckRuleMapper; import com.engine.salary.util.page.PageInfo; -import com.engine.salary.util.page.PageUtil; +import com.engine.salary.util.page.SalaryPageUtil; import org.apache.ibatis.session.SqlSession; import weaver.conn.mybatis.MyBatisFactory; @@ -93,7 +93,7 @@ public class SalarySobCheckRuleBiz { SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession(); try { SalarySobCheckRuleMapper mapper = sqlSession.getMapper(SalarySobCheckRuleMapper.class); - PageUtil.start(param.getCurrent(), param.getPageSize()); + SalaryPageUtil.start(param.getCurrent(), param.getPageSize()); List list = mapper.listByParam(param); PageInfo pageInfo = new PageInfo(list, SalarySobCheckRulePO.class); return pageInfo; diff --git a/src/com/engine/salary/entity/datacollection/dto/AddUpDeductionRecordDTO.java b/src/com/engine/salary/entity/datacollection/dto/AddUpDeductionRecordDTO.java index cc3ae1e3f..ff75cb973 100644 --- a/src/com/engine/salary/entity/datacollection/dto/AddUpDeductionRecordDTO.java +++ b/src/com/engine/salary/entity/datacollection/dto/AddUpDeductionRecordDTO.java @@ -43,6 +43,11 @@ public class AddUpDeductionRecordDTO { @ExcelProperty(index = 2) private String taxAgentName; + /** + * 个税扣缴义务人id + */ + private Long taxAgentId; + //部门 @SalaryTableColumn(text = "部门", width = "10%", column = "departmentName") diff --git a/src/com/engine/salary/mapper/datacollection/AddUpDeductionMapper.xml b/src/com/engine/salary/mapper/datacollection/AddUpDeductionMapper.xml index 34b0855b1..b32b0ec09 100644 --- a/src/com/engine/salary/mapper/datacollection/AddUpDeductionMapper.xml +++ b/src/com/engine/salary/mapper/datacollection/AddUpDeductionMapper.xml @@ -85,8 +85,8 @@ e.mobile, e.workcode as job_num, e.companystartdate as hiredate, - t2.name AS tax_agent_name, - t2.id AS tax_agent_name, + t2.name AS taxAgentName, + t2.id AS taxAgentId, t1.add_up_child_education, t1.add_up_continuing_education, t1.add_up_housing_loan_interest, diff --git a/src/com/engine/salary/service/impl/AddUpDeductionServiceImpl.java b/src/com/engine/salary/service/impl/AddUpDeductionServiceImpl.java index c61f5dd5c..c462f8e88 100644 --- a/src/com/engine/salary/service/impl/AddUpDeductionServiceImpl.java +++ b/src/com/engine/salary/service/impl/AddUpDeductionServiceImpl.java @@ -7,6 +7,7 @@ import com.engine.salary.cmd.datacollection.*; import com.engine.salary.entity.datacollection.AddUpDeduction; import com.engine.salary.entity.datacollection.DataCollectionEmployee; import com.engine.salary.entity.datacollection.dto.AddUpDeductionDTO; +import com.engine.salary.entity.datacollection.dto.AddUpDeductionRecordDTO; import com.engine.salary.entity.datacollection.param.AddUpDeductionQueryParam; import com.engine.salary.entity.taxagent.bo.TaxAgentBO; import com.engine.salary.entity.taxagent.dto.TaxAgentEmployeeDTO; @@ -20,13 +21,17 @@ import com.engine.salary.util.db.MapperProxyFactory; import com.engine.salary.util.excel.ExcelComment; import com.engine.salary.util.excel.ExcelUtil; import com.engine.salary.util.page.PageInfo; -import com.engine.salary.util.page.PageUtil; +import com.engine.salary.util.page.SalaryPageUtil; import com.google.common.collect.Lists; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.apache.poi.xssf.usermodel.XSSFWorkbook; import weaver.general.Util; +import javax.annotation.Resource; +import java.text.SimpleDateFormat; +import java.time.LocalDate; +import java.time.LocalDateTime; import java.time.YearMonth; import java.util.*; import java.util.stream.Collectors; @@ -50,6 +55,9 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction @Override public XSSFWorkbook export(Map params) { + + Boolean chief = taxAgentService.isChief((long) user.getUID()); + AddUpDeductionQueryParam addUpDeductionQueryParam = (AddUpDeductionQueryParam) params.get("addUpDeductionQueryParam"); AddUpDeductionBiz addUpDeductionBiz = new AddUpDeductionBiz(); @@ -221,11 +229,10 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction @Override public PageInfo listPage(AddUpDeductionQueryParam queryParam, Long employeeId) { - PageInfo dtoPage = PageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize()); // 未开启分权或是薪酬模块总管理员 if (!taxAgentService.isOpenDevolution() || taxAgentService.isChief(employeeId)) { - PageUtil.start(queryParam.getCurrent(), queryParam.getPageSize()); + SalaryPageUtil.start(queryParam.getCurrent(), queryParam.getPageSize()); List list = getAddUpDeductionMapper().list(queryParam); return new PageInfo<>(list, AddUpDeductionDTO.class); } else { @@ -243,51 +250,262 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction ).collect(Collectors.toList()); // 填充总数和当页数据 // 分页参数 + PageInfo dtoPage = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), AddUpDeductionDTO.class); dtoPage.setTotal(list.size()); - dtoPage.setRecords(SalaryPageUtil.subList((int) dtoPage.getCurrent(), (int) dtoPage.getSize(), list)); - page = dtoPage; + dtoPage.setList(SalaryPageUtil.subList(dtoPage.getPageNum(), dtoPage.getSize(), list)); + return dtoPage; } - return page; } @Override - public Page recordListPage(Page page, AddUpDeductionQueryParam queryParam, Long employeeId, String tenantKey) { + public PageInfo recordListPage(AddUpDeductionQueryParam queryParam, Long employeeId) { // 未开启分权或是薪酬模块总管理员 - if (!taxAgentService.isOpenDevolution(tenantKey) || taxAgentService.isChief(employeeId, tenantKey)) { - getAddUpDeductionMapper().recordList(page, queryParam, tenantKey); + if (!taxAgentService.isOpenDevolution() || taxAgentService.isChief(employeeId)) { + SalaryPageUtil.start(queryParam.getCurrent(), queryParam.getPageSize()); + List list = getAddUpDeductionMapper().recordList(queryParam); + return new PageInfo<>(list, AddUpDeductionRecordDTO.class); } else { - List taxAgentEmployees = taxAgentService.listTaxAgentAndEmployee(employeeId, tenantKey); + List taxAgentEmployees = taxAgentService.listTaxAgentAndEmployee(employeeId); + List taxAgentIdsAsAdmin = taxAgentService.listAllTaxAgentsAsAdmin(employeeId).stream().map(TaxAgentPO::getId).collect(Collectors.toList()); +// List lastList = getLastListByModifier(employeeId, tenantKey); + List list = getAddUpDeductionMapper().recordList(queryParam); + list = list.stream().filter(f -> + // 作为管理员 + taxAgentIdsAsAdmin.contains(f.getTaxAgentId()) + // 作为分管理员 + || TaxAgentBO.checkTaxAgentAndEmployee(taxAgentEmployees, f.getTaxAgentId(), f.getEmployeeId()) + // 自己最后修改过的,则可以看到最新和其历史 +// || lastList.stream().anyMatch(l -> l.getEmployeeId().equals(f.getEmployeeId()) && l.getTaxAgentId().equals(f.getTaxAgentId()) && !l.getDeclareMonth().isBefore(f.getDeclareMonth())) + ).collect(Collectors.toList()); + // 分页参数 + // 填充总数和当页数据 + PageInfo dtoPage = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), AddUpDeductionRecordDTO.class); + dtoPage.setTotal(list.size()); + dtoPage.setList(SalaryPageUtil.subList(dtoPage.getPageNum(), dtoPage.getSize(), list)); + return dtoPage; + } + } + + + @Override + public void export(Map map, String username, String eteamsId, boolean isChief, AddUpDeductionQueryParam queryParam, Long employeeId, String tenantKey) { + List sheetList = new ArrayList<>(); + + ExcelSheetData excelSheetData = new ExcelSheetData(); + + String nameI18n = SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 85380, "累计专项附加扣除"); + // 1.工作簿名称 + excelSheetData.setSheetName(nameI18n); + String[] header = { + SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 85429, "姓名"), + SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 86184, "个税扣缴义务人"), + SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 86185, "部门"), + SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 86186, "手机号"), + SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 86317, "工号"), + SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 86318, "证件号码"), + SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 86319, "入职日期"), + SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 86321, "累计子女教育"), + SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 86323, "累计继续教育"), + SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 86324, "累计住房贷款利息"), + SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 86325, "累计住房租金"), + SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 86326, "累计赡养老人"), + SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 105142, "累计大病医疗"), + SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 117732, "累计婴幼儿照护") + }; + // 2.表头 + excelSheetData.setHeaders(Collections.singletonList(header)); + queryParam.setDeclareMonthDate(CollectionUtils.emptyIfNull(queryParam.getDeclareMonth()).stream().map(e-> LocalDate.of(e.getYear(),e.getMonthValue(),1)).collect(Collectors.toList())); + // 获取累计专项附加扣除 + List list = addUpDeductionMapper.list(queryParam, tenantKey); + + // 开启分权并且不是薪酬模块总管理员 + if (taxAgentService.isOpenDevolution(tenantKey) && !isChief) { + List taxAgentEmployees = taxAgentService.listTaxAgentAndEmployee(employeeId, tenantKey); List taxAgentIdsAsAdmin = taxAgentService.listAllTaxAgentsAsAdmin(employeeId, tenantKey).stream().map(TaxAgentPO::getId).collect(Collectors.toList()); List lastList = getLastListByModifier(employeeId, tenantKey); - List list = getAddUpDeductionMapper().recordList(queryParam, tenantKey); - // 分页参数 - Page dtoPage = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize()); list = list.stream().filter(f -> // 作为管理员 taxAgentIdsAsAdmin.contains(f.getTaxAgentId()) // 作为分管理员 || TaxAgentBO.checkTaxAgentAndEmployee(taxAgentEmployees, f.getTaxAgentId(), f.getEmployeeId()) // 自己最后修改过的,则可以看到最新和其历史 - || lastList.stream().anyMatch(l -> l.getEmployeeId().equals(f.getEmployeeId()) && l.getTaxAgentId().equals(f.getTaxAgentId()) && !l.getDeclareMonth().isBefore(f.getDeclareMonth())) + || lastList.stream().anyMatch(l->l.getEmployeeId().equals(f.getEmployeeId()) && l.getTaxAgentId().equals(f.getTaxAgentId()) && !l.getDeclareMonth().isBefore(f.getDeclareMonth())) ).collect(Collectors.toList()); - // 填充总数和当页数据 - dtoPage.setTotal(list.size()); - dtoPage.setRecords(SalaryPageUtil.subList((int) dtoPage.getCurrent(), (int) dtoPage.getSize(), list)); - page = dtoPage; } - return page; + List simpleUserInfos = salaryEmployeeService.listByEmployeeIds(list.stream().map(AddUpDeductionListDTO::getEmployeeId).collect(Collectors.toList()), tenantKey); + List> rows = new ArrayList<>(); + for (AddUpDeductionListDTO dto : list) { + List row = new ArrayList<>(); + row.add(dto.getUsername()); + row.add(dto.getTaxAgentName()); + row.add(dto.getDepartmentName()); + row.add(dto.getMobile()); + row.add(dto.getJobNum()); + row.add(DataCollectionBO.getIdNo(dto.getEmployeeId(), simpleUserInfos)); + row.add(dto.getHiredate()+""); + row.add(dto.getAddUpChildEducation()); + row.add(dto.getAddUpContinuingEducation()); + row.add(dto.getAddUpHousingLoanInterest()); + row.add(dto.getAddUpHousingRent()); + row.add(dto.getAddUpSupportElderly()); + row.add(dto.getAddUpIllnessMedical()); + row.add(dto.getAddUpInfantCare()); + rows.add(row); + } + // 3.表数据 + excelSheetData.setRows(rows); + + sheetList.add(excelSheetData); + + salaryBatchService.simpleExportExcel(ExportExcelInfo.builder() + .bizId(map.get("biz").toString()) + .flag(true) + .userId(employeeId) + .eteamsId(eteamsId) + .tenantKey(tenantKey) + .operator(username) + .module(map.get("module").toString()) + .fileName(nameI18n + SalaryDateUtil.getFormatLocalDateTime(LocalDateTime.now())) + .handlerName(map.get("function").toString()) + .dataType(nameI18n) + .function(map.get("function").toString()).build(), sheetList); } @Override - public List getAddUpDeductionList(YearMonth declareMonth, List employeeIds, String tenantKey) { - if (declareMonth == null || StringUtils.isEmpty(tenantKey)) { - throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(tenantKey, UserContext.getCurrentEmployeeId(), 100342, "参数有误:申报月份、租户key必传")); + public void downloadTemplate(Map map, String username, String eteamsId, boolean isChief, AddUpDeductionQueryParam queryParam, Long employeeId, String tenantKey) { + List sheetList = new ArrayList<>(); + + ExcelSheetData excelSheetData = new ExcelSheetData(); + + String nameI18n = SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 101603, "累计专项附加扣除导入模板"); + // 1.工作簿名称 + excelSheetData.setSheetName(nameI18n); + String[] header = { + SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 85429, "姓名"), + SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 86184, "个税扣缴义务人"), + SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 86185, "部门"), + SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 86186, "手机号"), + SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 86317, "工号"), + SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 86318, "证件号码"), + SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 86319, "入职日期"), + SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 86321, "累计子女教育"), + SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 86323, "累计继续教育"), + SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 86324, "累计住房贷款利息"), + SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 86325, "累计住房租金"), + SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 86326, "累计赡养老人"), + SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 105142, "累计大病医疗"), + SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 117732, "累计婴幼儿照护") + }; + // 2.表头 + excelSheetData.setHeaders(Collections.singletonList(header)); + queryParam.setDeclareMonthDate(CollectionUtils.emptyIfNull(queryParam.getDeclareMonth()).stream().map(e-> LocalDate.of(e.getYear(),e.getMonthValue(),1)).collect(Collectors.toList())); + // 获取累计专项附加扣除 + List list = addUpDeductionMapper.list(queryParam, tenantKey); + List simpleUserInfos = salaryEmployeeService.listByEmployeeIds(list.stream().map(AddUpDeductionListDTO::getEmployeeId).collect(Collectors.toList()), tenantKey); + List> rows = new ArrayList<>(); + for (AddUpDeductionListDTO dto : list) { + List row = new ArrayList<>(); + row.add(dto.getUsername()); + row.add(dto.getTaxAgentName()); + row.add(dto.getDepartmentName()); + row.add(dto.getMobile()); + row.add(dto.getJobNum()); + row.add(DataCollectionBO.getIdNo(dto.getEmployeeId(), simpleUserInfos)); + row.add(dto.getHiredate()+""); + row.add(dto.getAddUpChildEducation()); + row.add(dto.getAddUpContinuingEducation()); + row.add(dto.getAddUpHousingLoanInterest()); + row.add(dto.getAddUpHousingRent()); + row.add(dto.getAddUpSupportElderly()); + row.add(dto.getAddUpIllnessMedical()); + row.add(dto.getAddUpInfantCare()); + rows.add(row); } - return new LambdaQueryChainWrapper<>(getAddUpDeductionMapper()) - .eq(AddUpDeductionPO::getDeleteType, 0) - .eq(AddUpDeductionPO::getTenantKey, tenantKey) - .eq(AddUpDeductionPO::getDeclareMonth, declareMonth.atDay(1)) - .in(CollectionUtils.isNotEmpty(employeeIds), AddUpDeductionPO::getEmployeeId, employeeIds).list(); + // 3.表数据 + excelSheetData.setRows(rows); + // 4.注释 + List excelComments = Lists.newArrayList(); + salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 100344, "必填"), 0, 0, 0, 0); + salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 100344, "必填"), 0, 0, 1, 1); + salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 100343, "输入数字"), 0, 0, 7, 7); + salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 100343, "输入数字"), 0, 0, 8, 8); + salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 100343, "输入数字"), 0, 0, 9, 9); + salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 100343, "输入数字"), 0, 0, 10, 10); + salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 100343, "输入数字"), 0, 0, 11, 11); + salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 100343, "输入数字"), 0, 0, 12, 12); + salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 100343, "输入数字"), 0, 0, 13, 13); + excelSheetData.setExcelComment(excelComments); + + sheetList.add(excelSheetData); + + salaryBatchService.simpleExportExcel(ExportExcelInfo.builder() + .bizId(map.get("biz").toString()) + .flag(true) + .userId(employeeId) + .eteamsId(eteamsId) + .tenantKey(tenantKey) + .operator(username) + .module(map.get("module").toString()) + .fileName(nameI18n + SalaryDateUtil.getFormatLocalDateTime(LocalDateTime.now())) + .handlerName(map.get("function").toString()) + .dataType(nameI18n) + .function(map.get("function").toString()).build(), sheetList); + } + + + /** + * 导出 + * + * @param param + * @return + */ + private XSSFWorkbook export(AddUpDeductionQueryParam param) { + + //获取操作按钮资源 + List> rowList = getExcelRowList(param); + + //获取excel + return ExcelUtil.genWorkbook(rowList, "累计专项附加扣除"); + } + + + /** + * 获取excel数据行 + * + * @return 导出数据行集合 + */ + private List> getExcelRowList(AddUpDeductionQueryParam param) { + //excel标题 + List title = Arrays.asList("姓名", "个税扣缴义务人", "部门", "手机号", "工号", "证件号码", "入职日期", "累计子女教育", "累计继续教育", "累计住房贷款利息", "累计住房租金", "累计赡养老人", "累计大病医疗", "累计婴幼儿照护"); + + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); + List list = list(param); + final List> dataRowList = Optional.ofNullable(list) + .map(List::stream) + .map(operatorStream -> operatorStream.map(dto -> { + List cellList = new ArrayList<>(); + cellList.add(Util.null2String(dto.getUsername())); + cellList.add(Util.null2String(dto.getTaxAgentName())); + cellList.add(Util.null2String(dto.getDepartmentName())); + cellList.add(Util.null2String(dto.getMobile())); + cellList.add(Util.null2String(dto.getJobNum())); + cellList.add(Util.null2String(dto.getIdNo())); + cellList.add(Util.null2String(dto.getHiredate())); + cellList.add(Util.null2String(dto.getAddUpChildEducation())); + cellList.add(Util.null2String(dto.getAddUpContinuingEducation())); + cellList.add(Util.null2String(dto.getAddUpHousingLoanInterest())); + cellList.add(Util.null2String(dto.getAddUpHousingRent())); + cellList.add(Util.null2String(dto.getAddUpSupportElderly())); + cellList.add(Util.null2String(dto.getAddUpIllnessMedical())); + cellList.add(Util.null2String(dto.getAddUpInfantCare())); + return cellList; + }).collect(Collectors.toList())) + .orElse(Collections.emptyList()); + + List> rowList = new ArrayList<>(); + rowList.add(title); + rowList.addAll(dataRowList); + return rowList; } diff --git a/src/com/engine/salary/service/impl/AttendQuoteDataServiceImpl.java b/src/com/engine/salary/service/impl/AttendQuoteDataServiceImpl.java index 283b81a2c..01f33b46f 100644 --- a/src/com/engine/salary/service/impl/AttendQuoteDataServiceImpl.java +++ b/src/com/engine/salary/service/impl/AttendQuoteDataServiceImpl.java @@ -38,7 +38,7 @@ import com.engine.salary.util.excel.ExcelParseHelper; import com.engine.salary.util.excel.ExcelSupport; import com.engine.salary.util.excel.ExcelUtil; import com.engine.salary.util.page.PageInfo; -import com.engine.salary.util.page.PageUtil; +import com.engine.salary.util.page.SalaryPageUtil; import com.engine.salary.util.valid.ValidUtil; import com.google.common.base.Joiner; import com.google.common.collect.Lists; @@ -113,7 +113,7 @@ public class AttendQuoteDataServiceImpl extends Service implements AttendQuoteDa @Override public PageInfo listPage(AttendQuoteDataQueryParam queryParam) { - PageUtil.start(queryParam.getCurrent(), queryParam.getPageSize()); + SalaryPageUtil.start(queryParam.getCurrent(), queryParam.getPageSize()); List list = getAttendQuoteDataMapper().list(queryParam); PageInfo page = new PageInfo(list); return page; diff --git a/src/com/engine/salary/service/impl/AttendQuoteFieldServiceImpl.java b/src/com/engine/salary/service/impl/AttendQuoteFieldServiceImpl.java index fcb24d0e4..719d6cafb 100644 --- a/src/com/engine/salary/service/impl/AttendQuoteFieldServiceImpl.java +++ b/src/com/engine/salary/service/impl/AttendQuoteFieldServiceImpl.java @@ -18,7 +18,7 @@ import com.engine.salary.remote.attend.service.impl.RemoteAttend4SalaryServiceIm import com.engine.salary.service.AttendQuoteFieldService; import com.engine.salary.util.db.MapperProxyFactory; import com.engine.salary.util.page.PageInfo; -import com.engine.salary.util.page.PageUtil; +import com.engine.salary.util.page.SalaryPageUtil; import com.google.common.collect.Lists; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; @@ -65,7 +65,7 @@ public class AttendQuoteFieldServiceImpl extends Service implements AttendQuoteF @Override public PageInfo listPage(AttendQuoteFieldQueryParam queryParam) { - PageUtil.start(queryParam.getCurrent(), queryParam.getPageSize()); + SalaryPageUtil.start(queryParam.getCurrent(), queryParam.getPageSize()); List list = getAttendQuoteFieldMapper().list(queryParam); return new PageInfo<>(list); } diff --git a/src/com/engine/salary/service/impl/AttendQuoteServiceImpl.java b/src/com/engine/salary/service/impl/AttendQuoteServiceImpl.java index c15cc325f..345101dc5 100644 --- a/src/com/engine/salary/service/impl/AttendQuoteServiceImpl.java +++ b/src/com/engine/salary/service/impl/AttendQuoteServiceImpl.java @@ -19,7 +19,7 @@ import com.engine.salary.service.SalaryAcctRecordService; import com.engine.salary.util.SalaryDateUtil; import com.engine.salary.util.db.MapperProxyFactory; import com.engine.salary.util.page.PageInfo; -import com.engine.salary.util.page.PageUtil; +import com.engine.salary.util.page.SalaryPageUtil; import org.apache.commons.collections4.CollectionUtils; import weaver.hrm.User; @@ -53,7 +53,7 @@ public class AttendQuoteServiceImpl extends Service implements AttendQuoteServic @Override public PageInfo listPage(AttendQuoteQueryParam queryParam) { - PageUtil.start(queryParam.getCurrent(), queryParam.getPageSize()); + SalaryPageUtil.start(queryParam.getCurrent(), queryParam.getPageSize()); List list = getAttendQuoteMapper().list(queryParam); return new PageInfo<>(list, AttendQuoteListDTO.class); } diff --git a/src/com/engine/salary/service/impl/SIAccountServiceImpl.java b/src/com/engine/salary/service/impl/SIAccountServiceImpl.java index 38fafbfbd..917846326 100644 --- a/src/com/engine/salary/service/impl/SIAccountServiceImpl.java +++ b/src/com/engine/salary/service/impl/SIAccountServiceImpl.java @@ -27,13 +27,11 @@ import com.engine.salary.enums.siaccount.BillStatusEnum; import com.engine.salary.enums.siaccount.InspectStatusEnum; import com.engine.salary.enums.siaccount.PaymentStatusEnum; import com.engine.salary.enums.siaccount.ProjectTypeEnum; -import com.engine.salary.enums.sicategory.DeleteTypeEnum; import com.engine.salary.enums.sicategory.WelfareTypeEnum; import com.engine.salary.mapper.siaccount.InsuranceAccountBatchMapper; import com.engine.salary.mapper.siaccount.InsuranceAccountDetailMapper; import com.engine.salary.mapper.siaccount.InsuranceAccountInspectMapper; import com.engine.salary.mapper.sicategory.ICategoryMapper; -import com.engine.salary.mapper.sischeme.InsuranceSchemeMapper; import com.engine.salary.service.ColumnBuildService; import com.engine.salary.service.RecordsBuildService; import com.engine.salary.service.SIAccountService; @@ -49,7 +47,7 @@ import com.engine.salary.util.SalaryI18nUtil; import com.engine.salary.util.db.MapperProxyFactory; import com.engine.salary.util.page.Column; import com.engine.salary.util.page.PageInfo; -import com.engine.salary.util.page.PageUtil; +import com.engine.salary.util.page.SalaryPageUtil; import com.engine.salary.util.valid.ValidUtil; import com.google.common.collect.Lists; import org.apache.commons.collections4.CollectionUtils; @@ -206,7 +204,7 @@ public class SIAccountServiceImpl extends Service implements SIAccountService { //补缴缴纳列表 queryParam.setPaymentStatus(PaymentStatusEnum.REPAIR.getValue()); - PageUtil.start(queryParam.getCurrent(), queryParam.getPageSize()); + SalaryPageUtil.start(queryParam.getCurrent(), queryParam.getPageSize()); List list = MapperProxyFactory.getProxy(InsuranceAccountDetailMapper.class).list(queryParam); PageInfo pageInfo = new PageInfo<>(list,InsuranceAccountDetailPO.class); List insuranceAccountDetailPOS = pageInfo.getList(); @@ -414,7 +412,7 @@ public class SIAccountServiceImpl extends Service implements SIAccountService { public Map changeList(InsuranceAccountDetailParam param) { Map datas = new HashMap<>(); Long employeeId = (long)user.getUID(); - PageUtil.start(param.getCurrent(),param.getPageSize()); + SalaryPageUtil.start(param.getCurrent(),param.getPageSize()); List insuranceArchivesEmployeePOS = MapperProxyFactory.getProxy(InsuranceAccountDetailMapper.class).changeList(param.getUserName()); PageInfo pageInfo = new PageInfo<>(insuranceArchivesEmployeePOS); @@ -476,7 +474,7 @@ public class SIAccountServiceImpl extends Service implements SIAccountService { public Map getInspectTable(InsuranceAccountDetailParam param) { Map datas = new HashMap<>(); - PageUtil.start(param.getCurrent(),param.getPageSize()); + SalaryPageUtil.start(param.getCurrent(),param.getPageSize()); List insuranceAccountInspectPOS = MapperProxyFactory.getProxy(InsuranceAccountInspectMapper.class).getByBillMonth(param.getBillMonth()); List> records = getService(user).buildInspectRecords(insuranceAccountInspectPOS); diff --git a/src/com/engine/salary/service/impl/SIReportServiceImpl.java b/src/com/engine/salary/service/impl/SIReportServiceImpl.java index de3fe5b39..c4749535c 100644 --- a/src/com/engine/salary/service/impl/SIReportServiceImpl.java +++ b/src/com/engine/salary/service/impl/SIReportServiceImpl.java @@ -7,7 +7,7 @@ import com.engine.salary.mapper.siaccount.SIAccountDetailMapper; import com.engine.salary.service.SIReportService; import com.engine.salary.util.db.MapperProxyFactory; import com.engine.salary.util.page.PageInfo; -import com.engine.salary.util.page.PageUtil; +import com.engine.salary.util.page.SalaryPageUtil; import java.util.List; @@ -20,7 +20,7 @@ public class SIReportServiceImpl extends Service implements SIReportService { @Override public PageInfo welfareList(QueryAccountDetailParam param) { - PageUtil.start(param.getCurrent(),param.getPageSize()); + SalaryPageUtil.start(param.getCurrent(),param.getPageSize()); List insuranceAccountDetailPOS = getSIAccountDetailMapper().listSome(param); PageInfo page = new PageInfo<>(insuranceAccountDetailPOS ,InsuranceAccountDetailPO.class); return page; diff --git a/src/com/engine/salary/service/impl/SISchemeServiceImpl.java b/src/com/engine/salary/service/impl/SISchemeServiceImpl.java index 2ef403831..94f5d43c2 100644 --- a/src/com/engine/salary/service/impl/SISchemeServiceImpl.java +++ b/src/com/engine/salary/service/impl/SISchemeServiceImpl.java @@ -1,6 +1,5 @@ package com.engine.salary.service.impl; -import cn.hutool.core.util.BooleanUtil; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.TypeReference; import com.cloudstore.eccom.pc.table.WeaTableColumn; @@ -9,18 +8,7 @@ import com.engine.core.impl.Service; import com.engine.salary.biz.EmployBiz; import com.engine.salary.biz.SISchemeBiz; import com.engine.salary.cmd.sischeme.*; -import com.engine.salary.constant.SalaryDefaultTenantConstant; import com.engine.salary.entity.datacollection.DataCollectionEmployee; -import com.engine.salary.entity.datacollection.param.AttendQuoteDataImportParam; -import com.engine.salary.entity.datacollection.po.AttendQuoteDataPO; -import com.engine.salary.entity.datacollection.po.AttendQuoteDataValuePO; -import com.engine.salary.entity.datacollection.po.AttendQuoteFieldPO; -import com.engine.salary.entity.datacollection.po.AttendQuotePO; -import com.engine.salary.entity.salaryacct.dto.SalaryAcctRecordListDTO; -import com.engine.salary.entity.salaryacct.po.SalaryAcctRecordPO; -import com.engine.salary.entity.salaryarchive.dto.TaxAgentListDTO; -import com.engine.salary.entity.salarysob.po.SalarySobPO; -import com.engine.salary.entity.siaccount.param.DSTenantKeyThreadVar; import com.engine.salary.entity.siarchives.param.InsuranceArchivesListParam; import com.engine.salary.entity.siarchives.po.*; import com.engine.salary.entity.sicategory.po.ICategoryPO; @@ -30,9 +18,7 @@ import com.engine.salary.entity.sischeme.param.SISchemaImportParam; import com.engine.salary.entity.sischeme.po.InsuranceSchemeDetailPO; import com.engine.salary.entity.sischeme.po.InsuranceSchemePO; import com.engine.salary.entity.taxrate.TaxAgent; -import com.engine.salary.enums.datacollection.AttendQuoteSourceTypeEnum; import com.engine.salary.enums.sicategory.*; -import com.engine.salary.exception.SalaryRunTimeException; import com.engine.salary.mapper.siarchives.FundSchemeMapper; import com.engine.salary.mapper.siarchives.OtherSchemeMapper; import com.engine.salary.mapper.siarchives.SocialSchemeMapper; @@ -44,15 +30,13 @@ import com.engine.salary.service.SISchemeService; import com.engine.salary.service.TaxAgentService; import com.engine.salary.util.*; import com.engine.salary.util.db.MapperProxyFactory; -import com.engine.salary.util.excel.ExcelComment; import com.engine.salary.util.excel.ExcelParseHelper; import com.engine.salary.util.excel.ExcelSupport; import com.engine.salary.util.excel.ExcelUtil; import com.engine.salary.util.page.PageInfo; -import com.engine.salary.util.page.PageUtil; +import com.engine.salary.util.page.SalaryPageUtil; import com.engine.salary.util.valid.ValidUtil; import com.google.common.collect.Maps; -import com.kingbase8.util.LOGGER; import dm.jdbc.util.IdGenerator; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; @@ -60,10 +44,8 @@ import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.util.IOUtils; import org.apache.poi.xssf.usermodel.XSSFWorkbook; import weaver.file.ImageFileManager; -import weaver.hrm.User; import java.io.InputStream; -import java.time.LocalDateTime; import java.util.*; import java.util.function.Function; import java.util.stream.Collectors; @@ -165,7 +147,7 @@ public class SISchemeServiceImpl extends Service implements SISchemeService { public PageInfo list(InsuranceSchemeParam queryParam) { SalaryAssert.notNull(queryParam.getWelfareTypeEnum(), SalaryI18nUtil.getI18nLabel( 84026, "参数错误")); - PageUtil.start(queryParam.getCurrent(), queryParam.getPageSize()); + SalaryPageUtil.start(queryParam.getCurrent(), queryParam.getPageSize()); List insuranceSchemePOS = MapperProxyFactory.getProxy(InsuranceSchemeMapper.class).listByWelfareType(queryParam.getWelfareTypeEnum().getValue()); PageInfo pageInfo = new PageInfo<>(insuranceSchemePOS, InsuranceSchemePO.class); List collect = insuranceSchemePOS.stream().map(item -> diff --git a/src/com/engine/salary/service/impl/SalaryAcctEmployeeServiceImpl.java b/src/com/engine/salary/service/impl/SalaryAcctEmployeeServiceImpl.java index 580cdad3e..c78bac48c 100644 --- a/src/com/engine/salary/service/impl/SalaryAcctEmployeeServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalaryAcctEmployeeServiceImpl.java @@ -21,7 +21,7 @@ import com.engine.salary.util.SalaryEntityUtil; import com.engine.salary.util.SalaryI18nUtil; import com.engine.salary.util.db.MapperProxyFactory; import com.engine.salary.util.page.PageInfo; -import com.engine.salary.util.page.PageUtil; +import com.engine.salary.util.page.SalaryPageUtil; import com.engine.salary.util.valid.ValidUtil; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; @@ -178,7 +178,7 @@ public class SalaryAcctEmployeeServiceImpl extends Service implements SalaryAcct public PageInfo listPageByParam(SalaryAcctEmployeeQueryParam queryParam) { ValidUtil.doValidator(queryParam); // 分页参数 - PageUtil.start(queryParam.getCurrent(), queryParam.getPageSize()); + SalaryPageUtil.start(queryParam.getCurrent(), queryParam.getPageSize()); // 查询薪资核算人员 List salaryAcctEmployeePOS = getSalaryAcctEmployeeMapper().listPage(queryParam); return new PageInfo<>(salaryAcctEmployeePOS); @@ -231,7 +231,7 @@ public class SalaryAcctEmployeeServiceImpl extends Service implements SalaryAcct Set lastMonthSalaryAcctRecordIds = SalaryEntityUtil.properties(salaryAcctRecordPOS, SalaryAcctRecordPO::getId); // 查询环比减少人员 // 分页参数 - PageUtil.start(queryParam.getCurrent(), queryParam.getPageSize()); + SalaryPageUtil.start(queryParam.getCurrent(), queryParam.getPageSize()); List salaryAcctEmployeePOS = getSalaryAcctEmployeeMapper().listPage4Reduce(lastMonthSalaryAcctRecordIds, queryParam); PageInfo salaryAcctEmployeePOPageInfo = new PageInfo<>(salaryAcctEmployeePOS); return salaryAcctEmployeePOPageInfo; @@ -260,7 +260,7 @@ public class SalaryAcctEmployeeServiceImpl extends Service implements SalaryAcct // 查询合并计税的薪资核算人员 Set otherSalaryAcctRecordIds = SalaryEntityUtil.properties(otherSalaryAcctRecordPOS, SalaryAcctRecordPO::getId); // 分页参数 - PageUtil.start(queryParam.getCurrent(), queryParam.getPageSize()); + SalaryPageUtil.start(queryParam.getCurrent(), queryParam.getPageSize()); List salaryAcctEmployeePOS = getSalaryAcctEmployeeMapper().listPage4ConsolidatedTax(otherSalaryAcctRecordIds, queryParam); PageInfo salaryAcctEmployeePOPageInfo = new PageInfo<>(salaryAcctEmployeePOS); return salaryAcctEmployeePOPageInfo; diff --git a/src/com/engine/salary/service/impl/SalaryAcctRecordServiceImpl.java b/src/com/engine/salary/service/impl/SalaryAcctRecordServiceImpl.java index 78f0f1649..362b5b283 100644 --- a/src/com/engine/salary/service/impl/SalaryAcctRecordServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalaryAcctRecordServiceImpl.java @@ -21,7 +21,7 @@ import com.engine.salary.util.SalaryEntityUtil; import com.engine.salary.util.SalaryI18nUtil; import com.engine.salary.util.db.MapperProxyFactory; import com.engine.salary.util.page.PageInfo; -import com.engine.salary.util.page.PageUtil; +import com.engine.salary.util.page.SalaryPageUtil; import com.engine.salary.util.valid.ValidUtil; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; @@ -140,7 +140,7 @@ public class SalaryAcctRecordServiceImpl extends Service implements SalaryAcctRe po.setSalaryMonths(localDateRange); // 查询薪资核算记录 - PageUtil.start(queryParam.getCurrent(), queryParam.getPageSize()); + SalaryPageUtil.start(queryParam.getCurrent(), queryParam.getPageSize()); List salaryAcctRecordPOS = getSalaryAcctRecordMapper().listSome(po); page.setList(salaryAcctRecordPOS); return page; diff --git a/src/com/engine/salary/service/impl/SalaryArchiveTaxAgentServiceImpl.java b/src/com/engine/salary/service/impl/SalaryArchiveTaxAgentServiceImpl.java index ed205f6c9..ee8b7dc3a 100644 --- a/src/com/engine/salary/service/impl/SalaryArchiveTaxAgentServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalaryArchiveTaxAgentServiceImpl.java @@ -20,7 +20,7 @@ import com.engine.salary.util.SalaryI18nUtil; import com.engine.salary.util.db.MapperProxyFactory; import com.engine.salary.util.excel.ExcelUtil; import com.engine.salary.util.page.PageInfo; -import com.engine.salary.util.page.PageUtil; +import com.engine.salary.util.page.SalaryPageUtil; import com.google.common.collect.Lists; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; @@ -56,7 +56,7 @@ public class SalaryArchiveTaxAgentServiceImpl extends Service implements SalaryA @Override public PageInfo taxAgentAdjustRecordListPage(TaxAgentAdjustRecordQueryParam queryParam) { - PageUtil.start(queryParam.getCurrent(), queryParam.getPageSize()); + SalaryPageUtil.start(queryParam.getCurrent(), queryParam.getPageSize()); List taxAgentAdjustRecordListDTOS = getSalaryArchiveTaxAgentMapper().taxAgentAdjustRecordList(queryParam); PageInfo pageInfo = new PageInfo(taxAgentAdjustRecordListDTOS, TaxAgentAdjustRecordListDTO.class); return pageInfo; diff --git a/src/com/engine/salary/service/impl/SalaryComparisonResultServiceImpl.java b/src/com/engine/salary/service/impl/SalaryComparisonResultServiceImpl.java index 6b4eeb63c..e020d92a9 100644 --- a/src/com/engine/salary/service/impl/SalaryComparisonResultServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalaryComparisonResultServiceImpl.java @@ -29,7 +29,7 @@ import com.engine.salary.util.SalaryEntityUtil; import com.engine.salary.util.SalaryI18nUtil; import com.engine.salary.util.db.MapperProxyFactory; import com.engine.salary.util.page.PageInfo; -import com.engine.salary.util.page.PageUtil; +import com.engine.salary.util.page.SalaryPageUtil; import com.google.common.collect.Sets; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.BooleanUtils; @@ -220,7 +220,7 @@ public class SalaryComparisonResultServiceImpl extends Service implements Salary PageInfo> dtoPage = new PageInfo<>(); dtoPage.setTotal(resultMapList.size()); if (needPage) { - dtoPage.setList(PageUtil.subList(queryParam.getCurrent(), queryParam.getPageSize(), resultMapList)); + dtoPage.setList(SalaryPageUtil.subList(queryParam.getCurrent(), queryParam.getPageSize(), resultMapList)); } else { dtoPage.setList(resultMapList); } diff --git a/src/com/engine/salary/service/impl/SalarySobRangeServiceImpl.java b/src/com/engine/salary/service/impl/SalarySobRangeServiceImpl.java index 191ca0391..9257c5eb7 100644 --- a/src/com/engine/salary/service/impl/SalarySobRangeServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalarySobRangeServiceImpl.java @@ -22,7 +22,7 @@ import com.engine.salary.service.SalarySobService; 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.PageUtil; +import com.engine.salary.util.page.SalaryPageUtil; import com.engine.salary.util.valid.ValidUtil; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; @@ -108,7 +108,7 @@ public class SalarySobRangeServiceImpl extends Service implements SalarySobRange // 填充总数和当页数据 PageInfo pageInfo = new PageInfo(salarySobRangeListDTOS,SalarySobRangeListDTO.class); pageInfo.setTotal(salarySobRangeListDTOS.size()); - pageInfo.setList(PageUtil.subList(queryParam.getCurrent(), queryParam.getPageSize(), salarySobRangeListDTOS)); + pageInfo.setList(SalaryPageUtil.subList(queryParam.getCurrent(), queryParam.getPageSize(), salarySobRangeListDTOS)); return pageInfo; } diff --git a/src/com/engine/salary/service/impl/TaxAgentManageRangeServiceImpl.java b/src/com/engine/salary/service/impl/TaxAgentManageRangeServiceImpl.java index 021a6f7ad..f4c1e3b4f 100644 --- a/src/com/engine/salary/service/impl/TaxAgentManageRangeServiceImpl.java +++ b/src/com/engine/salary/service/impl/TaxAgentManageRangeServiceImpl.java @@ -28,7 +28,7 @@ import com.engine.salary.util.SalaryEntityUtil; import com.engine.salary.util.SalaryI18nUtil; import com.engine.salary.util.db.MapperProxyFactory; import com.engine.salary.util.page.PageInfo; -import com.engine.salary.util.page.PageUtil; +import com.engine.salary.util.page.SalaryPageUtil; import com.google.common.collect.Lists; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; @@ -322,7 +322,7 @@ public class TaxAgentManageRangeServiceImpl extends Service implements TaxAgentM .collect(Collectors.toList()); List positionComInfos = employBiz.listPositionInfo(positionIds); // 分页参数 - PageInfo dtoPage = PageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), TaxAgentManageRangeListDTO.class); + PageInfo dtoPage = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), TaxAgentManageRangeListDTO.class); // 查询人员状态 // List hrmStatusList = hrmCommonHrmStatusService.list(); List hrmStatusList = UserStatusEnum.getHrmStatusList(); @@ -336,7 +336,7 @@ public class TaxAgentManageRangeServiceImpl extends Service implements TaxAgentM } // 填充总数和当页数据 dtoPage.setTotal(taxAgentManageRangeList.size()); - dtoPage.setList(PageUtil.subList(dtoPage.getPageNum(), dtoPage.getSize(), taxAgentManageRangeList)); + dtoPage.setList(SalaryPageUtil.subList(dtoPage.getPageNum(), dtoPage.getSize(), taxAgentManageRangeList)); return dtoPage; } diff --git a/src/com/engine/salary/service/impl/TaxAgentV2ServiceImpl.java b/src/com/engine/salary/service/impl/TaxAgentV2ServiceImpl.java index e47dcf260..64f876eda 100644 --- a/src/com/engine/salary/service/impl/TaxAgentV2ServiceImpl.java +++ b/src/com/engine/salary/service/impl/TaxAgentV2ServiceImpl.java @@ -33,7 +33,7 @@ import com.engine.salary.service.*; import com.engine.salary.util.SalaryI18nUtil; import com.engine.salary.util.db.MapperProxyFactory; import com.engine.salary.util.page.PageInfo; -import com.engine.salary.util.page.PageUtil; +import com.engine.salary.util.page.SalaryPageUtil; import com.engine.salary.util.valid.RuntimeTypeEnum; import com.engine.salary.util.valid.ValidUtil; import com.google.common.collect.Lists; @@ -186,7 +186,7 @@ public class TaxAgentV2ServiceImpl extends Service implements TaxAgentV2Service @Override public PageInfo listPage(TaxAgentQueryParam queryParam) { - PageUtil.start(queryParam.getCurrent(), queryParam.getPageSize()); + SalaryPageUtil.start(queryParam.getCurrent(), queryParam.getPageSize()); List taxAgentPOS = getTaxAgentMapper().listBySome(queryParam); return new PageInfo<>(taxAgentPOS); } diff --git a/src/com/engine/salary/service/impl/TaxDeclarationServiceImpl.java b/src/com/engine/salary/service/impl/TaxDeclarationServiceImpl.java index f023a38af..f670cfd9b 100644 --- a/src/com/engine/salary/service/impl/TaxDeclarationServiceImpl.java +++ b/src/com/engine/salary/service/impl/TaxDeclarationServiceImpl.java @@ -21,7 +21,7 @@ import com.engine.salary.util.SalaryEntityUtil; import com.engine.salary.util.SalaryI18nUtil; import com.engine.salary.util.db.MapperProxyFactory; import com.engine.salary.util.page.PageInfo; -import com.engine.salary.util.page.PageUtil; +import com.engine.salary.util.page.SalaryPageUtil; import org.apache.commons.collections4.CollectionUtils; import org.apache.ibatis.session.SqlSession; import weaver.conn.mybatis.MyBatisFactory; @@ -63,7 +63,7 @@ public class TaxDeclarationServiceImpl extends Service implements TaxDeclaration } po.setSalaryMonths(localDateRange); // 查询个税申报表 - PageUtil.start(queryParam.getCurrent(), queryParam.getPageSize()); + SalaryPageUtil.start(queryParam.getCurrent(), queryParam.getPageSize()); List taxDeclarationPOS = getTaxDeclarationMapper().listSome(po); page.setList(taxDeclarationPOS); diff --git a/src/com/engine/salary/util/page/PageUtil.java b/src/com/engine/salary/util/page/SalaryPageUtil.java similarity index 98% rename from src/com/engine/salary/util/page/PageUtil.java rename to src/com/engine/salary/util/page/SalaryPageUtil.java index 5bea08831..bd8ab155f 100644 --- a/src/com/engine/salary/util/page/PageUtil.java +++ b/src/com/engine/salary/util/page/SalaryPageUtil.java @@ -7,7 +7,7 @@ import java.util.Collections; import java.util.List; -public class PageUtil { +public class SalaryPageUtil { public static void start(Integer pageNum, Integer pageSize) { pageNum = pageNum == null || pageNum <= 0 ? 1 : pageNum; diff --git a/src/com/engine/salary/wrapper/SalarySendWrapper.java b/src/com/engine/salary/wrapper/SalarySendWrapper.java index e4f02ea7e..79a654a58 100644 --- a/src/com/engine/salary/wrapper/SalarySendWrapper.java +++ b/src/com/engine/salary/wrapper/SalarySendWrapper.java @@ -30,7 +30,7 @@ import com.engine.salary.service.impl.SalaryTemplateServiceImpl; import com.engine.salary.service.impl.TaxAgentServiceImpl; import com.engine.salary.util.SalaryI18nUtil; import com.engine.salary.util.page.PageInfo; -import com.engine.salary.util.page.PageUtil; +import com.engine.salary.util.page.SalaryPageUtil; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.apache.ibatis.session.SqlSession; @@ -84,7 +84,7 @@ public class SalarySendWrapper extends Service { queryParam.getSalaryYearMonth().stream().map(e -> e + "-01 00:00:00").collect(Collectors.toList())); SalarySendMapper salarySendMapper = sqlSession.getMapper(SalarySendMapper.class); - PageUtil.start(queryParam.getCurrent(), queryParam.getPageSize()); + SalaryPageUtil.start(queryParam.getCurrent(), queryParam.getPageSize()); List list = salarySendMapper.list(queryParam); PageInfo pageInfo = new PageInfo<>(list, SalarySendListDTO.class); List pageList = pageInfo.getList(); diff --git a/src/com/engine/salary/wrapper/TaxAgentSubAdminWrapper.java b/src/com/engine/salary/wrapper/TaxAgentSubAdminWrapper.java index edf8381a3..1c047a268 100644 --- a/src/com/engine/salary/wrapper/TaxAgentSubAdminWrapper.java +++ b/src/com/engine/salary/wrapper/TaxAgentSubAdminWrapper.java @@ -13,7 +13,7 @@ import com.engine.salary.service.TaxAgentManageRangeService; import com.engine.salary.service.TaxAgentSubAdminService; import com.engine.salary.util.SalaryI18nUtil; import com.engine.salary.util.page.PageInfo; -import com.engine.salary.util.page.PageUtil; +import com.engine.salary.util.page.SalaryPageUtil; import com.engine.salary.util.valid.ValidUtil; import com.google.common.collect.Lists; import org.apache.commons.lang3.StringUtils; @@ -54,10 +54,10 @@ public class TaxAgentSubAdminWrapper extends Service { List subAdminList = employBiz.getEmployeeByIds(list.stream().map(TaxAgentSubAdminPO::getEmployeeId).distinct().collect(Collectors.toList())); List records = TaxAgentBO.convertToSubAdminListDTO(list, range, subAdminList); - PageInfo listPage = PageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), TaxAgentSubAdminListDTO.class); + PageInfo listPage = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), TaxAgentSubAdminListDTO.class); // 填充总数和当页数据 listPage.setTotal(records.size()); - listPage.setList(PageUtil.subList(listPage.getPageNum(), listPage.getSize(), records)); + listPage.setList(SalaryPageUtil.subList(listPage.getPageNum(), listPage.getSize(), records)); return listPage; } diff --git a/src/com/engine/salary/wrapper/TaxAgentWrapper.java b/src/com/engine/salary/wrapper/TaxAgentWrapper.java index 54d09a860..8f8fe7bb5 100644 --- a/src/com/engine/salary/wrapper/TaxAgentWrapper.java +++ b/src/com/engine/salary/wrapper/TaxAgentWrapper.java @@ -20,7 +20,7 @@ import com.engine.salary.service.*; import com.engine.salary.service.impl.*; import com.engine.salary.util.SalaryI18nUtil; import com.engine.salary.util.page.PageInfo; -import com.engine.salary.util.page.PageUtil; +import com.engine.salary.util.page.SalaryPageUtil; import com.google.common.collect.Maps; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.StringUtils; @@ -124,11 +124,11 @@ public class TaxAgentWrapper extends Service { list = list.stream().filter(f -> adminTaxAgentIds.contains(f.getId())).collect(Collectors.toList()); // 分页参数 // 填充总数和当页数据 - PageInfo dtoPage = PageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize()); + PageInfo dtoPage = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize()); dtoPage.setTotal(list.size()); dtoPage.setPageNum(queryParam.getCurrent()); dtoPage.setPageSize(queryParam.getPageSize()); - dtoPage.setList(PageUtil.subList(dtoPage.getPageNum(), dtoPage.getPageSize(), list)); + dtoPage.setList(SalaryPageUtil.subList(dtoPage.getPageNum(), dtoPage.getPageSize(), list)); page = dtoPage; } } From 90a6bd9921d9a0c47f41917b0aba350c0d418ced Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=92=B1=E6=B6=9B?= <15850646081@163.com> Date: Wed, 25 May 2022 13:49:25 +0800 Subject: [PATCH 10/20] =?UTF-8?q?=E6=9A=82=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../engine/salary/biz/AddUpDeductionBiz.java | 59 ---- .../salary/service/AddUpDeductionService.java | 34 +- .../impl/AddUpDeductionServiceImpl.java | 296 ++++++------------ .../salary/web/AddUpDeductionController.java | 5 +- .../salary/wrapper/AddUpDeductionWrapper.java | 189 +++++++++++ 5 files changed, 289 insertions(+), 294 deletions(-) create mode 100644 src/com/engine/salary/wrapper/AddUpDeductionWrapper.java diff --git a/src/com/engine/salary/biz/AddUpDeductionBiz.java b/src/com/engine/salary/biz/AddUpDeductionBiz.java index c04f34936..f0f9f2bed 100644 --- a/src/com/engine/salary/biz/AddUpDeductionBiz.java +++ b/src/com/engine/salary/biz/AddUpDeductionBiz.java @@ -5,15 +5,11 @@ import com.engine.salary.entity.datacollection.dto.AddUpDeductionDTO; import com.engine.salary.entity.datacollection.dto.AddUpDeductionRecordDTO; import com.engine.salary.entity.datacollection.param.AddUpDeductionQueryParam; import com.engine.salary.mapper.datacollection.AddUpDeductionMapper; -import com.engine.salary.util.excel.ExcelUtil; import org.apache.commons.collections4.CollectionUtils; import org.apache.ibatis.session.SqlSession; -import org.apache.poi.xssf.usermodel.XSSFWorkbook; import weaver.conn.mybatis.MyBatisFactory; import weaver.general.BaseBean; -import weaver.general.Util; -import java.text.SimpleDateFormat; import java.util.*; import java.util.stream.Collectors; @@ -124,62 +120,7 @@ public class AddUpDeductionBiz extends BaseBean { - /** - * 导出详情列表 - * - * @param param - * @return - */ - public XSSFWorkbook exportDetail(AddUpDeductionQueryParam param) { - //获取操作按钮资源 - List> rowList = getExcelRowDetailList(param); - - //获取excel - return ExcelUtil.genWorkbook(rowList, "累计专项附加扣除明细"); - } - - - /** - * 导出详情 - * - * @param param - * @return - */ - private List> getExcelRowDetailList(AddUpDeductionQueryParam param) { - - //excel标题 - List title = Arrays.asList("姓名", "申报月份", "个税扣缴义务人", "部门", "工号", "累计子女教育", "累计继续教育", "累计住房贷款利息", "累计住房租金", "累计赡养老人", "累计大病医疗", "累计婴幼儿照护"); - - - SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM"); - //查询详细信息 - List list = recordList(param); - final List> dataRowList = Optional.ofNullable(list) - .map(List::stream) - .map(operatorStream -> operatorStream.map(dto -> { - List cellList = new ArrayList<>(); - cellList.add(Util.null2String(dto.getUsername())); - cellList.add(Util.null2String(dto.getDeclareMonth() == null ? "" : formatter.format(dto.getDeclareMonth()))); - cellList.add(Util.null2String(dto.getTaxAgentName())); - cellList.add(Util.null2String(dto.getDepartmentName())); - cellList.add(Util.null2String(dto.getJobNum())); - cellList.add(Util.null2String(dto.getAddUpChildEducation())); - cellList.add(Util.null2String(dto.getAddUpContinuingEducation())); - cellList.add(Util.null2String(dto.getAddUpHousingLoanInterest())); - cellList.add(Util.null2String(dto.getAddUpHousingRent())); - cellList.add(Util.null2String(dto.getAddUpSupportElderly())); - cellList.add(Util.null2String(dto.getAddUpIllnessMedical())); - cellList.add(Util.null2String(dto.getAddUpInfantCare())); - return cellList; - }).collect(Collectors.toList())) - .orElse(Collections.emptyList()); - - List> rowList = new ArrayList<>(); - rowList.add(title); - rowList.addAll(dataRowList); - return rowList; - } /** * 处理导入数据 diff --git a/src/com/engine/salary/service/AddUpDeductionService.java b/src/com/engine/salary/service/AddUpDeductionService.java index 2909a3655..fe4934ea1 100644 --- a/src/com/engine/salary/service/AddUpDeductionService.java +++ b/src/com/engine/salary/service/AddUpDeductionService.java @@ -4,7 +4,6 @@ import com.engine.salary.entity.datacollection.AddUpDeduction; import com.engine.salary.entity.datacollection.dto.AddUpDeductionDTO; import com.engine.salary.entity.datacollection.dto.AddUpDeductionRecordDTO; import com.engine.salary.entity.datacollection.param.AddUpDeductionQueryParam; -import com.engine.salary.entity.salaryacct.po.SalaryAcctEmployeePO; import com.engine.salary.util.page.PageInfo; import org.apache.poi.xssf.usermodel.XSSFWorkbook; @@ -16,8 +15,6 @@ public interface AddUpDeductionService { Map list(Map params); - XSSFWorkbook export(Map params); - Map getSearchCondition(Map params); Map importAddUpDeduction(Map params); @@ -26,8 +23,6 @@ public interface AddUpDeductionService { Map preview(Map params); - XSSFWorkbook exportDetail(Map map); - XSSFWorkbook downloadTemplate(AddUpDeductionQueryParam queryParam); @@ -66,42 +61,19 @@ public interface AddUpDeductionService { /** * 导出 * - * @param map - * @param username - * @param eteamsId * @param isChief * @param queryParam - * @param employeeId - * @param tenantKey */ - void export(Map map, String username, String eteamsId, boolean isChief, AddUpDeductionQueryParam queryParam, Long employeeId, String tenantKey); + XSSFWorkbook export(boolean isChief, AddUpDeductionQueryParam queryParam); /** * 导出详情 * - * @param map - * @param username - * @param eteamsId * @param beLongEmployeeId * @param isChief * @param queryParam - * @param employeeId - * @param tenantKey */ - void exportDetail(Map map, String username, String eteamsId, Long beLongEmployeeId, boolean isChief, AddUpDeductionQueryParam queryParam, Long employeeId, String tenantKey); - - /** - * 下载导入模板 - * - * @param map - * @param username - * @param eteamsId - * @param isChief - * @param queryParam - * @param employeeId - * @param tenantKey - */ - void downloadTemplate(Map map, String username, String eteamsId, boolean isChief, AddUpDeductionQueryParam queryParam, Long employeeId, String tenantKey); + XSSFWorkbook exportDetail(Long beLongEmployeeId, boolean isChief, AddUpDeductionQueryParam queryParam); /** * 获取累计专项附加扣除数据 @@ -118,5 +90,5 @@ public interface AddUpDeductionService { * @param yearMonth * @return */ - List getAccountedEmployeeData(String yearMonth); +// List getAccountedEmployeeData(String yearMonth); } diff --git a/src/com/engine/salary/service/impl/AddUpDeductionServiceImpl.java b/src/com/engine/salary/service/impl/AddUpDeductionServiceImpl.java index c462f8e88..063effbf5 100644 --- a/src/com/engine/salary/service/impl/AddUpDeductionServiceImpl.java +++ b/src/com/engine/salary/service/impl/AddUpDeductionServiceImpl.java @@ -24,14 +24,10 @@ import com.engine.salary.util.page.PageInfo; import com.engine.salary.util.page.SalaryPageUtil; import com.google.common.collect.Lists; import org.apache.commons.collections4.CollectionUtils; -import org.apache.commons.lang3.StringUtils; import org.apache.poi.xssf.usermodel.XSSFWorkbook; import weaver.general.Util; -import javax.annotation.Resource; import java.text.SimpleDateFormat; -import java.time.LocalDate; -import java.time.LocalDateTime; import java.time.YearMonth; import java.util.*; import java.util.stream.Collectors; @@ -53,20 +49,6 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction return commandExecutor.execute(new AddUpDeductionListCmd(params, user)); } - @Override - public XSSFWorkbook export(Map params) { - - Boolean chief = taxAgentService.isChief((long) user.getUID()); - - AddUpDeductionQueryParam addUpDeductionQueryParam = (AddUpDeductionQueryParam) params.get("addUpDeductionQueryParam"); - - AddUpDeductionBiz addUpDeductionBiz = new AddUpDeductionBiz(); - XSSFWorkbook workbook = addUpDeductionBiz.export(addUpDeductionQueryParam); - - return workbook; -// return commandExecutor.execute(new AddUpDeductionExportCmd(params, user)); - } - @Override public Map getSearchCondition(Map params) { return commandExecutor.execute(new AddUpDeductionGetSearchConditionCmd(params, user)); @@ -87,9 +69,13 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction return commandExecutor.execute(new AddUpDeductionPreviewCmd(params, user)); } - @Override - public XSSFWorkbook exportDetail(Map params) { - AddUpDeductionQueryParam queryParam = (AddUpDeductionQueryParam) params.get("addUpDeductionQueryParam"); + + /** + * 导出详情列表 + * + * @return + */ + public XSSFWorkbook exportDetail(Long beLongEmployeeId, boolean isChief, AddUpDeductionQueryParam queryParam) { EmployBiz employBiz = new EmployBiz(); AddUpDeductionBiz biz = new AddUpDeductionBiz(); @@ -116,12 +102,75 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction queryParam.setDeclareMonth(declareMonth.stream().map(e -> e + "-01 00:00:00").collect(Collectors.toList())); } - XSSFWorkbook workbook = biz.exportDetail(queryParam); - return workbook; -// return commandExecutor.execute(new AddUpDeductionExportDetailCmd(params, user)); + //获取操作按钮资源 + List> rowList = getExcelRowDetailList(isChief, queryParam); + + //获取excel + return ExcelUtil.genWorkbook(rowList, "累计专项附加扣除明细"); } + + /** + * 导出详情 + * + * @param param + * @return + */ + private List> getExcelRowDetailList(boolean isChief, AddUpDeductionQueryParam param) { + long employeeId = user.getUID(); + + //excel标题 + List title = Arrays.asList("姓名", "申报月份", "个税扣缴义务人", "部门", "工号", "累计子女教育", "累计继续教育", "累计住房贷款利息", "累计住房租金", "累计赡养老人", "累计大病医疗", "累计婴幼儿照护"); + + + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM"); + //查询详细信息 + List list = new AddUpDeductionBiz().recordList(param); + final List> dataRowList = Optional.ofNullable(list) + .map(List::stream) + .map(operatorStream -> operatorStream.map(dto -> { + List cellList = new ArrayList<>(); + cellList.add(Util.null2String(dto.getUsername())); + cellList.add(Util.null2String(dto.getDeclareMonth() == null ? "" : formatter.format(dto.getDeclareMonth()))); + cellList.add(Util.null2String(dto.getTaxAgentName())); + cellList.add(Util.null2String(dto.getDepartmentName())); + cellList.add(Util.null2String(dto.getJobNum())); + cellList.add(Util.null2String(dto.getAddUpChildEducation())); + cellList.add(Util.null2String(dto.getAddUpContinuingEducation())); + cellList.add(Util.null2String(dto.getAddUpHousingLoanInterest())); + cellList.add(Util.null2String(dto.getAddUpHousingRent())); + cellList.add(Util.null2String(dto.getAddUpSupportElderly())); + cellList.add(Util.null2String(dto.getAddUpIllnessMedical())); + cellList.add(Util.null2String(dto.getAddUpInfantCare())); + return cellList; + }).collect(Collectors.toList())) + .orElse(Collections.emptyList()); + + + // 开启分权并且不是薪酬模块总管理员 + if (taxAgentService.isOpenDevolution() && !isChief) { + List taxAgentEmployees = taxAgentService.listTaxAgentAndEmployee(employeeId); + List taxAgentIdsAsAdmin = taxAgentService.listAllTaxAgentsAsAdmin(employeeId).stream().map(TaxAgentPO::getId).collect(Collectors.toList()); +// List lastList = getLastListByModifier(employeeId, tenantKey); + list = list.stream().filter(f -> + // 作为管理员 + taxAgentIdsAsAdmin.contains(f.getTaxAgentId()) + // 作为分管理员 + || TaxAgentBO.checkTaxAgentAndEmployee(taxAgentEmployees, f.getTaxAgentId(), f.getEmployeeId()) + // 自己最后修改过的,则可以看到最新和其历史 +// || lastList.stream().anyMatch(l -> l.getEmployeeId().equals(f.getEmployeeId()) && l.getTaxAgentId().equals(f.getTaxAgentId()) && !l.getDeclareMonth().isBefore(f.getDeclareMonth())) + ).collect(Collectors.toList()); + } + + + List> rowList = new ArrayList<>(); + rowList.add(title); + rowList.addAll(dataRowList); + return rowList; + } + + @Override public List getAddUpDeductionList(YearMonth declareMonth, List employeeIds) { AddUpDeductionBiz addUpDeductionBiz = new AddUpDeductionBiz(); @@ -288,181 +337,10 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction @Override - public void export(Map map, String username, String eteamsId, boolean isChief, AddUpDeductionQueryParam queryParam, Long employeeId, String tenantKey) { - List sheetList = new ArrayList<>(); - - ExcelSheetData excelSheetData = new ExcelSheetData(); - - String nameI18n = SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 85380, "累计专项附加扣除"); - // 1.工作簿名称 - excelSheetData.setSheetName(nameI18n); - String[] header = { - SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 85429, "姓名"), - SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 86184, "个税扣缴义务人"), - SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 86185, "部门"), - SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 86186, "手机号"), - SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 86317, "工号"), - SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 86318, "证件号码"), - SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 86319, "入职日期"), - SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 86321, "累计子女教育"), - SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 86323, "累计继续教育"), - SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 86324, "累计住房贷款利息"), - SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 86325, "累计住房租金"), - SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 86326, "累计赡养老人"), - SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 105142, "累计大病医疗"), - SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 117732, "累计婴幼儿照护") - }; - // 2.表头 - excelSheetData.setHeaders(Collections.singletonList(header)); - queryParam.setDeclareMonthDate(CollectionUtils.emptyIfNull(queryParam.getDeclareMonth()).stream().map(e-> LocalDate.of(e.getYear(),e.getMonthValue(),1)).collect(Collectors.toList())); - // 获取累计专项附加扣除 - List list = addUpDeductionMapper.list(queryParam, tenantKey); - - // 开启分权并且不是薪酬模块总管理员 - if (taxAgentService.isOpenDevolution(tenantKey) && !isChief) { - List taxAgentEmployees = taxAgentService.listTaxAgentAndEmployee(employeeId, tenantKey); - List taxAgentIdsAsAdmin = taxAgentService.listAllTaxAgentsAsAdmin(employeeId, tenantKey).stream().map(TaxAgentPO::getId).collect(Collectors.toList()); - List lastList = getLastListByModifier(employeeId, tenantKey); - list = list.stream().filter(f -> - // 作为管理员 - taxAgentIdsAsAdmin.contains(f.getTaxAgentId()) - // 作为分管理员 - || TaxAgentBO.checkTaxAgentAndEmployee(taxAgentEmployees, f.getTaxAgentId(), f.getEmployeeId()) - // 自己最后修改过的,则可以看到最新和其历史 - || lastList.stream().anyMatch(l->l.getEmployeeId().equals(f.getEmployeeId()) && l.getTaxAgentId().equals(f.getTaxAgentId()) && !l.getDeclareMonth().isBefore(f.getDeclareMonth())) - ).collect(Collectors.toList()); - } - List simpleUserInfos = salaryEmployeeService.listByEmployeeIds(list.stream().map(AddUpDeductionListDTO::getEmployeeId).collect(Collectors.toList()), tenantKey); - List> rows = new ArrayList<>(); - for (AddUpDeductionListDTO dto : list) { - List row = new ArrayList<>(); - row.add(dto.getUsername()); - row.add(dto.getTaxAgentName()); - row.add(dto.getDepartmentName()); - row.add(dto.getMobile()); - row.add(dto.getJobNum()); - row.add(DataCollectionBO.getIdNo(dto.getEmployeeId(), simpleUserInfos)); - row.add(dto.getHiredate()+""); - row.add(dto.getAddUpChildEducation()); - row.add(dto.getAddUpContinuingEducation()); - row.add(dto.getAddUpHousingLoanInterest()); - row.add(dto.getAddUpHousingRent()); - row.add(dto.getAddUpSupportElderly()); - row.add(dto.getAddUpIllnessMedical()); - row.add(dto.getAddUpInfantCare()); - rows.add(row); - } - // 3.表数据 - excelSheetData.setRows(rows); - - sheetList.add(excelSheetData); - - salaryBatchService.simpleExportExcel(ExportExcelInfo.builder() - .bizId(map.get("biz").toString()) - .flag(true) - .userId(employeeId) - .eteamsId(eteamsId) - .tenantKey(tenantKey) - .operator(username) - .module(map.get("module").toString()) - .fileName(nameI18n + SalaryDateUtil.getFormatLocalDateTime(LocalDateTime.now())) - .handlerName(map.get("function").toString()) - .dataType(nameI18n) - .function(map.get("function").toString()).build(), sheetList); - } - - @Override - public void downloadTemplate(Map map, String username, String eteamsId, boolean isChief, AddUpDeductionQueryParam queryParam, Long employeeId, String tenantKey) { - List sheetList = new ArrayList<>(); - - ExcelSheetData excelSheetData = new ExcelSheetData(); - - String nameI18n = SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 101603, "累计专项附加扣除导入模板"); - // 1.工作簿名称 - excelSheetData.setSheetName(nameI18n); - String[] header = { - SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 85429, "姓名"), - SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 86184, "个税扣缴义务人"), - SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 86185, "部门"), - SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 86186, "手机号"), - SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 86317, "工号"), - SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 86318, "证件号码"), - SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 86319, "入职日期"), - SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 86321, "累计子女教育"), - SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 86323, "累计继续教育"), - SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 86324, "累计住房贷款利息"), - SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 86325, "累计住房租金"), - SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 86326, "累计赡养老人"), - SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 105142, "累计大病医疗"), - SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 117732, "累计婴幼儿照护") - }; - // 2.表头 - excelSheetData.setHeaders(Collections.singletonList(header)); - queryParam.setDeclareMonthDate(CollectionUtils.emptyIfNull(queryParam.getDeclareMonth()).stream().map(e-> LocalDate.of(e.getYear(),e.getMonthValue(),1)).collect(Collectors.toList())); - // 获取累计专项附加扣除 - List list = addUpDeductionMapper.list(queryParam, tenantKey); - List simpleUserInfos = salaryEmployeeService.listByEmployeeIds(list.stream().map(AddUpDeductionListDTO::getEmployeeId).collect(Collectors.toList()), tenantKey); - List> rows = new ArrayList<>(); - for (AddUpDeductionListDTO dto : list) { - List row = new ArrayList<>(); - row.add(dto.getUsername()); - row.add(dto.getTaxAgentName()); - row.add(dto.getDepartmentName()); - row.add(dto.getMobile()); - row.add(dto.getJobNum()); - row.add(DataCollectionBO.getIdNo(dto.getEmployeeId(), simpleUserInfos)); - row.add(dto.getHiredate()+""); - row.add(dto.getAddUpChildEducation()); - row.add(dto.getAddUpContinuingEducation()); - row.add(dto.getAddUpHousingLoanInterest()); - row.add(dto.getAddUpHousingRent()); - row.add(dto.getAddUpSupportElderly()); - row.add(dto.getAddUpIllnessMedical()); - row.add(dto.getAddUpInfantCare()); - rows.add(row); - } - // 3.表数据 - excelSheetData.setRows(rows); - // 4.注释 - List excelComments = Lists.newArrayList(); - salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 100344, "必填"), 0, 0, 0, 0); - salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 100344, "必填"), 0, 0, 1, 1); - salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 100343, "输入数字"), 0, 0, 7, 7); - salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 100343, "输入数字"), 0, 0, 8, 8); - salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 100343, "输入数字"), 0, 0, 9, 9); - salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 100343, "输入数字"), 0, 0, 10, 10); - salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 100343, "输入数字"), 0, 0, 11, 11); - salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 100343, "输入数字"), 0, 0, 12, 12); - salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 100343, "输入数字"), 0, 0, 13, 13); - excelSheetData.setExcelComment(excelComments); - - sheetList.add(excelSheetData); - - salaryBatchService.simpleExportExcel(ExportExcelInfo.builder() - .bizId(map.get("biz").toString()) - .flag(true) - .userId(employeeId) - .eteamsId(eteamsId) - .tenantKey(tenantKey) - .operator(username) - .module(map.get("module").toString()) - .fileName(nameI18n + SalaryDateUtil.getFormatLocalDateTime(LocalDateTime.now())) - .handlerName(map.get("function").toString()) - .dataType(nameI18n) - .function(map.get("function").toString()).build(), sheetList); - } - - - /** - * 导出 - * - * @param param - * @return - */ - private XSSFWorkbook export(AddUpDeductionQueryParam param) { + public XSSFWorkbook export(boolean isChief, AddUpDeductionQueryParam queryParam) { //获取操作按钮资源 - List> rowList = getExcelRowList(param); + List> rowList = getExcelRowList(isChief, queryParam); //获取excel return ExcelUtil.genWorkbook(rowList, "累计专项附加扣除"); @@ -474,12 +352,30 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction * * @return 导出数据行集合 */ - private List> getExcelRowList(AddUpDeductionQueryParam param) { + private List> getExcelRowList(boolean isChief, AddUpDeductionQueryParam param) { + Long employeeId = (long) user.getUID(); + //excel标题 List title = Arrays.asList("姓名", "个税扣缴义务人", "部门", "手机号", "工号", "证件号码", "入职日期", "累计子女教育", "累计继续教育", "累计住房贷款利息", "累计住房租金", "累计赡养老人", "累计大病医疗", "累计婴幼儿照护"); - SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); - List list = list(param); + List list = new AddUpDeductionBiz().list(param); + + // 开启分权并且不是薪酬模块总管理员 + if (taxAgentService.isOpenDevolution() && !isChief) { + List taxAgentEmployees = taxAgentService.listTaxAgentAndEmployee(employeeId); + List taxAgentIdsAsAdmin = taxAgentService.listAllTaxAgentsAsAdmin(employeeId).stream().map(TaxAgentPO::getId).collect(Collectors.toList()); +// List lastList = getLastListByModifier(employeeId); + list = list.stream().filter(f -> + // 作为管理员 + taxAgentIdsAsAdmin.contains(f.getTaxAgentId()) + // 作为分管理员 + || TaxAgentBO.checkTaxAgentAndEmployee(taxAgentEmployees, f.getTaxAgentId(), f.getEmployeeId()) + // 自己最后修改过的,则可以看到最新和其历史 +// || lastList.stream().anyMatch(l->l.getEmployeeId().equals(f.getEmployeeId()) && l.getTaxAgentId().equals(f.getTaxAgentId()) && !l.getDeclareMonth().isBefore(f.getDeclareMonth())) + ).collect(Collectors.toList()); + } + + final List> dataRowList = Optional.ofNullable(list) .map(List::stream) .map(operatorStream -> operatorStream.map(dto -> { diff --git a/src/com/engine/salary/web/AddUpDeductionController.java b/src/com/engine/salary/web/AddUpDeductionController.java index 6033cf609..d9d4d2fd3 100644 --- a/src/com/engine/salary/web/AddUpDeductionController.java +++ b/src/com/engine/salary/web/AddUpDeductionController.java @@ -150,10 +150,7 @@ public class AddUpDeductionController { AddUpDeductionQueryParam param = buildParam(request); - Map map = ParamUtil.request2Map(request); - map.put("addUpDeductionQueryParam", param); - - XSSFWorkbook workbook = getService(user).exportDetail(map); + XSSFWorkbook workbook = getService(user).exportDetail(param); String fileName = "累计专项附加扣除明细" + LocalDate.now(); try { diff --git a/src/com/engine/salary/wrapper/AddUpDeductionWrapper.java b/src/com/engine/salary/wrapper/AddUpDeductionWrapper.java new file mode 100644 index 000000000..987ef42c4 --- /dev/null +++ b/src/com/engine/salary/wrapper/AddUpDeductionWrapper.java @@ -0,0 +1,189 @@ +package com.engine.salary.wrapper; + +import com.engine.salary.entity.datacollection.dto.AddUpDeductionDTO; +import com.engine.salary.entity.datacollection.param.AddUpDeductionQueryParam; +import com.engine.salary.service.AddUpDeductionService; +import com.engine.salary.service.SalaryEmployeeService; +import com.engine.salary.service.TaxAgentV2Service; +import com.engine.salary.util.page.PageInfo; +import com.weaver.common.authority.format.FormatManager; +import com.weaver.common.component.table.WeaTable; +import com.weaver.common.component.table.page.Page; +import com.weaver.datasecurity.interceptor.DSTenantKeyThreadVar; +import com.weaver.framework.rpc.context.impl.TenantRpcContext; +import com.weaver.hrm.salary.common.excel.ExcelImportParam; +import com.weaver.hrm.salary.entity.datacollection.bo.DataCollectionBO; +import com.weaver.hrm.salary.entity.datacollection.dto.AddUpDeductionListDTO; +import com.weaver.hrm.salary.entity.datacollection.dto.AddUpDeductionRecordDTO; +import com.weaver.hrm.salary.entity.datacollection.po.AddUpDeductionPO; +import com.weaver.hrm.salary.exception.SalaryRunTimeException; +import com.weaver.hrm.salary.util.SalaryI18nUtil; +import com.weaver.teams.domain.hr.SimpleUserInfo; +import com.weaver.teams.security.context.TenantContext; +import com.weaver.teams.security.context.UserContext; +import org.apache.commons.collections4.CollectionUtils; +import org.springframework.stereotype.Component; + +import java.time.LocalDate; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +import static weaver.formmode.modesetdelete.DeleteItemType.page; + +/** + * 累计专项附加扣除 + *

Copyright: Copyright (c) 2022

+ *

Company: 泛微软件

+ * + * @author qiantao + * @version 1.0 + **/ +@Component +public class AddUpDeductionWrapper { + + private AddUpDeductionService addUpDeductionService; + private TaxAgentV2Service taxAgentService; + private SalaryEmployeeService salaryEmployeeService; + + + /** + * 数据采集-累计专项附加扣除列表(分页) + * + * @param queryParam + * @return + */ + public PageInfo list(AddUpDeductionQueryParam queryParam) { + + //申报月份 + List declareMonth = queryParam.getDeclareMonth(); + if (CollectionUtils.isNotEmpty(declareMonth)) { + queryParam.setDeclareMonth(declareMonth.stream().map(e -> e + "-01 00:00:00").collect(Collectors.toList())); + } + + page = addUpDeductionService.listPage(page, queryParam); + List list = page.getRecords(); + List simpleUserInfos = salaryEmployeeService.listByEmployeeIds(list.stream().map(AddUpDeductionListDTO::getEmployeeId).collect(Collectors.toList()), currentTenantKey); + // 人员信息赋值 + list.forEach(m -> { + // 身份证号 + m.setIdNo(DataCollectionBO.getIdNo(m.getEmployeeId(), simpleUserInfos)); + }); + + WeaTable weaTable = FormatManager.getInstance().genTable(AddUpDeductionListDTO.class, page); + weaTable.setModule("hrmsalary"); + // 在外展示操作按钮 + weaTable.getOperates().get(0).setOuter(Boolean.TRUE); + + return weaTable; + } + + /** + * 数据采集-累计专项附加扣除详情列表(分页) + * + * @param queryParam + * @param currentEmployeeId + * @param currentTenantKey + * @return + */ + public WeaTable getDetailList(AddUpDeductionQueryParam queryParam, Long currentEmployeeId, String currentTenantKey) { + Long id = queryParam.getAccumulatedSpecialAdditionalDeductionId(); + AddUpDeductionPO po = addUpDeductionService.getById(id, currentTenantKey); + if (po == null) { + throw new SalaryRunTimeException(String.format(SalaryI18nUtil.getI18nLabel(currentTenantKey, currentEmployeeId, 100338, "累计专项附加扣除不存在") + "[id:%s]", id)); + } + queryParam.setDeclareMonthDate(CollectionUtils.emptyIfNull(queryParam.getDeclareMonth()).stream().map(e -> LocalDate.of(e.getYear(), e.getMonthValue(), 1)).collect(Collectors.toList())); + queryParam.setEmployeeId(po.getEmployeeId()); + Page page = new Page<>(queryParam.getCurrent(), queryParam.getPageSize(), true); + page = addUpDeductionService.recordListPage(page, queryParam, currentEmployeeId, currentTenantKey); + // 记录表格 + WeaTable weaTable = FormatManager.getInstance() + .genTable(AddUpDeductionRecordDTO.class, page); + weaTable.setModule("hrmsalary"); + + return weaTable; + } + + /** + * 导出-累计专项附加扣除列表 + * + * @param queryParam + * @param currentEmployeeId + * @param currentTenantKey + * @return + */ + public Map export(AddUpDeductionQueryParam queryParam, Long currentEmployeeId, String currentTenantKey) { + // 构建异步导出参数 + Map map = salaryBatchService.buildeExportParam("exportAddUpDeduction"); + + String username = UserContext.getCurrentUser().getUsername(); + String eteamsId = TenantRpcContext.getEteamsId(); + boolean isChief = taxAgentService.isChief(currentEmployeeId, currentTenantKey); + taskExecutor.execute(() -> { + try { + DSTenantKeyThreadVar.tenantKey.set(currentTenantKey); + addUpDeductionService.export(map, username, eteamsId, isChief, queryParam, currentEmployeeId, currentTenantKey); + } finally { + DSTenantKeyThreadVar.tenantKey.remove(); + } + }); + return map; + } + + /** + * 导出-累计专项附加扣除详情列表 + * + * @param queryParam + * @param currentEmployeeId + * @param currentTenantKey + * @return + */ + public Map exportDetail(AddUpDeductionQueryParam queryParam, Long currentEmployeeId, String currentTenantKey) { + Long id = queryParam.getAccumulatedSpecialAdditionalDeductionId(); + AddUpDeductionPO po = addUpDeductionService.getById(id, currentTenantKey); + if (po == null) { + throw new SalaryRunTimeException(String.format(SalaryI18nUtil.getI18nLabel(currentTenantKey, currentEmployeeId, 100338, "累计专项附加扣除不存在") + "[id:%s]", id)); + } + boolean isChief = taxAgentService.isChief(currentEmployeeId, currentTenantKey); + // 构建异步导出参数 + Map map = salaryBatchService.buildeExportParam("exportAddUpDeductionDetail"); + + String username = UserContext.getCurrentUser().getUsername(); + String eteamsId = TenantRpcContext.getEteamsId(); + taskExecutor.execute(() -> { + try { + DSTenantKeyThreadVar.tenantKey.set(currentTenantKey); + addUpDeductionService.exportDetail(map, username, eteamsId, po.getEmployeeId(), isChief, queryParam, currentEmployeeId, currentTenantKey); + } finally { + DSTenantKeyThreadVar.tenantKey.remove(); + } + }); + return map; + } + + /** + * 下载导入模板 + * + * @param queryParam + * @param currentEmployeeId + * @param currentTenantKey + * @return + */ + public Map downloadTemplate(AddUpDeductionQueryParam queryParam, Long currentEmployeeId, String currentTenantKey) { + // 构建异步导出参数 + Map map = salaryBatchService.buildeExportParam("exportAddUpDeduction"); + boolean isChief = taxAgentService.isChief(currentEmployeeId, currentTenantKey); + String username = UserContext.getCurrentUser().getUsername(); + String eteamsId = TenantRpcContext.getEteamsId(); + taskExecutor.execute(() -> { + try { + DSTenantKeyThreadVar.tenantKey.set(currentTenantKey); + addUpDeductionService.downloadTemplate(map, username, eteamsId, isChief, queryParam, currentEmployeeId, currentTenantKey); + } finally { + DSTenantKeyThreadVar.tenantKey.remove(); + } + }); + return map; + } + +} From 586fad5f2c52c72bba5bc30033503d64ef3a1d86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=92=B1=E6=B6=9B?= <15850646081@163.com> Date: Wed, 25 May 2022 16:51:43 +0800 Subject: [PATCH 11/20] =?UTF-8?q?=E5=88=86=E6=9D=83=E7=B4=AF=E8=AE=A1?= =?UTF-8?q?=E4=B8=93=E9=A1=B9=E9=99=84=E5=8A=A0=E6=89=A3=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AddUpDeductionExportCmd.java | 34 ---- .../AddUpDeductionExportDetailCmd.java | 66 ------- .../DataCollectionEmployee.java | 2 + .../datacollection/bo/DataCollectionBO.java | 52 ++++++ .../datacollection/AddUpDeductionMapper.xml | 1 + .../mapper/datacollection/EmployMapper.xml | 8 +- .../salary/service/AddUpDeductionService.java | 13 +- .../impl/AddUpDeductionServiceImpl.java | 89 +++++++--- .../salary/web/AddUpDeductionController.java | 33 ++-- .../salary/wrapper/AddUpDeductionWrapper.java | 167 +++++++----------- 10 files changed, 208 insertions(+), 257 deletions(-) delete mode 100644 src/com/engine/salary/cmd/datacollection/AddUpDeductionExportCmd.java delete mode 100644 src/com/engine/salary/cmd/datacollection/AddUpDeductionExportDetailCmd.java create mode 100644 src/com/engine/salary/entity/datacollection/bo/DataCollectionBO.java diff --git a/src/com/engine/salary/cmd/datacollection/AddUpDeductionExportCmd.java b/src/com/engine/salary/cmd/datacollection/AddUpDeductionExportCmd.java deleted file mode 100644 index 8db98484f..000000000 --- a/src/com/engine/salary/cmd/datacollection/AddUpDeductionExportCmd.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.engine.salary.cmd.datacollection; - -import com.engine.common.biz.AbstractCommonCommand; -import com.engine.common.entity.BizLogContext; -import com.engine.core.interceptor.CommandContext; -import com.engine.salary.biz.AddUpDeductionBiz; -import com.engine.salary.entity.datacollection.param.AddUpDeductionQueryParam; -import org.apache.poi.xssf.usermodel.XSSFWorkbook; -import weaver.hrm.User; - -import java.util.Map; - -public class AddUpDeductionExportCmd extends AbstractCommonCommand { - - public AddUpDeductionExportCmd(Map params, User user) { - this.user = user; - this.params = params; - } - - @Override - public BizLogContext getLogContext() { - return null; - } - - @Override - public XSSFWorkbook execute(CommandContext commandContext) { - AddUpDeductionQueryParam addUpDeductionQueryParam = (AddUpDeductionQueryParam) params.get("addUpDeductionQueryParam"); - - AddUpDeductionBiz addUpDeductionBiz = new AddUpDeductionBiz(); - XSSFWorkbook workbook = addUpDeductionBiz.export(addUpDeductionQueryParam); - - return workbook; - } -} diff --git a/src/com/engine/salary/cmd/datacollection/AddUpDeductionExportDetailCmd.java b/src/com/engine/salary/cmd/datacollection/AddUpDeductionExportDetailCmd.java deleted file mode 100644 index 6a5370981..000000000 --- a/src/com/engine/salary/cmd/datacollection/AddUpDeductionExportDetailCmd.java +++ /dev/null @@ -1,66 +0,0 @@ -package com.engine.salary.cmd.datacollection; - -import com.engine.common.biz.AbstractCommonCommand; -import com.engine.common.entity.BizLogContext; -import com.engine.core.interceptor.CommandContext; -import com.engine.salary.biz.AddUpDeductionBiz; -import com.engine.salary.biz.EmployBiz; -import com.engine.salary.entity.datacollection.AddUpDeduction; -import com.engine.salary.entity.datacollection.DataCollectionEmployee; -import com.engine.salary.entity.datacollection.param.AddUpDeductionQueryParam; -import com.engine.salary.exception.SalaryRunTimeException; -import org.apache.commons.collections4.CollectionUtils; -import org.apache.poi.xssf.usermodel.XSSFWorkbook; -import weaver.hrm.User; - -import java.util.Collections; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - -public class AddUpDeductionExportDetailCmd extends AbstractCommonCommand { - - public AddUpDeductionExportDetailCmd(Map params, User user) { - this.user = user; - this.params = params; - } - - @Override - public BizLogContext getLogContext() { - return null; - } - - @Override - public XSSFWorkbook execute(CommandContext commandContext) { - AddUpDeductionQueryParam queryParam = (AddUpDeductionQueryParam) params.get("addUpDeductionQueryParam"); - EmployBiz employBiz = new EmployBiz(); - AddUpDeductionBiz biz = new AddUpDeductionBiz(); - - Long id = queryParam.getAccumulatedSpecialAdditionalDeductionId(); - if (id == null) { - throw new SalaryRunTimeException("id不能为空"); - } - - AddUpDeduction po = biz.getById(id); - if (po == null) { - throw new SalaryRunTimeException(String.format("累计专项附加扣除不存在"+"[id:%s]", id)); - } - - List employeeList = employBiz.getEmployeeByIds(Collections.singletonList(po.getEmployeeId())); - if (CollectionUtils.isEmpty(employeeList)) { - throw new SalaryRunTimeException("员工信息不存在"); - } - - //查询参数 - queryParam.setEmployeeId(po.getEmployeeId()); - //申报月份 - List declareMonth = queryParam.getDeclareMonth(); - if (CollectionUtils.isNotEmpty(declareMonth)) { - queryParam.setDeclareMonth(declareMonth.stream().map(e -> e + "-01 00:00:00").collect(Collectors.toList())); - } - - XSSFWorkbook workbook = biz.exportDetail(queryParam); - - return workbook; - } -} diff --git a/src/com/engine/salary/entity/datacollection/DataCollectionEmployee.java b/src/com/engine/salary/entity/datacollection/DataCollectionEmployee.java index efb57e7b3..7e74d2114 100644 --- a/src/com/engine/salary/entity/datacollection/DataCollectionEmployee.java +++ b/src/com/engine/salary/entity/datacollection/DataCollectionEmployee.java @@ -83,6 +83,8 @@ public class DataCollectionEmployee { @SalaryFormulaVar(defaultLabel = "出生日期", labelId = 98624, dataType = "string") private String birthday; + private String idNo; + //是否是系统管理员 private Boolean isAdmin; diff --git a/src/com/engine/salary/entity/datacollection/bo/DataCollectionBO.java b/src/com/engine/salary/entity/datacollection/bo/DataCollectionBO.java new file mode 100644 index 000000000..e216ddc7d --- /dev/null +++ b/src/com/engine/salary/entity/datacollection/bo/DataCollectionBO.java @@ -0,0 +1,52 @@ +package com.engine.salary.entity.datacollection.bo; + +/** + * @Description: 数据采集 + * @Author: wangxiangzhong + * @Date: 2021/11/29 13:28 + */ +public class DataCollectionBO { + + @Override + public String toString() { + return "DataCollectionBO{}"; + } + +// /** +// * 添加日期范围 +// * +// * @param weaSearchCondition +// * @param employeeId +// * @param tenantKey +// */ +// public static void addDatePickerRangeOtherParams(WeaSearchCondition weaSearchCondition, String datePickerKey, Long employeeId, String tenantKey) { +// WeaSearchConditionItem datePickerItem = weaSearchCondition.getItems().get(datePickerKey); +// Map otherParams = Maps.newHashMap(); +// otherParams.put("isRange", true); +// otherParams.put("type", "day"); +// otherParams.put("startPlaceholder", SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 90648, "开始日期")); +// otherParams.put("endPlaceholder", SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 90649, "结束日期")); +// datePickerItem.setOtherParams(otherParams); +// weaSearchCondition.getItems().put(datePickerKey, datePickerItem); +// } +// +// /** +// * 获取身份证号 +// * +// * @param employeeId +// * @param simpleUserInfos +// */ +// public static String getIdNo(Long employeeId, List simpleUserInfos) { +// if (employeeId == null || CollectionUtils.isEmpty(simpleUserInfos)) { +// return StringUtils.EMPTY; +// } +// Optional optionalSimpleUserInfo = simpleUserInfos.stream() +// .filter(simpleUserInfo -> Objects.nonNull(simpleUserInfo) && Objects.nonNull(simpleUserInfo.getUser())).findFirst(); +// String idNo = StringUtils.EMPTY; +// if (optionalSimpleUserInfo.isPresent()) { +// SimpleUserInfo simpleUserInfo = optionalSimpleUserInfo.get(); +// idNo = Optional.of(simpleUserInfo).map(SimpleUserInfo::getIdNo).orElse(StringUtils.EMPTY); +// } +// return idNo; +// } +} diff --git a/src/com/engine/salary/mapper/datacollection/AddUpDeductionMapper.xml b/src/com/engine/salary/mapper/datacollection/AddUpDeductionMapper.xml index b32b0ec09..d7c78f1a5 100644 --- a/src/com/engine/salary/mapper/datacollection/AddUpDeductionMapper.xml +++ b/src/com/engine/salary/mapper/datacollection/AddUpDeductionMapper.xml @@ -81,6 +81,7 @@ t1.declare_month, t1.employee_id, e.lastname as username, + e.certificatenum as idNo, d.departmentname AS departmentName, e.mobile, e.workcode as job_num, diff --git a/src/com/engine/salary/mapper/datacollection/EmployMapper.xml b/src/com/engine/salary/mapper/datacollection/EmployMapper.xml index 6ecdd03f3..0a1c8f9c3 100644 --- a/src/com/engine/salary/mapper/datacollection/EmployMapper.xml +++ b/src/com/engine/salary/mapper/datacollection/EmployMapper.xml @@ -30,6 +30,7 @@ e.lastname as username, e.status as status, e.workcode as workcode, + e.certificatenum as idNo, d.departmentname as departmentName, d.id as departmentId, c.jobtitlename as jobtitleName, @@ -81,6 +82,7 @@ select e.id as employeeId, e.lastname as username, e.status as status, + e.certificatenum as idNo, e.workcode as workcode, d.departmentname as departmentName, d.id as departmentId, @@ -132,6 +134,7 @@ select e.id as employeeId, e.lastname as username, e.status as status, + e.certificatenum as idNo, e.workcode as workcode, d.departmentname as departmentName, d.id as departmentId, @@ -189,6 +192,7 @@ e.lastname as username, e.status as status, e.workcode as workcode, + e.certificatenum as idNo, d.departmentname as departmentName, d.id as departmentId, c.jobtitlename as jobtitleName, @@ -207,7 +211,7 @@ select d.subcompanyname as name, - d.id as id + d.id as id from hrmsubcompany d where 1=1 diff --git a/src/com/engine/salary/service/AddUpDeductionService.java b/src/com/engine/salary/service/AddUpDeductionService.java index fe4934ea1..1d478b8a5 100644 --- a/src/com/engine/salary/service/AddUpDeductionService.java +++ b/src/com/engine/salary/service/AddUpDeductionService.java @@ -4,6 +4,7 @@ import com.engine.salary.entity.datacollection.AddUpDeduction; import com.engine.salary.entity.datacollection.dto.AddUpDeductionDTO; import com.engine.salary.entity.datacollection.dto.AddUpDeductionRecordDTO; import com.engine.salary.entity.datacollection.param.AddUpDeductionQueryParam; +import com.engine.salary.entity.salaryacct.po.SalaryAcctEmployeePO; import com.engine.salary.util.page.PageInfo; import org.apache.poi.xssf.usermodel.XSSFWorkbook; @@ -13,18 +14,16 @@ import java.util.Map; public interface AddUpDeductionService { - Map list(Map params); Map getSearchCondition(Map params); Map importAddUpDeduction(Map params); - Map getDetailList(Map params); Map preview(Map params); - XSSFWorkbook downloadTemplate(AddUpDeductionQueryParam queryParam); + XSSFWorkbook downloadTemplate(boolean isChief,AddUpDeductionQueryParam queryParam); @@ -44,19 +43,17 @@ public interface AddUpDeductionService { * 数据采集-累计专项附加扣除列表(分页) * * @param queryParam - * @param employeeId * @return */ - PageInfo listPage(AddUpDeductionQueryParam queryParam, Long employeeId); + PageInfo listPage(AddUpDeductionQueryParam queryParam); /** * 获取数据采集-累计专项附加扣除详情列表(分页) * * @param queryParam - * @param employeeId * @return */ - PageInfo recordListPage(AddUpDeductionQueryParam queryParam, Long employeeId); + PageInfo recordListPage(AddUpDeductionQueryParam queryParam); /** * 导出 @@ -90,5 +87,5 @@ public interface AddUpDeductionService { * @param yearMonth * @return */ -// List getAccountedEmployeeData(String yearMonth); + List getAccountedEmployeeData(String yearMonth); } diff --git a/src/com/engine/salary/service/impl/AddUpDeductionServiceImpl.java b/src/com/engine/salary/service/impl/AddUpDeductionServiceImpl.java index 063effbf5..426173f86 100644 --- a/src/com/engine/salary/service/impl/AddUpDeductionServiceImpl.java +++ b/src/com/engine/salary/service/impl/AddUpDeductionServiceImpl.java @@ -1,17 +1,24 @@ package com.engine.salary.service.impl; +import com.engine.common.util.ServiceUtil; import com.engine.core.impl.Service; import com.engine.salary.biz.AddUpDeductionBiz; import com.engine.salary.biz.EmployBiz; -import com.engine.salary.cmd.datacollection.*; +import com.engine.salary.cmd.datacollection.AddUpDeductionGetSearchConditionCmd; +import com.engine.salary.cmd.datacollection.AddUpDeductionImportCmd; +import com.engine.salary.cmd.datacollection.AddUpDeductionPreviewCmd; +import com.engine.salary.common.LocalDateRange; import com.engine.salary.entity.datacollection.AddUpDeduction; import com.engine.salary.entity.datacollection.DataCollectionEmployee; import com.engine.salary.entity.datacollection.dto.AddUpDeductionDTO; import com.engine.salary.entity.datacollection.dto.AddUpDeductionRecordDTO; import com.engine.salary.entity.datacollection.param.AddUpDeductionQueryParam; +import com.engine.salary.entity.salaryacct.po.SalaryAcctEmployeePO; +import com.engine.salary.entity.salaryacct.po.SalaryAcctRecordPO; import com.engine.salary.entity.taxagent.bo.TaxAgentBO; import com.engine.salary.entity.taxagent.dto.TaxAgentEmployeeDTO; import com.engine.salary.entity.taxagent.po.TaxAgentPO; +import com.engine.salary.enums.salaryaccounting.SalaryAcctRecordStatusEnum; import com.engine.salary.exception.SalaryRunTimeException; import com.engine.salary.mapper.datacollection.AddUpDeductionMapper; import com.engine.salary.service.*; @@ -26,8 +33,10 @@ import com.google.common.collect.Lists; import org.apache.commons.collections4.CollectionUtils; import org.apache.poi.xssf.usermodel.XSSFWorkbook; import weaver.general.Util; +import weaver.hrm.User; import java.text.SimpleDateFormat; +import java.time.LocalDate; import java.time.YearMonth; import java.util.*; import java.util.stream.Collectors; @@ -38,15 +47,20 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction return MapperProxyFactory.getProxy(AddUpDeductionMapper.class); } - private TaxAgentV2Service taxAgentService; - private SalaryAcctRecordService salaryAcctRecordService; - private SalaryAcctEmployeeService salaryAcctEmployeeService; - private SalaryEmployeeService salaryEmployeeService; + private TaxAgentV2Service getTaxAgentV2Service(User user) { + return ServiceUtil.getService(TaxAgentV2ServiceImpl.class, user); + } + + private SalaryAcctRecordService getSalaryAcctRecordService(User user) { + return ServiceUtil.getService(SalaryAcctRecordServiceImpl.class, user); + } + private SalaryAcctEmployeeService getSalaryAcctEmployeeService(User user) { + return ServiceUtil.getService(SalaryAcctEmployeeServiceImpl.class, user); + } - @Override - public Map list(Map params) { - return commandExecutor.execute(new AddUpDeductionListCmd(params, user)); + private SalaryEmployeeService getSalaryEmployeeService(User user) { + return ServiceUtil.getService(SalaryEmployeeServiceImpl.class, user); } @Override @@ -59,10 +73,6 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction return commandExecutor.execute(new AddUpDeductionImportCmd(params, user)); } - @Override - public Map getDetailList(Map params) { - return commandExecutor.execute(new AddUpDeductionGetDetailListCmd(params, user)); - } @Override public Map preview(Map params) { @@ -76,6 +86,8 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction * @return */ public XSSFWorkbook exportDetail(Long beLongEmployeeId, boolean isChief, AddUpDeductionQueryParam queryParam) { + queryParam.setEmployeeId(beLongEmployeeId); + EmployBiz employBiz = new EmployBiz(); AddUpDeductionBiz biz = new AddUpDeductionBiz(); @@ -149,9 +161,9 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction // 开启分权并且不是薪酬模块总管理员 - if (taxAgentService.isOpenDevolution() && !isChief) { - List taxAgentEmployees = taxAgentService.listTaxAgentAndEmployee(employeeId); - List taxAgentIdsAsAdmin = taxAgentService.listAllTaxAgentsAsAdmin(employeeId).stream().map(TaxAgentPO::getId).collect(Collectors.toList()); + if (getTaxAgentV2Service(user).isOpenDevolution() && !isChief) { + List taxAgentEmployees = getTaxAgentV2Service(user).listTaxAgentAndEmployee(employeeId); + List taxAgentIdsAsAdmin = getTaxAgentV2Service(user).listAllTaxAgentsAsAdmin(employeeId).stream().map(TaxAgentPO::getId).collect(Collectors.toList()); // List lastList = getLastListByModifier(employeeId, tenantKey); list = list.stream().filter(f -> // 作为管理员 @@ -181,7 +193,7 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction } @Override - public XSSFWorkbook downloadTemplate(AddUpDeductionQueryParam queryParam) { + public XSSFWorkbook downloadTemplate(boolean isChief,AddUpDeductionQueryParam queryParam) { String sheetName = SalaryI18nUtil.getI18nLabel(101603, "累计专项附加扣除导入模板"); String[] header = { @@ -277,16 +289,17 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction // } @Override - public PageInfo listPage(AddUpDeductionQueryParam queryParam, Long employeeId) { + public PageInfo listPage(AddUpDeductionQueryParam queryParam) { + long employeeId = (long)user.getUID(); // 未开启分权或是薪酬模块总管理员 - if (!taxAgentService.isOpenDevolution() || taxAgentService.isChief(employeeId)) { + if (!getTaxAgentV2Service(user).isOpenDevolution() || getTaxAgentV2Service(user).isChief(employeeId)) { SalaryPageUtil.start(queryParam.getCurrent(), queryParam.getPageSize()); List list = getAddUpDeductionMapper().list(queryParam); return new PageInfo<>(list, AddUpDeductionDTO.class); } else { - List taxAgentEmployees = taxAgentService.listTaxAgentAndEmployee(employeeId); - List taxAgentIdsAsAdmin = taxAgentService.listAllTaxAgentsAsAdmin(employeeId).stream().map(TaxAgentPO::getId).collect(Collectors.toList()); + List taxAgentEmployees = getTaxAgentV2Service(user).listTaxAgentAndEmployee(employeeId); + List taxAgentIdsAsAdmin = getTaxAgentV2Service(user).listAllTaxAgentsAsAdmin(employeeId).stream().map(TaxAgentPO::getId).collect(Collectors.toList()); // List lastList = getLastListByModifier(employeeId); List list = getAddUpDeductionMapper().list(queryParam); list = list.stream().filter(f -> @@ -307,15 +320,16 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction } @Override - public PageInfo recordListPage(AddUpDeductionQueryParam queryParam, Long employeeId) { + public PageInfo recordListPage(AddUpDeductionQueryParam queryParam) { + long employeeId = (long)user.getUID(); // 未开启分权或是薪酬模块总管理员 - if (!taxAgentService.isOpenDevolution() || taxAgentService.isChief(employeeId)) { + if (!getTaxAgentV2Service(user).isOpenDevolution() || getTaxAgentV2Service(user).isChief(employeeId)) { SalaryPageUtil.start(queryParam.getCurrent(), queryParam.getPageSize()); List list = getAddUpDeductionMapper().recordList(queryParam); return new PageInfo<>(list, AddUpDeductionRecordDTO.class); } else { - List taxAgentEmployees = taxAgentService.listTaxAgentAndEmployee(employeeId); - List taxAgentIdsAsAdmin = taxAgentService.listAllTaxAgentsAsAdmin(employeeId).stream().map(TaxAgentPO::getId).collect(Collectors.toList()); + List taxAgentEmployees = getTaxAgentV2Service(user).listTaxAgentAndEmployee(employeeId); + List taxAgentIdsAsAdmin = getTaxAgentV2Service(user).listAllTaxAgentsAsAdmin(employeeId).stream().map(TaxAgentPO::getId).collect(Collectors.toList()); // List lastList = getLastListByModifier(employeeId, tenantKey); List list = getAddUpDeductionMapper().recordList(queryParam); list = list.stream().filter(f -> @@ -361,9 +375,9 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction List list = new AddUpDeductionBiz().list(param); // 开启分权并且不是薪酬模块总管理员 - if (taxAgentService.isOpenDevolution() && !isChief) { - List taxAgentEmployees = taxAgentService.listTaxAgentAndEmployee(employeeId); - List taxAgentIdsAsAdmin = taxAgentService.listAllTaxAgentsAsAdmin(employeeId).stream().map(TaxAgentPO::getId).collect(Collectors.toList()); + if (getTaxAgentV2Service(user).isOpenDevolution() && !isChief) { + List taxAgentEmployees = getTaxAgentV2Service(user).listTaxAgentAndEmployee(employeeId); + List taxAgentIdsAsAdmin = getTaxAgentV2Service(user).listAllTaxAgentsAsAdmin(employeeId).stream().map(TaxAgentPO::getId).collect(Collectors.toList()); // List lastList = getLastListByModifier(employeeId); list = list.stream().filter(f -> // 作为管理员 @@ -405,4 +419,25 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction } + /** + * 根据年月获取已核算数据 + * + * @param yearMonth + * @return + */ + @Override + public List getAccountedEmployeeData(String yearMonth) { + List list = Lists.newArrayList(); + LocalDate salaryMonthDate = LocalDate.parse(yearMonth+"-01", SalaryDateUtil.DATE_FORMATTER); + List salaryAcctRecords = getSalaryAcctRecordService(user).listBySalaryMonth(LocalDateRange.builder().fromDate(SalaryDateUtil.localDateToDate(salaryMonthDate)).endDate(SalaryDateUtil.localDateToDate(salaryMonthDate)).build()); + salaryAcctRecords.forEach(e->{ + boolean isAccounted = e.getStatus() > SalaryAcctRecordStatusEnum.NOT_ARCHIVED.getValue(); + if (isAccounted) { + list.addAll(getSalaryAcctEmployeeService(user).listBySalaryAcctRecordIds(Collections.singleton(salaryAcctRecords.get(0).getId()))); + } + }); + + return list; + } + } diff --git a/src/com/engine/salary/web/AddUpDeductionController.java b/src/com/engine/salary/web/AddUpDeductionController.java index d9d4d2fd3..e085fcbf9 100644 --- a/src/com/engine/salary/web/AddUpDeductionController.java +++ b/src/com/engine/salary/web/AddUpDeductionController.java @@ -2,11 +2,13 @@ package com.engine.salary.web; import com.engine.common.util.ParamUtil; import com.engine.common.util.ServiceUtil; +import com.engine.salary.entity.datacollection.dto.AddUpDeductionDTO; +import com.engine.salary.entity.datacollection.dto.AddUpDeductionRecordDTO; import com.engine.salary.entity.datacollection.param.AddUpDeductionImportParam; import com.engine.salary.entity.datacollection.param.AddUpDeductionQueryParam; -import com.engine.salary.service.AddUpDeductionService; -import com.engine.salary.service.impl.AddUpDeductionServiceImpl; import com.engine.salary.util.ResponseResult; +import com.engine.salary.util.page.PageInfo; +import com.engine.salary.wrapper.AddUpDeductionWrapper; import io.swagger.v3.oas.annotations.parameters.RequestBody; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; @@ -39,8 +41,8 @@ import java.util.stream.Collectors; @Slf4j public class AddUpDeductionController { - private AddUpDeductionService getService(User user) { - return (AddUpDeductionService) ServiceUtil.getService(AddUpDeductionServiceImpl.class, user); + private AddUpDeductionWrapper getAddUpDeductionWrapper(User user) { + return ServiceUtil.getService(AddUpDeductionWrapper.class, user); } /** @@ -53,7 +55,7 @@ public class AddUpDeductionController { @Produces(MediaType.APPLICATION_JSON) public String getSearchCondition(@Context HttpServletRequest request, @Context HttpServletResponse response) { User user = HrmUserVarify.getUser(request, response); - return new ResponseResult, Map>(user).run(getService(user)::getSearchCondition, ParamUtil.request2Map(request)); + return new ResponseResult, Map>(user).run(getAddUpDeductionWrapper(user)::getSearchCondition, ParamUtil.request2Map(request)); } @@ -62,9 +64,7 @@ public class AddUpDeductionController { @Produces(MediaType.APPLICATION_JSON) public String list(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody AddUpDeductionQueryParam queryParam) { User user = HrmUserVarify.getUser(request, response); - Map map = ParamUtil.request2Map(request); - map.put("queryParam", queryParam); - return new ResponseResult, Map>(user).run(getService(user)::list, map); + return new ResponseResult>(user).run(getAddUpDeductionWrapper(user)::list, queryParam); } @@ -75,7 +75,7 @@ public class AddUpDeductionController { try { User user = HrmUserVarify.getUser(request, response); AddUpDeductionQueryParam queryParam = buildParam(request); - XSSFWorkbook workbook = getService(user).downloadTemplate(queryParam); + XSSFWorkbook workbook = getAddUpDeductionWrapper(user).downloadTemplate(queryParam); String fileName = "累计专项附加扣除导入模板" + LocalDate.now(); try { fileName = URLEncoder.encode(fileName + ".xlsx", "UTF-8"); @@ -112,10 +112,7 @@ public class AddUpDeductionController { AddUpDeductionQueryParam param = buildParam(request); - Map map = ParamUtil.request2Map(request); - map.put("addUpDeductionQueryParam", param); - - XSSFWorkbook workbook = getService(user).export(map); + XSSFWorkbook workbook = getAddUpDeductionWrapper(user).export(param); String fileName = "累计专项附加扣除" + LocalDate.now(); try { @@ -150,7 +147,7 @@ public class AddUpDeductionController { AddUpDeductionQueryParam param = buildParam(request); - XSSFWorkbook workbook = getService(user).exportDetail(param); + XSSFWorkbook workbook = getAddUpDeductionWrapper(user).exportDetail(param); String fileName = "累计专项附加扣除明细" + LocalDate.now(); try { @@ -251,7 +248,7 @@ public class AddUpDeductionController { User user = HrmUserVarify.getUser(request, response); Map map = ParamUtil.request2Map(request); map.put("importParam", importParam); - return new ResponseResult, Map>(user).run(getService(user)::preview, map); + return new ResponseResult, Map>(user).run(getAddUpDeductionWrapper(user)::preview, map); } @POST @@ -261,7 +258,7 @@ public class AddUpDeductionController { User user = HrmUserVarify.getUser(request, response); Map map = ParamUtil.request2Map(request); map.put("importParam", importParam); - return new ResponseResult, Map>(user).run(getService(user)::importAddUpDeduction, map); + return new ResponseResult, Map>(user).run(getAddUpDeductionWrapper(user)::importAddUpDeduction, map); } @POST @@ -269,9 +266,7 @@ public class AddUpDeductionController { @Produces(MediaType.APPLICATION_JSON) public String getDetailList(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody AddUpDeductionQueryParam queryParam) { User user = HrmUserVarify.getUser(request, response); - Map map = ParamUtil.request2Map(request); - map.put("queryParam", queryParam); - return new ResponseResult, Map>(user).run(getService(user)::getDetailList, map); + return new ResponseResult>(user).run(getAddUpDeductionWrapper(user)::getDetailList, queryParam); } diff --git a/src/com/engine/salary/wrapper/AddUpDeductionWrapper.java b/src/com/engine/salary/wrapper/AddUpDeductionWrapper.java index 987ef42c4..96d7834d3 100644 --- a/src/com/engine/salary/wrapper/AddUpDeductionWrapper.java +++ b/src/com/engine/salary/wrapper/AddUpDeductionWrapper.java @@ -1,36 +1,29 @@ package com.engine.salary.wrapper; +import com.engine.common.util.ServiceUtil; +import com.engine.core.impl.Service; +import com.engine.salary.entity.datacollection.AddUpDeduction; import com.engine.salary.entity.datacollection.dto.AddUpDeductionDTO; +import com.engine.salary.entity.datacollection.dto.AddUpDeductionRecordDTO; import com.engine.salary.entity.datacollection.param.AddUpDeductionQueryParam; +import com.engine.salary.exception.SalaryRunTimeException; import com.engine.salary.service.AddUpDeductionService; import com.engine.salary.service.SalaryEmployeeService; import com.engine.salary.service.TaxAgentV2Service; +import com.engine.salary.service.impl.AddUpDeductionServiceImpl; +import com.engine.salary.service.impl.SalaryEmployeeServiceImpl; +import com.engine.salary.service.impl.TaxAgentV2ServiceImpl; +import com.engine.salary.util.SalaryI18nUtil; import com.engine.salary.util.page.PageInfo; -import com.weaver.common.authority.format.FormatManager; -import com.weaver.common.component.table.WeaTable; -import com.weaver.common.component.table.page.Page; -import com.weaver.datasecurity.interceptor.DSTenantKeyThreadVar; -import com.weaver.framework.rpc.context.impl.TenantRpcContext; -import com.weaver.hrm.salary.common.excel.ExcelImportParam; -import com.weaver.hrm.salary.entity.datacollection.bo.DataCollectionBO; -import com.weaver.hrm.salary.entity.datacollection.dto.AddUpDeductionListDTO; -import com.weaver.hrm.salary.entity.datacollection.dto.AddUpDeductionRecordDTO; -import com.weaver.hrm.salary.entity.datacollection.po.AddUpDeductionPO; -import com.weaver.hrm.salary.exception.SalaryRunTimeException; -import com.weaver.hrm.salary.util.SalaryI18nUtil; -import com.weaver.teams.domain.hr.SimpleUserInfo; -import com.weaver.teams.security.context.TenantContext; -import com.weaver.teams.security.context.UserContext; import org.apache.commons.collections4.CollectionUtils; -import org.springframework.stereotype.Component; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; +import weaver.general.Util; +import weaver.hrm.User; -import java.time.LocalDate; import java.util.List; import java.util.Map; import java.util.stream.Collectors; -import static weaver.formmode.modesetdelete.DeleteItemType.page; - /** * 累计专项附加扣除 *

Copyright: Copyright (c) 2022

@@ -39,12 +32,19 @@ import static weaver.formmode.modesetdelete.DeleteItemType.page; * @author qiantao * @version 1.0 **/ -@Component -public class AddUpDeductionWrapper { +public class AddUpDeductionWrapper extends Service { - private AddUpDeductionService addUpDeductionService; - private TaxAgentV2Service taxAgentService; - private SalaryEmployeeService salaryEmployeeService; + private AddUpDeductionService getAddUpDeductionService(User user) { + return ServiceUtil.getService(AddUpDeductionServiceImpl.class, user); + } + + private TaxAgentV2Service getTaxAgentService(User user) { + return ServiceUtil.getService(TaxAgentV2ServiceImpl.class, user); + } + + private SalaryEmployeeService getSalaryEmployeeService(User user) { + return ServiceUtil.getService(SalaryEmployeeServiceImpl.class, user); + } /** @@ -61,129 +61,94 @@ public class AddUpDeductionWrapper { queryParam.setDeclareMonth(declareMonth.stream().map(e -> e + "-01 00:00:00").collect(Collectors.toList())); } - page = addUpDeductionService.listPage(page, queryParam); - List list = page.getRecords(); - List simpleUserInfos = salaryEmployeeService.listByEmployeeIds(list.stream().map(AddUpDeductionListDTO::getEmployeeId).collect(Collectors.toList()), currentTenantKey); + PageInfo pageInfo = getAddUpDeductionService(user).listPage(queryParam); + List list = pageInfo.getList(); // 人员信息赋值 list.forEach(m -> { // 身份证号 - m.setIdNo(DataCollectionBO.getIdNo(m.getEmployeeId(), simpleUserInfos)); + m.setIdNo(Util.null2String(m.getIdNo())); }); - WeaTable weaTable = FormatManager.getInstance().genTable(AddUpDeductionListDTO.class, page); - weaTable.setModule("hrmsalary"); - // 在外展示操作按钮 - weaTable.getOperates().get(0).setOuter(Boolean.TRUE); - - return weaTable; + return pageInfo; } /** * 数据采集-累计专项附加扣除详情列表(分页) * * @param queryParam - * @param currentEmployeeId - * @param currentTenantKey * @return */ - public WeaTable getDetailList(AddUpDeductionQueryParam queryParam, Long currentEmployeeId, String currentTenantKey) { + public PageInfo getDetailList(AddUpDeductionQueryParam queryParam) { Long id = queryParam.getAccumulatedSpecialAdditionalDeductionId(); - AddUpDeductionPO po = addUpDeductionService.getById(id, currentTenantKey); + AddUpDeduction po = getAddUpDeductionService(user).getById(id); if (po == null) { - throw new SalaryRunTimeException(String.format(SalaryI18nUtil.getI18nLabel(currentTenantKey, currentEmployeeId, 100338, "累计专项附加扣除不存在") + "[id:%s]", id)); + throw new SalaryRunTimeException(String.format(SalaryI18nUtil.getI18nLabel(100338, "累计专项附加扣除不存在") + "[id:%s]", id)); } - queryParam.setDeclareMonthDate(CollectionUtils.emptyIfNull(queryParam.getDeclareMonth()).stream().map(e -> LocalDate.of(e.getYear(), e.getMonthValue(), 1)).collect(Collectors.toList())); - queryParam.setEmployeeId(po.getEmployeeId()); - Page page = new Page<>(queryParam.getCurrent(), queryParam.getPageSize(), true); - page = addUpDeductionService.recordListPage(page, queryParam, currentEmployeeId, currentTenantKey); - // 记录表格 - WeaTable weaTable = FormatManager.getInstance() - .genTable(AddUpDeductionRecordDTO.class, page); - weaTable.setModule("hrmsalary"); - return weaTable; + //申报月份 + List declareMonth = queryParam.getDeclareMonth(); + if (CollectionUtils.isNotEmpty(declareMonth)) { + queryParam.setDeclareMonth(declareMonth.stream().map(e -> e + "-01 00:00:00").collect(Collectors.toList())); + } + queryParam.setEmployeeId(po.getEmployeeId()); + + PageInfo page = getAddUpDeductionService(user).recordListPage(queryParam); + + return page; } + /** * 导出-累计专项附加扣除列表 * * @param queryParam - * @param currentEmployeeId - * @param currentTenantKey * @return */ - public Map export(AddUpDeductionQueryParam queryParam, Long currentEmployeeId, String currentTenantKey) { - // 构建异步导出参数 - Map map = salaryBatchService.buildeExportParam("exportAddUpDeduction"); - - String username = UserContext.getCurrentUser().getUsername(); - String eteamsId = TenantRpcContext.getEteamsId(); - boolean isChief = taxAgentService.isChief(currentEmployeeId, currentTenantKey); - taskExecutor.execute(() -> { - try { - DSTenantKeyThreadVar.tenantKey.set(currentTenantKey); - addUpDeductionService.export(map, username, eteamsId, isChief, queryParam, currentEmployeeId, currentTenantKey); - } finally { - DSTenantKeyThreadVar.tenantKey.remove(); - } - }); - return map; + public XSSFWorkbook export(AddUpDeductionQueryParam queryParam) { + boolean isChief = getTaxAgentService(user).isChief((long) user.getUID()); + return getAddUpDeductionService(user).export(isChief, queryParam); } /** * 导出-累计专项附加扣除详情列表 * * @param queryParam - * @param currentEmployeeId - * @param currentTenantKey * @return */ - public Map exportDetail(AddUpDeductionQueryParam queryParam, Long currentEmployeeId, String currentTenantKey) { + public XSSFWorkbook exportDetail(AddUpDeductionQueryParam queryParam) { Long id = queryParam.getAccumulatedSpecialAdditionalDeductionId(); - AddUpDeductionPO po = addUpDeductionService.getById(id, currentTenantKey); + AddUpDeduction po = getAddUpDeductionService(user).getById(id); if (po == null) { - throw new SalaryRunTimeException(String.format(SalaryI18nUtil.getI18nLabel(currentTenantKey, currentEmployeeId, 100338, "累计专项附加扣除不存在") + "[id:%s]", id)); + throw new SalaryRunTimeException(String.format(SalaryI18nUtil.getI18nLabel(100338, "累计专项附加扣除不存在") + "[id:%s]", id)); } - boolean isChief = taxAgentService.isChief(currentEmployeeId, currentTenantKey); - // 构建异步导出参数 - Map map = salaryBatchService.buildeExportParam("exportAddUpDeductionDetail"); + boolean isChief = getTaxAgentService(user).isChief((long) user.getUID()); - String username = UserContext.getCurrentUser().getUsername(); - String eteamsId = TenantRpcContext.getEteamsId(); - taskExecutor.execute(() -> { - try { - DSTenantKeyThreadVar.tenantKey.set(currentTenantKey); - addUpDeductionService.exportDetail(map, username, eteamsId, po.getEmployeeId(), isChief, queryParam, currentEmployeeId, currentTenantKey); - } finally { - DSTenantKeyThreadVar.tenantKey.remove(); - } - }); - return map; + return getAddUpDeductionService(user).exportDetail(po.getEmployeeId(), isChief, queryParam); } /** * 下载导入模板 * * @param queryParam - * @param currentEmployeeId - * @param currentTenantKey * @return */ - public Map downloadTemplate(AddUpDeductionQueryParam queryParam, Long currentEmployeeId, String currentTenantKey) { + public XSSFWorkbook downloadTemplate(AddUpDeductionQueryParam queryParam) { // 构建异步导出参数 - Map map = salaryBatchService.buildeExportParam("exportAddUpDeduction"); - boolean isChief = taxAgentService.isChief(currentEmployeeId, currentTenantKey); - String username = UserContext.getCurrentUser().getUsername(); - String eteamsId = TenantRpcContext.getEteamsId(); - taskExecutor.execute(() -> { - try { - DSTenantKeyThreadVar.tenantKey.set(currentTenantKey); - addUpDeductionService.downloadTemplate(map, username, eteamsId, isChief, queryParam, currentEmployeeId, currentTenantKey); - } finally { - DSTenantKeyThreadVar.tenantKey.remove(); - } - }); - return map; + boolean isChief = getTaxAgentService(user).isChief((long) user.getUID()); + return getAddUpDeductionService(user).downloadTemplate(isChief, queryParam); } + + public Map importAddUpDeduction(Map params) { + return getAddUpDeductionService(user).importAddUpDeduction(params); + } + + + public Map preview(Map params) { + return getAddUpDeductionService(user).preview(params); + } + + public Map getSearchCondition(Map params) { + return getAddUpDeductionService(user).getSearchCondition(params); + } } From f6eb69e62abff2abf9ac7ff8477df56988a43c76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=92=B1=E6=B6=9B?= <15850646081@163.com> Date: Thu, 26 May 2022 11:02:55 +0800 Subject: [PATCH 12/20] =?UTF-8?q?=E6=9A=82=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- resource/sql/分权.sql | 7 +- .../param/AttendQuoteCheckOperationParam.java | 32 +++ .../entity/salarysob/po/SalarySobPO.java | 7 + .../taxagent/param/TaxAgentSaveParam.java | 4 +- .../taxagent/po/TaxAgentEmployeePO.java | 2 +- .../salaryacct/SalaryAcctResultMapper.java | 1 - .../mapper/salarysob/SalarySobMapper.java | 15 -- .../mapper/salarysob/SalarySobMapper.xml | 48 ++-- .../salary/mapper/taxagent/TaxAgentMapper.xml | 2 +- .../salary/service/SalarySobService.java | 13 +- .../impl/AddUpDeductionServiceImpl.java | 237 +++++++++--------- .../service/impl/SalarySobServiceImpl.java | 4 - .../service/impl/TaxAgentV2ServiceImpl.java | 27 +- .../salary/web/AttendQuoteController.java | 15 ++ .../salary/wrapper/AttendQuoteWrapper.java | 9 +- 15 files changed, 227 insertions(+), 196 deletions(-) create mode 100644 src/com/engine/salary/entity/datacollection/param/AttendQuoteCheckOperationParam.java diff --git a/resource/sql/分权.sql b/resource/sql/分权.sql index 00629e0ce..66283c1d3 100644 --- a/resource/sql/分权.sql +++ b/resource/sql/分权.sql @@ -125,5 +125,10 @@ CREATE TABLE hrsa_tax_agent_sub_admin_emp INDEX idx_tax_agent(tax_agent_id) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; -ALTER TABLE hrsa_add_up_deduction ADD COLUMN payment_agency varchar(255) NULL COMMENT '代缴机构' AFTER tenant_key; + + +ALTER TABLE hrsa_tax_agent ADD COLUMN payment_agency varchar(255) NULL COMMENT '代缴机构' AFTER tenant_key; + + +ALTER TABLE hrsa_salary_sob ADD COLUMN tax_agent_id bigint(0) NULL COMMENT '个税扣缴义务人的主键id' AFTER tenant_key; diff --git a/src/com/engine/salary/entity/datacollection/param/AttendQuoteCheckOperationParam.java b/src/com/engine/salary/entity/datacollection/param/AttendQuoteCheckOperationParam.java new file mode 100644 index 000000000..1efec4268 --- /dev/null +++ b/src/com/engine/salary/entity/datacollection/param/AttendQuoteCheckOperationParam.java @@ -0,0 +1,32 @@ +package com.engine.salary.entity.datacollection.param; + +import com.engine.salary.util.valid.DataCheck; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.time.YearMonth; + +/** + * 考勤引用是否可以操作参数 + *

Copyright: Copyright (c) 2022

+ *

Company: 泛微软件

+ * + * @author qiantao + * @version 1.0 + **/ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class AttendQuoteCheckOperationParam { + + //薪资所属月 + @DataCheck(require = true, message = "薪资所属月必传") + private YearMonth salaryYearMonth; + + //关联账套id + @DataCheck(require = true, message = "关联账套id必传") + private Long salarySobId; +} diff --git a/src/com/engine/salary/entity/salarysob/po/SalarySobPO.java b/src/com/engine/salary/entity/salarysob/po/SalarySobPO.java index 18a01d44e..921fad01c 100644 --- a/src/com/engine/salary/entity/salarysob/po/SalarySobPO.java +++ b/src/com/engine/salary/entity/salarysob/po/SalarySobPO.java @@ -27,6 +27,12 @@ public class SalarySobPO { * 名称 */ private String name; + + /** + * 个税扣缴义务人的主键id + */ + private Long taxAgentId; + /** * 应税项目。1:正常工资薪金所得 */ @@ -85,5 +91,6 @@ public class SalarySobPO { private String tenantKey; Collection ids; + Collection taxAgentIds; } \ No newline at end of file diff --git a/src/com/engine/salary/entity/taxagent/param/TaxAgentSaveParam.java b/src/com/engine/salary/entity/taxagent/param/TaxAgentSaveParam.java index 747418046..2b51d1065 100644 --- a/src/com/engine/salary/entity/taxagent/param/TaxAgentSaveParam.java +++ b/src/com/engine/salary/entity/taxagent/param/TaxAgentSaveParam.java @@ -7,6 +7,8 @@ import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; +import java.util.List; + /** * 个税扣缴义务人保存参数 *

Copyright: Copyright (c) 2022

@@ -30,7 +32,7 @@ public class TaxAgentSaveParam { private String name; //管理员主键id - private Long adminUserId; + private List adminUserIds; //代缴机构 private String paymentAgency; diff --git a/src/com/engine/salary/entity/taxagent/po/TaxAgentEmployeePO.java b/src/com/engine/salary/entity/taxagent/po/TaxAgentEmployeePO.java index f5c789c82..8b4adfcf6 100644 --- a/src/com/engine/salary/entity/taxagent/po/TaxAgentEmployeePO.java +++ b/src/com/engine/salary/entity/taxagent/po/TaxAgentEmployeePO.java @@ -34,7 +34,7 @@ public class TaxAgentEmployeePO { private String status; //人事状态") - private String personnelStatus; +// private String personnelStatus; private Collection ids; } diff --git a/src/com/engine/salary/mapper/salaryacct/SalaryAcctResultMapper.java b/src/com/engine/salary/mapper/salaryacct/SalaryAcctResultMapper.java index 736956ac5..a2f9e1f58 100644 --- a/src/com/engine/salary/mapper/salaryacct/SalaryAcctResultMapper.java +++ b/src/com/engine/salary/mapper/salaryacct/SalaryAcctResultMapper.java @@ -85,7 +85,6 @@ public interface SalaryAcctResultMapper { * 根据薪资核算id删除薪资核算结果 * * @param salaryAcctRecordIds - * @param tenantKey */ void deleteBySalaryAcctRecordIds(@Param("salaryAcctRecordIds") Collection salaryAcctRecordIds); diff --git a/src/com/engine/salary/mapper/salarysob/SalarySobMapper.java b/src/com/engine/salary/mapper/salarysob/SalarySobMapper.java index bd5aa6fc3..12aa1e901 100644 --- a/src/com/engine/salary/mapper/salarysob/SalarySobMapper.java +++ b/src/com/engine/salary/mapper/salarysob/SalarySobMapper.java @@ -39,13 +39,6 @@ public interface SalarySobMapper { */ int insertIgnoreNull(SalarySobPO SalarySobPO); - /** - * 修改,修改所有字段 - * - * @param SalarySobPO 修改的记录 - * @return 返回影响行数 - */ - int update(SalarySobPO SalarySobPO); /** * 修改,忽略null字段 @@ -55,14 +48,6 @@ public interface SalarySobMapper { */ int updateIgnoreNull(SalarySobPO SalarySobPO); - /** - * 删除记录 - * - * @param SalarySobPO 待删除的记录 - * @return 返回影响行数 - */ - int delete(SalarySobPO SalarySobPO); - void deleteByIds(@Param("ids") Collection ids); List listByParam(@Param("param") SalarySobPO SalarySobPO); diff --git a/src/com/engine/salary/mapper/salarysob/SalarySobMapper.xml b/src/com/engine/salary/mapper/salarysob/SalarySobMapper.xml index 2d017688a..ac7bf5054 100644 --- a/src/com/engine/salary/mapper/salarysob/SalarySobMapper.xml +++ b/src/com/engine/salary/mapper/salarysob/SalarySobMapper.xml @@ -18,6 +18,7 @@ + @@ -40,6 +41,7 @@ , t.update_time , t.delete_type , t.tenant_key + , t.tax_agent_id @@ -118,6 +120,12 @@ #{id}
+ + AND tax_agent_id IN + + #{taxAgentId} + + ORDER BY id DESC @@ -177,6 +185,9 @@ tenant_key, + + tax_agent_id, + @@ -227,32 +238,12 @@ #{tenantKey}, + + #{taxAgentId}, + - - - UPDATE hrsa_salary_sob - - name=#{name}, - income_category=#{incomeCategory}, - salary_cycle_type=#{salaryCycleType}, - salary_cycle_from_day=#{salaryCycleFromDay}, - tax_cycle_type=#{taxCycleType}, - attend_cycle_type=#{attendCycleType}, - attend_cycle_from_day=#{attendCycleFromDay}, - social_security_cycle_type=#{socialSecurityCycleType}, - disable=#{disable}, - description=#{description}, - creator=#{creator}, - create_time=#{createTime}, - update_time=#{updateTime}, - delete_type=#{deleteType}, - tenant_key=#{tenantKey}, - - WHERE id = #{id} AND delete_type = 0 - - @@ -303,19 +294,14 @@ tenant_key=#{tenantKey}, + + tax_agent_id=#{taxAgentId}, + WHERE id = #{id} AND delete_type = 0 - - - UPDATE hrsa_salary_sob - SET delete_type=1 - WHERE id = #{id} - AND delete_type = 0 - - UPDATE hrsa_salary_sob SET delete_type = 1 diff --git a/src/com/engine/salary/mapper/taxagent/TaxAgentMapper.xml b/src/com/engine/salary/mapper/taxagent/TaxAgentMapper.xml index 458d253c2..25b1baffd 100644 --- a/src/com/engine/salary/mapper/taxagent/TaxAgentMapper.xml +++ b/src/com/engine/salary/mapper/taxagent/TaxAgentMapper.xml @@ -219,7 +219,7 @@