2022-05-31 09:58:35 +08:00
|
|
|
|
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.core.impl.Service;
|
|
|
|
|
|
import com.engine.salary.entity.datacollection.dto.OtherDeductionListDTO;
|
2022-05-31 10:29:18 +08:00
|
|
|
|
import com.engine.salary.entity.datacollection.dto.OtherDeductionRecordDTO;
|
2022-05-31 09:58:35 +08:00
|
|
|
|
import com.engine.salary.entity.datacollection.param.OtherDeductionQueryParam;
|
2022-05-31 10:29:18 +08:00
|
|
|
|
import com.engine.salary.entity.datacollection.po.OtherDeductionPO;
|
|
|
|
|
|
import com.engine.salary.exception.SalaryRunTimeException;
|
2022-05-31 09:58:35 +08:00
|
|
|
|
import com.engine.salary.service.OtherDeductionService;
|
|
|
|
|
|
import com.engine.salary.service.SalaryEmployeeService;
|
|
|
|
|
|
import com.engine.salary.service.TaxAgentV2Service;
|
2022-05-31 10:29:18 +08:00
|
|
|
|
import com.engine.salary.util.SalaryI18nUtil;
|
2022-05-31 09:58:35 +08:00
|
|
|
|
import com.engine.salary.util.page.PageInfo;
|
|
|
|
|
|
import com.weaver.common.authority.format.FormatManager;
|
|
|
|
|
|
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.teams.security.context.TenantContext;
|
|
|
|
|
|
import com.weaver.teams.security.context.UserContext;
|
|
|
|
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
|
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
import weaver.systeminfo.SystemEnv;
|
|
|
|
|
|
|
|
|
|
|
|
import java.time.LocalDate;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
|
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 extends Service {
|
|
|
|
|
|
private OtherDeductionService otherDeductionService;
|
|
|
|
|
|
private TaxAgentV2Service taxAgentService;
|
|
|
|
|
|
private SalaryEmployeeService salaryEmployeeService;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 数据采集-其他免税扣除列表的高级搜索
|
|
|
|
|
|
*
|
|
|
|
|
|
* @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>();
|
|
|
|
|
|
|
|
|
|
|
|
//文本输入框
|
2022-05-31 10:29:18 +08:00
|
|
|
|
SearchConditionItem username = conditionFactory.createCondition(ConditionType.INPUT, 25034, "username");
|
2022-05-31 09:58:35 +08:00
|
|
|
|
username.setInputType("input");
|
|
|
|
|
|
username.setColSpan(2);//定义一行显示条件数,默认值为2,当值为1时标识该条件单独占一行
|
2022-05-31 10:29:18 +08:00
|
|
|
|
username.setFieldcol(16); //条件输入框所占宽度,默认值18
|
2022-05-31 09:58:35 +08:00
|
|
|
|
username.setLabelcol(8);
|
|
|
|
|
|
username.setViewAttr(2); // 编辑权限 1:只读,2:可编辑, 3:必填 默认2
|
|
|
|
|
|
username.setLabel("姓名"); //设置文本值 这个将覆盖多语言标签的值
|
|
|
|
|
|
conditionItems.add(username);
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-05-31 10:29:18 +08:00
|
|
|
|
SearchConditionItem departmentName = conditionFactory.createCondition(ConditionType.BROWSER, 502227, "departmentName", "4");
|
2022-05-31 09:58:35 +08:00
|
|
|
|
departmentName.setInputType("browser");
|
|
|
|
|
|
departmentName.setColSpan(2);
|
|
|
|
|
|
departmentName.setFieldcol(16);
|
|
|
|
|
|
departmentName.setLabelcol(8);
|
|
|
|
|
|
departmentName.setViewAttr(2);
|
|
|
|
|
|
departmentName.setIsQuickSearch(false);
|
|
|
|
|
|
departmentName.setLabel("部门");
|
|
|
|
|
|
conditionItems.add(departmentName);
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-05-31 10:29:18 +08:00
|
|
|
|
SearchConditionItem jobNum = conditionFactory.createCondition(ConditionType.INPUT, 25034, "jobNum");
|
2022-05-31 09:58:35 +08:00
|
|
|
|
jobNum.setInputType("input");
|
|
|
|
|
|
jobNum.setColSpan(2);
|
|
|
|
|
|
jobNum.setFieldcol(16);
|
|
|
|
|
|
jobNum.setLabelcol(8);
|
|
|
|
|
|
jobNum.setViewAttr(2);
|
|
|
|
|
|
jobNum.setLabel("工号");
|
|
|
|
|
|
conditionItems.add(jobNum);
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-05-31 10:29:18 +08:00
|
|
|
|
SearchConditionItem idNo = conditionFactory.createCondition(ConditionType.INPUT, 25034, "idNo");
|
2022-05-31 09:58:35 +08:00
|
|
|
|
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>();
|
2022-05-31 10:29:18 +08:00
|
|
|
|
dateOptions.add(new SearchConditionOption("6", SystemEnv.getHtmlLabelName(32530, user.getLanguage()), true));//指定日期范围(必须为6)
|
|
|
|
|
|
SearchConditionItem hiredate = conditionFactory.createCondition(ConditionType.RANGEPICKER, 18648, new String[]{"hiredate", "hiredate"});
|
2022-05-31 09:58:35 +08:00
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-05-31 10:29:18 +08:00
|
|
|
|
SearchConditionItem mobile = conditionFactory.createCondition(ConditionType.INPUT, 25034, "mobile");
|
2022-05-31 09:58:35 +08:00
|
|
|
|
mobile.setInputType("input");
|
|
|
|
|
|
mobile.setColSpan(2);
|
|
|
|
|
|
mobile.setFieldcol(16);
|
|
|
|
|
|
mobile.setLabelcol(8);
|
|
|
|
|
|
mobile.setViewAttr(2);
|
|
|
|
|
|
mobile.setLabel("手机号");
|
|
|
|
|
|
conditionItems.add(mobile);
|
|
|
|
|
|
|
2022-05-31 10:29:18 +08:00
|
|
|
|
addGroups.add(new SearchConditionGroup("常用条件", true, conditionItems));
|
2022-05-31 09:58:35 +08:00
|
|
|
|
|
2022-05-31 10:29:18 +08:00
|
|
|
|
apidatas.put("condition", addGroups);
|
2022-05-31 09:58:35 +08:00
|
|
|
|
return apidatas;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 数据采集-其他免税扣除列表(分页)
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param queryParam
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*/
|
|
|
|
|
|
public PageInfo<OtherDeductionListDTO> list(OtherDeductionQueryParam queryParam) {
|
2022-05-31 10:29:18 +08:00
|
|
|
|
// queryParam.setDeclareMonthDate(queryParam.getDeclareMonth().stream().map(e-> LocalDate.of(e.getYear(),e.getMonthValue(),1)).collect(Collectors.toList()));
|
2022-05-31 09:58:35 +08:00
|
|
|
|
|
2022-05-31 10:29:18 +08:00
|
|
|
|
return otherDeductionService.listPage(queryParam);
|
2022-05-31 09:58:35 +08:00
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 数据采集-其他免税扣除详情列表(分页)
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param queryParam
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*/
|
2022-05-31 10:29:18 +08:00
|
|
|
|
public PageInfo<OtherDeductionRecordDTO> getDetailList(OtherDeductionQueryParam queryParam) {
|
2022-05-31 09:58:35 +08:00
|
|
|
|
Long id = queryParam.getOtherTaxExemptDeductionId();
|
|
|
|
|
|
|
2022-05-31 10:29:18 +08:00
|
|
|
|
OtherDeductionPO po = otherDeductionService.getById(id);
|
2022-05-31 09:58:35 +08:00
|
|
|
|
if (po == null) {
|
2022-05-31 10:29:18 +08:00
|
|
|
|
throw new SalaryRunTimeException(String.format(SalaryI18nUtil.getI18nLabel(100415, "其他免税扣除不存在") + "[id:%s]", id));
|
2022-05-31 09:58:35 +08:00
|
|
|
|
}
|
2022-05-31 10:29:18 +08:00
|
|
|
|
queryParam.setDeclareMonthDate(queryParam.getDeclareMonth().stream().map(e -> LocalDate.of(e.getYear(), e.getMonthValue(), 1)).collect(Collectors.toList()));
|
2022-05-31 09:58:35 +08:00
|
|
|
|
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) {
|
2022-05-31 10:29:18 +08:00
|
|
|
|
throw new SalaryRunTimeException(String.format(SalaryI18nUtil.getI18nLabel(currentTenantKey, currentEmployeeId, 100415, "其他免税扣除不存在") + "[id:%s]", id));
|
2022-05-31 09:58:35 +08:00
|
|
|
|
}
|
|
|
|
|
|
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);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|