diff --git a/resource/WEB-INF/salaryoptconfig.xml b/resource/WEB-INF/salaryoptconfig.xml index de9489e3b..0fd791b00 100644 --- a/resource/WEB-INF/salaryoptconfig.xml +++ b/resource/WEB-INF/salaryoptconfig.xml @@ -8,6 +8,11 @@ + + + + + diff --git a/src/com/engine/salary/annotation/Auth.java b/src/com/engine/salary/annotation/Auth.java index 55677a320..2095e4755 100644 --- a/src/com/engine/salary/annotation/Auth.java +++ b/src/com/engine/salary/annotation/Auth.java @@ -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"; } diff --git a/src/com/engine/salary/entity/auth/dto/AuthRoleDTO.java b/src/com/engine/salary/entity/auth/dto/AuthRoleDTO.java new file mode 100644 index 000000000..3dbcc37b3 --- /dev/null +++ b/src/com/engine/salary/entity/auth/dto/AuthRoleDTO.java @@ -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; + + /** + * 涓◣鎵g即涔夊姟浜篿d + */ + private Long taxAgentId; + + /** + * 闄愬埗璐﹀ + */ + private List 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 ids; + +} \ No newline at end of file diff --git a/src/com/engine/salary/entity/auth/dto/AuthSobDTO.java b/src/com/engine/salary/entity/auth/dto/AuthSobDTO.java new file mode 100644 index 000000000..350758470 --- /dev/null +++ b/src/com/engine/salary/entity/auth/dto/AuthSobDTO.java @@ -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; +} + diff --git a/src/com/engine/salary/entity/auth/param/AuthRoleSaveParam.java b/src/com/engine/salary/entity/auth/param/AuthRoleSaveParam.java index edb128c22..465f5be54 100644 --- a/src/com/engine/salary/entity/auth/param/AuthRoleSaveParam.java +++ b/src/com/engine/salary/entity/auth/param/AuthRoleSaveParam.java @@ -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 = "鎵g即涔夊姟浜轰笉鍏佽涓虹┖") private Long taxAgentId; + + /** + * 闄愬埗璐﹀鑼冨洿 + */ + private String limitSobs; + } \ No newline at end of file diff --git a/src/com/engine/salary/entity/auth/po/AuthRolePO.java b/src/com/engine/salary/entity/auth/po/AuthRolePO.java index 144b2583d..47dde3804 100644 --- a/src/com/engine/salary/entity/auth/po/AuthRolePO.java +++ b/src/com/engine/salary/entity/auth/po/AuthRolePO.java @@ -31,6 +31,12 @@ public class AuthRolePO { @ElogTransform(name = "涓◣鎵g即涔夊姟浜篿d") private Long taxAgentId; + /** + * 闄愬埗璐﹀ + */ + @ElogTransform(name = "闄愬埗璐﹀") + private String limitSobs; + /** * 鎻忚堪 */ diff --git a/src/com/engine/salary/entity/salaryarchive/po/SalaryArchivePO.java b/src/com/engine/salary/entity/salaryarchive/po/SalaryArchivePO.java index f3fee2f08..25ad7601a 100644 --- a/src/com/engine/salary/entity/salaryarchive/po/SalaryArchivePO.java +++ b/src/com/engine/salary/entity/salaryarchive/po/SalaryArchivePO.java @@ -15,6 +15,7 @@ import lombok.NoArgsConstructor; import java.util.Collection; import java.util.Date; import java.util.List; +import java.util.Set; /** * 钖祫妗f @@ -138,4 +139,6 @@ public class SalaryArchivePO { */ @JsonIgnore private List runStatusList; + + private Set opts; } diff --git a/src/com/engine/salary/entity/salarysob/bo/SalarySobBO.java b/src/com/engine/salary/entity/salarysob/bo/SalarySobBO.java index e84a890ee..f235e4a25 100644 --- a/src/com/engine/salary/entity/salarysob/bo/SalarySobBO.java +++ b/src/com/engine/salary/entity/salarysob/bo/SalarySobBO.java @@ -76,6 +76,7 @@ public class SalarySobBO { .salaryCycle(buildSalaryCycle(salarySobPO)) .disable(salarySobPO.getDisable()) .description(salarySobPO.getDescription()) +// .opts(salarySobPO.getOpts()) .build()) .collect(Collectors.toList()); } diff --git a/src/com/engine/salary/entity/salarysob/dto/SalarySobListDTO.java b/src/com/engine/salary/entity/salarysob/dto/SalarySobListDTO.java index cb100ef55..0d1227764 100644 --- a/src/com/engine/salary/entity/salarysob/dto/SalarySobListDTO.java +++ b/src/com/engine/salary/entity/salarysob/dto/SalarySobListDTO.java @@ -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; } diff --git a/src/com/engine/salary/entity/salarysob/po/SalarySobPO.java b/src/com/engine/salary/entity/salarysob/po/SalarySobPO.java index 231d6f866..d2435b4ec 100644 --- a/src/com/engine/salary/entity/salarysob/po/SalarySobPO.java +++ b/src/com/engine/salary/entity/salarysob/po/SalarySobPO.java @@ -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 ids; Collection taxAgentIds; + private Set opts; + } \ No newline at end of file diff --git a/src/com/engine/salary/enums/auth/AuthCheckTypeEnum.java b/src/com/engine/salary/enums/auth/AuthCheckTypeEnum.java index f715fdbb3..5a648465a 100644 --- a/src/com/engine/salary/enums/auth/AuthCheckTypeEnum.java +++ b/src/com/engine/salary/enums/auth/AuthCheckTypeEnum.java @@ -18,7 +18,8 @@ public enum AuthCheckTypeEnum implements BaseEnum { TAX_EMP("TAX_EMP", "鎵g即涔夊姟浜哄拰浜哄憳娣峰悎楠岃瘉", 87627), EMP("EMP", "浜哄憳楠岃瘉", 87626), - TAX("TAX", "鎵g即涔夊姟浜洪獙璇", 87626); + TAX("TAX", "鎵g即涔夊姟浜洪獙璇", 87626), + SOB("SOB", "鎵g即涔夊姟浜洪獙璇", 87626); private String value; diff --git a/src/com/engine/salary/enums/auth/AuthFilterTypeEnum.java b/src/com/engine/salary/enums/auth/AuthFilterTypeEnum.java new file mode 100644 index 000000000..d52e2d0e8 --- /dev/null +++ b/src/com/engine/salary/enums/auth/AuthFilterTypeEnum.java @@ -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; + +/** + * 鏉冮檺杩囨护 + *

