限制账套

This commit is contained in:
钱涛 2024-08-28 10:02:39 +08:00
parent a2db71d403
commit 9b96d0cff2
20 changed files with 342 additions and 77 deletions

View File

@ -8,6 +8,11 @@
<!-- </module>-->
<module name="算薪" key="calculate">
<page name="薪资账套" key="salarySob">
<opt name="查询" key="query"/>
<opt name="管理" key="admin"/>
</page>
<page name="薪资档案" key="salaryArchive">
<opt name="查询" key="query"/>
<opt name="管理" key="admin"/>

View File

@ -21,8 +21,10 @@ public @interface Auth {
String page();
AuthCheckTypeEnum checkType() default AuthCheckTypeEnum.TAX_EMP;
boolean setOpts() default true;
String taxAgentIdField() default "taxAgentId";
String employeeIdField() default "employeeId";
String sobIdField() default "sobId";
String optsField() default "opts";
}

View File

@ -0,0 +1,70 @@
package com.engine.salary.entity.auth.dto;
import com.engine.salary.entity.salarysob.po.SalarySobPO;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Collection;
import java.util.Date;
import java.util.List;
/**
* 角色
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class AuthRoleDTO {
private Long id;
/**
* 名称
*/
private String name;
/**
* 个税扣缴义务人id
*/
private Long taxAgentId;
/**
* 限制账套
*/
private List<SalarySobPO> sobs;
/**
* 描述
*/
private String description;
/**
* 创建人
*/
private Long creator;
/**
* 创建时间
*/
private Date createTime;
/**
* 更新时间
*/
private Date updateTime;
/**
* 是否已删除0未删除1已删除
*/
private Integer deleteType;
/**
* 租户ID
*/
private String tenantKey;
//主键id集合
private Collection<Long> ids;
}

View File

@ -0,0 +1,17 @@
package com.engine.salary.entity.auth.dto;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class AuthSobDTO {
private Long taxAgentId;
private String limitSobs;
}

View File

@ -23,7 +23,6 @@ public class AuthRoleSaveParam {
@DataCheck(require = true, max = 40, message = "名称不允许为空,名称不能超过40个字符")
private String name;
@DataCheck(require = false, max = 400, message = "描述不能超过400个字符")
private String description;
@ -33,4 +32,10 @@ public class AuthRoleSaveParam {
@DataCheck(require = true, message = "扣缴义务人不允许为空")
private Long taxAgentId;
/**
* 限制账套范围
*/
private String limitSobs;
}

View File

@ -31,6 +31,12 @@ public class AuthRolePO {
@ElogTransform(name = "个税扣缴义务人id")
private Long taxAgentId;
/**
* 限制账套
*/
@ElogTransform(name = "限制账套")
private String limitSobs;
/**
* 描述
*/

View File

@ -15,6 +15,7 @@ import lombok.NoArgsConstructor;
import java.util.Collection;
import java.util.Date;
import java.util.List;
import java.util.Set;
/**
* 薪资档案
@ -138,4 +139,6 @@ public class SalaryArchivePO {
*/
@JsonIgnore
private List<String> runStatusList;
private Set<String> opts;
}

View File

@ -76,6 +76,7 @@ public class SalarySobBO {
.salaryCycle(buildSalaryCycle(salarySobPO))
.disable(salarySobPO.getDisable())
.description(salarySobPO.getDescription())
// .opts(salarySobPO.getOpts())
.build())
.collect(Collectors.toList());
}

View File

@ -66,5 +66,5 @@ public class SalarySobListDTO {
@SalaryTableColumn(text = "操作", width = "20%", column = "operate")
@TableTitle(title = "操作", key = "operate", dataIndex = "operate")
private String operate;
private String opts;
}

View File

