新建账套携带各扣缴义务人人员范围
This commit is contained in:
parent
e7eb2e3459
commit
5ccee97429
|
|
@ -1,19 +1,6 @@
|
|||
<?xml version="1.0" encoding="GB2312"?>
|
||||
|
||||
<config name="薪酬管理权限" key="salary">
|
||||
<!-- <module name="我的薪资福利" key="myBill">-->
|
||||
<!-- <page name="我的薪资福利" key="myBill">-->
|
||||
<!-- <opt name="查询" key="query" able="true"/>-->
|
||||
<!-- </page>-->
|
||||
<!-- </module>-->
|
||||
|
||||
<module name="配置" key="config">
|
||||
<page name="薪资账套" key="salarySob">
|
||||
<opt name="查询" key="query"/>
|
||||
<opt name="管理" key="admin"/>
|
||||
</page>
|
||||
|
||||
</module>
|
||||
|
||||
<module name="算薪" key="calculate">
|
||||
<page name="薪资档案" key="salaryArchive">
|
||||
|
|
@ -33,6 +20,13 @@
|
|||
</module>
|
||||
|
||||
<module name="个税" key="tax">
|
||||
<page name="个税申报" key="taxDeclaration">
|
||||
<opt name="查询" key="query"/>
|
||||
<opt name="管理" key="admin"/>
|
||||
</page>
|
||||
</module>
|
||||
|
||||
<module name="报表" key="tax">
|
||||
<page name="个税申报" key="taxdeclaration">
|
||||
<opt name="查询" key="query"/>
|
||||
<opt name="管理" key="admin"/>
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ public class SalarySobBO {
|
|||
.updateTime(now)
|
||||
.deleteType(NumberUtils.INTEGER_ZERO)
|
||||
.tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY)
|
||||
.taxAgentId(saveParam.getTaxAgentId())
|
||||
.taxAgentId(saveParam.getTaxAgentIds().get(0))
|
||||
.build();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -38,9 +38,6 @@ public class SalarySobBasicSaveParam {
|
|||
/**
|
||||
* 个税扣缴义务人的主键id
|
||||
*/
|
||||
@DataCheck(require = true, message = "个税扣缴义务人的主键id不允许为空")
|
||||
private Long taxAgentId;
|
||||
|
||||
private List<Long> taxAgentIds;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@ package com.engine.salary.entity.salarysob.param;
|
|||
import com.engine.salary.util.valid.DataCheck;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 薪资账套复制参数
|
||||
* <p>Copyright: Copyright (c) 2022</p>
|
||||
|
|
@ -27,9 +29,5 @@ public class SalarySobDuplicateParam {
|
|||
@DataCheck(require = true, max = 40, message = "名称不允许为空且名称不能超过40个字符长度")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 个税扣缴义务人id
|
||||
*/
|
||||
@DataCheck(require = true, message = "个税扣缴义务人不允许为空")
|
||||
private Long taxAgentId;
|
||||
private List<Long> taxAgentIds;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import lombok.NoArgsConstructor;
|
|||
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 数据
|
||||
|
|
@ -68,5 +69,6 @@ public class SobTaxLinkPO {
|
|||
|
||||
//主键id集合
|
||||
private Collection<Long> ids;
|
||||
private List<Long> taxAgentIds;
|
||||
|
||||
}
|
||||
|
|
@ -1,6 +1,8 @@
|
|||
package com.engine.salary.entity.taxdeclaration.po;
|
||||
|
||||
import com.engine.salary.annotation.Auth;
|
||||
import com.engine.salary.common.LocalDateRange;
|
||||
import com.engine.salary.enums.auth.AuthCheckTypeEnum;
|
||||
import com.engine.salary.enums.salarysob.IncomeCategoryEnum;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
|
|
@ -23,6 +25,7 @@ import java.util.Date;
|
|||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
//hrsa_tax_declaration
|
||||
@Auth(page = "taxDeclaration",checkType = AuthCheckTypeEnum.TAX)
|
||||
public class TaxDeclarationPO {
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ public enum AuthCheckTypeEnum implements BaseEnum<String> {
|
|||
TAX_EMP("TAX_EMP", "扣缴义务人和人员混合验证", 87627),
|
||||
EMP("EMP", "人员验证", 87626),
|
||||
TAX("TAX", "扣缴义务人验证", 87626),
|
||||
SOB("SOB", "扣缴义务人验证", 87626);
|
||||
SOB("SOB", "账套验证", 87626);
|
||||
|
||||
|
||||
private String value;
|
||||
|
|
|
|||
|
|
@ -15,10 +15,10 @@ import java.util.Objects;
|
|||
**/
|
||||
public enum AuthFilterTypeEnum implements BaseEnum<String> {
|
||||
|
||||
DATA_OPT("DATA_OPT", "数据&功能权限", 87626),
|
||||
ONLY_DATA("ONLY_DATA", "仅数据权限", 87627);
|
||||
// ONLY_OPT("ONLY_OPT", "仅功能权限", 87626) ;
|
||||
|
||||
ONLY_DATA("ONLY_DATA", "仅数据权限", 87627),
|
||||
// ONLY_OPT("ONLY_OPT", "仅功能权限", 87626),
|
||||
DATA_OPT("DATA_OPT", "数据&功能权限", 87626);
|
||||
|
||||
|
||||
private String value;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
package com.engine.salary.mapper.auth;
|
||||
|
||||
import com.engine.salary.entity.auth.dto.AuthDTO;
|
||||
import com.engine.salary.entity.auth.dto.AuthLimitDTO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -10,7 +9,9 @@ public interface AuthMapper {
|
|||
|
||||
List<AuthDTO> getAuth(@Param("uid") Long uid, @Param("page") String page);
|
||||
|
||||
List<AuthLimitDTO> getLimitSobs(@Param("uid") Long uid);
|
||||
List<Long> getLimitSobs(@Param("uid") Long uid);
|
||||
|
||||
List<Long> getLimitTaxAgents(@Param("uid") Long uid);
|
||||
|
||||
List<String> getOptsByPage(@Param("uid") Long uid, @Param("page") String page);
|
||||
}
|
||||
|
|
@ -14,34 +14,30 @@
|
|||
</resultMap>
|
||||
|
||||
<select id="getAuth" resultMap="BaseResultMap">
|
||||
select role.tax_agent_id, d.employee_id, o.id as optId,o.page,o.opt
|
||||
select resource.target as tax_agent_id, d.employee_id, o.id as optId,o.page,o.opt
|
||||
from hrsa_auth_role_emp emp
|
||||
left join hrsa_auth_role role on emp.role_id = role.id
|
||||
left join hrsa_auth_role_data d on emp.role_id = d.role_id
|
||||
left join hrsa_auth_opt o on d.role_id = o.role_id
|
||||
where emp.delete_type = 0 and role.delete_type = 0 and d.delete_type = 0 and o.delete_type = 0
|
||||
and emp.employee_id = #{uid} and o.page = #{page}
|
||||
left join hrsa_auth_role role on emp.role_id = role.id and emp.delete_type = 0 and role.delete_type = 0
|
||||
left join hrsa_auth_resource resource on resource.role_id = role.id and resource.target_type=1 and resource.delete_type = 0
|
||||
left join hrsa_auth_role_data d on emp.role_id = d.role_id and d.delete_type = 0
|
||||
left join hrsa_auth_opt o on d.role_id = o.role_id and o.delete_type = 0
|
||||
where emp.employee_id = #{uid} and o.page = #{page}
|
||||
</select>
|
||||
|
||||
|
||||
<resultMap id="getLimitSobMap" type="com.engine.salary.entity.auth.dto.AuthLimitDTO">
|
||||
<id column="tax_agent_id" property="taxAgentId"/>
|
||||
<collection property="roleLimits" ofType="com.engine.salary.entity.auth.dto.RoleLimit">
|
||||
<id column="roleId" property="roleId"/>
|
||||
<collection property="sobIds" ofType="long" javaType="arraylist">
|
||||
<constructor>
|
||||
<arg column="sob_id"/>
|
||||
</constructor>
|
||||
</collection>
|
||||
</collection>
|
||||
</resultMap>
|
||||
<select id="getLimitSobs" resultType="long">
|
||||
select resource.target
|
||||
from hrsa_auth_role_emp emp
|
||||
left join hrsa_auth_role role on emp.role_id = role.id and emp.delete_type = 0 and role.delete_type = 0
|
||||
left join hrsa_auth_resource resource on resource.role_id = role.id and resource.target_type=2 and resource.delete_type = 0
|
||||
where emp.employee_id = #{uid}
|
||||
</select>
|
||||
|
||||
<select id="getLimitSobs" resultMap="getLimitSobMap">
|
||||
select role.tax_agent_id ,role.id as roleId,lim.sob_id
|
||||
from hrsa_auth_role role
|
||||
left join hrsa_auth_limit lim on role.id = lim.role_id and lim.delete_type = 0 and role.delete_type = 0
|
||||
left join hrsa_auth_role_emp emp on role.id = emp.role_id and emp.delete_type = 0
|
||||
and emp.employee_id = #{uid}
|
||||
<select id="getLimitTaxAgents" resultType="long">
|
||||
select resource.target
|
||||
from hrsa_auth_role_emp emp
|
||||
left join hrsa_auth_role role on emp.role_id = role.id and emp.delete_type = 0 and role.delete_type = 0
|
||||
left join hrsa_auth_resource resource on resource.role_id = role.id and resource.target_type=1 and resource.delete_type = 0
|
||||
where emp.employee_id = #{uid}
|
||||
</select>
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -56,4 +56,6 @@ public interface SalarySobMapper {
|
|||
|
||||
|
||||
List<SalarySobPO> listByTaxAgentId(Long taxAgentId);
|
||||
|
||||
List<SalarySobPO> listByTaxAgentIds(@Param("taxAgentIds") List<Long> taxAgentIds);
|
||||
}
|
||||
|
|
@ -512,7 +512,21 @@
|
|||
SELECT
|
||||
<include refid="baseColumns"/>
|
||||
FROM hrsa_salary_sob t
|
||||
WHERE t.delete_type = 0 and t.id in (select sob_id from hrsa_sob_tax_link where delete_type=0 and tax_agent_id=#{taxAgentId})
|
||||
WHERE t.delete_type = 0 and t.id in (select sob_id from hrsa_sob_tax_link where delete_type=0 and
|
||||
tax_agent_id=#{taxAgentId})
|
||||
</select>
|
||||
|
||||
<select id="listByTaxAgentIds" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="baseColumns"/>
|
||||
FROM hrsa_salary_sob t
|
||||
WHERE t.delete_type = 0
|
||||
and t.id in
|
||||
(select sob_id from hrsa_sob_tax_link where delete_type=0 and tax_agent_id IN
|
||||
<foreach collection="taxAgentIds" open="(" item="taxAgentId" separator="," close=")">
|
||||
#{taxAgentId}
|
||||
</foreach>
|
||||
)
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
@ -78,6 +78,12 @@
|
|||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="taxAgentIds != null and taxAgentIds.size()>0">
|
||||
AND tax_agent_id IN
|
||||
<foreach collection="taxAgentIds" open="(" item="taxAgentId" separator="," close=")">
|
||||
#{taxAgentId}
|
||||
</foreach>
|
||||
</if>
|
||||
ORDER BY id DESC
|
||||
</select>
|
||||
|
||||
|
|
|
|||
|
|
@ -143,15 +143,6 @@ public interface SalarySobService {
|
|||
*/
|
||||
SalarySobCycleDTO getSalarySobCycle(Long id, YearMonth salaryMonth);
|
||||
|
||||
/**
|
||||
* 按权限过滤掉无权限的薪资账套
|
||||
*
|
||||
* 总管理员拥有权限
|
||||
* @param salarySobPOS
|
||||
* @return
|
||||
*/
|
||||
List<SalarySobPO> filterByAuthority(List<SalarySobPO> salarySobPOS);
|
||||
|
||||
/**
|
||||
* 根据扣缴义务人查询
|
||||
* @param taxAgentIds
|
||||
|
|
|
|||
|
|
@ -38,6 +38,8 @@ public interface TaxAgentManageRangeService {
|
|||
*/
|
||||
PageInfo<TaxAgentManageRangeListDTO> listPageByParamAndIncludeType(TaxAgentRangeQueryParam queryParam, Integer includeType);
|
||||
|
||||
List<TaxAgentManageRangePO> listByTaxAgentIdAndIncludeType(Long taxAgentId, Integer includeType);
|
||||
|
||||
/**
|
||||
* 根据分管理员id集合查询范围列表
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
package com.engine.salary.service.auth;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.salary.constant.SalaryDefaultTenantConstant;
|
||||
import com.engine.salary.entity.auth.dto.AuthRoleEmpDTO;
|
||||
|
|
@ -15,13 +14,10 @@ import com.engine.salary.exception.SalaryRunTimeException;
|
|||
import com.engine.salary.mapper.auth.AuthMemberMapper;
|
||||
import com.engine.salary.mapper.auth.AuthRoleEmpMapper;
|
||||
import com.engine.salary.mapper.auth.AuthRoleMapper;
|
||||
import com.engine.salary.service.TaxAgentService;
|
||||
import com.engine.salary.service.impl.TaxAgentServiceImpl;
|
||||
import com.engine.salary.util.SalaryEntityUtil;
|
||||
import com.engine.salary.util.db.IdGenerator;
|
||||
import com.engine.salary.util.db.MapperProxyFactory;
|
||||
import com.google.common.collect.Lists;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
|
@ -42,11 +38,6 @@ public class AuthMemberServiceImpl extends Service implements AuthMemberService
|
|||
}
|
||||
|
||||
|
||||
private TaxAgentService getTaxAgentService(User user) {
|
||||
return ServiceUtil.getService(TaxAgentServiceImpl.class, user);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<AuthMemberPO> list(Long roleId) {
|
||||
return getAuthMemberMapper().listSome(AuthMemberPO.builder().roleId(roleId).build());
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ public class AuthRoleServiceImpl extends Service implements AuthRoleService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Long saveRole(AuthRoleSaveParam param) {
|
||||
public Long saveRole(AuthRoleSaveParam param) {
|
||||
Date now = new Date();
|
||||
Long id = param.getId();
|
||||
String name = param.getName();
|
||||
|
|
|
|||
|
|
@ -5,15 +5,16 @@ import com.engine.common.util.ServiceUtil;
|
|||
import com.engine.core.impl.Service;
|
||||
import com.engine.salary.annotation.Auth;
|
||||
import com.engine.salary.entity.auth.dto.AuthDTO;
|
||||
import com.engine.salary.entity.auth.dto.AuthLimitDTO;
|
||||
import com.engine.salary.entity.auth.dto.EmpOpt;
|
||||
import com.engine.salary.entity.auth.dto.RoleLimit;
|
||||
import com.engine.salary.entity.auth.vo.Permission;
|
||||
import com.engine.salary.entity.salarysob.po.SalarySobPO;
|
||||
import com.engine.salary.enums.auth.AuthCheckTypeEnum;
|
||||
import com.engine.salary.enums.auth.AuthFilterTypeEnum;
|
||||
import com.engine.salary.exception.SalaryRunTimeException;
|
||||
import com.engine.salary.mapper.auth.AuthMapper;
|
||||
import com.engine.salary.service.SalarySobService;
|
||||
import com.engine.salary.service.TaxAgentService;
|
||||
import com.engine.salary.service.impl.SalarySobServiceImpl;
|
||||
import com.engine.salary.service.impl.TaxAgentServiceImpl;
|
||||
import com.engine.salary.util.SalaryEntityUtil;
|
||||
import com.engine.salary.util.db.MapperProxyFactory;
|
||||
|
|
@ -29,6 +30,10 @@ public class AuthServiceImpl extends Service implements AuthService {
|
|||
return ServiceUtil.getService(TaxAgentServiceImpl.class, user);
|
||||
}
|
||||
|
||||
private SalarySobService getSalarySobService(User user) {
|
||||
return ServiceUtil.getService(SalarySobServiceImpl.class, user);
|
||||
}
|
||||
|
||||
private AuthRoleService getAuthRoleService(User user) {
|
||||
return ServiceUtil.getService(AuthRoleServiceImpl.class, user);
|
||||
}
|
||||
|
|
@ -61,9 +66,9 @@ public class AuthServiceImpl extends Service implements AuthService {
|
|||
//给总管理员赋值最大权限
|
||||
Boolean isChief = getTaxAgentService(user).isChief((long) user.getUID());
|
||||
if (isChief) {
|
||||
list.forEach(t -> {
|
||||
try {
|
||||
if (filterType == AuthFilterTypeEnum.DATA_OPT) {
|
||||
if (filterType == AuthFilterTypeEnum.DATA_OPT) {
|
||||
list.forEach(t -> {
|
||||
try {
|
||||
Method optsFieldGetterMethod = t.getClass().getMethod(optsFieldGetter);
|
||||
Set<String> opts = (Set<String>) optsFieldGetterMethod.invoke(t);
|
||||
if (opts == null) {
|
||||
|
|
@ -74,51 +79,82 @@ public class AuthServiceImpl extends Service implements AuthService {
|
|||
|
||||
Method optsFieldSetterMethod = t.getClass().getMethod(optsFieldSetter, Set.class);
|
||||
optsFieldSetterMethod.invoke(t, opts);
|
||||
} catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException e) {
|
||||
throw new SalaryRunTimeException(e);
|
||||
}
|
||||
} catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException e) {
|
||||
throw new SalaryRunTimeException(e);
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
List<T> resultList = new ArrayList<>();
|
||||
|
||||
String page = auth.page();
|
||||
AuthCheckTypeEnum checkType = auth.checkType();
|
||||
|
||||
//给各管理员赋值对应的扣缴义务人权限
|
||||
List<Long> adminTaxAgentIds = getTaxAgentService(user).getAdminTaxAgentIds((long) user.getUID());
|
||||
if (CollectionUtil.isNotEmpty(adminTaxAgentIds)) {
|
||||
Iterator<T> iterator = list.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
try {
|
||||
T t = iterator.next();
|
||||
Method taxAgentIdFieldGetterMethod = t.getClass().getMethod(taxAgentIdFieldGetter);
|
||||
Long taxAgentId = (Long) taxAgentIdFieldGetterMethod.invoke(t);
|
||||
if (checkType == AuthCheckTypeEnum.TAX || checkType == AuthCheckTypeEnum.TAX_EMP) {
|
||||
while (iterator.hasNext()) {
|
||||
try {
|
||||
T t = iterator.next();
|
||||
Method taxAgentIdFieldGetterMethod = t.getClass().getMethod(taxAgentIdFieldGetter);
|
||||
Long taxAgentId = (Long) taxAgentIdFieldGetterMethod.invoke(t);
|
||||
|
||||
if (adminTaxAgentIds.contains(taxAgentId)) {
|
||||
if (filterType == AuthFilterTypeEnum.DATA_OPT) {
|
||||
Method optsFieldGetterMethod = t.getClass().getMethod(optsFieldGetter);
|
||||
Set<String> opts = (Set<String>) optsFieldGetterMethod.invoke(t);
|
||||
if (opts == null) {
|
||||
opts = new HashSet<>();
|
||||
if (adminTaxAgentIds.contains(taxAgentId)) {
|
||||
if (filterType == AuthFilterTypeEnum.DATA_OPT) {
|
||||
Method optsFieldGetterMethod = t.getClass().getMethod(optsFieldGetter);
|
||||
Set<String> opts = (Set<String>) optsFieldGetterMethod.invoke(t);
|
||||
if (opts == null) {
|
||||
opts = new HashSet<>();
|
||||
}
|
||||
opts.add("query");
|
||||
opts.add("admin");
|
||||
|
||||
Method optsFieldSetterMethod = t.getClass().getMethod(optsFieldSetter, Set.class);
|
||||
optsFieldSetterMethod.invoke(t, opts);
|
||||
}
|
||||
opts.add("query");
|
||||
opts.add("admin");
|
||||
|
||||
Method optsFieldSetterMethod = t.getClass().getMethod(optsFieldSetter, Set.class);
|
||||
optsFieldSetterMethod.invoke(t, opts);
|
||||
resultList.add(t);
|
||||
}
|
||||
} else {
|
||||
iterator.remove();
|
||||
} catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException e) {
|
||||
throw new SalaryRunTimeException(e);
|
||||
}
|
||||
}
|
||||
} else if (checkType == AuthCheckTypeEnum.SOB) {
|
||||
List<SalarySobPO> salarySobPOS = getSalarySobService(user).listByTaxAgentIds(adminTaxAgentIds);
|
||||
Set<Long> adminSobIds = SalaryEntityUtil.properties(salarySobPOS, SalarySobPO::getId);
|
||||
while (iterator.hasNext()) {
|
||||
try {
|
||||
T t = iterator.next();
|
||||
Method sobIdFieldGetterMethod = t.getClass().getMethod(sobIdFieldGetter);
|
||||
Long sobId = (Long) sobIdFieldGetterMethod.invoke(t);
|
||||
if (adminSobIds.contains(sobId)) {
|
||||
if (filterType == AuthFilterTypeEnum.DATA_OPT) {
|
||||
Method optsFieldGetterMethod = t.getClass().getMethod(optsFieldGetter);
|
||||
Set<String> opts = (Set<String>) optsFieldGetterMethod.invoke(t);
|
||||
if (opts == null) {
|
||||
opts = new HashSet<>();
|
||||
}
|
||||
opts.add("query");
|
||||
opts.add("admin");
|
||||
|
||||
Method optsFieldSetterMethod = t.getClass().getMethod(optsFieldSetter, Set.class);
|
||||
optsFieldSetterMethod.invoke(t, opts);
|
||||
}
|
||||
resultList.add(t);
|
||||
}
|
||||
} catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException e) {
|
||||
throw new SalaryRunTimeException(e);
|
||||
}
|
||||
} catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException e) {
|
||||
throw new SalaryRunTimeException(e);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
list.removeAll(resultList);
|
||||
|
||||
//给各角色赋权
|
||||
String page = auth.page();
|
||||
AuthCheckTypeEnum checkType = auth.checkType();
|
||||
List<AuthDTO> authDTOS = getAuthMapper().getAuth((long) user.getUID(), page);
|
||||
Map<Long, List<EmpOpt>> authMap = SalaryEntityUtil.convert2Map(authDTOS, AuthDTO::getTaxAgentId, AuthDTO::getEmps);
|
||||
|
||||
|
|
@ -150,50 +186,45 @@ public class AuthServiceImpl extends Service implements AuthService {
|
|||
Method optsFieldSetterMethod = t.getClass().getMethod(optsFieldSetter, Set.class);
|
||||
optsFieldSetterMethod.invoke(t, opts);
|
||||
}
|
||||
} else {
|
||||
iterator.remove();
|
||||
resultList.add(t);
|
||||
}
|
||||
} else {
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
} else if (checkType == AuthCheckTypeEnum.SOB) {
|
||||
List<AuthLimitDTO> limitSobs = getAuthMapper().getLimitSobs((long) user.getUID());
|
||||
Map<Long, List<RoleLimit>> taxLimitSobs = SalaryEntityUtil.convert2Map(limitSobs, AuthLimitDTO::getTaxAgentId, AuthLimitDTO::getRoleLimits);
|
||||
List<Long> limits = getAuthMapper().getLimitSobs((long) user.getUID());
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
T t = iterator.next();
|
||||
Method sobIdFieldGetterMethod = t.getClass().getMethod(sobIdFieldGetter);
|
||||
Long sobId = (Long) sobIdFieldGetterMethod.invoke(t);
|
||||
|
||||
if (limits.contains(sobId)) {
|
||||
if (filterType == AuthFilterTypeEnum.DATA_OPT) {
|
||||
|
||||
}
|
||||
resultList.add(t);
|
||||
}
|
||||
}
|
||||
} else if (checkType == AuthCheckTypeEnum.TAX) {
|
||||
List<Long> limits = getAuthMapper().getLimitTaxAgents((long) user.getUID());
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
T t = iterator.next();
|
||||
Method taxAgentIdFieldGetterMethod = t.getClass().getMethod(taxAgentIdFieldGetter);
|
||||
Long taxAgentId = (Long) taxAgentIdFieldGetterMethod.invoke(t);
|
||||
Method sobIdFieldGetterMethod = t.getClass().getMethod(sobIdFieldGetter);
|
||||
Long sobId = (Long) sobIdFieldGetterMethod.invoke(t);
|
||||
|
||||
if (taxLimitSobs.containsKey(taxAgentId)) {
|
||||
boolean hasAuth = false;
|
||||
List<RoleLimit> roleLimits = taxLimitSobs.get(taxAgentId);
|
||||
for (RoleLimit roleLimit : roleLimits) {
|
||||
List<Long> sobIds = roleLimit.getSobIds();
|
||||
if (CollectionUtil.isEmpty(sobIds)) {
|
||||
hasAuth = true;
|
||||
} else {
|
||||
hasAuth = sobIds.contains(sobId);
|
||||
}
|
||||
if (hasAuth) {
|
||||
break;
|
||||
}
|
||||
if (limits.contains(taxAgentId)) {
|
||||
if (filterType == AuthFilterTypeEnum.DATA_OPT) {
|
||||
|
||||
}
|
||||
if (!hasAuth) {
|
||||
iterator.remove();
|
||||
}
|
||||
} else {
|
||||
iterator.remove();
|
||||
resultList.add(t);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException e) {
|
||||
throw new SalaryRunTimeException(e);
|
||||
}
|
||||
return list;
|
||||
return resultList;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -18,10 +18,8 @@ import com.engine.salary.entity.salarysob.config.SalarySobConfig;
|
|||
import com.engine.salary.entity.salarysob.dto.SalarySobCycleDTO;
|
||||
import com.engine.salary.entity.salarysob.param.*;
|
||||
import com.engine.salary.entity.salarysob.po.*;
|
||||
import com.engine.salary.entity.taxagent.dto.TaxAgentManageRangeListDTO;
|
||||
import com.engine.salary.entity.taxagent.param.TaxAgentRangeQueryParam;
|
||||
import com.engine.salary.entity.taxagent.po.TaxAgentAdminPO;
|
||||
import com.engine.salary.entity.taxagent.po.TaxAgentExtRangePO;
|
||||
import com.engine.salary.entity.taxagent.po.TaxAgentManageRangePO;
|
||||
import com.engine.salary.entity.taxagent.po.TaxAgentPO;
|
||||
import com.engine.salary.enums.OperateTypeEnum;
|
||||
import com.engine.salary.enums.SalarySystemTypeEnum;
|
||||
|
|
@ -50,7 +48,6 @@ import com.engine.salary.util.valid.ValidUtil;
|
|||
import com.google.common.collect.Lists;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.BooleanUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.math.NumberUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
|
|
@ -233,13 +230,13 @@ public class SalarySobServiceImpl extends Service implements SalarySobService {
|
|||
return Collections.emptyList();
|
||||
}
|
||||
List<SalarySobPO> salarySobPOS = salarySobMapper.listByParam(SalarySobPO.builder().name(nameLike).build());
|
||||
return filterByAuthority(salarySobPOS);
|
||||
return getAuthService(user).auth(salarySobPOS, AuthFilterTypeEnum.DATA_OPT, SalarySobPO.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SalarySobPO> listByDisable(Integer disable) {
|
||||
List<SalarySobPO> salarySobPOS = salarySobMapper.listSome(SalarySobPO.builder().disable(disable).build());
|
||||
return filterByAuthority(salarySobPOS);
|
||||
return getAuthService(user).auth(salarySobPOS, AuthFilterTypeEnum.DATA_OPT, SalarySobPO.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -264,7 +261,7 @@ public class SalarySobServiceImpl extends Service implements SalarySobService {
|
|||
@Override
|
||||
public List<SalarySobPO> listByAdmin() {
|
||||
List<SalarySobPO> salarySobPOS = salarySobMapper.listSome(SalarySobPO.builder().build());
|
||||
return filterByAdmin(salarySobPOS);
|
||||
return getAuthService(user).auth(salarySobPOS, AuthFilterTypeEnum.ONLY_DATA, SalarySobPO.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -279,14 +276,6 @@ public class SalarySobServiceImpl extends Service implements SalarySobService {
|
|||
|
||||
@Override
|
||||
public PageInfo<SalarySobPO> listPageByParam(SalarySobListQueryParam queryParam) {
|
||||
long employeeId = user.getUID();
|
||||
// 分页参数
|
||||
PageInfo<SalarySobPO> page = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize());
|
||||
// 判断是否是“总管理员”
|
||||
Boolean isChief = getTaxAgentService(user).isChief(employeeId);
|
||||
// 是否开启分权
|
||||
Boolean openDevolution = getTaxAgentService(user).isOpenDevolution();
|
||||
// 总管理员拥有全部权限
|
||||
// 开启分权后需要过滤薪资账套
|
||||
String name = queryParam.getName();
|
||||
// 查询所有的薪资账套
|
||||
|
|
@ -303,59 +292,25 @@ public class SalarySobServiceImpl extends Service implements SalarySobService {
|
|||
|
||||
list = getAuthService(user).auth(list, AuthFilterTypeEnum.DATA_OPT, SalarySobPO.class);
|
||||
return SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), list, SalarySobPO.class);
|
||||
|
||||
// if (BooleanUtils.isTrue(openDevolution) && !isChief) {
|
||||
// List<SalarySobPO> salarySobPOS = salarySobMapper.listSome(build);
|
||||
// // 根据权限过滤
|
||||
// List<SalarySobPO> salarySobsFilterByAuthority = filterByAuthority(salarySobPOS);
|
||||
// if (CollectionUtils.isEmpty(salarySobsFilterByAuthority)) {
|
||||
// return page;
|
||||
// }
|
||||
// List<SalarySobPO> subSalarySobs = SalaryPageUtil.subList((int) page.getPageNum(), (int) page.getPageSize(), salarySobsFilterByAuthority);
|
||||
// page.setTotal(salarySobsFilterByAuthority.size());
|
||||
// page.setList(subSalarySobs);
|
||||
// return page;
|
||||
// } else {
|
||||
// List<SalarySobPO> salarySobPOS = salarySobMapper.listSome(build);
|
||||
// return SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), salarySobPOS, SalarySobPO.class);
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SalarySobPO> listByParam(SalarySobListQueryParam queryParam) {
|
||||
long employeeId = user.getUID();
|
||||
// 判断是否是“总管理员”
|
||||
Boolean isChief = getTaxAgentService(user).isChief(employeeId);
|
||||
// 是否开启分权
|
||||
Boolean openDevolution = getTaxAgentService(user).isOpenDevolution();
|
||||
// 总管理员拥有全部权限
|
||||
// 开启分权后需要过滤薪资账套
|
||||
|
||||
String name = queryParam.getName();
|
||||
// 查询所有的薪资账套
|
||||
SalarySobPO build = SalarySobPO.builder().build();
|
||||
if (StringUtils.isNotBlank(name)) {
|
||||
build.setName(name);
|
||||
}
|
||||
if (BooleanUtils.isTrue(openDevolution) && !isChief) {
|
||||
|
||||
Boolean adminEnable = getTaxAgentService(user).isAdminEnable(employeeId);
|
||||
//非管理员
|
||||
if (!adminEnable) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
List<SalarySobPO> salarySobPOS = salarySobMapper.listSome(build);
|
||||
|
||||
// 根据权限过滤
|
||||
List<SalarySobPO> salarySobsFilterByAuthority = filterByAuthority(salarySobPOS);
|
||||
if (CollectionUtils.isEmpty(salarySobsFilterByAuthority)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return salarySobsFilterByAuthority;
|
||||
|
||||
} else {
|
||||
return salarySobMapper.listSome(build);
|
||||
if (queryParam.getTaxAgentId() != null) {
|
||||
List<SobTaxLinkPO> sobTaxLinkPOS = getSobTaxLinkMapper().listSome(SobTaxLinkPO.builder().taxAgentId(queryParam.getTaxAgentId()).build());
|
||||
build.setIds(sobTaxLinkPOS.stream().map(SobTaxLinkPO::getTaxAgentId).collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
List<SalarySobPO> list = salarySobMapper.listSome(build);
|
||||
|
||||
return getAuthService(user).auth(list, AuthFilterTypeEnum.DATA_OPT, SalarySobPO.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -385,7 +340,7 @@ public class SalarySobServiceImpl extends Service implements SalarySobService {
|
|||
SalaryElogConfig.salarySobLoggerTemplate.write(loggerContext);
|
||||
|
||||
//保存个税扣缴义务人联系
|
||||
saveSobTaxLink(saveParam, salarySobPO);
|
||||
saveSobTaxLink(saveParam.getTaxAgentIds(), salarySobPO);
|
||||
// 新建薪资账套时,保存默认的员工信息字段
|
||||
saveDefaultEmpField(salarySobPO);
|
||||
// 新建薪资账套时,保存默认的薪资项目
|
||||
|
|
@ -396,9 +351,8 @@ public class SalarySobServiceImpl extends Service implements SalarySobService {
|
|||
return salarySobPO.getId();
|
||||
}
|
||||
|
||||
private void saveSobTaxLink(SalarySobBasicSaveParam saveParam, SalarySobPO salarySobPO) {
|
||||
private void saveSobTaxLink(List<Long> taxAgentIds, SalarySobPO salarySobPO) {
|
||||
getSobTaxLinkMapper().deleteBySobId(salarySobPO.getId());
|
||||
List<Long> taxAgentIds = saveParam.getTaxAgentIds();
|
||||
for (Long taxAgentId : taxAgentIds) {
|
||||
SobTaxLinkPO taxLinkPO = SobTaxLinkPO.builder()
|
||||
.id(IdGenerator.generate())
|
||||
|
|
@ -504,31 +458,33 @@ public class SalarySobServiceImpl extends Service implements SalarySobService {
|
|||
* @date 2022/10/9 15:30
|
||||
*/
|
||||
public void saveDefaultEmployeeRange(SalarySobPO salarySobPO) {
|
||||
// 获取人员范围列表
|
||||
TaxAgentRangeQueryParam queryParam = TaxAgentRangeQueryParam.builder().taxAgentId(salarySobPO.getTaxAgentId()).build();
|
||||
queryParam.setCurrent(1);
|
||||
queryParam.setPageSize(100000);
|
||||
List<TaxAgentManageRangeListDTO> includeList = (List<TaxAgentManageRangeListDTO>) getTaxAgentManageRangeService(user).listPageByParamAndIncludeType(queryParam, NumberUtils.INTEGER_ONE).getList();
|
||||
includeList.stream().forEach(item -> {
|
||||
item.setEmployeeStatus(parseEnum2ValueStr(item.getEmployeeStatus()));
|
||||
});
|
||||
// 获取从范围中排除
|
||||
List<TaxAgentManageRangeListDTO> excludeList = (List<TaxAgentManageRangeListDTO>) getTaxAgentManageRangeService(user).listPageByParamAndIncludeType(queryParam, NumberUtils.INTEGER_ZERO).getList();
|
||||
excludeList.stream().forEach(item -> {
|
||||
item.setEmployeeStatus(parseEnum2ValueStr(item.getEmployeeStatus()));
|
||||
});
|
||||
// 将TaxAgentManageRangeListDTO转换为SalarySobRangePO
|
||||
List<SalarySobRangePO> rangeList = convert2SalarySobRangePO(salarySobPO.getId(), includeList, excludeList);
|
||||
// 保存SalarySobRangePO
|
||||
if (CollectionUtils.isNotEmpty(rangeList)) {
|
||||
salarySobRangeBiz.batchInsert(rangeList);
|
||||
}
|
||||
Long sobId = salarySobPO.getId();
|
||||
salarySobPO = getByIdWithTax(sobId);
|
||||
|
||||
//非系统人员
|
||||
List<TaxAgentExtRangePO> taxAgentExtRangePOS = getTaxAgentExtRangeMapper().listSome(TaxAgentExtRangePO.builder().taxAgentId(salarySobPO.getTaxAgentId()).build());
|
||||
taxAgentExtRangePOS.forEach(po -> {
|
||||
SalarySobRangeExtSaveParam build = SalarySobRangeExtSaveParam.builder().salarySobId(salarySobPO.getId()).targetIds(Collections.singletonList(po.getTargetId())).targetType(1L).build();
|
||||
getSalarySobExtRangeService(user).saveExtRange(build);
|
||||
salarySobPO.getTaxAgentIds().forEach(taxAgentId -> {
|
||||
// 获取人员范围列表
|
||||
List<TaxAgentManageRangePO> includeList = getTaxAgentManageRangeService(user).listByTaxAgentIdAndIncludeType(taxAgentId, NumberUtils.INTEGER_ONE);
|
||||
includeList.forEach(item -> {
|
||||
item.setEmployeeStatus(parseEnum2ValueStr(item.getEmployeeStatus()));
|
||||
});
|
||||
// 获取从范围中排除
|
||||
List<TaxAgentManageRangePO> excludeList = getTaxAgentManageRangeService(user).listByTaxAgentIdAndIncludeType(taxAgentId, NumberUtils.INTEGER_ZERO);
|
||||
excludeList.forEach(item -> {
|
||||
item.setEmployeeStatus(parseEnum2ValueStr(item.getEmployeeStatus()));
|
||||
});
|
||||
// 将TaxAgentManageRangeListDTO转换为SalarySobRangePO
|
||||
List<SalarySobRangePO> rangeList = convert2SalarySobRangePO(sobId, includeList, excludeList);
|
||||
// 保存SalarySobRangePO
|
||||
if (CollectionUtils.isNotEmpty(rangeList)) {
|
||||
salarySobRangeBiz.batchInsert(rangeList);
|
||||
}
|
||||
|
||||
//非系统人员
|
||||
List<TaxAgentExtRangePO> taxAgentExtRangePOS = getTaxAgentExtRangeMapper().listSome(TaxAgentExtRangePO.builder().taxAgentId(taxAgentId).build());
|
||||
taxAgentExtRangePOS.forEach(po -> {
|
||||
SalarySobRangeExtSaveParam build = SalarySobRangeExtSaveParam.builder().salarySobId(sobId).targetIds(Collections.singletonList(po.getTargetId())).targetType(1L).build();
|
||||
getSalarySobExtRangeService(user).saveExtRange(build);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
|
@ -541,14 +497,14 @@ public class SalarySobServiceImpl extends Service implements SalarySobService {
|
|||
* @author Harryxzy
|
||||
* @date 2022/10/9 16:06
|
||||
*/
|
||||
private List<SalarySobRangePO> convert2SalarySobRangePO(Long salarySobID, List<TaxAgentManageRangeListDTO> includeList, List<TaxAgentManageRangeListDTO> excludeList) {
|
||||
private List<SalarySobRangePO> convert2SalarySobRangePO(Long salarySobID, List<TaxAgentManageRangePO> includeList, List<TaxAgentManageRangePO> excludeList) {
|
||||
Date now = new Date();
|
||||
ArrayList<SalarySobRangePO> result = new ArrayList<SalarySobRangePO>();
|
||||
// 关联人员范围
|
||||
includeList.stream().forEach(item -> {
|
||||
SalarySobRangePO salarySobRangePO = SalarySobRangePO.builder()
|
||||
.salarySobId(salarySobID)
|
||||
.targetType(item.getTargetType().getValue())
|
||||
.targetType(item.getTargetType())
|
||||
.targetId(item.getTargetId())
|
||||
.target(item.getTarget())
|
||||
.employeeStatuses(item.getEmployeeStatus())
|
||||
|
|
@ -565,7 +521,7 @@ public class SalarySobServiceImpl extends Service implements SalarySobService {
|
|||
excludeList.stream().forEach(item -> {
|
||||
SalarySobRangePO salarySobRangePO = SalarySobRangePO.builder()
|
||||
.salarySobId(salarySobID)
|
||||
.targetType(item.getTargetType().getValue())
|
||||
.targetType(item.getTargetType())
|
||||
.targetId(item.getTargetId())
|
||||
.target(item.getTarget())
|
||||
.employeeStatuses(item.getEmployeeStatus())
|
||||
|
|
@ -626,7 +582,7 @@ public class SalarySobServiceImpl extends Service implements SalarySobService {
|
|||
BeanUtils.copyProperties(salarySobPO, newSalarySobPO);
|
||||
newSalarySobPO.setId(saveParam.getId())
|
||||
.setName(saveParam.getName())
|
||||
.setTaxAgentId(saveParam.getTaxAgentId())
|
||||
.setTaxAgentId(saveParam.getTaxAgentIds().get(0))
|
||||
.setIncomeCategory(saveParam.getTaxableItems())
|
||||
.setSalaryCycleType(saveParam.getSalaryCycleType())
|
||||
.setSalaryCycleFromDay(saveParam.getSalaryCycleFromDay())
|
||||
|
|
@ -639,7 +595,7 @@ public class SalarySobServiceImpl extends Service implements SalarySobService {
|
|||
salarySobMapper.updateById(newSalarySobPO);
|
||||
|
||||
//保存个税扣缴义务人联系
|
||||
saveSobTaxLink(saveParam, salarySobPO);
|
||||
saveSobTaxLink(saveParam.getTaxAgentIds(), salarySobPO);
|
||||
|
||||
// 记录日志
|
||||
SalarySobPO salarySobPO4log = getSalarySobMapper().getById(newSalarySobPO.getId());
|
||||
|
|
@ -766,15 +722,6 @@ public class SalarySobServiceImpl extends Service implements SalarySobService {
|
|||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98403, "薪资账套名称已存在"));
|
||||
}
|
||||
|
||||
Boolean openDevolution = getTaxAgentService(user).isOpenDevolution();
|
||||
if (openDevolution) {
|
||||
Collection<TaxAgentPO> taxAgentPOS = getTaxAgentService(user).listAllTaxAgentsAsAdmin((long) user.getUID());
|
||||
Set<Long> taxAgentIds = SalaryEntityUtil.properties(taxAgentPOS, TaxAgentPO::getId);
|
||||
if (!taxAgentIds.contains(duplicateParam.getTaxAgentId())) {
|
||||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98403, "该扣缴义务人不在权限范围内!"));
|
||||
}
|
||||
}
|
||||
|
||||
// 查询薪资账套的员工信息字段
|
||||
List<SalarySobEmpFieldPO> salarySobEmpFieldPOS = salarySobEmpFieldService.listSome(SalarySobEmpFieldPO.builder().salarySobId(duplicateParam.getId()).build());
|
||||
// 查询薪资账套的薪资项目副本
|
||||
|
|
@ -794,7 +741,7 @@ public class SalarySobServiceImpl extends Service implements SalarySobService {
|
|||
// 复制薪资账套的基础设置
|
||||
SalarySobPO newSalarySob = SalarySobPO.builder()
|
||||
.name(duplicateParam.getName())
|
||||
.taxAgentId(duplicateParam.getTaxAgentId())
|
||||
.taxAgentId(duplicateParam.getTaxAgentIds().get(0))
|
||||
.incomeCategory(salarySobPO.getIncomeCategory())
|
||||
.salaryCycleType(salarySobPO.getSalaryCycleType())
|
||||
.salaryCycleFromDay(salarySobPO.getSalaryCycleFromDay())
|
||||
|
|
@ -810,6 +757,9 @@ public class SalarySobServiceImpl extends Service implements SalarySobService {
|
|||
.deleteType(NumberUtils.INTEGER_ZERO)
|
||||
.build();
|
||||
salarySobMapper.insert(newSalarySob);
|
||||
|
||||
|
||||
saveSobTaxLink(duplicateParam.getTaxAgentIds(), salarySobPO);
|
||||
// 复制
|
||||
SalarySobDuplicateBO salarySobDuplicateBO = new SalarySobDuplicateBO(newSalarySob, salarySobEmpFieldPOS, salarySobItemPOS,
|
||||
salarySobItemGroupPOS, salarySobAdjustRulePOS, salarySobCheckRulePOS, salarySobBackItemPOS);
|
||||
|
|
@ -864,40 +814,12 @@ public class SalarySobServiceImpl extends Service implements SalarySobService {
|
|||
return SalarySobCycleBO.buildSalarySobCycle(salarySobPO, salaryMonth);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SalarySobPO> filterByAuthority(List<SalarySobPO> salarySobPOS) {
|
||||
long employeeId = user.getUID();
|
||||
// 判断是否是“总管理员”
|
||||
Boolean isChief = getTaxAgentService(user).isChief(employeeId);
|
||||
// 是否开启分权
|
||||
Boolean openDevolution = getTaxAgentService(user).isOpenDevolution();
|
||||
// 开启分权后
|
||||
// 总管理员都能看见
|
||||
// 管理员自己管理的个税下的
|
||||
if (!openDevolution || isChief) {
|
||||
return salarySobPOS;
|
||||
}
|
||||
// 查询所有的个税扣缴义务人
|
||||
Collection<TaxAgentPO> taxAgentPOS = getTaxAgentService(user).listAll();
|
||||
Set<Long> allTaxAgentIds = SalaryEntityUtil.properties(taxAgentPOS, TaxAgentPO::getId);
|
||||
// 查询个税扣缴义务人的管理员
|
||||
List<TaxAgentAdminPO> taxAgentAdminPOS = getTaxAgentAdminService(user).listByTaxAgentIds(allTaxAgentIds);
|
||||
Map<Long, Set<Long>> adminMap = SalaryEntityUtil.group2Map(taxAgentAdminPOS, TaxAgentAdminPO::getEmployeeId, TaxAgentAdminPO::getTaxAgentId);
|
||||
return salarySobPOS.stream().filter(salarySobPO -> {
|
||||
Set<Long> taxAgentIds = adminMap.get(employeeId);
|
||||
if (CollectionUtils.isEmpty(taxAgentIds)) {
|
||||
return false;
|
||||
}
|
||||
return taxAgentIds.contains(salarySobPO.getTaxAgentId());
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SalarySobPO> listByTaxAgentIds(List<Long> taxAgentIds) {
|
||||
if (CollectionUtils.isEmpty(taxAgentIds)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return getSalarySobMapper().listSome(SalarySobPO.builder().taxAgentIds(taxAgentIds).build());
|
||||
return getSalarySobMapper().listByTaxAgentIds(taxAgentIds);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -1096,29 +1018,4 @@ public class SalarySobServiceImpl extends Service implements SalarySobService {
|
|||
return getSalarySobMapper().listSome(sobPO);
|
||||
}
|
||||
|
||||
|
||||
public List<SalarySobPO> filterByAdmin(List<SalarySobPO> salarySobPOS) {
|
||||
long employeeId = user.getUID();
|
||||
// 是否开启分权
|
||||
Boolean openDevolution = getTaxAgentService(user).isOpenDevolution();
|
||||
// 开启分权后
|
||||
// 管理员自己管理的个税下的
|
||||
if (!openDevolution) {
|
||||
return salarySobPOS;
|
||||
}
|
||||
// 查询所有的个税扣缴义务人
|
||||
Collection<TaxAgentPO> taxAgentPOS = getTaxAgentService(user).listAll();
|
||||
Set<Long> allTaxAgentIds = SalaryEntityUtil.properties(taxAgentPOS, TaxAgentPO::getId);
|
||||
// 查询个税扣缴义务人的管理员
|
||||
List<TaxAgentAdminPO> taxAgentAdminPOS = getTaxAgentAdminService(user).listByTaxAgentIds(allTaxAgentIds);
|
||||
Map<Long, Set<Long>> adminMap = SalaryEntityUtil.group2Map(taxAgentAdminPOS, TaxAgentAdminPO::getEmployeeId, TaxAgentAdminPO::getTaxAgentId);
|
||||
return salarySobPOS.stream().filter(salarySobPO -> {
|
||||
Set<Long> taxAgentIds = adminMap.get(employeeId);
|
||||
if (CollectionUtils.isEmpty(taxAgentIds)) {
|
||||
return false;
|
||||
}
|
||||
return taxAgentIds.contains(salarySobPO.getTaxAgentId());
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -272,7 +272,8 @@ public class TaxAgentManageRangeServiceImpl extends Service implements TaxAgentM
|
|||
* @param includeType
|
||||
* @return
|
||||
*/
|
||||
private List<TaxAgentManageRangePO> listByTaxAgentIdAndIncludeType(Long taxAgentId, Integer includeType) {
|
||||
@Override
|
||||
public List<TaxAgentManageRangePO> listByTaxAgentIdAndIncludeType(Long taxAgentId, Integer includeType) {
|
||||
return getTaxAgentManageRangeMapper().listSome(TaxAgentManageRangePO.builder().taxAgentId(taxAgentId).rangeType(TaxAgentRangeTypeEnum.TAXAGENT.getValue()).includeType(includeType).build());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,9 +2,9 @@ package com.engine.salary.service.impl;
|
|||
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.hrmelog.entity.dto.LoggerContext;
|
||||
import com.engine.salary.common.LocalDateRange;
|
||||
import com.engine.salary.config.SalaryElogConfig;
|
||||
import com.engine.hrmelog.entity.dto.LoggerContext;
|
||||
import com.engine.salary.entity.salaryacct.po.SalaryAcctRecordPO;
|
||||
import com.engine.salary.entity.salaryacct.po.SalaryAcctResultPO;
|
||||
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
|
||||
|
|
@ -15,6 +15,7 @@ import com.engine.salary.entity.taxdeclaration.param.TaxDeclarationListQueryPara
|
|||
import com.engine.salary.entity.taxdeclaration.param.TaxDeclarationSaveParam;
|
||||
import com.engine.salary.entity.taxdeclaration.po.TaxDeclarationPO;
|
||||
import com.engine.salary.enums.OperateTypeEnum;
|
||||
import com.engine.salary.enums.auth.AuthFilterTypeEnum;
|
||||
import com.engine.salary.enums.salaryaccounting.SalaryAcctRecordStatusEnum;
|
||||
import com.engine.salary.enums.salarysob.IncomeCategoryEnum;
|
||||
import com.engine.salary.exception.SalaryRunTimeException;
|
||||
|
|
@ -22,6 +23,8 @@ import com.engine.salary.mapper.datacollection.AddUpSituationMapper;
|
|||
import com.engine.salary.mapper.salaryacct.SalaryAcctRecordMapper;
|
||||
import com.engine.salary.mapper.taxdeclaration.TaxDeclarationMapper;
|
||||
import com.engine.salary.service.*;
|
||||
import com.engine.salary.service.auth.AuthService;
|
||||
import com.engine.salary.service.auth.AuthServiceImpl;
|
||||
import com.engine.salary.util.SalaryDateUtil;
|
||||
import com.engine.salary.util.SalaryEntityUtil;
|
||||
import com.engine.salary.util.SalaryI18nUtil;
|
||||
|
|
@ -87,6 +90,10 @@ public class TaxDeclarationServiceImpl extends Service implements TaxDeclaration
|
|||
return ServiceUtil.getService(SalaryAcctEmployeeServiceImpl.class, user);
|
||||
}
|
||||
|
||||
public AuthService getAuthService(User user) {
|
||||
return ServiceUtil.getService(AuthServiceImpl.class, user);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TaxDeclarationPO> listByTaxCycleAndTaxAgentIds(YearMonth taxCycle, Collection<Long> taxAgentIds) {
|
||||
if (Objects.isNull(taxCycle) || CollectionUtils.isEmpty(taxAgentIds)) {
|
||||
|
|
@ -99,8 +106,6 @@ public class TaxDeclarationServiceImpl extends Service implements TaxDeclaration
|
|||
|
||||
@Override
|
||||
public PageInfo<TaxDeclarationPO> listPageByParam(TaxDeclarationListQueryParam queryParam) {
|
||||
long currentEmployeeId = user.getUID();
|
||||
|
||||
// 分页参数
|
||||
TaxDeclarationPO po = TaxDeclarationPO.builder().build();
|
||||
LocalDateRange localDateRange = new LocalDateRange();
|
||||
|
|
@ -112,21 +117,11 @@ public class TaxDeclarationServiceImpl extends Service implements TaxDeclaration
|
|||
}
|
||||
po.setSalaryMonths(localDateRange);
|
||||
|
||||
|
||||
// 分权
|
||||
Boolean openDevolution = getTaxAgentService(user).isNeedAuth(currentEmployeeId);
|
||||
if (openDevolution) {
|
||||
// 查询负责管理的个税扣缴义务人
|
||||
Collection<TaxAgentPO> taxAgentPOS = getTaxAgentService(user).listAllTaxAgents(currentEmployeeId);
|
||||
if (CollectionUtils.isEmpty(taxAgentPOS)) {
|
||||
return new PageInfo<>(new ArrayList<>());
|
||||
}
|
||||
Set<Long> taxAgentIds = SalaryEntityUtil.properties(taxAgentPOS, TaxAgentPO::getId);
|
||||
po.setTaxAgentIds(taxAgentIds);
|
||||
}
|
||||
|
||||
// 查询个税申报表
|
||||
List<TaxDeclarationPO> taxDeclarationPOS = getTaxDeclarationMapper().listSome(po);
|
||||
|
||||
taxDeclarationPOS = getAuthService(user).auth(taxDeclarationPOS, AuthFilterTypeEnum.ONLY_DATA, TaxDeclarationPO.class);
|
||||
|
||||
return SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(),
|
||||
taxDeclarationPOS, TaxDeclarationPO.class);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue