From de0728665b3dbfadcee54fde4652d84e49bc5b42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=92=B1=E6=B6=9B?= <15850646081@163.com> Date: Fri, 13 Sep 2024 17:32:15 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=BC=E5=85=A5=E5=BE=80=E6=9C=9F=E7=B4=AF?= =?UTF-8?q?=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- resource/WEB-INF/salaryoptconfig.xml | 37 +++++++ .../engine/salary/common/BaseQueryParam.java | 3 + .../entity/datacollection/AddUpSituation.java | 10 +- .../dto/AttendQuoteListDTO.java | 10 +- .../taxagent/param/TaxAgentQueryParam.java | 6 -- .../impl/AddUpSituationServiceImpl.java | 97 +++++++------------ .../service/impl/AttendQuoteServiceImpl.java | 42 +++----- 7 files changed, 100 insertions(+), 105 deletions(-) diff --git a/resource/WEB-INF/salaryoptconfig.xml b/resource/WEB-INF/salaryoptconfig.xml index 006a55326..2539fcf90 100644 --- a/resource/WEB-INF/salaryoptconfig.xml +++ b/resource/WEB-INF/salaryoptconfig.xml @@ -2,7 +2,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/com/engine/salary/common/BaseQueryParam.java b/src/com/engine/salary/common/BaseQueryParam.java index 6bf519434..703231be8 100644 --- a/src/com/engine/salary/common/BaseQueryParam.java +++ b/src/com/engine/salary/common/BaseQueryParam.java @@ -26,5 +26,8 @@ public class BaseQueryParam { */ private OrderRuleVO orderRule; + /** + * 鏁版嵁杩囨护绾у埆 + */ private AuthFilterTypeEnum filterType ; } diff --git a/src/com/engine/salary/entity/datacollection/AddUpSituation.java b/src/com/engine/salary/entity/datacollection/AddUpSituation.java index b6d456bb8..b9d7278c6 100644 --- a/src/com/engine/salary/entity/datacollection/AddUpSituation.java +++ b/src/com/engine/salary/entity/datacollection/AddUpSituation.java @@ -1,9 +1,6 @@ package com.engine.salary.entity.datacollection; -import com.engine.salary.annotation.Encrypt; -import com.engine.salary.annotation.SalaryFormulaVar; -import com.engine.salary.annotation.SalaryTable; -import com.engine.salary.annotation.SalaryTableOperate; +import com.engine.salary.annotation.*; import com.engine.hrmelog.annotation.ElogTransform; import lombok.AllArgsConstructor; import lombok.Builder; @@ -13,6 +10,7 @@ import lombok.NoArgsConstructor; import java.util.Collection; import java.util.Date; import java.util.List; +import java.util.Set; /** * 鏁版嵁閲囬泦-绱鎯呭喌琛 @@ -24,6 +22,7 @@ import java.util.List; @SalaryTable(pageId = "a4f83287-e3f9-4275-9527-7d06e54y6238", fields = "id,addUpSubtraction", operates = {@SalaryTableOperate(text = "鍒犻櫎",index = "0")}) //hrsa_add_up_situation @ElogTransform(name = "寰鏈熺疮璁℃儏鍐") +@Auth(page = "addUpSituation") public class AddUpSituation { /** * 涓婚敭id @@ -234,4 +233,7 @@ public class AddUpSituation { Collection employeeIds; Collection taxAgentIds; + + private Set opts; + } \ No newline at end of file diff --git a/src/com/engine/salary/entity/datacollection/dto/AttendQuoteListDTO.java b/src/com/engine/salary/entity/datacollection/dto/AttendQuoteListDTO.java index f058c3d91..f5c6fce5f 100644 --- a/src/com/engine/salary/entity/datacollection/dto/AttendQuoteListDTO.java +++ b/src/com/engine/salary/entity/datacollection/dto/AttendQuoteListDTO.java @@ -1,9 +1,7 @@ package com.engine.salary.entity.datacollection.dto; -import com.engine.salary.annotation.SalaryTable; -import com.engine.salary.annotation.SalaryTableColumn; -import com.engine.salary.annotation.SalaryTableOperate; -import com.engine.salary.annotation.TableTitle; +import com.engine.salary.annotation.*; +import com.engine.salary.enums.auth.AuthCheckTypeEnum; import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; @@ -13,6 +11,7 @@ import lombok.Data; import lombok.NoArgsConstructor; import java.util.Date; +import java.util.Set; /** * 鏁版嵁閲囬泦-鑰冨嫟寮曠敤鍒楄〃 @@ -30,6 +29,7 @@ import java.util.Date; @SalaryTableOperate(text = "鏌ョ湅", index = "0"), @SalaryTableOperate(text = "鍒犻櫎", index = "1") }) +@Auth(page = "attendQuote",checkType = AuthCheckTypeEnum.SOB) public class AttendQuoteListDTO { @SalaryTableColumn(column = "id", display = false) @@ -79,4 +79,6 @@ public class AttendQuoteListDTO { * 钖祫璐﹀id */ private Long salarySobId; + + private Set opts; } diff --git a/src/com/engine/salary/entity/taxagent/param/TaxAgentQueryParam.java b/src/com/engine/salary/entity/taxagent/param/TaxAgentQueryParam.java index a8663b5cd..410b0b2b4 100644 --- a/src/com/engine/salary/entity/taxagent/param/TaxAgentQueryParam.java +++ b/src/com/engine/salary/entity/taxagent/param/TaxAgentQueryParam.java @@ -1,7 +1,6 @@ package com.engine.salary.entity.taxagent.param; import com.engine.salary.common.BaseQueryParam; -import com.engine.salary.enums.auth.AuthFilterTypeEnum; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; @@ -27,9 +26,4 @@ public class TaxAgentQueryParam extends BaseQueryParam { //涓◣鎵g即涔夊姟浜哄悕绉 private String name; - - /** - * 鏁版嵁杩囨护绾у埆 - */ - private AuthFilterTypeEnum filterType; } diff --git a/src/com/engine/salary/service/impl/AddUpSituationServiceImpl.java b/src/com/engine/salary/service/impl/AddUpSituationServiceImpl.java index 3ea83beca..f5fb1e6bf 100644 --- a/src/com/engine/salary/service/impl/AddUpSituationServiceImpl.java +++ b/src/com/engine/salary/service/impl/AddUpSituationServiceImpl.java @@ -1,5 +1,6 @@ package com.engine.salary.service.impl; +import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.util.NumberUtil; import com.api.browser.bean.SearchConditionGroup; import com.api.browser.bean.SearchConditionItem; @@ -22,6 +23,7 @@ import com.engine.salary.entity.datacollection.param.AddUpSituationParam; import com.engine.salary.entity.datacollection.param.AddUpSituationQueryParam; import com.engine.salary.entity.salaryacct.po.SalaryAcctEmployeePO; import com.engine.salary.entity.taxagent.dto.TaxAgentManageRangeEmployeeDTO; +import com.engine.salary.entity.taxagent.param.TaxAgentQueryParam; import com.engine.salary.entity.taxagent.po.TaxAgentPO; import com.engine.salary.enums.OperateTypeEnum; import com.engine.salary.enums.UserStatusEnum; @@ -264,6 +266,7 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation @Override public XSSFWorkbook export(AddUpSituationQueryParam queryParam) { + queryParam.setFilterType(AuthFilterTypeEnum.QUERY_DATA); // 鑾峰彇鎿嶄綔鎸夐挳璧勬簮 List> rowList = getExcelRowList(queryParam, true); @@ -302,10 +305,7 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation //鎺掑簭閰嶇疆 OrderRuleVO orderRule = getSalarySysConfService(user).orderRule(); param.setOrderRule(orderRule); - List list = getAddUpSituationMapper().list(param); - list = getAuthService(user).auth(list, AuthFilterTypeEnum.QUERY_DATA, AddUpSituationDTO.class); - encryptUtil.decryptList(list, AddUpSituationDTO.class); - SalaryI18nUtil.i18nList(list); + List list = listAuth(param); final List> dataRowList = Optional.ofNullable(list) .map(List::stream) @@ -345,6 +345,14 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation return rowList; } + private List listAuth(AddUpSituationQueryParam param) { + List list = getAddUpSituationMapper().list(param); + list = getAuthService(user).auth(list, param.getFilterType(), AddUpSituationDTO.class); + encryptUtil.decryptList(list, AddUpSituationDTO.class); + SalaryI18nUtil.i18nList(list); + return list; + } + /** * 瀵煎嚭璇︽儏 @@ -449,6 +457,7 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation @Override public XSSFWorkbook downloadTemplate(AddUpSituationQueryParam queryParam) { + queryParam.setFilterType(AuthFilterTypeEnum.ADMIN_DATA); String sheetName = SalaryI18nUtil.getI18nLabel(101605, "寰鏈熺疮璁℃儏鍐靛鍏ユā鏉"); // 鑾峰彇鎿嶄綔鎸夐挳璧勬簮 List> rowList = getExcelRowList(queryParam, queryParam.isHasData()); @@ -520,10 +529,8 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation @Override public Map importAddUpSituation(AddUpSituationImportParam importParam) { - Boolean openDevolution = getTaxAgentService(user).isOpenDevolution(); Map apidatas = new HashMap(); - AddUpSituationBiz biz = new AddUpSituationBiz(); //鏌ヨ瀵逛簬浜哄憳淇℃伅瀵煎叆绛涢夌殑鍏ㄥ眬閰嶇疆 SalarySysConfPO salarySysConfPO = getSalarySysConfMapper().getOneByCode("matchEmployeeMode"); @@ -540,7 +547,9 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation Long currentEmployeeId = (long) user.getUID(); // 鑾峰彇鎵鏈変釜绋庢墸缂翠箟鍔′汉 - Collection taxAgentList = getTaxAgentService(user).listTaxAgentAndEmployeeTree(currentEmployeeId); + TaxAgentQueryParam param = TaxAgentQueryParam.builder().build(); + param.setFilterType(AuthFilterTypeEnum.ADMIN_DATA); + List taxAgentList = getTaxAgentService(user).listAuth(param); // 鑾峰彇绉熸埛涓嬫墍鏈夌殑浜哄憳 List employees = getSalaryEmployeeService(user).listEmployee(); // 宸茬粡鏍哥畻杩囩殑涓嶅彲鎿嶄綔 @@ -607,7 +616,7 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation String idNo = dto.getIdNo(); //绛涢夊鍏ヤ汉鍛樹俊鎭彲浠ュ湪浜哄姏璧勬簮姹犱腑鍖归厤鍒扮殑浜哄憳淇℃伅 - List employeeSameIds = getSalaryEmployeeService(user).matchImportEmployee(confValue, employees, userName, deparmentName, mobile, workcode, idNo,null); + List employeeSameIds = getSalaryEmployeeService(user).matchImportEmployee(confValue, employees, userName, deparmentName, mobile, workcode, idNo, null); //褰撲汉鍛樹俊鎭鍏ョ瓫閫夌殑鍏ㄥ眬閰嶇疆涓"0"鏃讹紝濮撳悕鎵嶆槸蹇呭~椤 if (StringUtils.isBlank(userName) && "0".equals(confValue)) { @@ -658,10 +667,9 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation errorData.add(errorMessageMap); errorSum += 1; } else { - Optional optionalTemp = taxAgentList.stream().filter(m -> m.getTaxAgentName().equals(taxAgentName)).findFirst(); + Optional optionalTemp = taxAgentList.stream().filter(m -> m.getName().equals(taxAgentName)).findFirst(); if (optionalTemp.isPresent()) { - po.setTaxAgentId(optionalTemp.get().getTaxAgentId()); - taxAgentEmployees = optionalTemp.get().getEmployeeList(); + po.setTaxAgentId(optionalTemp.get().getId()); } else { //涓◣鎵g即涔夊姟浜轰笉瀛樺湪 Map errorMessageMap = Maps.newHashMap(); @@ -671,17 +679,6 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation } } - // fixme 鍒嗘潈鍒ゆ柇锛岃嫢鍛樺伐绂昏亴鍚庯紝涓嶅湪鎵g即涔夊姟浜鸿寖鍥村唴锛屼細鏈夊紓甯 -// if (openDevolution) { -// Optional optionalTaxAgentEmp = taxAgentEmployees.stream().filter(f -> f.getEmployeeId().equals(po.getEmployeeId())).findFirst(); -// if (!optionalTaxAgentEmp.isPresent()) { -// Map errorMessageMap = Maps.newHashMap(); -// errorMessageMap.put("message", rowIndex + "璇ユ潯鏁版嵁涓嶅湪涓◣鎵g即涔夊姟浜轰汉鍛樿寖鍥村唴锛屼笉鍙鍏"); -// errorData.add(errorMessageMap); -// errorSum += 1; -// } -// } - // 鍒ゆ柇鏄惁鏈夋牳绠楄繃 if (CollectionUtils.isNotEmpty(salaryAcctEmployees) && !Objects.equals(taxYearMonthStr.split("-")[1], "12")) { Optional optionalAcctEmp = salaryAcctEmployees.stream().filter(f -> f.getEmployeeId().equals(po.getEmployeeId()) && f.getTaxAgentId().equals(po.getTaxAgentId())).findFirst(); @@ -932,12 +929,7 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation */ @Override public void createAddUpSituation(AddUpSituationParam addUpSituationParam) { - Boolean openDevolution = getTaxAgentService(user).isOpenDevolution(); - AddUpSituationBiz biz = new AddUpSituationBiz(); - //鏌ヨ瀵逛簬浜哄憳淇℃伅瀵煎叆绛涢夌殑鍏ㄥ眬閰嶇疆 - //SalarySysConfPO salarySysConfPO = getSalarySysConfMapper().getOneByCode("matchEmployeeMode"); - //String confValue = (salarySysConfPO != null && salarySysConfPO.getConfValue() != null && !"".equals(salarySysConfPO.getConfValue())) ? salarySysConfPO.getConfValue() : "0"; Long currentEmployeeId = (long) user.getUID(); //绋庢鎵灞炴湡 String taxYearMonthStr = Util.null2String(addUpSituationParam.getTaxYearMonth()); @@ -989,16 +981,6 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation } } - // fixme 鍒嗘潈鍒ゆ柇锛岃嫢鍛樺伐绂昏亴鍚庯紝涓嶅湪鎵g即涔夊姟浜鸿寖鍥村唴锛屼細鏈夊紓甯 -// if (openDevolution) { -// Optional optionalTaxAgentEmp = taxAgentEmployees.stream().filter(f -> f.getEmployeeId().equals(po.getEmployeeId())).findFirst(); -// if (!optionalTaxAgentEmp.isPresent()) { -// Map errorMessageMap = Maps.newHashMap(); -// errorMessageMap.put("message", rowIndex + "璇ユ潯鏁版嵁涓嶅湪涓◣鎵g即涔夊姟浜轰汉鍛樿寖鍥村唴锛屼笉鍙鍏"); -// errorData.add(errorMessageMap); -// errorSum += 1; -// } -// } // 鍒ゆ柇鏄惁鏈夋牳绠楄繃 if (CollectionUtils.isNotEmpty(salaryAcctEmployees)) { @@ -1063,9 +1045,6 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation @Override public void deleteSelectAddUpSituation(AddUpSituationDeleteParam deleteParam) { - long currentEmployeeId = user.getUID(); - // 鑾峰彇鎵鏈変釜绋庢墸缂翠箟鍔′汉 - Collection taxAgentList = getTaxAgentService(user).listTaxAgentAndEmployeeTree(currentEmployeeId); AddUpSituationBiz biz = new AddUpSituationBiz(); String declareMonthStr = deleteParam.getTaxYearMonth(); List deleteIds = deleteParam.getIds(); @@ -1078,17 +1057,24 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation // 鍒ゆ柇鏄惁鏈夋牳绠楄繃 List deletePOList = new ArrayList<>(); List deleteList = new ArrayList<>(); + + AddUpSituationQueryParam param = AddUpSituationQueryParam.builder().ids(deleteIds).build(); + param.setFilterType(AuthFilterTypeEnum.ADMIN_DATA); + List addUpSituationDTOS = listAuth(param); + if (CollectionUtil.isEmpty(addUpSituationDTOS)) { + throw new SalaryRunTimeException("鏃犳潈闄愬垹闄ゆ暟鎹紒"); + } + + deleteIds = SalaryEntityUtil.properties(addUpSituationDTOS, AddUpSituationDTO::getId, Collectors.toList()); + + for (int i = 0; i < deleteIds.size(); i++) { Long id = deleteIds.get(i); AddUpSituation byId = biz.getById(id); if (byId == null) { throw new SalaryRunTimeException("鏁版嵁涓嶅瓨鍦ㄦ垨宸茶鍒犻櫎锛"); } - // 鍒ゆ柇鏄惁鍦ㄤ釜绋庢墸缂翠箟鍔′汉鑼冨洿鍐 - Optional first = taxAgentList.stream().filter(m -> Objects.equals(m.getTaxAgentId(), byId.getTaxAgentId())).findFirst(); - if (!first.isPresent()) { - throw new SalaryRunTimeException("涓◣鎵g即涔夊姟浜轰笉瀛樺湪鎴栦笉鍦ㄦ潈闄愯寖鍥村唴"); - } + // 鍒ゆ柇鐢ㄦ埛鏄惁瀛樺湪 if (CollectionUtils.isNotEmpty(salaryAcctEmployees)) { Optional optionalAcctEmp = salaryAcctEmployees.stream().filter(f -> f.getEmployeeId().equals(byId.getEmployeeId()) && f.getTaxAgentId().equals(byId.getTaxAgentId())).findFirst(); @@ -1119,11 +1105,7 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation @Override public void deleteAllAddUpSituation(AddUpSituationDeleteParam deleteParam) { String declareMonthStr = deleteParam.getTaxYearMonth(); - 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()); AddUpSituationBiz biz = new AddUpSituationBiz(); Date declareMonthDate = new Date(); try { @@ -1131,24 +1113,20 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation } catch (Exception e) { throw new SalaryRunTimeException("鏃ユ湡寮傚父"); } - AddUpSituation queryParam = null; + AddUpSituation queryParam = AddUpSituation.builder().taxYearMonth(declareMonthDate).build(); if (deleteParam.getTaxAgentId() != null && !deleteParam.getTaxAgentId().isEmpty()) { // 璁剧疆浜嗕釜绋庢墸缂翠箟鍔′汉 Long taxAgentId = SalaryEntityUtil.string2Long(deleteParam.getTaxAgentId()); - boolean canDelete = taxAgentIds.stream().anyMatch(t -> Objects.equals(t, taxAgentId)); - if (!canDelete) { - throw new SalaryRunTimeException("涓◣鎵g即涔夊姟浜轰笉瀛樺湪鎴栦笉鍦ㄦ潈闄愯寖鍥村唴!"); - } ArrayList tai = new ArrayList<>(); tai.add(taxAgentId); - queryParam = AddUpSituation.builder().taxYearMonth(declareMonthDate).taxAgentIds(tai).build(); - } else { - queryParam = AddUpSituation.builder().taxYearMonth(declareMonthDate).taxAgentIds(taxAgentIds).build(); + queryParam.setTaxAgentIds(tai); } // 鑾峰彇鎵鏈夋兂瑕佸垹闄ょ殑鏁版嵁 List list = biz.listSome(queryParam); + list = getAuthService(user).auth(list, AuthFilterTypeEnum.ADMIN_DATA, AddUpSituation.class); + LocalDate salaryMonthDate = LocalDate.parse(declareMonthStr + "-01", SalaryDateUtil.DATE_FORMATTER); String format = salaryMonthDate.plusMonths(1).atStartOfDay().format(DateTimeFormatter.ofPattern("yyyy-MM")); // 鑾峰彇宸茬粡鏍哥畻鐨勬暟鎹 @@ -1165,10 +1143,7 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation biz.batchDeleteByIDS(deleteIds); // 璁板綍鏃ュ織 - Collection finalTaxAgentIds = queryParam.getTaxAgentIds(); - List taxAgentNames = taxAgentList.stream().filter(t -> finalTaxAgentIds.contains(t.getTaxAgentId())) - .map(TaxAgentManageRangeEmployeeDTO::getTaxAgentName).collect(Collectors.toList()); - String name = declareMonthStr + " " + StringUtils.join(taxAgentNames, ","); + String name = declareMonthStr +"-"+ deleteParam.getTaxAgentId(); LoggerContext loggerContext = new LoggerContext<>(); loggerContext.setTargetName(name); loggerContext.setOperateType(OperateTypeEnum.CLEAR.getValue()); diff --git a/src/com/engine/salary/service/impl/AttendQuoteServiceImpl.java b/src/com/engine/salary/service/impl/AttendQuoteServiceImpl.java index b61987dde..5a0e2f28a 100644 --- a/src/com/engine/salary/service/impl/AttendQuoteServiceImpl.java +++ b/src/com/engine/salary/service/impl/AttendQuoteServiceImpl.java @@ -10,7 +10,7 @@ import com.engine.salary.entity.datacollection.dto.AttendQuoteListDTO; import com.engine.salary.entity.datacollection.param.AttendQuoteQueryParam; import com.engine.salary.entity.datacollection.po.AttendQuotePO; import com.engine.salary.entity.salaryacct.po.SalaryAcctRecordPO; -import com.engine.salary.entity.salarysob.po.SalarySobPO; +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.AttendQuoteMapper; @@ -18,20 +18,22 @@ import com.engine.salary.service.AttendQuoteService; import com.engine.salary.service.SalaryAcctRecordService; import com.engine.salary.service.SalarySobService; import com.engine.salary.service.TaxAgentService; +import com.engine.salary.service.auth.AuthService; +import com.engine.salary.service.auth.AuthServiceImpl; import com.engine.salary.util.SalaryDateUtil; -import com.engine.salary.util.SalaryEntityUtil; import com.engine.salary.util.SalaryI18nUtil; import com.engine.salary.util.SalaryLoggerUtil; import com.engine.salary.util.db.MapperProxyFactory; import com.engine.salary.util.page.PageInfo; import com.engine.salary.util.page.SalaryPageUtil; import org.apache.commons.collections4.CollectionUtils; -import org.apache.commons.lang3.math.NumberUtils; import weaver.hrm.User; import java.time.LocalDate; import java.time.YearMonth; -import java.util.*; +import java.util.Collection; +import java.util.List; +import java.util.Optional; import java.util.concurrent.atomic.AtomicReference; import java.util.stream.Collectors; @@ -56,42 +58,21 @@ public class AttendQuoteServiceImpl extends Service implements AttendQuoteServic private TaxAgentService getTaxAgentService(User user) { return ServiceUtil.getService(TaxAgentServiceImpl.class, user); } + public AuthService getAuthService(User user) { + return ServiceUtil.getService(AuthServiceImpl.class, user); + } @Override public PageInfo listPage(AttendQuoteQueryParam queryParam) { List declareMonth = queryParam.getSalaryYearMonth(); -// SalaryAcctRecordPO queryRecordParam = new SalaryAcctRecordPO(); if (CollectionUtils.isNotEmpty(declareMonth)) { queryParam.setSalaryYearMonth(declareMonth.stream().map(e -> e + "-01 00:00:00").collect(Collectors.toList())); queryParam.setSalaryYearMonthDate(declareMonth.stream().map(e -> e + "-01 00:00:00").map(SalaryDateUtil::dateStrToLocalTime).collect(Collectors.toList())); -// LocalDateRange salaryMonth = LocalDateRange.builder().fromDate(SalaryDateUtil.dateStrToLocalDate(declareMonth.get(0)+"-01 00:00:00")) -// .endDate(SalaryDateUtil.dateStrToLocalTime(declareMonth.get(1)+"-01 00:00:00")).build(); -// queryRecordParam.setSalaryMonths(salaryMonth); } - - long currentEmployeeId = user.getUID(); - Boolean needAuth = getTaxAgentService(user).isNeedAuth(currentEmployeeId); - if (needAuth) { - List salarySobPOS = getSalarySobService(user).listByDisable(NumberUtils.INTEGER_ZERO); - Set salarySobIds = SalaryEntityUtil.properties(salarySobPOS, SalarySobPO::getId); - if (CollectionUtils.isEmpty(salarySobIds)) { - return new PageInfo<>(AttendQuoteListDTO.class); - } - queryParam.setSalarySobIds(salarySobIds); -// queryRecordParam.setSalarySobIds(salarySobIds); - } - - // 鑾峰彇宸茬粡褰掓。鐨勮褰 -// List salaryAcctRecordPOS = getSalaryAcctRecordService(user).listSome(queryRecordParam); -// List archivedRecords = salaryAcctRecordPOS.stream().filter(PO -> PO.getStatus() > SalaryAcctRecordStatusEnum.NOT_ARCHIVED.getValue()) -// .map(PO -> SalaryDateUtil.getFormatYearMonth(PO.getSalaryMonth()) + PO.getSalarySobId()) -// .collect(Collectors.toList()); - - List list = getAttendQuoteMapper().list(queryParam); -// list.stream().forEach(DTO -> DTO.setCanDelete( !archivedRecords.contains( (SalaryDateUtil.getFormatYearMonth(DTO.getSalaryYearMonth()) + DTO.getSalarySobId().toString()) ) )); + list = getAuthService(user).auth(list, AuthFilterTypeEnum.DATA_OPT, AttendQuoteListDTO.class); return SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), list, AttendQuoteListDTO.class); @@ -103,8 +84,9 @@ public class AttendQuoteServiceImpl extends Service implements AttendQuoteServic throw new SalaryRunTimeException("鍙傛暟閿欒"); } List attendQuotes = biz.list(AttendQuoteQueryParam.builder().ids(ids).build()); + attendQuotes = getAuthService(user).auth(attendQuotes, AuthFilterTypeEnum.ADMIN_DATA, AttendQuoteListDTO.class); if (CollectionUtils.isEmpty(attendQuotes)) { - throw new SalaryRunTimeException("瑕佸垹闄ょ殑鏁版嵁涓嶅瓨鍦ㄦ垨宸插垹闄"); + throw new SalaryRunTimeException("鏃犳潈闄愬垹闄ゆ暟鎹紒"); } List accountingAttendQuotes = attendQuotes.stream().filter(e -> e.getSalaryAccountingStatus().equals(1)).collect(Collectors.toList());