@ -1,6 +1,8 @@
package com.engine.salary.entity.salarysob.po;
import com.engine.hrmelog.annotation.ElogTransform;
import com.engine.salary.annotation.Auth;
import com.engine.salary.enums.auth.AuthCheckTypeEnum;
import com.engine.salary.util.valid.Compare;
import com.thoughtworks.xstream.annotations.XStreamAlias;
import com.thoughtworks.xstream.annotations.XStreamAsAttribute;
@ -13,6 +15,7 @@ import lombok.experimental.Accessors;
import java.util.Collection;
import java.util.Date;
import java.util.Set;
/**
* 薪资帐套表
@ -25,6 +28,7 @@ import java.util.Date;
@ElogTransform( name="薪资账套" )
//hrsa_salary_sob
@XStreamAlias("SalarySob")
@Auth(page = "salarySob",checkType = AuthCheckTypeEnum.SOB,sobIdField="id",setOpts = false)
public class SalarySobPO {
/**
@ -174,4 +178,6 @@ public class SalarySobPO {
Collection<Long> ids;
Collection<Long> taxAgentIds;
private Set<String> opts;
}

View File

@ -18,7 +18,8 @@ public enum AuthCheckTypeEnum implements BaseEnum<String> {
TAX_EMP("TAX_EMP", "扣缴义务人和人员混合验证", 87627),
EMP("EMP", "人员验证", 87626),
TAX("TAX", "扣缴义务人验证", 87626);
TAX("TAX", "扣缴义务人验证", 87626),
SOB("SOB", "扣缴义务人验证", 87626);
private String value;

View File

@ -0,0 +1,58 @@
package com.engine.salary.enums.auth;
import com.engine.salary.enums.BaseEnum;
import com.engine.salary.exception.SalaryRunTimeException;
import java.util.Objects;
/**
* 权限过滤
* <p>Copyright: Copyright (c) 2024</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
public enum AuthFilterTypeEnum implements BaseEnum<String> {
ONLY_DATA("ONLY_DATA", "仅数据权限", 87627),
// ONLY_OPT("ONLY_OPT", "仅功能权限", 87626),
DATA_OPT("DATA_OPT", "数据&功能权限", 87626);
private String value;
private String defaultLabel;
private int labelId;
AuthFilterTypeEnum(String value, String defaultLabel, int labelId) {
this.value = value;
this.defaultLabel = defaultLabel;
this.labelId = labelId;
}
@Override
public String getValue() {
return value;
}
@Override
public String getDefaultLabel() {
return defaultLabel;
}
@Override
public Integer getLabelId() {
return labelId;
}
public static AuthFilterTypeEnum parseByValue(String value) {
for (AuthFilterTypeEnum typeEnum : AuthFilterTypeEnum.values()) {
if (Objects.equals(typeEnum.getValue(), value)) {
return typeEnum;
}
}
throw new SalaryRunTimeException("未找到对应的枚举");
}
}

View File

@ -1,6 +1,7 @@
package com.engine.salary.mapper.auth;
import com.engine.salary.entity.auth.dto.AuthDTO;
import com.engine.salary.entity.auth.dto.AuthSobDTO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -8,4 +9,6 @@ import java.util.List;
public interface AuthMapper {
List<AuthDTO> getAuth(@Param("uid") Long uid, @Param("page") String page);
List<AuthSobDTO> getLimitSobs(@Param("uid") Long uid);
}

View File

@ -6,8 +6,6 @@
<collection property="emps" ofType="com.engine.salary.entity.auth.dto.EmpOpt">
<id column="employee_id" property="employeeId"/>
<collection property="opts" ofType="com.engine.salary.entity.auth.dto.Opt">
<!-- <id column="optId" property="id"/>-->
<!-- <result column="page" property="page"/>-->
<result column="opt" property="opt"/>
</collection>
</collection>
@ -15,12 +13,26 @@
<select id="getAuth" resultMap="BaseResultMap">
select role.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.employee_id = #{uid} and o.page = #{page} and emp.delete_type = 0 and role.delete_type = 0 and d.delete_type = 0 and o.delete_type = 0
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}
</select>
<resultMap id="getLimitSobMap" type="com.engine.salary.entity.auth.dto.AuthSobDTO">
<id column="tax_agent_id" property="taxAgentId"/>
<result column="limit_sobs" property="limitSobs"/>
</resultMap>
<select id="getLimitSobs" resultMap="getLimitSobMap">
select role.tax_agent_id,role.limit_sobs
from hrsa_auth_role_emp emp
left join hrsa_auth_role role on role.id = emp.role_id
where emp.delete_type = 0 and role.delete_type = 0
and emp.employee_id = #{uid}
</select>

View File

@ -6,6 +6,7 @@
<result column="name" property="name"/>
<result column="description" property="description"/>
<result column="tax_agent_id" property="taxAgentId"/>
<result column="limit_sobs" property="limitSobs"/>
<result column="creator" property="creator"/>
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
@ -21,6 +22,7 @@
, t.name
, t.description
, t.tax_agent_id
, t.limit_sobs
, t.creator
, t.create_time
, t.update_time
@ -62,6 +64,9 @@
<if test="taxAgentId != null">
AND tax_agent_id = #{taxAgentId}
</if>
<if test="limitSobs != null">
AND limit_sobs = #{limitSobs}
</if>
<if test="creator != null">
AND creator = #{creator}
</if>
@ -104,6 +109,9 @@
<if test="taxAgentId != null">
tax_agent_id,
</if>
<if test="limitSobs != null">
limit_sobs,
</if>
<if test="creator != null">
creator,
</if>
@ -133,6 +141,9 @@
<if test="taxAgentId != null">
#{taxAgentId},
</if>
<if test="limitSobs != null">
#{limitSobs},
</if>
<if test="creator != null">
#{creator},
</if>
@ -158,6 +169,7 @@
name=#{name},
description=#{description},
tax_agent_id=#{taxAgentId},
limit_sobs=#{limitSobs},
creator=#{creator},
create_time=#{createTime},
update_time=#{updateTime},
@ -181,6 +193,9 @@
<if test="taxAgentId != null">
tax_agent_id=#{taxAgentId},
</if>
<if test="limitSobs != null">
limit_sobs=#{limitSobs},
</if>
<if test="creator != null">
creator=#{creator},
</if>

View File

@ -56,6 +56,7 @@ public class AuthRoleServiceImpl extends Service implements AuthRoleService {
String name = param.getName();
String description = param.getDescription();
Long taxAgentId = param.getTaxAgentId();
String limitSobs = param.getLimitSobs();
AuthRolePO po;
@ -65,6 +66,7 @@ public class AuthRoleServiceImpl extends Service implements AuthRoleService {
.name(name)
.description(description)
.taxAgentId(taxAgentId)
.limitSobs(limitSobs)
.creator((long) user.getUID())
.createTime(now)
.updateTime(now)
@ -93,6 +95,7 @@ public class AuthRoleServiceImpl extends Service implements AuthRoleService {
.name(name)
.description(description)
.taxAgentId(po.getTaxAgentId())
.limitSobs(limitSobs)
.updateTime(now)
.build();
getAuthRoleMapper().updateIgnoreNull(newPo);

View File

@ -1,6 +1,7 @@
package com.engine.salary.service.auth;
import com.engine.salary.entity.auth.dto.AuthDTO;
import com.engine.salary.enums.auth.AuthFilterTypeEnum;
import java.util.List;
@ -13,7 +14,8 @@ import java.util.List;
* @version 1.0
**/
public interface AuthService {
<T> List<T> auth(List<T> list, Class<T> clazz);
<T> List<T> auth(List<T> list, AuthFilterTypeEnum filterType, Class<T> clazz);
List<AuthDTO> auth(String page);
}

