This commit is contained in:
钱涛 2022-05-18 09:19:50 +08:00
parent 27b04da333
commit fa4d605c8d
83 changed files with 7440 additions and 13 deletions

89
resource/sql/分权.sql Normal file
View File

@ -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;

View File

@ -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";
}

View File

@ -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<TaxAgentEmployeeDTO> 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<LinkedHashMap> weaTable, boolean isOpenDevolution, Long employeeId, String tenantKey, int size) {
// 表格表头
List<WeaTableColumn> 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<WeaTableOperate> 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<List<Permission>> getDefaultOperatesPermission(int operateSize, int recordSize) {
List<List<Permission>> permissionList = Lists.newArrayList();
for (int i = 0; i < recordSize; i++) {
List<Permission> permissions = Lists.newArrayList();
for (int j = 0; j < operateSize; j++) {
permissions.add(new Permission(true, false));
}
permissionList.add(permissions);
}
return permissionList;
}
private static List<Permission> getDefaultCheckBoxPermission(int recordSize) {
List<Permission> 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<TaxAgentListDTO> convertToListDTO(Collection<TaxAgentPO> 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<Map<String, Object>> convertToTableListDTO(List<TaxAgentPO> taxAgents, List<PaymentAgencyPO> paymentAgencyPOS, String setLabel) {
return convertToTableListDTO(Boolean.FALSE, taxAgents, paymentAgencyPOS, null, null, setLabel);
}
/**
* 表数据转列表数据
*
* @param taxAgents
* @return
*/
public static List<Map<String, Object>> convertToTableListDTO(List<TaxAgentPO> taxAgents, List<PaymentAgencyPO> paymentAgencyPOS, List<TaxAgentAdminPO> taxAgentAdmins,
List<SimpleEmployee> adminList,
String setLabel) {
return convertToTableListDTO(Boolean.TRUE, taxAgents, paymentAgencyPOS, taxAgentAdmins, adminList, setLabel);
}
/**
* 表数据转列表数据
*
* @param taxAgents
* @param adminList
* @return
*/
public static List<Map<String, Object>> convertToTableListDTO(Boolean isDevolution, List<TaxAgentPO> taxAgents, List<PaymentAgencyPO> paymentAgencyPOS,
List<TaxAgentAdminPO> taxAgentAdmins,
List<SimpleEmployee> adminList, String setLabel) {
if (CollectionUtils.isEmpty(taxAgents)) {
return Collections.emptyList();
}
return taxAgents.stream()
.map(e -> {
Map<String, Object> map = new LinkedHashMap<>();
map.put("id", e.getId());
map.put("name", e.getName());
map.put("employeeRange", setLabel);
if (isDevolution) {
List<Long> empIds = taxAgentAdmins.stream().filter(t -> t.getTaxAgentId().equals(e.getId())).map(TaxAgentAdminPO::getEmployeeId).collect(Collectors.toList());
List<String> 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<Map<String, Object>> buildPaymentAgency(String originStr, List<PaymentAgencyPO> paymentAgencyPOS) {
List<Map<String, Object>> paymentAgencyList = new ArrayList<>();
if (CollectionUtils.isEmpty(paymentAgencyPOS)) {
return paymentAgencyList;
}
originStr = StringUtils.isBlank(originStr) ? "" : originStr;
String finalOriginStr = originStr;
return paymentAgencyPOS.stream().map(e -> {
HashMap<String, Object> 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<TaxAgentSubAdminListDTO> convertToSubAdminListDTO(List<TaxAgentSubAdminPO> list, String range, List<DataCollectionEmployee> subAdminList) {
if (CollectionUtils.isEmpty(list)) {
return Collections.emptyList();
}
return list.stream()
.map(e -> {
Optional<String> 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<TaxAgentManageRangeListDTO> convert2ListDTO(List<TaxAgentManageRangePO> taxAgentManageRanges, List<HrmEmployeeComInfo> employeeComInfos,
List<HrmDepartmentComInfo> departmentComInfos, List<HrmDepartmentComInfo> subDepartmentComInfos,
List<HrmPositionComInfo> positionComInfos, List<HrmStatus> hrmStatusList) {
if (CollectionUtils.isEmpty(taxAgentManageRanges)) {
return Collections.emptyList();
}
Map<Long, String> employeeComInfoMap = SalaryEntityUtil.convert2Map(employeeComInfos, HrmEmployeeComInfo::getId, HrmEmployeeComInfo::getUsername);
Map<Long, String> departmentComInfoMap = SalaryEntityUtil.convert2Map(departmentComInfos, HrmDepartmentComInfo::getId, HrmDepartmentComInfo::getName);
Map<Long, String> subDepartmentComInfoMap = SalaryEntityUtil.convert2Map(subDepartmentComInfos, HrmDepartmentComInfo::getId, HrmDepartmentComInfo::getName);
Map<Long, String> positionComInfoMap = SalaryEntityUtil.convert2Map(positionComInfos, HrmPositionComInfo::getId, HrmPositionComInfo::getName);
Map<String, String> 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<String, String> hrmStatusNameMap, String employeeStatus) {
List<String> 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<Long, String> employeeComInfoMap, Map<Long, String> departmentComInfoMap,
Map<Long, String> subDepartmentComInfoMap, Map<Long, String> 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<TaxAgentManageRangePO> taxAgentManageRanges, TaxAgentManageRangeSaveParam saveParam, Long taxAgentId, Long employeeId,
String tenantKey) {
return handleManageRange(taxAgentManageRanges, saveParam, TaxAgentRangeTypeEnum.TAXAGENT, taxAgentId, 0L, employeeId, tenantKey);
}
public static Result handleSubAdminRange(List<TaxAgentManageRangePO> 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<TaxAgentManageRangePO> 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<String, TaxAgentManageRangePO> 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<TaxAgentManageRangePO> needUpdateTaxAgentManageRanges;
/**
* 需要新增的人员范围
*/
private Collection<TaxAgentManageRangePO> needInsertTaxAgentManageRanges;
}
}

View File

@ -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<WeaSearchConditionOption> 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<WeaSearchConditionOption> 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<WeaSearchConditionOption> 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());
}
}

View File

@ -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;
}

View File

@ -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<WeaSearchConditionOption> 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<WeaSearchConditionOption> 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<WeaSearchConditionOption> 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());
}
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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<Long> taxAgentIds;
}

View File

@ -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<TaxAgentEmployeeOptionDTO> adminUser;
@WeaFormat(
label = "备注",
labelId = 84961,
from = @Form(itemType = WeaFormItemType.INPUT, maxLength = "20")
)
@ApiModelProperty("备注")
private String description;
}

View File

@ -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;
}

View File

@ -0,0 +1,47 @@
package com.engine.salary.entity.taxagent.dto;
import lombok.Builder;
import lombok.Data;
import java.util.List;
/**
* 个税扣缴义务人以及管理范围中的人员
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
@Data
@Builder
public class TaxAgentManageRangeEmployeeDTO {
/**
* 个税扣缴义务人id
*/
private Long taxAgentId;
/**
* 名称
*/
private String taxAgentName;
/**
* 人员列表
*/
private List<TaxAgentEmployee> employeeList;
@Data
public static class TaxAgentEmployee {
/**
* 人员id
*/
private Long employeeId;
/**
* 名字
*/
private String username;
}
}

View File

@ -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<TypesBrowserOption> targetOptions;
@ApiModelProperty("对象id")
private Long targetId;
@SalaryForm(
label = "选择人员状态",
labelId = 87825,
items = {
@SalaryFormItem(required = true, itemType = WeaFormItemType.CHECKBOX)
}
)
@ApiModelProperty("人员状态")
private Collection<String> employeeStatus;
}

View File

@ -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;
/**
* 个税扣缴义务人管理范围列表
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @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;
}

View File

@ -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<TaxAgentEmployeeOptionDTO> subAdminUser;
@WeaFormat(
label = "备注",
labelId = 84961,
from = @Form(itemType = WeaFormItemType.INPUT, maxLength = "20")
)
@ApiModelProperty("备注")
private String description;
}

View File

@ -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;
}

View File

@ -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<Long> ids;
@ApiModelProperty("薪资档案id")
private Long salaryArchiveId;
@ApiModelProperty("关键字(姓名、部门、个税扣缴义务人)")
private String keyword;
@ApiModelProperty("姓名")
private String username;
@ApiModelProperty("部门id")
private List<Long> departmentIds;
@ApiModelProperty("岗位id")
private List<Long> positionIds;
@ApiModelProperty("状态")
private String userstatus;
@ApiModelProperty("个税扣缴义务人id")
private Long taxAgentId;
@ApiModelProperty("调整原因")
private String adjustReason;
@ApiModelProperty("生效日期")
private List<LocalDate> effectiveTime;
@ApiModelProperty("操作日期")
private List<LocalDate> operateTime;
@ApiModelProperty("操作人id")
private List<Long> operatorIds;
@ApiModelProperty("备注")
private String description;
}

View File

@ -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;
}

View File

@ -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;
/**
* 个税扣缴义务人的关联人员保存参数
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class TaxAgentEmpSaveParam {
//个税口角义务人的主键id
private Long taxAgentId;
//关联人员列表
private List<DataCollectionEmployee> salaryEmployeeList;
}

View File

@ -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<Long> targetIds;
@ApiModelProperty("人员状态")
private Collection<String> employeeStatus;
}

View File

@ -0,0 +1,23 @@
package com.engine.salary.entity.taxagent.param;
import com.engine.salary.common.BaseQueryParam;
import lombok.Data;
/**
* 管理范围查询参数
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
@Data
//@Builder
//@NoArgsConstructor
//@AllArgsConstructor
//管理范围查询参数")
public class TaxAgentManageRangeQueryParam extends BaseQueryParam {
//对象")
private String targetName;
}

View File

@ -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;
/**
* 管理范围保存参数
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @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<TaxAgentSubAdminRangeTargetParam> targetParams;
/**
* 员工状态不允许为空
*/
@DataCheck(require = true,message = "员工状态不允许为空")
private Collection<String> employeeStatus;
/**
* 个税扣缴义务人分管理员管理范围保存参数中的对象
*/
@Data
public static class TaxAgentSubAdminRangeTargetParam {
/**
* 对象类型不能为空
*/
@DataCheck(require = true,message = "对象类型不能为空")
private TargetTypeEnum targetType;
/**
* 对象不能为空
*/
@DataCheck(require = true,message = "对象不能为空")
private Long targetId;
}
}

View File

@ -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<Long> ids;
@ApiModelProperty("个税扣缴义务人名称")
private String name;
}

View File

@ -0,0 +1,25 @@
package com.engine.salary.entity.taxagent.param;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 个税扣缴义务人人员范围查询参数
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
//个税扣缴义务人人员范围查询参数")
public class TaxAgentRangeQueryParam extends TaxAgentManageRangeQueryParam {
//个税扣缴义务人id")
private Long taxAgentId;
}

View File

@ -0,0 +1,22 @@
package com.engine.salary.entity.taxagent.param;
import com.engine.salary.util.valid.DataCheck;
import lombok.Data;
/**
* 个税扣缴义务人的人员范围保存参数
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
@Data
public class TaxAgentRangeSaveParam extends TaxAgentManageRangeSaveParam {
/**
* 个税扣缴义务人的id不允许为空
*/
@DataCheck(require = true,message = "个税扣缴义务人的id不允许为空")
private Long taxAgentId;
}

View File

@ -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;
}

View File

@ -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<String> 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);
}
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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<SalaryEmployee> salaryEmployeeList;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -0,0 +1,22 @@
package com.engine.salary.entity.taxagent.param;
import com.engine.salary.util.valid.DataCheck;
import lombok.Data;
/**
* 个税扣缴义务人分管理员管理范围保存参数
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
@Data
public class TaxAgentSubAdminRangeSaveParam extends TaxAgentManageRangeSaveParam {
/**
* 分管理员的id不允许为空
*/
@DataCheck(require = true, message = "分管理员的id不允许为空")
private Long subAdminId;
}

View File

@ -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<Long> taxAgentIds;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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<Long> taxAgentIds;
}

View File

@ -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;
}

View File

