diff --git a/src/com/engine/salary/entity/taxdeclaration/dto/AzGssbDTO.java b/src/com/engine/salary/entity/taxdeclaration/dto/AzGssbDTO.java new file mode 100644 index 000000000..1010dc86b --- /dev/null +++ b/src/com/engine/salary/entity/taxdeclaration/dto/AzGssbDTO.java @@ -0,0 +1,34 @@ +package com.engine.salary.entity.taxdeclaration.dto; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @author Harryxzy + * @ClassName AzGssbDTO + * @date 2024/03/27 15:03 + * @description 艾志个税申报权限 + */ +@Builder +@Data +@AllArgsConstructor +@NoArgsConstructor +public class AzGssbDTO { + + /** + * 个税管理人员 + */ + private int gsglry; + + /** + * 权限 + */ + private int qx; + + /** + * 部门 + */ + private int bm; +} diff --git a/src/com/engine/salary/service/EmployeeDeclareService.java b/src/com/engine/salary/service/EmployeeDeclareService.java index 3a6f6910c..24b116443 100644 --- a/src/com/engine/salary/service/EmployeeDeclareService.java +++ b/src/com/engine/salary/service/EmployeeDeclareService.java @@ -6,11 +6,13 @@ import com.engine.salary.entity.employeedeclare.dto.EmployeeDeclareListDTO; import com.engine.salary.entity.employeedeclare.dto.EmployeeDeclareRateDTO; import com.engine.salary.entity.employeedeclare.param.*; import com.engine.salary.entity.employeedeclare.po.EmployeeDeclarePO; +import com.engine.salary.entity.taxdeclaration.dto.AzGssbDTO; import com.engine.salary.util.page.PageInfo; import java.util.Collection; import java.util.Date; import java.util.List; +import java.util.Map; /** * 人员报送(人员) @@ -186,4 +188,8 @@ public interface EmployeeDeclareService{ void batchInsert(List insertList); List listByEmpIdsAndTaxCycle(List empIds, Date date); + + List getAzGssbAuth(int uid); + + Map empIdsByAzGssbAuth(int uid); } diff --git a/src/com/engine/salary/service/TaxDeclarationValueService.java b/src/com/engine/salary/service/TaxDeclarationValueService.java index f961dbc6f..e57d8e46a 100644 --- a/src/com/engine/salary/service/TaxDeclarationValueService.java +++ b/src/com/engine/salary/service/TaxDeclarationValueService.java @@ -30,7 +30,7 @@ public interface TaxDeclarationValueService { * @param taxDeclarationIds * @return */ - PageInfo listPageByTaxDeclarationIds(TaxDeclarationValueListQueryParam queryParam, Collection taxDeclarationIds, String keyWord); + PageInfo listPageByTaxDeclarationIds(TaxDeclarationValueListQueryParam queryParam, Collection taxDeclarationIds, String keyWord, TaxDeclarationPO taxDeclaration); /** * 查询个税申报表明细 diff --git a/src/com/engine/salary/service/impl/EmployeeDeclareExcelServiceImpl.java b/src/com/engine/salary/service/impl/EmployeeDeclareExcelServiceImpl.java index de5a7a82a..659ca6a8a 100644 --- a/src/com/engine/salary/service/impl/EmployeeDeclareExcelServiceImpl.java +++ b/src/com/engine/salary/service/impl/EmployeeDeclareExcelServiceImpl.java @@ -222,6 +222,11 @@ public class EmployeeDeclareExcelServiceImpl extends Service implements Employee if (CollectionUtils.isEmpty(data)) { throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0, "导入数据不能为空")); } + + List canManageTaxAgentIds = getTaxAgentService(user).listAllTaxAgentsAsAdmin(Long.valueOf(user.getUID())).stream().map(TaxAgentPO::getId).collect(Collectors.toList()); + Map authMap = getEmployeeDeclareService(user).empIdsByAzGssbAuth(user.getUID()); + List canManageEmpIds = (List)authMap.get("canManageEmpIds"); + // 错误提示信息 List excelComments = Lists.newArrayList(); List errorData = new ArrayList<>(); @@ -439,20 +444,38 @@ public class EmployeeDeclareExcelServiceImpl extends Service implements Employee errorMessageMap.put("message", rowIndex + SalaryI18nUtil.getI18nLabel(0, "系统内的人员不存在该工号")); errorData.add(errorMessageMap); } else { - needAddEmployeeDeclares.add(buildEmployeeDeclare(extEmployee, simpleEmployee, - employeeDeclareExcel, taxAgentId, taxCycleDate, now)); + // 艾志二开-校验是否有导入权限 + if (!canManageTaxAgentIds.contains(taxAgentId) && + ((extEmployee != null && !canManageEmpIds.contains(extEmployee.getEmployeeId())) + || (simpleEmployee != null && !canManageEmpIds.contains(simpleEmployee.getEmployeeId()))) ) { + isError = true; + Map errorMessageMap = Maps.newHashMap(); + errorMessageMap.put("message", rowIndex + SalaryI18nUtil.getI18nLabel(0, "没有该部门个税操作权限,请联系管理员开通权限")); + errorData.add(errorMessageMap); + } else { + needAddEmployeeDeclares.add(buildEmployeeDeclare(extEmployee, simpleEmployee, + employeeDeclareExcel, taxAgentId, taxCycleDate, now)); + } } } else { - EmployeeDeclarePO newEmployeeDeclare = new EmployeeDeclarePO(); - BeanUtils.copyProperties(employeeDeclare, newEmployeeDeclare); - EmployeeDeclarePO employeeDeclarePO = EmployeeDeclareBO.convert2PO(employeeDeclareExcel); - BeanUtils.copyProperties(employeeDeclarePO, newEmployeeDeclare, getNullPropertyNames(employeeDeclarePO)); - newEmployeeDeclare.setNewEmployeeInfo(StringUtils.equals(employeeDeclare.toCompareString(), newEmployeeDeclare.toCompareString()) ? 0 : 1); - newEmployeeDeclare.setUpdateTime(now); - needUpdateEmployeeDeclares.add(newEmployeeDeclare); - if (Objects.equals(newEmployeeDeclare.getNewEmployeeInfo(), 1)) { - newEmployeeDeclare.setDeclareStatus(DeclareStatusEnum.NOT_DECLARE.getValue()); - newEmployeeDeclare.setDeclareErrorMsg(""); + // 艾志二开-校验是否有导入权限 + if (!canManageTaxAgentIds.contains(taxAgentId) && !canManageEmpIds.contains(employeeDeclare.getEmployeeId())){ + isError = true; + Map errorMessageMap = Maps.newHashMap(); + errorMessageMap.put("message", rowIndex + SalaryI18nUtil.getI18nLabel(0, "没有该部门个税操作权限,请联系管理员开通权限")); + errorData.add(errorMessageMap); + } else { + EmployeeDeclarePO newEmployeeDeclare = new EmployeeDeclarePO(); + BeanUtils.copyProperties(employeeDeclare, newEmployeeDeclare); + EmployeeDeclarePO employeeDeclarePO = EmployeeDeclareBO.convert2PO(employeeDeclareExcel); + BeanUtils.copyProperties(employeeDeclarePO, newEmployeeDeclare, getNullPropertyNames(employeeDeclarePO)); + newEmployeeDeclare.setNewEmployeeInfo(StringUtils.equals(employeeDeclare.toCompareString(), newEmployeeDeclare.toCompareString()) ? 0 : 1); + newEmployeeDeclare.setUpdateTime(now); + needUpdateEmployeeDeclares.add(newEmployeeDeclare); + if (Objects.equals(newEmployeeDeclare.getNewEmployeeInfo(), 1)) { + newEmployeeDeclare.setDeclareStatus(DeclareStatusEnum.NOT_DECLARE.getValue()); + newEmployeeDeclare.setDeclareErrorMsg(""); + } } } } else { @@ -466,21 +489,39 @@ public class EmployeeDeclareExcelServiceImpl extends Service implements Employee errorMessageMap.put("message", rowIndex + SalaryI18nUtil.getI18nLabel(0, "系统内的人员不存在该证件号码")); errorData.add(errorMessageMap); } else { - needAddEmployeeDeclares.add(buildEmployeeDeclare(extEmployee, simpleEmployee, - employeeDeclareExcel, taxAgentId, taxCycleDate, now)); + // 艾志二开-校验是否有导入权限 + if (!canManageTaxAgentIds.contains(taxAgentId) && + ((extEmployee != null && !canManageEmpIds.contains(extEmployee.getEmployeeId())) + || (simpleEmployee != null && !canManageEmpIds.contains(simpleEmployee.getEmployeeId()))) ) { + isError = true; + Map errorMessageMap = Maps.newHashMap(); + errorMessageMap.put("message", rowIndex + SalaryI18nUtil.getI18nLabel(0, "没有该部门个税操作权限,请联系管理员开通权限")); + errorData.add(errorMessageMap); + } else { + needAddEmployeeDeclares.add(buildEmployeeDeclare(extEmployee, simpleEmployee, + employeeDeclareExcel, taxAgentId, taxCycleDate, now)); + } } } else { - EmployeeDeclarePO newEmployeeDeclare = new EmployeeDeclarePO(); - BeanUtils.copyProperties(employeeDeclare, newEmployeeDeclare); - EmployeeDeclarePO employeeDeclarePO = EmployeeDeclareBO.convert2PO(employeeDeclareExcel); - BeanUtils.copyProperties(employeeDeclarePO, newEmployeeDeclare, getNullPropertyNames(employeeDeclarePO)); - newEmployeeDeclare.setNewEmployeeInfo(StringUtils.equals(employeeDeclare.toCompareString(), newEmployeeDeclare.toCompareString()) ? 0 : 1); - newEmployeeDeclare.setUpdateTime(now); - if (Objects.equals(newEmployeeDeclare.getNewEmployeeInfo(), 1)) { - newEmployeeDeclare.setDeclareStatus(DeclareStatusEnum.NOT_DECLARE.getValue()); - newEmployeeDeclare.setDeclareErrorMsg(""); + // 艾志二开-校验是否有导入权限 + if (!canManageTaxAgentIds.contains(taxAgentId) && !canManageEmpIds.contains(employeeDeclare.getEmployeeId())){ + isError = true; + Map errorMessageMap = Maps.newHashMap(); + errorMessageMap.put("message", rowIndex + SalaryI18nUtil.getI18nLabel(0, "没有该部门个税操作权限,请联系管理员开通权限")); + errorData.add(errorMessageMap); + } else { + EmployeeDeclarePO newEmployeeDeclare = new EmployeeDeclarePO(); + BeanUtils.copyProperties(employeeDeclare, newEmployeeDeclare); + EmployeeDeclarePO employeeDeclarePO = EmployeeDeclareBO.convert2PO(employeeDeclareExcel); + BeanUtils.copyProperties(employeeDeclarePO, newEmployeeDeclare, getNullPropertyNames(employeeDeclarePO)); + newEmployeeDeclare.setNewEmployeeInfo(StringUtils.equals(employeeDeclare.toCompareString(), newEmployeeDeclare.toCompareString()) ? 0 : 1); + newEmployeeDeclare.setUpdateTime(now); + if (Objects.equals(newEmployeeDeclare.getNewEmployeeInfo(), 1)) { + newEmployeeDeclare.setDeclareStatus(DeclareStatusEnum.NOT_DECLARE.getValue()); + newEmployeeDeclare.setDeclareErrorMsg(""); + } + needUpdateEmployeeDeclares.add(newEmployeeDeclare); } - needUpdateEmployeeDeclares.add(newEmployeeDeclare); } } } @@ -578,6 +619,10 @@ public class EmployeeDeclareExcelServiceImpl extends Service implements Employee public XSSFWorkbook export(EmployeeDeclareListQueryParam queryParam) { // 查询需要报送的人员 List employeeDeclares = getEmployeeDeclareService(user).listByParam(queryParam); + List taxAgentIds = getTaxAgentService(user).listAllTaxAgentsAsAdmin(Long.valueOf(user.getUID())).stream().map(TaxAgentPO::getId).collect(Collectors.toList()); + Map authMap = getEmployeeDeclareService(user).empIdsByAzGssbAuth(user.getUID()); + List canManageEmpIds = (List)authMap.get("canManageEmpIds"); + employeeDeclares = employeeDeclares.stream().filter(po -> taxAgentIds.contains(po.getTaxAgentId()) || canManageEmpIds.contains(po.getEmployeeId())).collect(Collectors.toList()); // 转换成dto List dtoList = getEmployeeDeclareService(user).convert(employeeDeclares); // 需要导出的数据 diff --git a/src/com/engine/salary/service/impl/EmployeeDeclareServiceImpl.java b/src/com/engine/salary/service/impl/EmployeeDeclareServiceImpl.java index dd9c47c64..2e743d935 100644 --- a/src/com/engine/salary/service/impl/EmployeeDeclareServiceImpl.java +++ b/src/com/engine/salary/service/impl/EmployeeDeclareServiceImpl.java @@ -28,6 +28,7 @@ import com.engine.salary.entity.taxagent.po.TaxAgentPO; import com.engine.salary.entity.taxagent.po.TaxAgentTaxReturnPO; import com.engine.salary.entity.taxapiflow.bo.TaxApiFlowBO; import com.engine.salary.entity.taxapiflow.po.TaxDeclarationApiFlowRecordPO; +import com.engine.salary.entity.taxdeclaration.dto.AzGssbDTO; import com.engine.salary.entity.taxdeclaration.po.TaxDeclarationApiConfigPO; import com.engine.salary.enums.OperateTypeEnum; import com.engine.salary.enums.SalaryCycleTypeEnum; @@ -58,8 +59,10 @@ import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.transaction.annotation.Transactional; +import weaver.conn.RecordSet; import weaver.general.Util; import weaver.hrm.User; +import weaver.hrm.company.DepartmentComInfo; import java.time.LocalDate; import java.util.*; @@ -108,6 +111,10 @@ public class EmployeeDeclareServiceImpl extends Service implements EmployeeDecla return ServiceUtil.getService(TaxDeclarationApiBillingServiceImpl.class, user); } + private EmployeeDeclareService getEmployeeDeclareService(User user) { + return ServiceUtil.getService(EmployeeDeclareServiceImpl.class, user); + } + @Override public EmployeeDeclarePO getById(Long id) { return getEmployeeDeclareMapper().getById(id); @@ -161,6 +168,10 @@ public class EmployeeDeclareServiceImpl extends Service implements EmployeeDecla @Override public PageInfo listPage4UpdateByParam(EmployeeDeclareListQueryParam queryParam) { List list = getEmployeeDeclareMapper().list4UpdateByParam(queryParam); + List taxAgentIds = getTaxAgentService(user).listAllTaxAgentsAsAdmin(Long.valueOf(user.getUID())).stream().map(TaxAgentPO::getId).collect(Collectors.toList()); + Map authMap = empIdsByAzGssbAuth(user.getUID()); + List canManageEmpIds = (List)authMap.get("canManageEmpIds"); + list = list.stream().filter(po -> taxAgentIds.contains(po.getTaxAgentId()) || canManageEmpIds.contains(po.getEmployeeId())).collect(Collectors.toList()); return SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), list, EmployeeDeclarePO.class); } @@ -190,6 +201,15 @@ public class EmployeeDeclareServiceImpl extends Service implements EmployeeDecla @Override public void save(EmployeeDeclareSaveParam saveParam) { + List taxAgentIds = getTaxAgentService(user).listAllTaxAgentsAsAdmin(Long.valueOf(user.getUID())).stream().map(TaxAgentPO::getId).collect(Collectors.toList()); + if (!taxAgentIds.contains(saveParam.getTaxAgentId())) { + // 不是薪酬管理员 + Map authMap = empIdsByAzGssbAuth(user.getUID()); + List canManageEmpIds = (List)authMap.get("canManageEmpIds"); + if (!canManageEmpIds.contains(saveParam.getEmployeeId())) { + throw new SalaryRunTimeException("没有该部门个税操作权限,请联系管理员开通权限"); + } + } Date now = new Date(); EmployeeDeclarePO employeeDeclare = new EmployeeDeclarePO(); employeeDeclare.setTaxAgentId(saveParam.getTaxAgentId()); @@ -551,6 +571,13 @@ public class EmployeeDeclareServiceImpl extends Service implements EmployeeDecla public EmployeeDeclareInfoDTO getDeclareInfo(EmployeeDeclareParam employeeDeclareParam) { // 查询本月已有的需要报送的人员 List employeeDeclares = listByTaxCycleAndTaxAgentId(employeeDeclareParam.getTaxCycle(), employeeDeclareParam.getTaxAgentId()); + + // 240329艾志分权 + // 获取能够管理的义务人id + List taxAgentIds = getTaxAgentService(user).listAllTaxAgentsAsAdmin(Long.valueOf(user.getUID())).stream().map(TaxAgentPO::getId).collect(Collectors.toList()); + Map authMap = empIdsByAzGssbAuth(user.getUID()); + List canManageEmpIds = (List)authMap.get("canManageEmpIds"); + employeeDeclares = employeeDeclares.stream().filter(po -> taxAgentIds.contains(po.getTaxAgentId()) || canManageEmpIds.contains(po.getEmployeeId())).collect(Collectors.toList()); // 本月是否有修改过人员信息 boolean updateEmployeeInfo = employeeDeclares.stream().anyMatch(e -> Objects.equals(e.getNewEmployeeInfo(), 1) && Objects.equals(e.getDeclareStatus(), DeclareStatusEnum.NOT_DECLARE.getValue())); // 本月报送失败的人数 @@ -766,4 +793,44 @@ public class EmployeeDeclareServiceImpl extends Service implements EmployeeDecla } return getEmployeeDeclareMapper().listSome(EmployeeDeclarePO.builder().employeeIds(empIds).taxCycle(date).build()); } + + @Override + public List getAzGssbAuth(int uid) { + RecordSet rs = new RecordSet(); + rs.execute("select qx,bm from uf_gssbqx where gsglry="+uid); + List azGssbAuthList = new ArrayList<>(); + while (rs.next()) { + azGssbAuthList.add(AzGssbDTO.builder() + .gsglry(uid) + .bm(rs.getInt("bm")) + .qx(rs.getInt("qx")).build()); + } + azGssbAuthList = azGssbAuthList.stream().filter(auth -> auth.getQx() == 0 || auth.getQx() == 1).collect(Collectors.toList()); + return azGssbAuthList; + } + + public Map empIdsByAzGssbAuth(int uid) { + //艾志二开,登录人拥有查看、编辑部门权限下的人员 + List azGssbAuth = getAzGssbAuth(uid); + List empListByDep = new ArrayList<>(); + if (azGssbAuth.size() > 0) { + List depWithChildList = new ArrayList<>(); + for (AzGssbDTO dto : azGssbAuth) { + try { + String depStr = DepartmentComInfo.getAllChildDepartId(String.valueOf(dto.getBm()), String.valueOf(dto.getBm())); + depWithChildList.addAll(Arrays.stream(depStr.split(",")).map(Long::parseLong).collect(Collectors.toList())); + } catch (Exception e) { + e.printStackTrace(); + } + } + //查询有权限部门包含的员工id + empListByDep = getSalaryEmployeeService(user).listEmpIdByDepId(depWithChildList); + } + Map resultMap = new HashMap<>(); + resultMap.put("canManageEmpIds", empListByDep); + // 客户会规定一个用户在建模表中要么全是查看权限,要么全是编辑权限 + Optional canOperate = azGssbAuth.stream().filter(dto -> dto.getQx() == 1).findFirst(); + resultMap.put("canOperate", canOperate.isPresent()); + return resultMap; + } } diff --git a/src/com/engine/salary/service/impl/TaxDeclarationExcelServiceImpl.java b/src/com/engine/salary/service/impl/TaxDeclarationExcelServiceImpl.java index 9be20c0ad..a3b15cf1b 100644 --- a/src/com/engine/salary/service/impl/TaxDeclarationExcelServiceImpl.java +++ b/src/com/engine/salary/service/impl/TaxDeclarationExcelServiceImpl.java @@ -7,7 +7,6 @@ import com.engine.core.impl.Service; import com.engine.salary.config.SalaryElogConfig; import com.engine.salary.constant.SalaryDefaultTenantConstant; import com.engine.salary.entity.datacollection.DataCollectionEmployee; -import com.engine.hrmelog.entity.dto.LoggerContext; import com.engine.salary.entity.taxagent.po.TaxAgentPO; import com.engine.salary.entity.taxdeclaration.dto.AbnormalEmployeeListDTO; import com.engine.salary.entity.taxdeclaration.dto.FailEmployeeListDTO; @@ -90,6 +89,10 @@ public class TaxDeclarationExcelServiceImpl extends Service implements TaxDeclar return ServiceUtil.getService(TaxReportColumnServiceImpl.class, user); } + private EmployeeDeclareService getEmployeeDeclareService(User user) { + return ServiceUtil.getService(EmployeeDeclareServiceImpl.class, user); + } + private SalarySysConfMapper getSalarySysConfMapper() { return SqlProxyHandle.getProxy(SalarySysConfMapper.class); } @@ -104,6 +107,15 @@ public class TaxDeclarationExcelServiceImpl extends Service implements TaxDeclar TaxDeclarationPO taxDeclarationPO = getTaxDeclarationService(user).getById(queryParam.getTaxDeclarationId()); // 查询个税申报表明细 List taxDeclarationValues = getTaxDeclarationValueService(user).listByTaxDeclarationIds(Collections.singleton(queryParam.getTaxDeclarationId())); + // 艾志个税分权 + List taxAgentIds = getTaxAgentService(user).listAllTaxAgentsAsAdmin(Long.valueOf(user.getUID())).stream().map(TaxAgentPO::getId).collect(Collectors.toList()); + if (!taxAgentIds.contains(taxDeclarationPO.getTaxAgentId())) { + // 不是薪酬管理员 + Map authMap = getEmployeeDeclareService(user).empIdsByAzGssbAuth(user.getUID()); + List canManageEmpIds = (List)authMap.get("canManageEmpIds"); + taxDeclarationValues = taxDeclarationValues.stream().filter(po -> canManageEmpIds.contains(po.getEmployeeId())).collect(Collectors.toList()); + } + // 转成个税申报表明细 TaxDeclarationValueListDTO taxDeclarationValueListDTO = getTaxDeclarationValueService(user).convert2List(taxDeclarationPO, taxDeclarationValues); // excel导出的数据 diff --git a/src/com/engine/salary/service/impl/TaxDeclarationValueServiceImpl.java b/src/com/engine/salary/service/impl/TaxDeclarationValueServiceImpl.java index 706a31334..834a45b0b 100644 --- a/src/com/engine/salary/service/impl/TaxDeclarationValueServiceImpl.java +++ b/src/com/engine/salary/service/impl/TaxDeclarationValueServiceImpl.java @@ -103,7 +103,7 @@ public class TaxDeclarationValueServiceImpl extends Service implements TaxDeclar } @Override - public PageInfo listPageByTaxDeclarationIds(TaxDeclarationValueListQueryParam queryParam, Collection taxDeclarationIds, String keyword) { + public PageInfo listPageByTaxDeclarationIds(TaxDeclarationValueListQueryParam queryParam, Collection taxDeclarationIds, String keyword, TaxDeclarationPO taxDeclaration) { List taxDeclarationValuePOS = getTaxDeclarationValueMapper().listSome(TaxDeclarationValuePO.builder().taxDeclarationIds(taxDeclarationIds).build()); // 根据关键词查人员信息 if (StringUtils.isNotBlank(keyword)) { @@ -111,6 +111,13 @@ public class TaxDeclarationValueServiceImpl extends Service implements TaxDeclar List empIds = employeeList.stream().map(DataCollectionEmployee::getEmployeeId).collect(Collectors.toList()); taxDeclarationValuePOS = taxDeclarationValuePOS.stream().filter(po -> empIds.contains(po.getEmployeeId())).collect(Collectors.toList()); } + // 艾志分权 + List taxAgentIds = getTaxAgentService(user).listAllTaxAgentsAsAdmin(Long.valueOf(user.getUID())).stream().map(TaxAgentPO::getId).collect(Collectors.toList()); + if (!taxAgentIds.contains(taxDeclaration.getTaxAgentId())) { + Map authMap = getEmployeeDeclareService(user).empIdsByAzGssbAuth(user.getUID()); + List canManageEmpIds = (List)authMap.get("canManageEmpIds"); + taxDeclarationValuePOS = taxDeclarationValuePOS.stream().filter(po -> canManageEmpIds.contains(po.getEmployeeId())).collect(Collectors.toList()); + } taxDeclarationValuePOS = decryptBatch(taxDeclarationValuePOS); return SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), taxDeclarationValuePOS, TaxDeclarationValuePO.class); } diff --git a/src/com/engine/salary/service/impl/TaxDeclareRecordServiceImpl.java b/src/com/engine/salary/service/impl/TaxDeclareRecordServiceImpl.java index 96e4456e2..1abf89a82 100644 --- a/src/com/engine/salary/service/impl/TaxDeclareRecordServiceImpl.java +++ b/src/com/engine/salary/service/impl/TaxDeclareRecordServiceImpl.java @@ -26,6 +26,7 @@ import com.engine.salary.entity.taxagent.po.TaxAgentTaxReturnPO; import com.engine.salary.entity.taxapiflow.bo.TaxApiFlowBO; import com.engine.salary.entity.taxapiflow.po.TaxDeclarationApiFlowRecordPO; import com.engine.salary.entity.taxdeclaration.bo.*; +import com.engine.salary.entity.taxdeclaration.dto.AzGssbDTO; import com.engine.salary.entity.taxdeclaration.dto.TaxDeclarationRateDTO; import com.engine.salary.entity.taxdeclaration.param.AbnormalEmployeeListQueryParam; import com.engine.salary.entity.taxdeclaration.param.DeclareTaxResultFeedbackQueryParam; @@ -225,6 +226,11 @@ public class TaxDeclareRecordServiceImpl extends Service implements TaxDeclareRe Collection taxAgents = Lists.newArrayList(); if (openDevolution && !isChief) { taxAgents = getTaxAgentService(user).listAllTaxAgentsAsAdmin((long) user.getUID()); + // 艾志二开-查询是否具有个税申报权限 + List azGssbAuth = getEmployeeDeclareService(user).getAzGssbAuth(user.getUID()); + if (CollectionUtils.isNotEmpty(azGssbAuth)) { + taxAgents = getTaxAgentService(user).listAll(); + } if (CollectionUtils.isEmpty(taxAgents)) { return pageInfo; } diff --git a/src/com/engine/salary/web/TaxDeclarationController.java b/src/com/engine/salary/web/TaxDeclarationController.java index bc0eb3f65..64c36c30f 100644 --- a/src/com/engine/salary/web/TaxDeclarationController.java +++ b/src/com/engine/salary/web/TaxDeclarationController.java @@ -73,7 +73,7 @@ public class TaxDeclarationController { @Produces(MediaType.APPLICATION_JSON) public String listTaxDeclaration(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody TaxDeclarationListQueryParam queryParam) { User user = HrmUserVarify.getUser(request, response); - return new ResponseResult(user).run(getTaxDeclareRecordWrapper(user)::listPage, queryParam); + return new ResponseResult>(user).run(getTaxDeclareRecordWrapper(user)::listPage, queryParam); } /** diff --git a/src/com/engine/salary/wrapper/EmployeeDeclareWrapper.java b/src/com/engine/salary/wrapper/EmployeeDeclareWrapper.java index 39623bb5a..37db25dd8 100644 --- a/src/com/engine/salary/wrapper/EmployeeDeclareWrapper.java +++ b/src/com/engine/salary/wrapper/EmployeeDeclareWrapper.java @@ -12,6 +12,7 @@ import com.engine.salary.entity.employeedeclare.dto.*; import com.engine.salary.entity.employeedeclare.param.*; import com.engine.salary.entity.employeedeclare.po.EmployeeDeclarePO; import com.engine.salary.entity.taxagent.po.TaxAgentPO; +import com.engine.salary.entity.taxdeclaration.dto.AzGssbDTO; import com.engine.salary.enums.SalaryOnOffEnum; import com.engine.salary.enums.employeedeclare.*; import com.engine.salary.enums.salaryaccounting.EmployeeTypeEnum; @@ -34,6 +35,7 @@ import com.weaver.util.threadPool.ThreadPoolUtil; import com.weaver.util.threadPool.constant.ModulePoolEnum; import com.weaver.util.threadPool.entity.LocalRunnable; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.apache.poi.xssf.usermodel.XSSFWorkbook; import weaver.hrm.User; @@ -95,6 +97,11 @@ public class EmployeeDeclareWrapper extends Service { taxAgents = getTaxAgentService(user).listAll(); } else { taxAgents = new ArrayList<>(getTaxAgentService(user).listAllTaxAgentsAsAdmin(Long.valueOf(user.getUID()))); + // 艾志二开-查询是否具有个税申报权限 + List azGssbAuth = getEmployeeDeclareService(user).getAzGssbAuth(user.getUID()); + if (CollectionUtils.isNotEmpty(azGssbAuth)) { + taxAgents = getTaxAgentService(user).listAll(); + } } if (StringUtils.isNotEmpty(queryParam.getTaxAgentName())) { taxAgents = taxAgents.stream().filter(e -> StringUtils.contains(e.getName(), queryParam.getTaxAgentName())).collect(Collectors.toList()); @@ -110,6 +117,9 @@ public class EmployeeDeclareWrapper extends Service { } + + + /** * 人员报送-全部人员列表 * @@ -120,6 +130,12 @@ public class EmployeeDeclareWrapper extends Service { ValidUtil.doValidator(queryParam); PageInfo pageInfo = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), EmployeeDeclareListDTO.class); List employeeDeclarePOS = getEmployeeDeclareService(user).listByParam(queryParam); + // 获取能够管理的义务人id + List taxAgentIds = getTaxAgentService(user).listAllTaxAgentsAsAdmin(Long.valueOf(user.getUID())).stream().map(TaxAgentPO::getId).collect(Collectors.toList()); + Map authMap = getEmployeeDeclareService(user).empIdsByAzGssbAuth(user.getUID()); + List canManageEmpIds = (List)authMap.get("canManageEmpIds"); + boolean canOperate = (Boolean) authMap.get("canOperate"); + employeeDeclarePOS = employeeDeclarePOS.stream().filter(po -> taxAgentIds.contains(po.getTaxAgentId()) || canManageEmpIds.contains(po.getEmployeeId())).collect(Collectors.toList()); pageInfo.setTotal(employeeDeclarePOS.size()); employeeDeclarePOS = SalaryPageUtil.subList(queryParam.getCurrent(), queryParam.getPageSize(), employeeDeclarePOS); List convert = getEmployeeDeclareService(user).convert(employeeDeclarePOS); @@ -141,9 +157,11 @@ public class EmployeeDeclareWrapper extends Service { Map datas = new HashMap<>(); datas.put("pageInfo", pageInfo); datas.put("dataKey", result.getResultMap()); + datas.put("canOperate", canOperate); return datas; } + /** * 人员报送-本月新增人员列表 * @@ -152,6 +170,12 @@ public class EmployeeDeclareWrapper extends Service { */ public Map list4Add(EmployeeDeclareAddListQueryParam queryParam) { List addPOList = getEmployeeDeclareService(user).list4AddByParam(queryParam); + // 获取能够管理的义务人id + List taxAgentIds = getTaxAgentService(user).listAllTaxAgentsAsAdmin(Long.valueOf(user.getUID())).stream().map(TaxAgentPO::getId).collect(Collectors.toList()); + Map authMap = getEmployeeDeclareService(user).empIdsByAzGssbAuth(user.getUID()); + List canManageEmpIds = (List)authMap.get("canManageEmpIds"); + addPOList = addPOList.stream().filter(po -> taxAgentIds.contains(po.getTaxAgentId()) || canManageEmpIds.contains(po.getEmployeeId())).collect(Collectors.toList()); + PageInfo addPoPageInfo = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), addPOList, EmployeeDeclarePO.class); List addDTOList = getEmployeeDeclareService(user).convert(addPoPageInfo.getList()); // 分页 diff --git a/src/com/engine/salary/wrapper/TaxAgentWrapper.java b/src/com/engine/salary/wrapper/TaxAgentWrapper.java index d633db4eb..d7e55227b 100644 --- a/src/com/engine/salary/wrapper/TaxAgentWrapper.java +++ b/src/com/engine/salary/wrapper/TaxAgentWrapper.java @@ -66,6 +66,10 @@ public class TaxAgentWrapper extends Service { return ServiceUtil.getService(TaxAgentExcelServiceImpl.class, user); } + private EmployeeDeclareService getEmployeeDeclareService(User user) { + return ServiceUtil.getService(EmployeeDeclareServiceImpl.class, user); + } + // private PaymentAgencyService paymentAgencyService; // @@ -106,6 +110,7 @@ public class TaxAgentWrapper extends Service { } resultMap.put("isChief", isChief); resultMap.put("isDefaultOpen", isDefaultOpen); + // 是否是薪酬管理员 resultMap.put("isAdminEnable", isAdminEnable); resultMap.put("isOpenDevolution", isOpenDevolution); resultMap.put("isDepAuth", isDepAuth); diff --git a/src/com/engine/salary/wrapper/TaxDeclareRecordWrapper.java b/src/com/engine/salary/wrapper/TaxDeclareRecordWrapper.java index 9e115aa32..806e9015f 100644 --- a/src/com/engine/salary/wrapper/TaxDeclareRecordWrapper.java +++ b/src/com/engine/salary/wrapper/TaxDeclareRecordWrapper.java @@ -2,9 +2,9 @@ package com.engine.salary.wrapper; import com.engine.common.util.ServiceUtil; import com.engine.core.impl.Service; +import com.engine.hrmelog.entity.dto.LoggerContext; import com.engine.salary.cache.SalaryCacheKey; import com.engine.salary.config.SalaryElogConfig; -import com.engine.hrmelog.entity.dto.LoggerContext; import com.engine.salary.entity.datacollection.DataCollectionEmployee; import com.engine.salary.entity.employeedeclare.param.EmployeeDeclareListQueryParam; import com.engine.salary.entity.employeedeclare.po.EmployeeDeclarePO; @@ -27,12 +27,12 @@ import com.engine.salary.util.SalaryDateUtil; import com.engine.salary.util.SalaryEntityUtil; import com.engine.salary.util.SalaryEnumUtil; import com.engine.salary.util.SalaryI18nUtil; +import com.engine.salary.util.db.IdGenerator; import com.engine.salary.util.page.PageInfo; import com.engine.salary.util.page.SalaryPageUtil; import com.weaver.util.threadPool.ThreadPoolUtil; import com.weaver.util.threadPool.constant.ModulePoolEnum; import com.weaver.util.threadPool.entity.LocalRunnable; -import com.engine.salary.util.db.IdGenerator; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.compress.utils.Lists; @@ -109,7 +109,15 @@ public class TaxDeclareRecordWrapper extends Service { * @param queryParam * @return */ - public PageInfo listPage(TaxDeclarationListQueryParam queryParam) { + public Map listPage(TaxDeclarationListQueryParam queryParam) { + // 获取是否具有艾志个税操作权限 + Map azGssbAuth = getEmployeeDeclareService(user).empIdsByAzGssbAuth(user.getUID()); + boolean canOperate = (Boolean) azGssbAuth.get("canOperate"); + Boolean adminEnable = getTaxAgentService(user).isAdminEnable(Long.valueOf(user.getUID())); + if (adminEnable) { + // 薪酬管理员也有操作权限 + canOperate = true; + } PageInfo page = getTaxDeclareRecordService(user).listPageByParam(queryParam); List list = page.getList(); @@ -149,7 +157,11 @@ public class TaxDeclareRecordWrapper extends Service { } dtoPage.setList(dtoList); } - return dtoPage; + Map resultMap = new HashMap<>(); + resultMap.put("pageInfo", dtoPage); + resultMap.put("canOperate", canOperate); + + return resultMap; } /** @@ -167,7 +179,7 @@ public class TaxDeclareRecordWrapper extends Service { throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(156515, "对不起,您暂时没有权限查看")); } // 查询个税申报表详情 - PageInfo page = getTaxDeclarationValueService(user).listPageByTaxDeclarationIds(queryParam, Collections.singleton(queryParam.getTaxDeclarationId()), queryParam.getKeyword()); + PageInfo page = getTaxDeclarationValueService(user).listPageByTaxDeclarationIds(queryParam, Collections.singleton(queryParam.getTaxDeclarationId()), queryParam.getKeyword(), taxDeclaration); TaxDeclarationValueListDTO taxDeclarationValueListDTO = getTaxDeclarationValueService(user).convert2List(taxDeclaration, page.getList()); PageInfo> dtoPage = new PageInfo<>( page.getPageNum(), @@ -175,6 +187,16 @@ public class TaxDeclareRecordWrapper extends Service { page.getTotal(), SalaryPageUtil.convertList(taxDeclarationValueListDTO.getColumns()), taxDeclarationValueListDTO.getData()); + Map azGssbAuth = getEmployeeDeclareService(user).empIdsByAzGssbAuth(user.getUID()); + boolean canOperate = (Boolean) azGssbAuth.get("canOperate"); + Boolean adminEnable = getTaxAgentService(user).isAdminEnable(Long.valueOf(user.getUID())); + if (adminEnable) { + // 薪酬管理员也有操作权限 + canOperate = true; + } + Map resultMap = new HashMap<>(); + resultMap.put("canOperate", canOperate); + resultMap.put("pageInfo", dtoPage); return dtoPage; }