View File

@ -5,9 +5,11 @@ 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.AuthSobDTO;
import com.engine.salary.entity.auth.dto.EmpOpt;
import com.engine.salary.entity.auth.dto.Opt;
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.TaxAgentService;
@ -27,12 +29,17 @@ public class AuthServiceImpl extends Service implements AuthService {
return ServiceUtil.getService(TaxAgentServiceImpl.class, user);
}
private AuthRoleService getAuthRoleService(User user) {
return ServiceUtil.getService(AuthRoleServiceImpl.class, user);
}
private AuthMapper getAuthMapper() {
return MapperProxyFactory.getProxy(AuthMapper.class);
}
@Override
public <T> List<T> auth(List<T> list, Class<T> clazz) {
public <T> List<T> auth(List<T> list, AuthFilterTypeEnum filterType, Class<T> clazz) {
Boolean isOpenDevolution = getTaxAgentService(user).isOpenDevolution();
boolean isAuth = clazz.isAnnotationPresent(Auth.class);
@ -45,6 +52,8 @@ public class AuthServiceImpl extends Service implements AuthService {
String taxAgentIdFieldGetter = "get" + taxAgentIdField.substring(0, 1).toUpperCase() + taxAgentIdField.substring(1);
String employeeIdField = auth.employeeIdField();
String employeeIdFieldGetter = "get" + employeeIdField.substring(0, 1).toUpperCase() + employeeIdField.substring(1);
String sobIdField = auth.sobIdField();
String sobIdFieldGetter = "get" + sobIdField.substring(0, 1).toUpperCase() + sobIdField.substring(1);
String optsField = auth.optsField();
String optsFieldGetter = "get" + optsField.substring(0, 1).toUpperCase() + optsField.substring(1);
String optsFieldSetter = "set" + optsField.substring(0, 1).toUpperCase() + optsField.substring(1);
@ -54,17 +63,18 @@ public class AuthServiceImpl extends Service implements AuthService {
if (isChief) {
list.forEach(t -> {
try {
Method optsFieldGetterMethod = t.getClass().getMethod(optsFieldGetter);
Set<String> opts = (Set<String>) optsFieldGetterMethod.invoke(t);
if (opts == null) {
opts = new HashSet<>();
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);
} catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException e) {
throw new SalaryRunTimeException(e);
}
@ -84,16 +94,18 @@ public class AuthServiceImpl extends Service implements AuthService {
Long taxAgentId = (Long) taxAgentIdFieldGetterMethod.invoke(t);
if (adminTaxAgentIds.contains(taxAgentId)) {
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");
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);
Method optsFieldSetterMethod = t.getClass().getMethod(optsFieldSetter, Set.class);
optsFieldSetterMethod.invoke(t, opts);
}
} else {
iterator.remove();
}
@ -109,44 +121,75 @@ public class AuthServiceImpl extends Service implements AuthService {
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);
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);
Method employeeIdFieldGetterMethod = t.getClass().getMethod(employeeIdFieldGetter);
Long employeeId = (Long) employeeIdFieldGetterMethod.invoke(t);
try {
Iterator<T> iterator = list.iterator();
if (checkType == AuthCheckTypeEnum.TAX_EMP) {
//混合验证
if (authMap.containsKey(taxAgentId)) {
List<EmpOpt> orDefault = authMap.getOrDefault(taxAgentId, new ArrayList<>());
Map<Long, Set<Opt>> optsMap = SalaryEntityUtil.convert2Map(orDefault, EmpOpt::getEmployeeId, EmpOpt::getOpts);
if (optsMap.containsKey(employeeId)) {
Set<String> optSets = optsMap.getOrDefault(employeeId, new HashSet<>()).stream().map(Opt::getOpt).collect(Collectors.toSet());
Method optsFieldGetterMethod = t.getClass().getMethod(optsFieldGetter);
Set<String> opts = (Set<String>) optsFieldGetterMethod.invoke(t);
if (opts == null) {
opts = new HashSet<>();
while (iterator.hasNext()) {
T t = iterator.next();
//混合验证
Method taxAgentIdFieldGetterMethod = t.getClass().getMethod(taxAgentIdFieldGetter);
Long taxAgentId = (Long) taxAgentIdFieldGetterMethod.invoke(t);
Method employeeIdFieldGetterMethod = t.getClass().getMethod(employeeIdFieldGetter);
Long employeeId = (Long) employeeIdFieldGetterMethod.invoke(t);
if (authMap.containsKey(taxAgentId)) {
List<EmpOpt> orDefault = authMap.getOrDefault(taxAgentId, new ArrayList<>());
Map<Long, Set<Opt>> optsMap = SalaryEntityUtil.convert2Map(orDefault, EmpOpt::getEmployeeId, EmpOpt::getOpts);
if (optsMap.containsKey(employeeId)) {
if (filterType == AuthFilterTypeEnum.DATA_OPT) {
Set<String> optSets = optsMap.getOrDefault(employeeId, new HashSet<>()).stream().map(Opt::getOpt).collect(Collectors.toSet());
Method optsFieldGetterMethod = t.getClass().getMethod(optsFieldGetter);
Set<String> opts = (Set<String>) optsFieldGetterMethod.invoke(t);
if (opts == null) {
opts = new HashSet<>();
}
opts.addAll(optSets);
Method optsFieldSetterMethod = t.getClass().getMethod(optsFieldSetter, Set.class);
optsFieldSetterMethod.invoke(t, opts);
}
} else {
iterator.remove();
}
opts.addAll(optSets);
Method optsFieldSetterMethod = t.getClass().getMethod(optsFieldSetter, Set.class);
optsFieldSetterMethod.invoke(t, opts);
} else {
iterator.remove();
}
} else {
iterator.remove();
}
} else if (checkType == AuthCheckTypeEnum.SOB) {
List<AuthSobDTO> limitSobs = getAuthMapper().getLimitSobs((long) user.getUID());
Map<Long, Set<String>> taxLimitSobs = SalaryEntityUtil.group2Map(limitSobs, AuthSobDTO::getTaxAgentId, AuthSobDTO::getLimitSobs);
} catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException e) {
throw new SalaryRunTimeException(e);
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)) {
Set<String> limitSobIds = taxLimitSobs.get(taxAgentId);
boolean hasAuth = false;
for (String sobIdStrs : limitSobIds) {
List<String> sobIds = Arrays.asList(sobIdStrs.split(","));
if (CollectionUtil.isEmpty(sobIds)) {
hasAuth = true;
}else {
hasAuth = sobIds.contains(sobId.toString());
}
}
if(!hasAuth){
iterator.remove();
}
} else {
iterator.remove();
}
}
}
} catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException e) {
throw new SalaryRunTimeException(e);
}
return list;
}

View File

@ -27,6 +27,7 @@ import com.engine.salary.entity.taxagent.po.TaxAgentEmpChangePO;
import com.engine.salary.entity.taxagent.po.TaxAgentPO;
import com.engine.salary.enums.OperateTypeEnum;
import com.engine.salary.enums.UserStatusEnum;
import com.engine.salary.enums.auth.AuthFilterTypeEnum;
import com.engine.salary.enums.datacollection.UseEmployeeTypeEnum;
import com.engine.salary.enums.salaryarchive.*;
import com.engine.salary.enums.salaryitem.SalaryDataTypeEnum;
@ -231,7 +232,7 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe
.collect(Collectors.toList());
//能查看哪些档案
list = getAuthService(user).auth(list, SalaryArchiveListDTO.class);
list = getAuthService(user).auth(list, AuthFilterTypeEnum.DATA_OPT , SalaryArchiveListDTO.class);
PageInfo<SalaryArchiveListDTO> pageInfo = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), SalaryArchiveListDTO.class);
@ -1069,7 +1070,7 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe
List<SalaryArchivePO> list = getSalaryArchiveMapper().listAll();
list = getAuthService(user).auth(list,SalaryArchivePO.class);
list = getAuthService(user).auth(list,AuthFilterTypeEnum.ONLY_DATA,SalaryArchivePO.class);
long pendingTotal = 0L;
long fixedTotal = 0L;