@ -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<Long> taxAgentIds;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -0,0 +1,31 @@
package com.engine.salary.enums;
/**
* 个税扣缴义务人角色类型
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @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;
}
}

View File

@ -16,9 +16,10 @@ import java.util.Objects;
public enum TargetTypeEnum implements BaseEnum<Integer> {
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;

View File

@ -0,0 +1,32 @@
package com.engine.salary.enums.taxagent;
/**
* 模块类型
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @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;
}
}

View File

@ -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;
}
}

View File

@ -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<TaxAgentRangeTypeEnum> 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()):"";
}
}

View File

@ -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;
}
}

View File

@ -36,4 +36,6 @@ public interface EmployMapper {
List<DataCollectionEmployee> listByParams(@Param("params") Collection<SalarySobRangeEmpQueryParam> queryParams);
DataCollectionEmployee getEmployeeById(Long employeeId);
List<DataCollectionEmployee> listAll();
}

View File

@ -184,4 +184,25 @@
<include refid="paramSql"/>
</select>
<select id="listAll" resultType="com.engine.salary.entity.datacollection.DataCollectionEmployee">
select e.id as employeeId,
e.lastname as username,
e.status as status,
e.workcode as workcode,
d.departmentname as departmentName,
d.id as departmentId,
c.jobtitlename as jobtitleName,
c.id as jobtitleId,
e.companystartdate as companystartdate,
e.mobile as mobile,
b.dismissdate as dismissdate
from hrmresource e
left join hrmdepartment d on e.departmentid = d.id
left join hrmjobtitles c on e.jobtitle = c.id
left join bill_hrmdismiss b on e.id = b.resource_n
where e.status not in (7)
AND e.id = #{id}
</select>
</mapper>

View File

@ -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<TaxAgentAdminPO> listAll();
/**
* 根据主键查询
*
* @param id 主键
* @return 返回记录没有返回null
*/
TaxAgentAdminPO getById(Long id);
/**
* 条件查询
*
* @return 返回集合没有返回空List
*/
List<TaxAgentAdminPO> 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<Long> taxAgentIds);
}

View File

@ -0,0 +1,209 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.engine.salary.mapper.taxagent.TaxAgentAdminMapper">
<resultMap id="BaseResultMap" type="com.engine.salary.entity.taxagent.po.TaxAgentAdminPO">
<result column="create_time" property="createTime"/>
<result column="creator" property="creator"/>
<result column="delete_type" property="deleteType"/>
<result column="employee_id" property="employeeId"/>
<result column="id" property="id"/>
<result column="tax_agent_id" property="taxAgentId"/>
<result column="tenant_key" property="tenantKey"/>
<result column="update_time" property="updateTime"/>
</resultMap>
<!-- 表字段 -->
<sql id="baseColumns">
t
.
create_time
, t.creator
, t.delete_type
, t.employee_id
, t.id
, t.tax_agent_id
, t.tenant_key
, t.update_time
</sql>
<!-- 查询全部 -->
<select id="listAll" resultMap="BaseResultMap">
SELECT
<include refid="baseColumns"/>
FROM hrsa_tax_agent_admin t
WHERE delete_type = 0
</select>
<!-- 根据主键获取单条记录 -->
<select id="getById" resultMap="BaseResultMap" parameterType="Long">
SELECT
<include refid="baseColumns"/>
FROM hrsa_tax_agent_admin t
WHERE id = #{id} AND delete_type = 0
</select>
<!-- 条件查询 -->
<select id="listSome" resultMap="BaseResultMap"
parameterType="com.engine.salary.entity.taxagent.po.TaxAgentAdminPO">
SELECT
<include refid="baseColumns"/>
FROM hrsa_tax_agent_admin t
WHERE delete_type = 0
<if test="createTime != null">
AND create_time = #{createTime}
</if>
<if test="creator != null">
AND creator = #{creator}
</if>
<if test="deleteType != null">
AND delete_type = #{deleteType}
</if>
<if test="employeeId != null">
AND employee_id = #{employeeId}
</if>
<if test="id != null">
AND id = #{id}
</if>
<if test="taxAgentId != null">
AND tax_agent_id = #{taxAgentId}
</if>
<if test="tenantKey != null">
AND tenant_key = #{tenantKey}
</if>
<if test="updateTime != null">
AND update_time = #{updateTime}
</if>
<if test="taxAgentIds != null and taxAgentIds.size()>0">
AND tax_agent_id IN
<foreach collection="taxAgentIds" open="(" item="taxAgentId" separator="," close=")">
#{taxAgentId}
</foreach>
</if>
ORDER BY id DESC
</select>
<!-- 插入不为NULL的字段 -->
<insert id="insertIgnoreNull" parameterType="com.engine.salary.entity.taxagent.po.TaxAgentAdminPO">
INSERT INTO hrsa_tax_agent_admin
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="createTime != null">
create_time,
</if>
<if test="creator != null">
creator,
</if>
<if test="deleteType != null">
delete_type,
</if>
<if test="employeeId != null">
employee_id,
</if>
<if test="id != null">
id,
</if>
<if test="taxAgentId != null">
tax_agent_id,
</if>
<if test="tenantKey != null">
tenant_key,
</if>
<if test="updateTime != null">
update_time,
</if>
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
<if test="createTime != null">
#{createTime},
</if>
<if test="creator != null">
#{creator},
</if>
<if test="deleteType != null">
#{deleteType},
</if>
<if test="employeeId != null">
#{employeeId},
</if>
<if test="id != null">
#{id},
</if>
<if test="taxAgentId != null">
#{taxAgentId},
</if>
<if test="tenantKey != null">
#{tenantKey},
</if>
<if test="updateTime != null">
#{updateTime},
</if>
</trim>
</insert>
<!-- 更新,更新全部字段 -->
<update id="update" parameterType="com.engine.salary.entity.taxagent.po.TaxAgentAdminPO">
UPDATE hrsa_tax_agent_admin
<set>
create_time=#{createTime},
creator=#{creator},
delete_type=#{deleteType},
employee_id=#{employeeId},
tax_agent_id=#{taxAgentId},
tenant_key=#{tenantKey},
update_time=#{updateTime},
</set>
WHERE id = #{id} AND delete_type = 0
</update>
<!-- 更新不为NULL的字段 -->
<update id="updateIgnoreNull" parameterType="com.engine.salary.entity.taxagent.po.TaxAgentAdminPO">
UPDATE hrsa_tax_agent_admin
<set>
<if test="createTime != null">
create_time=#{createTime},
</if>
<if test="creator != null">
creator=#{creator},
</if>
<if test="deleteType != null">
delete_type=#{deleteType},
</if>
<if test="employeeId != null">
employee_id=#{employeeId},
</if>
<if test="taxAgentId != null">
tax_agent_id=#{taxAgentId},
</if>
<if test="tenantKey != null">
tenant_key=#{tenantKey},
</if>
<if test="updateTime != null">
update_time=#{updateTime},
</if>
</set>
WHERE id = #{id} AND delete_type = 0
</update>
<!-- 根据主键删除记录 -->
<delete id="delete" parameterType="com.engine.salary.entity.taxagent.po.TaxAgentAdminPO">
UPDATE hrsa_tax_agent_admin
SET delete_type=1
WHERE id = #{id}
AND delete_type = 0
</delete>
<delete id="deleteByTaxAgentIds">
UPDATE hrsa_tax_agent_admin
SET delete_type=1
WHERE delete_type = 0
AND tax_agent_id IN
<foreach collection="taxAgentIds" open="(" item="taxAgentId" separator="," close=")">
#{taxAgentId}
</foreach>
</delete>
</mapper>

View File

@ -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<TaxAgentBasePO> listAll();
/**
* 根据主键查询
*
* @param id 主键
* @return 返回记录没有返回null
*/
TaxAgentBasePO getById(Long id);
/**
* 条件查询
*
* @return 返回集合没有返回空List
*/
List<TaxAgentBasePO> 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);
}

View File

@ -0,0 +1,180 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.engine.salary.mapper.taxagent.TaxAgentBaseMapper">
<resultMap id="BaseResultMap" type="com.engine.salary.entity.taxagent.po.TaxAgentBasePO">
<result column="create_time" property="createTime" />
<result column="creator" property="creator" />
<result column="delete_type" property="deleteType" />
<result column="devolution_status" property="devolutionStatus" />
<result column="id" property="id" />
<result column="tenant_key" property="tenantKey" />
<result column="update_time" property="updateTime" />
</resultMap>
<!-- 表字段 -->
<sql id="baseColumns">
t.create_time
, t.creator
, t.delete_type
, t.devolution_status
, t.id
, t.tenant_key
, t.update_time
</sql>
<!-- 查询全部 -->
<select id="listAll" resultMap="BaseResultMap">
SELECT
<include refid="baseColumns" />
FROM hrsa_tax_agent_base t
WHERE delete_type = 0
</select>
<!-- 根据主键获取单条记录 -->
<select id="getById" resultMap="BaseResultMap" parameterType="Long">
SELECT
<include refid="baseColumns" />
FROM hrsa_tax_agent_base t
WHERE id = #{id} AND delete_type = 0
</select>
<!-- 条件查询 -->
<select id="listSome" resultMap="BaseResultMap" parameterType="com.engine.salary.entity.taxagent.po.TaxAgentBasePO">
SELECT
<include refid="baseColumns" />
FROM hrsa_tax_agent_base t
WHERE delete_type = 0
<if test="createTime != null">
AND create_time = #{createTime}
</if>
<if test="creator != null">
AND creator = #{creator}
</if>
<if test="deleteType != null">
AND delete_type = #{deleteType}
</if>
<if test="devolutionStatus != null">
AND devolution_status = #{devolutionStatus}
</if>
<if test="id != null">
AND id = #{id}
</if>
<if test="tenantKey != null">
AND tenant_key = #{tenantKey}
</if>
<if test="updateTime != null">
AND update_time = #{updateTime}
</if>
<if test="ids != null and ids.size()>0">
AND id IN
<foreach collection="ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</if>
ORDER BY id DESC
</select>
<!-- 插入不为NULL的字段 -->
<insert id="insertIgnoreNull" parameterType="com.engine.salary.entity.taxagent.po.TaxAgentBasePO">
INSERT INTO hrsa_tax_agent_base
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="createTime != null">
create_time,
</if>
<if test="creator != null">
creator,
</if>
<if test="deleteType != null">
delete_type,
</if>
<if test="devolutionStatus != null">
devolution_status,
</if>
<if test="id != null">
id,
</if>
<if test="tenantKey != null">
tenant_key,
</if>
<if test="updateTime != null">
update_time,
</if>
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
<if test="createTime != null" >
#{createTime},
</if>
<if test="creator != null" >
#{creator},
</if>
<if test="deleteType != null" >
#{deleteType},
</if>
<if test="devolutionStatus != null" >
#{devolutionStatus},
</if>
<if test="id != null" >
#{id},
</if>
<if test="tenantKey != null" >
#{tenantKey},
</if>
<if test="updateTime != null" >
#{updateTime},
</if>
</trim>
</insert>
<!-- 更新,更新全部字段 -->
<update id="update" parameterType="com.engine.salary.entity.taxagent.po.TaxAgentBasePO">
UPDATE hrsa_tax_agent_base
<set>
create_time=#{createTime},
creator=#{creator},
delete_type=#{deleteType},
devolution_status=#{devolutionStatus},
tenant_key=#{tenantKey},
update_time=#{updateTime},
</set>
WHERE id = #{id} AND delete_type = 0
</update>
<!-- 更新不为NULL的字段 -->
<update id="updateIgnoreNull" parameterType="com.engine.salary.entity.taxagent.po.TaxAgentBasePO">
UPDATE hrsa_tax_agent_base
<set>
<if test="createTime != null" >
create_time=#{createTime},
</if>
<if test="creator != null" >
creator=#{creator},
</if>
<if test="deleteType != null" >
delete_type=#{deleteType},
</if>
<if test="devolutionStatus != null" >
devolution_status=#{devolutionStatus},
</if>
<if test="tenantKey != null" >
tenant_key=#{tenantKey},
</if>
<if test="updateTime != null" >
update_time=#{updateTime},
</if>
</set>
WHERE id = #{id} AND delete_type = 0
</update>
<!-- 根据主键删除记录 -->
<delete id="delete" parameterType="com.engine.salary.entity.taxagent.po.TaxAgentBasePO">
UPDATE hrsa_tax_agent_base
SET delete_type=1
WHERE id = #{id} AND delete_type = 0
</delete>
</mapper>

View File

@ -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<TaxAgentEmpChangePO> listAll();
/**
* 根据主键查询
*
* @param id 主键
* @return 返回记录没有返回null
*/
TaxAgentEmpChangePO getById(Long id);
/**
* 条件查询
*
* @return 返回集合没有返回空List
*/
List<TaxAgentEmpChangePO> 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<Long> ids);
/**
* 批量插入
*
* @param saves
*/
void batchInsert(@Param("collection") List<TaxAgentEmpChangePO> saves);
}

