diff --git a/resource/WEB-INF/salaryoptconfig.xml b/resource/WEB-INF/salaryoptconfig.xml index 80c777de9..b08c0f340 100644 --- a/resource/WEB-INF/salaryoptconfig.xml +++ b/resource/WEB-INF/salaryoptconfig.xml @@ -29,6 +29,10 @@ + + + + diff --git a/src/com/engine/salary/common/BaseQueryParam.java b/src/com/engine/salary/common/BaseQueryParam.java index dd9a8bc3c..6bf519434 100644 --- a/src/com/engine/salary/common/BaseQueryParam.java +++ b/src/com/engine/salary/common/BaseQueryParam.java @@ -1,5 +1,6 @@ package com.engine.salary.common; +import com.engine.salary.enums.auth.AuthFilterTypeEnum; import com.engine.salary.sys.entity.vo.OrderRuleVO; import lombok.AllArgsConstructor; import lombok.Data; @@ -24,4 +25,6 @@ public class BaseQueryParam { * 鎺掑簭瑙勫垯 */ private OrderRuleVO orderRule; + + private AuthFilterTypeEnum filterType ; } diff --git a/src/com/engine/salary/entity/auth/dto/AuthRoleDTO.java b/src/com/engine/salary/entity/auth/dto/AuthRoleDTO.java index 0e228e77f..cb680172f 100644 --- a/src/com/engine/salary/entity/auth/dto/AuthRoleDTO.java +++ b/src/com/engine/salary/entity/auth/dto/AuthRoleDTO.java @@ -1,11 +1,15 @@ package com.engine.salary.entity.auth.dto; import com.engine.salary.annotation.TableTitle; +import com.engine.salary.entity.salarysob.po.SalarySobPO; +import com.engine.salary.entity.taxagent.po.TaxAgentPO; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; +import java.util.List; + /** * 瑙掕壊 */ @@ -23,6 +27,16 @@ public class AuthRoleDTO { @TableTitle(title = "鎻忚堪", dataIndex = "description", key = "description") private String description; + /** + * 鎵g即涔夊姟浜鸿祫婧 + */ + private List taxAgentIds; + + /** + * 璐﹀璧勬簮 + */ + private List sobIds; + @TableTitle(title = "鎴愬憳", dataIndex = "members", key = "members") private Integer members; @@ -35,4 +49,5 @@ public class AuthRoleDTO { @TableTitle(title = "鏁版嵁", dataIndex = "datas", key = "datas") private Integer datas; + } \ No newline at end of file diff --git a/src/com/engine/salary/entity/datacollection/dto/AddUpDeductionDTO.java b/src/com/engine/salary/entity/datacollection/dto/AddUpDeductionDTO.java index b16ebacf6..d0124efdf 100644 --- a/src/com/engine/salary/entity/datacollection/dto/AddUpDeductionDTO.java +++ b/src/com/engine/salary/entity/datacollection/dto/AddUpDeductionDTO.java @@ -9,6 +9,8 @@ import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; +import java.util.Set; + /** * 鏁版嵁閲囬泦-绱涓撻」闄勫姞鎵i櫎 *

Copyright: Copyright (c) 2022

@@ -24,6 +26,7 @@ import lombok.NoArgsConstructor; @SalaryTable(pageId = "a4f85287-e3f9-4275-adn9-7d06e54y67j8", tableType = WeaTableType.CHECKBOX, operates = { @SalaryTableOperate(text = "鏌ョ湅鏄庣粏") }) +@Auth(page = "addUpDeduction") public class AddUpDeductionDTO { /** @@ -164,4 +167,6 @@ public class AddUpDeductionDTO { @SalaryTableColumn(text = "鎿嶄綔", width = "20%", column = "operate") @TableTitle(title = "鎿嶄綔", dataIndex = "operate", key = "operate") private String operate; + + private Set opts; } diff --git a/src/com/engine/salary/entity/salaryBill/dto/SalarySendListDTO.java b/src/com/engine/salary/entity/salaryBill/dto/SalarySendListDTO.java index 915045c89..ff2bb7d2a 100644 --- a/src/com/engine/salary/entity/salaryBill/dto/SalarySendListDTO.java +++ b/src/com/engine/salary/entity/salaryBill/dto/SalarySendListDTO.java @@ -1,8 +1,10 @@ package com.engine.salary.entity.salaryBill.dto; +import com.engine.salary.annotation.Auth; import com.engine.salary.annotation.SalaryTable; import com.engine.salary.annotation.SalaryTableColumn; import com.engine.salary.annotation.SalaryTableOperate; +import com.engine.salary.enums.auth.AuthCheckTypeEnum; import com.fasterxml.jackson.annotation.JsonIgnore; import lombok.AllArgsConstructor; import lombok.Builder; @@ -10,6 +12,7 @@ import lombok.Data; import lombok.NoArgsConstructor; import java.util.Date; +import java.util.Set; /** * @Description: 宸ヨ祫鍗曞彂鏀 @@ -19,10 +22,11 @@ import java.util.Date; @NoArgsConstructor @AllArgsConstructor @SalaryTable(pageId = "a4f85287-289dff07669d7a23de0ef88d2f7129e7", operates = { - @SalaryTableOperate(index = "0", text = "鍙戞斁" ), + @SalaryTableOperate(index = "0", text = "鍙戞斁"), @SalaryTableOperate(index = "1", text = "鏌ョ湅璇︽儏"), @SalaryTableOperate(index = "2", text = "鏇存柊妯℃澘") }) +@Auth(page = "salaryBill", checkType = AuthCheckTypeEnum.SOB, sobIdField = "salarySobId") public class SalarySendListDTO { // 涓婚敭id @@ -37,7 +41,7 @@ public class SalarySendListDTO { // ) // @JsonFormat(pattern = "yyyy-MM") -// 钖祫鎵灞炴湀 + // 钖祫鎵灞炴湀 @SalaryTableColumn(text = "钖祫鎵灞炴湀", width = "10%", column = "salaryYearMonth") private Date salaryYearMonth; @@ -54,15 +58,15 @@ public class SalarySendListDTO { // tableColumn = @TableColumn(width = "35%") // ) -// 钖祫璐﹀ + // 钖祫璐﹀ @SalaryTableColumn(text = "钖祫璐﹀", width = "35%", column = "username") private String salarySob; -// 鏍哥畻娆℃暟") + // 鏍哥畻娆℃暟") // 鏍哥畻娆℃暟 private String acctTimes; -// 宸ヨ祫鍗曟ā鏉") + // 宸ヨ祫鍗曟ā鏉") // @WeaFormat( // label = "宸ヨ祫鍗曟ā鏉", // labelId = 93214, @@ -72,7 +76,7 @@ public class SalarySendListDTO { // 宸ヨ祫鍗曟ā鏉 private String template; -// 宸ヨ祫鍗曟ā鏉縄d") + // 宸ヨ祫鍗曟ā鏉縄d") // 宸ヨ祫鍗曟ā鏉縄d @SalaryTableColumn(text = "宸ヨ祫鍗曟ā鏉縤d", width = "0%", column = "templateId", display = false) private Long templateId; @@ -91,7 +95,7 @@ public class SalarySendListDTO { @SalaryTableColumn(text = "鍙戦佹绘暟", width = "0%", column = "sendTotal", display = false) private Integer sendTotal; -// 宸插彂鏀") + // 宸插彂鏀") // @WeaFormat( // label = "宸插彂鏀", // labelId = 93212, @@ -101,7 +105,7 @@ public class SalarySendListDTO { @SalaryTableColumn(text = "宸插彂鏀", width = "15%", column = "sendSituation") private String sendSituation; -// 鏈鍚庡彂閫佹椂闂") + // 鏈鍚庡彂閫佹椂闂") // @WeaFormat( // label = "鏈鍚庡彂閫佹椂闂", // labelId = 93213, @@ -146,5 +150,5 @@ public class SalarySendListDTO { */ private Integer ackFeedbackStatus; - + private Set opts; } diff --git a/src/com/engine/salary/service/SalarySendService.java b/src/com/engine/salary/service/SalarySendService.java index 4f570039b..15747572a 100644 --- a/src/com/engine/salary/service/SalarySendService.java +++ b/src/com/engine/salary/service/SalarySendService.java @@ -52,6 +52,7 @@ public interface SalarySendService { * @return */ PageInfo listPage(SalarySendQueryParam queryParam); + List list(SalarySendQueryParam queryParam); /** * 宸ヨ祫鍗曞彂鏀 diff --git a/src/com/engine/salary/service/auth/AuthRoleService.java b/src/com/engine/salary/service/auth/AuthRoleService.java index 98a43b0fa..d94b737a1 100644 --- a/src/com/engine/salary/service/auth/AuthRoleService.java +++ b/src/com/engine/salary/service/auth/AuthRoleService.java @@ -19,6 +19,8 @@ public interface AuthRoleService { PageInfo roleList(AuthRoleListQueryParam param); + AuthRoleDTO getRole(Long id); + /** * 娣诲姞瑙掕壊 * @param param diff --git a/src/com/engine/salary/service/auth/AuthRoleServiceImpl.java b/src/com/engine/salary/service/auth/AuthRoleServiceImpl.java index 1ac54bf8b..345da7ae1 100644 --- a/src/com/engine/salary/service/auth/AuthRoleServiceImpl.java +++ b/src/com/engine/salary/service/auth/AuthRoleServiceImpl.java @@ -24,6 +24,7 @@ import com.engine.salary.util.page.PageInfo; import com.engine.salary.util.page.SalaryPageUtil; import weaver.hrm.User; +import java.util.ArrayList; import java.util.Collections; import java.util.Date; import java.util.List; @@ -79,7 +80,32 @@ public class AuthRoleServiceImpl extends Service implements AuthRoleService { } @Override - public Long saveRole(AuthRoleSaveParam param) { + public AuthRoleDTO getRole(Long id) { + AuthRolePO po = getAuthRoleMapper().getById(id); + Long roleId = po.getId(); + List authResources = getAuthResourceMapper().listSome(AuthResourcePO.builder().roleId(roleId).build()); + + List taxAgentIds = new ArrayList<>(); + List sobIds = new ArrayList<>(); + authResources.forEach(resource -> { + if (ResourceTargetTypeEnum.TAX_AGENT.getValue().equals(resource.getTargetType())) { + taxAgentIds.add(TaxAgentPO.builder().id(resource.getTarget()).name(resource.getTargetName()).build()); + } else if (ResourceTargetTypeEnum.SOB.getValue().equals(resource.getTargetType())) { + sobIds.add(SalarySobPO.builder().id(resource.getTarget()).name(resource.getTargetName()).build()); + } + }); + + return AuthRoleDTO.builder() + .id(roleId) + .name(po.getName()) + .description(po.getDescription()) + .taxAgentIds(taxAgentIds) + .sobIds(sobIds) + .build(); + } + + @Override + public Long saveRole(AuthRoleSaveParam param) { Date now = new Date(); Long id = param.getId(); String name = param.getName(); diff --git a/src/com/engine/salary/service/auth/AuthServiceImpl.java b/src/com/engine/salary/service/auth/AuthServiceImpl.java index 2d0e70dfa..ba55a4644 100644 --- a/src/com/engine/salary/service/auth/AuthServiceImpl.java +++ b/src/com/engine/salary/service/auth/AuthServiceImpl.java @@ -67,6 +67,7 @@ public class AuthServiceImpl extends Service implements AuthService { //缁欐荤鐞嗗憳璧嬪兼渶澶ф潈闄 Boolean isChief = getTaxAgentService(user).isChief((long) user.getUID()); +// Boolean isChief = false; if (isChief) { if (filterType == AuthFilterTypeEnum.DATA_OPT) { list.forEach(t -> { @@ -95,7 +96,8 @@ public class AuthServiceImpl extends Service implements AuthService { AuthCheckTypeEnum checkType = auth.checkType(); //缁欏悇绠$悊鍛樿祴鍊煎搴旂殑鎵g即涔夊姟浜烘潈闄 - List adminTaxAgentIds = getTaxAgentService(user).getAdminTaxAgentIds((long) user.getUID()); +// List adminTaxAgentIds = getTaxAgentService(user).getAdminTaxAgentIds((long) user.getUID()); + List adminTaxAgentIds = new ArrayList<>(); if (CollectionUtil.isNotEmpty(adminTaxAgentIds)) { Iterator iterator = list.iterator(); if (checkType == AuthCheckTypeEnum.TAX || checkType == AuthCheckTypeEnum.TAX_EMP) { diff --git a/src/com/engine/salary/service/impl/AddUpDeductionServiceImpl.java b/src/com/engine/salary/service/impl/AddUpDeductionServiceImpl.java index 6a7e15884..36db3ed92 100644 --- a/src/com/engine/salary/service/impl/AddUpDeductionServiceImpl.java +++ b/src/com/engine/salary/service/impl/AddUpDeductionServiceImpl.java @@ -32,11 +32,14 @@ import com.engine.salary.entity.taxagent.dto.TaxAgentManageRangeEmployeeDTO; 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.salaryaccounting.SalaryAcctRecordStatusEnum; import com.engine.salary.exception.SalaryRunTimeException; import com.engine.salary.mapper.datacollection.AddUpDeductionMapper; import com.engine.salary.mapper.sys.SalarySysConfMapper; 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.po.SalarySysConfPO; import com.engine.salary.sys.entity.vo.OrderRuleVO; import com.engine.salary.sys.service.SalarySysConfService; @@ -116,6 +119,11 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction return ServiceUtil.getService(SpecialAddDeductionServiceImpl.class, user); } + public AuthService getAuthService(User user) { + return ServiceUtil.getService(AuthServiceImpl.class, user); + } + + @Override public Map getSearchCondition(Map params) { Map apidatas = new HashMap(); @@ -219,12 +227,7 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction Date now = new Date(); //寰呮彃鍏ユ暟鎹簱瀵硅薄 - AddUpDeduction addUpDeduction = AddUpDeduction.builder() - .tenantKey(DEFAULT_TENANT_KEY) - .createTime(now) - .updateTime(now) - .creator((long) user.getUID()) - .declareMonth(declareMonth).build(); + AddUpDeduction addUpDeduction = AddUpDeduction.builder().tenantKey(DEFAULT_TENANT_KEY).createTime(now).updateTime(now).creator((long) user.getUID()).declareMonth(declareMonth).build(); //寮傚父鐐规暟閲 int errorSum = 0; @@ -256,9 +259,7 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction errorSum += 1; } else if (employeeSameIds.size() > 1) { //瀛樺湪绂昏亴鍜屽湪鑱岀姸鎬佸彇鍦ㄨ亴鐘舵 - employeeSameIds = employeeSameIds.stream() - .filter(e -> UserStatusEnum.getNormalStatus().contains(e.getStatus())) - .collect(Collectors.toList()); + employeeSameIds = employeeSameIds.stream().filter(e -> UserStatusEnum.getNormalStatus().contains(e.getStatus())).collect(Collectors.toList()); if (employeeSameIds.size() != 1) { Map errorMessageMap = Maps.newHashMap(); errorMessageMap.put("message", rowIndex + "鍛樺伐淇℃伅涓嶅瓨鍦ㄦ垨鑰呭瓨鍦ㄥ涓憳宸"); @@ -480,8 +481,7 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction loggerContext.setTargetName(SalaryI18nUtil.getI18nLabel(0, "绱涓撻」闄勫姞鎵i櫎") + "-" + addUpDeduction.getId()); loggerContext.setOperateType(OperateTypeEnum.UPDATE.getValue()); loggerContext.setOperateTypeName(name); - loggerContext.setOperatedesc(SalaryI18nUtil.getI18nLabel(0, "绱涓撻」闄勫姞鎵i櫎") + "-" + SalaryI18nUtil - .getI18nLabel(0, "缂栬緫")); + loggerContext.setOperatedesc(SalaryI18nUtil.getI18nLabel(0, "绱涓撻」闄勫姞鎵i櫎") + "-" + SalaryI18nUtil.getI18nLabel(0, "缂栬緫")); loggerContext.setOldValues(byId); loggerContext.setNewValues(newValue); loggerContext.setUser(user); @@ -518,12 +518,7 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction List taxAgentEmployees = Lists.newArrayList(); Date now = new Date(); //寰呮彃鍏ユ暟鎹簱瀵硅薄 - AddUpDeduction addUpDeduction = AddUpDeduction.builder() - .tenantKey(DEFAULT_TENANT_KEY) - .createTime(now) - .updateTime(now) - .creator((long) user.getUID()) - .declareMonth(declareMonth).build(); + AddUpDeduction addUpDeduction = AddUpDeduction.builder().tenantKey(DEFAULT_TENANT_KEY).createTime(now).updateTime(now).creator((long) user.getUID()).declareMonth(declareMonth).build(); boolean employeeSameId = employees.stream().anyMatch(e -> Objects.equals(e.getEmployeeId(), addUpDeductionRecordParam.getEmployeeId())); if (!employeeSameId) { throw new SalaryRunTimeException("鍛樺伐淇℃伅涓嶅瓨鍦"); @@ -647,8 +642,7 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction loggerContext.setTargetName(SalaryI18nUtil.getI18nLabel(0, "绱涓撻」闄勫姞鎵i櫎") + "-" + e.getId()); loggerContext.setOperateType(OperateTypeEnum.DELETE.getValue()); loggerContext.setOperateTypeName(SalaryI18nUtil.getI18nLabel(0, "鍒犻櫎")); - loggerContext.setOperatedesc(SalaryI18nUtil.getI18nLabel(0, "绱涓撻」闄勫姞鎵i櫎") + "-" + SalaryI18nUtil - .getI18nLabel(0, "鍒犻櫎")); + loggerContext.setOperatedesc(SalaryI18nUtil.getI18nLabel(0, "绱涓撻」闄勫姞鎵i櫎") + "-" + SalaryI18nUtil.getI18nLabel(0, "鍒犻櫎")); loggerContext.setOldValues(e); loggerContext.setUser(user); SalaryElogConfig.addUpDeductionLoggerTemplate.write(loggerContext); @@ -702,16 +696,14 @@ 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.getTaxAgentId())).map(TaxAgentManageRangeEmployeeDTO::getTaxAgentName).collect(Collectors.toList()); String name = declareMonthStr + " " + StringUtils.join(taxAgentNames, ","); LoggerContext loggerContext = new LoggerContext<>(); loggerContext.setUser(user); loggerContext.setTargetName(name); loggerContext.setOperateType(OperateTypeEnum.CLEAR.getValue()); loggerContext.setOperateTypeName(SalaryI18nUtil.getI18nLabel(0, "涓閿竻绌")); - loggerContext.setOperatedesc(SalaryI18nUtil.getI18nLabel(0, "绱涓撻」闄勫姞鎵i櫎") + "-" + SalaryI18nUtil - .getI18nLabel(0, "涓閿竻绌猴細") + name); + loggerContext.setOperatedesc(SalaryI18nUtil.getI18nLabel(0, "绱涓撻」闄勫姞鎵i櫎") + "-" + SalaryI18nUtil.getI18nLabel(0, "涓閿竻绌猴細") + name); SalaryElogConfig.addUpDeductionLoggerTemplate.write(loggerContext); } @@ -745,8 +737,7 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction try { Util_DataCache.setObjVal(cacheKey, true); //濡傛灉鏄畾鏃朵换鍔$洿鎺ユ煡璇㈡墍鏈夛紝isAdmin浼爐rue - boolean isChief = Boolean.TRUE.equals(isAdmin) - || getTaxAgentService(user).isChief((long) user.getUID()); + boolean isChief = Boolean.TRUE.equals(isAdmin) || getTaxAgentService(user).isChief((long) user.getUID()); Collection taxAgents; if (isChief) { taxAgents = getTaxAgentService(user).listAll(); @@ -759,25 +750,18 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction } LocalDateTime yearMonthTime = DateUtil.toLocalDateTime(yearMonth); //璁剧疆鏃堕棿鍒颁笅涓骞1鏈1鍙 - Instant instant = yearMonthTime.plusYears(1L) - .withMonth(1).withDayOfMonth(1) - .atZone(ZoneOffset.systemDefault()).toInstant(); + Instant instant = yearMonthTime.plusYears(1L).withMonth(1).withDayOfMonth(1).atZone(ZoneOffset.systemDefault()).toInstant(); Date nextYearStart = Date.from(instant); - int countByDeclareAfter = getAddUpDeductionMapper() - .countByDeclareAfter(yearMonth, nextYearStart, - taxAgents.stream().map(TaxAgentPO::getId).collect(Collectors.toList()) - ); + int countByDeclareAfter = getAddUpDeductionMapper().countByDeclareAfter(yearMonth, nextYearStart, taxAgents.stream().map(TaxAgentPO::getId).collect(Collectors.toList())); if (countByDeclareAfter > 0) { throw new SalaryRunTimeException("鏃犳硶绱锛岃妫鏌ュ綋鍓嶇疮璁″勾搴﹀唴璇ユ湀鍚庢槸鍚︽湁绱涓撻」闄勫姞鎵i櫎璁板綍锛"); } List updateList = new ArrayList<>(); List insertList = new ArrayList<>(); List errorMessages = new ArrayList<>(); - List accountedEmployeeData = - getAccountedEmployeeData(DateUtil.format(yearMonth, "yyyy-MM")); + List accountedEmployeeData = getAccountedEmployeeData(DateUtil.format(yearMonth, "yyyy-MM")); for (TaxAgentPO taxAgent : taxAgents) { - List employeePOs = getSpecialAddDeductionService(user) - .getSpecialAddDeductionPOByEmployee(null, taxAgent.getId()); + List employeePOs = getSpecialAddDeductionService(user).getSpecialAddDeductionPOByEmployee(null, taxAgent.getId()); //鑾峰彇涓婃湀鍛樺伐鏁版嵁锛岀敤浜庣疮鍔 @@ -797,17 +781,12 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction employeePOs.forEach(employeePO -> { Long employeeId = employeePO.getEmployeeId(); // 濡傛灉璇ュ憳宸ュ綋鍓嶆湀浠藉凡缁忔牳绠楋紝涓嶅仛绱 - SalaryAcctEmployeePO anyAccountedEmployee = accountedEmployeeData.stream() - .filter(e -> e.getEmployeeId().equals(employeeId)) - .filter(e -> e.getTaxAgentId().equals(taxAgent.getId())) - .findAny().orElse(null); + SalaryAcctEmployeePO anyAccountedEmployee = accountedEmployeeData.stream().filter(e -> e.getEmployeeId().equals(employeeId)).filter(e -> e.getTaxAgentId().equals(taxAgent.getId())).findAny().orElse(null); if (anyAccountedEmployee != null) { errorMessages.add(employeeId); return; } - AddUpDeduction addUpDeduction = Optional.ofNullable(lastEmpInfo.get(employeeId)) - .flatMap(list -> list.stream().findFirst()) - .orElseGet(AddUpDeduction::new); + AddUpDeduction addUpDeduction = Optional.ofNullable(lastEmpInfo.get(employeeId)).flatMap(list -> list.stream().findFirst()).orElseGet(AddUpDeduction::new); this.combine(addUpDeduction, employeePO); addUpDeduction.setEmployeeId(employeeId); @@ -817,9 +796,7 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction addUpDeduction.setTenantKey(DEFAULT_TENANT_KEY); //纭褰撴湡鏄惁鏈夊凡缁忕疮璁$殑璁板綍 - AddUpDeduction oldInfo = Optional.ofNullable(currentEmpInfo.get(employeeId)) - .flatMap(c -> c.stream().findFirst()) - .orElse(null); + AddUpDeduction oldInfo = Optional.ofNullable(currentEmpInfo.get(employeeId)).flatMap(c -> c.stream().findFirst()).orElse(null); Date now = new Date(); if (oldInfo == null) { addUpDeduction.setCreateTime(now); @@ -833,10 +810,8 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction } }); } - Lists.partition(insertList, 100) - .forEach(l -> getAddUpDeductionMapper().insertData((List) l)); - Lists.partition(updateList, 100) - .forEach(l -> getAddUpDeductionMapper().updateDataAndDeclareMonth((List) l)); + Lists.partition(insertList, 100).forEach(l -> getAddUpDeductionMapper().insertData((List) l)); + Lists.partition(updateList, 100).forEach(l -> getAddUpDeductionMapper().updateDataAndDeclareMonth((List) l)); // 璁板綍鏃ュ織 // 鏍规嵁鏈堜唤銆佷汉鍛榠d鏌ュ嚭淇濆瓨鐨勬暟鎹 @@ -863,11 +838,7 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction } if (!errorMessages.isEmpty()) { - String userNames = getSalaryEmployeeService(user) - .getEmployeeByIdsAll(errorMessages) - .stream() - .map(DataCollectionEmployee::getUsername) - .collect(Collectors.joining(",")); + String userNames = getSalaryEmployeeService(user).getEmployeeByIdsAll(errorMessages).stream().map(DataCollectionEmployee::getUsername).collect(Collectors.joining(",")); return "涓閿疮璁″畬鎴愶紒鍛樺伐" + userNames + "鍦ㄨ骞存湀宸叉牳绠楀綊妗o紝璺宠繃鏈绱"; } return "涓閿疮璁″畬鎴愶紒"; @@ -907,16 +878,12 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction } private String plus(String var0, String var1) { - return SalaryEntityUtil.string2BigDecimalDefault0(var0) - .add(SalaryEntityUtil.string2BigDecimalDefault0(var1)) - .toString(); + return SalaryEntityUtil.string2BigDecimalDefault0(var0).add(SalaryEntityUtil.string2BigDecimalDefault0(var1)).toString(); } private Map> getEmpInfoByYearMonth(TaxAgentPO taxAgent, List employeePOs, YearMonth lastMonth) { List addUpDeductionList = getAddUpDeductionList(lastMonth, employeePOs.stream().map(SpecialAddDeductionPO::getEmployeeId).collect(Collectors.toList()), Collections.singletonList(taxAgent.getId())); - return addUpDeductionList.stream() - .filter(addUpDeduction -> taxAgent.getId().equals(addUpDeduction.getTaxAgentId())) - .collect(Collectors.groupingBy(AddUpDeduction::getEmployeeId)); + return addUpDeductionList.stream().filter(addUpDeduction -> taxAgent.getId().equals(addUpDeduction.getTaxAgentId())).collect(Collectors.groupingBy(AddUpDeduction::getEmployeeId)); } @@ -975,26 +942,12 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction queryParam.setDeclareMonthDate(declareMonth.stream().map(e -> e + "-01 00:00:00").map(SalaryDateUtil::dateStrToLocalTime).collect(Collectors.toList())); } - long employeeId = user.getUID(); - - Boolean needAuth = getTaxAgentService(user).isNeedAuth(employeeId); - if (needAuth) { - List taxAgentIdsAsAdmin = getTaxAgentService(user).listAllTaxAgentsAsAdmin(employeeId).stream().map(TaxAgentPO::getId).collect(Collectors.toList()); - if (CollectionUtils.isEmpty(taxAgentIdsAsAdmin)) { - return new PageInfo<>(AddUpDeductionDTO.class); - } - // 杩囨护涔夊姟浜虹瓫閫夋 - if (CollectionUtils.isNotEmpty(queryParam.getTaxAgentIds())) { - taxAgentIdsAsAdmin = taxAgentIdsAsAdmin.stream().filter(id -> queryParam.getTaxAgentIds().contains(id)).collect(Collectors.toList()); - } - queryParam.setTaxAgentIds(taxAgentIdsAsAdmin); - } - //鎺掑簭閰嶇疆 OrderRuleVO orderRule = getSalarySysConfService(user).orderRule(); queryParam.setOrderRule(orderRule); List list = getAddUpDeductionMapper().list(queryParam); + list = getAuthService(user).auth(list, AuthFilterTypeEnum.DATA_OPT, AddUpDeductionDTO.class); PageInfo pageInfo = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), list, AddUpDeductionDTO.class); encryptUtil.decryptList(pageInfo.getList(), AddUpDeductionDTO.class); return pageInfo; @@ -1014,8 +967,7 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction } List list = getAddUpDeductionMapper().recordList(queryParam); - PageInfo page = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), - list, AddUpDeductionRecordDTO.class); + PageInfo page = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), list, AddUpDeductionRecordDTO.class); encryptUtil.decryptList(page.getList(), AddUpDeductionRecordDTO.class); return page; } @@ -1081,26 +1033,23 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM"); //鏌ヨ璇︾粏淇℃伅 List list = new AddUpDeductionBiz().recordList(param); - final List> dataRowList = Optional.ofNullable(list) - .map(List::stream) - .map(operatorStream -> operatorStream.map(dto -> { - List cellList = new ArrayList<>(); - cellList.add(Util.null2String(dto.getUsername())); - cellList.add(Util.null2String(dto.getDeclareMonth() == null ? "" : formatter.format(dto.getDeclareMonth()))); - cellList.add(Util.null2String(dto.getTaxAgentName())); - cellList.add(Util.null2String(dto.getDepartmentName())); - cellList.add(Util.null2String(dto.getJobNum())); - cellList.add(NumberUtil.isNumber(dto.getAddUpChildEducation()) ? new BigDecimal(dto.getAddUpChildEducation()) : Util.null2String(dto.getAddUpChildEducation())); - cellList.add(NumberUtil.isNumber(dto.getAddUpContinuingEducation()) ? new BigDecimal(dto.getAddUpContinuingEducation()) :Util.null2String(dto.getAddUpContinuingEducation())); - cellList.add(NumberUtil.isNumber(dto.getAddUpHousingLoanInterest()) ? new BigDecimal(dto.getAddUpHousingLoanInterest()) :Util.null2String(dto.getAddUpHousingLoanInterest())); - cellList.add(NumberUtil.isNumber(dto.getAddUpHousingRent()) ? new BigDecimal(dto.getAddUpHousingRent()) :Util.null2String(dto.getAddUpHousingRent())); - cellList.add(NumberUtil.isNumber(dto.getAddUpSupportElderly()) ? new BigDecimal(dto.getAddUpSupportElderly()) :Util.null2String(dto.getAddUpSupportElderly())); - cellList.add(NumberUtil.isNumber(dto.getAddUpIllnessMedical()) ? new BigDecimal(dto.getAddUpIllnessMedical()) :Util.null2String(dto.getAddUpIllnessMedical())); - cellList.add(NumberUtil.isNumber(dto.getAddUpInfantCare()) ? new BigDecimal(dto.getAddUpInfantCare()) :Util.null2String(dto.getAddUpInfantCare())); + final List> dataRowList = Optional.ofNullable(list).map(List::stream).map(operatorStream -> operatorStream.map(dto -> { + List cellList = new ArrayList<>(); + cellList.add(Util.null2String(dto.getUsername())); + cellList.add(Util.null2String(dto.getDeclareMonth() == null ? "" : formatter.format(dto.getDeclareMonth()))); + cellList.add(Util.null2String(dto.getTaxAgentName())); + cellList.add(Util.null2String(dto.getDepartmentName())); + cellList.add(Util.null2String(dto.getJobNum())); + cellList.add(NumberUtil.isNumber(dto.getAddUpChildEducation()) ? new BigDecimal(dto.getAddUpChildEducation()) : Util.null2String(dto.getAddUpChildEducation())); + cellList.add(NumberUtil.isNumber(dto.getAddUpContinuingEducation()) ? new BigDecimal(dto.getAddUpContinuingEducation()) : Util.null2String(dto.getAddUpContinuingEducation())); + cellList.add(NumberUtil.isNumber(dto.getAddUpHousingLoanInterest()) ? new BigDecimal(dto.getAddUpHousingLoanInterest()) : Util.null2String(dto.getAddUpHousingLoanInterest())); + cellList.add(NumberUtil.isNumber(dto.getAddUpHousingRent()) ? new BigDecimal(dto.getAddUpHousingRent()) : Util.null2String(dto.getAddUpHousingRent())); + cellList.add(NumberUtil.isNumber(dto.getAddUpSupportElderly()) ? new BigDecimal(dto.getAddUpSupportElderly()) : Util.null2String(dto.getAddUpSupportElderly())); + cellList.add(NumberUtil.isNumber(dto.getAddUpIllnessMedical()) ? new BigDecimal(dto.getAddUpIllnessMedical()) : Util.null2String(dto.getAddUpIllnessMedical())); + cellList.add(NumberUtil.isNumber(dto.getAddUpInfantCare()) ? new BigDecimal(dto.getAddUpInfantCare()) : Util.null2String(dto.getAddUpInfantCare())); - return cellList; - }).collect(Collectors.toList())) - .orElse(Collections.emptyList()); + return cellList; + }).collect(Collectors.toList())).orElse(Collections.emptyList()); // 寮鍚垎鏉冨苟涓斾笉鏄柂閰ā鍧楁荤鐞嗗憳 @@ -1112,8 +1061,7 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction // 浣滀负绠$悊鍛 taxAgentIdsAsAdmin.contains(f.getTaxAgentId()) // 浣滀负鍒嗙鐞嗗憳 - || TaxAgentBO.checkTaxAgentAndEmployee(taxAgentEmployees, f.getTaxAgentId(), f.getEmployeeId()) - ).collect(Collectors.toList()); + || TaxAgentBO.checkTaxAgentAndEmployee(taxAgentEmployees, f.getTaxAgentId(), f.getEmployeeId())).collect(Collectors.toList()); } @@ -1137,22 +1085,7 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction public XSSFWorkbook downloadTemplate(boolean isChief, AddUpDeductionQueryParam queryParam) { String sheetName = SalaryI18nUtil.getI18nLabel(101603, "绱涓撻」闄勫姞鎵i櫎瀵煎叆妯℃澘"); - String[] header = { - SalaryI18nUtil.getI18nLabel(85429, "濮撳悕"), - SalaryI18nUtil.getI18nLabel(86184, "涓◣鎵g即涔夊姟浜"), - SalaryI18nUtil.getI18nLabel(86185, "閮ㄩ棬"), - SalaryI18nUtil.getI18nLabel(86186, "鎵嬫満鍙"), - SalaryI18nUtil.getI18nLabel(86317, "宸ュ彿"), - SalaryI18nUtil.getI18nLabel(86318, "璇佷欢鍙风爜"), - SalaryI18nUtil.getI18nLabel(86319, "鍏ヨ亴鏃ユ湡"), - SalaryI18nUtil.getI18nLabel(86321, "绱瀛愬コ鏁欒偛"), - SalaryI18nUtil.getI18nLabel(86323, "绱缁х画鏁欒偛"), - SalaryI18nUtil.getI18nLabel(86324, "绱浣忔埧璐锋鍒╂伅"), - SalaryI18nUtil.getI18nLabel(86325, "绱浣忔埧绉熼噾"), - SalaryI18nUtil.getI18nLabel(86326, "绱璧″吇鑰佷汉"), - SalaryI18nUtil.getI18nLabel(105142, "绱澶х梾鍖荤枟"), - SalaryI18nUtil.getI18nLabel(105142, "绱濠村辜鍎跨収鎶") - }; + String[] header = {SalaryI18nUtil.getI18nLabel(85429, "濮撳悕"), SalaryI18nUtil.getI18nLabel(86184, "涓◣鎵g即涔夊姟浜"), SalaryI18nUtil.getI18nLabel(86185, "閮ㄩ棬"), SalaryI18nUtil.getI18nLabel(86186, "鎵嬫満鍙"), SalaryI18nUtil.getI18nLabel(86317, "宸ュ彿"), SalaryI18nUtil.getI18nLabel(86318, "璇佷欢鍙风爜"), SalaryI18nUtil.getI18nLabel(86319, "鍏ヨ亴鏃ユ湡"), SalaryI18nUtil.getI18nLabel(86321, "绱瀛愬コ鏁欒偛"), SalaryI18nUtil.getI18nLabel(86323, "绱缁х画鏁欒偛"), SalaryI18nUtil.getI18nLabel(86324, "绱浣忔埧璐锋鍒╂伅"), SalaryI18nUtil.getI18nLabel(86325, "绱浣忔埧绉熼噾"), SalaryI18nUtil.getI18nLabel(86326, "绱璧″吇鑰佷汉"), SalaryI18nUtil.getI18nLabel(105142, "绱澶х梾鍖荤枟"), SalaryI18nUtil.getI18nLabel(105142, "绱濠村辜鍎跨収鎶")}; List headerList = Arrays.asList(header); @@ -1225,31 +1158,27 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction // 浣滀负绠$悊鍛 taxAgentIdsAsAdmin.contains(f.getTaxAgentId()) // 浣滀负鍒嗙鐞嗗憳 - || TaxAgentBO.checkTaxAgentAndEmployee(taxAgentEmployees, f.getTaxAgentId(), f.getEmployeeId()) - ).collect(Collectors.toList()); + || TaxAgentBO.checkTaxAgentAndEmployee(taxAgentEmployees, f.getTaxAgentId(), f.getEmployeeId())).collect(Collectors.toList()); } - List> dataRowList = Optional.ofNullable(list) - .map(List::stream) - .map(operatorStream -> operatorStream.map(dto -> { - List cellList = new ArrayList<>(); - cellList.add(Util.null2String(dto.getUsername())); - cellList.add(Util.null2String(dto.getTaxAgentName())); - cellList.add(Util.null2String(dto.getDepartmentName())); - cellList.add(Util.null2String(dto.getMobile())); - cellList.add(Util.null2String(dto.getJobNum())); - cellList.add(Util.null2String(dto.getIdNo())); - cellList.add(Util.null2String(dto.getHiredate())); - cellList.add(NumberUtil.isNumber(dto.getAddUpChildEducation()) ? new BigDecimal(dto.getAddUpChildEducation()) : Util.null2String(dto.getAddUpChildEducation())); - cellList.add(NumberUtil.isNumber(dto.getAddUpContinuingEducation()) ? new BigDecimal(dto.getAddUpContinuingEducation()) :Util.null2String(dto.getAddUpContinuingEducation())); - cellList.add(NumberUtil.isNumber(dto.getAddUpHousingLoanInterest()) ? new BigDecimal(dto.getAddUpHousingLoanInterest()) :Util.null2String(dto.getAddUpHousingLoanInterest())); - cellList.add(NumberUtil.isNumber(dto.getAddUpHousingRent()) ? new BigDecimal(dto.getAddUpHousingRent()) :Util.null2String(dto.getAddUpHousingRent())); - cellList.add(NumberUtil.isNumber(dto.getAddUpSupportElderly()) ? new BigDecimal(dto.getAddUpSupportElderly()) :Util.null2String(dto.getAddUpSupportElderly())); - cellList.add(NumberUtil.isNumber(dto.getAddUpIllnessMedical()) ? new BigDecimal(dto.getAddUpIllnessMedical()) :Util.null2String(dto.getAddUpIllnessMedical())); - cellList.add(NumberUtil.isNumber(dto.getAddUpInfantCare()) ? new BigDecimal(dto.getAddUpInfantCare()) :Util.null2String(dto.getAddUpInfantCare())); - return cellList; - }).collect(Collectors.toList())) - .orElse(Collections.emptyList()); + List> dataRowList = Optional.ofNullable(list).map(List::stream).map(operatorStream -> operatorStream.map(dto -> { + List cellList = new ArrayList<>(); + cellList.add(Util.null2String(dto.getUsername())); + cellList.add(Util.null2String(dto.getTaxAgentName())); + cellList.add(Util.null2String(dto.getDepartmentName())); + cellList.add(Util.null2String(dto.getMobile())); + cellList.add(Util.null2String(dto.getJobNum())); + cellList.add(Util.null2String(dto.getIdNo())); + cellList.add(Util.null2String(dto.getHiredate())); + cellList.add(NumberUtil.isNumber(dto.getAddUpChildEducation()) ? new BigDecimal(dto.getAddUpChildEducation()) : Util.null2String(dto.getAddUpChildEducation())); + cellList.add(NumberUtil.isNumber(dto.getAddUpContinuingEducation()) ? new BigDecimal(dto.getAddUpContinuingEducation()) : Util.null2String(dto.getAddUpContinuingEducation())); + cellList.add(NumberUtil.isNumber(dto.getAddUpHousingLoanInterest()) ? new BigDecimal(dto.getAddUpHousingLoanInterest()) : Util.null2String(dto.getAddUpHousingLoanInterest())); + cellList.add(NumberUtil.isNumber(dto.getAddUpHousingRent()) ? new BigDecimal(dto.getAddUpHousingRent()) : Util.null2String(dto.getAddUpHousingRent())); + cellList.add(NumberUtil.isNumber(dto.getAddUpSupportElderly()) ? new BigDecimal(dto.getAddUpSupportElderly()) : Util.null2String(dto.getAddUpSupportElderly())); + cellList.add(NumberUtil.isNumber(dto.getAddUpIllnessMedical()) ? new BigDecimal(dto.getAddUpIllnessMedical()) : Util.null2String(dto.getAddUpIllnessMedical())); + cellList.add(NumberUtil.isNumber(dto.getAddUpInfantCare()) ? new BigDecimal(dto.getAddUpInfantCare()) : Util.null2String(dto.getAddUpInfantCare())); + return cellList; + }).collect(Collectors.toList())).orElse(Collections.emptyList()); return dataRowList; } @@ -1282,10 +1211,7 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction YearMonth month = YearMonth.parse(yearMonth); LocalDate salaryMonthDate = month.atDay(1); LocalDate salaryMonthEndDate = month.atEndOfMonth(); - List salaryAcctRecords = getSalaryAcctRecordService(user).listByTaxCycle( - LocalDateRange.builder().fromDate(SalaryDateUtil.localDateToDate(salaryMonthDate)) - .endDate(SalaryDateUtil.localDateToDate(salaryMonthEndDate)).build(), - null); + List salaryAcctRecords = getSalaryAcctRecordService(user).listByTaxCycle(LocalDateRange.builder().fromDate(SalaryDateUtil.localDateToDate(salaryMonthDate)).endDate(SalaryDateUtil.localDateToDate(salaryMonthEndDate)).build(), null); salaryAcctRecords.forEach(e -> { boolean isAccounted = e.getStatus() > SalaryAcctRecordStatusEnum.NOT_ARCHIVED.getValue(); if (isAccounted) { diff --git a/src/com/engine/salary/service/impl/SalaryArchiveExcelServiceImpl.java b/src/com/engine/salary/service/impl/SalaryArchiveExcelServiceImpl.java index acc81e362..3257860d9 100644 --- a/src/com/engine/salary/service/impl/SalaryArchiveExcelServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalaryArchiveExcelServiceImpl.java @@ -21,11 +21,14 @@ import com.engine.salary.entity.salarysob.param.SalarySobRangeSaveParam; import com.engine.salary.entity.taxagent.dto.TaxAgentManageRangeEmployeeDTO; import com.engine.salary.entity.taxagent.param.TaxAgentRangeSaveParam; import com.engine.salary.entity.taxagent.po.TaxAgentPO; +import com.engine.salary.enums.auth.AuthFilterTypeEnum; import com.engine.salary.enums.datacollection.UseEmployeeTypeEnum; import com.engine.salary.enums.salaryarchive.SalaryArchiveImportTypeEnum; import com.engine.salary.enums.salaryarchive.SalaryArchiveListTypeEnum; import com.engine.salary.enums.salaryarchive.SalaryArchiveStatusEnum; 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.po.SalarySysConfPO; import com.engine.salary.sys.service.SalarySysConfService; import com.engine.salary.sys.service.impl.SalarySysConfServiceImpl; @@ -89,6 +92,10 @@ public class SalaryArchiveExcelServiceImpl extends Service implements SalaryArch return ServiceUtil.getService(SalarySysConfServiceImpl.class, user); } + public AuthService getAuthService(User user) { + return ServiceUtil.getService(AuthServiceImpl.class, user); + } + private SalaryArchiveBiz salaryArchiveMapper = new SalaryArchiveBiz(); private SalaryArchiveItemBiz salaryArchiveItemMapper = new SalaryArchiveItemBiz(); @@ -311,17 +318,9 @@ public class SalaryArchiveExcelServiceImpl extends Service implements SalaryArch rows.add(header); // 鑾峰彇鎵鏈変釜绋庢墸缂翠箟鍔′汉 Collection taxAgentList = getTaxAgentService(user).listAll(); - Collection salaryArchives = salaryArchiveService(user).getSalaryArchiveList(queryParam); + List salaryArchives = salaryArchiveService(user).getSalaryArchiveList(queryParam); + salaryArchives = getAuthService(user).auth(salaryArchives, AuthFilterTypeEnum.ADMIN_DATA, SalaryArchiveListDTO.class); - long employeeId = user.getUID(); - if (getTaxAgentService(user).isNeedAuth(employeeId)) { - List taxAgentIdsAsAdmin = getTaxAgentService(user).listAllTaxAgentsAsAdmin(employeeId).stream().map(TaxAgentPO::getId).collect(Collectors.toList()); - salaryArchives = salaryArchives.stream() - .filter(f -> - // 浣滀负绠$悊鍛 - taxAgentIdsAsAdmin.contains(f.getTaxAgentId()) - ).collect(Collectors.toList()); - } if (queryParam.getHasData()) { List> listMaps = salaryArchiveService(user) .buildSalaryArchiveData(salaryArchives, taxAgentList, salaryItems, Boolean.FALSE); diff --git a/src/com/engine/salary/service/impl/SalaryArchiveServiceImpl.java b/src/com/engine/salary/service/impl/SalaryArchiveServiceImpl.java index 7efe48768..13c4de06f 100644 --- a/src/com/engine/salary/service/impl/SalaryArchiveServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalaryArchiveServiceImpl.java @@ -547,29 +547,11 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe OrderRuleVO orderRule = getSalarySysConfService(user).orderRule(); queryParam.setOrderRule(orderRule); - Collection salaryArchives = getSalaryArchiveList(queryParam); + List salaryArchives = getSalaryArchiveList(queryParam); //鍒嗘潈 - Boolean needAuth = getTaxAgentService(user).isNeedAuth(employeeId); - if (needAuth) { - Boolean adminEnable = getTaxAgentService(user).isAdminEnable(employeeId); - if (!adminEnable) { - salaryArchives = new ArrayList<>(); - } else { + salaryArchives = getAuthService(user).auth(salaryArchives, AuthFilterTypeEnum.QUERY_DATA, SalaryArchiveListDTO.class); - Collection taxAgentPOS = getTaxAgentService(user).listAllTaxAgentsAsAdmin((long) user.getUID()); - Set taxAgentIds = SalaryEntityUtil.properties(taxAgentPOS, TaxAgentPO::getId); - - //鑾峰彇绠$悊鎵g即鍗曚綅钖祫妗f - salaryArchives = salaryArchives.stream().filter(dto -> taxAgentIds.contains(dto.getTaxAgentId())).collect(Collectors.toList()); - - //杩囨护妗f鐘舵 - if (StringUtils.isNotBlank(queryParam.getArchiveStatus())) { - //杩囨护妗f鐘舵 - salaryArchives = salaryArchives.stream().filter(dto -> StringUtils.equals(queryParam.getArchiveStatus(), dto.getArchiveStatus())).collect(Collectors.toList()); - } - } - } List> listMaps = buildSalaryArchiveData(salaryArchives, taxAgentList, salaryItems, Boolean.FALSE); // 缁勮鏁版嵁 diff --git a/src/com/engine/salary/service/impl/SalarySendServiceImpl.java b/src/com/engine/salary/service/impl/SalarySendServiceImpl.java index 5ee35419d..bcc0f71d1 100644 --- a/src/com/engine/salary/service/impl/SalarySendServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalarySendServiceImpl.java @@ -58,6 +58,8 @@ import com.engine.salary.mapper.salarybill.SalarySendInfoMapper; import com.engine.salary.mapper.salarybill.SalarySendMapper; import com.engine.salary.report.common.constant.SalaryConstant; 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.OrderRuleVO; import com.engine.salary.sys.service.SalarySysConfService; import com.engine.salary.sys.service.impl.SalarySysConfServiceImpl; @@ -199,6 +201,10 @@ public class SalarySendServiceImpl extends Service implements SalarySendService return ServiceUtil.getService(SalaryBillBaseSetServiceImpl.class, user); } + public AuthService getAuthService(User user) { + return ServiceUtil.getService(AuthServiceImpl.class, user); + } + @Override public SalarySendPO getById(Long salarySendId) { return mapper.getById(salarySendId); @@ -430,6 +436,12 @@ public class SalarySendServiceImpl extends Service implements SalarySendService return pageInfo; } + @Override + public List list(SalarySendQueryParam queryParam) { + List list = mapper.list(queryParam); + return getAuthService(user).auth(list, queryParam.getFilterType(), SalarySendListDTO.class); + } + @Override public SalarySendBaseInfoDTO getBaseInfo(Long id) { SalarySendPO salarySend = mapper.getById(id); diff --git a/src/com/engine/salary/web/AuthController.java b/src/com/engine/salary/web/AuthController.java index 0c95482e7..d03c668c3 100644 --- a/src/com/engine/salary/web/AuthController.java +++ b/src/com/engine/salary/web/AuthController.java @@ -45,6 +45,14 @@ public class AuthController { return new ResponseResult>(user).run(getAuthWrapper(user)::roleList, param); } + @GET + @Path("/role/getRole") + @Produces(MediaType.APPLICATION_JSON) + public String getRole(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody @QueryParam(value = "id") Long id) { + User user = HrmUserVarify.getUser(request, response); + return new ResponseResult(user).run(getAuthWrapper(user)::getRole, id); + } + @POST @Path("/role/save") @Produces(MediaType.APPLICATION_JSON) diff --git a/src/com/engine/salary/wrapper/AuthWrapper.java b/src/com/engine/salary/wrapper/AuthWrapper.java index 9f0485f56..5e3faa0e0 100644 --- a/src/com/engine/salary/wrapper/AuthWrapper.java +++ b/src/com/engine/salary/wrapper/AuthWrapper.java @@ -53,6 +53,10 @@ public class AuthWrapper extends Service { return getAuthRoleService(user).roleList(param); } + public AuthRoleDTO getRole(Long id) { + return getAuthRoleService(user).getRole(id); + } + public Long saveRole(AuthRoleSaveParam param) { ValidUtil.doValidator(param); return getAuthRoleService(user).saveRole(param); diff --git a/src/com/engine/salary/wrapper/SalarySendWrapper.java b/src/com/engine/salary/wrapper/SalarySendWrapper.java index 0fccfecd0..3e2983871 100644 --- a/src/com/engine/salary/wrapper/SalarySendWrapper.java +++ b/src/com/engine/salary/wrapper/SalarySendWrapper.java @@ -22,9 +22,9 @@ import com.engine.salary.entity.salaryacct.po.SalaryAcctRecordPO; import com.engine.salary.entity.salarysob.po.SalarySobPO; import com.engine.salary.entity.taxagent.dto.TaxAgentListDTO; import com.engine.salary.enums.UserStatusEnum; +import com.engine.salary.enums.auth.AuthFilterTypeEnum; import com.engine.salary.enums.salarybill.SalarySendStatusEnum; import com.engine.salary.exception.SalaryRunTimeException; -import com.engine.salary.mapper.salarybill.SalarySendMapper; import com.engine.salary.service.*; import com.engine.salary.service.impl.*; import com.engine.salary.sys.constant.SalarySysConstant; @@ -33,7 +33,6 @@ import com.engine.salary.sys.enums.PayrollCheckTypeEnum; import com.engine.salary.sys.service.SalarySysConfService; import com.engine.salary.sys.service.impl.SalarySysConfServiceImpl; import com.engine.salary.util.SalaryDateUtil; -import com.engine.salary.util.SalaryEntityUtil; import com.engine.salary.util.SalaryI18nUtil; import com.engine.salary.util.SalaryTokenUtil; import com.engine.salary.util.page.PageInfo; @@ -112,23 +111,11 @@ public class SalarySendWrapper extends Service implements SalarySendWrapperProxy try { queryParam.setSalaryMonth(queryParam.getSalaryYearMonth().stream().map(e -> e + "-01 00:00:00").collect(Collectors.toList())); queryParam.setSalaryMonthDate(queryParam.getSalaryYearMonth().stream().map(e -> e + "-01 00:00:00").map(SalaryDateUtil::dateStrToLocalTime).collect(Collectors.toList())); - //鍒嗘潈锛岃幏鍙栧綋鍓嶄汉鍛樼鐞嗙殑璐﹀ - Boolean needAuth = getTaxAgentService(user).isNeedAuth(currentEmployeeId); - List list = new ArrayList<>(); - if (needAuth) { - List salarySobPOS = getSalarySobService(user).listByDisable(NumberUtils.INTEGER_ZERO); - Set salarySobIds = SalaryEntityUtil.properties(salarySobPOS, SalarySobPO::getId); - if (CollectionUtils.isNotEmpty(salarySobIds)) { - queryParam.setSalarySobIds(salarySobIds); - SalarySendMapper salarySendMapper = sqlSession.getMapper(SalarySendMapper.class); - list = salarySendMapper.list(queryParam); - } - } else { - SalarySendMapper salarySendMapper = sqlSession.getMapper(SalarySendMapper.class); - list = salarySendMapper.list(queryParam); - } + queryParam.setFilterType(AuthFilterTypeEnum.DATA_OPT); - list.stream().forEach(dto -> { + List list = getSalarySendService(user).list(queryParam); + + list.forEach(dto -> { // 鍥炵畻杩囷紝浣嗘槸鏌ョ湅鐨勬槸鏅氬伐璧勫崟锛堜笉鑳芥煡鐪嬭鎯咃級;鍥炵畻杩囷紝浣嗘槸鏌ョ湅鐨勬槸鍥炵畻宸ヨ祫鍗曪紙鍙互鍙戯級锛涜褰曟病鍥炵畻杩囷紙鍙互鍙戯級 if(Objects.equals(dto.getSalaryAcctRecordType(), NumberUtils.INTEGER_ONE) && Objects.equals(dto.getSalaryAcctType(),NumberUtils.INTEGER_ZERO)){ dto.setCanSeeDetail(false);