Merge branch 'auth-1' into release

This commit is contained in:
钱涛 2022-05-31 18:29:43 +08:00
commit 69c76ea687
53 changed files with 1149 additions and 1944 deletions

View File

@ -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');

View File

@ -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<List<String>> rowList = getExcelRowList(param);
//获取excel
return ExcelUtil.genWorkbook(rowList,"其他免税扣除");
}
/**
* 获取excel数据行
*
* @return 导出数据行集合
*/
private List<List<String>> getExcelRowList(OtherDeductionQueryParam param) {
//excel标题
List<String> title = Arrays.asList("姓名", "个税扣缴义务人", "部门", "手机号", "工号", "证件号码", "入职日期", "商业健康保险", "税延养老保险", "其他", "准予扣除的捐赠额");
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
List<OtherDeductionListDTO> list = list(param);
final List<List<String>> dataRowList = Optional.ofNullable(list)
.map(List::stream)
.map(operatorStream -> operatorStream.map(dto -> {
List<String> 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<List<String>> rowList = new ArrayList<>();
rowList.add(title);
rowList.addAll(dataRowList);
return rowList;
}
/**
* 导出详情列表
*
* @param param
* @return
*/
public XSSFWorkbook exportDetail(OtherDeductionQueryParam param) {
//获取操作按钮资源
List<List<String>> rowList = getExcelRowDetailList(param);
//获取excel
return ExcelUtil.genWorkbook(rowList,"其他免税扣除明细");
}
/**
* 导出详情
*
* @param param
* @return
*/
private List<List<String>> getExcelRowDetailList(OtherDeductionQueryParam param) {
//excel标题
List<String> title = Arrays.asList("姓名", "申报月份", "个税扣缴义务人", "部门", "手机号", "工号", "商业健康保险", "税延养老保险", "其他", "准予扣除的捐赠额");
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM");
//查询详细信息
List<OtherDeductionRecordDTO> list = recordList(param);
final List<List<String>> dataRowList = Optional.ofNullable(list)
.map(List::stream)
.map(operatorStream -> operatorStream.map(dto -> {
List<String> 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<List<String>> rowList = new ArrayList<>();
rowList.add(title);
rowList.addAll(dataRowList);
return rowList;
}
/**
* 处理导入数据

View File

@ -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<Map<String, Object>> {
protected HttpServletRequest request;
public AddUpDeductionImportCmd(Map<String, Object> params, User user) {
this.user = user;
this.params = params;
}
@Override
public BizLogContext getLogContext() {
return null;
}
@Override
public Map<String, Object> execute(CommandContext commandContext) {
Map<String, Object> apidatas = new HashMap<String, Object>();
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<AddUpDeductionDTO> 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<DataCollectionEmployee> employees = employBiz.listEmployee();
List<TaxAgent> taxAgents = new TaxAgentBiz().listAll();
//税款所属期
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
Date declareMonth = SalaryDateUtil.stringToDate(declareMonthStr + "-01");
// 错误excel内容
List<Map> errorData = new ArrayList<>();
//合规数据
List<AddUpDeduction> 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<Long> employeeSameIds = new ArrayList<>();
List<DataCollectionEmployee> 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<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", rowIndex + "姓名不能为空");
errorData.add(errorMessageMap);
errorSum += 1;
} else if (CollectionUtils.isEmpty(employeeSameIds) || employeeSameIds.size() > 1) {
Map<String, String> 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<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", rowIndex + "姓名错误,系统内不存在该姓名");
errorData.add(errorMessageMap);
errorSum += 1;
}
}
String taxAgentName = dto.getTaxAgentName();
if (StringUtils.isBlank(taxAgentName)) {
//个税扣缴义务人不能为空
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", rowIndex + "个税扣缴义务人不能为空");
errorData.add(errorMessageMap);
errorSum += 1;
} else {
Optional<TaxAgent> 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<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", rowIndex + "个税扣缴义务人与导入时选择的不一致");
errorData.add(errorMessageMap);
errorSum += 1;
} else {
addUpDeduction.setTaxAgentId(optionalTemp.get().getId());
}
} else {
//个税扣缴义务人不存在
Map<String, String> 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("税款所属期为空");
}
}
}

View File

@ -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<XSSFWorkbook> {
public OtherDeductionExportCmd(Map<String, Object> 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;
}
}

View File

@ -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<XSSFWorkbook> {
public OtherDeductionExportDetailCmd(Map<String, Object> 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<DataCollectionEmployee> employeeList = employBiz.getEmployeeByIds(Collections.singletonList(po.getEmployeeId()));
if (CollectionUtils.isEmpty(employeeList)) {
throw new SalaryRunTimeException("员工信息不存在");
}
//构建参数
queryParam.setEmployeeId(po.getEmployeeId());
//申报月份
List<String> 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;
}
}

View File

@ -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<Map<String, Object>> {
public OtherDeductionGetDetailListCmd(Map<String, Object> params, User user) {
this.user = user;
this.params = params;
}
@Override
public BizLogContext getLogContext() {
return null;
}
@Override
public Map<String, Object> 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<DataCollectionEmployee> employeeList = employBiz.getEmployeeByIds(Collections.singletonList(po.getEmployeeId()));
if (CollectionUtils.isEmpty(employeeList)) {
throw new SalaryRunTimeException("员工信息不存在");
}
//构建参数
queryParam.setEmployeeId(po.getEmployeeId());
//申报月份
List<String> 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<OtherDeductionRecordDTO> table = new SalaryWeaTable<OtherDeductionRecordDTO>(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<Long> 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<String> 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<Long> 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<Date> 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;
}
}

View File

@ -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<Map<String, Object>> {
public OtherDeductionGetSearchConditionCmd(Map<String, Object> params, User user) {
this.user = user;
this.params = params;
}
@Override
public BizLogContext getLogContext() {
return null;
}
@Override
public Map<String, Object> execute(CommandContext commandContext) {
Map<String, Object> apidatas = new HashMap<String, Object>();
ConditionFactory conditionFactory = new ConditionFactory(user);
//条件组
List<SearchConditionGroup> addGroups = new ArrayList<SearchConditionGroup>();
List<SearchConditionItem> conditionItems = new ArrayList<SearchConditionItem>();
//文本输入框
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<SearchConditionOption> dateOptions = new ArrayList<SearchConditionOption>();
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;
}
}

View File

@ -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<Map<String, Object>> {
protected HttpServletRequest request;
public OtherDeductionImportCmd(Map<String, Object> params, User user) {
this.user = user;
this.params = params;
}
@Override
public BizLogContext getLogContext() {
return null;
}
@SneakyThrows
@Override
public Map<String, Object> execute(CommandContext commandContext) {
Map<String, Object> apidatas = new HashMap<String, Object>();
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<OtherDeductionListDTO> 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<DataCollectionEmployee> employees = employBiz.listEmployee();
List<TaxAgent> taxAgents = new TaxAgentBiz().listAll();
//税款所属期
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
Date declareMonth = simpleDateFormat.parse(declareMonthStr + "-01");
// 错误excel内容
List<Map> errorData = new ArrayList<>();
//合规数据
List<OtherDeductionPO> 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<Long> employeeSameIds = new ArrayList<>();
List<DataCollectionEmployee> 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<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", rowIndex + "姓名不能为空");
errorData.add(errorMessageMap);
errorSum += 1;
} else if (CollectionUtils.isEmpty(employeeSameIds) || employeeSameIds.size() > 1) {
Map<String, String> 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<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", rowIndex + "姓名错误,系统内不存在该姓名");
errorData.add(errorMessageMap);
errorSum += 1;
}
}
String taxAgentName = dto.getTaxAgentName();
if (StringUtils.isBlank(taxAgentName)) {
//个税扣缴义务人不能为空
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", rowIndex + "个税扣缴义务人不能为空");
errorData.add(errorMessageMap);
errorSum += 1;
} else {
Optional<TaxAgent> 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<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", rowIndex + "个税扣缴义务人与导入时选择的不一致");
errorData.add(errorMessageMap);
errorSum += 1;
} else {
po.setTaxAgentId(optionalTemp.get().getId());
}
} else {
//个税扣缴义务人不存在
Map<String, String> 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("税款所属期为空");
}
}
}

View File

@ -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<Map<String, Object>> {
public OtherDeductionListCmd(Map<String, Object> params, User user) {
this.user = user;
this.params = params;
}
@Override
public BizLogContext getLogContext() {
return null;
}
@Override
public Map<String, Object> 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<OtherDeductionListDTO> table = new SalaryWeaTable<OtherDeductionListDTO>(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<String> 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<Long> 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<String> 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<Long> 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<Date> 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;
}
}

View File

@ -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<Map<String, Object>> {
protected HttpServletRequest request;
public OtherDeductionPreviewCmd(Map<String, Object> params, User user) {
this.user = user;
this.params = params;
}
@Override
public BizLogContext getLogContext() {
return null;
}
@SneakyThrows
@Override
public Map<String, Object> execute(CommandContext commandContext) {
Map<String, Object> apidatas = new HashMap<String, Object>();
//导入参数
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<OtherDeductionListDTO> OtherDeductions = ExcelParseHelper.parse2Map(fileInputStream, OtherDeductionListDTO.class, 0, 1, 11, "OtherDeductionTemplate.xlsx");
apidatas.put("preview", OtherDeductions);
} finally {
IOUtils.closeQuietly(fileInputStream);
}
return apidatas;
}
}

View File

@ -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")

View File

@ -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;

View File

@ -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<Long> ids;

View File

@ -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<SalaryAccEmployeeListDTO> convert2EmployeeListDTO(List<SalaryAcctEmployeePO> salaryAccountingEmployees,
List<TaxAgent> taxAgents,
List<TaxAgentPO> taxAgents,
List<DataCollectionEmployee> simpleEmployees) {
if (CollectionUtils.isEmpty(salaryAccountingEmployees)) {
return Collections.emptyList();
}
Map<Long, String> taxAgentNameMap = SalaryEntityUtil.convert2Map(taxAgents, TaxAgent::getId, TaxAgent::getName);
Map<Long, String> taxAgentNameMap = SalaryEntityUtil.convert2Map(taxAgents, TaxAgentPO::getId, TaxAgentPO::getName);
Map<Long, DataCollectionEmployee> simpleEmployeeMap = SalaryEntityUtil.convert2Map(simpleEmployees, DataCollectionEmployee::getEmployeeId);
return salaryAccountingEmployees.stream()
.map(e -> {

View File

@ -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<DataCollectionEmployee> simpleEmployees,
List<SalaryAcctEmployeePO> salaryAcctEmployees,
List<SalaryAcctResultPO> salaryAccountingResults,
List<TaxAgent> taxAgents,
List<TaxAgentPO> taxAgents,
Set<Long> consolidatedTaxSalaryAcctEmpIds,
Map<Long, String> customParameters) {
if (CollectionUtils.isEmpty(salaryAcctEmployees)) {
@ -176,7 +176,7 @@ public class SalaryAcctResultBO {
}
Map<Long, DataCollectionEmployee> employeeMap = SalaryEntityUtil.convert2Map(simpleEmployees, DataCollectionEmployee::getEmployeeId);
Map<Long, List<SalaryAcctResultPO>> acctResultMap = SalaryEntityUtil.group2Map(salaryAccountingResults, SalaryAcctResultPO::getEmployeeId);
Map<Long, String> taxAgentNameMap = SalaryEntityUtil.convert2Map(taxAgents, TaxAgent::getId, TaxAgent::getName);
Map<Long, String> taxAgentNameMap = SalaryEntityUtil.convert2Map(taxAgents, TaxAgentPO::getId, TaxAgentPO::getName);
return salaryAcctEmployees.stream().map(e -> {
Map<Long, Object> resultValueMap = SalaryEntityUtil.convert2Map(acctResultMap.getOrDefault(e.getEmployeeId(), Collections.emptyList()),
SalaryAcctResultPO::getSalaryItemId, SalaryAcctResultPO::getResultValue);
@ -226,7 +226,7 @@ public class SalaryAcctResultBO {
List<SalaryAcctEmployeePO> salaryAcctEmployees,
List<SalaryAcctResultPO> salaryAcctResultPOS,
List<ExcelAcctResultPO> excelAcctResultPOS,
List<TaxAgent> taxAgents,
List<TaxAgentPO> taxAgents,
Map<Long, String> customParameters,
Set<Long> consolidatedTaxSalaryAcctEmpIds,
Set<Long> includeSalaryItemIds) {
@ -235,7 +235,7 @@ public class SalaryAcctResultBO {
}
Map<Long, List<ExcelAcctResultPO>> excelResultMap = SalaryEntityUtil.group2Map(excelAcctResultPOS, ExcelAcctResultPO::getSalaryAcctEmpId);
Map<Long, List<SalaryAcctResultPO>> acctResultMap = SalaryEntityUtil.group2Map(salaryAcctResultPOS, SalaryAcctResultPO::getSalaryAcctEmpId);
Map<Long, String> taxAgentNameMap = SalaryEntityUtil.convert2Map(taxAgents, TaxAgent::getId, TaxAgent::getName);
Map<Long, String> taxAgentNameMap = SalaryEntityUtil.convert2Map(taxAgents, TaxAgentPO::getId, TaxAgentPO::getName);
Map<Long, DataCollectionEmployee> employeeMap = SalaryEntityUtil.convert2Map(simpleEmployees, DataCollectionEmployee::getEmployeeId);
List<Map<String, Object>> 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<SalarySobEmpFieldPO> salarySobEmpFields,
List<SalarySobItemPO> salarySobItemPOS,
@ -320,7 +320,7 @@ public class SalaryAcctResultBO {
// 员工信息字段
Map<String, String> 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<String, String> employeeFieldNameMap = buildEmployeeFieldName();
List<SalaryAcctEmployeeInfoDTO> 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<SalarySobEmpFieldPO> salarySobEmpFields,
List<SalaryItemPO> salaryItems,
List<SalaryAcctEmployeePO> salaryAcctEmployees,

View File

@ -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<TaxAgent> taxAgentList;
Collection<TaxAgentPO> taxAgentList;
/**
* 获取所有可被引用的薪资项目

View File

@ -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<Map<String, Object>> listPage, boolean isOpenDevolution) {
// 表格表头
List<WeaTableColumn> columns = new ArrayList<>();
List<Column> 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<List<Permission>> getDefaultOperatesPermission(int operateSize, int recordSize) {
@ -354,8 +341,7 @@ public class TaxAgentBO {
}
}
public static Result handleTaxAgentRange(List<TaxAgentManageRangePO> taxAgentManageRanges, TaxAgentManageRangeSaveParam saveParam, Long taxAgentId, Long employeeId
) {
public static Result handleTaxAgentRange(List<TaxAgentManageRangePO> taxAgentManageRanges, TaxAgentManageRangeSaveParam saveParam, Long taxAgentId, Long employeeId) {
return handleManageRange(taxAgentManageRanges, saveParam, TaxAgentRangeTypeEnum.TAXAGENT, taxAgentId, 0L, employeeId);
}

View File

@ -61,7 +61,6 @@ public class TaxAgentManageRangePO {
* 人员状态
*/
private String employeeStatus;
/**
* 是包含还是排除 0排除1包含
*/

View File

@ -18,8 +18,8 @@ public enum TargetTypeEnum implements BaseEnum<Integer> {
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;

View File

@ -44,5 +44,5 @@ public interface EmployMapper {
List<DeptInfo> getDeptInfoList(@Param("departmentIds") List<Long> departmentIds);
List<SubCompanyInfo> getSubCompanyInfoList(List<Long> subDepartmentIds);
List<SubCompanyInfo> getSubCompanyInfoList(@Param("subDepartmentIds") List<Long> subDepartmentIds);
}

View File

@ -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,

View File

@ -69,9 +69,6 @@
<if test="id != null and id != ''">
AND id = #{id}
</if>
<if test="name != null and name != ''">
AND name = #{name}
</if>
<if test="incomeCategory != null and incomeCategory != ''">
AND income_category = #{incomeCategory}
</if>
@ -126,6 +123,7 @@
#{taxAgentId}
</foreach>
</if>
<include refid="listSomeParamSql"/>
ORDER BY id DESC
</select>
@ -364,4 +362,22 @@
</sql>
<sql id="listSomeParamSql">
<if test="name != null and name != ''">
AND name like CONCAT('%',#{name},'%')
</if>
</sql>
<sql id="listSomeParamSql" databaseId="oracle">
<if test="name != null and name != ''">
AND name like '%'||#{name}||'%'
</if>
</sql>
<sql id="listSomeParamSql" databaseId="sqlserver">
<if test="name != null and name != ''">
AND name like '%'+#{name}+'%'
</if>
</sql>
</mapper>

View File

@ -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 @@
<if test="deleteType != null">
AND delete_type = #{deleteType}
</if>
<if test="employeeId != null">
AND employee_id = #{employeeId}
</if>
<!-- <if test="employeeId != null">-->
<!-- AND employee_id = #{employeeId}-->
<!-- </if>-->
<if test="employeeStatus != null">
AND employee_status = #{employeeStatus}
</if>
@ -136,9 +136,9 @@
<if test="deleteType != null">
delete_type,
</if>
<if test="employeeId != null">
employee_id,
</if>
<!-- <if test="employeeId != null">-->
<!-- employee_id,-->
<!-- </if>-->
<if test="employeeStatus != null">
employee_status,
</if>
@ -180,9 +180,9 @@
<if test="deleteType != null" >
#{deleteType},
</if>
<if test="employeeId != null" >
#{employeeId},
</if>
<!-- <if test="employeeId != null" >-->
<!-- #{employeeId},-->
<!-- </if>-->
<if test="employeeStatus != null" >
#{employeeStatus},
</if>
@ -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 @@
<if test="deleteType != null" >
delete_type=#{deleteType},
</if>
<if test="employeeId != null" >
employee_id=#{employeeId},
</if>
<!-- <if test="employeeId != null" >-->
<!-- employee_id=#{employeeId},-->
<!-- </if>-->
<if test="employeeStatus != null" >
employee_status=#{employeeStatus},
</if>

View File

@ -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<String, Object> getSearchCondition(Map<String, Object> params);
OtherDeductionPO getById(Long id);
/**
* 数据采集-其他免税扣除列表
*
* @param queryParam
* @return
*/
Map<String, Object> list(Map<String, Object> params);
PageInfo<OtherDeductionListDTO> listPage(OtherDeductionQueryParam queryParam);
/**
* 获取数据采集-其他免税扣除表单
* 获取数据采集-其他免税扣除详情
*
* @param queryParam
* @return
*/
Map<String, Object> getDetailList(Map<String, Object> params);
PageInfo<OtherDeductionRecordDTO> recordListPage(OtherDeductionQueryParam queryParam);
/**
* 导出
*
*/
XSSFWorkbook export(OtherDeductionQueryParam queryParam);
/**
* 导出详情
*
*/
XSSFWorkbook exportDetail( OtherDeductionQueryParam queryParam);
/**
* 下载导入模板
*
* @param param
* @return
*/
XSSFWorkbook downloadTemplate(OtherDeductionQueryParam param);
/**
* 预览
*/
Map<String, Object> preview(Map<String, Object> params);
Map<String, Object> preview(OtherDeductionImportParam importParam);
/**
* 导入数据
*/
Map<String, Object> importData(Map<String, Object> params);
Map<String, Object> importData(OtherDeductionImportParam importParam);
/**
* 导出
* 获取其他免税扣除数据
*
* @param declareMonth
* @param employeeIds
* @return
*/
XSSFWorkbook export(Map<String, Object> params);
List<OtherDeductionPO> getOtherDeductionList(YearMonth declareMonth, List<Long> employeeIds);
/**
* 导出详情
*/
XSSFWorkbook exportDetail(Map<String, Object> params);
List<OtherDeductionPO> getOtherDeductionList(YearMonth taxCycle, List<Long> employeeIds);
XSSFWorkbook downloadTemplate(OtherDeductionQueryParam param);
}

View File

@ -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<Map<String, Object>> buildSalaryArchiveData(Collection<SalaryArchiveListDTO> salaryArchives, Collection<TaxAgent> taxAgentLists, List<SalaryItemPO> salaryItems, Boolean isPage);
List<Map<String, Object>> buildSalaryArchiveData(Collection<SalaryArchiveListDTO> salaryArchives, Collection<TaxAgentPO> taxAgentLists, List<SalaryItemPO> salaryItems, Boolean isPage);
/**
* 获取薪资档案对应的当前生效的薪资项目

View File

@ -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<SalarySobPO> listPageByParam(SalarySobListQueryParam queryParam);
PageInfo<SalarySobPO> listPageByParam(SalarySobListQueryParam queryParam);
/**
* 保存
@ -123,4 +124,12 @@ public interface SalarySobService {
* @return
*/
SalarySobCycleDTO getSalarySobCycle(Long id, YearMonth salaryMonth);
/**
* 按权限过滤掉无权限的薪资账套
*
* @param salarySobPOS
* @return
*/
List<SalarySobPO> filterByAuthority(List<SalarySobPO> salarySobPOS);
}

View File

@ -1,18 +0,0 @@
package com.engine.salary.service;
import com.engine.salary.entity.taxrate.TaxAgent;
import java.util.Collection;
public interface TaxAgentService {
Collection<TaxAgent> findAll();
/**
* 根据id获取单个个税扣缴义务人
*
* @param id
* @return
*/
TaxAgent getById(Long id);
}

View File

@ -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<TaxAgent> taxAgents = new TaxAgentBiz().listAll();
// 错误excel内容
List<Map> errorData = new ArrayList<>();
//合规数据

View File

@ -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<TaxAgent> taxAgents = new TaxAgentBiz().listAll();
Date now = new Date();

View File

@ -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<List<Object>> rows = new ArrayList<>();
rows.add(header);
for (Map<String, Object> dto : listMaps) {
List<Object> row = new ArrayList<>();
row.add(dto.get("username"));
row.add(dto.get("departmentName"));
row.add(dto.get("mobile"));
row.add(dto.get("jobNum"));
// 动态列
Map<String, Object> 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<String, Object> dto : listMaps) {
// List<Object> row = new ArrayList<>();
// row.add(dto.get("username"));
// row.add(dto.get("departmentName"));
// row.add(dto.get("mobile"));
// row.add(dto.get("jobNum"));
//
// // 动态列
// Map<String, Object> 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) {

View File

@ -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<String, Object> getSearchCondition(Map<String, Object> 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<String, Object> list(Map<String, Object> params) {
return commandExecutor.execute(new OtherDeductionListCmd(params, user));
public OtherDeductionPO getById(Long id) {
return getOtherDeductionMapper().getById(id);
}
@Override
public PageInfo<OtherDeductionListDTO> listPage(OtherDeductionQueryParam queryParam) {
long employeeId = user.getUID();
// 未开启分权或是薪酬模块总管理员
if (!getTaxAgentV2Service(user).isOpenDevolution() || getTaxAgentV2Service(user).isChief(employeeId)) {
SalaryPageUtil.start(queryParam.getCurrent(), queryParam.getPageSize());
List<OtherDeductionListDTO> list = getOtherDeductionMapper().list(queryParam);
return new PageInfo<>(list, OtherDeductionListDTO.class);
} else {
List<TaxAgentEmployeeDTO> taxAgentEmployees = getTaxAgentV2Service(user).listTaxAgentAndEmployee(employeeId);
List<Long> taxAgentIdsAsAdmin = getTaxAgentV2Service(user).listAllTaxAgentsAsAdmin(employeeId).stream().map(TaxAgentPO::getId).collect(Collectors.toList());
// List<OtherDeductionPO> lastList = getLastListByModifier(employeeId, tenantKey);
List<OtherDeductionListDTO> list = getOtherDeductionMapper().list(queryParam);
list = list.stream().filter(f ->
// 作为管理员
taxAgentIdsAsAdmin.contains(f.getTaxAgentId())
).collect(Collectors.toList());
// 分页参数
PageInfo<OtherDeductionListDTO> 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<String, Object> preview(Map<String, Object> params) {
return commandExecutor.execute(new OtherDeductionPreviewCmd(params, user));
public PageInfo<OtherDeductionRecordDTO> recordListPage(OtherDeductionQueryParam queryParam) {
long employeeId = user.getUID();
// 未开启分权或是薪酬模块总管理员
if (!getTaxAgentV2Service(user).isOpenDevolution() || getTaxAgentV2Service(user).isChief(employeeId)) {
SalaryPageUtil.start(queryParam.getCurrent(), queryParam.getPageSize());
List<OtherDeductionRecordDTO> list = getOtherDeductionMapper().recordList(queryParam);
return new PageInfo<>(list, OtherDeductionRecordDTO.class);
} else {
List<TaxAgentEmployeeDTO> taxAgentEmployees = getTaxAgentV2Service(user).listTaxAgentAndEmployee(employeeId);
List<Long> taxAgentIdsAsAdmin = getTaxAgentV2Service(user).listAllTaxAgentsAsAdmin(employeeId).stream().map(TaxAgentPO::getId).collect(Collectors.toList());
// List<OtherDeductionPO> lastList = getLastListByModifier(employeeId, tenantKey);
List<OtherDeductionRecordDTO> list = getOtherDeductionMapper().recordList(queryParam);
list = list.stream().filter(f ->
// 作为管理员
taxAgentIdsAsAdmin.contains(f.getTaxAgentId())
).collect(Collectors.toList());
// 分页参数
PageInfo<OtherDeductionRecordDTO> 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<String, Object> importData(Map<String, Object> params) {
return commandExecutor.execute(new OtherDeductionImportCmd(params, user));
public Map<String, Object> preview(OtherDeductionImportParam importParam) {
Map<String, Object> apidatas = new HashMap<String, Object>();
//excel文件id
String imageId = Util.null2String(importParam.getImageId());
Validate.notBlank(imageId, "imageId为空");
InputStream fileInputStream = null;
try {
fileInputStream = ImageFileManager.getInputStreamById(Integer.parseInt(imageId));
List<OtherDeductionListDTO> 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<String, Object> params) {
OtherDeductionQueryParam OtherDeductionQueryParam = (OtherDeductionQueryParam) params.get("queryParam");
public Map<String, Object> importData(OtherDeductionImportParam importParam) {
long currentEmployeeId = user.getUID();
Map<String, Object> apidatas = new HashMap<String, Object>();
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<OtherDeductionListDTO> 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<DataCollectionEmployee> employees = employBiz.listEmployee();
// 获取所有个税扣缴义务人
Collection<TaxAgentManageRangeEmployeeDTO> taxAgentList = getTaxAgentV2Service(user).listTaxAgentAndEmployeeTree(currentEmployeeId);
//税款所属期
Date declareMonth = SalaryDateUtil.stringToDate(declareMonthStr + "-01");
// 获取已经核算的数据
List<SalaryAcctEmployeePO> salaryAcctEmployees = getAddUpDeductionService(user).getAccountedEmployeeData(declareMonthStr);
// 查询已有数据
List<OtherDeductionPO> list = getOtherDeductionMapper().listSome(OtherDeductionPO.builder().declareMonth(declareMonth).build());
// 错误excel内容
List<Map> errorData = new ArrayList<>();
//合规数据
List<OtherDeductionPO> eligibleData = new ArrayList<>();
List<TaxAgentManageRangeEmployeeDTO.TaxAgentEmployee> 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<Long> employeeSameIds = new ArrayList<>();
List<DataCollectionEmployee> 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<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", rowIndex + "姓名不能为空");
errorData.add(errorMessageMap);
errorSum += 1;
} else if (CollectionUtils.isEmpty(employeeSameIds) || employeeSameIds.size() > 1) {
Map<String, String> 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<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", rowIndex + "姓名错误,系统内不存在该姓名");
errorData.add(errorMessageMap);
errorSum += 1;
}
}
String taxAgentName = dto.getTaxAgentName();
if (StringUtils.isBlank(taxAgentName)) {
//个税扣缴义务人不能为空
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", rowIndex + "个税扣缴义务人不能为空");
errorData.add(errorMessageMap);
errorSum += 1;
} else {
Optional<TaxAgentManageRangeEmployeeDTO> 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<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", rowIndex + "个税扣缴义务人与导入时选择的不一致");
errorData.add(errorMessageMap);
errorSum += 1;
} else {
po.setTaxAgentId(optionalTemp.get().getTaxAgentId());
taxAgentEmployees = optionalTemp.get().getEmployeeList();
}
} else {
//个税扣缴义务人不存在
Map<String, String> 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<TaxAgentManageRangeEmployeeDTO.TaxAgentEmployee> optionalTaxAgentEmp = taxAgentEmployees.stream().filter(f -> f.getEmployeeId().equals(finalPoE.getEmployeeId())).findFirst();
if (!optionalTaxAgentEmp.isPresent()) {
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", rowIndex + "该条数据不在数据权限范围内,不可导入");
errorData.add(errorMessageMap);
errorSum += 1;
}
// 判断是否有核算过
if (CollectionUtils.isNotEmpty(salaryAcctEmployees)) {
OtherDeductionPO finalPo = po;
Optional<SalaryAcctEmployeePO> 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<String, String> 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<String, Object> params) {
/**
* 导出
*
* @param param
* @return
*/
public XSSFWorkbook export(OtherDeductionQueryParam param) {
//获取操作按钮资源
List<List<String>> rowList = getExcelRowList(param);
//获取excel
return ExcelUtil.genWorkbook(rowList,"其他免税扣除");
}
/**
* 获取excel数据行
*
* @return 导出数据行集合
*/
private List<List<String>> getExcelRowList(OtherDeductionQueryParam param) {
long employeeId = user.getUID();
//excel标题
List<String> title = Arrays.asList("姓名", "个税扣缴义务人", "部门", "手机号", "工号", "证件号码", "入职日期", "商业健康保险", "税延养老保险", "其他", "准予扣除的捐赠额");
List<OtherDeductionListDTO> list = getOtherDeductionMapper().list(param);
// 开启分权并且不是薪酬模块总管理员
if (getTaxAgentV2Service(user).isOpenDevolution() && !getTaxAgentV2Service(user).isChief(employeeId)) {
// List<TaxAgentEmployeeDTO> taxAgentEmployees = getTaxAgentV2Service(user).listTaxAgentAndEmployee(employeeId);
List<Long> 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<List<String>> dataRowList = Optional.ofNullable(list)
.map(List::stream)
.map(operatorStream -> operatorStream.map(dto -> {
List<String> 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<List<String>> 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<DataCollectionEmployee> 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<String> declareMonth = queryParam.getDeclareMonth();
List<String> 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<List<String>> rowList = getExcelRowDetailList(param);
// return commandExecutor.execute(new OtherDeductionExportDetailCmd(params, user));
//获取excel
return ExcelUtil.genWorkbook(rowList,"其他免税扣除明细");
}
/**
* 导出详情
*
* @param param
* @return
*/
private List<List<String>> getExcelRowDetailList(OtherDeductionQueryParam param) {
//excel标题
List<String> title = Arrays.asList("姓名", "申报月份", "个税扣缴义务人", "部门", "手机号", "工号", "商业健康保险", "税延养老保险", "其他", "准予扣除的捐赠额");
@Override
public Map<String, Object> getDetailList(Map<String, Object> params) {
return commandExecutor.execute(new OtherDeductionGetDetailListCmd(params, user));
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM");
//查询详细信息
List<OtherDeductionRecordDTO> list = getOtherDeductionMapper().recordList(param);
final List<List<String>> dataRowList = Optional.ofNullable(list)
.map(List::stream)
.map(operatorStream -> operatorStream.map(dto -> {
List<String> 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<List<String>> rowList = new ArrayList<>();
rowList.add(title);
rowList.addAll(dataRowList);
return rowList;
}
@Override
public List<OtherDeductionPO> getOtherDeductionList(YearMonth declareMonth, List<Long> 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<Object> headerList = Arrays.asList(header);
// 获取其他免税扣除
List<OtherDeductionListDTO> list = getOtherDeductionMapper().list(param);
// 人员信息赋值
list.stream().map(m->{
// todo 身份证号
m.setIdNo("");
return m;
}).collect(Collectors.toList());
List<List<Object>> rows = new ArrayList<>();
List<Object> headerList = Arrays.asList(header);
rows.add(headerList);
for (OtherDeductionListDTO dto : list) {
List<Object> 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<ExcelComment> excelComments = Lists.newArrayList();

View File

@ -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<String, Long> schemeNameIdMap = schemeNameIdMap();
Map<Long, String> welfareMap = welfareMap();
// 获取所有个税扣缴义务人的名称和id的map
Map<String, Long> paymentNameIdMap = getTaxAgentService().findAll().stream().collect(Collectors.toMap(TaxAgent::getName, TaxAgent::getId));
Map<String, Long> paymentNameIdMap = getTaxAgentService().findAll().stream().collect(Collectors.toMap(TaxAgentListDTO::getName, TaxAgentListDTO::getId));
// 获取所有人员信息
// 获取租户下所有的人员
List<DataCollectionEmployee> employeeByIds = employeeBiz.listEmployee();

View File

@ -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<DataCollectionEmployee> simpleEmployees = getSalaryEmployeeService(user).listByIds(employeeIds);
// 个税扣缴义务人
List<Long> taxAgentIds = tempList.stream().map(SalaryAcctEmployeePO::getTaxAgentId).distinct().collect(Collectors.toList());
List<TaxAgent> taxAgents = taxAgentService.listByIds(taxAgentIds);
List<TaxAgentPO> taxAgents = getTaxAgentService(user).listByIds(taxAgentIds);
// 转换成列表数据
salaryAccEmployeeListDTOS.addAll(SalaryAcctEmployeeBO.convert2EmployeeListDTO(tempList, taxAgents, simpleEmployees));
}
@ -483,8 +484,8 @@ public class SalaryAcctExcelServiceImpl extends Service implements SalaryAcctExc
List<DataCollectionEmployee> salaryEmployees = getSalaryEmployeeService(user).listAll();
Map<String, Long> salaryEmployeeMap = SalaryEntityUtil.convert2Map(salaryEmployees, DataCollectionEmployee::getUsername, DataCollectionEmployee::getEmployeeId);
// 租户下所有的个税扣缴义务人
List<TaxAgent> taxAgents = taxAgentService.listAll();
Map<String, Long> taxAgentNameMap = SalaryEntityUtil.convert2Map(taxAgents, TaxAgent::getName, TaxAgent::getId);
List<TaxAgentPO> taxAgents = getTaxAgentService(user).listAll();
Map<String, Long> taxAgentNameMap = SalaryEntityUtil.convert2Map(taxAgents, TaxAgentPO::getName, TaxAgentPO::getId);
// 索引(用于计算进度)
int index = 0;

View File

@ -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<SalaryAcctResultPO> 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<DataCollectionEmployee> simpleEmployees = getSalaryEmployeeService(user).listByIds(employeeIds);
// 查询个税扣缴义务人
Set<Long> taxAgentIds = SalaryEntityUtil.properties(salaryAcctEmployeePOS, SalaryAcctEmployeePO::getTaxAgentId);
List<TaxAgent> taxAgentPOS = taxAgentService.listByIds(taxAgentIds);
List<TaxAgentPO> taxAgentPOS = getTaxAgentService(user).listByIds(taxAgentIds);
// 判断是否存在合并计税
Set<Long> 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<SalaryCheckResultPO> loggerContext = new LoggerContext<>();

View File

@ -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<Map<String, Object>> buildSalaryArchiveData(Collection<SalaryArchiveListDTO> salaryArchives,
Collection<TaxAgent> taxAgentLists,
Collection<TaxAgentPO> taxAgentLists,
List<SalaryItemPO> salaryItems,
Boolean isPage) {
// 分页用于表格展示否则用于导出
@ -149,7 +151,7 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe
Map<String, Object> map = Maps.newHashMap();
map.put("salaryArchiveId", m.getSalaryArchiveId());
map.put("taxAgentId", m.getTaxAgentId());
Optional<TaxAgent> optional = taxAgentLists.stream().filter(f -> f.getId().equals(m.getTaxAgentId())).findFirst();
Optional<TaxAgentPO> 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<TaxAgent> taxAgentList = taxAgentService.listAll();
Collection<TaxAgentPO> taxAgentList = getTaxAgentService(user).listAll();
Collection<SalaryArchiveListDTO> salaryArchives = SalaryArchiveMapper.list(queryParam);
List<Map<String, Object>> listMaps = buildSalaryArchiveData(salaryArchives, taxAgentList, salaryItems, Boolean.FALSE);
// 组装数据
@ -267,7 +269,7 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe
}
// 获取所有个税扣缴义务人
Collection<TaxAgent> taxAgentList = taxAgentService.listAll();
Collection<TaxAgentPO> taxAgentList = getTaxAgentService(user).listAll();
Collection<SalaryArchiveListDTO> salaryArchives = SalaryArchiveMapper.list(queryParam);
List<Map<String, Object>> 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<TaxAgent> optionalTaxAgent = importHandleParam.getTaxAgentList().stream().filter(m -> m.getName().equals(taxAgentCellVal)).findFirst();
Long taxAgentId = optionalTaxAgent.map(TaxAgent::getId).orElse(null);
Optional<TaxAgentPO> optionalTaxAgent = importHandleParam.getTaxAgentList().stream().filter(m -> m.getName().equals(taxAgentCellVal)).findFirst();
Long taxAgentId = optionalTaxAgent.map(TaxAgentPO::getId).orElse(null);
// 4.调整原因
String adjustReason = "";
if (isTaxAgentAdjust) {

View File

@ -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<TaxAgentAdjustRecordListDTO> list = getSalaryArchiveTaxAgentMapper().taxAgentAdjustRecordList(queryParam);
List<TaxAgentAdjustRecordListDTO> listAll = getSalaryArchiveTaxAgentMapper().taxAgentAdjustRecordList(TaxAgentAdjustRecordQueryParam.builder().build());
// 个税扣缴义务人
Collection<TaxAgent> taxAgentList = taxAgentService.listAll();
Collection<TaxAgentPO> 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<TaxAgentAdjustRecordListDTO> optional = listAll.stream().filter(f -> f.getSalaryArchiveId().equals(m.getSalaryArchiveId())).findFirst();
m.setAdjustBefore(optional.isPresent() ? optional.get().getAdjustAfter() : "");
Optional<TaxAgent> optionalBefore = taxAgentList.stream().filter(t -> t.getId().toString().equals(m.getAdjustBefore())).findFirst();
Optional<TaxAgentPO> optionalBefore = taxAgentList.stream().filter(t -> t.getId().toString().equals(m.getAdjustBefore())).findFirst();
m.setAdjustBefore(optionalBefore.isPresent() ? optionalBefore.get().getName() : "");
Optional<TaxAgent> optionalAfter = taxAgentList.stream().filter(t -> t.getId().toString().equals(m.getAdjustAfter())).findFirst();
Optional<TaxAgentPO> 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())));

View File

@ -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<Long> taxAgentIds = SalaryEntityUtil.properties(salaryAcctEmployeePOS, SalaryAcctEmployeePO::getTaxAgentId);
List<TaxAgent> taxAgentPOS = taxAgentService.listByIds(taxAgentIds);
List<TaxAgentPO> taxAgentPOS = getTaxAgentService(user).listByIds(taxAgentIds);
// 查询人员信息
List<Long> employeeIds = SalaryEntityUtil.properties(salaryAcctEmployeePOS, SalaryAcctEmployeePO::getEmployeeId, Collectors.toList());
List<DataCollectionEmployee> simpleEmployees = getSalaryEmployeeService(user).listByIds(employeeIds);

View File

@ -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);

View File

@ -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<SalarySobPO> listPageByParam(SalarySobListQueryParam queryParam, String tenantKey) {
// // 分页参数
// Page<SalarySobPO> 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<SalarySobPO> listPageByParam(SalarySobListQueryParam queryParam) {
long employeeId = user.getUID();
// 分页参数
PageInfo<SalarySobPO> 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<SalarySobPO> salarySobPOS = salarySobMapper.listSome(build);
// 根据权限过滤
List<SalarySobPO> salarySobsFilterByAuthority = filterByAuthority(salarySobPOS);
if (CollectionUtils.isEmpty(salarySobsFilterByAuthority)) {
return page;
}
List<SalarySobPO> 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<SalarySobPO> 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<SalarySobPO> filterByAuthority(List<SalarySobPO> salarySobPOS) {
long employeeId = user.getUID();
// 判断是否是总管理员
Boolean isChief = getTaxAgentService(user).isChief(employeeId);
// 是否开启分权
Boolean openDevolution = getTaxAgentService(user).isOpenDevolution();
// 开启分权后
// 总管理员都能看见
// 管理员可以看见自己创建的+自己下面的分管理员创建的
// 分管理员只能看见自己创建的
if (!openDevolution || isChief) {
return salarySobPOS;
}
// 查询所有的个税扣缴义务人
List<TaxAgentPO> taxAgentPOS = getTaxAgentService(user).listAll();
Set<Long> allTaxAgentIds = SalaryEntityUtil.properties(taxAgentPOS, TaxAgentPO::getId);
// 查询个税扣缴义务人的管理员
List<TaxAgentAdminPO> taxAgentAdminPOS = getTaxAgentAdminService(user).listByTaxAgentIds(allTaxAgentIds);
Map<Long, Set<Long>> adminMap = SalaryEntityUtil.group2Map(taxAgentAdminPOS, TaxAgentAdminPO::getEmployeeId, TaxAgentAdminPO::getTaxAgentId);
// 查询个税扣缴义务人的分管理员
// List<TaxAgentSubAdminPO> taxAgentSubAdminPOS = taxAgentSubAdminService.listByTaxAgentIds(allTaxAgentIds, tenantKey);
// Map<Long, Set<Long>> subAdminMap = SalaryEntityUtil.group2Map(taxAgentSubAdminPOS, TaxAgentSubAdminPO::getTaxAgentId, TaxAgentSubAdminPO::getEmployeeId);
return salarySobPOS.stream().filter(salarySobPO -> {
Set<Long> taxAgentIds = adminMap.get(employeeId);
if (CollectionUtils.isEmpty(taxAgentIds)) {
return false;
}
return taxAgentIds.contains(salarySobPO.getTaxAgentId());
}).collect(Collectors.toList());
}
}

View File

@ -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<DataCollectionEmployee> allSalaryEmployees, List<TaxAgentManageRangePO> 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<TaxAgentManageRangePO> 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<TaxAgentSubAdminEmpSaveParam> subAdminEmpSaveParamList = getTaxAgentSubAdminEmpSyncParam(taxAgentId, allSubAdminRanges);
// List<TaxAgentSubAdminEmpSaveParam> subAdminEmpSaveParamList = getTaxAgentSubAdminEmpSyncParam(taxAgentId, allSubAdminRanges);
// 同步分管理员的人员
taxAgentSubAdminEmployeeService.syncTaxAgentSubAdminEmployee(subAdminEmpSaveParamList, employeeId);
// taxAgentSubAdminEmployeeService.syncTaxAgentSubAdminEmployee(subAdminEmpSaveParamList, employeeId);
}
}

View File

@ -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<TaxAgent> findAll() {
return new TaxAgentBiz().listAll();
}
@Override
public TaxAgent getById(Long id) {
return getTaxAgentMapper().getById(id);
}
}

View File

@ -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<String, Object>, Map<String, Object>>(user).run(getService(user)::getSearchCondition, ParamUtil.request2Map(request));
return new ResponseResult<Map<String, Object>, Map<String, Object>>(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<String, Object> map = ParamUtil.request2Map(request);
map.put("queryParam", queryParam);
return new ResponseResult<Map<String, Object>, Map<String, Object>>(user).run(getService(user)::list, map);
return new ResponseResult<OtherDeductionQueryParam, PageInfo<OtherDeductionListDTO>>(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<String, Object> map = ParamUtil.request2Map(request);
map.put("queryParam", queryParam);
return new ResponseResult<Map<String, Object>, Map<String, Object>>(user).run(getService(user)::getDetailList, map);
return new ResponseResult<OtherDeductionQueryParam, PageInfo<OtherDeductionRecordDTO>>(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<String, Object> 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<String, Object> 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<String, Object> map = ParamUtil.request2Map(request);
map.put("importParam", importParam);
return new ResponseResult<Map<String, Object>, Map<String, Object>>(user).run(getService(user)::preview, map);
return new ResponseResult<OtherDeductionImportParam, Map<String, Object>>(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<String, Object> map = ParamUtil.request2Map(request);
map.put("importParam", importParam);
return new ResponseResult<Map<String, Object>, Map<String, Object>>(user).run(getService(user)::importData, map);
return new ResponseResult<OtherDeductionImportParam, Map<String, Object>>(user).run(getOtherDeductionWrapper(user)::importData, importParam);
}

View File

@ -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<TaxAgentQueryParam, Map<String, Object>>(user).run(getTaxAgentWrapper(user)::list, queryParam);
return new ResponseResult<TaxAgentQueryParam, PageInfo<Map<String, Object>>>(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<Long, TaxAgentFormDTO>(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<TaxAgentSubAdminQueryParam, PageInfo<TaxAgentSubAdminListDTO>>(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<TaxAgentSubAdminQueryParam, PageInfo<TaxAgentSubAdminListDTO>>(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<TaxAgentSubAdminBaseFormParam, TaxAgentSubAdminBaseFormDTO>(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<TaxAgentSubAdminBaseFormParam, TaxAgentSubAdminBaseFormDTO>(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<TaxAgentSubAdminBaseSaveParam, String>(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<TaxAgentSubAdminBaseSaveParam, String>(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<Long> ids) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<Collection<Long>, 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<Long> ids) {
// User user = HrmUserVarify.getUser(request, response);
// return new ResponseResult<Collection<Long>, 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<TaxAgentSubAdminRangeQueryParam, PageInfo<TaxAgentManageRangeListDTO>>(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<TaxAgentSubAdminRangeQueryParam, PageInfo<TaxAgentManageRangeListDTO>>(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<TaxAgentSubAdminRangeQueryParam, PageInfo<TaxAgentManageRangeListDTO>>(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<TaxAgentSubAdminRangeQueryParam, PageInfo<TaxAgentManageRangeListDTO>>(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<TaxAgentSubAdminRangeQueryParam, TaxAgentManageRangeFormDTO>(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<TaxAgentSubAdminRangeQueryParam, TaxAgentManageRangeFormDTO>(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<TaxAgentSubAdminRangeSaveParam, TaxAgentManageRangeFormDTO>(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<TaxAgentSubAdminRangeSaveParam, TaxAgentManageRangeFormDTO>(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<Long> ids) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<Collection<Long>, 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<Long> ids) {
// User user = HrmUserVarify.getUser(request, response);
// return new ResponseResult<Collection<Long>, String>(user).run(getTaxAgentSubAdminWrapper(user)::deleteRange, ids);
// }
/******** 分管理员 end ***********************************************************************************************/

View File

@ -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;
/**
* 同步考勤引用数据
*

View File

@ -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.<OtherDeductionSearchConditionDTO>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<OtherDeductionListDTO> 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<OtherDeductionListDTO> page = new Page<>(queryParam.getCurrent(), queryParam.getPageSize(), true);
// page = otherDeductionService.listPage(page, queryParam, currentEmployeeId, currentTenantKey);
//
// List<OtherDeductionListDTO> list = page.getRecords();
//
// List<SimpleUserInfo> simpleUserInfos = salaryEmployeeService.listByEmployeeIds(list.stream().map(OtherDeductionListDTO::getEmployeeId).collect(Collectors.toList()), currentTenantKey);
// // 人员信息赋值
// list.forEach(m->{
// // 身份证号
// m.setIdNo(DataCollectionBO.getIdNo(m.getEmployeeId(), simpleUserInfos));
// });
// WeaTable<OtherDeductionListDTO> weaTable = FormatManager.<OtherDeductionListDTO>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<OtherDeductionRecordDTO> 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<OtherDeductionRecordDTO> page = new Page<>(queryParam.getCurrent(), queryParam.getPageSize(), true);
//
// page = otherDeductionService.recordListPage(page, queryParam, currentEmployeeId, currentTenantKey);
// // 记录表格
// WeaTable<OtherDeductionRecordDTO> weaTable = FormatManager.<OtherDeductionRecordDTO>getInstance()
// .genTable(OtherDeductionRecordDTO.class, page);
// weaTable.setModule("hrmsalary");
// return weaTable;
// }
//
// /**
// * 导出-其他免税扣除列表
// *
// * @param queryParam
// * @param currentEmployeeId
// * @param currentTenantKey
// * @return
// */
// public Map<String, Object> export(OtherDeductionQueryParam queryParam, Long currentEmployeeId, String currentTenantKey) {
// // 构建异步导出参数
// Map<String, Object> 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<String, Object> 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<String, Object> 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<String, Object> downloadTemplate(OtherDeductionQueryParam queryParam, Long currentEmployeeId, String currentTenantKey) {
// // 构建异步导出参数
// Map<String, Object> 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<String, Object> getSearchCondition() {
Map<String, Object> apidatas = new HashMap<String, Object>();
ConditionFactory conditionFactory = new ConditionFactory(user);
//条件组
List<SearchConditionGroup> addGroups = new ArrayList<SearchConditionGroup>();
List<SearchConditionItem> conditionItems = new ArrayList<SearchConditionItem>();
//文本输入框
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<SearchConditionOption> dateOptions = new ArrayList<SearchConditionOption>();
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<OtherDeductionListDTO> 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<OtherDeductionRecordDTO> 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<String, Object> preview(OtherDeductionImportParam importParam){
return getOtherDeductionService(user).preview(importParam);
}
/**
* 导入数据
*/
public Map<String, Object> importData(OtherDeductionImportParam importParam){
return getOtherDeductionService(user).importData(importParam);
}
}

View File

@ -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<DataCollectionEmployee> simpleEmployees = getSalaryEmployeeService(user).listByIds(employeeIds);
// 查询个税扣缴义务人
List<Long> taxAgentIds = list.stream().map(SalaryAcctEmployeePO::getTaxAgentId).collect(Collectors.toList());
List<TaxAgent> taxAgentPOS = taxAgentService.listByIds(taxAgentIds);
List<TaxAgentPO> taxAgentPOS = getTaxAgentService(user).listByIds(taxAgentIds);
// 转换成列表dto
List<SalaryAccEmployeeListDTO> salaryAccEmployeeListDTOS = SalaryAcctEmployeeBO.convert2EmployeeListDTO(list, taxAgentPOS, simpleEmployees);
PageInfo<SalaryAccEmployeeListDTO> pageInfo = new PageInfo<SalaryAccEmployeeListDTO>(salaryAccEmployeeListDTOS, SalaryAccEmployeeListDTO.class);
@ -111,7 +115,7 @@ public class SalaryAcctEmployeeWrapper extends Service {
// WeaSearchCondition searchCondition = SalaryFormatUtil.<SalaryAcctEmpSearchConditionDTO>getInstance().buildCondition(SalaryAcctEmpSearchConditionDTO.class,
// searchConditionDTO, "SalaryAcctEmpCondition");
// // 查询个税扣缴义务人
// List<TaxAgentPO> taxAgentPOS = taxAgentService.listAll(tenantKey);
// List<TaxAgentPO> taxAgentPOS = getTaxAgentService(user).listAll(tenantKey);
// List<WeaSearchConditionOption> weaSearchConditionOptions = taxAgentPOS.stream()
// .map(taxAgentPO -> new WeaSearchConditionOption(String.valueOf(taxAgentPO.getId()), taxAgentPO.getName()))
// .collect(Collectors.toList());

View File

@ -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);

View File

@ -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<String, Object> buildTaxAgentForm(Date effectiveTime, String adjustReason, String adjustBefore, Long adjustAfter) {
// 个税扣缴义务人下拉列表
Collection<TaxAgent> taxAgentList = getTaxAgentService(user).findAll();
Collection<TaxAgentListDTO> taxAgentList = getTaxAgentService(user).findAll();
Map<String, Object> 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<TaxAgent> taxAgentList = getTaxAgentService(user).findAll();
Collection<TaxAgentListDTO> taxAgentList = getTaxAgentService(user).findAll();
// 调整前
String adjustBefore = "";
SalaryArchiveTaxAgentPO adjustBeforePo = getSalaryArchiveTaxAgentService(user).getAdjustBeforeTaxAgent(salaryArchiveTaxAgent);
if (adjustBeforePo != null) {
Optional<TaxAgent> optional = taxAgentList.stream().filter(f -> f.getId().equals(adjustBeforePo.getTaxAgentId())).findFirst();
Optional<TaxAgentListDTO> 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<TaxAgentAdjustRecordListDTO> adjustRecordList(TaxAgentAdjustRecordQueryParam queryParam) {
// 个税扣缴义务人
Collection<TaxAgent> taxAgentList = getTaxAgentService(user).findAll();
Collection<TaxAgentListDTO> taxAgentList = getTaxAgentService(user).findAll();
List<TaxAgentAdjustRecordListDTO> listAll = getSalaryArchiveTaxAgentService(user).taxAgentAdjustRecordList(TaxAgentAdjustRecordQueryParam.builder().build());
PageInfo<TaxAgentAdjustRecordListDTO> page = getSalaryArchiveTaxAgentService(user).taxAgentAdjustRecordListPage(queryParam);
List<TaxAgentAdjustRecordListDTO> list = page.getList();
@ -176,9 +177,9 @@ public class SalaryArchiveTaxAgentWrapper extends Service {
}
Optional<TaxAgentAdjustRecordListDTO> optional = listAll.stream().filter(f -> f.getSalaryArchiveId().equals(m.getSalaryArchiveId())).findFirst();
m.setAdjustBefore(optional.isPresent() ? optional.get().getAdjustAfter() : "");
Optional<TaxAgent> optionalBefore = taxAgentList.stream().filter(t -> t.getId().toString().equals(m.getAdjustBefore())).findFirst();
Optional<TaxAgentListDTO> optionalBefore = taxAgentList.stream().filter(t -> t.getId().toString().equals(m.getAdjustBefore())).findFirst();
m.setAdjustBefore(optionalBefore.isPresent() ? optionalBefore.get().getName() : "");
Optional<TaxAgent> optionalAfter = taxAgentList.stream().filter(t -> t.getId().toString().equals(m.getAdjustAfter())).findFirst();
Optional<TaxAgentListDTO> 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<TaxAgentAdjustRecordListDTO> page = getSalaryArchiveTaxAgentService(user).taxAgentAdjustRecordListPage(adjustRecordQueryParam);
// 个税扣缴义务人
Collection<TaxAgent> taxAgentList = getTaxAgentService(user).findAll();
Collection<TaxAgentListDTO> taxAgentList = getTaxAgentService(user).findAll();
List<TaxAgentAdjustRecordListDTO> listAll = getSalaryArchiveTaxAgentService(user).taxAgentAdjustRecordList(TaxAgentAdjustRecordQueryParam.builder().build());
List<TaxAgentAdjustRecordListDTO> list = page.getList();
List<SingleTaxAgentAdjustRecordListDTO> resultList = Lists.newArrayList();
@ -215,9 +216,9 @@ public class SalaryArchiveTaxAgentWrapper extends Service {
}
Optional<TaxAgentAdjustRecordListDTO> optional = listAll.stream().filter(f -> f.getSalaryArchiveId().equals(m.getSalaryArchiveId())).findFirst();
m.setAdjustBefore(optional.isPresent() ? optional.get().getAdjustAfter() : "");
Optional<TaxAgent> optionalBefore = taxAgentList.stream().filter(t -> t.getId().toString().equals(m.getAdjustBefore())).findFirst();
Optional<TaxAgentListDTO> optionalBefore = taxAgentList.stream().filter(t -> t.getId().toString().equals(m.getAdjustBefore())).findFirst();
m.setAdjustBefore(optionalBefore.isPresent() ? optionalBefore.get().getName() : "");
Optional<TaxAgent> optionalAfter = taxAgentList.stream().filter(t -> t.getId().toString().equals(m.getAdjustAfter())).findFirst();
Optional<TaxAgentListDTO> 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()));

View File

@ -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<SalaryArchiveListDTO> salaryArchives = pageInfo.getList();
//所有个税扣缴义务人
Collection<TaxAgent> taxAgentLists = getTaxAgentService(user).findAll();
Collection<TaxAgentPO> taxAgentLists = getTaxAgentService(user).listAll();
// 获取所有可被引用的薪资项目
List<SalaryItemPO> salaryItems = getSalaryArchiveItemService(user).getCanAdjustSalaryItems();
@ -137,11 +138,11 @@ public class SalaryArchiveWrapper extends Service {
// 获取当前已生效个税扣缴义务人
List<SalaryArchiveTaxAgentPO> taxAgentList = getSalaryArchiveService(user).getCurrentEffectiveTaxAgentList(Collections.singletonList(salaryArchiveId));
// 获取所有个税扣缴义务人
Collection<TaxAgent> taxAgentLists = getTaxAgentService(user).findAll();
Collection<TaxAgentListDTO> taxAgentLists = getTaxAgentService(user).findAll();
String taxAgent = "";
if (CollectionUtils.isNotEmpty(taxAgentList)) {
SalaryArchiveTaxAgentPO salaryArchiveTaxAgent = taxAgentList.get(0);
Optional<TaxAgent> taxAgentOptional = taxAgentLists.stream().filter(f -> f.getId().equals(salaryArchiveTaxAgent.getTaxAgentId())).findFirst();
Optional<TaxAgentListDTO> 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<Map<String, String>> userStatus = UserStatusEnum.getList();
List<Map<String, String>> itemAdjustReasons = SalaryArchiveItemAdjustReasonEnum.getList();
List<Map<String, String>> TaxAgentAdjustReason = SalaryArchiveTaxAgentAdjustReasonEnum.getList();
Collection<TaxAgent> taxAgentList = getTaxAgentService(user).findAll();
Collection<TaxAgentListDTO> taxAgentList = getTaxAgentService(user).findAll();
HashMap map = Maps.newHashMap();
map.put("userStatus",userStatus);
map.put("itemAdjustReasons",itemAdjustReasons);

View File

@ -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<SearchConditionOption> searchConditionOptions = new ArrayList<>();
Collection<TaxAgent> taxAgentLists = getTaxAgentService(user).findAll();
Collection<TaxAgentListDTO> 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<SearchConditionOption> searchConditionOptions = new ArrayList<>();
Collection<TaxAgent> taxAgentLists = getTaxAgentService(user).findAll();
Collection<TaxAgentListDTO> taxAgentLists = getTaxAgentService(user).findAll();
taxAgentLists.forEach(e -> searchConditionOptions.add(new SearchConditionOption(e.getId().toString(), e.getName())));
taxAgent.setOptions(searchConditionOptions);
taxAgent.setInputType("");

View File

@ -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<String, Object> listPage(SalarySobListQueryParam queryParam) {
SalaryWeaTable<SalarySobListDTO> table = new SalaryWeaTable<SalarySobListDTO>(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<SalarySobPO> page = getSalarySobService(user).listPageByParam(queryParam);
// // 查询人员信息
// List<Long> employeeIds = SalaryEntityUtil.properties(page.getRecords(), SalarySobPO::getCreator, Collectors.toList());
// List<SimpleEmployee> simpleEmployees = hrmCommonEmployeeService.getEmployeeByIds(employeeIds, tenantKey);
// // 薪资账套po转换成薪资账套列表dto
// List<SalarySobListDTO> salarySobListDTOS = SalarySobBO.convert2ListDTO(page.getRecords(), simpleEmployees);
// Page<SalarySobListDTO> dtoPage = new Page<>(page.getCurrent(), page.getSize(), page.getTotal(), page.isSearchCount());
// dtoPage.setRecords(salarySobListDTOS);
// // 转换成前端所需的数据格式
// return SalaryFormatUtil.<SalarySobListDTO>getInstance().buildTable(SalarySobListDTO.class, dtoPage);
return null;
}
/**

View File

@ -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<String, Object> list(TaxAgentQueryParam queryParam) {
public PageInfo<Map<String, Object>> 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<String, Object> datas = new HashMap<>();
datas.put("pageInfo", listPage);
datas.put("dataKey", result.getResultMap());
return datas;
return listPage;
}

View File

@ -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.<TaxDeclarationFormDTO>getInstance().buildForm(TaxDeclarationFormDTO.class, formDTO);
// 查询租户所有的个税扣缴义务人
Collection<TaxAgent> taxAgentListDTOS = new TaxAgentBiz().listAll();
Collection<TaxAgentPO> taxAgentListDTOS =getTaxAgentService(user).listAll();
// 表单中个税扣缴义务人的可选项
List<WeaFormOption> 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();
}
/**