View File

@ -0,0 +1,344 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.engine.salary.mapper.taxagent.TaxAgentEmpChangeMapper">
<resultMap id="BaseResultMap" type="com.engine.salary.entity.taxagent.po.TaxAgentEmpChangePO">
<result column="change_type" property="changeType"/>
<result column="create_time" property="createTime"/>
<result column="creator" property="creator"/>
<result column="delete_type" property="deleteType"/>
<result column="employee_id" property="employeeId"/>
<result column="employee_name" property="employeeName"/>
<result column="id" property="id"/>
<result column="module_type" property="moduleType"/>
<result column="tax_agent_id" property="taxAgentId"/>
<result column="tenant_key" property="tenantKey"/>
<result column="update_time" property="updateTime"/>
</resultMap>
<!-- 表字段 -->
<sql id="baseColumns">
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
</sql>
<!-- 查询全部 -->
<select id="listAll" resultMap="BaseResultMap">
SELECT
<include refid="baseColumns"/>
FROM hrsa_tax_agent_emp_change t
WHERE delete_type = 0
ORDER BY update_time ASC
</select>
<!-- 根据主键获取单条记录 -->
<select id="getById" resultMap="BaseResultMap" parameterType="Long">
SELECT
<include refid="baseColumns"/>
FROM hrsa_tax_agent_emp_change t
WHERE id = #{id} AND delete_type = 0
</select>
<!-- 条件查询 -->
<select id="listSome" resultMap="BaseResultMap"
parameterType="com.engine.salary.entity.taxagent.po.TaxAgentEmpChangePO">
SELECT
<include refid="baseColumns"/>
FROM hrsa_tax_agent_emp_change t
WHERE delete_type = 0
<if test="changeType != null">
AND change_type = #{changeType}
</if>
<if test="createTime != null">
AND create_time = #{createTime}
</if>
<if test="creator != null">
AND creator = #{creator}
</if>
<if test="deleteType != null">
AND delete_type = #{deleteType}
</if>
<if test="employeeId != null">
AND employee_id = #{employeeId}
</if>
<if test="employeeName != null">
AND employee_name = #{employeeName}
</if>
<if test="id != null">
AND id = #{id}
</if>
<if test="moduleType != null">
AND module_type = #{moduleType}
</if>
<if test="taxAgentId != null">
AND tax_agent_id = #{taxAgentId}
</if>
<if test="tenantKey != null">
AND tenant_key = #{tenantKey}
</if>
<if test="updateTime != null">
AND update_time = #{updateTime}
</if>
<if test="ids != null and ids.size()>0">
AND id IN
<foreach collection="ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</if>
ORDER BY update_time ASC
</select>
<!-- 插入不为NULL的字段 -->
<insert id="insertIgnoreNull" parameterType="com.engine.salary.entity.taxagent.po.TaxAgentEmpChangePO">
INSERT INTO hrsa_tax_agent_emp_change
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="changeType != null">
change_type,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="creator != null">
creator,
</if>
<if test="deleteType != null">
delete_type,
</if>
<if test="employeeId != null">
employee_id,
</if>
<if test="employeeName != null">
employee_name,
</if>
<if test="id != null">
id,
</if>
<if test="moduleType != null">
module_type,
</if>
<if test="taxAgentId != null">
tax_agent_id,
</if>
<if test="tenantKey != null">
tenant_key,
</if>
<if test="updateTime != null">
update_time,
</if>
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
<if test="changeType != null">
#{changeType},
</if>
<if test="createTime != null">
#{createTime},
</if>
<if test="creator != null">
#{creator},
</if>
<if test="deleteType != null">
#{deleteType},
</if>
<if test="employeeId != null">
#{employeeId},
</if>
<if test="employeeName != null">
#{employeeName},
</if>
<if test="id != null">
#{id},
</if>
<if test="moduleType != null">
#{moduleType},
</if>
<if test="taxAgentId != null">
#{taxAgentId},
</if>
<if test="tenantKey != null">
#{tenantKey},
</if>
<if test="updateTime != null">
#{updateTime},
</if>
</trim>
</insert>
<!-- 更新,更新全部字段 -->
<update id="update" parameterType="com.engine.salary.entity.taxagent.po.TaxAgentEmpChangePO">
UPDATE hrsa_tax_agent_emp_change
<set>
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},
</set>
WHERE id = #{id} AND delete_type = 0
</update>
<!-- 更新不为NULL的字段 -->
<update id="updateIgnoreNull" parameterType="com.engine.salary.entity.taxagent.po.TaxAgentEmpChangePO">
UPDATE hrsa_tax_agent_emp_change
<set>
<if test="changeType != null">
change_type=#{changeType},
</if>
<if test="createTime != null">
create_time=#{createTime},
</if>
<if test="creator != null">
creator=#{creator},
</if>
<if test="deleteType != null">
delete_type=#{deleteType},
</if>
<if test="employeeId != null">
employee_id=#{employeeId},
</if>
<if test="employeeName != null">
employee_name=#{employeeName},
</if>
<if test="moduleType != null">
module_type=#{moduleType},
</if>
<if test="taxAgentId != null">
tax_agent_id=#{taxAgentId},
</if>
<if test="tenantKey != null">
tenant_key=#{tenantKey},
</if>
<if test="updateTime != null">
update_time=#{updateTime},
</if>
</set>
WHERE id = #{id} AND delete_type = 0
</update>
<!-- 根据主键删除记录 -->
<delete id="delete" parameterType="com.engine.salary.entity.taxagent.po.TaxAgentEmpChangePO">
UPDATE hrsa_tax_agent_emp_change
SET delete_type=1
WHERE id = #{id}
AND delete_type = 0
</delete>
<delete id="deleteByIds">
UPDATE hrsa_tax_agent_emp_change
SET delete_type=1
WHERE delete_type = 0
AND id IN
<foreach collection="ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</delete>
<insert id="batchInsert">
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
<foreach collection="collection" item="item" separator=",">
(
#{item.id},
#{item.employeeId},
#{item.taxAgentId},
#{item.employeeName},
#{item.changeType},
#{item.moduleType},
#{item.createTime},
#{item.updateTime},
#{item.creator},
#{item.tenantKey}
)
</foreach>
</insert>
<insert id="batchInsert" databaseId="oracle">
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
)
<foreach collection="collection" item="item" separator="union all">
select
#{item.id},
#{item.employeeId},
#{item.taxAgentId},
#{item.employeeName},
#{item.changeType},
#{item.moduleType},
#{item.createTime},
#{item.updateTime},
#{item.creator},
#{item.tenantKey}
from dual
</foreach>
</insert>
<insert id="batchInsert" databaseId="sqlserver">
<foreach collection="collection" item="item" separator=";">
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}
)
</foreach>
</insert>
</mapper>

View File

@ -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<TaxAgentEmpPO> listAll();
/**
* 根据主键查询
*
* @param id 主键
* @return 返回记录没有返回null
*/
TaxAgentEmpPO getById(Long id);
/**
* 条件查询
*
* @return 返回集合没有返回空List
*/
List<TaxAgentEmpPO> 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<Long> ids);
/**
* 批量插入
*
* @param saves
*/
void batchInsert(@Param("collection") List<TaxAgentEmpPO> saves);
}

View File

@ -0,0 +1,297 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.engine.salary.mapper.taxagent.TaxAgentEmpMapper">
<resultMap id="BaseResultMap" type="com.engine.salary.entity.taxagent.po.TaxAgentEmpPO">
<result column="create_time" property="createTime" />
<result column="creator" property="creator" />
<result column="delete_type" property="deleteType" />
<result column="employee_id" property="employeeId" />
<result column="employee_name" property="employeeName" />
<result column="id" property="id" />
<result column="tax_agent_id" property="taxAgentId" />
<result column="tenant_key" property="tenantKey" />
<result column="update_time" property="updateTime" />
</resultMap>
<!-- 表字段 -->
<sql id="baseColumns">
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
</sql>
<!-- 查询全部 -->
<select id="listAll" resultMap="BaseResultMap">
SELECT
<include refid="baseColumns" />
FROM hrsa_tax_agent_emp t
WHERE delete_type = 0
</select>
<!-- 根据主键获取单条记录 -->
<select id="getById" resultMap="BaseResultMap" parameterType="Long">
SELECT
<include refid="baseColumns" />
FROM hrsa_tax_agent_emp t
WHERE id = #{id} AND delete_type = 0
</select>
<!-- 条件查询 -->
<select id="listSome" resultMap="BaseResultMap" parameterType="com.engine.salary.entity.taxagent.po.TaxAgentEmpPO">
SELECT
<include refid="baseColumns" />
FROM hrsa_tax_agent_emp t
WHERE delete_type = 0
<if test="createTime != null">
AND create_time = #{createTime}
</if>
<if test="creator != null">
AND creator = #{creator}
</if>
<if test="deleteType != null">
AND delete_type = #{deleteType}
</if>
<if test="employeeId != null">
AND employee_id = #{employeeId}
</if>
<if test="employeeName != null">
AND employee_name = #{employeeName}
</if>
<if test="id != null">
AND id = #{id}
</if>
<if test="taxAgentId != null">
AND tax_agent_id = #{taxAgentId}
</if>
<if test="tenantKey != null">
AND tenant_key = #{tenantKey}
</if>
<if test="updateTime != null">
AND update_time = #{updateTime}
</if>
<if test="ids != null and ids.size()>0">
AND tax_agent_id IN
<foreach collection="taxAgentIds" open="(" item="taxAgentId" separator="," close=")">
#{taxAgentId}
</foreach>
</if>
ORDER BY id DESC
</select>
<!-- 插入不为NULL的字段 -->
<insert id="insertIgnoreNull" parameterType="com.engine.salary.entity.taxagent.po.TaxAgentEmpPO">
INSERT INTO hrsa_tax_agent_emp
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="createTime != null">
create_time,
</if>
<if test="creator != null">
creator,
</if>
<if test="deleteType != null">
delete_type,
</if>
<if test="employeeId != null">
employee_id,
</if>
<if test="employeeName != null">
employee_name,
</if>
<if test="id != null">
id,
</if>
<if test="taxAgentId != null">
tax_agent_id,
</if>
<if test="tenantKey != null">
tenant_key,
</if>
<if test="updateTime != null">
update_time,
</if>
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
<if test="createTime != null" >
#{createTime},
</if>
<if test="creator != null" >
#{creator},
</if>
<if test="deleteType != null" >
#{deleteType},
</if>
<if test="employeeId != null" >
#{employeeId},
</if>
<if test="employeeName != null" >
#{employeeName},
</if>
<if test="id != null" >
#{id},
</if>
<if test="taxAgentId != null" >
#{taxAgentId},
</if>
<if test="tenantKey != null" >
#{tenantKey},
</if>
<if test="updateTime != null" >
#{updateTime},
</if>
</trim>
</insert>
<!-- 更新,更新全部字段 -->
<update id="update" parameterType="com.engine.salary.entity.taxagent.po.TaxAgentEmpPO">
UPDATE hrsa_tax_agent_emp
<set>
create_time=#{createTime},
creator=#{creator},
delete_type=#{deleteType},
employee_id=#{employeeId},
employee_name=#{employeeName},
tax_agent_id=#{taxAgentId},
tenant_key=#{tenantKey},
update_time=#{updateTime},
</set>
WHERE id = #{id} AND delete_type = 0
</update>
<!-- 更新不为NULL的字段 -->
<update id="updateIgnoreNull" parameterType="com.engine.salary.entity.taxagent.po.TaxAgentEmpPO">
UPDATE hrsa_tax_agent_emp
<set>
<if test="createTime != null" >
create_time=#{createTime},
</if>
<if test="creator != null" >
creator=#{creator},
</if>
<if test="deleteType != null" >
delete_type=#{deleteType},
</if>
<if test="employeeId != null" >
employee_id=#{employeeId},
</if>
<if test="employeeName != null" >
employee_name=#{employeeName},
</if>
<if test="taxAgentId != null" >
tax_agent_id=#{taxAgentId},
</if>
<if test="tenantKey != null" >
tenant_key=#{tenantKey},
</if>
<if test="updateTime != null" >
update_time=#{updateTime},
</if>
</set>
WHERE id = #{id} AND delete_type = 0
</update>
<!-- 根据主键删除记录 -->
<delete id="delete" parameterType="com.engine.salary.entity.taxagent.po.TaxAgentEmpPO">
UPDATE hrsa_tax_agent_emp
SET delete_type=1
WHERE id = #{id} AND delete_type = 0
</delete>
<delete id="deleteByIds">
UPDATE hrsa_tax_agent_emp
SET delete_type=1
WHERE delete_type = 0
AND id IN
<foreach collection="ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</delete>
<insert id="batchInsert">
INSERT INTO hrsa_tax_agent_emp(
id,
employee_id,
tax_agent_id,
employee_name,
create_time,
update_time,
creator,
tenant_key
)
VALUES
<foreach collection="collection" item="item" separator=",">
(
#{item.id},
#{item.employeeId},
#{item.taxAgentId},
#{item.employeeName},
#{item.createTime},
#{item.updateTime},
#{item.creator},
#{item.tenantKey}
)
</foreach>
</insert>
<insert id="batchInsert" databaseId="oracle">
INSERT INTO hrsa_tax_agent_emp(
id,
employee_id,
tax_agent_id,
employee_name,
create_time,
update_time,
creator,
tenant_key
)
<foreach collection="collection" item="item" separator="union all">
select
#{item.id},
#{item.employeeId},
#{item.taxAgentId},
#{item.employeeName},
#{item.createTime},
#{item.updateTime},
#{item.creator},
#{item.tenantKey}
from dual
</foreach>
</insert>
<insert id="batchInsert" databaseId="sqlserver">
<foreach collection="collection" item="item" separator=";">
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}
)
</foreach>
</insert>
</mapper>

