diff --git a/src/com/engine/salary/entity/taxagent/bo/TaxAgentBO.java b/src/com/engine/salary/entity/taxagent/bo/TaxAgentBO.java index 7078723af..eb80a49af 100644 --- a/src/com/engine/salary/entity/taxagent/bo/TaxAgentBO.java +++ b/src/com/engine/salary/entity/taxagent/bo/TaxAgentBO.java @@ -2,6 +2,7 @@ package com.engine.salary.entity.taxagent.bo; import com.engine.salary.constant.SalaryDefaultTenantConstant; import com.engine.salary.entity.agency.po.PaymentAgencyPO; +import com.engine.salary.entity.auth.po.AuthRolePO; import com.engine.salary.entity.datacollection.DataCollectionEmployee; import com.engine.salary.entity.hrm.DeptInfo; import com.engine.salary.entity.hrm.HrmStatus; @@ -83,21 +84,15 @@ public class TaxAgentBO { // String paymentAgency = SalaryI18nUtil.getI18nLabel(112448, "社保福利代缴机构"); String description = SalaryI18nUtil.getI18nLabel(84961, "备注"); String sortedIndex = SalaryI18nUtil.getI18nLabel(84962, "显示顺序"); + + columns.add(new Column(name, "name", "name")); + columns.add(new Column(employeeRange, "employeeRange", "employeeRange")); if (isOpenDevolution) { - columns.add(new Column(name, "name", "name%")); - columns.add(new Column(employeeRange, "employeeRange", "employeeRange")); - columns.add(new Column(admins, "admins", "admins%")); -// columns.add(new Column(subAdmins, "subAdmins", "20%")); -// columns.add(new Column(paymentAgency, "paymentAgency", "30%")); - columns.add(new Column(description, "description", "name")); - columns.add(new Column(sortedIndex, "sortedIndex", "sortedIndex")); - } else { - columns.add(new Column(name, "name", "name")); - columns.add(new Column(employeeRange, "employeeRange", "employeeRange")); -// columns.add(new WeaTableColumn(paymentAgency, "paymentAgency", "30%")); - columns.add(new Column(description, "description", "description")); - columns.add(new Column(sortedIndex, "sortedIndex", "sortedIndex")); + columns.add(new Column(admins, "admins", "admins")); } + columns.add(new Column("角色", "role", "role")); + columns.add(new Column(description, "description", "description")); + columns.add(new Column(sortedIndex, "sortedIndex", "sortedIndex")); listPage.setColumns(columns); } @@ -146,8 +141,8 @@ public class TaxAgentBO { * @param taxAgents * @return */ - public static List> convertToTableListDTO(List taxAgents, List paymentAgencyPOS, String setLabel) { - return convertToTableListDTO(Boolean.FALSE, taxAgents, paymentAgencyPOS, null, null, setLabel); + public static List> convertToTableListDTO(List taxAgents, List paymentAgencyPOS, Map> rolelistMap) { + return convertToTableListDTO(Boolean.FALSE, taxAgents, paymentAgencyPOS, null, null, rolelistMap); } /** @@ -158,8 +153,8 @@ public class TaxAgentBO { */ public static List> convertToTableListDTO(List taxAgents, List paymentAgencyPOS, List taxAgentAdmins, List adminList, - String setLabel) { - return convertToTableListDTO(Boolean.TRUE, taxAgents, paymentAgencyPOS, taxAgentAdmins, adminList, setLabel); + Map> rolelistMap) { + return convertToTableListDTO(Boolean.TRUE, taxAgents, paymentAgencyPOS, taxAgentAdmins, adminList, rolelistMap); } /** @@ -171,7 +166,7 @@ public class TaxAgentBO { */ public static List> convertToTableListDTO(Boolean isDevolution, List taxAgents, List paymentAgencyPOS, List taxAgentAdmins, - List adminList, String setLabel) { + List adminList, Map> rolelistMap) { if (CollectionUtils.isEmpty(taxAgents)) { return Collections.emptyList(); } @@ -180,12 +175,13 @@ public class TaxAgentBO { Map map = new LinkedHashMap<>(); map.put("id", e.getId()); map.put("name", e.getName()); - map.put("employeeRange", setLabel); + map.put("employeeRange", "设置"); + map.put("role", rolelistMap.getOrDefault(e.getId(), Collections.emptyList())); if (isDevolution) { List empIds = taxAgentAdmins.stream().filter(t -> t.getTaxAgentId().equals(e.getId())).map(TaxAgentAdminPO::getEmployeeId).collect(Collectors.toList()); List admins = adminList.stream().filter(a -> empIds.contains(a.getEmployeeId())).map(DataCollectionEmployee::getUsername).collect(Collectors.toList()); map.put("admins", CollectionUtils.isEmpty(admins) ? "" : Joiner.on(",").join((Iterable) admins)); - map.put("subAdmins", setLabel); + map.put("subAdmins", "设置"); } map.put("paymentAgency", buildPaymentAgency(e.getPaymentAgency(), paymentAgencyPOS)); map.put("description", e.getDescription()); @@ -380,9 +376,9 @@ public class TaxAgentBO { String key = saveParam.getIncludeType() + "-" + targetParam.getTargetType().getValue() + "-" + targetParam.getTargetId() + "-" + rangeTypeEnum.getValue(); if (taxAgentManageRangeMap.containsKey(key)) { TaxAgentManageRangePO taxAgentManageRange = taxAgentManageRangeMap.get(key); - if(isImport){ + if (isImport) { taxAgentManageRange.setEmployeeStatus(JsonUtil.toJsonString(targetParam.getEmployeeStatus())); - }else { + } else { taxAgentManageRange.setEmployeeStatus(JsonUtil.toJsonString(saveParam.getEmployeeStatus())); } taxAgentManageRange.setUpdateTime(now); @@ -403,9 +399,9 @@ public class TaxAgentBO { .tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY) .deleteType(0) .build(); - if(isImport){ + if (isImport) { taxAgentManageRange.setEmployeeStatus(JsonUtil.toJsonString(targetParam.getEmployeeStatus())); - }else { + } else { taxAgentManageRange.setEmployeeStatus(JsonUtil.toJsonString(saveParam.getEmployeeStatus())); } handleResult.getNeedInsertTaxAgentManageRanges().add(taxAgentManageRange); diff --git a/src/com/engine/salary/service/auth/AuthRoleService.java b/src/com/engine/salary/service/auth/AuthRoleService.java index 30dbb3e98..e792ffe69 100644 --- a/src/com/engine/salary/service/auth/AuthRoleService.java +++ b/src/com/engine/salary/service/auth/AuthRoleService.java @@ -1,6 +1,9 @@ package com.engine.salary.service.auth; import com.engine.salary.entity.auth.param.AuthRoleSaveParam; +import com.engine.salary.entity.auth.po.AuthRolePO; + +import java.util.List; /** * 角色 @@ -12,6 +15,8 @@ import com.engine.salary.entity.auth.param.AuthRoleSaveParam; **/ public interface AuthRoleService { + List roleList(Long taxAgentId); + /** * 添加角色 * @param param diff --git a/src/com/engine/salary/service/auth/AuthRoleServiceImpl.java b/src/com/engine/salary/service/auth/AuthRoleServiceImpl.java index 0efeba99e..2d55e403a 100644 --- a/src/com/engine/salary/service/auth/AuthRoleServiceImpl.java +++ b/src/com/engine/salary/service/auth/AuthRoleServiceImpl.java @@ -21,6 +21,7 @@ import weaver.hrm.User; import java.util.Collections; import java.util.Date; +import java.util.List; public class AuthRoleServiceImpl extends Service implements AuthRoleService { @@ -37,6 +38,11 @@ public class AuthRoleServiceImpl extends Service implements AuthRoleService { } + @Override + public List roleList(Long taxAgentId) { + return getAuthRoleMapper().listSome(AuthRolePO.builder().taxAgentId(taxAgentId).build()); + } + @Override public Long saveRole(AuthRoleSaveParam param) { Date now = new Date(); diff --git a/src/com/engine/salary/wrapper/TaxAgentWrapper.java b/src/com/engine/salary/wrapper/TaxAgentWrapper.java index 027df9952..5f70f1903 100644 --- a/src/com/engine/salary/wrapper/TaxAgentWrapper.java +++ b/src/com/engine/salary/wrapper/TaxAgentWrapper.java @@ -4,6 +4,7 @@ import com.cloudstore.dev.api.util.Util_DataCache; import com.engine.common.util.ServiceUtil; import com.engine.core.impl.Service; import com.engine.salary.cache.SalaryCacheKey; +import com.engine.salary.entity.auth.po.AuthRolePO; import com.engine.salary.entity.datacollection.DataCollectionEmployee; import com.engine.salary.entity.hrm.HrmStatus; import com.engine.salary.entity.taxagent.bo.TaxAgentBO; @@ -16,7 +17,10 @@ import com.engine.salary.enums.UserStatusEnum; import com.engine.salary.enums.salarysob.TargetTypeEnum; import com.engine.salary.exception.SalaryRunTimeException; import com.engine.salary.service.*; +import com.engine.salary.service.auth.AuthRoleService; +import com.engine.salary.service.auth.AuthRoleServiceImpl; import com.engine.salary.service.impl.*; +import com.engine.salary.util.SalaryEntityUtil; import com.engine.salary.util.SalaryI18nUtil; import com.engine.salary.util.page.PageInfo; import com.engine.salary.util.page.SalaryPageUtil; @@ -66,6 +70,9 @@ public class TaxAgentWrapper extends Service { return ServiceUtil.getService(TaxAgentExcelServiceImpl.class, user); } + public AuthRoleService getAuthRoleService(User user) { + return ServiceUtil.getService(AuthRoleServiceImpl.class, user); + } // private PaymentAgencyService paymentAgencyService; // @@ -116,8 +123,6 @@ public class TaxAgentWrapper extends Service { // 是否开启分权 boolean isOpenDevolution = getTaxAgentBaseService(user).isOpenDevolution(); -// List paymentAgencyPOS = paymentAgencyService.listAll(currentTenantKey); - PageInfo page = null; // 分权情况下,根据自己作为管理员过滤列表 if (isOpenDevolution && !isChief) { @@ -138,24 +143,29 @@ public class TaxAgentWrapper extends Service { } else { page = getTaxAgentService(user).listPage(queryParam); } + List taxAgentPOS = page.getList(); + //获取角色信息 + List authRolePOS = getAuthRoleService(user).roleList(null); + Map> rolelistMap = SalaryEntityUtil.group2Map(authRolePOS, AuthRolePO::getTaxAgentId); PageInfo> listPage = new PageInfo<>(); - String setLabel = SalaryI18nUtil.getI18nLabel(94614, "设置"); if (isOpenDevolution) { - List list = page.getList(); + List list = taxAgentPOS; List taxAgentIds = list.stream().map(TaxAgentPO::getId).collect(Collectors.toList()); List taxAgentAdmins = getTaxAgentAdminService(user).listByTaxAgentIds(taxAgentIds); List adminList = getSalaryEmployeeService(user).getEmployeeByIdsAll(taxAgentAdmins.stream().map(TaxAgentAdminPO::getEmployeeId).distinct().collect(Collectors.toList())); - listPage.setList(TaxAgentBO.convertToTableListDTO(page.getList(), null, taxAgentAdmins, adminList, setLabel)); + listPage.setList(TaxAgentBO.convertToTableListDTO(taxAgentPOS, null, taxAgentAdmins, adminList, rolelistMap)); } else { - listPage.setList(TaxAgentBO.convertToTableListDTO(page.getList(), null, setLabel)); + listPage.setList(TaxAgentBO.convertToTableListDTO(taxAgentPOS, null, rolelistMap)); } listPage.setTotal(page.getTotal()); listPage.setPageNum(page.getPageNum()); listPage.setPageSize(page.getPageSize()); + + //构造表格 TaxAgentBO.buildTaxAgentTable(listPage, isOpenDevolution);