diff --git a/resource/sql/分权.sql b/resource/sql/分权.sql index 66283c1d3..15116bb76 100644 --- a/resource/sql/分权.sql +++ b/resource/sql/分权.sql @@ -132,3 +132,5 @@ ALTER TABLE hrsa_tax_agent ADD COLUMN payment_agency varchar(255) NULL COMMENT ' ALTER TABLE hrsa_salary_sob ADD COLUMN tax_agent_id bigint(0) NULL COMMENT '个税扣缴义务人的主键id' AFTER tenant_key; + +INSERT INTO hrsa_tax_agent_base(id, devolution_status, create_time, update_time, creator, delete_type, tenant_key) VALUES (1653303537239, 1, '2022-05-23 18:58:53', '2022-05-23 19:12:12', 1, 0, 'all_teams'); diff --git a/src/com/engine/salary/biz/OtherDeductionBiz.java b/src/com/engine/salary/biz/OtherDeductionBiz.java index 3383200b5..566ea5914 100644 --- a/src/com/engine/salary/biz/OtherDeductionBiz.java +++ b/src/com/engine/salary/biz/OtherDeductionBiz.java @@ -5,16 +5,12 @@ import com.engine.salary.entity.datacollection.dto.OtherDeductionRecordDTO; import com.engine.salary.entity.datacollection.param.OtherDeductionQueryParam; import com.engine.salary.entity.datacollection.po.OtherDeductionPO; import com.engine.salary.mapper.datacollection.OtherDeductionMapper; -import com.engine.salary.util.excel.ExcelUtil; import com.google.common.collect.Lists; import org.apache.commons.collections4.CollectionUtils; import org.apache.ibatis.session.SqlSession; -import org.apache.poi.xssf.usermodel.XSSFWorkbook; import weaver.conn.mybatis.MyBatisFactory; import weaver.general.BaseBean; -import weaver.general.Util; -import java.text.SimpleDateFormat; import java.util.*; import java.util.stream.Collectors; @@ -130,111 +126,9 @@ public class OtherDeductionBiz extends BaseBean { } - /** - * 导出 - * - * @param param - * @return - */ - public XSSFWorkbook export(OtherDeductionQueryParam param) { - - //获取操作按钮资源 - List> rowList = getExcelRowList(param); - - //获取excel - return ExcelUtil.genWorkbook(rowList,"其他免税扣除"); - } - /** - * 获取excel数据行 - * - * @return 导出数据行集合 - */ - private List> getExcelRowList(OtherDeductionQueryParam param) { - //excel标题 - List title = Arrays.asList("姓名", "个税扣缴义务人", "部门", "手机号", "工号", "证件号码", "入职日期", "商业健康保险", "税延养老保险", "其他", "准予扣除的捐赠额"); - SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); - List list = list(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.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(Util.null2String(dto.getBusinessHealthyInsurance())); - cellList.add(Util.null2String(dto.getTaxDelayEndowmentInsurance())); - cellList.add(Util.null2String(dto.getOtherDeduction())); - cellList.add(Util.null2String(dto.getDeductionAllowedDonation())); - return cellList; - }).collect(Collectors.toList())) - .orElse(Collections.emptyList()); - - List> rowList = new ArrayList<>(); - rowList.add(title); - rowList.addAll(dataRowList); - return rowList; - } - - - /** - * 导出详情列表 - * - * @param param - * @return - */ - public XSSFWorkbook exportDetail(OtherDeductionQueryParam param) { - - //获取操作按钮资源 - List> rowList = getExcelRowDetailList(param); - - //获取excel - return ExcelUtil.genWorkbook(rowList,"其他免税扣除明细"); - } - - - /** - * 导出详情 - * - * @param param - * @return - */ - private List> getExcelRowDetailList(OtherDeductionQueryParam param) { - //excel标题 - List title = Arrays.asList("姓名", "申报月份", "个税扣缴义务人", "部门", "手机号", "工号", "商业健康保险", "税延养老保险", "其他", "准予扣除的捐赠额"); - - SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM"); - //查询详细信息 - List list = 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.getMobile())); - cellList.add(Util.null2String(dto.getJobNum())); - cellList.add(Util.null2String(dto.getBusinessHealthyInsurance())); - cellList.add(Util.null2String(dto.getTaxDelayEndowmentInsurance())); - cellList.add(Util.null2String(dto.getOtherDeduction())); - cellList.add(Util.null2String(dto.getDeductionAllowedDonation())); - return cellList; - }).collect(Collectors.toList())) - .orElse(Collections.emptyList()); - - List> rowList = new ArrayList<>(); - rowList.add(title); - rowList.addAll(dataRowList); - return rowList; - } /** * 处理导入数据 diff --git a/src/com/engine/salary/cmd/datacollection/AddUpDeductionImportCmd.java b/src/com/engine/salary/cmd/datacollection/AddUpDeductionImportCmd.java deleted file mode 100644 index 8cd219cc8..000000000 --- a/src/com/engine/salary/cmd/datacollection/AddUpDeductionImportCmd.java +++ /dev/null @@ -1,252 +0,0 @@ -package com.engine.salary.cmd.datacollection; - -import com.engine.common.biz.AbstractCommonCommand; -import com.engine.common.entity.BizLogContext; -import com.engine.core.interceptor.CommandContext; -import com.engine.salary.biz.AddUpDeductionBiz; -import com.engine.salary.biz.EmployBiz; -import com.engine.salary.biz.TaxAgentBiz; -import com.engine.salary.entity.datacollection.AddUpDeduction; -import com.engine.salary.entity.datacollection.DataCollectionEmployee; -import com.engine.salary.entity.datacollection.dto.AddUpDeductionDTO; -import com.engine.salary.entity.datacollection.param.AddUpDeductionImportParam; -import com.engine.salary.entity.taxrate.TaxAgent; -import com.engine.salary.enums.UserStatusEnum; -import com.engine.salary.exception.SalaryRunTimeException; -import com.engine.salary.util.SalaryDateUtil; -import com.engine.salary.util.excel.ExcelParseHelper; -import com.google.common.collect.Maps; -import org.apache.commons.collections4.CollectionUtils; -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.lang3.Validate; -import org.apache.poi.util.IOUtils; -import weaver.file.ImageFileManager; -import weaver.general.Util; -import weaver.hrm.User; - -import javax.servlet.http.HttpServletRequest; -import java.io.InputStream; -import java.text.SimpleDateFormat; -import java.util.*; -import java.util.stream.Collectors; - -import static com.engine.salary.constant.SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY; - -public class AddUpDeductionImportCmd extends AbstractCommonCommand> { - - protected HttpServletRequest request; - - public AddUpDeductionImportCmd(Map params, User user) { - this.user = user; - this.params = params; - - } - - @Override - public BizLogContext getLogContext() { - return null; - } - - @Override - public Map execute(CommandContext commandContext) { - Map apidatas = new HashMap(); - EmployBiz employBiz = new EmployBiz(); - AddUpDeductionBiz addUpDeductionBiz = new AddUpDeductionBiz(); - - //检验参数 - checkImportParam(); - - //导入参数 - AddUpDeductionImportParam importParam = (AddUpDeductionImportParam) params.get("importParam"); - //excel文件id - String imageId = Util.null2String(importParam.getImageId()); - Validate.notBlank(imageId, "imageId为空"); - //税款所属期 - String declareMonthStr = Util.null2String(importParam.getDeclareMonth()); - //个税扣缴义务人 - String taxAgentId = Util.null2String(importParam.getTaxAgentId()); - - InputStream fileInputStream = null; - try { - fileInputStream = ImageFileManager.getInputStreamById(Integer.valueOf(imageId)); - List addUpDeductions = ExcelParseHelper.parse2Map(fileInputStream, AddUpDeductionDTO.class, 0, 1, 14, "addUpDeductionTemplate.xlsx"); - - int total = addUpDeductions.size(); - int index = 0; - int successCount = 0; - int errorCount = 0; - - //人员信息 - List employees = employBiz.listEmployee(); - List taxAgents = new TaxAgentBiz().listAll(); - - //税款所属期 - SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); - Date declareMonth = SalaryDateUtil.stringToDate(declareMonthStr + "-01"); - - - // 错误excel内容 - List errorData = new ArrayList<>(); - //合规数据 - List eligibleData = new ArrayList<>(); - - - for (int i = 0; i < addUpDeductions.size(); i++) { - - AddUpDeductionDTO dto = addUpDeductions.get(i); - - Date now = new Date(); - //待插入数据库对象 - AddUpDeduction addUpDeduction = AddUpDeduction.builder() - .tenantKey(DEFAULT_TENANT_KEY) - .createTime(now) - .updateTime(now) - .creator((long) user.getUID()) - .declareMonth(declareMonth).build(); - - //异常点数量 - int errorSum = 0; - - //行号 - String rowIndex = String.format("第%s行", i + 2); - - //相同的姓名 - String userName = dto.getUsername(); - String deparmentName = dto.getDepartmentName(); - - List employeeSameIds = new ArrayList<>(); - List emps = employees.stream().filter(e -> (StringUtils.isBlank(userName) || Objects.equals(e.getUsername(), userName)) - && (StringUtils.isBlank(deparmentName) || Objects.equals(e.getDepartmentName(), deparmentName))) - .collect(Collectors.toList()); - //含在职和离职,选在职数据 - if (CollectionUtils.isNotEmpty(emps) && emps.size() > 1) { - employeeSameIds = emps.stream() - .filter(e -> UserStatusEnum.getNormalStatus().contains(e.getStatus())) - .map(DataCollectionEmployee::getEmployeeId) - .collect(Collectors.toList()); - } - if (CollectionUtils.isNotEmpty(emps) && emps.size() == 1) { - employeeSameIds = emps.stream() - .map(DataCollectionEmployee::getEmployeeId) - .collect(Collectors.toList()); - } - - - if (StringUtils.isBlank(userName)) { - //姓名 不能为空 - //错误消息对象 - Map errorMessageMap = Maps.newHashMap(); - errorMessageMap.put("message", rowIndex + "姓名不能为空"); - errorData.add(errorMessageMap); - errorSum += 1; - } else if (CollectionUtils.isEmpty(employeeSameIds) || employeeSameIds.size() > 1) { - Map errorMessageMap = Maps.newHashMap(); - errorMessageMap.put("message", rowIndex + "员工信息不能为空且不可重复(姓名与部门同时确认唯一)"); - errorData.add(errorMessageMap); - errorSum += 1; - } else { - Long employeeId = CollectionUtils.isNotEmpty(employeeSameIds) && employeeSameIds.size() == 1 ? employeeSameIds.get(0) : null; - if (employeeId != null && employeeId > 0) { - addUpDeduction.setEmployeeId(employeeId); - } else { - //姓名错误,系统内不存在该姓名 - Map errorMessageMap = Maps.newHashMap(); - errorMessageMap.put("message", rowIndex + "姓名错误,系统内不存在该姓名"); - errorData.add(errorMessageMap); - errorSum += 1; - } - } - - - String taxAgentName = dto.getTaxAgentName(); - if (StringUtils.isBlank(taxAgentName)) { - //个税扣缴义务人不能为空 - Map errorMessageMap = Maps.newHashMap(); - errorMessageMap.put("message", rowIndex + "个税扣缴义务人不能为空"); - errorData.add(errorMessageMap); - errorSum += 1; - } else { - Optional optionalTemp = taxAgents.stream().filter(m -> m.getName().equals(taxAgentName)).findFirst(); - if (optionalTemp.isPresent()) { - if (StringUtils.isNotEmpty(taxAgentId) && !optionalTemp.get().getId().equals(Long.valueOf(taxAgentId))) { - //个税扣缴义务人与导入时选择的不一致 - Map errorMessageMap = Maps.newHashMap(); - errorMessageMap.put("message", rowIndex + "个税扣缴义务人与导入时选择的不一致"); - errorData.add(errorMessageMap); - errorSum += 1; - } else { - addUpDeduction.setTaxAgentId(optionalTemp.get().getId()); - } - } else { - //个税扣缴义务人不存在 - Map errorMessageMap = Maps.newHashMap(); - errorMessageMap.put("message", rowIndex + "个税扣缴义务人不存在"); - errorData.add(errorMessageMap); - errorSum += 1; - } - } - - //累计子女教育 - String addUpChildEducation = dto.getAddUpChildEducation(); - addUpDeduction.setAddUpChildEducation(Util.null2String(addUpChildEducation)); - //累计继续教育 - String addUpContinuingEducation = dto.getAddUpContinuingEducation(); - addUpDeduction.setAddUpContinuingEducation(Util.null2String(addUpContinuingEducation)); - //累计住房贷款利息 - String addUpHousingLoanInterest = dto.getAddUpHousingLoanInterest(); - addUpDeduction.setAddUpHousingLoanInterest(Util.null2String(addUpHousingLoanInterest)); - //累计住房租金 - String addUpHousingRent = dto.getAddUpHousingRent(); - addUpDeduction.setAddUpHousingRent(Util.null2String(addUpHousingRent)); - //累计赡养老人 - String addUpSupportElderly = dto.getAddUpSupportElderly(); - addUpDeduction.setAddUpSupportElderly(Util.null2String(addUpSupportElderly)); - - addUpDeduction.setAddUpIllnessMedical(Util.null2String(dto.getAddUpIllnessMedical())); - addUpDeduction.setAddUpInfantCare(Util.null2String(dto.getAddUpInfantCare())); - - - if (errorSum == 0) { - successCount += 1; - // 合格数据 - eligibleData.add(addUpDeduction); - } else { - errorCount += 1; - // 添加错误数据 - } - } - - //入库 - addUpDeductionBiz.handleImportData(eligibleData); - - apidatas.put("successCount", successCount); - apidatas.put("errorCount", errorCount); - apidatas.put("errorData", errorData); - - } finally { - IOUtils.closeQuietly(fileInputStream); - } - return apidatas; - } - - private void checkImportParam() { - - AddUpDeductionImportParam importParam = (AddUpDeductionImportParam) params.get("importParam"); - - //excel文件id - String imageId = Util.null2String(importParam.getImageId()); - //税款所属期 - String declareMonthStr = Util.null2String(importParam.getDeclareMonth()); - //个税扣缴义务人 - String taxAgentId = Util.null2String(importParam.getTaxAgentId()); - - if (StringUtils.isBlank(imageId)) { - throw new SalaryRunTimeException("文件不存在"); - } - if (StringUtils.isBlank(declareMonthStr)) { - throw new SalaryRunTimeException("税款所属期为空"); - } - } - - -} diff --git a/src/com/engine/salary/cmd/datacollection/OtherDeductionExportCmd.java b/src/com/engine/salary/cmd/datacollection/OtherDeductionExportCmd.java deleted file mode 100644 index 0332bd661..000000000 --- a/src/com/engine/salary/cmd/datacollection/OtherDeductionExportCmd.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.engine.salary.cmd.datacollection; - -import com.engine.common.biz.AbstractCommonCommand; -import com.engine.common.entity.BizLogContext; -import com.engine.core.interceptor.CommandContext; -import com.engine.salary.biz.OtherDeductionBiz; -import com.engine.salary.entity.datacollection.param.OtherDeductionQueryParam; -import org.apache.poi.xssf.usermodel.XSSFWorkbook; -import weaver.hrm.User; - -import java.util.Map; - -public class OtherDeductionExportCmd extends AbstractCommonCommand { - - public OtherDeductionExportCmd(Map params, User user) { - this.user = user; - this.params = params; - } - - @Override - public BizLogContext getLogContext() { - return null; - } - - @Override - public XSSFWorkbook execute(CommandContext commandContext) { - OtherDeductionQueryParam OtherDeductionQueryParam = (OtherDeductionQueryParam) params.get("queryParam"); - - OtherDeductionBiz OtherDeductionBiz = new OtherDeductionBiz(); - XSSFWorkbook workbook = OtherDeductionBiz.export(OtherDeductionQueryParam); - - return workbook; - } -} diff --git a/src/com/engine/salary/cmd/datacollection/OtherDeductionExportDetailCmd.java b/src/com/engine/salary/cmd/datacollection/OtherDeductionExportDetailCmd.java deleted file mode 100644 index b5f79e97a..000000000 --- a/src/com/engine/salary/cmd/datacollection/OtherDeductionExportDetailCmd.java +++ /dev/null @@ -1,67 +0,0 @@ -package com.engine.salary.cmd.datacollection; - -import com.engine.common.biz.AbstractCommonCommand; -import com.engine.common.entity.BizLogContext; -import com.engine.core.interceptor.CommandContext; -import com.engine.salary.biz.EmployBiz; -import com.engine.salary.biz.OtherDeductionBiz; -import com.engine.salary.entity.datacollection.DataCollectionEmployee; -import com.engine.salary.entity.datacollection.param.OtherDeductionQueryParam; -import com.engine.salary.entity.datacollection.po.OtherDeductionPO; -import com.engine.salary.exception.SalaryRunTimeException; -import org.apache.commons.collections4.CollectionUtils; -import org.apache.poi.xssf.usermodel.XSSFWorkbook; -import weaver.hrm.User; - -import java.util.Collections; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - -public class OtherDeductionExportDetailCmd extends AbstractCommonCommand { - - public OtherDeductionExportDetailCmd(Map params, User user) { - this.user = user; - this.params = params; - } - - @Override - public BizLogContext getLogContext() { - return null; - } - - @Override - public XSSFWorkbook execute(CommandContext commandContext) { - OtherDeductionQueryParam queryParam = (OtherDeductionQueryParam) params.get("queryParam"); - OtherDeductionBiz biz = new OtherDeductionBiz(); - EmployBiz employBiz = new EmployBiz(); - - Long id = queryParam.getOtherTaxExemptDeductionId(); - if (id == null) { - throw new SalaryRunTimeException("id不能为空"); - } - - OtherDeductionPO po = biz.getById(id); - if (po == null) { - throw new SalaryRunTimeException(String.format("其他免税扣除不存在"+"[id:%s]", id)); - } - - List employeeList = employBiz.getEmployeeByIds(Collections.singletonList(po.getEmployeeId())); - if (CollectionUtils.isEmpty(employeeList)) { - throw new SalaryRunTimeException("员工信息不存在"); - } - - //构建参数 - queryParam.setEmployeeId(po.getEmployeeId()); - //申报月份 - List declareMonth = queryParam.getDeclareMonth(); - if (CollectionUtils.isNotEmpty(declareMonth)) { - queryParam.setDeclareMonth(declareMonth.stream().map(e -> e + "-01 00:00:00").collect(Collectors.toList())); - } - - - XSSFWorkbook workbook = biz.exportDetail(queryParam); - - return workbook; - } -} diff --git a/src/com/engine/salary/cmd/datacollection/OtherDeductionGetDetailListCmd.java b/src/com/engine/salary/cmd/datacollection/OtherDeductionGetDetailListCmd.java deleted file mode 100644 index 3aea3f2fd..000000000 --- a/src/com/engine/salary/cmd/datacollection/OtherDeductionGetDetailListCmd.java +++ /dev/null @@ -1,168 +0,0 @@ -package com.engine.salary.cmd.datacollection; - -import com.cloudstore.eccom.result.WeaResultMsg; -import com.engine.common.biz.AbstractCommonCommand; -import com.engine.common.entity.BizLogContext; -import com.engine.core.interceptor.CommandContext; -import com.engine.salary.biz.EmployBiz; -import com.engine.salary.biz.OtherDeductionBiz; -import com.engine.salary.component.SalaryWeaTable; -import com.engine.salary.entity.datacollection.DataCollectionEmployee; -import com.engine.salary.entity.datacollection.dto.OtherDeductionRecordDTO; -import com.engine.salary.entity.datacollection.param.OtherDeductionQueryParam; -import com.engine.salary.entity.datacollection.po.OtherDeductionPO; -import com.engine.salary.exception.SalaryRunTimeException; -import org.apache.commons.collections4.CollectionUtils; -import org.apache.commons.lang3.StringUtils; -import weaver.hrm.User; - -import java.util.*; -import java.util.stream.Collectors; - -public class OtherDeductionGetDetailListCmd extends AbstractCommonCommand> { - - public OtherDeductionGetDetailListCmd(Map params, User user) { - this.user = user; - this.params = params; - } - - @Override - public BizLogContext getLogContext() { - return null; - } - - @Override - public Map execute(CommandContext commandContext) { - - EmployBiz employBiz = new EmployBiz(); - OtherDeductionBiz biz = new OtherDeductionBiz(); - - OtherDeductionQueryParam queryParam = (OtherDeductionQueryParam) params.get("queryParam"); - if (queryParam == null) { - throw new SalaryRunTimeException("参数异常"); - } - - Long id = queryParam.getOtherTaxExemptDeductionId(); - if (id == null) { - throw new SalaryRunTimeException("其他免税扣除id不能为空"); - } - - OtherDeductionPO po = biz.getById(id); - if (po == null) { - throw new SalaryRunTimeException(String.format("其他免税扣除不存在[id:%s]", id)); - } - - List employeeList = employBiz.getEmployeeByIds(Collections.singletonList(po.getEmployeeId())); - if (CollectionUtils.isEmpty(employeeList)) { - throw new SalaryRunTimeException("员工信息不存在"); - } - - //构建参数 - queryParam.setEmployeeId(po.getEmployeeId()); - //申报月份 - List declareMonth = queryParam.getDeclareMonth(); - if (CollectionUtils.isNotEmpty(declareMonth)) { - queryParam.setDeclareMonth(declareMonth.stream().map(e -> e + "-01 00:00:00").collect(Collectors.toList())); - } - - String fields = " t1.id," + - " t1.declare_month as declareMonth," + - " t1.employee_id as employeeId," + - " t2.name AS taxAgentName," + - " e.lastname as username," + - " d.departmentname AS departmentName," + - " e.mobile," + - " e.workcode as jobNum," + - " e.companystartdate as hiredate," + - " t1.business_healthy_insurance as businessHealthyInsurance," + - " t1.tax_delay_endowment_insurance as taxDelayEndowmentInsurance," + - " t1.other_deduction as otherDeduction," + - " t1.deduction_allowed_donation as deductionAllowedDonation"; - - String fromSql = " FROM" + - " hrsa_other_deduction t1" + - " LEFT JOIN hrsa_tax_agent t2 ON t1.tax_agent_id = t2.id" + - " LEFT JOIN hrmresource e ON e.id = t1.employee_id" + - " LEFT JOIN hrmdepartment d ON d.id = e.departmentid"; - - SalaryWeaTable table = new SalaryWeaTable(user, OtherDeductionRecordDTO.class); - table.setBackfields(fields); - table.setSqlform(fromSql); - table.setSqlwhere(makeSqlWhere(queryParam)); - table.setSqlorderby("t1.declare_month DESC"); - table.setSqlprimarykey("t1.id"); - table.setSqlisdistinct("false"); - - - WeaResultMsg result = new WeaResultMsg(false); - result.putAll(table.makeDataResult()); - result.success(); - return result.getResultMap(); - } - - - private String makeSqlWhere(OtherDeductionQueryParam queryParam) { - - String sqlWhere = "t1.delete_type = 0 AND t2.delete_type = 0"; - Collection ids = queryParam.getIds(); - if (CollectionUtils.isNotEmpty(ids)) { - String idsStr = ids.stream().map(String::valueOf).collect(Collectors.joining(",")); - sqlWhere += " AND t1.id IN (" + idsStr + ")"; - } - Long employeeId = queryParam.getEmployeeId(); - if (employeeId != null) { - sqlWhere += " AND t1.employee_id =" + employeeId; - } - String keyword = queryParam.getKeyword(); - if (StringUtils.isNotBlank(keyword)) { - sqlWhere += " AND (" + - " e.lastname like '%" + keyword + "%'" + - " OR d.departmentname like '%" + keyword + "%'" + - " OR e.workcode like ''%" + keyword + "%'" + - " )"; - } - // 申报月份 - List declareMonths = queryParam.getDeclareMonth(); - if (CollectionUtils.isNotEmpty(declareMonths)) { - if (declareMonths.size() == 1) { - sqlWhere += " AND t1.declare_month = '" + declareMonths.get(0) + ","; - } - if (declareMonths.size() == 2) { - sqlWhere += " AND (t1.declare_month BETWEEN '" + declareMonths.get(0) + "' AND '" + declareMonths.get(1) + "')"; - } - } - //姓名 - String username = queryParam.getUsername(); - if (StringUtils.isNotBlank(username)) { - sqlWhere += " AND e.lastname like '%" + username + "%'"; - } - //个税扣缴义务人 - Long taxAgentId = queryParam.getTaxAgentId(); - if (taxAgentId != null) { - sqlWhere += " AND t1.tax_agent_id = " + taxAgentId; - } - //部门 - List departmentIds = queryParam.getDepartmentIds(); - if (CollectionUtils.isNotEmpty(departmentIds)) { - String departmentStrIds = departmentIds.stream().map(String::valueOf).collect(Collectors.joining(",")); - sqlWhere += " AND d.id IN (" + departmentStrIds + ")"; - } - //工号 - String jobNum = queryParam.getJobNum(); - if (StringUtils.isNotBlank(jobNum)) { - sqlWhere += " AND e.workcode like '%" + jobNum + "%'"; - } - //入职日期 - List hiredate = queryParam.getHiredate(); - if (CollectionUtils.isNotEmpty(hiredate) && hiredate.size() == 2) { - sqlWhere += " AND (e.companystartdate BETWEEN " + hiredate.get(0) + " AND " + hiredate.get(1) + ")"; - } - //手机号 - String mobile = queryParam.getMobile(); - if (StringUtils.isNotBlank(mobile)) { - sqlWhere += " AND e.mobile like '%" + mobile + "%'"; - } - - return sqlWhere; - } -} diff --git a/src/com/engine/salary/cmd/datacollection/OtherDeductionGetSearchConditionCmd.java b/src/com/engine/salary/cmd/datacollection/OtherDeductionGetSearchConditionCmd.java deleted file mode 100644 index 7b06caecc..000000000 --- a/src/com/engine/salary/cmd/datacollection/OtherDeductionGetSearchConditionCmd.java +++ /dev/null @@ -1,112 +0,0 @@ -package com.engine.salary.cmd.datacollection; - -import com.api.browser.bean.SearchConditionGroup; -import com.api.browser.bean.SearchConditionItem; -import com.api.browser.bean.SearchConditionOption; -import com.api.browser.util.ConditionFactory; -import com.api.browser.util.ConditionType; -import com.engine.common.biz.AbstractCommonCommand; -import com.engine.common.entity.BizLogContext; -import com.engine.core.interceptor.CommandContext; -import weaver.hrm.User; -import weaver.systeminfo.SystemEnv; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -public class OtherDeductionGetSearchConditionCmd extends AbstractCommonCommand> { - - public OtherDeductionGetSearchConditionCmd(Map params, User user) { - this.user = user; - this.params = params; - } - - @Override - public BizLogContext getLogContext() { - return null; - } - - @Override - public Map execute(CommandContext commandContext) { - Map apidatas = new HashMap(); - ConditionFactory conditionFactory = new ConditionFactory(user); - - //条件组 - List addGroups = new ArrayList(); - - List conditionItems = new ArrayList(); - - //文本输入框 - SearchConditionItem username = conditionFactory.createCondition(ConditionType.INPUT,25034, "username"); - username.setInputType("input"); - username.setColSpan(2);//定义一行显示条件数,默认值为2,当值为1时标识该条件单独占一行 - username.setFieldcol(16); //条件输入框所占宽度,默认值18 - username.setLabelcol(8); - username.setViewAttr(2); // 编辑权限 1:只读,2:可编辑, 3:必填 默认2 - username.setLabel("姓名"); //设置文本值 这个将覆盖多语言标签的值 - conditionItems.add(username); - - - SearchConditionItem departmentName = conditionFactory.createCondition(ConditionType.BROWSER,502227,"departmentName","4"); - departmentName.setInputType("browser"); - departmentName.setColSpan(2); - departmentName.setFieldcol(16); - departmentName.setLabelcol(8); - departmentName.setViewAttr(2); - departmentName.setIsQuickSearch(false); - departmentName.setLabel("部门"); - conditionItems.add(departmentName); - - - SearchConditionItem jobNum = conditionFactory.createCondition(ConditionType.INPUT,25034, "jobNum"); - jobNum.setInputType("input"); - jobNum.setColSpan(2); - jobNum.setFieldcol(16); - jobNum.setLabelcol(8); - jobNum.setViewAttr(2); - jobNum.setLabel("工号"); - conditionItems.add(jobNum); - - - - SearchConditionItem idNo = conditionFactory.createCondition(ConditionType.INPUT,25034, "idNo"); - idNo.setInputType("input"); - idNo.setColSpan(2); - idNo.setFieldcol(16); - idNo.setLabelcol(8); - idNo.setViewAttr(2); - idNo.setLabel("证件号码"); - conditionItems.add(idNo); - - //日期范围选项 - List dateOptions = new ArrayList(); - dateOptions.add(new SearchConditionOption("6", SystemEnv.getHtmlLabelName(32530, user.getLanguage()),true));//指定日期范围(必须为6) - SearchConditionItem hiredate = conditionFactory.createCondition(ConditionType.RANGEPICKER, 18648, new String[]{"hiredate","hiredate"}); - hiredate.setInputType("rangepicker"); - hiredate.setFormat("yyyy-MM-dd"); - hiredate.setFieldcol(16); - hiredate.setLabelcol(8); - hiredate.setViewAttr(2); - hiredate.setLabel("入职日期"); - hiredate.setOptions(dateOptions); - conditionItems.add(hiredate); - - - SearchConditionItem mobile = conditionFactory.createCondition(ConditionType.INPUT,25034, "mobile"); - mobile.setInputType("input"); - mobile.setColSpan(2); - mobile.setFieldcol(16); - mobile.setLabelcol(8); - mobile.setViewAttr(2); - mobile.setLabel("手机号"); - conditionItems.add(mobile); - - addGroups.add(new SearchConditionGroup("常用条件",true,conditionItems)); - - apidatas.put("condition",addGroups); - return apidatas; - } - -} diff --git a/src/com/engine/salary/cmd/datacollection/OtherDeductionImportCmd.java b/src/com/engine/salary/cmd/datacollection/OtherDeductionImportCmd.java deleted file mode 100644 index 29a4a2ea1..000000000 --- a/src/com/engine/salary/cmd/datacollection/OtherDeductionImportCmd.java +++ /dev/null @@ -1,245 +0,0 @@ -package com.engine.salary.cmd.datacollection; - -import com.engine.common.biz.AbstractCommonCommand; -import com.engine.common.entity.BizLogContext; -import com.engine.core.interceptor.CommandContext; -import com.engine.salary.biz.EmployBiz; -import com.engine.salary.biz.OtherDeductionBiz; -import com.engine.salary.biz.TaxAgentBiz; -import com.engine.salary.entity.datacollection.DataCollectionEmployee; -import com.engine.salary.entity.datacollection.dto.OtherDeductionListDTO; -import com.engine.salary.entity.datacollection.param.OtherDeductionImportParam; -import com.engine.salary.entity.datacollection.po.OtherDeductionPO; -import com.engine.salary.entity.taxrate.TaxAgent; -import com.engine.salary.enums.UserStatusEnum; -import com.engine.salary.exception.SalaryRunTimeException; -import com.engine.salary.util.excel.ExcelParseHelper; -import com.google.common.collect.Maps; -import lombok.SneakyThrows; -import org.apache.commons.collections4.CollectionUtils; -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.lang3.Validate; -import org.apache.poi.util.IOUtils; -import weaver.file.ImageFileManager; -import weaver.general.Util; -import weaver.hrm.User; - -import javax.servlet.http.HttpServletRequest; -import java.io.InputStream; -import java.text.SimpleDateFormat; -import java.util.*; -import java.util.stream.Collectors; - -import static com.engine.salary.constant.SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY; - -public class OtherDeductionImportCmd extends AbstractCommonCommand> { - - protected HttpServletRequest request; - - public OtherDeductionImportCmd(Map params, User user) { - this.user = user; - this.params = params; - - } - - @Override - public BizLogContext getLogContext() { - return null; - } - - @SneakyThrows - @Override - public Map execute(CommandContext commandContext) { - Map apidatas = new HashMap(); - EmployBiz employBiz = new EmployBiz(); - OtherDeductionBiz OtherDeductionBiz = new OtherDeductionBiz(); - - //检验参数 - checkImportParam(); - - //导入参数 - OtherDeductionImportParam importParam = (OtherDeductionImportParam) params.get("importParam"); - //excel文件id - String imageId = Util.null2String(importParam.getImageId()); - Validate.notBlank(imageId, "imageId为空"); - //税款所属期 - String declareMonthStr = Util.null2String(importParam.getDeclareMonth()); - //个税扣缴义务人 - String taxAgentId = Util.null2String(importParam.getTaxAgentId()); - - InputStream fileInputStream = null; - try { - fileInputStream = ImageFileManager.getInputStreamById(Integer.valueOf(imageId)); - List OtherDeductions = ExcelParseHelper.parse2Map(fileInputStream, OtherDeductionListDTO.class, 0, 1, 11, "OtherDeductionTemplate.xlsx"); - - int total = OtherDeductions.size(); - int index = 0; - int successCount = 0; - int errorCount = 0; - - //人员信息 - List employees = employBiz.listEmployee(); - List taxAgents = new TaxAgentBiz().listAll(); - - //税款所属期 - SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); - Date declareMonth = simpleDateFormat.parse(declareMonthStr + "-01"); - - - // 错误excel内容 - List errorData = new ArrayList<>(); - //合规数据 - List eligibleData = new ArrayList<>(); - - - for (int i = 0; i < OtherDeductions.size(); i++) { - OtherDeductionListDTO dto = OtherDeductions.get(i); - - Date now = new Date(); - //待插入数据库对象 - OtherDeductionPO po = OtherDeductionPO.builder() - .tenantKey(DEFAULT_TENANT_KEY) - .createTime(now) - .updateTime(now) - .creator((long) user.getUID()) - .declareMonth(declareMonth).build(); - - //异常点数量 - int errorSum = 0; - - //行号 - String rowIndex = String.format("第%s行", i + 2); - - //相同的姓名 - String userName = dto.getUsername(); - String deparmentName = dto.getDepartmentName(); - List employeeSameIds = new ArrayList<>(); - - List emps = employees.stream().filter(e -> (StringUtils.isBlank(userName) || Objects.equals(e.getUsername(), userName)) - && (StringUtils.isBlank(deparmentName) || Objects.equals(e.getDepartmentName(), deparmentName))) - .collect(Collectors.toList()); - //含在职和离职,选在职数据 - if (CollectionUtils.isNotEmpty(emps) && emps.size() > 1) { - employeeSameIds = emps.stream() - .filter(e -> UserStatusEnum.getNormalStatus().contains(e.getStatus())) - .map(DataCollectionEmployee::getEmployeeId) - .collect(Collectors.toList()); - } - if (CollectionUtils.isNotEmpty(emps) && emps.size() == 1) { - employeeSameIds = emps.stream() - .map(DataCollectionEmployee::getEmployeeId) - .collect(Collectors.toList()); - } - - - if (StringUtils.isBlank(userName)) { - //姓名 不能为空 - //错误消息对象 - Map errorMessageMap = Maps.newHashMap(); - errorMessageMap.put("message", rowIndex + "姓名不能为空"); - errorData.add(errorMessageMap); - errorSum += 1; - } else if (CollectionUtils.isEmpty(employeeSameIds) || employeeSameIds.size() > 1) { - Map errorMessageMap = Maps.newHashMap(); - errorMessageMap.put("message", rowIndex + "员工信息不能为空且不可重复(姓名与部门同时确认唯一)"); - errorData.add(errorMessageMap); - errorSum += 1; - } else { - Long employeeId = CollectionUtils.isNotEmpty(employeeSameIds) && employeeSameIds.size() == 1 ? employeeSameIds.get(0) : null; - if (employeeId != null && employeeId > 0) { - po.setEmployeeId(employeeId); - } else { - //姓名错误,系统内不存在该姓名 - Map errorMessageMap = Maps.newHashMap(); - errorMessageMap.put("message", rowIndex + "姓名错误,系统内不存在该姓名"); - errorData.add(errorMessageMap); - errorSum += 1; - } - } - - - String taxAgentName = dto.getTaxAgentName(); - if (StringUtils.isBlank(taxAgentName)) { - //个税扣缴义务人不能为空 - Map errorMessageMap = Maps.newHashMap(); - errorMessageMap.put("message", rowIndex + "个税扣缴义务人不能为空"); - errorData.add(errorMessageMap); - errorSum += 1; - } else { - Optional optionalTemp = taxAgents.stream().filter(m -> m.getName().equals(taxAgentName)).findFirst(); - if (optionalTemp.isPresent()) { - if (StringUtils.isNotEmpty(taxAgentId) && !optionalTemp.get().getId().equals(Long.valueOf(taxAgentId))) { - //个税扣缴义务人与导入时选择的不一致 - Map errorMessageMap = Maps.newHashMap(); - errorMessageMap.put("message", rowIndex + "个税扣缴义务人与导入时选择的不一致"); - errorData.add(errorMessageMap); - errorSum += 1; - } else { - po.setTaxAgentId(optionalTemp.get().getId()); - } - } else { - //个税扣缴义务人不存在 - Map errorMessageMap = Maps.newHashMap(); - errorMessageMap.put("message", rowIndex + "个税扣缴义务人不存在"); - errorData.add(errorMessageMap); - errorSum += 1; - } - } - - //商业健康保险 - String businessHealthyInsurance = dto.getBusinessHealthyInsurance(); - po.setBusinessHealthyInsurance(businessHealthyInsurance); - //税延养老保险 - String taxDelayEndowmentInsurance = dto.getTaxDelayEndowmentInsurance(); - po.setTaxDelayEndowmentInsurance(taxDelayEndowmentInsurance); - //其他 - String otherDeduction = dto.getOtherDeduction(); - po.setOtherDeduction(otherDeduction); - //准予扣除的捐赠额 - String deductionAllowedDonation = dto.getDeductionAllowedDonation(); - po.setDeductionAllowedDonation(deductionAllowedDonation); - - if (errorSum == 0) { - successCount += 1; - // 合格数据 - eligibleData.add(po); - } else { - errorCount += 1; - // 添加错误数据 - } - } - - //入库 - OtherDeductionBiz.handleImportData(eligibleData); - - apidatas.put("successCount", successCount); - apidatas.put("errorCount", errorCount); - apidatas.put("errorData", errorData); - - } finally { - IOUtils.closeQuietly(fileInputStream); - } - return apidatas; - } - - private void checkImportParam() { - - OtherDeductionImportParam importParam = (OtherDeductionImportParam) params.get("importParam"); - - //excel文件id - String imageId = Util.null2String(importParam.getImageId()); - //税款所属期 - String declareMonthStr = Util.null2String(importParam.getDeclareMonth()); - //个税扣缴义务人 - String taxAgentId = Util.null2String(importParam.getTaxAgentId()); - - if (StringUtils.isBlank(imageId)) { - throw new SalaryRunTimeException("文件不存在"); - } - if (StringUtils.isBlank(declareMonthStr)) { - throw new SalaryRunTimeException("税款所属期为空"); - } - } - - -} diff --git a/src/com/engine/salary/cmd/datacollection/OtherDeductionListCmd.java b/src/com/engine/salary/cmd/datacollection/OtherDeductionListCmd.java deleted file mode 100644 index 2c6e14523..000000000 --- a/src/com/engine/salary/cmd/datacollection/OtherDeductionListCmd.java +++ /dev/null @@ -1,141 +0,0 @@ -package com.engine.salary.cmd.datacollection; - -import com.cloudstore.eccom.result.WeaResultMsg; -import com.engine.common.biz.AbstractCommonCommand; -import com.engine.common.entity.BizLogContext; -import com.engine.core.interceptor.CommandContext; -import com.engine.salary.component.SalaryWeaTable; -import com.engine.salary.entity.datacollection.dto.OtherDeductionListDTO; -import com.engine.salary.entity.datacollection.param.OtherDeductionQueryParam; -import org.apache.commons.collections4.CollectionUtils; -import org.apache.commons.lang3.StringUtils; -import weaver.hrm.User; - -import java.util.Collection; -import java.util.Date; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - -public class OtherDeductionListCmd extends AbstractCommonCommand> { - - public OtherDeductionListCmd(Map params, User user) { - this.user = user; - this.params = params; - } - - @Override - public BizLogContext getLogContext() { - return null; - } - - @Override - public Map execute(CommandContext commandContext) { - - String fields = " t1.id," + - " t1.declare_month as declareMonth," + - " t1.employee_id as employeeId," + - " t2.name AS taxAgentName," + - " e.lastname as username," + - " d.departmentname AS departmentName," + - " e.mobile," + - " e.workcode as jobNum," + - " e.companystartdate as hiredate," + - " t1.business_healthy_insurance as businessHealthyInsurance," + - " t1.tax_delay_endowment_insurance as taxDelayEndowmentInsurance," + - " t1.other_deduction as otherDeduction," + - " t1.deduction_allowed_donation as deductionAllowedDonation"; - - String fromSql = " FROM" + - " hrsa_other_deduction t1" + - " LEFT JOIN hrsa_tax_agent t2 ON t1.tax_agent_id = t2.id" + - " LEFT JOIN hrmresource e ON e.id = t1.employee_id" + - " LEFT JOIN hrmdepartment d ON d.id = e.departmentid"; - - SalaryWeaTable table = new SalaryWeaTable(user, OtherDeductionListDTO.class); - table.setBackfields(fields); - table.setSqlform(fromSql); - table.setSqlwhere(makeSqlWhere()); - table.setSqlorderby("t1.id DESC"); - table.setSqlprimarykey("t1.id"); - table.setSqlisdistinct("false"); - - WeaResultMsg result = new WeaResultMsg(false); - result.putAll(table.makeDataResult()); - result.success(); - return result.getResultMap(); - } - - - private String makeSqlWhere() { - - OtherDeductionQueryParam queryParam = (OtherDeductionQueryParam) params.get("queryParam"); - //申报月份 - List declareMonth = queryParam.getDeclareMonth(); - if (CollectionUtils.isNotEmpty(declareMonth)) { - queryParam.setDeclareMonth(declareMonth.stream().map(e -> e + "-01 00:00:00").collect(Collectors.toList())); - } - - String sqlWhere = "t1.delete_type = 0 AND t2.delete_type = 0 AND e.status not in (7)"; - Collection ids = queryParam.getIds(); - if (CollectionUtils.isNotEmpty(ids)) { - String idsStr = ids.stream().map(String::valueOf).collect(Collectors.joining(",")); - sqlWhere += " AND t1.id IN (" + idsStr + ")"; - } - Long employeeId = queryParam.getEmployeeId(); - if (employeeId != null) { - sqlWhere += " AND t1.employee_id =" + employeeId; - } - String keyword = queryParam.getKeyword(); - if (StringUtils.isNotBlank(keyword)) { - sqlWhere += " AND (" + - " e.lastname like '%" + keyword + "%'" + - " OR d.departmentname like '%" + keyword + "%'" + - " OR e.workcode like ''%" + keyword + "%'" + - " )"; - } - // 税款所属期 - List declareMonth1 = queryParam.getDeclareMonth(); - if (CollectionUtils.isNotEmpty(declareMonth1)) { - if (declareMonth1.size() == 1) { - sqlWhere += " AND t1.declare_month = '" + declareMonth1.get(0) + "'"; - } - if (declareMonth1.size() == 2) { - sqlWhere += " AND (t1.declare_month BETWEEN '" + declareMonth1.get(0) + "' AND '" + declareMonth1.get(1) + "')"; - } - } - //姓名 - String username = queryParam.getUsername(); - if (StringUtils.isNotBlank(username)) { - sqlWhere += " AND e.lastname like '%" + username + "%'"; - } - //个税扣缴义务人 - Long taxAgentId = queryParam.getTaxAgentId(); - if (taxAgentId != null) { - sqlWhere += " AND t1.tax_agent_id = " + taxAgentId; - } - //部门 - List departmentIds = queryParam.getDepartmentIds(); - if (CollectionUtils.isNotEmpty(departmentIds)) { - String departmentStrIds = departmentIds.stream().map(String::valueOf).collect(Collectors.joining(",")); - sqlWhere += " AND d.id IN (" + departmentStrIds + ")"; - } - //工号 - String jobNum = queryParam.getJobNum(); - if (StringUtils.isNotBlank(jobNum)) { - sqlWhere += " AND e.workcode like '%" + jobNum + "%'"; - } - //入职日期 - List hiredate = queryParam.getHiredate(); - if (CollectionUtils.isNotEmpty(hiredate) && hiredate.size() == 2) { - sqlWhere += " AND (e.companystartdate BETWEEN '" + hiredate.get(0) + "' AND '" + hiredate.get(1) + "')"; - } - //手机号 - String mobile = queryParam.getMobile(); - if (StringUtils.isNotBlank(mobile)) { - sqlWhere += " AND e.mobile like '%" + mobile + "%'"; - } - - return sqlWhere; - } -} diff --git a/src/com/engine/salary/cmd/datacollection/OtherDeductionPreviewCmd.java b/src/com/engine/salary/cmd/datacollection/OtherDeductionPreviewCmd.java deleted file mode 100644 index aa6615ee5..000000000 --- a/src/com/engine/salary/cmd/datacollection/OtherDeductionPreviewCmd.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.engine.salary.cmd.datacollection; - -import com.engine.common.biz.AbstractCommonCommand; -import com.engine.common.entity.BizLogContext; -import com.engine.core.interceptor.CommandContext; -import com.engine.salary.entity.datacollection.dto.OtherDeductionListDTO; -import com.engine.salary.entity.datacollection.param.OtherDeductionImportParam; -import com.engine.salary.util.excel.ExcelParseHelper; -import lombok.SneakyThrows; -import org.apache.commons.lang3.Validate; -import org.apache.poi.util.IOUtils; -import weaver.file.ImageFileManager; -import weaver.general.Util; -import weaver.hrm.User; - -import javax.servlet.http.HttpServletRequest; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -public class OtherDeductionPreviewCmd extends AbstractCommonCommand> { - - protected HttpServletRequest request; - - public OtherDeductionPreviewCmd(Map params, User user) { - this.user = user; - this.params = params; - - } - - @Override - public BizLogContext getLogContext() { - return null; - } - - @SneakyThrows - @Override - public Map execute(CommandContext commandContext) { - Map apidatas = new HashMap(); - - //导入参数 - OtherDeductionImportParam importParam = (OtherDeductionImportParam) params.get("importParam"); - //excel文件id - String imageId = Util.null2String(importParam.getImageId()); - Validate.notBlank(imageId, "imageId为空"); - - InputStream fileInputStream = null; - try { - fileInputStream = ImageFileManager.getInputStreamById(Integer.valueOf(imageId)); - List OtherDeductions = ExcelParseHelper.parse2Map(fileInputStream, OtherDeductionListDTO.class, 0, 1, 11, "OtherDeductionTemplate.xlsx"); - apidatas.put("preview", OtherDeductions); - } finally { - IOUtils.closeQuietly(fileInputStream); - } - return apidatas; - } - - -} diff --git a/src/com/engine/salary/entity/datacollection/dto/OtherDeductionListDTO.java b/src/com/engine/salary/entity/datacollection/dto/OtherDeductionListDTO.java index f8730aa8d..d5e067a93 100644 --- a/src/com/engine/salary/entity/datacollection/dto/OtherDeductionListDTO.java +++ b/src/com/engine/salary/entity/datacollection/dto/OtherDeductionListDTO.java @@ -4,6 +4,7 @@ import com.cloudstore.eccom.pc.table.WeaTableType; 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.util.excel.ExcelProperty; import lombok.AllArgsConstructor; import lombok.Builder; @@ -37,57 +38,73 @@ public class OtherDeductionListDTO { //姓名 @SalaryTableColumn(text = "姓名", width = "10%", column = "username") + @TableTitle(title = "姓名", dataIndex = "username", key = "username") @ExcelProperty(index = 0) private String username; //个税扣缴义务人 @SalaryTableColumn(text = "个税扣缴义务人", width = "10%", column = "taxAgentName") + @TableTitle(title = "个税扣缴义务人", dataIndex = "taxAgentName", key = "taxAgentName") @ExcelProperty(index = 1) private String taxAgentName; + /** + * 个税扣缴义务人id + */ + private Long taxAgentId; + //部门 @SalaryTableColumn(text = "部门", width = "10%", column = "departmentName") + @TableTitle(title = "部门", dataIndex = "departmentName", key = "departmentName") @ExcelProperty(index = 2) private String departmentName; //手机号 @SalaryTableColumn(text = "手机号", width = "10%", column = "mobile") + @TableTitle(title = "手机号", dataIndex = "mobile", key = "mobile") @ExcelProperty(index = 3) private String mobile; //工号 @SalaryTableColumn(text = "工号", width = "10%", column = "jobNum") + @TableTitle(title = "工号", dataIndex = "jobNum", key = "jobNum") @ExcelProperty(index = 4) private String jobNum; //证件号码 @SalaryTableColumn(text = "证件号码", width = "10%", column = "idNo") + @TableTitle(title = "证件号码", dataIndex = "idNo", key = "idNo") @ExcelProperty(index = 5) private String idNo; //入职日期 @ExcelProperty(index = 6) @SalaryTableColumn(text = "入职日期", width = "10%", column = "hiredate") + @TableTitle(title = "入职日期", dataIndex = "hiredate", key = "hiredate") private String hiredate; //商业健康保险 @ExcelProperty(index = 7) @SalaryTableColumn(text = "商业健康保险", width = "10%", column = "businessHealthyInsurance") + @TableTitle(title = "商业健康保险", dataIndex = "businessHealthyInsurance", key = "businessHealthyInsurance") private String businessHealthyInsurance; //税延养老保险 @ExcelProperty(index = 8) @SalaryTableColumn(text = "税延养老保险", width = "10%", column = "taxDelayEndowmentInsurance") + @TableTitle(title = "税延养老保险", dataIndex = "taxDelayEndowmentInsurance", key = "taxDelayEndowmentInsurance") private String taxDelayEndowmentInsurance; //其他 @ExcelProperty(index = 9) @SalaryTableColumn(text = "其他", width = "10%", column = "otherDeduction") + @TableTitle(title = "其他", dataIndex = "otherDeduction", key = "otherDeduction") private String otherDeduction; //准予扣除的捐赠额 @ExcelProperty(index = 10) @SalaryTableColumn(text = "准予扣除的捐赠额", width = "10%", column = "deductionAllowedDonation") + @TableTitle(title = "准予扣除的捐赠额", dataIndex = "deductionAllowedDonation", key = "deductionAllowedDonation") private String deductionAllowedDonation; @SalaryTableColumn(text = "操作", width = "20%", column = "operate") diff --git a/src/com/engine/salary/entity/datacollection/dto/OtherDeductionRecordDTO.java b/src/com/engine/salary/entity/datacollection/dto/OtherDeductionRecordDTO.java index b2a0a1399..42bae4440 100644 --- a/src/com/engine/salary/entity/datacollection/dto/OtherDeductionRecordDTO.java +++ b/src/com/engine/salary/entity/datacollection/dto/OtherDeductionRecordDTO.java @@ -42,6 +42,11 @@ public class OtherDeductionRecordDTO { //个税扣缴义务人 @SalaryTableColumn(text = "个税扣缴义务人", width = "10%", column = "taxAgentName") private String taxAgentName; + /** + * 个税扣缴义务人id + */ + private Long taxAgentId; + //部门 @SalaryTableColumn(text = "部门", width = "10%", column = "departmentName") @@ -51,6 +56,8 @@ public class OtherDeductionRecordDTO { @SalaryTableColumn(text = "手机号", width = "10%", column = "mobile") private String mobile; + private String idNo; + //工号 @SalaryTableColumn(text = "工号", width = "10%", column = "jobNum") private String jobNum; diff --git a/src/com/engine/salary/entity/datacollection/param/OtherDeductionQueryParam.java b/src/com/engine/salary/entity/datacollection/param/OtherDeductionQueryParam.java index 534fd2157..c1c8c0337 100644 --- a/src/com/engine/salary/entity/datacollection/param/OtherDeductionQueryParam.java +++ b/src/com/engine/salary/entity/datacollection/param/OtherDeductionQueryParam.java @@ -1,5 +1,6 @@ package com.engine.salary.entity.datacollection.param; +import com.engine.salary.common.BaseQueryParam; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; @@ -15,7 +16,7 @@ import java.util.List; @NoArgsConstructor @AllArgsConstructor //数据采集-其他免税扣除查询参数 -public class OtherDeductionQueryParam { +public class OtherDeductionQueryParam extends BaseQueryParam { //主键id private Collection ids; diff --git a/src/com/engine/salary/entity/salaryacct/bo/SalaryAcctEmployeeBO.java b/src/com/engine/salary/entity/salaryacct/bo/SalaryAcctEmployeeBO.java index 9f0741cc9..6934b4298 100644 --- a/src/com/engine/salary/entity/salaryacct/bo/SalaryAcctEmployeeBO.java +++ b/src/com/engine/salary/entity/salaryacct/bo/SalaryAcctEmployeeBO.java @@ -7,7 +7,7 @@ import com.engine.salary.entity.salaryacct.po.SalaryAcctEmployeePO; import com.engine.salary.entity.salaryacct.po.SalaryAcctRecordPO; import com.engine.salary.entity.salaryarchive.dto.SalaryArchiveDataDTO; import com.engine.salary.entity.salaryarchive.dto.SalaryArchiveTaxAgentDataDTO; -import com.engine.salary.entity.taxrate.TaxAgent; +import com.engine.salary.entity.taxagent.po.TaxAgentPO; import com.engine.salary.enums.UserStatusEnum; import com.engine.salary.util.SalaryEntityUtil; import com.google.common.collect.Lists; @@ -38,12 +38,12 @@ public class SalaryAcctEmployeeBO { * @return */ public static List convert2EmployeeListDTO(List salaryAccountingEmployees, - List taxAgents, + List taxAgents, List simpleEmployees) { if (CollectionUtils.isEmpty(salaryAccountingEmployees)) { return Collections.emptyList(); } - Map taxAgentNameMap = SalaryEntityUtil.convert2Map(taxAgents, TaxAgent::getId, TaxAgent::getName); + Map taxAgentNameMap = SalaryEntityUtil.convert2Map(taxAgents, TaxAgentPO::getId, TaxAgentPO::getName); Map simpleEmployeeMap = SalaryEntityUtil.convert2Map(simpleEmployees, DataCollectionEmployee::getEmployeeId); return salaryAccountingEmployees.stream() .map(e -> { diff --git a/src/com/engine/salary/entity/salaryacct/bo/SalaryAcctResultBO.java b/src/com/engine/salary/entity/salaryacct/bo/SalaryAcctResultBO.java index 442f4b331..f451640aa 100644 --- a/src/com/engine/salary/entity/salaryacct/bo/SalaryAcctResultBO.java +++ b/src/com/engine/salary/entity/salaryacct/bo/SalaryAcctResultBO.java @@ -18,7 +18,7 @@ import com.engine.salary.entity.salarysob.dto.SalarySobItemGroupDTO; import com.engine.salary.entity.salarysob.po.SalarySobEmpFieldPO; import com.engine.salary.entity.salarysob.po.SalarySobItemPO; import com.engine.salary.entity.salarysob.po.SalarySobPO; -import com.engine.salary.entity.taxrate.TaxAgent; +import com.engine.salary.entity.taxagent.po.TaxAgentPO; import com.engine.salary.enums.salaryitem.SalaryDataTypeEnum; import com.engine.salary.util.SalaryEntityUtil; import com.engine.salary.util.SalaryI18nUtil; @@ -168,7 +168,7 @@ public class SalaryAcctResultBO { List simpleEmployees, List salaryAcctEmployees, List salaryAccountingResults, - List taxAgents, + List taxAgents, Set consolidatedTaxSalaryAcctEmpIds, Map customParameters) { if (CollectionUtils.isEmpty(salaryAcctEmployees)) { @@ -176,7 +176,7 @@ public class SalaryAcctResultBO { } Map employeeMap = SalaryEntityUtil.convert2Map(simpleEmployees, DataCollectionEmployee::getEmployeeId); Map> acctResultMap = SalaryEntityUtil.group2Map(salaryAccountingResults, SalaryAcctResultPO::getEmployeeId); - Map taxAgentNameMap = SalaryEntityUtil.convert2Map(taxAgents, TaxAgent::getId, TaxAgent::getName); + Map taxAgentNameMap = SalaryEntityUtil.convert2Map(taxAgents, TaxAgentPO::getId, TaxAgentPO::getName); return salaryAcctEmployees.stream().map(e -> { Map resultValueMap = SalaryEntityUtil.convert2Map(acctResultMap.getOrDefault(e.getEmployeeId(), Collections.emptyList()), SalaryAcctResultPO::getSalaryItemId, SalaryAcctResultPO::getResultValue); @@ -226,7 +226,7 @@ public class SalaryAcctResultBO { List salaryAcctEmployees, List salaryAcctResultPOS, List excelAcctResultPOS, - List taxAgents, + List taxAgents, Map customParameters, Set consolidatedTaxSalaryAcctEmpIds, Set includeSalaryItemIds) { @@ -235,7 +235,7 @@ public class SalaryAcctResultBO { } Map> excelResultMap = SalaryEntityUtil.group2Map(excelAcctResultPOS, ExcelAcctResultPO::getSalaryAcctEmpId); Map> acctResultMap = SalaryEntityUtil.group2Map(salaryAcctResultPOS, SalaryAcctResultPO::getSalaryAcctEmpId); - Map taxAgentNameMap = SalaryEntityUtil.convert2Map(taxAgents, TaxAgent::getId, TaxAgent::getName); + Map taxAgentNameMap = SalaryEntityUtil.convert2Map(taxAgents, TaxAgentPO::getId, TaxAgentPO::getName); Map employeeMap = SalaryEntityUtil.convert2Map(simpleEmployees, DataCollectionEmployee::getEmployeeId); List> resultList = Lists.newArrayListWithExpectedSize(salaryAcctEmployees.size()); for (SalaryAcctEmployeePO salaryAcctEmployee : salaryAcctEmployees) { @@ -311,7 +311,7 @@ public class SalaryAcctResultBO { * @return */ public static SalaryAcctResultDetailDTO convert2DetailDTO(DataCollectionEmployee simpleEmployee, - TaxAgent taxAgentPO, + TaxAgentPO taxAgentPO, SalaryAcctEmployeePO salaryAcctEmployee, List salarySobEmpFields, List salarySobItemPOS, @@ -320,7 +320,7 @@ public class SalaryAcctResultBO { // 员工信息字段 Map employeeFieldValueMap = SalaryAcctFormulaBO.convert2FormulaEmployee(simpleEmployee); // 个税扣缴义务人 - employeeFieldValueMap.put("taxAgentName", Optional.ofNullable(taxAgentPO).map(TaxAgent::getName).orElse(StringUtils.EMPTY)); + employeeFieldValueMap.put("taxAgentName", Optional.ofNullable(taxAgentPO).map(TaxAgentPO::getName).orElse(StringUtils.EMPTY)); Map employeeFieldNameMap = buildEmployeeFieldName(); List employeeInfos = salarySobEmpFields.stream() .map(e -> SalaryAcctEmployeeInfoDTO.builder() @@ -418,7 +418,7 @@ public class SalaryAcctResultBO { } public static ConsolidatedTaxDetailDTO convert2ConsolidatedTaxDetailDTO(DataCollectionEmployee simpleEmployee, - TaxAgent taxAgent, + TaxAgentPO taxAgent, List salarySobEmpFields, List salaryItems, List salaryAcctEmployees, diff --git a/src/com/engine/salary/entity/salaryarchive/param/SalaryArchiveImportHandleParam.java b/src/com/engine/salary/entity/salaryarchive/param/SalaryArchiveImportHandleParam.java index 01492e075..9599f2d54 100644 --- a/src/com/engine/salary/entity/salaryarchive/param/SalaryArchiveImportHandleParam.java +++ b/src/com/engine/salary/entity/salaryarchive/param/SalaryArchiveImportHandleParam.java @@ -6,7 +6,7 @@ import com.engine.salary.entity.salaryarchive.po.SalaryArchiveItemPO; import com.engine.salary.entity.salaryarchive.po.SalaryArchivePO; import com.engine.salary.entity.salaryarchive.po.SalaryArchiveTaxAgentPO; import com.engine.salary.entity.salaryitem.po.SalaryItemPO; -import com.engine.salary.entity.taxrate.TaxAgent; +import com.engine.salary.entity.taxagent.po.TaxAgentPO; import com.engine.salary.enums.salaryarchive.SalaryArchiveImportTypeEnum; import lombok.AllArgsConstructor; import lombok.Builder; @@ -55,7 +55,7 @@ public class SalaryArchiveImportHandleParam { /** * 获取所有个税扣缴义务人 */ - Collection taxAgentList; + Collection taxAgentList; /** * 获取所有可被引用的薪资项目 diff --git a/src/com/engine/salary/entity/taxagent/bo/TaxAgentBO.java b/src/com/engine/salary/entity/taxagent/bo/TaxAgentBO.java index f1e97ac2e..6ee6ef2b7 100644 --- a/src/com/engine/salary/entity/taxagent/bo/TaxAgentBO.java +++ b/src/com/engine/salary/entity/taxagent/bo/TaxAgentBO.java @@ -1,9 +1,5 @@ package com.engine.salary.entity.taxagent.bo; -import com.cloudstore.eccom.pc.table.WeaTable; -import com.cloudstore.eccom.pc.table.WeaTableColumn; -import com.cloudstore.eccom.pc.table.WeaTableOperate; -import com.cloudstore.eccom.pc.table.WeaTableOperates; import com.engine.salary.constant.SalaryDefaultTenantConstant; import com.engine.salary.entity.agency.po.PaymentAgencyPO; import com.engine.salary.entity.datacollection.DataCollectionEmployee; @@ -27,6 +23,8 @@ import com.engine.salary.enums.taxagent.TaxAgentRangeTypeEnum; import com.engine.salary.util.JsonUtil; import com.engine.salary.util.SalaryEntityUtil; import com.engine.salary.util.SalaryI18nUtil; +import com.engine.salary.util.page.Column; +import com.engine.salary.util.page.PageInfo; import com.google.common.base.Joiner; import com.google.common.collect.Lists; import dm.jdbc.util.IdGenerator; @@ -76,9 +74,9 @@ public class TaxAgentBO { * @param weaTable * @param isOpenDevolution */ - public static void buildTaxAgentTable(WeaTable weaTable, boolean isOpenDevolution) { + public static void buildTaxAgentTable(PageInfo> listPage, boolean isOpenDevolution) { // 表格表头 - List columns = new ArrayList<>(); + List columns = new ArrayList<>(); String name = SalaryI18nUtil.getI18nLabel(91558, "个税扣缴义务人名称"); String employeeRange = SalaryI18nUtil.getI18nLabel(86125, "人员范围"); String admins = SalaryI18nUtil.getI18nLabel(106259, "管理员"); @@ -86,30 +84,19 @@ public class TaxAgentBO { // String paymentAgency = SalaryI18nUtil.getI18nLabel(112448, "社保福利代缴机构"); String description = SalaryI18nUtil.getI18nLabel(84961, "备注"); if (isOpenDevolution) { - columns.add(new WeaTableColumn(name, "name", "20%")); - columns.add(new WeaTableColumn(employeeRange, "employeeRange", "20%")); - columns.add(new WeaTableColumn(admins, "admins", "20%")); -// columns.add(new WeaTableColumn(subAdmins, "subAdmins", "20%")); -// columns.add(new WeaTableColumn(paymentAgency, "paymentAgency", "30%")); - columns.add(new WeaTableColumn(description, "description", "20%")); + columns.add(new Column(name, "name", "name%")); + columns.add(new Column(employeeRange, "employeeRange", "employeeRange")); + columns.add(new Column(admins, "admins", "admins%")); +// columns.add(new Column(subAdmins, "subAdmins", "20%")); +// columns.add(new Column(paymentAgency, "paymentAgency", "30%")); + columns.add(new Column(description, "description", "name")); } else { - columns.add(new WeaTableColumn(name, "name", "40%")); - columns.add(new WeaTableColumn(employeeRange, "employeeRange", "20%")); + columns.add(new Column(name, "name", "name")); + columns.add(new Column(employeeRange, "employeeRange", "employeeRange")); // columns.add(new WeaTableColumn(paymentAgency, "paymentAgency", "30%")); - columns.add(new WeaTableColumn(description, "description", "40%")); + columns.add(new Column(description, "description", "description")); } - weaTable.setColumns(columns); - - WeaTableOperates operates = weaTable.getOperates(); - operates.getOperate().add(new WeaTableOperate(SalaryI18nUtil.getI18nLabel(59943, "编辑"), null, "0")); - operates.getOperate().add(new WeaTableOperate(SalaryI18nUtil.getI18nLabel(59942, "删除"), null, "1")); -// if (isOpenDevolution) { -// operates.add(new WeaTableOperate(SalaryI18nUtil.getI18nLabel( 106247, "管理范围及分权设置"), 2)); -// } -// weaTable.setOperatesPermission(getDefaultOperatesPermission(operates.getOperate().size(), size)); -// weaTable.setCheckBoxPermission(getDefaultCheckBoxPermission(size)); -// -// weaTable.setTableType(WeaTableTypeEnum.CHECKBOX); + listPage.setColumns(columns); } // private static List> getDefaultOperatesPermission(int operateSize, int recordSize) { @@ -354,8 +341,7 @@ public class TaxAgentBO { } } - public static Result handleTaxAgentRange(List taxAgentManageRanges, TaxAgentManageRangeSaveParam saveParam, Long taxAgentId, Long employeeId - ) { + public static Result handleTaxAgentRange(List taxAgentManageRanges, TaxAgentManageRangeSaveParam saveParam, Long taxAgentId, Long employeeId) { return handleManageRange(taxAgentManageRanges, saveParam, TaxAgentRangeTypeEnum.TAXAGENT, taxAgentId, 0L, employeeId); } diff --git a/src/com/engine/salary/entity/taxagent/po/TaxAgentManageRangePO.java b/src/com/engine/salary/entity/taxagent/po/TaxAgentManageRangePO.java index e34ffef53..e2df638d0 100644 --- a/src/com/engine/salary/entity/taxagent/po/TaxAgentManageRangePO.java +++ b/src/com/engine/salary/entity/taxagent/po/TaxAgentManageRangePO.java @@ -61,7 +61,6 @@ public class TaxAgentManageRangePO { * 人员状态 */ private String employeeStatus; - /** * 是包含还是排除 0:排除、1:包含 */ diff --git a/src/com/engine/salary/enums/salarysob/TargetTypeEnum.java b/src/com/engine/salary/enums/salarysob/TargetTypeEnum.java index dc006785a..eac7f4458 100644 --- a/src/com/engine/salary/enums/salarysob/TargetTypeEnum.java +++ b/src/com/engine/salary/enums/salarysob/TargetTypeEnum.java @@ -18,8 +18,8 @@ public enum TargetTypeEnum implements BaseEnum { DEPT(2, "部门", 86185), SUBCOMPANY(3, "分部", 107369), POSITION(4, "岗位", 90633), - ALL(5, "所有人", 107729), - EXT_EMPLOYEE(100, "外部人员", 0); + ALL(5, "所有人", 107729); +// EXT_EMPLOYEE(100, "外部人员", 0); private int value; private String defaultLabel; diff --git a/src/com/engine/salary/mapper/datacollection/EmployMapper.java b/src/com/engine/salary/mapper/datacollection/EmployMapper.java index 1cd5b5688..9c6c53db2 100644 --- a/src/com/engine/salary/mapper/datacollection/EmployMapper.java +++ b/src/com/engine/salary/mapper/datacollection/EmployMapper.java @@ -44,5 +44,5 @@ public interface EmployMapper { List getDeptInfoList(@Param("departmentIds") List departmentIds); - List getSubCompanyInfoList(List subDepartmentIds); + List getSubCompanyInfoList(@Param("subDepartmentIds") List subDepartmentIds); } \ No newline at end of file diff --git a/src/com/engine/salary/mapper/datacollection/OtherDeductionMapper.xml b/src/com/engine/salary/mapper/datacollection/OtherDeductionMapper.xml index 8b23e4ef8..f8f9966f6 100644 --- a/src/com/engine/salary/mapper/datacollection/OtherDeductionMapper.xml +++ b/src/com/engine/salary/mapper/datacollection/OtherDeductionMapper.xml @@ -316,7 +316,9 @@ t1.declare_month, t1.employee_id, t2.name AS tax_agent_name, + t2.name AS tax_agent_name, e.lastname as username, + e.certificatenum as idNo, d.departmentname AS departmentName, e.mobile, e.workcode as job_num, diff --git a/src/com/engine/salary/mapper/salarysob/SalarySobMapper.xml b/src/com/engine/salary/mapper/salarysob/SalarySobMapper.xml index 5eafd5c50..9ea7ef119 100644 --- a/src/com/engine/salary/mapper/salarysob/SalarySobMapper.xml +++ b/src/com/engine/salary/mapper/salarysob/SalarySobMapper.xml @@ -69,9 +69,6 @@ AND id = #{id} - - AND name = #{name} - AND income_category = #{incomeCategory} @@ -126,6 +123,7 @@ #{taxAgentId} + ORDER BY id DESC @@ -364,4 +362,22 @@ + + + AND name like CONCAT('%',#{name},'%') + + + + + AND name like '%'||#{name}||'%' + + + + + AND name like '%'+#{name}+'%' + + + + + \ No newline at end of file diff --git a/src/com/engine/salary/mapper/taxagent/TaxAgentManageRangeMapper.xml b/src/com/engine/salary/mapper/taxagent/TaxAgentManageRangeMapper.xml index c19c09421..c5eb21ebf 100644 --- a/src/com/engine/salary/mapper/taxagent/TaxAgentManageRangeMapper.xml +++ b/src/com/engine/salary/mapper/taxagent/TaxAgentManageRangeMapper.xml @@ -23,7 +23,7 @@ t.create_time , t.creator , t.delete_type - , t.employee_id +-- , t.employee_id , t.employee_status , t.id , t.include_type @@ -67,9 +67,9 @@ AND delete_type = #{deleteType} - - AND employee_id = #{employeeId} - + + + AND employee_status = #{employeeStatus} @@ -136,9 +136,9 @@ delete_type, - - employee_id, - + + + employee_status, @@ -180,9 +180,9 @@ #{deleteType}, - - #{employeeId}, - + + + #{employeeStatus}, @@ -223,7 +223,7 @@ create_time=#{createTime}, creator=#{creator}, delete_type=#{deleteType}, - employee_id=#{employeeId}, +-- employee_id=#{employeeId}, employee_status=#{employeeStatus}, include_type=#{includeType}, range_type=#{rangeType}, @@ -251,9 +251,9 @@ delete_type=#{deleteType}, - - employee_id=#{employeeId}, - + + + employee_status=#{employeeStatus}, diff --git a/src/com/engine/salary/service/OtherDeductionService.java b/src/com/engine/salary/service/OtherDeductionService.java index f2f1e8fdb..f0c47b9c1 100644 --- a/src/com/engine/salary/service/OtherDeductionService.java +++ b/src/com/engine/salary/service/OtherDeductionService.java @@ -1,7 +1,11 @@ package com.engine.salary.service; +import com.engine.salary.entity.datacollection.dto.OtherDeductionListDTO; +import com.engine.salary.entity.datacollection.dto.OtherDeductionRecordDTO; +import com.engine.salary.entity.datacollection.param.OtherDeductionImportParam; import com.engine.salary.entity.datacollection.param.OtherDeductionQueryParam; import com.engine.salary.entity.datacollection.po.OtherDeductionPO; +import com.engine.salary.util.page.PageInfo; import org.apache.poi.xssf.usermodel.XSSFWorkbook; import java.time.YearMonth; @@ -19,42 +23,69 @@ import java.util.Map; public interface OtherDeductionService { /** - * 数据采集-其他免税扣除列表的高级搜索 + * 通过id获取单条其他免税扣除记录 + * + * @param id + * @return */ - Map getSearchCondition(Map params); + OtherDeductionPO getById(Long id); /** * 数据采集-其他免税扣除列表 + * + * @param queryParam + * @return */ - Map list(Map params); + PageInfo listPage(OtherDeductionQueryParam queryParam); /** - * 获取数据采集-其他免税扣除表单 + * 获取数据采集-其他免税扣除详情 + * + * @param queryParam + * @return */ - Map getDetailList(Map params); + PageInfo recordListPage(OtherDeductionQueryParam queryParam); + + /** + * 导出 + * + */ + XSSFWorkbook export(OtherDeductionQueryParam queryParam); + + /** + * 导出详情 + * + */ + XSSFWorkbook exportDetail( OtherDeductionQueryParam queryParam); + + /** + * 下载导入模板 + * + * @param param + * @return + */ + XSSFWorkbook downloadTemplate(OtherDeductionQueryParam param); /** * 预览 */ - Map preview(Map params); + Map preview(OtherDeductionImportParam importParam); /** * 导入数据 */ - Map importData(Map params); + Map importData(OtherDeductionImportParam importParam); + /** - * 导出 + * 获取其他免税扣除数据 + * + * @param declareMonth + * @param employeeIds + * @return */ - XSSFWorkbook export(Map params); + List getOtherDeductionList(YearMonth declareMonth, List employeeIds); - /** - * 导出详情 - */ - XSSFWorkbook exportDetail(Map params); - List getOtherDeductionList(YearMonth taxCycle, List employeeIds); - - XSSFWorkbook downloadTemplate(OtherDeductionQueryParam param); } diff --git a/src/com/engine/salary/service/SalaryArchiveService.java b/src/com/engine/salary/service/SalaryArchiveService.java index 0cb51a7b9..4004526da 100644 --- a/src/com/engine/salary/service/SalaryArchiveService.java +++ b/src/com/engine/salary/service/SalaryArchiveService.java @@ -11,7 +11,7 @@ import com.engine.salary.entity.salaryarchive.po.SalaryArchiveItemPO; import com.engine.salary.entity.salaryarchive.po.SalaryArchivePO; import com.engine.salary.entity.salaryarchive.po.SalaryArchiveTaxAgentPO; import com.engine.salary.entity.salaryitem.po.SalaryItemPO; -import com.engine.salary.entity.taxrate.TaxAgent; +import com.engine.salary.entity.taxagent.po.TaxAgentPO; import com.engine.salary.enums.salaryarchive.SalaryArchiveImportTypeEnum; import com.engine.salary.util.page.PageInfo; import org.apache.poi.xssf.usermodel.XSSFWorkbook; @@ -55,7 +55,7 @@ public interface SalaryArchiveService { * @param isPage * @return */ - List> buildSalaryArchiveData(Collection salaryArchives, Collection taxAgentLists, List salaryItems, Boolean isPage); + List> buildSalaryArchiveData(Collection salaryArchives, Collection taxAgentLists, List salaryItems, Boolean isPage); /** * 获取薪资档案对应的当前生效的薪资项目 diff --git a/src/com/engine/salary/service/SalarySobService.java b/src/com/engine/salary/service/SalarySobService.java index 5a465d533..0e648a881 100644 --- a/src/com/engine/salary/service/SalarySobService.java +++ b/src/com/engine/salary/service/SalarySobService.java @@ -1,11 +1,13 @@ package com.engine.salary.service; -import com.engine.salary.entity.salarysob.param.SalarySobBasicSaveParam; import com.engine.salary.entity.salarysob.dto.SalarySobCycleDTO; +import com.engine.salary.entity.salarysob.param.SalarySobBasicSaveParam; import com.engine.salary.entity.salarysob.param.SalarySobDisableParam; import com.engine.salary.entity.salarysob.param.SalarySobDuplicateParam; +import com.engine.salary.entity.salarysob.param.SalarySobListQueryParam; import com.engine.salary.entity.salarysob.po.SalarySobPO; import com.engine.salary.enums.salarysob.IncomeCategoryEnum; +import com.engine.salary.util.page.PageInfo; import java.time.YearMonth; import java.util.Collection; @@ -73,10 +75,9 @@ public interface SalarySobService { * 根据列表查询参数查询薪资账套(分页) * * @param queryParam 列表查询参数 - * @param tenantKey 租户key * @return */ -// Page listPageByParam(SalarySobListQueryParam queryParam); + PageInfo listPageByParam(SalarySobListQueryParam queryParam); /** * 保存 @@ -123,4 +124,12 @@ public interface SalarySobService { * @return */ SalarySobCycleDTO getSalarySobCycle(Long id, YearMonth salaryMonth); + + /** + * 按权限过滤掉无权限的薪资账套 + * + * @param salarySobPOS + * @return + */ + List filterByAuthority(List salarySobPOS); } diff --git a/src/com/engine/salary/service/TaxAgentService.java b/src/com/engine/salary/service/TaxAgentService.java deleted file mode 100644 index 9b7aac2d6..000000000 --- a/src/com/engine/salary/service/TaxAgentService.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.engine.salary.service; - -import com.engine.salary.entity.taxrate.TaxAgent; - -import java.util.Collection; - -public interface TaxAgentService { - - Collection findAll(); - - /** - * 根据id获取单个个税扣缴义务人 - * - * @param id - * @return - */ - TaxAgent getById(Long id); -} diff --git a/src/com/engine/salary/service/impl/AddUpDeductionServiceImpl.java b/src/com/engine/salary/service/impl/AddUpDeductionServiceImpl.java index 9daa82e3f..af57deb43 100644 --- a/src/com/engine/salary/service/impl/AddUpDeductionServiceImpl.java +++ b/src/com/engine/salary/service/impl/AddUpDeductionServiceImpl.java @@ -9,7 +9,6 @@ import com.engine.common.util.ServiceUtil; import com.engine.core.impl.Service; import com.engine.salary.biz.AddUpDeductionBiz; import com.engine.salary.biz.EmployBiz; -import com.engine.salary.biz.TaxAgentBiz; import com.engine.salary.common.LocalDateRange; import com.engine.salary.entity.datacollection.AddUpDeduction; import com.engine.salary.entity.datacollection.DataCollectionEmployee; @@ -23,7 +22,6 @@ 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.po.TaxAgentPO; -import com.engine.salary.entity.taxrate.TaxAgent; import com.engine.salary.enums.salaryaccounting.SalaryAcctRecordStatusEnum; import com.engine.salary.exception.SalaryRunTimeException; import com.engine.salary.mapper.datacollection.AddUpDeductionMapper; @@ -201,9 +199,6 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction int successCount = 0; int errorCount = 0; - //人员信息 - List taxAgents = new TaxAgentBiz().listAll(); - // 错误excel内容 List errorData = new ArrayList<>(); //合规数据 diff --git a/src/com/engine/salary/service/impl/AddUpSituationServiceImpl.java b/src/com/engine/salary/service/impl/AddUpSituationServiceImpl.java index 83a4c9d3c..0794ad6d1 100644 --- a/src/com/engine/salary/service/impl/AddUpSituationServiceImpl.java +++ b/src/com/engine/salary/service/impl/AddUpSituationServiceImpl.java @@ -9,7 +9,6 @@ import com.engine.common.util.ServiceUtil; import com.engine.core.impl.Service; import com.engine.salary.biz.AddUpSituationBiz; import com.engine.salary.biz.EmployBiz; -import com.engine.salary.biz.TaxAgentBiz; import com.engine.salary.entity.datacollection.AddUpSituation; import com.engine.salary.entity.datacollection.DataCollectionEmployee; import com.engine.salary.entity.datacollection.dto.AddUpSituationDTO; @@ -20,7 +19,6 @@ import com.engine.salary.entity.salaryacct.po.SalaryAcctEmployeePO; import com.engine.salary.entity.taxagent.dto.TaxAgentEmployeeDTO; import com.engine.salary.entity.taxagent.dto.TaxAgentManageRangeEmployeeDTO; import com.engine.salary.entity.taxagent.po.TaxAgentPO; -import com.engine.salary.entity.taxrate.TaxAgent; import com.engine.salary.exception.SalaryRunTimeException; import com.engine.salary.mapper.datacollection.AddUpSituationMapper; import com.engine.salary.service.AddUpDeductionService; @@ -608,8 +606,6 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation int successCount = 0; int errorCount = 0; - //人员信息 - List taxAgents = new TaxAgentBiz().listAll(); Date now = new Date(); diff --git a/src/com/engine/salary/service/impl/AttendQuoteDataServiceImpl.java b/src/com/engine/salary/service/impl/AttendQuoteDataServiceImpl.java index a32812147..b7db41e04 100644 --- a/src/com/engine/salary/service/impl/AttendQuoteDataServiceImpl.java +++ b/src/com/engine/salary/service/impl/AttendQuoteDataServiceImpl.java @@ -480,26 +480,22 @@ public class AttendQuoteDataServiceImpl extends Service implements AttendQuoteDa for (AttendQuoteFieldPO attendQuoteField : attendQuoteFields) { header.add(attendQuoteField.getFieldName()); } -// // 2.表头 -// excelSheetData.setHeaders(Collections.singletonList(header.toArray(new String[]{}))); - List> rows = new ArrayList<>(); rows.add(header); - for (Map dto : listMaps) { - List row = new ArrayList<>(); - row.add(dto.get("username")); - row.add(dto.get("departmentName")); - row.add(dto.get("mobile")); - row.add(dto.get("jobNum")); - - // 动态列 - Map map = listMaps.get(0); - for (AttendQuoteFieldPO attendQuoteField : attendQuoteFields) { - row.add(map.containsKey(attendQuoteField.getId() + "_attendQuoteData") ? dto.get(attendQuoteField.getId() + "_attendQuoteData") : ""); - } - // 2.表头 - rows.add(row); - } +// for (Map dto : listMaps) { +// List row = new ArrayList<>(); +// row.add(dto.get("username")); +// row.add(dto.get("departmentName")); +// row.add(dto.get("mobile")); +// row.add(dto.get("jobNum")); +// +// // 动态列 +// Map map = listMaps.get(0); +// for (AttendQuoteFieldPO attendQuoteField : attendQuoteFields) { +// row.add(map.containsKey(attendQuoteField.getId() + "_attendQuoteData") ? dto.get(attendQuoteField.getId() + "_attendQuoteData") : ""); +// } +// rows.add(row); +// } return ExcelUtil.genWorkbookV2(rows, sheetName); } catch (Exception e) { diff --git a/src/com/engine/salary/service/impl/OtherDeductionServiceImpl.java b/src/com/engine/salary/service/impl/OtherDeductionServiceImpl.java index 69f948cc7..33b84dc93 100644 --- a/src/com/engine/salary/service/impl/OtherDeductionServiceImpl.java +++ b/src/com/engine/salary/service/impl/OtherDeductionServiceImpl.java @@ -1,83 +1,451 @@ package com.engine.salary.service.impl; +import com.engine.common.util.ServiceUtil; import com.engine.core.impl.Service; import com.engine.salary.biz.EmployBiz; import com.engine.salary.biz.OtherDeductionBiz; -import com.engine.salary.cmd.datacollection.*; import com.engine.salary.entity.datacollection.DataCollectionEmployee; import com.engine.salary.entity.datacollection.dto.OtherDeductionListDTO; +import com.engine.salary.entity.datacollection.dto.OtherDeductionRecordDTO; +import com.engine.salary.entity.datacollection.param.OtherDeductionImportParam; import com.engine.salary.entity.datacollection.param.OtherDeductionQueryParam; import com.engine.salary.entity.datacollection.po.OtherDeductionPO; +import com.engine.salary.entity.salaryacct.po.SalaryAcctEmployeePO; +import com.engine.salary.entity.taxagent.dto.TaxAgentEmployeeDTO; +import com.engine.salary.entity.taxagent.dto.TaxAgentManageRangeEmployeeDTO; +import com.engine.salary.entity.taxagent.po.TaxAgentPO; +import com.engine.salary.enums.UserStatusEnum; import com.engine.salary.exception.SalaryRunTimeException; import com.engine.salary.mapper.datacollection.OtherDeductionMapper; +import com.engine.salary.service.AddUpDeductionService; import com.engine.salary.service.OtherDeductionService; +import com.engine.salary.service.SalaryEmployeeService; +import com.engine.salary.service.TaxAgentV2Service; import com.engine.salary.util.SalaryDateUtil; import com.engine.salary.util.SalaryI18nUtil; import com.engine.salary.util.db.MapperProxyFactory; import com.engine.salary.util.excel.ExcelComment; +import com.engine.salary.util.excel.ExcelParseHelper; import com.engine.salary.util.excel.ExcelUtil; +import com.engine.salary.util.page.PageInfo; +import com.engine.salary.util.page.SalaryPageUtil; import com.google.common.collect.Lists; +import com.google.common.collect.Maps; import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.Validate; +import org.apache.poi.util.IOUtils; import org.apache.poi.xssf.usermodel.XSSFWorkbook; +import weaver.file.ImageFileManager; import weaver.general.Util; +import weaver.hrm.User; +import java.io.InputStream; +import java.text.SimpleDateFormat; import java.time.YearMonth; import java.util.*; import java.util.stream.Collectors; +import static com.engine.salary.constant.SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY; + public class OtherDeductionServiceImpl extends Service implements OtherDeductionService { private OtherDeductionMapper getOtherDeductionMapper() { return MapperProxyFactory.getProxy(OtherDeductionMapper.class); } - - @Override - public Map getSearchCondition(Map params) { - return commandExecutor.execute(new OtherDeductionGetSearchConditionCmd(params, user)); + + private TaxAgentV2Service getTaxAgentV2Service(User user) { + return ServiceUtil.getService(TaxAgentV2ServiceImpl.class, user); + } + private AddUpDeductionService getAddUpDeductionService(User user) { + return ServiceUtil.getService(AddUpDeductionServiceImpl.class, user); + } + private SalaryEmployeeService getSalaryEmployeeService(User user) { + return ServiceUtil.getService(SalaryEmployeeServiceImpl.class, user); } @Override - public Map list(Map params) { - return commandExecutor.execute(new OtherDeductionListCmd(params, user)); + public OtherDeductionPO getById(Long id) { + return getOtherDeductionMapper().getById(id); + } + + + @Override + public PageInfo listPage(OtherDeductionQueryParam queryParam) { + long employeeId = user.getUID(); + // 未开启分权或是薪酬模块总管理员 + if (!getTaxAgentV2Service(user).isOpenDevolution() || getTaxAgentV2Service(user).isChief(employeeId)) { + SalaryPageUtil.start(queryParam.getCurrent(), queryParam.getPageSize()); + List list = getOtherDeductionMapper().list(queryParam); + return new PageInfo<>(list, OtherDeductionListDTO.class); + } else { + List taxAgentEmployees = getTaxAgentV2Service(user).listTaxAgentAndEmployee(employeeId); + List taxAgentIdsAsAdmin = getTaxAgentV2Service(user).listAllTaxAgentsAsAdmin(employeeId).stream().map(TaxAgentPO::getId).collect(Collectors.toList()); +// List lastList = getLastListByModifier(employeeId, tenantKey); + List list = getOtherDeductionMapper().list(queryParam); + + list = list.stream().filter(f -> + // 作为管理员 + taxAgentIdsAsAdmin.contains(f.getTaxAgentId()) + ).collect(Collectors.toList()); + + // 分页参数 + PageInfo dtoPage = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), OtherDeductionListDTO.class); + // 填充总数和当页数据 + dtoPage.setTotal(list.size()); + dtoPage.setList(SalaryPageUtil.subList(dtoPage.getPageNum(), dtoPage.getSize(), list)); + return dtoPage; + } } @Override - public Map preview(Map params) { - return commandExecutor.execute(new OtherDeductionPreviewCmd(params, user)); + public PageInfo recordListPage(OtherDeductionQueryParam queryParam) { + long employeeId = user.getUID(); + // 未开启分权或是薪酬模块总管理员 + if (!getTaxAgentV2Service(user).isOpenDevolution() || getTaxAgentV2Service(user).isChief(employeeId)) { + SalaryPageUtil.start(queryParam.getCurrent(), queryParam.getPageSize()); + List list = getOtherDeductionMapper().recordList(queryParam); + return new PageInfo<>(list, OtherDeductionRecordDTO.class); + } else { + List taxAgentEmployees = getTaxAgentV2Service(user).listTaxAgentAndEmployee(employeeId); + List taxAgentIdsAsAdmin = getTaxAgentV2Service(user).listAllTaxAgentsAsAdmin(employeeId).stream().map(TaxAgentPO::getId).collect(Collectors.toList()); +// List lastList = getLastListByModifier(employeeId, tenantKey); + List list = getOtherDeductionMapper().recordList(queryParam); + + list = list.stream().filter(f -> + // 作为管理员 + taxAgentIdsAsAdmin.contains(f.getTaxAgentId()) + ).collect(Collectors.toList()); + // 分页参数 + PageInfo dtoPage = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), OtherDeductionRecordDTO.class); + // 填充总数和当页数据 + dtoPage.setTotal(list.size()); + dtoPage.setList(SalaryPageUtil.subList(dtoPage.getPageNum(), dtoPage.getSize(), list)); + return dtoPage; + } } + @Override - public Map importData(Map params) { - return commandExecutor.execute(new OtherDeductionImportCmd(params, user)); + public Map preview(OtherDeductionImportParam importParam) { + Map apidatas = new HashMap(); + + //excel文件id + String imageId = Util.null2String(importParam.getImageId()); + Validate.notBlank(imageId, "imageId为空"); + + InputStream fileInputStream = null; + try { + fileInputStream = ImageFileManager.getInputStreamById(Integer.parseInt(imageId)); + List OtherDeductions = ExcelParseHelper.parse2Map(fileInputStream, OtherDeductionListDTO.class, 0, 1, 11, "OtherDeductionTemplate.xlsx"); + apidatas.put("preview", OtherDeductions); + } finally { + IOUtils.closeQuietly(fileInputStream); + } + return apidatas; } - @Override - public XSSFWorkbook export(Map params) { - OtherDeductionQueryParam OtherDeductionQueryParam = (OtherDeductionQueryParam) params.get("queryParam"); + public Map importData(OtherDeductionImportParam importParam) { + long currentEmployeeId = user.getUID(); + Map apidatas = new HashMap(); + EmployBiz employBiz = new EmployBiz(); OtherDeductionBiz OtherDeductionBiz = new OtherDeductionBiz(); - XSSFWorkbook workbook = OtherDeductionBiz.export(OtherDeductionQueryParam); - return workbook; -// return commandExecutor.execute(new OtherDeductionExportCmd(params, user)); + //检验参数 + checkImportParam(importParam); + + //excel文件id + String imageId = Util.null2String(importParam.getImageId()); + Validate.notBlank(imageId, "imageId为空"); + //税款所属期 + String declareMonthStr = Util.null2String(importParam.getDeclareMonth()); + //个税扣缴义务人 + String taxAgentId = Util.null2String(importParam.getTaxAgentId()); + + InputStream fileInputStream = null; + try { + fileInputStream = ImageFileManager.getInputStreamById(Integer.parseInt(imageId)); + List OtherDeductions = ExcelParseHelper.parse2Map(fileInputStream, OtherDeductionListDTO.class, 0, 1, 11, "OtherDeductionTemplate.xlsx"); + + int total = OtherDeductions.size(); + int index = 0; + int successCount = 0; + int errorCount = 0; + + //人员信息 + List employees = employBiz.listEmployee(); + // 获取所有个税扣缴义务人 + Collection taxAgentList = getTaxAgentV2Service(user).listTaxAgentAndEmployeeTree(currentEmployeeId); + //税款所属期 + Date declareMonth = SalaryDateUtil.stringToDate(declareMonthStr + "-01"); + // 获取已经核算的数据 + List salaryAcctEmployees = getAddUpDeductionService(user).getAccountedEmployeeData(declareMonthStr); + // 查询已有数据 + List list = getOtherDeductionMapper().listSome(OtherDeductionPO.builder().declareMonth(declareMonth).build()); + + // 错误excel内容 + List errorData = new ArrayList<>(); + //合规数据 + List eligibleData = new ArrayList<>(); + + List taxAgentEmployees = Lists.newArrayList(); + for (int i = 0; i < OtherDeductions.size(); i++) { + OtherDeductionListDTO dto = OtherDeductions.get(i); + + Date now = new Date(); + //待插入数据库对象 + OtherDeductionPO po = OtherDeductionPO.builder() + .tenantKey(DEFAULT_TENANT_KEY) + .createTime(now) + .updateTime(now) + .creator((long) user.getUID()) + .declareMonth(declareMonth).build(); + + //异常点数量 + int errorSum = 0; + + //行号 + String rowIndex = String.format("第%s行", i + 2); + + //相同的姓名 + String userName = dto.getUsername(); + String deparmentName = dto.getDepartmentName(); + List employeeSameIds = new ArrayList<>(); + + List emps = employees.stream().filter(e -> (StringUtils.isBlank(userName) || Objects.equals(e.getUsername(), userName)) + && (StringUtils.isBlank(deparmentName) || Objects.equals(e.getDepartmentName(), deparmentName))) + .collect(Collectors.toList()); + //含在职和离职,选在职数据 + if (CollectionUtils.isNotEmpty(emps) && emps.size() > 1) { + employeeSameIds = emps.stream() + .filter(e -> UserStatusEnum.getNormalStatus().contains(e.getStatus())) + .map(DataCollectionEmployee::getEmployeeId) + .collect(Collectors.toList()); + } + if (CollectionUtils.isNotEmpty(emps) && emps.size() == 1) { + employeeSameIds = emps.stream() + .map(DataCollectionEmployee::getEmployeeId) + .collect(Collectors.toList()); + } + + + if (StringUtils.isBlank(userName)) { + //姓名 不能为空 + //错误消息对象 + Map errorMessageMap = Maps.newHashMap(); + errorMessageMap.put("message", rowIndex + "姓名不能为空"); + errorData.add(errorMessageMap); + errorSum += 1; + } else if (CollectionUtils.isEmpty(employeeSameIds) || employeeSameIds.size() > 1) { + Map errorMessageMap = Maps.newHashMap(); + errorMessageMap.put("message", rowIndex + "员工信息不能为空且不可重复(姓名与部门同时确认唯一)"); + errorData.add(errorMessageMap); + errorSum += 1; + } else { + Long employeeId = CollectionUtils.isNotEmpty(employeeSameIds) && employeeSameIds.size() == 1 ? employeeSameIds.get(0) : null; + if (employeeId != null && employeeId > 0) { + po.setEmployeeId(employeeId); + } else { + //姓名错误,系统内不存在该姓名 + Map errorMessageMap = Maps.newHashMap(); + errorMessageMap.put("message", rowIndex + "姓名错误,系统内不存在该姓名"); + errorData.add(errorMessageMap); + errorSum += 1; + } + } + + + String taxAgentName = dto.getTaxAgentName(); + if (StringUtils.isBlank(taxAgentName)) { + //个税扣缴义务人不能为空 + Map errorMessageMap = Maps.newHashMap(); + errorMessageMap.put("message", rowIndex + "个税扣缴义务人不能为空"); + errorData.add(errorMessageMap); + errorSum += 1; + } else { + Optional optionalTemp = taxAgentList.stream().filter(m -> m.getTaxAgentName().equals(taxAgentName)).findFirst(); + if (optionalTemp.isPresent()) { + if (StringUtils.isNotEmpty(taxAgentId) && !optionalTemp.get().getTaxAgentId().equals(Long.valueOf(taxAgentId))) { + //个税扣缴义务人与导入时选择的不一致 + Map errorMessageMap = Maps.newHashMap(); + errorMessageMap.put("message", rowIndex + "个税扣缴义务人与导入时选择的不一致"); + errorData.add(errorMessageMap); + errorSum += 1; + } else { + po.setTaxAgentId(optionalTemp.get().getTaxAgentId()); + taxAgentEmployees = optionalTemp.get().getEmployeeList(); + } + } else { + //个税扣缴义务人不存在 + Map errorMessageMap = Maps.newHashMap(); + errorMessageMap.put("message", rowIndex + "个税扣缴义务人不存在"); + errorData.add(errorMessageMap); + errorSum += 1; + } + } + + //商业健康保险 + String businessHealthyInsurance = dto.getBusinessHealthyInsurance(); + po.setBusinessHealthyInsurance(businessHealthyInsurance); + //税延养老保险 + String taxDelayEndowmentInsurance = dto.getTaxDelayEndowmentInsurance(); + po.setTaxDelayEndowmentInsurance(taxDelayEndowmentInsurance); + //其他 + String otherDeduction = dto.getOtherDeduction(); + po.setOtherDeduction(otherDeduction); + //准予扣除的捐赠额 + String deductionAllowedDonation = dto.getDeductionAllowedDonation(); + po.setDeductionAllowedDonation(deductionAllowedDonation); + + + // 分权判断 + OtherDeductionPO finalPoE = po; + Optional optionalTaxAgentEmp = taxAgentEmployees.stream().filter(f -> f.getEmployeeId().equals(finalPoE.getEmployeeId())).findFirst(); + if (!optionalTaxAgentEmp.isPresent()) { + Map errorMessageMap = Maps.newHashMap(); + errorMessageMap.put("message", rowIndex + "该条数据不在数据权限范围内,不可导入"); + errorData.add(errorMessageMap); + errorSum += 1; + } + // 判断是否有核算过 + if (CollectionUtils.isNotEmpty(salaryAcctEmployees)) { + OtherDeductionPO finalPo = po; + Optional optionalAcctEmp = salaryAcctEmployees.stream().filter(f -> f.getEmployeeId().equals(finalPo.getEmployeeId()) && f.getTaxAgentId().equals(finalPo.getTaxAgentId())).findFirst(); + boolean isExist = list.stream().anyMatch(f -> f.getEmployeeId().equals(finalPo.getEmployeeId()) && f.getTaxAgentId().equals(finalPo.getTaxAgentId())); + if (optionalAcctEmp.isPresent() && isExist) { + Map errorMessageMap = Maps.newHashMap(); + errorMessageMap.put("message", rowIndex + "该年月这条数据已经核算过,不可导入"); + errorData.add(errorMessageMap); + errorSum += 1; + } + } + + + if (errorSum == 0) { + successCount += 1; + // 合格数据 + eligibleData.add(po); + } else { + errorCount += 1; + // 添加错误数据 + } + } + + //入库 + OtherDeductionBiz.handleImportData(eligibleData); + + apidatas.put("successCount", successCount); + apidatas.put("errorCount", errorCount); + apidatas.put("errorData", errorData); + + } finally { + IOUtils.closeQuietly(fileInputStream); + } + return apidatas; + } + + private void checkImportParam(OtherDeductionImportParam importParam) { + //excel文件id + String imageId = Util.null2String(importParam.getImageId()); + //税款所属期 + String declareMonthStr = Util.null2String(importParam.getDeclareMonth()); + //个税扣缴义务人 + String taxAgentId = Util.null2String(importParam.getTaxAgentId()); + + if (StringUtils.isBlank(imageId)) { + throw new SalaryRunTimeException("文件不存在"); + } + if (StringUtils.isBlank(declareMonthStr)) { + throw new SalaryRunTimeException("税款所属期为空"); + } } - @Override - public XSSFWorkbook exportDetail(Map params) { + /** + * 导出 + * + * @param param + * @return + */ + public XSSFWorkbook export(OtherDeductionQueryParam param) { + + //获取操作按钮资源 + List> rowList = getExcelRowList(param); + + //获取excel + return ExcelUtil.genWorkbook(rowList,"其他免税扣除"); + } + + + /** + * 获取excel数据行 + * + * @return 导出数据行集合 + */ + private List> getExcelRowList(OtherDeductionQueryParam param) { + long employeeId = user.getUID(); + //excel标题 + List title = Arrays.asList("姓名", "个税扣缴义务人", "部门", "手机号", "工号", "证件号码", "入职日期", "商业健康保险", "税延养老保险", "其他", "准予扣除的捐赠额"); + + List list = getOtherDeductionMapper().list(param); + // 开启分权并且不是薪酬模块总管理员 + if (getTaxAgentV2Service(user).isOpenDevolution() && !getTaxAgentV2Service(user).isChief(employeeId)) { +// List taxAgentEmployees = getTaxAgentV2Service(user).listTaxAgentAndEmployee(employeeId); + List taxAgentIdsAsAdmin = getTaxAgentV2Service(user).listAllTaxAgentsAsAdmin(employeeId).stream().map(TaxAgentPO::getId).collect(Collectors.toList()); + list = list.stream().filter(f -> + // 作为管理员 + taxAgentIdsAsAdmin.contains(f.getTaxAgentId()) + ).collect(Collectors.toList()); + } + + + 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.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(Util.null2String(dto.getBusinessHealthyInsurance())); + cellList.add(Util.null2String(dto.getTaxDelayEndowmentInsurance())); + cellList.add(Util.null2String(dto.getOtherDeduction())); + cellList.add(Util.null2String(dto.getDeductionAllowedDonation())); + return cellList; + }).collect(Collectors.toList())) + .orElse(Collections.emptyList()); + + List> rowList = new ArrayList<>(); + rowList.add(title); + rowList.addAll(dataRowList); + return rowList; + } + + + + /** + * 导出详情列表 + * + * @param param + * @return + */ + public XSSFWorkbook exportDetail(OtherDeductionQueryParam param) { - OtherDeductionQueryParam queryParam = (OtherDeductionQueryParam) params.get("queryParam"); OtherDeductionBiz biz = new OtherDeductionBiz(); EmployBiz employBiz = new EmployBiz(); - Long id = queryParam.getOtherTaxExemptDeductionId(); + Long id = param.getOtherTaxExemptDeductionId(); if (id == null) { throw new SalaryRunTimeException("id不能为空"); } OtherDeductionPO po = biz.getById(id); if (po == null) { - throw new SalaryRunTimeException(String.format("其他免税扣除不存在"+"[id:%s]", id)); + throw new SalaryRunTimeException(String.format("其他免税扣除不存在" + "[id:%s]", id)); } List employeeList = employBiz.getEmployeeByIds(Collections.singletonList(po.getEmployeeId())); @@ -86,26 +454,60 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction } //构建参数 - queryParam.setEmployeeId(po.getEmployeeId()); + param.setEmployeeId(po.getEmployeeId()); //申报月份 - List declareMonth = queryParam.getDeclareMonth(); + List declareMonth = param.getDeclareMonth(); if (CollectionUtils.isNotEmpty(declareMonth)) { - queryParam.setDeclareMonth(declareMonth.stream().map(e -> e + "-01 00:00:00").collect(Collectors.toList())); + param.setDeclareMonth(declareMonth.stream().map(e -> e + "-01 00:00:00").collect(Collectors.toList())); } - return biz.exportDetail(queryParam); + //获取操作按钮资源 + List> rowList = getExcelRowDetailList(param); -// return commandExecutor.execute(new OtherDeductionExportDetailCmd(params, user)); + //获取excel + return ExcelUtil.genWorkbook(rowList,"其他免税扣除明细"); } + /** + * 导出详情 + * + * @param param + * @return + */ + private List> getExcelRowDetailList(OtherDeductionQueryParam param) { + //excel标题 + List title = Arrays.asList("姓名", "申报月份", "个税扣缴义务人", "部门", "手机号", "工号", "商业健康保险", "税延养老保险", "其他", "准予扣除的捐赠额"); - @Override - public Map getDetailList(Map params) { - return commandExecutor.execute(new OtherDeductionGetDetailListCmd(params, user)); + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM"); + //查询详细信息 + List list = getOtherDeductionMapper().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.getMobile())); + cellList.add(Util.null2String(dto.getJobNum())); + cellList.add(Util.null2String(dto.getBusinessHealthyInsurance())); + cellList.add(Util.null2String(dto.getTaxDelayEndowmentInsurance())); + cellList.add(Util.null2String(dto.getOtherDeduction())); + cellList.add(Util.null2String(dto.getDeductionAllowedDonation())); + return cellList; + }).collect(Collectors.toList())) + .orElse(Collections.emptyList()); + + List> rowList = new ArrayList<>(); + rowList.add(title); + rowList.addAll(dataRowList); + return rowList; } + @Override public List getOtherDeductionList(YearMonth declareMonth, List employeeIds) { if (declareMonth == null) { @@ -118,49 +520,24 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction @Override public XSSFWorkbook downloadTemplate(OtherDeductionQueryParam param) { // 1.工作簿名称 - String sheetName = SalaryI18nUtil.getI18nLabel( 101604, "其他免税扣除导入模板"); + String sheetName = SalaryI18nUtil.getI18nLabel(101604, "其他免税扣除导入模板"); String[] header = { - SalaryI18nUtil.getI18nLabel( 85429, "姓名"), - SalaryI18nUtil.getI18nLabel( 86184, "个税扣缴义务人"), - SalaryI18nUtil.getI18nLabel( 86185, "部门"), - SalaryI18nUtil.getI18nLabel( 86186, "手机号"), - SalaryI18nUtil.getI18nLabel( 86317, "工号"), - SalaryI18nUtil.getI18nLabel( 86318, "证件号码"), - SalaryI18nUtil.getI18nLabel( 86319, "入职日期"), - SalaryI18nUtil.getI18nLabel( 91238, "商业健康保险"), - SalaryI18nUtil.getI18nLabel( 91239, "税延养老保险"), - SalaryI18nUtil.getI18nLabel( 84500, "其他"), - SalaryI18nUtil.getI18nLabel( 91240, "准予扣除的捐赠额") + SalaryI18nUtil.getI18nLabel(85429, "姓名"), + SalaryI18nUtil.getI18nLabel(86184, "个税扣缴义务人"), + SalaryI18nUtil.getI18nLabel(86185, "部门"), + SalaryI18nUtil.getI18nLabel(86186, "手机号"), + SalaryI18nUtil.getI18nLabel(86317, "工号"), + SalaryI18nUtil.getI18nLabel(86318, "证件号码"), + SalaryI18nUtil.getI18nLabel(86319, "入职日期"), + SalaryI18nUtil.getI18nLabel(91238, "商业健康保险"), + SalaryI18nUtil.getI18nLabel(91239, "税延养老保险"), + SalaryI18nUtil.getI18nLabel(84500, "其他"), + SalaryI18nUtil.getI18nLabel(91240, "准予扣除的捐赠额") }; // 2.表头 - List headerList = Arrays.asList(header); - // 获取其他免税扣除 - List list = getOtherDeductionMapper().list(param); - // 人员信息赋值 - list.stream().map(m->{ - // todo 身份证号 - m.setIdNo(""); - return m; - }).collect(Collectors.toList()); - List> rows = new ArrayList<>(); + List headerList = Arrays.asList(header); rows.add(headerList); - for (OtherDeductionListDTO dto : list) { - List row = new ArrayList<>(); - row.add(Util.null2String(dto.getUsername())); - row.add(Util.null2String(dto.getTaxAgentName())); - row.add(Util.null2String(dto.getDepartmentName())); - row.add(Util.null2String(dto.getMobile())); - row.add(Util.null2String(dto.getJobNum())); - row.add(Util.null2String(dto.getIdNo())); - row.add(Util.null2String(dto.getHiredate())); - row.add(Util.null2String(dto.getBusinessHealthyInsurance())); - row.add(Util.null2String(dto.getTaxDelayEndowmentInsurance())); - row.add(Util.null2String(dto.getOtherDeduction())); - row.add(Util.null2String(dto.getDeductionAllowedDonation())); - rows.add(row); - } - // 3.表数据 // 4.注释 List excelComments = Lists.newArrayList(); diff --git a/src/com/engine/salary/service/impl/SISchemeServiceImpl.java b/src/com/engine/salary/service/impl/SISchemeServiceImpl.java index 8cc50abc2..31d94aae8 100644 --- a/src/com/engine/salary/service/impl/SISchemeServiceImpl.java +++ b/src/com/engine/salary/service/impl/SISchemeServiceImpl.java @@ -17,7 +17,7 @@ import com.engine.salary.entity.sischeme.param.InsuranceSchemeParam; import com.engine.salary.entity.sischeme.param.SISchemaImportParam; import com.engine.salary.entity.sischeme.po.InsuranceSchemeDetailPO; import com.engine.salary.entity.sischeme.po.InsuranceSchemePO; -import com.engine.salary.entity.taxrate.TaxAgent; +import com.engine.salary.entity.taxagent.dto.TaxAgentListDTO; import com.engine.salary.enums.sicategory.*; import com.engine.salary.mapper.siarchives.FundSchemeMapper; import com.engine.salary.mapper.siarchives.OtherSchemeMapper; @@ -27,7 +27,7 @@ import com.engine.salary.mapper.sischeme.InsuranceSchemeDetailMapper; import com.engine.salary.mapper.sischeme.InsuranceSchemeMapper; import com.engine.salary.service.SIImportService; import com.engine.salary.service.SISchemeService; -import com.engine.salary.service.TaxAgentService; +import com.engine.salary.service.TaxAgentV2Service; import com.engine.salary.util.*; import com.engine.salary.util.db.MapperProxyFactory; import com.engine.salary.util.excel.ExcelParseHelper; @@ -84,8 +84,8 @@ public class SISchemeServiceImpl extends Service implements SISchemeService { } - private TaxAgentService getTaxAgentService() { - return ServiceUtil.getService(TaxAgentServiceImpl.class, user); + private TaxAgentV2Service getTaxAgentService() { + return ServiceUtil.getService(TaxAgentV2ServiceImpl.class, user); } private InsuranceSchemeDetailMapper getInsuranceSchemeDetailMapper() { @@ -537,7 +537,7 @@ public class SISchemeServiceImpl extends Service implements SISchemeService { Map schemeNameIdMap = schemeNameIdMap(); Map welfareMap = welfareMap(); // 获取所有个税扣缴义务人的名称和id的map - Map paymentNameIdMap = getTaxAgentService().findAll().stream().collect(Collectors.toMap(TaxAgent::getName, TaxAgent::getId)); + Map paymentNameIdMap = getTaxAgentService().findAll().stream().collect(Collectors.toMap(TaxAgentListDTO::getName, TaxAgentListDTO::getId)); // 获取所有人员信息 // 获取租户下所有的人员 List employeeByIds = employeeBiz.listEmployee(); diff --git a/src/com/engine/salary/service/impl/SalaryAcctExcelServiceImpl.java b/src/com/engine/salary/service/impl/SalaryAcctExcelServiceImpl.java index f198f20f5..66b11b919 100644 --- a/src/com/engine/salary/service/impl/SalaryAcctExcelServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalaryAcctExcelServiceImpl.java @@ -3,7 +3,6 @@ package com.engine.salary.service.impl; import com.cloudstore.eccom.pc.table.WeaTableColumn; import com.engine.common.util.ServiceUtil; import com.engine.core.impl.Service; -import com.engine.salary.biz.TaxAgentBiz; import com.engine.salary.component.WeaTableColumnGroup; import com.engine.salary.constant.SalaryDefaultTenantConstant; import com.engine.salary.entity.datacollection.DataCollectionEmployee; @@ -23,7 +22,7 @@ import com.engine.salary.entity.salarysob.dto.SalarySobItemDTO; import com.engine.salary.entity.salarysob.dto.SalarySobItemGroupDTO; import com.engine.salary.entity.salarysob.po.SalarySobEmpFieldPO; import com.engine.salary.entity.salarysob.po.SalarySobItemPO; -import com.engine.salary.entity.taxrate.TaxAgent; +import com.engine.salary.entity.taxagent.po.TaxAgentPO; import com.engine.salary.enums.SalaryValueTypeEnum; import com.engine.salary.exception.SalaryRunTimeException; import com.engine.salary.service.*; @@ -96,7 +95,9 @@ public class SalaryAcctExcelServiceImpl extends Service implements SalaryAcctExc return (SalaryComparisonResultService) ServiceUtil.getService(SalaryComparisonResultServiceImpl.class, user); } - private TaxAgentBiz taxAgentService = new TaxAgentBiz(); + private TaxAgentV2Service getTaxAgentService(User user) { + return ServiceUtil.getService(TaxAgentV2ServiceImpl.class, user); + } private SalaryEmployeeService getSalaryEmployeeService(User user) { @@ -185,7 +186,7 @@ public class SalaryAcctExcelServiceImpl extends Service implements SalaryAcctExc List simpleEmployees = getSalaryEmployeeService(user).listByIds(employeeIds); // 个税扣缴义务人 List taxAgentIds = tempList.stream().map(SalaryAcctEmployeePO::getTaxAgentId).distinct().collect(Collectors.toList()); - List taxAgents = taxAgentService.listByIds(taxAgentIds); + List taxAgents = getTaxAgentService(user).listByIds(taxAgentIds); // 转换成列表数据 salaryAccEmployeeListDTOS.addAll(SalaryAcctEmployeeBO.convert2EmployeeListDTO(tempList, taxAgents, simpleEmployees)); } @@ -483,8 +484,8 @@ public class SalaryAcctExcelServiceImpl extends Service implements SalaryAcctExc List salaryEmployees = getSalaryEmployeeService(user).listAll(); Map salaryEmployeeMap = SalaryEntityUtil.convert2Map(salaryEmployees, DataCollectionEmployee::getUsername, DataCollectionEmployee::getEmployeeId); // 租户下所有的个税扣缴义务人 - List taxAgents = taxAgentService.listAll(); - Map taxAgentNameMap = SalaryEntityUtil.convert2Map(taxAgents, TaxAgent::getName, TaxAgent::getId); + List taxAgents = getTaxAgentService(user).listAll(); + Map taxAgentNameMap = SalaryEntityUtil.convert2Map(taxAgents, TaxAgentPO::getName, TaxAgentPO::getId); // 索引(用于计算进度) int index = 0; diff --git a/src/com/engine/salary/service/impl/SalaryAcctResultServiceImpl.java b/src/com/engine/salary/service/impl/SalaryAcctResultServiceImpl.java index 0a3d9c736..6c6d0e97a 100644 --- a/src/com/engine/salary/service/impl/SalaryAcctResultServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalaryAcctResultServiceImpl.java @@ -2,7 +2,6 @@ package com.engine.salary.service.impl; import com.engine.common.util.ServiceUtil; import com.engine.core.impl.Service; -import com.engine.salary.biz.TaxAgentBiz; import com.engine.salary.cache.SalaryCacheKey; import com.engine.salary.common.LocalDateRange; import com.engine.salary.entity.datacollection.DataCollectionEmployee; @@ -28,7 +27,7 @@ import com.engine.salary.entity.salarysob.po.SalarySobAdjustRulePO; import com.engine.salary.entity.salarysob.po.SalarySobEmpFieldPO; import com.engine.salary.entity.salarysob.po.SalarySobItemPO; import com.engine.salary.entity.salarysob.po.SalarySobPO; -import com.engine.salary.entity.taxrate.TaxAgent; +import com.engine.salary.entity.taxagent.po.TaxAgentPO; import com.engine.salary.enums.salaryaccounting.SalaryAcctRecordStatusEnum; import com.engine.salary.enums.salarysob.IncomeCategoryEnum; import com.engine.salary.exception.SalaryRunTimeException; @@ -96,7 +95,9 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe return (SalaryAcctRecordService) ServiceUtil.getService(SalaryAcctRecordServiceImpl.class, user); } - private TaxAgentBiz taxAgentService = new TaxAgentBiz(); + private TaxAgentV2Service getTaxAgentService(User user) { + return ServiceUtil.getService(TaxAgentV2ServiceImpl.class, user); + } private SalaryEmployeeService getSalaryEmployeeService(User user) { return (SalaryEmployeeService) ServiceUtil.getService(SalaryEmployeeServiceImpl.class, user); @@ -183,7 +184,7 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe // 查询薪资核算结果 List salaryAcctResultPOS = listBySalaryAcctEmployeeId(salaryAcctEmployeeId); // 查询个税扣缴义务人 - TaxAgent taxAgent = taxAgentService.getById(salaryAcctEmployeePO.getTaxAgentId()); + TaxAgentPO taxAgent = getTaxAgentService(user).getById(salaryAcctEmployeePO.getTaxAgentId()); // 转换成薪资核算结果详情dto return SalaryAcctResultBO.convert2DetailDTO(simpleEmployee, taxAgent, salaryAcctEmployeePO, salarySobEmpFieldPOS, salarySobItemPOS, salaryItemPOS, salaryAcctResultPOS); } @@ -242,7 +243,7 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe List simpleEmployees = getSalaryEmployeeService(user).listByIds(employeeIds); // 查询个税扣缴义务人 Set taxAgentIds = SalaryEntityUtil.properties(salaryAcctEmployeePOS, SalaryAcctEmployeePO::getTaxAgentId); - List taxAgentPOS = taxAgentService.listByIds(taxAgentIds); + List taxAgentPOS = getTaxAgentService(user).listByIds(taxAgentIds); // 判断是否存在合并计税 Set salaryAcctEmployeeIds4ConsolidatedTax; if (StringUtils.isNotEmpty(queryParam.getConsolidatedTaxation())) { @@ -281,7 +282,7 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98831, "薪资核算人员不存在或已被删除")); } // 查询当前的薪资核算人员的个税扣缴义务人 - TaxAgent taxAgentPO = taxAgentService.getById(salaryAcctEmployeePO.getTaxAgentId()); + TaxAgentPO taxAgentPO = getTaxAgentService(user).getById(salaryAcctEmployeePO.getTaxAgentId()); // 查询当前的薪资核算人员的人员信息 DataCollectionEmployee simpleEmployee = getSalaryEmployeeService(user).getEmployeeById(salaryAcctEmployeePO.getEmployeeId()); // 查询当前的薪资核算记录 @@ -343,7 +344,7 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe // 查询人员信息 DataCollectionEmployee simpleEmployee = getSalaryEmployeeService(user).getEmployeeById(salaryAcctEmployeePO.getEmployeeId()); // 查询个税扣缴义务人 - TaxAgent taxAgentPO = taxAgentService.getById(salaryAcctEmployeePO.getTaxAgentId()); +// TaxAgentPO taxAgentPO = getTaxAgentService(user).getById(salaryAcctEmployeePO.getTaxAgentId()); // 记录日志 // String operateDesc = simpleEmployee.getUsername() + "(" + Optional.ofNullable(taxAgentPO).map(TaxAgentPO::getName).orElse(StringUtils.EMPTY) + ")"; // LoggerContext loggerContext = new LoggerContext<>(); diff --git a/src/com/engine/salary/service/impl/SalaryArchiveServiceImpl.java b/src/com/engine/salary/service/impl/SalaryArchiveServiceImpl.java index 8734d2c17..ece53ce2a 100644 --- a/src/com/engine/salary/service/impl/SalaryArchiveServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalaryArchiveServiceImpl.java @@ -1,5 +1,6 @@ package com.engine.salary.service.impl; +import com.engine.common.util.ServiceUtil; import com.engine.core.impl.Service; import com.engine.salary.biz.*; import com.engine.salary.common.LocalDateRange; @@ -17,13 +18,14 @@ import com.engine.salary.entity.salaryarchive.po.SalaryArchiveItemPO; import com.engine.salary.entity.salaryarchive.po.SalaryArchivePO; import com.engine.salary.entity.salaryarchive.po.SalaryArchiveTaxAgentPO; import com.engine.salary.entity.salaryitem.po.SalaryItemPO; -import com.engine.salary.entity.taxrate.TaxAgent; +import com.engine.salary.entity.taxagent.po.TaxAgentPO; import com.engine.salary.enums.UserStatusEnum; import com.engine.salary.enums.salaryarchive.SalaryArchiveImportTypeEnum; import com.engine.salary.enums.salaryarchive.SalaryArchiveItemAdjustReasonEnum; import com.engine.salary.enums.salaryarchive.SalaryArchiveTaxAgentAdjustReasonEnum; import com.engine.salary.exception.SalaryRunTimeException; import com.engine.salary.service.SalaryArchiveService; +import com.engine.salary.service.TaxAgentV2Service; import com.engine.salary.util.SalaryDateUtil; import com.engine.salary.util.SalaryI18nUtil; import com.engine.salary.util.excel.ExcelComment; @@ -42,11 +44,11 @@ import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.util.IOUtils; import org.apache.poi.xssf.usermodel.XSSFWorkbook; import weaver.file.ImageFileManager; +import weaver.hrm.User; import java.io.InputStream; import java.text.SimpleDateFormat; import java.util.*; -import java.util.concurrent.ExecutorService; import java.util.concurrent.atomic.AtomicInteger; import java.util.stream.Collectors; @@ -70,9 +72,9 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe private SalaryItemBiz salaryItemMapper = new SalaryItemBiz(); - // private SalaryBatchService salaryBatchService; - private TaxAgentBiz taxAgentService = new TaxAgentBiz(); - private ExecutorService taskExecutor; + private TaxAgentV2Service getTaxAgentService(User user) { + return ServiceUtil.getService(TaxAgentV2ServiceImpl.class, user); + } @Override public SalaryArchivePO getById(Long salaryArchiveId) { @@ -125,7 +127,7 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe */ @Override public List> buildSalaryArchiveData(Collection salaryArchives, - Collection taxAgentLists, + Collection taxAgentLists, List salaryItems, Boolean isPage) { // 分页用于表格展示,否则用于导出 @@ -149,7 +151,7 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe Map map = Maps.newHashMap(); map.put("salaryArchiveId", m.getSalaryArchiveId()); map.put("taxAgentId", m.getTaxAgentId()); - Optional optional = taxAgentLists.stream().filter(f -> f.getId().equals(m.getTaxAgentId())).findFirst(); + Optional optional = taxAgentLists.stream().filter(f -> f.getId().equals(m.getTaxAgentId())).findFirst(); map.put("taxAgentName", optional.isPresent() ? optional.get().getName() : ""); map.put("taxAgentEffectiveTime", m.getEffectiveTime()); return map; @@ -202,7 +204,7 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe } // 获取所有个税扣缴义务人 - Collection taxAgentList = taxAgentService.listAll(); + Collection taxAgentList = getTaxAgentService(user).listAll(); Collection salaryArchives = SalaryArchiveMapper.list(queryParam); List> listMaps = buildSalaryArchiveData(salaryArchives, taxAgentList, salaryItems, Boolean.FALSE); // 组装数据 @@ -267,7 +269,7 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe } // 获取所有个税扣缴义务人 - Collection taxAgentList = taxAgentService.listAll(); + Collection taxAgentList = getTaxAgentService(user).listAll(); Collection salaryArchives = SalaryArchiveMapper.list(queryParam); List> listMaps = buildSalaryArchiveData(salaryArchives, taxAgentList, salaryItems, Boolean.FALSE); // 组装数据 @@ -524,7 +526,7 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe // 获取租户下所有的人员 .employees(employBiz.listEmployee()) // 获取所有个税扣缴义务人 - .taxAgentList(taxAgentService.listAll()) + .taxAgentList(getTaxAgentService(user).listAll()) .salaryItems(salaryItems) // 查询已有的薪资档案基本数据 .salaryArchives(SalaryArchiveMapper.list(SalaryArchiveQueryParam.builder().build())) @@ -721,8 +723,8 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe String taxAgentCellVal = Optional.ofNullable(map.get(taxAgentI18n)).orElse("").toString(); // 用于初始化导入的同一个人的记录校验 map.put("taxAgent", taxAgentCellVal); - Optional optionalTaxAgent = importHandleParam.getTaxAgentList().stream().filter(m -> m.getName().equals(taxAgentCellVal)).findFirst(); - Long taxAgentId = optionalTaxAgent.map(TaxAgent::getId).orElse(null); + Optional optionalTaxAgent = importHandleParam.getTaxAgentList().stream().filter(m -> m.getName().equals(taxAgentCellVal)).findFirst(); + Long taxAgentId = optionalTaxAgent.map(TaxAgentPO::getId).orElse(null); // 4.调整原因 String adjustReason = ""; if (isTaxAgentAdjust) { diff --git a/src/com/engine/salary/service/impl/SalaryArchiveTaxAgentServiceImpl.java b/src/com/engine/salary/service/impl/SalaryArchiveTaxAgentServiceImpl.java index ee8b7dc3a..f4016e359 100644 --- a/src/com/engine/salary/service/impl/SalaryArchiveTaxAgentServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalaryArchiveTaxAgentServiceImpl.java @@ -1,7 +1,7 @@ package com.engine.salary.service.impl; +import com.engine.common.util.ServiceUtil; import com.engine.core.impl.Service; -import com.engine.salary.biz.TaxAgentBiz; import com.engine.salary.constant.SalaryDefaultTenantConstant; import com.engine.salary.entity.salaryarchive.dto.TaxAgentAdjustRecordListDTO; import com.engine.salary.entity.salaryarchive.param.SalaryArchiveTaxAgentQueryParam; @@ -9,13 +9,14 @@ import com.engine.salary.entity.salaryarchive.param.SalaryArchiveTaxAgentSavePar import com.engine.salary.entity.salaryarchive.param.TaxAgentAdjustRecordQueryParam; import com.engine.salary.entity.salaryarchive.po.SalaryArchivePO; import com.engine.salary.entity.salaryarchive.po.SalaryArchiveTaxAgentPO; -import com.engine.salary.entity.taxrate.TaxAgent; +import com.engine.salary.entity.taxagent.po.TaxAgentPO; import com.engine.salary.enums.UserStatusEnum; import com.engine.salary.enums.salaryarchive.SalaryArchiveTaxAgentAdjustReasonEnum; import com.engine.salary.exception.SalaryRunTimeException; import com.engine.salary.mapper.archive.SalaryArchiveMapper; import com.engine.salary.mapper.archive.SalaryArchiveTaxAgentMapper; import com.engine.salary.service.SalaryArchiveTaxAgentService; +import com.engine.salary.service.TaxAgentV2Service; import com.engine.salary.util.SalaryI18nUtil; import com.engine.salary.util.db.MapperProxyFactory; import com.engine.salary.util.excel.ExcelUtil; @@ -27,6 +28,7 @@ import org.apache.commons.lang3.StringUtils; import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import weaver.hrm.User; import java.text.SimpleDateFormat; import java.util.*; @@ -46,7 +48,9 @@ public class SalaryArchiveTaxAgentServiceImpl extends Service implements SalaryA return MapperProxyFactory.getProxy(SalaryArchiveTaxAgentMapper.class); } - private TaxAgentBiz taxAgentService = new TaxAgentBiz(); + private TaxAgentV2Service getTaxAgentService(User user) { + return ServiceUtil.getService(TaxAgentV2ServiceImpl.class, user); + } // private SalaryBatchService salaryBatchService; @Override @@ -210,7 +214,7 @@ public class SalaryArchiveTaxAgentServiceImpl extends Service implements SalaryA List list = getSalaryArchiveTaxAgentMapper().taxAgentAdjustRecordList(queryParam); List listAll = getSalaryArchiveTaxAgentMapper().taxAgentAdjustRecordList(TaxAgentAdjustRecordQueryParam.builder().build()); // 个税扣缴义务人 - Collection taxAgentList = taxAgentService.listAll(); + Collection taxAgentList = getTaxAgentService(user).listAll(); // 人员信息赋值 list.forEach(m -> { if (!org.springframework.util.CollectionUtils.isEmpty(listAll)) { @@ -218,9 +222,9 @@ public class SalaryArchiveTaxAgentServiceImpl extends Service implements SalaryA } Optional optional = listAll.stream().filter(f -> f.getSalaryArchiveId().equals(m.getSalaryArchiveId())).findFirst(); m.setAdjustBefore(optional.isPresent() ? optional.get().getAdjustAfter() : ""); - Optional optionalBefore = taxAgentList.stream().filter(t -> t.getId().toString().equals(m.getAdjustBefore())).findFirst(); + Optional optionalBefore = taxAgentList.stream().filter(t -> t.getId().toString().equals(m.getAdjustBefore())).findFirst(); m.setAdjustBefore(optionalBefore.isPresent() ? optionalBefore.get().getName() : ""); - Optional optionalAfter = taxAgentList.stream().filter(t -> t.getId().toString().equals(m.getAdjustAfter())).findFirst(); + Optional optionalAfter = taxAgentList.stream().filter(t -> t.getId().toString().equals(m.getAdjustAfter())).findFirst(); m.setAdjustAfter(optionalAfter.isPresent() ? optionalAfter.get().getName() : ""); m.setEmployeeStatus(UserStatusEnum.getDefaultLabelByValue(Integer.parseInt(m.getEmployeeStatus()))); diff --git a/src/com/engine/salary/service/impl/SalaryComparisonResultServiceImpl.java b/src/com/engine/salary/service/impl/SalaryComparisonResultServiceImpl.java index 2bd9003fc..3aa4888bb 100644 --- a/src/com/engine/salary/service/impl/SalaryComparisonResultServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalaryComparisonResultServiceImpl.java @@ -2,7 +2,6 @@ package com.engine.salary.service.impl; import com.engine.common.util.ServiceUtil; import com.engine.core.impl.Service; -import com.engine.salary.biz.TaxAgentBiz; import com.engine.salary.entity.datacollection.DataCollectionEmployee; import com.engine.salary.entity.salaryacct.bo.SalaryAcctResultBO; import com.engine.salary.entity.salaryacct.dto.SalaryComparisonResultListDTO; @@ -20,7 +19,7 @@ import com.engine.salary.entity.salarysob.po.SalarySobEmpFieldPO; import com.engine.salary.entity.salarysob.po.SalarySobItemGroupPO; import com.engine.salary.entity.salarysob.po.SalarySobItemPO; import com.engine.salary.entity.salarysob.po.SalarySobPO; -import com.engine.salary.entity.taxrate.TaxAgent; +import com.engine.salary.entity.taxagent.po.TaxAgentPO; import com.engine.salary.exception.SalaryRunTimeException; import com.engine.salary.mapper.salaryacct.ExcelAcctResultMapper; import com.engine.salary.service.*; @@ -79,7 +78,10 @@ public class SalaryComparisonResultServiceImpl extends Service implements Salary return (SalaryEmployeeService) ServiceUtil.getService(SalaryEmployeeServiceImpl.class, user); } - private TaxAgentBiz taxAgentService = new TaxAgentBiz(); + + private TaxAgentV2Service getTaxAgentService(User user) { + return ServiceUtil.getService(TaxAgentV2ServiceImpl.class, user); + } private SalaryFormulaService getSalaryFormulaService(User user) { return (SalaryFormulaService)ServiceUtil.getService(SalaryFormulaServiceImpl.class,user); @@ -189,7 +191,7 @@ public class SalaryComparisonResultServiceImpl extends Service implements Salary // 查询个税扣缴义务人 Set taxAgentIds = SalaryEntityUtil.properties(salaryAcctEmployeePOS, SalaryAcctEmployeePO::getTaxAgentId); - List taxAgentPOS = taxAgentService.listByIds(taxAgentIds); + List taxAgentPOS = getTaxAgentService(user).listByIds(taxAgentIds); // 查询人员信息 List employeeIds = SalaryEntityUtil.properties(salaryAcctEmployeePOS, SalaryAcctEmployeePO::getEmployeeId, Collectors.toList()); List simpleEmployees = getSalaryEmployeeService(user).listByIds(employeeIds); diff --git a/src/com/engine/salary/service/impl/SalarySendServiceImpl.java b/src/com/engine/salary/service/impl/SalarySendServiceImpl.java index 68f5083f5..232feb314 100644 --- a/src/com/engine/salary/service/impl/SalarySendServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalarySendServiceImpl.java @@ -22,7 +22,7 @@ import com.engine.salary.entity.salaryacct.po.SalaryAcctResultPO; import com.engine.salary.entity.salaryformula.dto.SalaryFormulaEmployeeDTO; import com.engine.salary.entity.salarysob.dto.SalarySobCycleDTO; import com.engine.salary.entity.salarysob.po.SalarySobPO; -import com.engine.salary.entity.taxrate.TaxAgent; +import com.engine.salary.entity.taxagent.po.TaxAgentPO; import com.engine.salary.enums.salaryaccounting.SalaryAcctRecordStatusEnum; import com.engine.salary.enums.salarybill.SalarySendStatusEnum; import com.engine.salary.exception.SalaryRunTimeException; @@ -93,8 +93,8 @@ public class SalarySendServiceImpl extends Service implements SalarySendService return SqlProxyHandle.getProxy(SalaryAcctResultMapper.class); } - private TaxAgentService getTaxAgentService(User user) { - return ServiceUtil.getService(TaxAgentServiceImpl.class, user); + private TaxAgentV2Service getTaxAgentService(User user) { + return ServiceUtil.getService(TaxAgentV2ServiceImpl.class, user); } private SalaryEmployeeService getSalaryEmployeeService(User user) { @@ -382,9 +382,9 @@ public class SalarySendServiceImpl extends Service implements SalarySendService } }); }); - TaxAgent byId = getTaxAgentService(user).getById(salarySendInfo.getTaxAgentId()); + TaxAgentPO taxAgentPO = getTaxAgentService(user).getById(salarySendInfo.getTaxAgentId()); DataCollectionEmployee simpleEmployee = getSalaryEmployeeService(user).getEmployeeById(salarySendInfo.getEmployeeId()); - buildEmployeeInfo(employeeInformation, simpleEmployee, byId.getName(), SalaryAcctResultBO.buildEmployeeFieldName()); + buildEmployeeInfo(employeeInformation, simpleEmployee, taxAgentPO.getName(), SalaryAcctResultBO.buildEmployeeFieldName()); map.put("employeeInformation", employeeInformation); map.put("salaryGroups", itemSetListDTOS); diff --git a/src/com/engine/salary/service/impl/SalarySobServiceImpl.java b/src/com/engine/salary/service/impl/SalarySobServiceImpl.java index 4e3b97b72..becd09ee9 100644 --- a/src/com/engine/salary/service/impl/SalarySobServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalarySobServiceImpl.java @@ -16,17 +16,23 @@ import com.engine.salary.entity.salarysob.dto.SalarySobCycleDTO; import com.engine.salary.entity.salarysob.param.SalarySobBasicSaveParam; import com.engine.salary.entity.salarysob.param.SalarySobDisableParam; import com.engine.salary.entity.salarysob.param.SalarySobDuplicateParam; +import com.engine.salary.entity.salarysob.param.SalarySobListQueryParam; import com.engine.salary.entity.salarysob.po.*; +import com.engine.salary.entity.taxagent.po.TaxAgentAdminPO; +import com.engine.salary.entity.taxagent.po.TaxAgentPO; import com.engine.salary.enums.SalarySystemTypeEnum; import com.engine.salary.enums.salarysob.IncomeCategoryEnum; import com.engine.salary.exception.SalaryRunTimeException; import com.engine.salary.service.*; import com.engine.salary.util.SalaryEntityUtil; import com.engine.salary.util.SalaryI18nUtil; +import com.engine.salary.util.page.PageInfo; +import com.engine.salary.util.page.SalaryPageUtil; import com.engine.salary.util.valid.RuntimeTypeEnum; import com.engine.salary.util.valid.ValidUtil; import com.google.common.collect.Lists; import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang3.BooleanUtils; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.math.NumberUtils; import org.springframework.beans.BeanUtils; @@ -59,21 +65,32 @@ public class SalarySobServiceImpl extends Service implements SalarySobService { private SalaryItemService getSalaryItemService(User user) { - return (SalaryItemService) ServiceUtil.getService(SalaryItemServiceImpl.class, user); + return ServiceUtil.getService(SalaryItemServiceImpl.class, user); } private SysSalaryItemService getSysSalaryItemService(User user) { - return (SysSalaryItemService) ServiceUtil.getService(SysSalaryItemServiceImpl.class, user); + return ServiceUtil.getService(SysSalaryItemServiceImpl.class, user); } + private SalarySobAdjustRuleBiz salarySobAdjustRuleService = new SalarySobAdjustRuleBiz(); private SalarySobCheckRuleService getSalarySobCheckRuleService(User user) { - return (SalarySobCheckRuleService) ServiceUtil.getService(SalarySobCheckRuleServiceImpl.class, user); + return ServiceUtil.getService(SalarySobCheckRuleServiceImpl.class, user); } + private SalaryAcctRecordService getSalaryAcctRecordService(User user) { - return (SalaryAcctRecordService) ServiceUtil.getService(SalaryAcctRecordServiceImpl.class, user); + return ServiceUtil.getService(SalaryAcctRecordServiceImpl.class, user); } + private TaxAgentV2Service getTaxAgentService(User user) { + return ServiceUtil.getService(TaxAgentV2ServiceImpl.class, user); + } + + private TaxAgentAdminService getTaxAgentAdminService(User user) { + return ServiceUtil.getService(TaxAgentAdminServiceImpl.class, user); + } + + @Override public SalarySobPO getById(Long id) { return salarySobMapper.getById(id); @@ -113,18 +130,41 @@ public class SalarySobServiceImpl extends Service implements SalarySobService { return salarySobMapper.listSome(SalarySobPO.builder().incomeCategory(incomeCategory.getValue()).build()); } -// @Override -// public Page listPageByParam(SalarySobListQueryParam queryParam, String tenantKey) { -// // 分页参数 -// Page page = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize()); -// // 查询薪资账套 -// return new LambdaQueryChainWrapper<>(salarySobMapper) -// .eq(SalarySobPO::getTenantKey, tenantKey) -// .eq(SalarySobPO::getDeleteType, 0) -// .like(StringUtils.isNotEmpty(queryParam.getName()), SalarySobPO::getName, queryParam.getName()) -// .orderByDesc(SalarySobPO::getId) -// .page(page); -// } + @Override + public PageInfo listPageByParam(SalarySobListQueryParam queryParam) { + long employeeId = user.getUID(); + // 分页参数 + PageInfo page = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize()); + // 判断是否是“总管理员” + Boolean isChief = getTaxAgentService(user).isChief(employeeId); + // 是否开启分权 + Boolean openDevolution = getTaxAgentService(user).isOpenDevolution(); + // 总管理员拥有全部权限 + // 开启分权后需要过滤薪资账套 + String name = queryParam.getName(); + // 查询所有的薪资账套 + SalarySobPO build = SalarySobPO.builder().build(); + if (StringUtils.isNotBlank(name)) { + build.setName(name); + } + if (BooleanUtils.isTrue(openDevolution) && !isChief) { + List salarySobPOS = salarySobMapper.listSome(build); + + // 根据权限过滤 + List salarySobsFilterByAuthority = filterByAuthority(salarySobPOS); + if (CollectionUtils.isEmpty(salarySobsFilterByAuthority)) { + return page; + } + List subSalarySobs = SalaryPageUtil.subList((int) page.getPageNum(), (int) page.getSize(), salarySobsFilterByAuthority); + page.setTotal(salarySobsFilterByAuthority.size()); + page.setList(subSalarySobs); + return page; + }else{ + SalaryPageUtil.start(queryParam.getCurrent(), queryParam.getPageSize()); + List salarySobPOS = salarySobMapper.listSome(build); + return new PageInfo<>(salarySobPOS,SalarySobPO.class); + } + } @Override public Long save(SalarySobBasicSaveParam saveParam) { @@ -363,7 +403,7 @@ public class SalarySobServiceImpl extends Service implements SalarySobService { .attendCycleFromDay(salarySobPO.getAttendCycleFromDay()) .socialSecurityCycleType(salarySobPO.getSocialSecurityCycleType()) .disable(salarySobPO.getDisable()) - .creator((long)user.getUID()) + .creator((long) user.getUID()) .createTime(new Date()) .updateTime(new Date()) .tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY) @@ -373,7 +413,7 @@ public class SalarySobServiceImpl extends Service implements SalarySobService { // 复制 SalarySobDuplicateBO salarySobDuplicateBO = new SalarySobDuplicateBO(newSalarySob, salarySobEmpFieldPOS, salarySobItemPOS, salarySobItemGroupPOS, salarySobAdjustRulePOS, salarySobCheckRulePOS); - SalarySobDuplicateBO.Result result = salarySobDuplicateBO.duplicate((long)user.getUID()); + SalarySobDuplicateBO.Result result = salarySobDuplicateBO.duplicate((long) user.getUID()); // 复制薪资账套的员工信息字段 if (CollectionUtils.isNotEmpty(result.getSalarySobEmpFields())) { salarySobEmpFieldService.batchInsert(result.getSalarySobEmpFields()); @@ -413,4 +453,37 @@ public class SalarySobServiceImpl extends Service implements SalarySobService { } return SalarySobCycleBO.buildSalarySobCycle(salarySobPO, salaryMonth); } + + @Override + public List filterByAuthority(List salarySobPOS) { + long employeeId = user.getUID(); + // 判断是否是“总管理员” + Boolean isChief = getTaxAgentService(user).isChief(employeeId); + // 是否开启分权 + Boolean openDevolution = getTaxAgentService(user).isOpenDevolution(); + // 开启分权后 + // 总管理员都能看见 + // 管理员可以看见自己创建的+自己下面的分管理员创建的 + // 分管理员只能看见自己创建的 + if (!openDevolution || isChief) { + return salarySobPOS; + } + // 查询所有的个税扣缴义务人 + List taxAgentPOS = getTaxAgentService(user).listAll(); + Set allTaxAgentIds = SalaryEntityUtil.properties(taxAgentPOS, TaxAgentPO::getId); + // 查询个税扣缴义务人的管理员 + List taxAgentAdminPOS = getTaxAgentAdminService(user).listByTaxAgentIds(allTaxAgentIds); + Map> adminMap = SalaryEntityUtil.group2Map(taxAgentAdminPOS, TaxAgentAdminPO::getEmployeeId, TaxAgentAdminPO::getTaxAgentId); + // 查询个税扣缴义务人的分管理员 +// List taxAgentSubAdminPOS = taxAgentSubAdminService.listByTaxAgentIds(allTaxAgentIds, tenantKey); +// Map> subAdminMap = SalaryEntityUtil.group2Map(taxAgentSubAdminPOS, TaxAgentSubAdminPO::getTaxAgentId, TaxAgentSubAdminPO::getEmployeeId); + return salarySobPOS.stream().filter(salarySobPO -> { + Set taxAgentIds = adminMap.get(employeeId); + if (CollectionUtils.isEmpty(taxAgentIds)) { + return false; + } + return taxAgentIds.contains(salarySobPO.getTaxAgentId()); + }).collect(Collectors.toList()); + } + } diff --git a/src/com/engine/salary/service/impl/TaxAgentManageRangeServiceImpl.java b/src/com/engine/salary/service/impl/TaxAgentManageRangeServiceImpl.java index f4c1e3b4f..d5790219d 100644 --- a/src/com/engine/salary/service/impl/TaxAgentManageRangeServiceImpl.java +++ b/src/com/engine/salary/service/impl/TaxAgentManageRangeServiceImpl.java @@ -38,7 +38,6 @@ import org.springframework.transaction.annotation.Transactional; import weaver.hrm.User; import java.util.*; -import java.util.concurrent.ExecutorService; import java.util.stream.Collectors; /** @@ -80,7 +79,6 @@ public class TaxAgentManageRangeServiceImpl extends Service implements TaxAgentM return MapperProxyFactory.getProxy(EmployMapper.class); } - private ExecutorService taskExecutor; private EmployBiz employBiz = new EmployBiz(); // private HrmCommonHrmStatusService hrmCommonHrmStatusService; @@ -392,16 +390,22 @@ public class TaxAgentManageRangeServiceImpl extends Service implements TaxAgentM } /** 同步本地人员范围的关联人员=========================== */ - taskExecutor.execute(() -> { - try { - syncLocalEmp(saveParam.getTaxAgentId(), allSalaryEmployees, allSubAdminRanges, (long) user.getUID()); - } finally { - } - }); + syncLocalEmp(saveParam.getTaxAgentId(), allSalaryEmployees, allSubAdminRanges); // 记录日志 todo } + private void syncLocalEmp(Long taxAgentId, List allSalaryEmployees, List allSubAdminRanges) { + new Thread() { + public void run() { + try { + syncLocalEmp(taxAgentId, allSalaryEmployees, allSubAdminRanges, (long) user.getUID()); + } finally { + } + } + }.start(); + } + /** * 获取个税口角义务人的管理范围 * @@ -484,15 +488,13 @@ public class TaxAgentManageRangeServiceImpl extends Service implements TaxAgentM } /** 同步本地人员范围的关联人员=========================== */ List finalAllSubAdminRanges = allSubAdminRanges; - taskExecutor.execute(() -> { - try { - syncLocalEmp(taxAgentSubAdmin.getTaxAgentId(), allSalaryEmployees, finalAllSubAdminRanges, (long) user.getUID()); - } finally { - } - }); + + syncLocalEmp(taxAgentSubAdmin.getTaxAgentId(), allSalaryEmployees, allSubAdminRanges); // 记录日志 todo } + + /** * 根据分管理员id获取管理范围列表 * @@ -540,12 +542,8 @@ public class TaxAgentManageRangeServiceImpl extends Service implements TaxAgentM getTaxAgentManageRangeMapper().deleteByIds(ids); /** 同步本地人员范围的关联人员=========================== */ - taskExecutor.execute(() -> { - try { - syncLocalEmp(taxAgentId, allSalaryEmployees, allSubAdminRanges, (long) user.getUID()); - } finally { - } - }); + + syncLocalEmp(taxAgentId, allSalaryEmployees, allSubAdminRanges); // 记录日志 todo } @@ -563,7 +561,7 @@ public class TaxAgentManageRangeServiceImpl extends Service implements TaxAgentM } getTaxAgentManageRangeMapper().deleteBySubAdminIds(subAdminIds); // 删除管理范围下的所有人员 - taxAgentSubAdminEmployeeService.deleteBySubAdminIds(subAdminIds); +// taxAgentSubAdminEmployeeService.deleteBySubAdminIds(subAdminIds); } //fixme @@ -611,7 +609,7 @@ public class TaxAgentManageRangeServiceImpl extends Service implements TaxAgentM // 同步管理员的人员 getTaxAgentEmpService(user).syncTaxAgentEmployee(taxAgentEmpSaveParamList, employeeId); // 同步分管理员的人员 - taxAgentSubAdminEmployeeService.syncTaxAgentSubAdminEmployee(subAdminEmpSaveParamList, employeeId); +// taxAgentSubAdminEmployeeService.syncTaxAgentSubAdminEmployee(subAdminEmpSaveParamList, employeeId); } /** @@ -664,8 +662,8 @@ public class TaxAgentManageRangeServiceImpl extends Service implements TaxAgentM // 同步个税扣缴义务人的人员 getTaxAgentEmpService(user).syncTaxAgentEmployee(taxAgentEmpSaveParamList, employeeId); - List subAdminEmpSaveParamList = getTaxAgentSubAdminEmpSyncParam(taxAgentId, allSubAdminRanges); +// List subAdminEmpSaveParamList = getTaxAgentSubAdminEmpSyncParam(taxAgentId, allSubAdminRanges); // 同步分管理员的人员 - taxAgentSubAdminEmployeeService.syncTaxAgentSubAdminEmployee(subAdminEmpSaveParamList, employeeId); +// taxAgentSubAdminEmployeeService.syncTaxAgentSubAdminEmployee(subAdminEmpSaveParamList, employeeId); } } diff --git a/src/com/engine/salary/service/impl/TaxAgentServiceImpl.java b/src/com/engine/salary/service/impl/TaxAgentServiceImpl.java deleted file mode 100644 index da6d227bd..000000000 --- a/src/com/engine/salary/service/impl/TaxAgentServiceImpl.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.engine.salary.service.impl; - -import com.engine.core.impl.Service; -import com.engine.salary.biz.TaxAgentBiz; -import com.engine.salary.entity.taxrate.TaxAgent; -import com.engine.salary.mapper.TaxAgentMapper; -import com.engine.salary.service.TaxAgentService; -import com.engine.salary.util.db.MapperProxyFactory; - -import java.util.Collection; - -public class TaxAgentServiceImpl extends Service implements TaxAgentService { - - private TaxAgentMapper getTaxAgentMapper() { - return MapperProxyFactory.getProxy(TaxAgentMapper.class); - } - - @Override - public Collection findAll() { - return new TaxAgentBiz().listAll(); - } - - @Override - public TaxAgent getById(Long id) { - return getTaxAgentMapper().getById(id); - } -} diff --git a/src/com/engine/salary/web/OtherDeductionController.java b/src/com/engine/salary/web/OtherDeductionController.java index c344a7c8b..528564f81 100644 --- a/src/com/engine/salary/web/OtherDeductionController.java +++ b/src/com/engine/salary/web/OtherDeductionController.java @@ -1,12 +1,13 @@ package com.engine.salary.web; -import com.engine.common.util.ParamUtil; import com.engine.common.util.ServiceUtil; +import com.engine.salary.entity.datacollection.dto.OtherDeductionListDTO; +import com.engine.salary.entity.datacollection.dto.OtherDeductionRecordDTO; import com.engine.salary.entity.datacollection.param.OtherDeductionImportParam; import com.engine.salary.entity.datacollection.param.OtherDeductionQueryParam; -import com.engine.salary.service.OtherDeductionService; -import com.engine.salary.service.impl.OtherDeductionServiceImpl; import com.engine.salary.util.ResponseResult; +import com.engine.salary.util.page.PageInfo; +import com.engine.salary.wrapper.OtherDeductionWrapper; import io.swagger.v3.oas.annotations.parameters.RequestBody; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; @@ -47,8 +48,8 @@ import java.util.stream.Collectors; @Slf4j public class OtherDeductionController { - private OtherDeductionService getService(User user) { - return (OtherDeductionService) ServiceUtil.getService(OtherDeductionServiceImpl.class, user); + private OtherDeductionWrapper getOtherDeductionWrapper(User user) { + return ServiceUtil.getService(OtherDeductionWrapper.class, user); } /** @@ -61,7 +62,7 @@ public class OtherDeductionController { @Produces(MediaType.APPLICATION_JSON) public String getSearchCondition(@Context HttpServletRequest request, @Context HttpServletResponse response) { User user = HrmUserVarify.getUser(request, response); - return new ResponseResult, Map>(user).run(getService(user)::getSearchCondition, ParamUtil.request2Map(request)); + return new ResponseResult, Map>(user).run(getOtherDeductionWrapper(user)::getSearchCondition); } @@ -70,9 +71,7 @@ public class OtherDeductionController { @Produces(MediaType.APPLICATION_JSON) public String list(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody OtherDeductionQueryParam queryParam) { User user = HrmUserVarify.getUser(request, response); - Map map = ParamUtil.request2Map(request); - map.put("queryParam", queryParam); - return new ResponseResult, Map>(user).run(getService(user)::list, map); + return new ResponseResult>(user).run(getOtherDeductionWrapper(user)::list, queryParam); } @@ -81,9 +80,7 @@ public class OtherDeductionController { @Produces(MediaType.APPLICATION_JSON) public String getDetailList(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody OtherDeductionQueryParam queryParam) { User user = HrmUserVarify.getUser(request, response); - Map map = ParamUtil.request2Map(request); - map.put("queryParam", queryParam); - return new ResponseResult, Map>(user).run(getService(user)::getDetailList, map); + return new ResponseResult>(user).run(getOtherDeductionWrapper(user)::getDetailList, queryParam); } @@ -94,7 +91,7 @@ public class OtherDeductionController { try { User user = HrmUserVarify.getUser(request, response); OtherDeductionQueryParam param = buildParam(request); - XSSFWorkbook workbook = getService(user).downloadTemplate(param); + XSSFWorkbook workbook = getOtherDeductionWrapper(user).downloadTemplate(param); String fileName = "其他免税扣除导入模板" + LocalDate.now(); try { fileName = URLEncoder.encode(fileName + ".xlsx", "UTF-8"); @@ -131,10 +128,7 @@ public class OtherDeductionController { OtherDeductionQueryParam param = buildParam(request); - Map map = ParamUtil.request2Map(request); - map.put("queryParam", param); - - XSSFWorkbook workbook = getService(user).export(map); + XSSFWorkbook workbook = getOtherDeductionWrapper(user).export(param); String fileName = null; try { @@ -168,10 +162,7 @@ public class OtherDeductionController { OtherDeductionQueryParam param = buildParam(request); - Map map = ParamUtil.request2Map(request); - map.put("queryParam", param); - - XSSFWorkbook workbook = getService(user).exportDetail(map); + XSSFWorkbook workbook = getOtherDeductionWrapper(user).exportDetail(param); String fileName = "其他免税扣除明细" + LocalDate.now(); try { @@ -269,9 +260,7 @@ public class OtherDeductionController { @Produces(MediaType.APPLICATION_JSON) public String preview(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody OtherDeductionImportParam importParam) { User user = HrmUserVarify.getUser(request, response); - Map map = ParamUtil.request2Map(request); - map.put("importParam", importParam); - return new ResponseResult, Map>(user).run(getService(user)::preview, map); + return new ResponseResult>(user).run(getOtherDeductionWrapper(user)::preview, importParam); } @POST @@ -279,9 +268,7 @@ public class OtherDeductionController { @Produces(MediaType.APPLICATION_JSON) public String importAddUpDeduction(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody OtherDeductionImportParam importParam) { User user = HrmUserVarify.getUser(request, response); - Map map = ParamUtil.request2Map(request); - map.put("importParam", importParam); - return new ResponseResult, Map>(user).run(getService(user)::importData, map); + return new ResponseResult>(user).run(getOtherDeductionWrapper(user)::importData, importParam); } diff --git a/src/com/engine/salary/web/TaxAgentController.java b/src/com/engine/salary/web/TaxAgentController.java index 66c114235..6e22715c1 100644 --- a/src/com/engine/salary/web/TaxAgentController.java +++ b/src/com/engine/salary/web/TaxAgentController.java @@ -10,16 +10,12 @@ import com.engine.salary.wrapper.TaxAgentBaseWrapper; import com.engine.salary.wrapper.TaxAgentSubAdminWrapper; import com.engine.salary.wrapper.TaxAgentWrapper; import io.swagger.v3.oas.annotations.parameters.RequestBody; -import org.springframework.web.bind.annotation.RequestParam; import weaver.hrm.HrmUserVarify; import weaver.hrm.User; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; +import javax.ws.rs.*; import javax.ws.rs.core.Context; import javax.ws.rs.core.MediaType; import java.util.Collection; @@ -109,14 +105,14 @@ public class TaxAgentController { @Produces(MediaType.APPLICATION_JSON) public String list(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody TaxAgentQueryParam queryParam) { User user = HrmUserVarify.getUser(request, response); - return new ResponseResult>(user).run(getTaxAgentWrapper(user)::list, queryParam); + return new ResponseResult>>(user).run(getTaxAgentWrapper(user)::list, queryParam); } //查询个税扣缴义务人下面的代缴机构") @GET @Path("/paymentAgency/list") @Produces(MediaType.APPLICATION_JSON) - public String paymentAgencyList(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestParam(value = "id") Long id) { + public String paymentAgencyList(@Context HttpServletRequest request, @Context HttpServletResponse response, @QueryParam(value = "id") Long id) { User user = HrmUserVarify.getUser(request, response); TaxAgentQueryParam queryParam = new TaxAgentQueryParam(); queryParam.setIds(Collections.singleton(id)); @@ -142,7 +138,7 @@ public class TaxAgentController { @GET @Path("/getForm") @Produces(MediaType.APPLICATION_JSON) - public String getFrom(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestParam(value = "id") Long id) { + public String getFrom(@Context HttpServletRequest request, @Context HttpServletResponse response, @QueryParam(value = "id") Long id) { User user = HrmUserVarify.getUser(request, response); return new ResponseResult(user).run(getTaxAgentWrapper(user)::getFrom, id); } @@ -218,7 +214,7 @@ public class TaxAgentController { } /** - * 分管理员管理范围排除列表 + * 人员范围排除列表 * * @param queryParam * @return @@ -280,26 +276,26 @@ public class TaxAgentController { * @param queryParam * @return */ - @POST - @Path("/subAdmin/list") - @Produces(MediaType.APPLICATION_JSON) - public String subAdminList(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody TaxAgentSubAdminQueryParam queryParam) { - User user = HrmUserVarify.getUser(request, response); - return new ResponseResult>(user).run(getTaxAgentSubAdminWrapper(user)::list, queryParam); - } +// @POST +// @Path("/subAdmin/list") +// @Produces(MediaType.APPLICATION_JSON) +// public String subAdminList(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody TaxAgentSubAdminQueryParam queryParam) { +// User user = HrmUserVarify.getUser(request, response); +// return new ResponseResult>(user).run(getTaxAgentSubAdminWrapper(user)::list, queryParam); +// } /** * 获取分管理员基础设置表单 * * @return */ - @POST - @Path("/subAdmin/getBaseForm") - @Produces(MediaType.APPLICATION_JSON) - public String getSubAdminBaseFrom(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody TaxAgentSubAdminBaseFormParam baseFormParam) { - User user = HrmUserVarify.getUser(request, response); - return new ResponseResult(user).run(getTaxAgentSubAdminWrapper(user)::getBaseFrom, baseFormParam); - } +// @POST +// @Path("/subAdmin/getBaseForm") +// @Produces(MediaType.APPLICATION_JSON) +// public String getSubAdminBaseFrom(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody TaxAgentSubAdminBaseFormParam baseFormParam) { +// User user = HrmUserVarify.getUser(request, response); +// return new ResponseResult(user).run(getTaxAgentSubAdminWrapper(user)::getBaseFrom, baseFormParam); +// } /** * 分管理员基础设置保存 @@ -307,13 +303,13 @@ public class TaxAgentController { * @param saveParam * @return */ - @POST - @Path("/subAdmin/saveBase") - @Produces(MediaType.APPLICATION_JSON) - public String saveSubAdminBase(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody TaxAgentSubAdminBaseSaveParam saveParam) { - User user = HrmUserVarify.getUser(request, response); - return new ResponseResult(user).run(getTaxAgentSubAdminWrapper(user)::saveBase, saveParam); - } +// @POST +// @Path("/subAdmin/saveBase") +// @Produces(MediaType.APPLICATION_JSON) +// public String saveSubAdminBase(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody TaxAgentSubAdminBaseSaveParam saveParam) { +// User user = HrmUserVarify.getUser(request, response); +// return new ResponseResult(user).run(getTaxAgentSubAdminWrapper(user)::saveBase, saveParam); +// } /** * 删除个税扣缴义务人分管理员 @@ -321,58 +317,58 @@ public class TaxAgentController { * @param ids * @return */ - @POST - @Path("/subAdmin/delete") - @Produces(MediaType.APPLICATION_JSON) - public String deleteSubAdmin(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody Collection ids) { - User user = HrmUserVarify.getUser(request, response); - return new ResponseResult, String>(user).run(getTaxAgentSubAdminWrapper(user)::delete, ids); - } +// @POST +// @Path("/subAdmin/delete") +// @Produces(MediaType.APPLICATION_JSON) +// public String deleteSubAdmin(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody Collection ids) { +// User user = HrmUserVarify.getUser(request, response); +// return new ResponseResult, String>(user).run(getTaxAgentSubAdminWrapper(user)::delete, ids); +// } //分管理员的管理范围列表 - @POST - @Path("/subAdmin/range/listInclude") - @Produces(MediaType.APPLICATION_JSON) - public String subAdminRangeListInclude(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody TaxAgentSubAdminRangeQueryParam queryParam) { - User user = HrmUserVarify.getUser(request, response); - return new ResponseResult>(user).run(getTaxAgentSubAdminWrapper(user)::listRangeInclude, queryParam); - } +// @POST +// @Path("/subAdmin/range/listInclude") +// @Produces(MediaType.APPLICATION_JSON) +// public String subAdminRangeListInclude(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody TaxAgentSubAdminRangeQueryParam queryParam) { +// User user = HrmUserVarify.getUser(request, response); +// return new ResponseResult>(user).run(getTaxAgentSubAdminWrapper(user)::listRangeInclude, queryParam); +// } //分管理员的管理范围排除列表 - @POST - @Path("/subAdmin/range/listExclude") - @Produces(MediaType.APPLICATION_JSON) - public String subAdminRangeListExclude(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody TaxAgentSubAdminRangeQueryParam queryParam) { - User user = HrmUserVarify.getUser(request, response); - return new ResponseResult>(user).run(getTaxAgentSubAdminWrapper(user)::listRangeExclude, queryParam); - } +// @POST +// @Path("/subAdmin/range/listExclude") +// @Produces(MediaType.APPLICATION_JSON) +// public String subAdminRangeListExclude(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody TaxAgentSubAdminRangeQueryParam queryParam) { +// User user = HrmUserVarify.getUser(request, response); +// return new ResponseResult>(user).run(getTaxAgentSubAdminWrapper(user)::listRangeExclude, queryParam); +// } //获取分管理员的管理范围表单 - @POST - @Path("/subAdmin/range/getForm") - @Produces(MediaType.APPLICATION_JSON) - public String getSubAdminRangeFrom(@Context HttpServletRequest request, @Context HttpServletResponse response) { - User user = HrmUserVarify.getUser(request, response); - return new ResponseResult(user).run(getTaxAgentSubAdminWrapper(user)::getRangeFrom); - } +// @POST +// @Path("/subAdmin/range/getForm") +// @Produces(MediaType.APPLICATION_JSON) +// public String getSubAdminRangeFrom(@Context HttpServletRequest request, @Context HttpServletResponse response) { +// User user = HrmUserVarify.getUser(request, response); +// return new ResponseResult(user).run(getTaxAgentSubAdminWrapper(user)::getRangeFrom); +// } //保存分管理员的管理范围 - @POST - @Path("/subAdmin/range/save") - @Produces(MediaType.APPLICATION_JSON) - public String saveSubAdminRange(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody TaxAgentSubAdminRangeSaveParam saveParam) { - User user = HrmUserVarify.getUser(request, response); - return new ResponseResult(user).run(getTaxAgentSubAdminWrapper(user)::saveRange, saveParam); - } +// @POST +// @Path("/subAdmin/range/save") +// @Produces(MediaType.APPLICATION_JSON) +// public String saveSubAdminRange(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody TaxAgentSubAdminRangeSaveParam saveParam) { +// User user = HrmUserVarify.getUser(request, response); +// return new ResponseResult(user).run(getTaxAgentSubAdminWrapper(user)::saveRange, saveParam); +// } //删除分管理员的管理范围 - @POST - @Path("/subAdmin/range/delete") - @Produces(MediaType.APPLICATION_JSON) - public String deleteSubAdminRange(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody Collection ids) { - User user = HrmUserVarify.getUser(request, response); - return new ResponseResult, String>(user).run(getTaxAgentSubAdminWrapper(user)::deleteRange, ids); - } +// @POST +// @Path("/subAdmin/range/delete") +// @Produces(MediaType.APPLICATION_JSON) +// public String deleteSubAdminRange(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody Collection ids) { +// User user = HrmUserVarify.getUser(request, response); +// return new ResponseResult, String>(user).run(getTaxAgentSubAdminWrapper(user)::deleteRange, ids); +// } /******** 分管理员 end ***********************************************************************************************/ diff --git a/src/com/engine/salary/wrapper/AttendQuoteDataWrapper.java b/src/com/engine/salary/wrapper/AttendQuoteDataWrapper.java index 4f9259977..64fd3fc87 100644 --- a/src/com/engine/salary/wrapper/AttendQuoteDataWrapper.java +++ b/src/com/engine/salary/wrapper/AttendQuoteDataWrapper.java @@ -26,7 +26,6 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.concurrent.ExecutorService; /** * 考勤数据 @@ -46,8 +45,6 @@ public class AttendQuoteDataWrapper extends Service { return (AttendQuoteFieldService) ServiceUtil.getService(AttendQuoteFieldServiceImpl.class, user); } - private ExecutorService taskExecutor; - /** * 同步考勤引用数据 * diff --git a/src/com/engine/salary/wrapper/OtherDeductionWrapper.java b/src/com/engine/salary/wrapper/OtherDeductionWrapper.java index 66d0d9696..f43ffc63d 100644 --- a/src/com/engine/salary/wrapper/OtherDeductionWrapper.java +++ b/src/com/engine/salary/wrapper/OtherDeductionWrapper.java @@ -1,214 +1,212 @@ -//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.api.browser.bean.SearchConditionGroup; +import com.api.browser.bean.SearchConditionItem; +import com.api.browser.bean.SearchConditionOption; +import com.api.browser.util.ConditionFactory; +import com.api.browser.util.ConditionType; +import com.engine.common.util.ServiceUtil; +import com.engine.core.impl.Service; +import com.engine.salary.entity.datacollection.dto.OtherDeductionListDTO; +import com.engine.salary.entity.datacollection.dto.OtherDeductionRecordDTO; +import com.engine.salary.entity.datacollection.param.OtherDeductionImportParam; +import com.engine.salary.entity.datacollection.param.OtherDeductionQueryParam; +import com.engine.salary.entity.datacollection.po.OtherDeductionPO; +import com.engine.salary.exception.SalaryRunTimeException; +import com.engine.salary.service.OtherDeductionService; +import com.engine.salary.service.SalaryEmployeeService; +import com.engine.salary.service.TaxAgentV2Service; +import com.engine.salary.service.impl.OtherDeductionServiceImpl; +import com.engine.salary.service.impl.SalaryEmployeeServiceImpl; +import com.engine.salary.service.impl.TaxAgentV2ServiceImpl; +import com.engine.salary.util.SalaryI18nUtil; +import com.engine.salary.util.page.PageInfo; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; +import weaver.hrm.User; +import weaver.systeminfo.SystemEnv; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * @Description: 其他免税扣除 + * @Author: wangxiangzhong + * @Date: 2022/3/14 16:09 + */ +public class OtherDeductionWrapper extends Service { + private OtherDeductionService getOtherDeductionService(User user) { + return ServiceUtil.getService(OtherDeductionServiceImpl.class, user); + } + private TaxAgentV2Service getTaxAgentV2Service(User user) { + return ServiceUtil.getService(TaxAgentV2ServiceImpl.class, user); + } + private SalaryEmployeeService getSalaryEmployeeService(User user) { + return ServiceUtil.getService(SalaryEmployeeServiceImpl.class, user); + } + /** + * 数据采集-其他免税扣除列表的高级搜索 + * + * @return + */ + public Map getSearchCondition() { + Map apidatas = new HashMap(); + ConditionFactory conditionFactory = new ConditionFactory(user); + + //条件组 + List addGroups = new ArrayList(); + + List conditionItems = new ArrayList(); + + //文本输入框 + SearchConditionItem username = conditionFactory.createCondition(ConditionType.INPUT, 25034, "username"); + username.setInputType("input"); + username.setColSpan(2);//定义一行显示条件数,默认值为2,当值为1时标识该条件单独占一行 + username.setFieldcol(16); //条件输入框所占宽度,默认值18 + username.setLabelcol(8); + username.setViewAttr(2); // 编辑权限 1:只读,2:可编辑, 3:必填 默认2 + username.setLabel("姓名"); //设置文本值 这个将覆盖多语言标签的值 + conditionItems.add(username); + + + SearchConditionItem departmentName = conditionFactory.createCondition(ConditionType.BROWSER, 502227, "departmentName", "4"); + departmentName.setInputType("browser"); + departmentName.setColSpan(2); + departmentName.setFieldcol(16); + departmentName.setLabelcol(8); + departmentName.setViewAttr(2); + departmentName.setIsQuickSearch(false); + departmentName.setLabel("部门"); + conditionItems.add(departmentName); + + + SearchConditionItem jobNum = conditionFactory.createCondition(ConditionType.INPUT, 25034, "jobNum"); + jobNum.setInputType("input"); + jobNum.setColSpan(2); + jobNum.setFieldcol(16); + jobNum.setLabelcol(8); + jobNum.setViewAttr(2); + jobNum.setLabel("工号"); + conditionItems.add(jobNum); + + + SearchConditionItem idNo = conditionFactory.createCondition(ConditionType.INPUT, 25034, "idNo"); + idNo.setInputType("input"); + idNo.setColSpan(2); + idNo.setFieldcol(16); + idNo.setLabelcol(8); + idNo.setViewAttr(2); + idNo.setLabel("证件号码"); + conditionItems.add(idNo); + + //日期范围选项 + List dateOptions = new ArrayList(); + dateOptions.add(new SearchConditionOption("6", SystemEnv.getHtmlLabelName(32530, user.getLanguage()), true));//指定日期范围(必须为6) + SearchConditionItem hiredate = conditionFactory.createCondition(ConditionType.RANGEPICKER, 18648, new String[]{"hiredate", "hiredate"}); + hiredate.setInputType("rangepicker"); + hiredate.setFormat("yyyy-MM-dd"); + hiredate.setFieldcol(16); + hiredate.setLabelcol(8); + hiredate.setViewAttr(2); + hiredate.setLabel("入职日期"); + hiredate.setOptions(dateOptions); + conditionItems.add(hiredate); + + + SearchConditionItem mobile = conditionFactory.createCondition(ConditionType.INPUT, 25034, "mobile"); + mobile.setInputType("input"); + mobile.setColSpan(2); + mobile.setFieldcol(16); + mobile.setLabelcol(8); + mobile.setViewAttr(2); + mobile.setLabel("手机号"); + conditionItems.add(mobile); + + addGroups.add(new SearchConditionGroup("常用条件", true, conditionItems)); + + apidatas.put("condition", addGroups); + return apidatas; + } + + /** + * 数据采集-其他免税扣除列表(分页) + * + * @param queryParam + * @return + */ + public PageInfo list(OtherDeductionQueryParam queryParam) { +// queryParam.setDeclareMonthDate(queryParam.getDeclareMonth().stream().map(e-> LocalDate.of(e.getYear(),e.getMonthValue(),1)).collect(Collectors.toList())); + + return getOtherDeductionService(user).listPage(queryParam); + + } + + /** + * 数据采集-其他免税扣除详情列表(分页) + * + * @param queryParam + * @return + */ + public PageInfo getDetailList(OtherDeductionQueryParam queryParam) { + Long id = queryParam.getOtherTaxExemptDeductionId(); + + OtherDeductionPO po = getOtherDeductionService(user).getById(id); + if (po == null) { + throw new SalaryRunTimeException(String.format(SalaryI18nUtil.getI18nLabel(100415, "其他免税扣除不存在") + "[id:%s]", id)); + } +// queryParam.setDeclareMonthDate(queryParam.getDeclareMonth().stream().map(e -> LocalDate.of(e.getYear(), e.getMonthValue(), 1)).collect(Collectors.toList())); + queryParam.setEmployeeId(po.getEmployeeId()); + + return getOtherDeductionService(user).recordListPage(queryParam); + } + + /** + * 导出-其他免税扣除列表 + * + * @param queryParam + * @return + */ + public XSSFWorkbook export(OtherDeductionQueryParam queryParam) { + return getOtherDeductionService(user).export(queryParam); + } + + /** + * 导出-其他免税扣除详情列表 + * + * @param queryParam + * @return + */ + public XSSFWorkbook exportDetail(OtherDeductionQueryParam queryParam) { + Long id = queryParam.getOtherTaxExemptDeductionId(); + OtherDeductionPO po = getOtherDeductionService(user).getById(id); + if (po == null) { + throw new SalaryRunTimeException(String.format(SalaryI18nUtil.getI18nLabel( 100415, "其他免税扣除不存在") + "[id:%s]", id)); + } + return getOtherDeductionService(user).exportDetail(queryParam); + } + + /** + * 下载导入模板 + * + * @param queryParam + * @return + */ + public XSSFWorkbook downloadTemplate(OtherDeductionQueryParam queryParam) { + return getOtherDeductionService(user).export(queryParam); + } + + /** + * 预览 + */ + public Map preview(OtherDeductionImportParam importParam){ + return getOtherDeductionService(user).preview(importParam); + } + + /** + * 导入数据 + */ + public Map importData(OtherDeductionImportParam importParam){ + return getOtherDeductionService(user).importData(importParam); + } +} diff --git a/src/com/engine/salary/wrapper/SalaryAcctEmployeeWrapper.java b/src/com/engine/salary/wrapper/SalaryAcctEmployeeWrapper.java index c44b79c2a..77f452622 100644 --- a/src/com/engine/salary/wrapper/SalaryAcctEmployeeWrapper.java +++ b/src/com/engine/salary/wrapper/SalaryAcctEmployeeWrapper.java @@ -2,7 +2,6 @@ package com.engine.salary.wrapper; import com.engine.common.util.ServiceUtil; import com.engine.core.impl.Service; -import com.engine.salary.biz.TaxAgentBiz; import com.engine.salary.entity.datacollection.DataCollectionEmployee; import com.engine.salary.entity.salaryacct.bo.SalaryAcctEmployeeBO; import com.engine.salary.entity.salaryacct.dto.SalaryAccEmployeeListDTO; @@ -11,12 +10,14 @@ import com.engine.salary.entity.salaryacct.param.SalaryAcctEmployeeDeleteParam; import com.engine.salary.entity.salaryacct.param.SalaryAcctEmployeeQueryParam; import com.engine.salary.entity.salaryacct.param.SalaryAcctEmployeeSaveParam; import com.engine.salary.entity.salaryacct.po.SalaryAcctEmployeePO; -import com.engine.salary.entity.taxrate.TaxAgent; +import com.engine.salary.entity.taxagent.po.TaxAgentPO; import com.engine.salary.exception.SalaryRunTimeException; import com.engine.salary.service.SalaryAcctEmployeeService; import com.engine.salary.service.SalaryEmployeeService; +import com.engine.salary.service.TaxAgentV2Service; import com.engine.salary.service.impl.SalaryAcctEmployeeServiceImpl; import com.engine.salary.service.impl.SalaryEmployeeServiceImpl; +import com.engine.salary.service.impl.TaxAgentV2ServiceImpl; import com.engine.salary.util.SalaryI18nUtil; import com.engine.salary.util.page.PageInfo; import org.apache.commons.collections4.CollectionUtils; @@ -43,7 +44,10 @@ public class SalaryAcctEmployeeWrapper extends Service { return (SalaryEmployeeService) ServiceUtil.getService(SalaryEmployeeServiceImpl.class, user); } - private TaxAgentBiz taxAgentService = new TaxAgentBiz(); + + private TaxAgentV2Service getTaxAgentService(User user) { + return ServiceUtil.getService(TaxAgentV2ServiceImpl.class, user); + } /** * 薪资核算人员列表 @@ -91,7 +95,7 @@ public class SalaryAcctEmployeeWrapper extends Service { List simpleEmployees = getSalaryEmployeeService(user).listByIds(employeeIds); // 查询个税扣缴义务人 List taxAgentIds = list.stream().map(SalaryAcctEmployeePO::getTaxAgentId).collect(Collectors.toList()); - List taxAgentPOS = taxAgentService.listByIds(taxAgentIds); + List taxAgentPOS = getTaxAgentService(user).listByIds(taxAgentIds); // 转换成列表dto List salaryAccEmployeeListDTOS = SalaryAcctEmployeeBO.convert2EmployeeListDTO(list, taxAgentPOS, simpleEmployees); PageInfo pageInfo = new PageInfo(salaryAccEmployeeListDTOS, SalaryAccEmployeeListDTO.class); @@ -111,7 +115,7 @@ public class SalaryAcctEmployeeWrapper extends Service { // WeaSearchCondition searchCondition = SalaryFormatUtil.getInstance().buildCondition(SalaryAcctEmpSearchConditionDTO.class, // searchConditionDTO, "SalaryAcctEmpCondition"); // // 查询个税扣缴义务人 -// List taxAgentPOS = taxAgentService.listAll(tenantKey); +// List taxAgentPOS = getTaxAgentService(user).listAll(tenantKey); // List weaSearchConditionOptions = taxAgentPOS.stream() // .map(taxAgentPO -> new WeaSearchConditionOption(String.valueOf(taxAgentPO.getId()), taxAgentPO.getName())) // .collect(Collectors.toList()); diff --git a/src/com/engine/salary/wrapper/SalaryAcctResultWrapper.java b/src/com/engine/salary/wrapper/SalaryAcctResultWrapper.java index 861c69a78..a400afef0 100644 --- a/src/com/engine/salary/wrapper/SalaryAcctResultWrapper.java +++ b/src/com/engine/salary/wrapper/SalaryAcctResultWrapper.java @@ -59,9 +59,6 @@ public class SalaryAcctResultWrapper extends Service { // private SalaryCheckResultService salaryCheckResultService; - private TaxAgentService getTaxAgentService(User user) { - return (TaxAgentService) ServiceUtil.getService(TaxAgentServiceImpl.class, user); - } private SalaryAcctExcelService getSalaryAcctExcelService(User user) { return (SalaryAcctExcelService) ServiceUtil.getService(SalaryAcctExcelServiceImpl.class, user); diff --git a/src/com/engine/salary/wrapper/SalaryArchiveTaxAgentWrapper.java b/src/com/engine/salary/wrapper/SalaryArchiveTaxAgentWrapper.java index 5feb996a4..67a9f2ee5 100644 --- a/src/com/engine/salary/wrapper/SalaryArchiveTaxAgentWrapper.java +++ b/src/com/engine/salary/wrapper/SalaryArchiveTaxAgentWrapper.java @@ -9,14 +9,15 @@ import com.engine.salary.entity.salaryarchive.param.SalaryArchiveTaxAgentSavePar import com.engine.salary.entity.salaryarchive.param.SingleTaxAgentAdjustRecordQueryParam; import com.engine.salary.entity.salaryarchive.param.TaxAgentAdjustRecordQueryParam; import com.engine.salary.entity.salaryarchive.po.SalaryArchiveTaxAgentPO; -import com.engine.salary.entity.taxrate.TaxAgent; +import com.engine.salary.entity.taxagent.dto.TaxAgentListDTO; +import com.engine.salary.entity.taxagent.po.TaxAgentPO; import com.engine.salary.enums.UserStatusEnum; import com.engine.salary.enums.salaryarchive.SalaryArchiveTaxAgentAdjustReasonEnum; import com.engine.salary.exception.SalaryRunTimeException; import com.engine.salary.service.SalaryArchiveTaxAgentService; -import com.engine.salary.service.TaxAgentService; +import com.engine.salary.service.TaxAgentV2Service; import com.engine.salary.service.impl.SalaryArchiveTaxAgentServiceImpl; -import com.engine.salary.service.impl.TaxAgentServiceImpl; +import com.engine.salary.service.impl.TaxAgentV2ServiceImpl; import com.engine.salary.util.SalaryI18nUtil; import com.engine.salary.util.page.PageInfo; import com.google.common.collect.Lists; @@ -40,8 +41,8 @@ public class SalaryArchiveTaxAgentWrapper extends Service { return (SalaryArchiveTaxAgentService) ServiceUtil.getService(SalaryArchiveTaxAgentServiceImpl.class, user); } - private TaxAgentService getTaxAgentService(User user) { - return (TaxAgentService) ServiceUtil.getService(TaxAgentServiceImpl.class, user); + private TaxAgentV2Service getTaxAgentService(User user) { + return (TaxAgentV2Service) ServiceUtil.getService(TaxAgentV2ServiceImpl.class, user); } // @@ -67,7 +68,7 @@ public class SalaryArchiveTaxAgentWrapper extends Service { Date effectiveTime = null; SalaryArchiveTaxAgentPO adjustBeforePo = getSalaryArchiveTaxAgentService(user).getAdjustBeforeTaxAgent(SalaryArchiveTaxAgentPO.builder().salaryArchiveId(salaryArchiveId).effectiveTime(new Date()).build()); if (adjustBeforePo != null) { - TaxAgent taxAgent = getTaxAgentService(user).getById(adjustBeforePo.getTaxAgentId()); + TaxAgentPO taxAgent = getTaxAgentService(user).getById(adjustBeforePo.getTaxAgentId()); if (taxAgent != null) { adjustBefore = taxAgent.getName(); } @@ -87,7 +88,7 @@ public class SalaryArchiveTaxAgentWrapper extends Service { private Map buildTaxAgentForm(Date effectiveTime, String adjustReason, String adjustBefore, Long adjustAfter) { // 个税扣缴义务人下拉列表 - Collection taxAgentList = getTaxAgentService(user).findAll(); + Collection taxAgentList = getTaxAgentService(user).findAll(); Map map = new HashMap<>(); map.put("adjustReasonList", SalaryArchiveTaxAgentAdjustReasonEnum.getList()); map.put("taxAgentList", taxAgentList); @@ -113,13 +114,13 @@ public class SalaryArchiveTaxAgentWrapper extends Service { throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(100484, "该薪资档案的个税扣缴义务人的调整记录不存在")); } // 个税扣缴义务人下拉列表 - Collection taxAgentList = getTaxAgentService(user).findAll(); + Collection taxAgentList = getTaxAgentService(user).findAll(); // 调整前 String adjustBefore = ""; SalaryArchiveTaxAgentPO adjustBeforePo = getSalaryArchiveTaxAgentService(user).getAdjustBeforeTaxAgent(salaryArchiveTaxAgent); if (adjustBeforePo != null) { - Optional optional = taxAgentList.stream().filter(f -> f.getId().equals(adjustBeforePo.getTaxAgentId())).findFirst(); + Optional optional = taxAgentList.stream().filter(f -> f.getId().equals(adjustBeforePo.getTaxAgentId())).findFirst(); adjustBefore = optional.isPresent() ? optional.get().getName() : ""; } @@ -166,7 +167,7 @@ public class SalaryArchiveTaxAgentWrapper extends Service { public PageInfo adjustRecordList(TaxAgentAdjustRecordQueryParam queryParam) { // 个税扣缴义务人 - Collection taxAgentList = getTaxAgentService(user).findAll(); + Collection taxAgentList = getTaxAgentService(user).findAll(); List listAll = getSalaryArchiveTaxAgentService(user).taxAgentAdjustRecordList(TaxAgentAdjustRecordQueryParam.builder().build()); PageInfo page = getSalaryArchiveTaxAgentService(user).taxAgentAdjustRecordListPage(queryParam); List list = page.getList(); @@ -176,9 +177,9 @@ public class SalaryArchiveTaxAgentWrapper extends Service { } Optional optional = listAll.stream().filter(f -> f.getSalaryArchiveId().equals(m.getSalaryArchiveId())).findFirst(); m.setAdjustBefore(optional.isPresent() ? optional.get().getAdjustAfter() : ""); - Optional optionalBefore = taxAgentList.stream().filter(t -> t.getId().toString().equals(m.getAdjustBefore())).findFirst(); + Optional optionalBefore = taxAgentList.stream().filter(t -> t.getId().toString().equals(m.getAdjustBefore())).findFirst(); m.setAdjustBefore(optionalBefore.isPresent() ? optionalBefore.get().getName() : ""); - Optional optionalAfter = taxAgentList.stream().filter(t -> t.getId().toString().equals(m.getAdjustAfter())).findFirst(); + Optional optionalAfter = taxAgentList.stream().filter(t -> t.getId().toString().equals(m.getAdjustAfter())).findFirst(); m.setAdjustAfter(optionalAfter.isPresent() ? optionalAfter.get().getName() : ""); m.setEmployeeStatus(UserStatusEnum.getDefaultLabelByValue(Integer.parseInt(m.getEmployeeStatus()))); @@ -205,7 +206,7 @@ public class SalaryArchiveTaxAgentWrapper extends Service { PageInfo page = getSalaryArchiveTaxAgentService(user).taxAgentAdjustRecordListPage(adjustRecordQueryParam); // 个税扣缴义务人 - Collection taxAgentList = getTaxAgentService(user).findAll(); + Collection taxAgentList = getTaxAgentService(user).findAll(); List listAll = getSalaryArchiveTaxAgentService(user).taxAgentAdjustRecordList(TaxAgentAdjustRecordQueryParam.builder().build()); List list = page.getList(); List resultList = Lists.newArrayList(); @@ -215,9 +216,9 @@ public class SalaryArchiveTaxAgentWrapper extends Service { } Optional optional = listAll.stream().filter(f -> f.getSalaryArchiveId().equals(m.getSalaryArchiveId())).findFirst(); m.setAdjustBefore(optional.isPresent() ? optional.get().getAdjustAfter() : ""); - Optional optionalBefore = taxAgentList.stream().filter(t -> t.getId().toString().equals(m.getAdjustBefore())).findFirst(); + Optional optionalBefore = taxAgentList.stream().filter(t -> t.getId().toString().equals(m.getAdjustBefore())).findFirst(); m.setAdjustBefore(optionalBefore.isPresent() ? optionalBefore.get().getName() : ""); - Optional optionalAfter = taxAgentList.stream().filter(t -> t.getId().toString().equals(m.getAdjustAfter())).findFirst(); + Optional optionalAfter = taxAgentList.stream().filter(t -> t.getId().toString().equals(m.getAdjustAfter())).findFirst(); m.setAdjustAfter(optionalAfter.isPresent() ? optionalAfter.get().getName() : ""); m.setAdjustReason(SalaryArchiveTaxAgentAdjustReasonEnum.getDefaultLabelByValue(m.getAdjustReason())); diff --git a/src/com/engine/salary/wrapper/SalaryArchiveWrapper.java b/src/com/engine/salary/wrapper/SalaryArchiveWrapper.java index bdfab6d3d..095258289 100644 --- a/src/com/engine/salary/wrapper/SalaryArchiveWrapper.java +++ b/src/com/engine/salary/wrapper/SalaryArchiveWrapper.java @@ -19,7 +19,8 @@ import com.engine.salary.entity.salaryarchive.po.SalaryArchiveItemPO; import com.engine.salary.entity.salaryarchive.po.SalaryArchivePO; import com.engine.salary.entity.salaryarchive.po.SalaryArchiveTaxAgentPO; import com.engine.salary.entity.salaryitem.po.SalaryItemPO; -import com.engine.salary.entity.taxrate.TaxAgent; +import com.engine.salary.entity.taxagent.dto.TaxAgentListDTO; +import com.engine.salary.entity.taxagent.po.TaxAgentPO; import com.engine.salary.enums.UserStatusEnum; import com.engine.salary.enums.salaryarchive.SalaryArchiveImportTypeEnum; import com.engine.salary.enums.salaryarchive.SalaryArchiveItemAdjustReasonEnum; @@ -27,10 +28,10 @@ import com.engine.salary.enums.salaryarchive.SalaryArchiveTaxAgentAdjustReasonEn import com.engine.salary.exception.SalaryRunTimeException; import com.engine.salary.service.SalaryArchiveItemService; import com.engine.salary.service.SalaryArchiveService; -import com.engine.salary.service.TaxAgentService; +import com.engine.salary.service.TaxAgentV2Service; import com.engine.salary.service.impl.SalaryArchiveItemServiceImpl; import com.engine.salary.service.impl.SalaryArchiveServiceImpl; -import com.engine.salary.service.impl.TaxAgentServiceImpl; +import com.engine.salary.service.impl.TaxAgentV2ServiceImpl; import com.engine.salary.util.SalaryI18nUtil; import com.engine.salary.util.page.PageInfo; import com.google.common.collect.Lists; @@ -62,8 +63,8 @@ public class SalaryArchiveWrapper extends Service { private EmployBiz employeeService = new EmployBiz(); - private TaxAgentService getTaxAgentService(User user) { - return (TaxAgentService) ServiceUtil.getService(TaxAgentServiceImpl.class, user); + private TaxAgentV2Service getTaxAgentService(User user) { + return ServiceUtil.getService(TaxAgentV2ServiceImpl.class, user); } // private SalaryBatchService salaryBatchService; @@ -83,7 +84,7 @@ public class SalaryArchiveWrapper extends Service { Collection salaryArchives = pageInfo.getList(); //所有个税扣缴义务人 - Collection taxAgentLists = getTaxAgentService(user).findAll(); + Collection taxAgentLists = getTaxAgentService(user).listAll(); // 获取所有可被引用的薪资项目 List salaryItems = getSalaryArchiveItemService(user).getCanAdjustSalaryItems(); @@ -137,11 +138,11 @@ public class SalaryArchiveWrapper extends Service { // 获取当前已生效个税扣缴义务人 List taxAgentList = getSalaryArchiveService(user).getCurrentEffectiveTaxAgentList(Collections.singletonList(salaryArchiveId)); // 获取所有个税扣缴义务人 - Collection taxAgentLists = getTaxAgentService(user).findAll(); + Collection taxAgentLists = getTaxAgentService(user).findAll(); String taxAgent = ""; if (CollectionUtils.isNotEmpty(taxAgentList)) { SalaryArchiveTaxAgentPO salaryArchiveTaxAgent = taxAgentList.get(0); - Optional taxAgentOptional = taxAgentLists.stream().filter(f -> f.getId().equals(salaryArchiveTaxAgent.getTaxAgentId())).findFirst(); + Optional taxAgentOptional = taxAgentLists.stream().filter(f -> f.getId().equals(salaryArchiveTaxAgent.getTaxAgentId())).findFirst(); taxAgent = taxAgentOptional.isPresent() ? taxAgentOptional.get().getName() : taxAgent; } @@ -274,7 +275,7 @@ public class SalaryArchiveWrapper extends Service { List> userStatus = UserStatusEnum.getList(); List> itemAdjustReasons = SalaryArchiveItemAdjustReasonEnum.getList(); List> TaxAgentAdjustReason = SalaryArchiveTaxAgentAdjustReasonEnum.getList(); - Collection taxAgentList = getTaxAgentService(user).findAll(); + Collection taxAgentList = getTaxAgentService(user).findAll(); HashMap map = Maps.newHashMap(); map.put("userStatus",userStatus); map.put("itemAdjustReasons",itemAdjustReasons); diff --git a/src/com/engine/salary/wrapper/SalarySendWrapper.java b/src/com/engine/salary/wrapper/SalarySendWrapper.java index 79a654a58..d1fdb9b23 100644 --- a/src/com/engine/salary/wrapper/SalarySendWrapper.java +++ b/src/com/engine/salary/wrapper/SalarySendWrapper.java @@ -17,17 +17,17 @@ import com.engine.salary.entity.salaryBill.dto.*; import com.engine.salary.entity.salaryBill.param.*; import com.engine.salary.entity.salaryBill.po.SalarySendPO; import com.engine.salary.entity.salaryBill.po.SalaryTemplatePO; -import com.engine.salary.entity.taxrate.TaxAgent; +import com.engine.salary.entity.taxagent.dto.TaxAgentListDTO; import com.engine.salary.enums.UserStatusEnum; 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.SalarySendService; import com.engine.salary.service.SalaryTemplateService; -import com.engine.salary.service.TaxAgentService; +import com.engine.salary.service.TaxAgentV2Service; import com.engine.salary.service.impl.SalarySendServiceImpl; import com.engine.salary.service.impl.SalaryTemplateServiceImpl; -import com.engine.salary.service.impl.TaxAgentServiceImpl; +import com.engine.salary.service.impl.TaxAgentV2ServiceImpl; import com.engine.salary.util.SalaryI18nUtil; import com.engine.salary.util.page.PageInfo; import com.engine.salary.util.page.SalaryPageUtil; @@ -49,8 +49,8 @@ import java.util.stream.Collectors; * @Date: 2022/3/16 13:57 */ public class SalarySendWrapper extends Service { - private TaxAgentService getTaxAgentService(User user) { - return ServiceUtil.getService(TaxAgentServiceImpl.class, user); + private TaxAgentV2Service getTaxAgentService(User user) { + return ServiceUtil.getService(TaxAgentV2ServiceImpl.class, user); } private SalarySendService getSalarySendService(User user) { @@ -187,7 +187,7 @@ public class SalarySendWrapper extends Service { taxAgent.setFieldcol(16); //条件输入框所占宽度,默认值18 taxAgent.setLabelcol(8); List searchConditionOptions = new ArrayList<>(); - Collection taxAgentLists = getTaxAgentService(user).findAll(); + Collection taxAgentLists = getTaxAgentService(user).findAll(); taxAgentLists.forEach(e -> searchConditionOptions.add(new SearchConditionOption(e.getId().toString(), e.getName()))); taxAgent.setOptions(searchConditionOptions); taxAgent.setInputType(""); @@ -389,7 +389,7 @@ public class SalarySendWrapper extends Service { taxAgent.setFieldcol(16); //条件输入框所占宽度,默认值18 taxAgent.setLabelcol(8); List searchConditionOptions = new ArrayList<>(); - Collection taxAgentLists = getTaxAgentService(user).findAll(); + Collection taxAgentLists = getTaxAgentService(user).findAll(); taxAgentLists.forEach(e -> searchConditionOptions.add(new SearchConditionOption(e.getId().toString(), e.getName()))); taxAgent.setOptions(searchConditionOptions); taxAgent.setInputType(""); diff --git a/src/com/engine/salary/wrapper/SalarySobWrapper.java b/src/com/engine/salary/wrapper/SalarySobWrapper.java index 0b3c2c99a..cbac3a0a6 100644 --- a/src/com/engine/salary/wrapper/SalarySobWrapper.java +++ b/src/com/engine/salary/wrapper/SalarySobWrapper.java @@ -1,12 +1,9 @@ package com.engine.salary.wrapper; -import com.cloudstore.eccom.result.WeaResultMsg; import com.engine.common.util.ServiceUtil; import com.engine.core.impl.Service; -import com.engine.salary.component.SalaryWeaTable; import com.engine.salary.entity.salarysob.bo.SalarySobBO; import com.engine.salary.entity.salarysob.dto.SalarySobBasicFormDTO; -import com.engine.salary.entity.salarysob.dto.SalarySobListDTO; import com.engine.salary.entity.salarysob.param.SalarySobBasicSaveParam; import com.engine.salary.entity.salarysob.param.SalarySobDisableParam; import com.engine.salary.entity.salarysob.param.SalarySobDuplicateParam; @@ -17,9 +14,6 @@ import com.engine.salary.exception.SalaryRunTimeException; import com.engine.salary.service.SalarySobService; import com.engine.salary.service.impl.SalarySobServiceImpl; import com.engine.salary.util.SalaryI18nUtil; -import com.engine.salary.util.db.DBType; -import org.apache.commons.lang3.StringUtils; -import weaver.conn.RecordSet; import weaver.hrm.User; import java.util.Collection; @@ -51,47 +45,18 @@ public class SalarySobWrapper extends Service { */ public Map listPage(SalarySobListQueryParam queryParam) { - SalaryWeaTable table = new SalaryWeaTable(user, SalarySobListDTO.class); - - String fields = " t.id" + - " , t.name" + - " , t.income_category" + - " , t.salary_cycle_type as salaryCycle" + - " , t.salary_cycle_from_day as salaryCycleFromDay" + - " , t.tax_cycle_type" + - " , t.attend_cycle_type" + - " , t.attend_cycle_from_day" + - " , t.social_security_cycle_type" + - " , t.disable" + - " , t.description"; - - String from = " from hrsa_salary_sob t"; - - table.setBackfields(fields); - table.setSqlform(from); - table.setSqlwhere(makeSqlWhere(queryParam)); - table.setSqlorderby("t.id DESC"); - table.setSqlprimarykey("t.id"); - table.setSqlisdistinct("false"); - - WeaResultMsg result = new WeaResultMsg(false); - result.putAll(table.makeDataResult()); - result.success(); - return result.getResultMap(); - - } - - private String makeSqlWhere(SalarySobListQueryParam queryParam) { - - DBType dbType = DBType.get(new RecordSet().getDBType()); - - String sqlWhere = " t.delete_type = 0 "; - - String name = queryParam.getName(); - if (StringUtils.isNotBlank(name)) { - sqlWhere += " AND t.name " + dbType.like(name); - } - return sqlWhere; +// // 查询薪资账套 +// PageInfo page = getSalarySobService(user).listPageByParam(queryParam); +// // 查询人员信息 +// List employeeIds = SalaryEntityUtil.properties(page.getRecords(), SalarySobPO::getCreator, Collectors.toList()); +// List simpleEmployees = hrmCommonEmployeeService.getEmployeeByIds(employeeIds, tenantKey); +// // 薪资账套po转换成薪资账套列表dto +// List salarySobListDTOS = SalarySobBO.convert2ListDTO(page.getRecords(), simpleEmployees); +// Page dtoPage = new Page<>(page.getCurrent(), page.getSize(), page.getTotal(), page.isSearchCount()); +// dtoPage.setRecords(salarySobListDTOS); +// // 转换成前端所需的数据格式 +// return SalaryFormatUtil.getInstance().buildTable(SalarySobListDTO.class, dtoPage); +return null; } /** diff --git a/src/com/engine/salary/wrapper/TaxAgentWrapper.java b/src/com/engine/salary/wrapper/TaxAgentWrapper.java index 20766a686..d89117f74 100644 --- a/src/com/engine/salary/wrapper/TaxAgentWrapper.java +++ b/src/com/engine/salary/wrapper/TaxAgentWrapper.java @@ -1,7 +1,5 @@ package com.engine.salary.wrapper; -import com.cloudstore.eccom.pc.table.WeaTable; -import com.cloudstore.eccom.result.WeaResultMsg; import com.engine.common.util.ServiceUtil; import com.engine.core.impl.Service; import com.engine.salary.entity.datacollection.DataCollectionEmployee; @@ -28,7 +26,10 @@ import org.apache.commons.lang3.math.NumberUtils; import org.springframework.beans.BeanUtils; import weaver.hrm.User; -import java.util.*; +import java.util.Collection; +import java.util.Collections; +import java.util.List; +import java.util.Map; import java.util.stream.Collectors; /** @@ -102,7 +103,7 @@ public class TaxAgentWrapper extends Service { * @param queryParam * @return */ - public Map list(TaxAgentQueryParam queryParam) { + public PageInfo> list(TaxAgentQueryParam queryParam) { // 是否是总管理员 Boolean isChief = getTaxAgentService(user).isChief((long) user.getUID()); // 是否开启分权 @@ -149,26 +150,9 @@ public class TaxAgentWrapper extends Service { listPage.setPageSize(page.getPageSize()); //构造表格 - WeaTable weaTable = new WeaTable(); - TaxAgentBO.buildTaxAgentTable(weaTable, isOpenDevolution); - if (isChief) { - // 在外展示操作按钮 -// weaTable.getOperates().get(0).setOuter(Boolean.TRUE); - } else { - // 去掉增删改权限 - weaTable.getOperates().getOperate().clear(); -// weaTable.getCheckBoxPermission().clear(); - } + TaxAgentBO.buildTaxAgentTable(listPage, isOpenDevolution); - WeaResultMsg result = new WeaResultMsg(false); - result.putAll(weaTable.makeDataResult()); - result.success(); - - Map datas = new HashMap<>(); - datas.put("pageInfo", listPage); - datas.put("dataKey", result.getResultMap()); - - return datas; + return listPage; } diff --git a/src/com/engine/salary/wrapper/TaxDeclarationWrapper.java b/src/com/engine/salary/wrapper/TaxDeclarationWrapper.java index f23d420b1..365b11e24 100644 --- a/src/com/engine/salary/wrapper/TaxDeclarationWrapper.java +++ b/src/com/engine/salary/wrapper/TaxDeclarationWrapper.java @@ -4,7 +4,6 @@ import com.engine.common.util.ServiceUtil; import com.engine.core.impl.Service; import com.engine.salary.biz.EmployBiz; import com.engine.salary.biz.SalaryItemBiz; -import com.engine.salary.biz.TaxAgentBiz; import com.engine.salary.common.LocalDateRange; import com.engine.salary.component.WeaFormOption; import com.engine.salary.entity.datacollection.AddUpSituation; @@ -13,6 +12,7 @@ import com.engine.salary.entity.salaryacct.po.SalaryAcctRecordPO; import com.engine.salary.entity.salaryacct.po.SalaryAcctResultPO; import com.engine.salary.entity.salaryitem.po.SalaryItemPO; import com.engine.salary.entity.salarysob.po.SalarySobPO; +import com.engine.salary.entity.taxagent.po.TaxAgentPO; import com.engine.salary.entity.taxdeclaration.TaxDeclaration; import com.engine.salary.entity.taxdeclaration.bo.TaxDeclarationBO; import com.engine.salary.entity.taxdeclaration.dto.TaxDeclarationFormDTO; @@ -57,19 +57,19 @@ public class TaxDeclarationWrapper extends Service { } private TaxDeclarationService getTaxDeclarationService(User user) { - return (TaxDeclarationService) ServiceUtil.getService(TaxDeclarationServiceImpl.class, user); + return ServiceUtil.getService(TaxDeclarationServiceImpl.class, user); } - private TaxAgentService getTaxAgentService(User user) { - return (TaxAgentService) ServiceUtil.getService(TaxAgentServiceImpl.class, user); + private TaxAgentV2Service getTaxAgentService(User user) { + return ServiceUtil.getService(TaxAgentV2ServiceImpl.class, user); } private TaxDeclarationDetailService getTaxDeclarationDetailService(User user) { - return (TaxDeclarationDetailService) ServiceUtil.getService(TaxDeclarationDetailServiceImpl.class, user); + return ServiceUtil.getService(TaxDeclarationDetailServiceImpl.class, user); } private SalaryAcctRecordService getSalaryAcctRecordService(User user) { - return (SalaryAcctRecordService) ServiceUtil.getService(SalaryAcctRecordServiceImpl.class, user); + return ServiceUtil.getService(SalaryAcctRecordServiceImpl.class, user); } private TaxDeclarationMapper getTaxDeclarationMapper() { @@ -80,12 +80,6 @@ public class TaxDeclarationWrapper extends Service { return MapperProxyFactory.getProxy(SalaryAcctRecordMapper.class); } - private TaxAgentBiz taxAgentBiz = new TaxAgentBiz(); -// private SalaryItemBiz salaryItemBiz; -// private TaxDeclarationDetailService taxDeclarationDetailService; -// private SalaryAcctResultService salaryAcctResultService; -// private SalaryAcctRecordService salaryAcctRecordService; - private AddUpSituationMapper getAddUpSituationMapper() { return MapperProxyFactory.getProxy(AddUpSituationMapper.class); } @@ -102,10 +96,6 @@ public class TaxDeclarationWrapper extends Service { return ServiceUtil.getService(SalaryAcctResultServiceImpl.class, user); } - -// private TaxDeclarationMapper taxDeclarationMapper; - - /** * 个税申报表列表 * @@ -146,7 +136,7 @@ public class TaxDeclarationWrapper extends Service { throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98877, "个税申报表不存在或已删除")); } // 查询个税扣缴义务人 - TaxAgent taxAgent = new TaxAgentBiz().getById(id); + TaxAgentPO taxAgent = getTaxAgentService(user).getById(id); //日期转换 SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM"); String transformDate = simpleDateFormat.format(taxDeclaration.getSalaryMonth()); @@ -154,7 +144,7 @@ public class TaxDeclarationWrapper extends Service { formDTO = TaxDeclarationFormDTO.builder() .salaryMonth(SalaryDateUtil.String2YearMonth(transformDate)) .taxAgentId(taxDeclaration.getTaxAgentId()) - .taxAgentName(Optional.ofNullable(taxAgent).map(TaxAgent::getName).orElse("")) + .taxAgentName(Optional.ofNullable(taxAgent).map(TaxAgentPO::getName).orElse("")) .description(taxDeclaration.getDescription()) .build(); } @@ -162,10 +152,10 @@ public class TaxDeclarationWrapper extends Service { // WeaForm weaForm = SalaryFormatUtil.getInstance().buildForm(TaxDeclarationFormDTO.class, formDTO); // 查询租户所有的个税扣缴义务人 - Collection taxAgentListDTOS = new TaxAgentBiz().listAll(); + Collection taxAgentListDTOS =getTaxAgentService(user).listAll(); // 表单中个税扣缴义务人的可选项 List weaFormOptions = Lists.newArrayListWithExpectedSize(taxAgentListDTOS.size()); - for (TaxAgent taxAgent : taxAgentListDTOS) { + for (TaxAgentPO taxAgent : taxAgentListDTOS) { weaFormOptions.add(new WeaFormOption("" + taxAgent.getId(), taxAgent.getName())); } // weaForm.getItems().forEach((k, v) -> { @@ -197,11 +187,11 @@ public class TaxDeclarationWrapper extends Service { SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM"); String transformDate = simpleDateFormat.format(taxDeclaration.getSalaryMonth()); // 查询个税扣缴义务人 - TaxAgent taxAgentPO = new TaxAgentBiz().getById(taxDeclaration.getTaxAgentId()); + TaxAgentPO taxAgentPO = getTaxAgentService(user).getById(taxDeclaration.getTaxAgentId()); return TaxDeclarationInfoDTO.builder() .salaryMonth(SalaryDateUtil.String2YearMonth(transformDate)) .taxAgentId(taxDeclaration.getTaxAgentId()) - .taxAgentName(Optional.ofNullable(taxAgentPO).map(TaxAgent::getName).orElse("")) + .taxAgentName(Optional.ofNullable(taxAgentPO).map(TaxAgentPO::getName).orElse("")) .build(); } /**