Copyright: Copyright (c) 2024

+ *

Company: 娉涘井杞欢

+ * + * @author qiantao + * @version 1.0 + **/ +public enum AuthFilterTypeEnum implements BaseEnum { + + + 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("鏈壘鍒板搴旂殑鏋氫妇"); + } +} diff --git a/src/com/engine/salary/mapper/auth/AuthMapper.java b/src/com/engine/salary/mapper/auth/AuthMapper.java index e762c6511..a30125137 100644 --- a/src/com/engine/salary/mapper/auth/AuthMapper.java +++ b/src/com/engine/salary/mapper/auth/AuthMapper.java @@ -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 getAuth(@Param("uid") Long uid, @Param("page") String page); + + List getLimitSobs(@Param("uid") Long uid); } \ No newline at end of file diff --git a/src/com/engine/salary/mapper/auth/AuthMapper.xml b/src/com/engine/salary/mapper/auth/AuthMapper.xml index 9a29df352..aced2df21 100644 --- a/src/com/engine/salary/mapper/auth/AuthMapper.xml +++ b/src/com/engine/salary/mapper/auth/AuthMapper.xml @@ -6,8 +6,6 @@ - - @@ -15,12 +13,26 @@ + + + + + + + + diff --git a/src/com/engine/salary/mapper/auth/AuthRoleMapper.xml b/src/com/engine/salary/mapper/auth/AuthRoleMapper.xml index e6cf464cf..9b9a0267f 100644 --- a/src/com/engine/salary/mapper/auth/AuthRoleMapper.xml +++ b/src/com/engine/salary/mapper/auth/AuthRoleMapper.xml @@ -6,6 +6,7 @@ + @@ -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 @@ AND tax_agent_id = #{taxAgentId} + + AND limit_sobs = #{limitSobs} + AND creator = #{creator} @@ -104,6 +109,9 @@ tax_agent_id, + + limit_sobs, + creator, @@ -133,6 +141,9 @@ #{taxAgentId}, + + #{limitSobs}, + #{creator}, @@ -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 @@ tax_agent_id=#{taxAgentId}, + + limit_sobs=#{limitSobs}, + creator=#{creator}, diff --git a/src/com/engine/salary/service/auth/AuthRoleServiceImpl.java b/src/com/engine/salary/service/auth/AuthRoleServiceImpl.java index 4f9a00e8f..752849370 100644 --- a/src/com/engine/salary/service/auth/AuthRoleServiceImpl.java +++ b/src/com/engine/salary/service/auth/AuthRoleServiceImpl.java @@ -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); diff --git a/src/com/engine/salary/service/auth/AuthService.java b/src/com/engine/salary/service/auth/AuthService.java index b0166dbf4..79542b1d0 100644 --- a/src/com/engine/salary/service/auth/AuthService.java +++ b/src/com/engine/salary/service/auth/AuthService.java @@ -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 { - List auth(List list, Class clazz); + + List auth(List list, AuthFilterTypeEnum filterType, Class clazz); List auth(String page); } diff --git a/src/com/engine/salary/service/auth/AuthServiceImpl.java b/src/com/engine/salary/service/auth/AuthServiceImpl.java index a9672a6da..7d9c35771 100644 --- a/src/com/engine/salary/service/auth/AuthServiceImpl.java +++ b/src/com/engine/salary/service/auth/AuthServiceImpl.java @@ -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 List auth(List list, Class clazz) { + public List auth(List list, AuthFilterTypeEnum filterType, Class 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 opts = (Set) optsFieldGetterMethod.invoke(t); - if (opts == null) { - opts = new HashSet<>(); + if (filterType == AuthFilterTypeEnum.DATA_OPT) { + Method optsFieldGetterMethod = t.getClass().getMethod(optsFieldGetter); + Set opts = (Set) 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 opts = (Set) 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 opts = (Set) 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 authDTOS = getAuthMapper().getAuth((long) user.getUID(), page); Map> authMap = SalaryEntityUtil.convert2Map(authDTOS, AuthDTO::getTaxAgentId, AuthDTO::getEmps); - Iterator 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 iterator = list.iterator(); + if (checkType == AuthCheckTypeEnum.TAX_EMP) { - //娣峰悎楠岃瘉 - if (authMap.containsKey(taxAgentId)) { - List orDefault = authMap.getOrDefault(taxAgentId, new ArrayList<>()); - Map> optsMap = SalaryEntityUtil.convert2Map(orDefault, EmpOpt::getEmployeeId, EmpOpt::getOpts); - if (optsMap.containsKey(employeeId)) { - Set optSets = optsMap.getOrDefault(employeeId, new HashSet<>()).stream().map(Opt::getOpt).collect(Collectors.toSet()); - Method optsFieldGetterMethod = t.getClass().getMethod(optsFieldGetter); - Set opts = (Set) 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 orDefault = authMap.getOrDefault(taxAgentId, new ArrayList<>()); + Map> optsMap = SalaryEntityUtil.convert2Map(orDefault, EmpOpt::getEmployeeId, EmpOpt::getOpts); + if (optsMap.containsKey(employeeId)) { + if (filterType == AuthFilterTypeEnum.DATA_OPT) { + Set optSets = optsMap.getOrDefault(employeeId, new HashSet<>()).stream().map(Opt::getOpt).collect(Collectors.toSet()); + Method optsFieldGetterMethod = t.getClass().getMethod(optsFieldGetter); + Set opts = (Set) 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 limitSobs = getAuthMapper().getLimitSobs((long) user.getUID()); + Map> 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 limitSobIds = taxLimitSobs.get(taxAgentId); + boolean hasAuth = false; + for (String sobIdStrs : limitSobIds) { + List 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; } diff --git a/src/com/engine/salary/service/impl/SalaryArchiveServiceImpl.java b/src/com/engine/salary/service/impl/SalaryArchiveServiceImpl.java index 8afde0c90..d315b44b2 100644 --- a/src/com/engine/salary/service/impl/SalaryArchiveServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalaryArchiveServiceImpl.java @@ -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 pageInfo = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), SalaryArchiveListDTO.class); @@ -1069,7 +1070,7 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe List 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; diff --git a/src/com/engine/salary/service/impl/SalarySobServiceImpl.java b/src/com/engine/salary/service/impl/SalarySobServiceImpl.java index f1ff59e93..3674f1697 100644 --- a/src/com/engine/salary/service/impl/SalarySobServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalarySobServiceImpl.java @@ -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 salarySobPOS = salarySobMapper.listSome(build); - // 鏍规嵁鏉冮檺杩囨护 - List salarySobsFilterByAuthority = filterByAuthority(salarySobPOS); - if (CollectionUtils.isEmpty(salarySobsFilterByAuthority)) { - return page; - } - List subSalarySobs = SalaryPageUtil.subList((int) page.getPageNum(), (int) page.getPageSize(), salarySobsFilterByAuthority); - page.setTotal(salarySobsFilterByAuthority.size()); - page.setList(subSalarySobs); - return page; - } else { - List salarySobPOS = salarySobMapper.listSome(build); - return SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), salarySobPOS, SalarySobPO.class); - } + List 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 salarySobPOS = salarySobMapper.listSome(build); +// // 鏍规嵁鏉冮檺杩囨护 +// List salarySobsFilterByAuthority = filterByAuthority(salarySobPOS); +// if (CollectionUtils.isEmpty(salarySobsFilterByAuthority)) { +// return page; +// } +// List subSalarySobs = SalaryPageUtil.subList((int) page.getPageNum(), (int) page.getPageSize(), salarySobsFilterByAuthority); +// page.setTotal(salarySobsFilterByAuthority.size()); +// page.setList(subSalarySobs); +// return page; +// } else { +// List salarySobPOS = salarySobMapper.listSome(build); +// return SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), salarySobPOS, SalarySobPO.class); +// } } @Override