View File

@ -24,12 +24,15 @@ import com.engine.salary.entity.taxagent.po.TaxAgentExtRangePO;
import com.engine.salary.entity.taxagent.po.TaxAgentPO;
import com.engine.salary.enums.OperateTypeEnum;
import com.engine.salary.enums.SalarySystemTypeEnum;
import com.engine.salary.enums.auth.AuthFilterTypeEnum;
import com.engine.salary.enums.salarysob.IncomeCategoryEnum;
import com.engine.salary.enums.salarysob.SalaryEmployeeStatusEnum;
import com.engine.salary.exception.SalaryRunTimeException;
import com.engine.salary.mapper.salarysob.SalarySobMapper;
import com.engine.salary.mapper.taxagent.TaxAgentExtRangeMapper;
import com.engine.salary.service.*;
import com.engine.salary.service.auth.AuthService;
import com.engine.salary.service.auth.AuthServiceImpl;
import com.engine.salary.sys.entity.vo.UploadConfigResponse;
import com.engine.salary.sys.enums.TaxDeclarationFunctionEnum;
import com.engine.salary.sys.service.SalarySysConfService;
@ -160,6 +163,10 @@ public class SalarySobServiceImpl extends Service implements SalarySobService {
return ServiceUtil.getService(SalarySysConfServiceImpl.class, user);
}
public AuthService getAuthService(User user) {
return ServiceUtil.getService(AuthServiceImpl.class, user);
}
@Override
public SalarySobPO getById(Long id) {
return salarySobMapper.getById(id);
@ -253,21 +260,26 @@ public class SalarySobServiceImpl extends Service implements SalarySobService {
build.setTaxAgentId(queryParam.getTaxAgentId());
}
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);
}
List<SalarySobPO> list = salarySobMapper.listSome(build);
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