From 7e09b283da17a2e5fcbd342722a9aa71363ce8ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=92=B1=E6=B6=9B?= <15850646081@163.com> Date: Mon, 30 May 2022 13:33:22 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9A=82=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../salary/wrapper/OtherDeductionWrapper.java | 428 +++++++++--------- 1 file changed, 214 insertions(+), 214 deletions(-) diff --git a/src/com/engine/salary/wrapper/OtherDeductionWrapper.java b/src/com/engine/salary/wrapper/OtherDeductionWrapper.java index 18e569947..66d0d9696 100644 --- a/src/com/engine/salary/wrapper/OtherDeductionWrapper.java +++ b/src/com/engine/salary/wrapper/OtherDeductionWrapper.java @@ -1,214 +1,214 @@ -package com.engine.salary.wrapper; - -import com.engine.salary.service.OtherDeductionService; -import com.engine.salary.service.SalaryEmployeeService; -import com.weaver.common.authority.format.FormatManager; -import com.weaver.common.component.search.WeaSearchCondition; -import com.weaver.common.component.table.WeaTable; -import com.weaver.common.component.table.page.Page; -import com.weaver.datasecurity.interceptor.DSTenantKeyThreadVar; -import com.weaver.framework.rpc.context.impl.TenantRpcContext; -import com.weaver.hrm.salary.common.excel.ExcelImportParam; -import com.weaver.hrm.salary.entity.datacollection.bo.DataCollectionBO; -import com.weaver.hrm.salary.entity.datacollection.dto.OtherDeductionListDTO; -import com.weaver.hrm.salary.entity.datacollection.dto.OtherDeductionRecordDTO; -import com.weaver.hrm.salary.entity.datacollection.dto.OtherDeductionSearchConditionDTO; -import com.weaver.hrm.salary.entity.datacollection.param.OtherDeductionQueryParam; -import com.weaver.hrm.salary.entity.datacollection.po.OtherDeductionPO; -import com.weaver.hrm.salary.exception.SalaryRunTimeException; -import com.weaver.hrm.salary.service.TaxAgentService; -import com.weaver.hrm.salary.util.SalaryFormatUtil; -import com.weaver.hrm.salary.util.SalaryI18nUtil; -import com.weaver.teams.domain.hr.SimpleUserInfo; -import com.weaver.teams.security.context.TenantContext; -import com.weaver.teams.security.context.UserContext; -import org.apache.commons.collections4.CollectionUtils; -import org.springframework.stereotype.Component; - -import java.time.LocalDate; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - -/** - * @Description: 其他免税扣除 - * @Author: wangxiangzhong - * @Date: 2022/3/14 16:09 - */ -@Component -public class OtherDeductionWrapper { - private OtherDeductionService otherDeductionService; - private TaxAgentService taxAgentService; - private SalaryEmployeeService salaryEmployeeService; - - /** - * 数据采集-其他免税扣除列表的高级搜索 - * - * @param currentEmployeeId - * @param currentTenantKey - * @return - */ - public WeaSearchCondition getSearchCondition(Long currentEmployeeId, String currentTenantKey) { - WeaSearchCondition weaSearchCondition = SalaryFormatUtil.getInstance() - .buildCondition(OtherDeductionSearchConditionDTO.class, new OtherDeductionSearchConditionDTO()); - // 入职日期-添加范围 - DataCollectionBO.addDatePickerRangeOtherParams(weaSearchCondition, "hiredate", currentEmployeeId, currentTenantKey); - // 只保留常用条件 - weaSearchCondition.setGroups(weaSearchCondition.getGroups().stream().filter(e-> "commonGroup".equals(e.getId())).collect(Collectors.toList())); - - return weaSearchCondition; - } - - /** - * 数据采集-其他免税扣除列表(分页) - * - * @param queryParam - * @param currentEmployeeId - * @param currentTenantKey - * @return - */ - public WeaTable list(OtherDeductionQueryParam queryParam, Long currentEmployeeId, String currentTenantKey) { - queryParam.setDeclareMonthDate(CollectionUtils.emptyIfNull(queryParam.getDeclareMonth()).stream().map(e-> LocalDate.of(e.getYear(),e.getMonthValue(),1)).collect(Collectors.toList())); - - Page page = new Page<>(queryParam.getCurrent(), queryParam.getPageSize(), true); - page = otherDeductionService.listPage(page, queryParam, currentEmployeeId, currentTenantKey); - - List list = page.getRecords(); - - List simpleUserInfos = salaryEmployeeService.listByEmployeeIds(list.stream().map(OtherDeductionListDTO::getEmployeeId).collect(Collectors.toList()), currentTenantKey); - // 人员信息赋值 - list.forEach(m->{ - // 身份证号 - m.setIdNo(DataCollectionBO.getIdNo(m.getEmployeeId(), simpleUserInfos)); - }); - WeaTable weaTable = FormatManager.getInstance().genTable(OtherDeductionListDTO.class, page); - - // 在外展示操作按钮 - weaTable.getOperates().get(0).setOuter(Boolean.TRUE); - weaTable.setModule("hrmsalary"); - - return weaTable; - } - - /** - * 数据采集-其他免税扣除详情列表(分页) - * - * @param queryParam - * @param currentEmployeeId - * @param currentTenantKey - * @return - */ - public WeaTable getDetailList(OtherDeductionQueryParam queryParam, Long currentEmployeeId, String currentTenantKey) { - Long id = queryParam.getOtherTaxExemptDeductionId(); - - OtherDeductionPO po = otherDeductionService.getById(id, currentTenantKey); - if (po == null) { - throw new SalaryRunTimeException(String.format(SalaryI18nUtil.getI18nLabel(currentTenantKey, currentEmployeeId, 100415, "其他免税扣除不存在")+"[id:%s]", id)); - } - queryParam.setDeclareMonthDate(CollectionUtils.emptyIfNull(queryParam.getDeclareMonth()).stream().map(e-> LocalDate.of(e.getYear(),e.getMonthValue(),1)).collect(Collectors.toList())); - queryParam.setEmployeeId(po.getEmployeeId()); - Page page = new Page<>(queryParam.getCurrent(), queryParam.getPageSize(), true); - - page = otherDeductionService.recordListPage(page, queryParam, currentEmployeeId, currentTenantKey); - // 记录表格 - WeaTable weaTable = FormatManager.getInstance() - .genTable(OtherDeductionRecordDTO.class, page); - weaTable.setModule("hrmsalary"); - return weaTable; - } - - /** - * 导出-其他免税扣除列表 - * - * @param queryParam - * @param currentEmployeeId - * @param currentTenantKey - * @return - */ - public Map export(OtherDeductionQueryParam queryParam, Long currentEmployeeId, String currentTenantKey) { - // 构建异步导出参数 - Map map = salaryBatchService.buildeExportParam("exportOtherDeduction"); - - String username = UserContext.getCurrentUser().getUsername(); - String eteamsId = TenantRpcContext.getEteamsId(); - boolean isChief = taxAgentService.isChief(currentEmployeeId, currentTenantKey); - taskExecutor.execute(() -> { - try { - DSTenantKeyThreadVar.tenantKey.set(currentTenantKey); - otherDeductionService.export(map, username, eteamsId, isChief, queryParam, currentEmployeeId, currentTenantKey); - } finally { - DSTenantKeyThreadVar.tenantKey.remove(); - } - }); - return map; - } - - /** - * 导出-其他免税扣除详情列表 - * - * @param queryParam - * @param currentEmployeeId - * @param currentTenantKey - * @return - */ - public Map exportDetail(OtherDeductionQueryParam queryParam, Long currentEmployeeId, String currentTenantKey) { - Long id = queryParam.getOtherTaxExemptDeductionId(); - OtherDeductionPO po = otherDeductionService.getById(id, currentTenantKey); - if (po == null) { - throw new SalaryRunTimeException(String.format(SalaryI18nUtil.getI18nLabel(currentTenantKey, currentEmployeeId, 100415, "其他免税扣除不存在")+"[id:%s]", id)); - } - boolean isChief = taxAgentService.isChief(currentEmployeeId, currentTenantKey); - // 构建异步导出参数 - Map map = salaryBatchService.buildeExportParam("exportOtherDeductionDetail"); - - String username = UserContext.getCurrentUser().getUsername(); - String eteamsId = TenantRpcContext.getEteamsId(); - taskExecutor.execute(() -> { - try { - DSTenantKeyThreadVar.tenantKey.set(currentTenantKey); - otherDeductionService.exportDetail(map, username, eteamsId, po.getEmployeeId(), isChief, queryParam, currentEmployeeId, currentTenantKey); - } finally { - DSTenantKeyThreadVar.tenantKey.remove(); - } - }); - return map; - } - - /** - * 下载导入模板 - * - * @param queryParam - * @param currentEmployeeId - * @param currentTenantKey - * @return - */ - public Map downloadTemplate(OtherDeductionQueryParam queryParam, Long currentEmployeeId, String currentTenantKey) { - // 构建异步导出参数 - Map map = salaryBatchService.buildeExportParam("exportOtherDeduction"); - boolean isChief = taxAgentService.isChief(currentEmployeeId, currentTenantKey); - String username = UserContext.getCurrentUser().getUsername(); - String eteamsId = TenantRpcContext.getEteamsId(); - taskExecutor.execute(() -> { - try { - DSTenantKeyThreadVar.tenantKey.set(currentTenantKey); - otherDeductionService.export(map, username, eteamsId, isChief, queryParam, currentEmployeeId, currentTenantKey); - } finally { - DSTenantKeyThreadVar.tenantKey.remove(); - } - }); - return map; - } - - /** - * 获取导入参数 - * - * @return - */ - public ExcelImportParam getImportParams() { - return salaryBatchService.buildImportParam("importOtherDeduction", - "importOtherDeduction", - SalaryI18nUtil.getI18nLabel(TenantContext.getCurrentTenantKey(), UserContext.getCurrentEmployeeId(), 93849, "其他免税扣除"), - null, - null); - } -} +//package com.engine.salary.wrapper; +// +//import com.engine.salary.service.OtherDeductionService; +//import com.engine.salary.service.SalaryEmployeeService; +//import com.weaver.common.authority.format.FormatManager; +//import com.weaver.common.component.search.WeaSearchCondition; +//import com.weaver.common.component.table.WeaTable; +//import com.weaver.common.component.table.page.Page; +//import com.weaver.datasecurity.interceptor.DSTenantKeyThreadVar; +//import com.weaver.framework.rpc.context.impl.TenantRpcContext; +//import com.weaver.hrm.salary.common.excel.ExcelImportParam; +//import com.weaver.hrm.salary.entity.datacollection.bo.DataCollectionBO; +//import com.weaver.hrm.salary.entity.datacollection.dto.OtherDeductionListDTO; +//import com.weaver.hrm.salary.entity.datacollection.dto.OtherDeductionRecordDTO; +//import com.weaver.hrm.salary.entity.datacollection.dto.OtherDeductionSearchConditionDTO; +//import com.weaver.hrm.salary.entity.datacollection.param.OtherDeductionQueryParam; +//import com.weaver.hrm.salary.entity.datacollection.po.OtherDeductionPO; +//import com.weaver.hrm.salary.exception.SalaryRunTimeException; +//import com.weaver.hrm.salary.service.TaxAgentService; +//import com.weaver.hrm.salary.util.SalaryFormatUtil; +//import com.weaver.hrm.salary.util.SalaryI18nUtil; +//import com.weaver.teams.domain.hr.SimpleUserInfo; +//import com.weaver.teams.security.context.TenantContext; +//import com.weaver.teams.security.context.UserContext; +//import org.apache.commons.collections4.CollectionUtils; +//import org.springframework.stereotype.Component; +// +//import java.time.LocalDate; +//import java.util.List; +//import java.util.Map; +//import java.util.stream.Collectors; +// +///** +// * @Description: 其他免税扣除 +// * @Author: wangxiangzhong +// * @Date: 2022/3/14 16:09 +// */ +//@Component +//public class OtherDeductionWrapper { +// private OtherDeductionService otherDeductionService; +// private TaxAgentService taxAgentService; +// private SalaryEmployeeService salaryEmployeeService; +// +// /** +// * 数据采集-其他免税扣除列表的高级搜索 +// * +// * @param currentEmployeeId +// * @param currentTenantKey +// * @return +// */ +// public WeaSearchCondition getSearchCondition(Long currentEmployeeId, String currentTenantKey) { +// WeaSearchCondition weaSearchCondition = SalaryFormatUtil.getInstance() +// .buildCondition(OtherDeductionSearchConditionDTO.class, new OtherDeductionSearchConditionDTO()); +// // 入职日期-添加范围 +// DataCollectionBO.addDatePickerRangeOtherParams(weaSearchCondition, "hiredate", currentEmployeeId, currentTenantKey); +// // 只保留常用条件 +// weaSearchCondition.setGroups(weaSearchCondition.getGroups().stream().filter(e-> "commonGroup".equals(e.getId())).collect(Collectors.toList())); +// +// return weaSearchCondition; +// } +// +// /** +// * 数据采集-其他免税扣除列表(分页) +// * +// * @param queryParam +// * @param currentEmployeeId +// * @param currentTenantKey +// * @return +// */ +// public WeaTable list(OtherDeductionQueryParam queryParam, Long currentEmployeeId, String currentTenantKey) { +// queryParam.setDeclareMonthDate(CollectionUtils.emptyIfNull(queryParam.getDeclareMonth()).stream().map(e-> LocalDate.of(e.getYear(),e.getMonthValue(),1)).collect(Collectors.toList())); +// +// Page page = new Page<>(queryParam.getCurrent(), queryParam.getPageSize(), true); +// page = otherDeductionService.listPage(page, queryParam, currentEmployeeId, currentTenantKey); +// +// List list = page.getRecords(); +// +// List simpleUserInfos = salaryEmployeeService.listByEmployeeIds(list.stream().map(OtherDeductionListDTO::getEmployeeId).collect(Collectors.toList()), currentTenantKey); +// // 人员信息赋值 +// list.forEach(m->{ +// // 身份证号 +// m.setIdNo(DataCollectionBO.getIdNo(m.getEmployeeId(), simpleUserInfos)); +// }); +// WeaTable weaTable = FormatManager.getInstance().genTable(OtherDeductionListDTO.class, page); +// +// // 在外展示操作按钮 +// weaTable.getOperates().get(0).setOuter(Boolean.TRUE); +// weaTable.setModule("hrmsalary"); +// +// return weaTable; +// } +// +// /** +// * 数据采集-其他免税扣除详情列表(分页) +// * +// * @param queryParam +// * @param currentEmployeeId +// * @param currentTenantKey +// * @return +// */ +// public WeaTable getDetailList(OtherDeductionQueryParam queryParam, Long currentEmployeeId, String currentTenantKey) { +// Long id = queryParam.getOtherTaxExemptDeductionId(); +// +// OtherDeductionPO po = otherDeductionService.getById(id, currentTenantKey); +// if (po == null) { +// throw new SalaryRunTimeException(String.format(SalaryI18nUtil.getI18nLabel(currentTenantKey, currentEmployeeId, 100415, "其他免税扣除不存在")+"[id:%s]", id)); +// } +// queryParam.setDeclareMonthDate(CollectionUtils.emptyIfNull(queryParam.getDeclareMonth()).stream().map(e-> LocalDate.of(e.getYear(),e.getMonthValue(),1)).collect(Collectors.toList())); +// queryParam.setEmployeeId(po.getEmployeeId()); +// Page page = new Page<>(queryParam.getCurrent(), queryParam.getPageSize(), true); +// +// page = otherDeductionService.recordListPage(page, queryParam, currentEmployeeId, currentTenantKey); +// // 记录表格 +// WeaTable weaTable = FormatManager.getInstance() +// .genTable(OtherDeductionRecordDTO.class, page); +// weaTable.setModule("hrmsalary"); +// return weaTable; +// } +// +// /** +// * 导出-其他免税扣除列表 +// * +// * @param queryParam +// * @param currentEmployeeId +// * @param currentTenantKey +// * @return +// */ +// public Map export(OtherDeductionQueryParam queryParam, Long currentEmployeeId, String currentTenantKey) { +// // 构建异步导出参数 +// Map map = salaryBatchService.buildeExportParam("exportOtherDeduction"); +// +// String username = UserContext.getCurrentUser().getUsername(); +// String eteamsId = TenantRpcContext.getEteamsId(); +// boolean isChief = taxAgentService.isChief(currentEmployeeId, currentTenantKey); +// taskExecutor.execute(() -> { +// try { +// DSTenantKeyThreadVar.tenantKey.set(currentTenantKey); +// otherDeductionService.export(map, username, eteamsId, isChief, queryParam, currentEmployeeId, currentTenantKey); +// } finally { +// DSTenantKeyThreadVar.tenantKey.remove(); +// } +// }); +// return map; +// } +// +// /** +// * 导出-其他免税扣除详情列表 +// * +// * @param queryParam +// * @param currentEmployeeId +// * @param currentTenantKey +// * @return +// */ +// public Map exportDetail(OtherDeductionQueryParam queryParam, Long currentEmployeeId, String currentTenantKey) { +// Long id = queryParam.getOtherTaxExemptDeductionId(); +// OtherDeductionPO po = otherDeductionService.getById(id, currentTenantKey); +// if (po == null) { +// throw new SalaryRunTimeException(String.format(SalaryI18nUtil.getI18nLabel(currentTenantKey, currentEmployeeId, 100415, "其他免税扣除不存在")+"[id:%s]", id)); +// } +// boolean isChief = taxAgentService.isChief(currentEmployeeId, currentTenantKey); +// // 构建异步导出参数 +// Map map = salaryBatchService.buildeExportParam("exportOtherDeductionDetail"); +// +// String username = UserContext.getCurrentUser().getUsername(); +// String eteamsId = TenantRpcContext.getEteamsId(); +// taskExecutor.execute(() -> { +// try { +// DSTenantKeyThreadVar.tenantKey.set(currentTenantKey); +// otherDeductionService.exportDetail(map, username, eteamsId, po.getEmployeeId(), isChief, queryParam, currentEmployeeId, currentTenantKey); +// } finally { +// DSTenantKeyThreadVar.tenantKey.remove(); +// } +// }); +// return map; +// } +// +// /** +// * 下载导入模板 +// * +// * @param queryParam +// * @param currentEmployeeId +// * @param currentTenantKey +// * @return +// */ +// public Map downloadTemplate(OtherDeductionQueryParam queryParam, Long currentEmployeeId, String currentTenantKey) { +// // 构建异步导出参数 +// Map map = salaryBatchService.buildeExportParam("exportOtherDeduction"); +// boolean isChief = taxAgentService.isChief(currentEmployeeId, currentTenantKey); +// String username = UserContext.getCurrentUser().getUsername(); +// String eteamsId = TenantRpcContext.getEteamsId(); +// taskExecutor.execute(() -> { +// try { +// DSTenantKeyThreadVar.tenantKey.set(currentTenantKey); +// otherDeductionService.export(map, username, eteamsId, isChief, queryParam, currentEmployeeId, currentTenantKey); +// } finally { +// DSTenantKeyThreadVar.tenantKey.remove(); +// } +// }); +// return map; +// } +// +// /** +// * 获取导入参数 +// * +// * @return +// */ +// public ExcelImportParam getImportParams() { +// return salaryBatchService.buildImportParam("importOtherDeduction", +// "importOtherDeduction", +// SalaryI18nUtil.getI18nLabel(TenantContext.getCurrentTenantKey(), UserContext.getCurrentEmployeeId(), 93849, "其他免税扣除"), +// null, +// null); +// } +//}