View File

@ -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<TaxAgentManageRangePO> listAll();
/**
* 根据主键查询
*
* @param id 主键
* @return 返回记录没有返回null
*/
TaxAgentManageRangePO getById(Long id);
/**
* 条件查询
*
* @return 返回集合没有返回空List
*/
List<TaxAgentManageRangePO> 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);
}

View File

@ -0,0 +1,285 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.engine.salary.mapper.taxagent.TaxAgentManageRangeMapper">
<resultMap id="BaseResultMap" type="com.engine.salary.entity.taxagent.po.TaxAgentManageRangePO">
<result column="create_time" property="createTime" />
<result column="creator" property="creator" />
<result column="delete_type" property="deleteType" />
<!-- <result column="employee_id" property="employeeId" />-->
<result column="employee_status" property="employeeStatus" />
<result column="id" property="id" />
<result column="include_type" property="includeType" />
<result column="range_type" property="rangeType" />
<result column="target_id" property="targetId" />
<result column="target_type" property="targetType" />
<result column="tax_agent_id" property="taxAgentId" />
<result column="tax_agent_sub_admin_id" property="taxAgentSubAdminId" />
<result column="tenant_key" property="tenantKey" />
<result column="update_time" property="updateTime" />
</resultMap>
<!-- 表字段 -->
<sql id="baseColumns">
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
</sql>
<!-- 查询全部 -->
<select id="listAll" resultMap="BaseResultMap">
SELECT
<include refid="baseColumns" />
FROM hrsa_tax_agent_manage_range t
WHERE delete_type = 0
</select>
<!-- 根据主键获取单条记录 -->
<select id="getById" resultMap="BaseResultMap" parameterType="Long">
SELECT
<include refid="baseColumns" />
FROM hrsa_tax_agent_manage_range t
WHERE id = #{id} AND delete_type = 0
</select>
<!-- 条件查询 -->
<select id="listSome" resultMap="BaseResultMap" parameterType="com.engine.salary.entity.taxagent.po.TaxAgentManageRangePO">
SELECT
<include refid="baseColumns" />
FROM hrsa_tax_agent_manage_range t
WHERE delete_type = 0
<if test="createTime != null">
AND create_time = #{createTime}
</if>
<if test="creator != null">
AND creator = #{creator}
</if>
<if test="deleteType != null">
AND delete_type = #{deleteType}
</if>
<if test="employeeId != null">
AND employee_id = #{employeeId}
</if>
<if test="employeeStatus != null">
AND employee_status = #{employeeStatus}
</if>
<if test="id != null">
AND id = #{id}
</if>
<if test="includeType != null">
AND include_type = #{includeType}
</if>
<if test="rangeType != null">
AND range_type = #{rangeType}
</if>
<if test="targetId != null">
AND target_id = #{targetId}
</if>
<if test="targetType != null">
AND target_type = #{targetType}
</if>
<if test="taxAgentId != null">
AND tax_agent_id = #{taxAgentId}
</if>
<if test="taxAgentSubAdminId != null">
AND tax_agent_sub_admin_id = #{taxAgentSubAdminId}
</if>
<if test="tenantKey != null">
AND tenant_key = #{tenantKey}
</if>
<if test="updateTime != null">
AND update_time = #{updateTime}
</if>
<if test="taxAgentIds != null and ids.size()>0">
AND tax_agent_id IN
<foreach collection="taxAgentIds" open="(" item="taxAgentId" separator="," close=")">
#{taxAgentId}
</foreach>
</if>
ORDER BY id DESC
</select>
<!-- 插入不为NULL的字段 -->
<insert id="insertIgnoreNull" parameterType="com.engine.salary.entity.taxagent.po.TaxAgentManageRangePO">
INSERT INTO hrsa_tax_agent_manage_range
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="createTime != null">
create_time,
</if>
<if test="creator != null">
creator,
</if>
<if test="deleteType != null">
delete_type,
</if>
<if test="employeeId != null">
employee_id,
</if>
<if test="employeeStatus != null">
employee_status,
</if>
<if test="id != null">
id,
</if>
<if test="includeType != null">
include_type,
</if>
<if test="rangeType != null">
range_type,
</if>
<if test="targetId != null">
target_id,
</if>
<if test="targetType != null">
target_type,
</if>
<if test="taxAgentId != null">
tax_agent_id,
</if>
<if test="taxAgentSubAdminId != null">
tax_agent_sub_admin_id,
</if>
<if test="tenantKey != null">
tenant_key,
</if>
<if test="updateTime != null">
update_time,
</if>
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
<if test="createTime != null" >
#{createTime},
</if>
<if test="creator != null" >
#{creator},
</if>
<if test="deleteType != null" >
#{deleteType},
</if>
<if test="employeeId != null" >
#{employeeId},
</if>
<if test="employeeStatus != null" >
#{employeeStatus},
</if>
<if test="id != null" >
#{id},
</if>
<if test="includeType != null" >
#{includeType},
</if>
<if test="rangeType != null" >
#{rangeType},
</if>
<if test="targetId != null" >
#{targetId},
</if>
<if test="targetType != null" >
#{targetType},
</if>
<if test="taxAgentId != null" >
#{taxAgentId},
</if>
<if test="taxAgentSubAdminId != null" >
#{taxAgentSubAdminId},
</if>
<if test="tenantKey != null" >
#{tenantKey},
</if>
<if test="updateTime != null" >
#{updateTime},
</if>
</trim>
</insert>
<!-- 更新,更新全部字段 -->
<update id="update" parameterType="com.engine.salary.entity.taxagent.po.TaxAgentManageRangePO">
UPDATE hrsa_tax_agent_manage_range
<set>
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},
</set>
WHERE id = #{id} AND delete_type = 0
</update>
<!-- 更新不为NULL的字段 -->
<update id="updateIgnoreNull" parameterType="com.engine.salary.entity.taxagent.po.TaxAgentManageRangePO">
UPDATE hrsa_tax_agent_manage_range
<set>
<if test="createTime != null" >
create_time=#{createTime},
</if>
<if test="creator != null" >
creator=#{creator},
</if>
<if test="deleteType != null" >
delete_type=#{deleteType},
</if>
<if test="employeeId != null" >
employee_id=#{employeeId},
</if>
<if test="employeeStatus != null" >
employee_status=#{employeeStatus},
</if>
<if test="includeType != null" >
include_type=#{includeType},
</if>
<if test="rangeType != null" >
range_type=#{rangeType},
</if>
<if test="targetId != null" >
target_id=#{targetId},
</if>
<if test="targetType != null" >
target_type=#{targetType},
</if>
<if test="taxAgentId != null" >
tax_agent_id=#{taxAgentId},
</if>
<if test="taxAgentSubAdminId != null" >
tax_agent_sub_admin_id=#{taxAgentSubAdminId},
</if>
<if test="tenantKey != null" >
tenant_key=#{tenantKey},
</if>
<if test="updateTime != null" >
update_time=#{updateTime},
</if>
</set>
WHERE id = #{id} AND delete_type = 0
</update>
<!-- 根据主键删除记录 -->
<delete id="delete" parameterType="com.engine.salary.entity.taxagent.po.TaxAgentManageRangePO">
UPDATE hrsa_tax_agent_manage_range
SET delete_type=1
WHERE id = #{id} AND delete_type = 0
</delete>
</mapper>

View File

@ -155,4 +155,12 @@ public interface SalaryAcctRecordService {
* @return
*/
String getLogTargetNameById(Long id);
/**
* 根据状态查询薪资核算记录
*
* @param status
* @return
*/
List<SalaryAcctRecordPO> listByStatus(SalaryAcctRecordStatusEnum status);
}

View File

@ -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;
/**
* 个税扣缴义务人管理员
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
public interface TaxAgentAdminService {
/**
* 根据个税扣缴义务人id删除管理员
*
* @param taxAgentIds
*/
void deleteByTaxAgentIds(Collection<Long> taxAgentIds);
/**
* 批量新增管理员
*
* @param taxAgentId
* @param admins
*/
void batchInsert(Long taxAgentId, Collection<Long> admins);
/**
* 根据个税扣缴义务人id查询管理员
*
* @param taxAgentIds
* @return
*/
List<TaxAgentAdminPO> listByTaxAgentIds(Collection<Long> taxAgentIds);
/**
* 根据个税扣缴义务人id查询管理员
*
* @param taxAgentIds
* @param currentEmployeeId
* @return
*/
List<TaxAgentAdminPO> listByTaxAgentIdsAndEmployeeId(Collection<Long> taxAgentIds, Long currentEmployeeId);
/**
* 根据当前登录人查询管理员
*
* @param currentEmployeeId
* @return
*/
List<TaxAgentAdminPO> listByEmployeeId(Long currentEmployeeId);
}

View File

@ -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;
/**
* 个税扣缴义务人基础信息
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
public interface TaxAgentBaseService {
/**
* 是否开启分权
*
* @return
*/
Boolean isOpenDevolution();
/**
* 获取个税扣缴义务人基本信息
*
* @return
*/
TaxAgentBasePO getBaseInfo();
/**
* 保存个税扣缴义务人信息
*
* @param saveBaseParam
* @return
*/
String save(TaxAgentSaveBaseParam saveBaseParam);
}

View File

@ -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;
/**
* 个税扣缴义务人管理范围的增量人员
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
public interface TaxAgentEmpChangeService {
/**
* 获取所有增量数据
*
*/
List<TaxAgentEmpChangePO> listAll();
/**
* 根据模块类型获取所有增量数据
*/
List<TaxAgentEmpChangePO> listAllByModule(TaxAgentEmpChangeModuleEnum moduleTypeEnum);
/**
* 删除增量数据
*
* @param ids
* @return
*/
boolean deleleByIds(Collection<Long> ids);
void batchInsert(List<TaxAgentEmpChangePO> taxAgentEmpChangeList);
}

View File

@ -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;
/**
* 个税扣缴义务人管理范围的人员
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
public interface TaxAgentEmpService{
/**
* 根据个税扣缴义务人id删除管理范围的人员
*
* @param taxAgentIds
*/
void deleteByTaxAgentIds(Collection<Long> taxAgentIds);
/**
* 根据个税扣缴义务人id获取管理范围中的人员
*
* @param taxAgentIds
* @param tenantKey
* @return
*/
List<TaxAgentEmpPO> listByTaxAgentIds(List<Long> taxAgentIds);
/**
* 同步人员到本地关联表
*
* @param taxAgentEmpSaveParamList
* @param currentEmployeeId
* @param tenantKey
*/
void syncTaxAgentEmployee(List<TaxAgentEmpSaveParam> taxAgentEmpSaveParamList, Long currentEmployeeId);
}

View File

