diff --git a/src/com/engine/salary/biz/AddUpDeductionBiz.java b/src/com/engine/salary/biz/AddUpDeductionBiz.java index 14ba5933c..3e7f8330c 100644 --- a/src/com/engine/salary/biz/AddUpDeductionBiz.java +++ b/src/com/engine/salary/biz/AddUpDeductionBiz.java @@ -96,7 +96,9 @@ public class AddUpDeductionBiz extends BaseBean { try { AddUpDeductionMapper mapper = sqlSession.getMapper(AddUpDeductionMapper.class); List addUpDeductionRecordStrDTOS = mapper.recordList(param); - return encryptUtil.decryptList(addUpDeductionRecordStrDTOS, AddUpDeductionRecordDTO.class); + encryptUtil.decryptList(addUpDeductionRecordStrDTOS, AddUpDeductionRecordDTO.class); + SalaryI18nUtil.i18nList(addUpDeductionRecordStrDTOS); + return addUpDeductionRecordStrDTOS; } finally { sqlSession.close(); } diff --git a/src/com/engine/salary/entity/auth/dto/AuthRoleDTO.java b/src/com/engine/salary/entity/auth/dto/AuthRoleDTO.java index cb680172f..2dac34f8f 100644 --- a/src/com/engine/salary/entity/auth/dto/AuthRoleDTO.java +++ b/src/com/engine/salary/entity/auth/dto/AuthRoleDTO.java @@ -37,15 +37,15 @@ public class AuthRoleDTO { */ private List sobIds; + @TableTitle(title = "资源", dataIndex = "resources", key = "resources") + private Integer resources; + @TableTitle(title = "成员", dataIndex = "members", key = "members") private Integer members; @TableTitle(title = "权限", dataIndex = "opts", key = "opts") private Integer opts; - @TableTitle(title = "资源", dataIndex = "resources", key = "resources") - private Integer resources; - @TableTitle(title = "数据", dataIndex = "datas", key = "datas") private Integer datas; diff --git a/src/com/engine/salary/service/AddUpDeductionService.java b/src/com/engine/salary/service/AddUpDeductionService.java index ef3b259ba..5d7e2211d 100644 --- a/src/com/engine/salary/service/AddUpDeductionService.java +++ b/src/com/engine/salary/service/AddUpDeductionService.java @@ -86,10 +86,9 @@ public interface AddUpDeductionService { * 导出详情 * * @param beLongEmployeeId - * @param isChief * @param queryParam */ - XSSFWorkbook exportDetail(Long beLongEmployeeId, boolean isChief, AddUpDeductionQueryParam queryParam); + XSSFWorkbook exportDetail(Long beLongEmployeeId, AddUpDeductionQueryParam queryParam); /** * 获取累计专项附加扣除数据 @@ -155,5 +154,7 @@ public interface AddUpDeductionService { * @return void * @author lfc */ - String autoAddAll(Date yearMonth, Boolean isAdmin, List taxAgentIds); + String autoAddAll(Date yearMonth, boolean isAdmin, List taxAgentIds); + + List listAuth(AddUpDeductionQueryParam param); } diff --git a/src/com/engine/salary/service/impl/AddUpDeductionServiceImpl.java b/src/com/engine/salary/service/impl/AddUpDeductionServiceImpl.java index 46c8fef28..bf5850e5a 100644 --- a/src/com/engine/salary/service/impl/AddUpDeductionServiceImpl.java +++ b/src/com/engine/salary/service/impl/AddUpDeductionServiceImpl.java @@ -10,10 +10,10 @@ import com.api.formmode.mybatis.util.SqlProxyHandle; import com.cloudstore.dev.api.util.Util_DataCache; import com.engine.common.util.ServiceUtil; import com.engine.core.impl.Service; +import com.engine.hrmelog.entity.dto.LoggerContext; import com.engine.salary.biz.AddUpDeductionBiz; import com.engine.salary.common.LocalDateRange; import com.engine.salary.config.SalaryElogConfig; -import com.engine.hrmelog.entity.dto.LoggerContext; import com.engine.salary.encrypt.EncryptUtil; import com.engine.salary.entity.datacollection.AddUpDeduction; import com.engine.salary.entity.datacollection.DataCollectionEmployee; @@ -26,8 +26,6 @@ import com.engine.salary.entity.datacollection.param.AddUpDeductionRecordParam; import com.engine.salary.entity.datacollection.po.SpecialAddDeductionPO; import com.engine.salary.entity.salaryacct.po.SalaryAcctEmployeePO; import com.engine.salary.entity.salaryacct.po.SalaryAcctRecordPO; -import com.engine.salary.entity.taxagent.bo.TaxAgentBO; -import com.engine.salary.entity.taxagent.dto.TaxAgentEmployeeDTO; import com.engine.salary.entity.taxagent.dto.TaxAgentManageRangeEmployeeDTO; import com.engine.salary.entity.taxagent.param.TaxAgentQueryParam; import com.engine.salary.entity.taxagent.po.TaxAgentPO; @@ -646,8 +644,10 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction long currentEmployeeId = user.getUID(); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); // 获取所有个税扣缴义务人 - Collection taxAgentList = getTaxAgentService(user).listTaxAgentAndEmployeeTree(currentEmployeeId); - List taxAgentIds = taxAgentList.stream().map(TaxAgentManageRangeEmployeeDTO::getTaxAgentId).collect(Collectors.toList()); + TaxAgentQueryParam param = TaxAgentQueryParam.builder().build(); + param.setFilterType(AuthFilterTypeEnum.ADMIN_DATA); + Collection taxAgentList = getTaxAgentService(user).listAuth(param); + List taxAgentIds = SalaryEntityUtil.properties(taxAgentList, TaxAgentPO::getId, Collectors.toList()); AddUpDeductionBiz addUpDeductionBiz = new AddUpDeductionBiz(); ArrayList declareMonthDate = new ArrayList<>(); try { @@ -659,10 +659,6 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction if (deleteParam.getTaxAgentId() != null && (!deleteParam.getTaxAgentId().equals(""))) { // 设置了个税扣缴义务人 Long taxAgentId = SalaryEntityUtil.string2Long(deleteParam.getTaxAgentId()); - boolean canDelete = taxAgentIds.stream().anyMatch(t -> Objects.equals(t, taxAgentId)); - if (!canDelete) { - throw new SalaryRunTimeException("个税扣缴义务人不存在或不在权限范围内!"); - } ArrayList tai = new ArrayList<>(); tai.add(taxAgentId); queryParam = AddUpDeductionQueryParam.builder().declareMonthDate(declareMonthDate).taxAgentIds(tai).build(); @@ -670,7 +666,9 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction queryParam = AddUpDeductionQueryParam.builder().declareMonthDate(declareMonthDate).taxAgentIds(taxAgentIds).build(); } // 获取所有想要删除的数据 - List list = addUpDeductionBiz.list(queryParam); + queryParam.setFilterType(AuthFilterTypeEnum.ADMIN_DATA); + List list = listAuth(queryParam); + // 获取已经核算的数据 List salaryAcctEmployees = getAccountedEmployeeDataByTaxYearMonth(declareMonthStr); for (AddUpDeductionDTO item : list) { @@ -686,7 +684,7 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction // 记录日志 Collection finalTaxAgentIds = queryParam.getTaxAgentIds(); - List taxAgentNames = taxAgentList.stream().filter(t -> finalTaxAgentIds.contains(t.getTaxAgentId())).map(TaxAgentManageRangeEmployeeDTO::getTaxAgentName).collect(Collectors.toList()); + List taxAgentNames = taxAgentList.stream().filter(t -> finalTaxAgentIds.contains(t.getId())).map(TaxAgentPO::getName).collect(Collectors.toList()); String name = declareMonthStr + " " + StringUtils.join(taxAgentNames, ","); LoggerContext loggerContext = new LoggerContext<>(); loggerContext.setUser(user); @@ -710,7 +708,7 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction } @Override - public String autoAddAll(Date yearMonth, Boolean isAdmin, List taxAgentIds) { + public String autoAddAll(Date yearMonth, boolean isAdmin, List taxAgentIds) { String cacheKey = "addUpDeduction_autoAddAll_processing"; Object objVal = Util_DataCache.getObjVal(cacheKey); if (objVal != null) { @@ -719,12 +717,13 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction try { Util_DataCache.setObjVal(cacheKey, true); //如果是定时任务直接查询所有,isAdmin传true - boolean isChief = Boolean.TRUE.equals(isAdmin) || getTaxAgentService(user).isChief((long) user.getUID()); Collection taxAgents; - if (isChief) { + if (isAdmin) { taxAgents = getTaxAgentService(user).listAll(); } else { - taxAgents = getTaxAgentService(user).listAllTaxAgentsAsAdmin((long) user.getUID()); + TaxAgentQueryParam param = TaxAgentQueryParam.builder().build(); + param.setFilterType(AuthFilterTypeEnum.ADMIN_DATA); + taxAgents = getTaxAgentService(user).listAuth(param); } // 过滤个税扣缴义务人选择框 if (CollectionUtils.isNotEmpty(taxAgentIds)) { @@ -829,6 +828,15 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction } } + @Override + public List listAuth(AddUpDeductionQueryParam param) { + List list = getAddUpDeductionMapper().list(param); + list = getAuthService(user).auth(list, param.getFilterType(), AddUpDeductionDTO.class); + encryptUtil.decryptList(list, AddUpDeductionDTO.class); + SalaryI18nUtil.i18nList(list); + return list; + } + /** * 对每个扣除项做加法 * @@ -928,8 +936,9 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction OrderRuleVO orderRule = getSalarySysConfService(user).orderRule(); queryParam.setOrderRule(orderRule); - List list = getAddUpDeductionMapper().list(queryParam); - list = getAuthService(user).auth(list, AuthFilterTypeEnum.DATA_OPT, AddUpDeductionDTO.class); + queryParam.setFilterType(AuthFilterTypeEnum.DATA_OPT); + List list = listAuth(queryParam); + PageInfo pageInfo = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), list, AddUpDeductionDTO.class); encryptUtil.decryptList(pageInfo.getList(), AddUpDeductionDTO.class); return pageInfo; @@ -961,7 +970,7 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction * @return */ @Override - public XSSFWorkbook exportDetail(Long beLongEmployeeId, boolean isChief, AddUpDeductionQueryParam queryParam) { + public XSSFWorkbook exportDetail(Long beLongEmployeeId, AddUpDeductionQueryParam queryParam) { queryParam.setEmployeeId(beLongEmployeeId); AddUpDeductionBiz biz = new AddUpDeductionBiz(); @@ -991,7 +1000,7 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction //获取操作按钮资源 - List> rowList = getExcelRowDetailList(isChief, queryParam); + List> rowList = getExcelRowDetailList(queryParam); //获取excel @@ -1005,8 +1014,7 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction * @param param * @return */ - private List> getExcelRowDetailList(boolean isChief, AddUpDeductionQueryParam param) { - long employeeId = user.getUID(); + private List> getExcelRowDetailList(AddUpDeductionQueryParam param) { //excel标题 List title = Arrays.asList("姓名", "申报月份", "个税扣缴义务人", "部门", "工号", "累计子女教育", "累计继续教育", "累计住房贷款利息", "累计住房租金", "累计赡养老人", "累计大病医疗", "累计婴幼儿照护"); @@ -1034,19 +1042,6 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction }).collect(Collectors.toList())).orElse(Collections.emptyList()); - // 开启分权并且不是薪酬模块总管理员 - if (getTaxAgentService(user).isOpenDevolution() && !isChief) { - List taxAgentEmployees = getTaxAgentService(user).listTaxAgentAndEmployee(employeeId); - List taxAgentIdsAsAdmin = getTaxAgentService(user).listAllTaxAgentsAsAdmin(employeeId).stream().map(TaxAgentPO::getId).collect(Collectors.toList()); -// List lastList = getLastListByModifier(employeeId, tenantKey); - list = list.stream().filter(f -> - // 作为管理员 - taxAgentIdsAsAdmin.contains(f.getTaxAgentId()) - // 作为分管理员 - || TaxAgentBO.checkTaxAgentAndEmployee(taxAgentEmployees, f.getTaxAgentId(), f.getEmployeeId())).collect(Collectors.toList()); - } - - List> rowList = new ArrayList<>(); rowList.add(title); rowList.addAll(dataRowList); @@ -1075,6 +1070,7 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction List> rows = new ArrayList<>(); rows.add(headerList); if (queryParam.isHasData()) { + queryParam.setFilterType(AuthFilterTypeEnum.ADMIN_DATA); List> datas = getLists(queryParam); rows.addAll(datas); } @@ -1102,6 +1098,7 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction //excel标题 List title = Arrays.asList("姓名", "个税扣缴义务人", "部门", "手机号", "工号", "证件号码", "入职日期", "累计子女教育", "累计继续教育", "累计住房贷款利息", "累计住房租金", "累计赡养老人", "累计大病医疗", "累计婴幼儿照护"); + queryParam.setFilterType(AuthFilterTypeEnum.QUERY_DATA); List> dataRowList = getLists(queryParam); List> rowList = new ArrayList<>(); @@ -1130,18 +1127,7 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction OrderRuleVO orderRule = getSalarySysConfService(user).orderRule(); param.setOrderRule(orderRule); - List list = new AddUpDeductionBiz().list(param); - - // 开启分权并且不是薪酬模块总管理员 - if (getTaxAgentService(user).isNeedAuth(uid)) { - List taxAgentEmployees = getTaxAgentService(user).listTaxAgentAndEmployee(uid); - List taxAgentIdsAsAdmin = getTaxAgentService(user).listAllTaxAgentsAsAdmin(uid).stream().map(TaxAgentPO::getId).collect(Collectors.toList()); - list = list.stream().filter(f -> - // 作为管理员 - taxAgentIdsAsAdmin.contains(f.getTaxAgentId()) - // 作为分管理员 - || TaxAgentBO.checkTaxAgentAndEmployee(taxAgentEmployees, f.getTaxAgentId(), f.getEmployeeId())).collect(Collectors.toList()); - } + List list = listAuth(param); List> dataRowList = Optional.ofNullable(list).map(List::stream).map(operatorStream -> operatorStream.map(dto -> { List cellList = new ArrayList<>(); diff --git a/src/com/engine/salary/web/SalaryItemController.java b/src/com/engine/salary/web/SalaryItemController.java index 50c610056..115719b2c 100644 --- a/src/com/engine/salary/web/SalaryItemController.java +++ b/src/com/engine/salary/web/SalaryItemController.java @@ -6,6 +6,7 @@ import com.engine.salary.entity.salaryitem.dto.SalaryItemFormDTO; import com.engine.salary.entity.salaryitem.dto.SalaryItemListDTO; import com.engine.salary.entity.salaryitem.dto.SysSalaryItemListDTO; import com.engine.salary.entity.salaryitem.param.*; +import com.engine.salary.entity.salaryitem.po.SalaryItemPO; import com.engine.salary.exception.SalaryRunTimeException; import com.engine.salary.util.ResponseResult; import com.engine.salary.util.SalaryI18nUtil; @@ -72,7 +73,7 @@ public class SalaryItemController { @Produces(MediaType.APPLICATION_JSON) public String listAuth(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalaryItemSearchParam searchParam) { User user = HrmUserVarify.getUser(request, response); - return new ResponseResult>(request, response, user).run(getSalaryItemWrapper(user)::listAuth, searchParam); + return new ResponseResult>(request, response, user).run(getSalaryItemWrapper(user)::listAuth, searchParam); } diff --git a/src/com/engine/salary/wrapper/AddUpDeductionWrapper.java b/src/com/engine/salary/wrapper/AddUpDeductionWrapper.java index 68c8e6c4d..a4e3bf86f 100644 --- a/src/com/engine/salary/wrapper/AddUpDeductionWrapper.java +++ b/src/com/engine/salary/wrapper/AddUpDeductionWrapper.java @@ -115,9 +115,8 @@ public class AddUpDeductionWrapper extends Service { if (po == null) { throw new SalaryRunTimeException(String.format(SalaryI18nUtil.getI18nLabel(100338, "累计专项附加扣除不存在") + "[id:%s]", id)); } - boolean isChief = getTaxAgentService(user).isChief((long) user.getUID()); - return getAddUpDeductionService(user).exportDetail(po.getEmployeeId(), isChief, queryParam); + return getAddUpDeductionService(user).exportDetail(po.getEmployeeId(), queryParam); } /** @@ -168,12 +167,9 @@ public class AddUpDeductionWrapper extends Service { public String autoAddAll(AddDeductionAutoAddParam param) { Date yearMonth = param.getYearMonthDate(); - if (isLog) { - log.info("一键累计, 操作人 「{}」", user.getUsername()); - } if (yearMonth == null) { throw new SalaryRunTimeException("一键累计传入日期格式错误"); } - return getAddUpDeductionService(user).autoAddAll(yearMonth, null, param.getTaxAgentIds()); + return getAddUpDeductionService(user).autoAddAll(yearMonth, false, param.getTaxAgentIds()); } } diff --git a/src/com/engine/salary/wrapper/SalaryItemWrapper.java b/src/com/engine/salary/wrapper/SalaryItemWrapper.java index fc61561fa..2a510d8db 100644 --- a/src/com/engine/salary/wrapper/SalaryItemWrapper.java +++ b/src/com/engine/salary/wrapper/SalaryItemWrapper.java @@ -322,7 +322,7 @@ public class SalaryItemWrapper extends Service { return getSalaryItemService(user).downloadTemplate(param); } - public void listAuth(SalaryItemSearchParam param) { - getSalaryItemService(user).listByName(param.getName()); + public List listAuth(SalaryItemSearchParam param) { + return getSalaryItemService(user).listByName(param.getName()); } }