@ -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;
/**
* 个税扣缴义务人的管理范围
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
public interface TaxAgentManageRangeService {
/**
* 根据个税扣缴义务人ID和当前账户查询人员
*
* @param taxAgentIds
* @return
*/
List<TaxAgentManageRangeEmployeeDTO> listSalaryEmployeeByTaxAgentIds(List<Long> taxAgentIds);
/**
* 根据人员状态个税扣缴义务人ID和当前账户查询人员
*
* @param employeeStatus
* @param taxAgentIds
* @return
*/
List<TaxAgentManageRangeEmployeeDTO> listSalaryEmployeeByTaxAgentIds(SalaryEmployeeStatusEnum employeeStatus, List<Long> taxAgentIds);
/**
* 根据分管理员ID和当前账户查询人员
*
* @param taxAgentSubAdminIds
* @return
*/
List<TaxAgentManageRangeEmployeeDTO> listSalaryEmployeeBySubAdminIds(List<Long> taxAgentSubAdminIds);
/**
* 根据人员状态分管理员ID和当前账户查询人员
*
* @param employeeStatus
* @param taxAgentSubAdminIds
* @return
*/
// List<TaxAgentManageRangeEmployeeDTO> listSalaryEmployeeBySubAdminIds(SalaryEmployeeStatusEnum employeeStatus, List<Long> taxAgentSubAdminIds);
/**
* 根据查询条件查询分管理员的人员范围
*
* @param queryParam 查询条件
* @param includeType 0-从范围中排除/1-关联人员范围
* @return
*/
// Page<TaxAgentManageRangeListDTO> listPageByParamAndIncludeType(TaxAgentSubAdminRangeQueryParam queryParam, Integer includeType);
/**
* 根据查询条件查询个税扣缴义务人的人员范围
*
* @param queryParam 查询条件
* @param includeType 0-从范围中排除/1-关联人员范围
* @return
*/
// PageInfo<TaxAgentManageRangeListDTO> listPageByParamAndIncludeType(TaxAgentRangeQueryParam queryParam, Integer includeType);
/**
* 根据分管理员id集合查询范围列表
*
* @param taxAgentSubAdminIds
* @return
*/
// List<TaxAgentManageRangePO> listBySubAdminIds(Collection<Long> 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<Long> ids, Long employeeId);
/**
* 根据个税扣缴义务人的id删除管理范围
*
* @param taxAgentIds 个税扣缴义务人的id
*/
void deleteByTaxAgentIds(Collection<Long> taxAgentIds);
/**
* 根据分管理员的id删除管理范围
*
* @param subAdminIds 分管理员列表
*/
void deleteBySubAdmins(Collection<Long> subAdminIds);
}

View File

@ -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<TaxAgentPO> listPage(Page<TaxAgentPO> page, TaxAgentQueryParam queryParam, String currentTenantKey);
/**
* 个税扣缴义务人列表(不分页)
*
* @param queryParam
* @param currentTenantKey
* @return
*/
List<TaxAgentPO> list(TaxAgentQueryParam queryParam, String currentTenantKey);
/**
* 根据id查询个税扣缴义务人
*
* @param ids
* @param tenantKey
* @return
*/
List<TaxAgentPO> listByIds(Collection<Long> ids, String tenantKey);
/**
* 查询租户下的所有个税扣缴义务人
*
* @param tenantKey
* @return
*/
List<TaxAgentPO> listAll(String tenantKey);
/**
* 根据id获取单个个税扣缴义务人
*
* @param id
* @param tenantKey
* @return
*/
TaxAgentPO getById(Long id, String tenantKey);
/**
* 获取所有个税扣缴义务人
*
* @param tenantKey
* @return
*/
Collection<TaxAgentListDTO> findAll(String tenantKey);
/**
* 获取作为管理员或分管理员的个税扣缴义务人列表
*
* @param currentEmployeeId 当前登录人id
* @param tenantKey
* @return
*/
Collection<TaxAgentPO> listAllTaxAgents(Long currentEmployeeId, String tenantKey);
/**
* 获取作为管理员的所有个税扣缴义务人列表
*
* @param currentEmployeeId 当前登录人id
* @param tenantKey
* @return
*/
Collection<TaxAgentPO> listAllTaxAgentsAsAdmin(Long currentEmployeeId, String tenantKey);
/**
* 获取作为人员范围中的个税扣缴义务人列表
*
* @param employeeIds 被管理的人员id
* @param tenantKey
* @return
*/
Collection<TaxAgentEmployeeTaxAgentDTO> listAllTaxAgentsAsRange(List<Long> 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<Long> ids, Long employeeId, String tenantKey);
/**
* 获取个税扣缴义务人下拉列表
*
* @param currentEmployeeId
* @param currentTenantKey
* @return
*/
List<Map<String, Object>> selectList(Long currentEmployeeId, String currentTenantKey);
/**
* 是否开启分权
*
* @param tenantKey
* @return
*/
Boolean isOpenDevolution(String tenantKey);
/**
* 获取个税扣缴义务人和可查看的人员列表(树型)
*
* @param employeeId
* @param tenantKey
* @return
*/
List<TaxAgentManageRangeEmployeeDTO> listTaxAgentAndEmployeeTree(Long employeeId, String tenantKey);
/**
* 获取个税扣缴义务人和可查看的人员列表(扁平型)
*
* @param employeeId
* @param tenantKey
* @return
*/
List<TaxAgentEmployeeDTO> listTaxAgentAndEmployee(Long employeeId, String tenantKey);
/**
* 获取个税扣缴义务人和可查看的人员列表(树型)
*
* @param employeeStatus
* @param employeeId
* @param tenantKey
* @return
*/
List<TaxAgentManageRangeEmployeeDTO> listTaxAgentAndEmployeeTree(SalaryEmployeeStatusEnum employeeStatus, Long employeeId, String tenantKey);
/**
* 获取个税扣缴义务人和可查看的人员列表(扁平型)
*
* @param employeeStatus
* @param employeeId
* @param tenantKey
* @return
*/
List<TaxAgentEmployeeDTO> listTaxAgentAndEmployee(SalaryEmployeeStatusEnum employeeStatus, Long employeeId, String tenantKey);
/**
* 更换管理员校验是否有核算数据
*
* @param checkParam
* @param currentEmployeeId
* @param currentTenantKey
* @return
*/
Boolean adminChangeCheck(TaxAgentAdminChangeCheckParam checkParam, Long currentEmployeeId, String currentTenantKey);
}

View File

@ -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;

View File

@ -463,4 +463,9 @@ public class SalaryAcctRecordServiceImpl extends Service implements SalaryAcctRe
}
return salarySobPO.getName() + SalaryDateUtil.localDate2YearMonth(salaryAcctRecordPO.getSalaryMonth());
}
@Override
public List<SalaryAcctRecordPO> listByStatus(SalaryAcctRecordStatusEnum status) {
return getSalaryAcctRecordMapper().listSome(SalaryAcctRecordPO.builder().status(status.getValue()).build());
}
}

View File

@ -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;

View File

@ -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;
/**
* 个税扣缴义务人管理员
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
public class TaxAgentAdminServiceImpl extends Service implements TaxAgentAdminService {
private TaxAgentAdminMapper taxAgentAdminMapper;
@Override
public void deleteByTaxAgentIds(Collection<Long> taxAgentIds) {
if (CollectionUtils.isEmpty(taxAgentIds)) {
return;
}
taxAgentAdminMapper.deleteByTaxAgentIds(taxAgentIds);
}
@Override
public void batchInsert(Long taxAgentId, Collection<Long> 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<TaxAgentAdminPO> listByTaxAgentIds(Collection<Long> taxAgentIds) {
List<TaxAgentAdminPO> list = Lists.newArrayList();
if (CollectionUtils.isEmpty(taxAgentIds)) {
return list;
}
return taxAgentAdminMapper.listSome(TaxAgentAdminPO.builder().taxAgentIds(taxAgentIds).build());
}
@Override
public List<TaxAgentAdminPO> listByTaxAgentIdsAndEmployeeId(Collection<Long> taxAgentIds, Long currentEmployeeId) {
List<TaxAgentAdminPO> list = Lists.newArrayList();
if (CollectionUtils.isEmpty(taxAgentIds) || currentEmployeeId == null) {
return list;
}
return taxAgentAdminMapper.listSome(TaxAgentAdminPO.builder().taxAgentIds(taxAgentIds).employeeId(currentEmployeeId).build());
}
@Override
public List<TaxAgentAdminPO> listByEmployeeId(Long currentEmployeeId) {
return taxAgentAdminMapper.listSome(TaxAgentAdminPO.builder().employeeId(currentEmployeeId).build());
}
}

View File

@ -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;
/**
* 个税扣缴义务人基本信息
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @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<TaxAgentBasePO> 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<SalaryAcctRecordPO> salaryAcctRecords = salaryAcctRecordService.listByStatus(SalaryAcctRecordStatusEnum.NOT_ARCHIVED);// salaryAcctRecordService.listByStatusAndEmployeeId(SalaryAcctRecordStatusEnum.NOT_ARCHIVED, currentTenantKey);
if (CollectionUtils.isNotEmpty(salaryAcctRecords) || checkedValue) {
return Boolean.TRUE;
}
return Boolean.FALSE;
}
}

View File

@ -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;
/**
* 个税扣缴义务人管理范围的增量人员
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
public class TaxAgentEmpChangeServiceImpl extends Service implements TaxAgentEmpChangeService {
@Resource
private TaxAgentEmpChangeMapper taxAgentEmpChangeMapper;
@Override
public List<TaxAgentEmpChangePO> listAll() {
return taxAgentEmpChangeMapper.listAll();
}
@Override
public List<TaxAgentEmpChangePO> listAllByModule(TaxAgentEmpChangeModuleEnum moduleTypeEnum) {
return taxAgentEmpChangeMapper.listSome(TaxAgentEmpChangePO.builder().moduleType(moduleTypeEnum.getValue()).build());
}
@Override
public boolean deleleByIds(Collection<Long> ids) {
if (CollectionUtils.isEmpty(ids)) {
return Boolean.FALSE;
}
taxAgentEmpChangeMapper.deleteByIds(ids);
return Boolean.TRUE;
}
@Override
public void batchInsert(List<TaxAgentEmpChangePO> taxAgentEmpChangeList) {
taxAgentEmpChangeMapper.batchInsert(taxAgentEmpChangeList);
}
}

View File

@ -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;
/**
* 个税扣缴义务人管理范围的人员
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
public class TaxAgentEmpServiceImpl extends Service implements TaxAgentEmpService {
private TaxAgentEmpMapper taxAgentEmployeeMapper;
private TaxAgentEmpChangeService taxAgentEmpChangeService;
@Override
public void deleteByTaxAgentIds(Collection<Long> taxAgentIds) {
if (CollectionUtils.isEmpty(taxAgentIds)) {
return;
}
List<TaxAgentEmpPO> taxAgentEmpList = taxAgentEmployeeMapper.listSome(TaxAgentEmpPO.builder().taxAgentIds(taxAgentIds).build());
if (CollectionUtils.isEmpty(taxAgentEmpList)) {
return;
}
List<Long> idList = taxAgentEmpList.stream().map(TaxAgentEmpPO::getId).collect(Collectors.toList());
taxAgentEmployeeMapper.deleteByIds(idList);
}
@Override
public List<TaxAgentEmpPO> listByTaxAgentIds(List<Long> taxAgentIds) {
if (CollectionUtils.isEmpty(taxAgentIds)) {
return Lists.newArrayList();
}
return taxAgentEmployeeMapper.listSome(TaxAgentEmpPO.builder().taxAgentIds(taxAgentIds).build());
}
@Override
public void syncTaxAgentEmployee(List<TaxAgentEmpSaveParam> taxAgentEmpSaveParamList, Long currentEmployeeId) {
if (CollectionUtils.isEmpty(taxAgentEmpSaveParamList)) {
return;
}
List<Long> taxAgentIds = taxAgentEmpSaveParamList.stream().map(TaxAgentEmpSaveParam::getTaxAgentId).collect(Collectors.toList());
List<TaxAgentEmpPO> taxAgentEmployeeExistList = this.listByTaxAgentIds(taxAgentIds);
Date now = new Date();
// 关联表
List<TaxAgentEmpPO> taxAgentEmployeeAddList = Lists.newArrayList();
List<Long> taxAgentEmployeeDelIds = Lists.newArrayList();
// 增量表
List<TaxAgentEmpChangePO> taxAgentEmpChangeList = Lists.newArrayList();
taxAgentEmpSaveParamList.forEach(saveParam -> {
List<TaxAgentEmpPO> existList = taxAgentEmployeeExistList.stream().filter(f -> f.getTaxAgentId().equals(saveParam.getTaxAgentId())).collect(Collectors.toList());
Map<String, TaxAgentEmpPO> 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);
}
}
}

View File

@ -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;
/**
* 个税扣缴义务人的管理范围
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @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<TaxAgentManageRangePO> listByTaxAgentIds(List<Long> taxAgentIds) {
if (CollectionUtils.isEmpty(taxAgentIds)) {
return Lists.newArrayList();
}
return taxAgentManageRangeMapper.listSome(TaxAgentManageRangePO.builder().rangeType(TaxAgentRangeTypeEnum.TAXAGENT.getValue()).taxAgentIds(taxAgentIds).build());
}
@Override
public List<TaxAgentManageRangeEmployeeDTO> listSalaryEmployeeByTaxAgentIds(List<Long> taxAgentIds) {
return listSalaryEmployeeByTaxAgentIds(null, taxAgentIds);
}
@Override
public List<TaxAgentManageRangeEmployeeDTO> listSalaryEmployeeByTaxAgentIds(SalaryEmployeeStatusEnum employeeStatus, List<Long> taxAgentIds) {
List<TaxAgentManageRangePO> allTaxAgentManageRanges = this.listByTaxAgentIds(taxAgentIds);
return convertTaxAgentEmployee(employeeStatus, taxAgentIds, allTaxAgentManageRanges);
}
// @Override
// public List<TaxAgentManageRangePO> listBySubAdminIds(Collection<Long> 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<TaxAgentManageRangeEmployeeDTO> listSalaryEmployeeBySubAdminIds(List<Long> taxAgentIds) {
// return listSalaryEmployeeBySubAdminIds(null, taxAgentIds);
// }
// @Override
// public List<TaxAgentManageRangeEmployeeDTO> listSalaryEmployeeBySubAdminIds(SalaryEmployeeStatusEnum employeeStatus, List<Long> taxAgentSubAdminIds) {
// List<TaxAgentManageRangePO> allTaxAgentManageRanges = this.listBySubAdminIds(taxAgentSubAdminIds);
// List<Long> taxAgentIds = allTaxAgentManageRanges.stream().map(TaxAgentManageRangePO::getTaxAgentId).distinct().collect(Collectors.toList());
//
// return convertTaxAgentEmployee(employeeStatus, taxAgentIds, allTaxAgentManageRanges);
// }
private List<TaxAgentManageRangeEmployeeDTO> convertTaxAgentEmployee(SalaryEmployeeStatusEnum employeeStatus, List<Long> taxAgentIds, List<TaxAgentManageRangePO> allTaxAgentManageRanges) {
return taxAgentIds.stream().distinct().map(e -> {
// 获取范围下的人员
List<DataCollectionEmployee> salaryEmployees = getManageRangeSalaryEmployees(employeeStatus, e, allTaxAgentManageRanges);
if (CollectionUtils.isEmpty(salaryEmployees)) {
return null;
}
List<TaxAgentManageRangeEmployeeDTO.TaxAgentEmployee> 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<DataCollectionEmployee> getManageRangeSalaryEmployees(SalaryEmployeeStatusEnum employeeStatus, Long taxAgentId,
List<TaxAgentManageRangePO> allTaxAgentManageRanges) {
List<TaxAgentManageRangePO> includeAllTaxAgentManageRanges = allTaxAgentManageRanges.stream().filter(f -> f.getIncludeType().equals(NumberUtils.INTEGER_ONE)).collect(Collectors.toList());
if (CollectionUtils.isEmpty(includeAllTaxAgentManageRanges)) {
return Collections.emptyList();
}
List<TaxAgentManageRangePO> excludeAllTaxAgentManageRanges = allTaxAgentManageRanges.stream().filter(f -> f.getIncludeType().equals(NumberUtils.INTEGER_ZERO)).collect(Collectors.toList());
List<DataCollectionEmployee> includeSalaryEmployees = Lists.newArrayList();
List<TaxAgentManageRangePO> includeTaxAgentManageRanges = includeAllTaxAgentManageRanges.stream().filter(f -> f.getTaxAgentId().equals(taxAgentId)).collect(Collectors.toList());
if (CollectionUtils.isEmpty(includeTaxAgentManageRanges)) {
return includeSalaryEmployees;
}
// 如果需要状态过滤
List<String> personnelStatuss = Lists.newArrayList();
if (employeeStatus != null) {
// 查询人员状态
List<HrmStatus> 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<TaxAgentManageRangePO> excludeTaxAgentManageRanges = excludeAllTaxAgentManageRanges.stream().filter(f -> f.getTaxAgentId().equals(taxAgentId)).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(excludeTaxAgentManageRanges)) {
// 根据上一步的查询参数查询人员
List<DataCollectionEmployee> excludeSalaryEmployees = listSalaryEmployeeByManageRange(excludeTaxAgentManageRanges, personnelStatuss);
// 需要排除的人员范围
Set<Long> 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<DataCollectionEmployee> listSalaryEmployeeByManageRange(List<TaxAgentManageRangePO> taxAgentManageRanges, List<String> personnelStatuss) {
if (CollectionUtils.isEmpty(taxAgentManageRanges)) {
return Collections.emptyList();
}
List<DataCollectionEmployee> salaryEmployees = employeeMapper.listAll();
List<DataCollectionEmployee> salaryEmployeeList = Lists.newArrayList();
for (TaxAgentManageRangePO manageRange : taxAgentManageRanges) {
salaryEmployeeList.addAll(salaryEmployees.stream()
.filter(salaryEmployee -> {
// 判断人员状态
List<String> 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<TaxAgentManageRangePO> 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<TaxAgentManageRangePO> listByTaxAgentIdAndIncludeType(Long taxAgentId, Integer includeType) {
return taxAgentManageRangeMapper.listSome(TaxAgentManageRangePO.builder().taxAgentId(taxAgentId).rangeType(TaxAgentRangeTypeEnum.TAXAGENT.getValue()).includeType(includeType).build());
}
// @Override
// public Page<TaxAgentManageRangeListDTO> listPageByParamAndIncludeType(TaxAgentSubAdminRangeQueryParam queryParam, Integer includeType) {
// // 查询已有的管理范围
// List<TaxAgentManageRangePO> taxAgentManageRanges = listBySubAdminIdAndIncludeType(queryParam.getSubAdminId(), includeType);
// return listPageByParamAndIncludeType(taxAgentManageRanges, queryParam, includeType);
// }
@Override
public PageInfo<TaxAgentManageRangeListDTO> listPageByParamAndIncludeType(TaxAgentRangeQueryParam queryParam, Integer includeType) {
// 查询已有的管理范围
List<TaxAgentManageRangePO> taxAgentManageRanges = listByTaxAgentIdAndIncludeType(queryParam.getTaxAgentId(), includeType);
return listPageByParamAndIncludeType(taxAgentManageRanges, queryParam, includeType);
}
private PageInfo<TaxAgentManageRangeListDTO> listPageByParamAndIncludeType(List<TaxAgentManageRangePO> taxAgentManageRanges, TaxAgentManageRangeQueryParam queryParam, Integer includeType) {
// 查询人员信息
List<Object> employeeIds = taxAgentManageRanges.stream()
.filter(e -> Objects.equals(e.getTargetType(), TargetTypeEnum.EMPLOYEE.getValue()))
.map(TaxAgentManageRangePO::getTargetId)
.collect(Collectors.toList());
List<HrmEmployeeComInfo> employeeComInfos = comInfoCache.getCacheList(HrmEmployeeComInfo.class, employeeIds);
// 查询部门信息
List<Object> departmentIds = taxAgentManageRanges.stream()
.filter(e -> Objects.equals(e.getTargetType(), TargetTypeEnum.DEPT.getValue()))
.map(TaxAgentManageRangePO::getTargetId)
.collect(Collectors.toList());
List<HrmDepartmentComInfo> departmentComInfos = comInfoCache.getCacheList(HrmDepartmentComInfo.class, departmentIds);
// 查询分部信息
List<Object> subDepartmentIds = taxAgentManageRanges.stream()
.filter(e -> Objects.equals(e.getTargetType(), TargetTypeEnum.SUBCOMPANY.getValue()))
.map(TaxAgentManageRangePO::getTargetId)
.collect(Collectors.toList());
List<HrmDepartmentComInfo> subDepartmentComInfos = comInfoCache.getCacheList(HrmDepartmentComInfo.class, subDepartmentIds);
// 查询岗位信息
List<Object> positionIds = taxAgentManageRanges.stream()
.filter(e -> Objects.equals(e.getTargetType(), TargetTypeEnum.POSITION.getValue()))
.map(TaxAgentManageRangePO::getTargetId)
.collect(Collectors.toList());
List<HrmPositionComInfo> positionComInfos = comInfoCache.getCacheList(HrmPositionComInfo.class, positionIds);
// 分页参数
Page<TaxAgentManageRangeListDTO> dtoPage = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize());
// 查询人员状态
List<HrmStatus> hrmStatusList = hrmCommonHrmStatusService.list(tenantKey);
// 薪资账套的人员范围po转换成列表dto
List<TaxAgentManageRangeListDTO> 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<TaxAgentManageRangePO> taxAgentManageAllRanges = listByTaxAgentId(saveParam.getTaxAgentId(), tenantKey);
List<TaxAgentManageRangePO> 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<TaxAgentManageRangePO> 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<SalaryEmployee> allSalaryEmployees = this.getManageRangeSalaryEmployees(null, saveParam.getTaxAgentId(), allRanges, tenantKey);
// 如果是排除是否会对分管理范围产生影响
List<TaxAgentManageRangePO> allSubAdminRanges = listSunAdminRangeByTaxAgentId(saveParam.getTaxAgentId(), tenantKey);
if (saveParam.getIncludeType().equals(NumberUtils.INTEGER_ZERO)) {
List<SalaryEmployee> allSubAdminSalaryEmployees = this.getManageRangeSalaryEmployees(null, saveParam.getTaxAgentId(), allSubAdminRanges, tenantKey);
List<Long> 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<TaxAgentManageRangePO> 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<TaxAgentManageRangePO> 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<TaxAgentManageRangePO> taxAgentManageAllRanges = listBySubAdminId(saveParam.getSubAdminId(), tenantKey);
List<TaxAgentManageRangePO> 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<TaxAgentManageRangePO> allSubAdminRangesExist = listSunAdminRangeByTaxAgentId(taxAgentSubAdmin.getTaxAgentId(), tenantKey);
/** 检查当前分管理员的范围与其他分管理员人员范围===========================start */
// 当前分管理员的范围
List<TaxAgentManageRangePO> allSubAdminRangesCuttent = Lists.newArrayList(taxAgentManageAllRanges);
// 其他分管理员的范围
List<TaxAgentManageRangePO> otherSubAdminRangesExist = allSubAdminRangesExist.stream().filter(f -> !f.getTaxAgentSubAdminId().equals(saveParam.getSubAdminId())).collect(Collectors.toList());
allSubAdminRangesCuttent.addAll(result.getNeedInsertTaxAgentManageRanges());
allSubAdminRangesCuttent.addAll(result.getNeedUpdateTaxAgentManageRanges());
// 当前分管理员的所有人员
List<SalaryEmployee> currentSubAdminSalaryEmployees = this.getManageRangeSalaryEmployees(null, taxAgentSubAdmin.getTaxAgentId(), allSubAdminRangesCuttent, tenantKey);
// 其他分管理员的所有人员
List<SalaryEmployee> otherSubAdminSalaryEmployees = this.getManageRangeSalaryEmployees(null, taxAgentSubAdmin.getTaxAgentId(), otherSubAdminRangesExist, tenantKey);
for (SalaryEmployee se : currentSubAdminSalaryEmployees) {
Optional<SalaryEmployee> 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<TaxAgentManageRangePO> 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<TaxAgentManageRangePO> allRanges = listByTaxAgentId(taxAgentSubAdmin.getTaxAgentId(), tenantKey);
List<SalaryEmployee> allSalaryEmployees = this.getManageRangeSalaryEmployees(null, taxAgentSubAdmin.getTaxAgentId(), allRanges, tenantKey);
// 所有分管理员的所有人员
List<SalaryEmployee> allSubAdminSalaryEmployees = this.getManageRangeSalaryEmployees(null, taxAgentSubAdmin.getTaxAgentId(), allSubAdminRanges, tenantKey);
List<Long> 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<TaxAgentManageRangePO> 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<TaxAgentManageRangePO> 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<TaxAgentManageRangePO> listByIds(Collection<Long> 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<Long> ids, Long employeeId, String tenantKey) {
// 查询管理范围
List<TaxAgentManageRangePO> taxAgentManageRanges = listByIds(ids, tenantKey);
if (CollectionUtils.isEmpty(taxAgentManageRanges)) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98604, "数据不存在或已被删除"));
}
List<Long> taxAgentIds = taxAgentManageRanges.stream().map(TaxAgentManageRangePO::getTaxAgentId).distinct().collect(Collectors.toList());
if (taxAgentIds.size() > 1) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(110159, "一次只能删一个个税个税扣缴义务人的范围"));
}
Collection<Long> finalIds = ids;
taxAgentManageRanges = this.listByTaxAgentIds(taxAgentIds, tenantKey);
List<TaxAgentManageRangePO> allManageRanges = taxAgentManageRanges.stream().filter(f -> !finalIds.contains(f.getId())).collect(Collectors.toList());
List<TaxAgentManageRangePO> allRanges = allManageRanges.stream().filter(f -> f.getRangeType().equals(TaxAgentRangeTypeEnum.TAXAGENT.getValue())).collect(Collectors.toList());
List<TaxAgentManageRangePO> allSubAdminRanges = allManageRanges.stream().filter(f -> f.getRangeType().equals(TaxAgentRangeTypeEnum.SUBADMIN.getValue())).collect(Collectors.toList());
Long taxAgentId = taxAgentIds.get(0);
List<SalaryEmployee> allSalaryEmployees = this.getManageRangeSalaryEmployees(null, taxAgentId, allRanges, tenantKey);
List<SalaryEmployee> 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<Long> 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<Long> 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<HrmCommonQueue> 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<TaxAgentManageRangePO> allManageRanges = new LambdaQueryChainWrapper<>(taxAgentManageRangeMapper)
.eq(TaxAgentManageRangePO::getTenantKey, tenantKey)
.eq(TaxAgentManageRangePO::getDeleteType, 0)
.orderByDesc(TaxAgentManageRangePO::getId)
.list();
if (CollectionUtils.isEmpty(allManageRanges)) {
return;
}
List<Long> taxAgentIds = allManageRanges.stream().map(m -> m.getTaxAgentId()).distinct().collect(Collectors.toList());
List<TaxAgentEmpSaveParam> taxAgentEmpSaveParamList = Lists.newArrayList();
List<TaxAgentSubAdminEmpSaveParam> subAdminEmpSaveParamList = Lists.newArrayList();
taxAgentIds.forEach(taxAgentId -> {
// 当前个税扣缴义务人的所有范围
List<TaxAgentManageRangePO> allRanges = allManageRanges.stream().filter(f -> f.getTaxAgentId().equals(taxAgentId) && f.getRangeType().equals(TaxAgentRangeTypeEnum.TAXAGENT.getValue())).collect(Collectors.toList());
List<SalaryEmployee> allSalaryEmployees = this.getManageRangeSalaryEmployees(null, taxAgentId, allRanges, tenantKey);
taxAgentEmpSaveParamList.add(getTaxAgentEmpSyncParam(taxAgentId, allSalaryEmployees));
List<TaxAgentManageRangePO> 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<SalaryEmployee> allSalaryEmployees) {
return TaxAgentEmpSaveParam.builder()
.taxAgentId(taxAgentId)
.salaryEmployeeList(allSalaryEmployees)
.build();
}
/**
* 获取分管理员的同步参数
*
* @param taxAgentId
* @param allSubAdminRanges
* @param tenantKey
* @return
*/
private List<TaxAgentSubAdminEmpSaveParam> getTaxAgentSubAdminEmpSyncParam(Long taxAgentId, List<TaxAgentManageRangePO> allSubAdminRanges, String tenantKey) {
List<Long> allSubAdminIds = allSubAdminRanges.stream().map(TaxAgentManageRangePO::getTaxAgentSubAdminId).distinct().collect(Collectors.toList());
List<TaxAgentSubAdminEmpSaveParam> subAdminEmpSaveParamList = Lists.newArrayList();
allSubAdminIds.forEach(e -> {
List<TaxAgentManageRangePO> singSubAdminRanges = allSubAdminRanges.stream().filter(r -> e.equals(r.getTaxAgentSubAdminId())).collect(Collectors.toList());
List<SalaryEmployee> 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<SalaryEmployee> allSalaryEmployees, List<TaxAgentManageRangePO> allSubAdminRanges, Long employeeId, String tenantKey) {
List<TaxAgentEmpSaveParam> taxAgentEmpSaveParamList = Collections.singletonList(getTaxAgentEmpSyncParam(taxAgentId, allSalaryEmployees));
// 同步个税扣缴义务人的人员
taxAgentEmployeeService.syncTaxAgentEmployee(taxAgentEmpSaveParamList, employeeId, tenantKey);
List<TaxAgentSubAdminEmpSaveParam> subAdminEmpSaveParamList = getTaxAgentSubAdminEmpSyncParam(taxAgentId, allSubAdminRanges, tenantKey);
// 同步分管理员的人员
taxAgentSubAdminEmployeeService.syncTaxAgentSubAdminEmployee(subAdminEmpSaveParamList, employeeId, tenantKey);
}
}

View File

@ -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<TaxAgentAdminPO> taxAgentAdmins = taxAgentAdminService.listByEmployeeId(currentEmployeeId, currentTenantKey);
if (CollectionUtils.isNotEmpty(taxAgentAdmins)) {
return TaxAgentRoleTypeEnum.ADMIN;
}
List<TaxAgentSubAdminPO> 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<TaxAgentAdminPO> taxAgentAdminList = taxAgentAdminService.listByEmployeeId(currentEmployeeId);
return CollectionUtils.isNotEmpty(taxAgentAdminList);
}
}
return Boolean.TRUE;
}
@Override
public Page<TaxAgentPO> listPage(Page<TaxAgentPO> page, TaxAgentQueryParam queryParam, String currentTenantKey) {
taxAgentMapper.list(page, queryParam, currentTenantKey);
return page;
}
@Override
public List<TaxAgentPO> list(TaxAgentQueryParam queryParam, String currentTenantKey) {
return taxAgentMapper.list(queryParam, currentTenantKey);
}
@Override
public List<TaxAgentPO> listByIds(Collection<Long> ids, String tenantKey) {
return new LambdaQueryChainWrapper<>(taxAgentMapper)
.eq(TaxAgentPO::getTenantKey, tenantKey)
.eq(TaxAgentPO::getDeleteType, 0)
.in(TaxAgentPO::getId, ids)
.list();
}
@Override
public List<TaxAgentPO> 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<TaxAgentListDTO> findAll(String tenantKey) {
List<TaxAgentPO> taxAgents = taxAgentMapper.list(TaxAgentQueryParam.builder().build(), tenantKey);
return TaxAgentBO.convertToListDTO(taxAgents, tenantKey);
}
@Override
public Collection<TaxAgentPO> listAllTaxAgents(Long employeeId, String tenantKey) {
List<TaxAgentPO> taxAgents = taxAgentMapper.list(TaxAgentQueryParam.builder().build(), tenantKey);
return handleForDevolution(taxAgents, employeeId, tenantKey);
}
@Override
public Collection<TaxAgentPO> listAllTaxAgentsAsAdmin(Long employeeId, String tenantKey) {
List<TaxAgentPO> taxAgents = taxAgentMapper.list(TaxAgentQueryParam.builder().build(), tenantKey);
// 是否开启分权
boolean isOpenDevolution = taxAgentBaseService.isOpenDevolution(tenantKey);
if (!isOpenDevolution) {
return taxAgents;
}
List<Long> taxAgentIds = taxAgents.stream().map(TaxAgentPO::getId).collect(Collectors.toList());
List<Long> enableTaxAgentIds = Lists.newArrayList();
// 1.判断自己是否是管理员 如果是管理员就是能够查看所属个税扣缴义务人
List<TaxAgentAdminPO> taxAgentAdminList = taxAgentAdminService.listByTaxAgentIds(taxAgentIds, tenantKey);
// 是管理员的列表
List<Long> 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<TaxAgentEmployeeTaxAgentDTO> listAllTaxAgentsAsRange(List<Long> employeeIds, String tenantKey) {
List<TaxAgentPO> taxAgents = taxAgentMapper.list(TaxAgentQueryParam.builder().build(), tenantKey);
List<Long> taxAgentIds = taxAgents.stream().map(TaxAgentPO::getId).collect(Collectors.toList());
List<TaxAgentEmpPO> taxAgentEmployees = taxAgentEmpService.listByTaxAgentIds(taxAgentIds, tenantKey);
if (CollectionUtils.isEmpty(taxAgentEmployees)) {
return Lists.newArrayList();
}
// 转换数据结构
List<Long> allemployeeIds = taxAgentEmployees.stream().map(TaxAgentEmpPO::getEmployeeId).distinct().collect(Collectors.toList());
return allemployeeIds.stream().map(m -> {
List<Long> 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<TaxAgentPO> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("tenant_key", tenantKey)
.eq("delete_type", 0)
.eq("name", saveParam.getName());
List<TaxAgentPO> 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<TaxAgentPO> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("tenant_key", tenantKey)
.eq("delete_type", 0)
.eq("name", saveParam.getName());
List<TaxAgentPO> 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<TaxAgentAdminPO> 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<SalaryAcctRecordPO> 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<Long> ids, Long employeeId, String tenantKey) {
List<TaxAgentPO> 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<Long> ids, String tenantKey) {
// 被薪资档案引用
List<SalaryArchivePO> 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<InsuranceArchivesSocialSchemePO> 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<InsuranceArchivesFundSchemePO> 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<InsuranceArchivesOtherSchemePO> 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<ExtEmployeePO> extEmployeeList = extEmployeeService.listAll(tenantKey);
List<Long> 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<AddUpDeductionPO> 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<OtherDeductionPO> 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<AddUpSituationPO> 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<Map<String, Object>> selectList(Long currentEmployeeId, String currentTenantKey) {
List<TaxAgentPO> taxAgents = taxAgentMapper.list(TaxAgentQueryParam.builder().build(), currentTenantKey);
taxAgents = handleForDevolution(taxAgents, currentEmployeeId, currentTenantKey);
return CollectionUtils.emptyIfNull(taxAgents).stream().map(m -> {
Map<String, Object> 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<TaxAgentPO> handleForDevolution(List<TaxAgentPO> taxAgents, Long currentEmployeeId, String currentTenantKey) {
// 是否开启分权
boolean isOpenDevolution = taxAgentBaseService.isOpenDevolution(currentTenantKey);
if (!isOpenDevolution || isChief(currentEmployeeId, currentTenantKey)) {
return taxAgents;
}
List<Long> taxAgentIds = taxAgents.stream().map(TaxAgentPO::getId).collect(Collectors.toList());
List<Long> enableTaxAgentIds = Lists.newArrayList();
// 1.判断自己是否是管理员 如果是管理员就是能够查看所属个税扣缴义务人
List<TaxAgentAdminPO> taxAgentAdminList = taxAgentAdminService.listByTaxAgentIdsAndEmployeeId(taxAgentIds, currentEmployeeId, currentTenantKey);
// 是管理员的列表
List<Long> adminTaxAgentIds = taxAgentAdminList.stream().map(TaxAgentAdminPO::getTaxAgentId).collect(Collectors.toList());
enableTaxAgentIds.addAll(adminTaxAgentIds);
// 2.根据作为非管理员查找自己作为分管理员的个税扣缴义务人id
List<Long> noAdminTaxAgentIds = taxAgents.stream()
.map(TaxAgentPO::getId)
.filter(id -> !adminTaxAgentIds.contains(id)).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(noAdminTaxAgentIds)) {
List<TaxAgentSubAdminPO> taxAgentSubAdmins = taxAgentSubAdminService.listByTaxAgentIdsAndEmployeeId(noAdminTaxAgentIds, currentEmployeeId, currentTenantKey);
List<Long> 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<TaxAgentManageRangeEmployeeDTO> listTaxAgentAndEmployeeTree(Long employeeId, String tenantKey) {
return listTaxAgentAndEmployeeTree(null, employeeId, tenantKey);
}
@Override
public List<TaxAgentEmployeeDTO> listTaxAgentAndEmployee(Long employeeId, String tenantKey) {
return listTaxAgentAndEmployee(null, employeeId, tenantKey);
}
@Override
public List<TaxAgentManageRangeEmployeeDTO> listTaxAgentAndEmployeeTree(SalaryEmployeeStatusEnum employeeStatus, Long employeeId, String tenantKey) {
List<TaxAgentManageRangeEmployeeDTO> taxAgentManageRangeEmployeeList = Lists.newArrayList();
// 所有个税扣缴义务人
List<TaxAgentPO> allTaxAgents = listAll(tenantKey);
if (CollectionUtils.isEmpty(allTaxAgents)) {
return taxAgentManageRangeEmployeeList;
}
List<Long> taxAgentIds = allTaxAgents.stream().map(TaxAgentPO::getId).collect(Collectors.toList());
List<TaxAgentEmployeePO> allEmployees = taxAgentMapper.listEmployee(tenantKey);
if (employeeStatus != null) {
List<String> personnelStatusList;
// 查询人员状态
List<HrmStatus> 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<String> 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<String> 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<TaxAgentAdminPO> taxAgentAdminList = taxAgentAdminService.listByTaxAgentIdsAndEmployeeId(taxAgentIds, employeeId, tenantKey);
// 是管理员的列表
List<Long> adminTaxAgentIds = taxAgentAdminList.stream().map(TaxAgentAdminPO::getTaxAgentId).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(adminTaxAgentIds)) {
taxAgentManageRangeEmployeeList.addAll(getTaxAgentEmp(allTaxAgents, adminTaxAgentIds, allEmployees, tenantKey));
}
// 2.根据作为非管理员查找自己作为分管理员 对应的管理范围人员
List<Long> 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<TaxAgentManageRangeEmployeeDTO> getTaxAgentSubAdminEmp(List<TaxAgentPO> allTaxAgents, List<Long> noAdminTaxAgentIds, List<TaxAgentEmployeePO> allEmployees, String tenantKey) {
List<TaxAgentManageRangeEmployeeDTO> taxAgentManageRangeEmployeeList = Lists.newArrayList();
List<TaxAgentSubAdminEmpPO> taxAgentEmps = taxAgentSubAdminEmpService.listByTaxAgentIds(noAdminTaxAgentIds, tenantKey);
taxAgentEmps = taxAgentEmps.stream().filter(f -> allEmployees.stream().anyMatch(e -> e.getEmployeeId().equals(f.getEmployeeId()))).collect(Collectors.toList());
List<TaxAgentSubAdminEmpPO> finalTaxAgentEmps = taxAgentEmps;
noAdminTaxAgentIds.forEach(e -> {
Optional<TaxAgentPO> optionalTaxAgent = allTaxAgents.stream().filter(t -> t.getId().equals(e)).findFirst();
String taxAgentName = (optionalTaxAgent.isPresent() ? optionalTaxAgent.get().getName() : "");
List<TaxAgentManageRangeEmployeeDTO.TaxAgentEmployee> 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<TaxAgentManageRangeEmployeeDTO> getTaxAgentEmp(List<TaxAgentPO> allTaxAgents, List<Long> taxAgentIds, List<TaxAgentEmployeePO> allEmployees, String tenantKey) {
List<TaxAgentManageRangeEmployeeDTO> taxAgentManageRangeEmployeeList = Lists.newArrayList();
List<TaxAgentEmpPO> taxAgentEmps = taxAgentEmpService.listByTaxAgentIds(taxAgentIds, tenantKey);
taxAgentEmps = taxAgentEmps.stream().filter(f -> allEmployees.stream().anyMatch(e -> e.getEmployeeId().equals(f.getEmployeeId()))).collect(Collectors.toList());
List<TaxAgentEmpPO> finalTaxAgentEmps = taxAgentEmps;
taxAgentIds.forEach(e -> {
Optional<TaxAgentPO> optionalTaxAgent = allTaxAgents.stream().filter(t -> t.getId().equals(e)).findFirst();
String taxAgentName = (optionalTaxAgent.isPresent() ? optionalTaxAgent.get().getName() : "");
List<TaxAgentManageRangeEmployeeDTO.TaxAgentEmployee> 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<TaxAgentEmployeeDTO> listTaxAgentAndEmployee(SalaryEmployeeStatusEnum employeeStatus, Long employeeId, String tenantKey) {
List<TaxAgentEmployeeDTO> taxAgentEmployeeList = Lists.newArrayList();
List<TaxAgentManageRangeEmployeeDTO> taxAgentManageRangeEmployeeList = listTaxAgentAndEmployeeTree(employeeStatus, employeeId, tenantKey);
taxAgentManageRangeEmployeeList.forEach(m -> {
List<TaxAgentManageRangeEmployeeDTO.TaxAgentEmployee> 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;
}
}

View File

@ -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);
}
}

View File

@ -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<String, Object>, Map<String, Object>>(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<Map<String, Boolean>> permission() {
return WeaResult.success(taxAgentWrapper.permission(UserContext.getCurrentEmployeeId(), TenantContext.getCurrentTenantKey()));
}
//------------------------------------------------------------------------------------------
//个税扣缴义务人列表
@GET
@Path("/list")

View File

@ -46,7 +46,7 @@ public class SalaryArchiveTaxAgentWrapper extends Service {
return (TaxAgentService) ServiceUtil.getService(TaxAgentServiceImpl.class, user);
}
// @Resource
//
// private SalaryBatchService salaryBatchService;
// @Autowired
// private ExecutorService taskExecutor;

View File

@ -65,7 +65,7 @@ public class SalarySendWrapper extends Service {
// }
// @Resource
//
// private SalaryBatchService salaryBatchService;
// @Autowired
// private ExecutorService taskExecutor;

View File

@ -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<String, Boolean> permission(Long currentEmployeeId, String currentTenantKey) {
Map<String, Boolean> 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<LinkedHashMap> list(TaxAgentQueryParam queryParam, Long currentEmployeeId, String currentTenantKey) {
// 是否是总管理员
Boolean isChief = taxAgentService.isChief(currentEmployeeId, currentTenantKey);
// 是否开启分权
boolean isOpenDevolution = taxAgentBaseService.isOpenDevolution(currentTenantKey);
List<PaymentAgencyPO> paymentAgencyPOS = paymentAgencyService.listAll(currentTenantKey);
Page<TaxAgentPO> page = new Page<>(queryParam.getCurrent(), queryParam.getPageSize(), true);
if (isChief) {
page = taxAgentService.listPage(page, queryParam, currentTenantKey);
} else {
// 分权情况下根据自己作为管理员过滤列表
if (isOpenDevolution) {
List<TaxAgentPO> list = taxAgentService.list(queryParam, currentTenantKey);
// 1.判断自己是否是管理员 如果是管理员就是能够操作所属个税扣缴义务人下的所有人的数据
List<TaxAgentAdminPO> taxAgentAdminList = taxAgentAdminService.listByTaxAgentIdsAndEmployeeId(list.stream().map(TaxAgentPO::getId).collect(Collectors.toList()),
currentEmployeeId, currentTenantKey);
// 是管理员的列表
List<Long> adminTaxAgentIds = taxAgentAdminList.stream().map(TaxAgentAdminPO::getTaxAgentId).collect(Collectors.toList());
// 分页参数
Page<TaxAgentPO> 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<Map<String, Object>> listPage = new Page<>(page.getCurrent(), page.getSize(), page.getTotal(), page.isSearchCount());
String setLabel = SalaryI18nUtil.getI18nLabel(currentTenantKey, currentEmployeeId, 94614, "设置");
if (isOpenDevolution) {
List<Long> taxAgentIds = page.getRecords().stream().map(TaxAgentPO::getId).collect(Collectors.toList());
List<TaxAgentAdminPO> taxAgentAdmins = taxAgentAdminService.listByTaxAgentIds(taxAgentIds, currentTenantKey);
List<SimpleEmployee> 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<LinkedHashMap> weaTable = FormatManager.<LinkedHashMap>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<Map<String, Object>> paymentAgencyList(TaxAgentQueryParam queryParam, Long currentEmployeeId, String currentTenantKey) {
List<TaxAgentPO> taxAgentPOS = taxAgentService.listByIds(queryParam.getIds(), currentTenantKey);
List<PaymentAgencyPO> 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<TaxAgentPO> taxAgentPOS = taxAgentService.listByIds(Collections.singletonList(param.getId()), currentTenantKey);
SalaryAssert.notEmpty(taxAgentPOS, "data is not exist");
TaxAgentPO taxAgentPO = taxAgentPOS.get(0);
List<String> errorList = new ArrayList<>();
List<String> resultList = new ArrayList<>();
if (StringUtils.isNotBlank(taxAgentPO.getPaymentAgency())) {
List<String> originList = new ArrayList<>(Arrays.asList(taxAgentPO.getPaymentAgency().split(",")));
List<String> list = new ArrayList<>(Arrays.asList(param.getPaymentAgency().split(",")));
originList.removeAll(list);
if (CollectionUtils.isNotEmpty(originList)) {
originList.stream().forEach(e -> {
List<InsuranceEmployeeStatusPO> 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<PaymentAgencyPO> paymentAgencyPOS = paymentAgencyService.listAll(currentTenantKey);
errorList.forEach(e -> {
Optional<PaymentAgencyPO> 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.<TaxAgentFormDTO>getInstance().genForm(TaxAgentFormDTO.class, taxAgentFromDTO);
// 是否开启分权
boolean isOpenDevolution = taxAgentBaseService.isOpenDevolution(currentTenantKey);
if (isOpenDevolution) {
List<TaxAgentAdminPO> 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<String, Object> 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<Long> ids, Long currentEmployeeId, String currentTenantKey) {
return taxAgentService.delete(ids, currentEmployeeId, currentTenantKey);
}
/**
* 个税扣缴义务人下拉列表
*
* @param currentEmployeeId
* @param currentTenantKey
* @return
*/
public List<Map<String, Object>> selectList(Long currentEmployeeId, String currentTenantKey) {
return taxAgentService.selectList(currentEmployeeId, currentTenantKey);
}
/**
* 范围列表
*
* @param queryParam
* @param employeeId
* @param tenantKey
* @return
*/
public WeaTable<TaxAgentManageRangeListDTO> listRangeInclude(TaxAgentRangeQueryParam queryParam, Long employeeId, String tenantKey) {
Page<TaxAgentManageRangeListDTO> listPage = taxAgentManageRangeService.listPageByParamAndIncludeType(queryParam, NumberUtils.INTEGER_ONE, tenantKey);
WeaTable<TaxAgentManageRangeListDTO> weaTable = SalaryFormatUtil.<TaxAgentManageRangeListDTO>getInstance().buildTable(TaxAgentManageRangeListDTO.class, listPage);
weaTable.setModule("hrmsalary");
weaTable.setPageUid("taxAgentRangeIncludeList");
return weaTable;
}
/**
* 范围排除列表
*
* @param queryParam
* @param employeeId
* @param tenantKey
* @return
*/
public WeaTable<TaxAgentManageRangeListDTO> listRangeExclude(TaxAgentRangeQueryParam queryParam, Long employeeId, String tenantKey) {
Page<TaxAgentManageRangeListDTO> listPage = taxAgentManageRangeService.listPageByParamAndIncludeType(queryParam, NumberUtils.INTEGER_ZERO, tenantKey);
WeaTable<TaxAgentManageRangeListDTO> weaTable = SalaryFormatUtil.<TaxAgentManageRangeListDTO>getInstance().buildTable(TaxAgentManageRangeListDTO.class, listPage);
weaTable.setModule("hrmsalary");
weaTable.setPageUid("taxAgentRangeExcludeList");
return weaTable;
}
/**
* 获取管理范围表单
*
* @return
*/
public WeaForm getRangeFrom(String tenantKey) {
// 查询人员状态
List<HrmStatus> hrmStatusList = hrmCommonHrmStatusService.list(tenantKey);
List<WeaFormOption> 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<TypesBrowserOption> 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.<TaxAgentManageRangeFormDTO>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<Long> ids, Long employeeId, String tenantKey) {
taxAgentManageRangeService.deleteByIds(ids, employeeId, tenantKey);
return StringUtils.EMPTY;
}
}

71
src/demo.java Normal file
View File

@ -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) {
//全天会议可用的时间点900-1800每15min
List<LocalTime> 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<String> takeUpStringList = new ArrayList(){{
}};
List<LocalTime> takeUpTimeList = takeUpStringList.stream().map(LocalTime::parse).collect(Collectors.toList());
//比较两个时间点数组将全天的时间点分割
List<Integer> 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<LocalTime>> 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<String> list = new ArrayList<String>();//用来接收划分后的时间
//进行循环将时间按照分钟进行划分
for (Date i = start; i.before(end); ) {
list.add(simpleDateFormat.format(i));
i.setMinutes(i.getMinutes() + 1);
}
}
}