419 lines
19 KiB
Java
419 lines
19 KiB
Java
|
|
package com.engine.salary.wrapper;
|
||
|
|
|
||
|
|
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
|
||
|
|
import com.google.common.collect.Maps;
|
||
|
|
import com.weaver.common.authority.format.FormatManager;
|
||
|
|
import com.weaver.common.component.browser.combination.TypesBrowserOption;
|
||
|
|
import com.weaver.common.component.form.WeaForm;
|
||
|
|
import com.weaver.common.component.form.item.WeaFormItem;
|
||
|
|
import com.weaver.common.component.form.item.WeaFormOption;
|
||
|
|
import com.weaver.common.component.table.WeaTable;
|
||
|
|
import com.weaver.common.component.table.page.Page;
|
||
|
|
import com.weaver.common.hrm.cache.HrmConfigSetCache;
|
||
|
|
import com.weaver.common.hrm.domain.employee.HrmStatus;
|
||
|
|
import com.weaver.common.hrm.service.HrmCommonEmployeeService;
|
||
|
|
import com.weaver.common.hrm.service.employee.HrmCommonHrmStatusService;
|
||
|
|
import com.weaver.framework.util.JsonUtil;
|
||
|
|
import com.weaver.hrm.salary.dao.SIEmployeeStatusMapper;
|
||
|
|
import com.weaver.hrm.salary.entity.agency.po.PaymentAgencyPO;
|
||
|
|
import com.weaver.hrm.salary.entity.siarchives.po.InsuranceEmployeeStatusPO;
|
||
|
|
import com.weaver.hrm.salary.entity.taxagent.bo.TaxAgentBO;
|
||
|
|
import com.weaver.hrm.salary.entity.taxagent.dto.TaxAgentEmployeeOptionDTO;
|
||
|
|
import com.weaver.hrm.salary.entity.taxagent.dto.TaxAgentFormDTO;
|
||
|
|
import com.weaver.hrm.salary.entity.taxagent.dto.TaxAgentManageRangeFormDTO;
|
||
|
|
import com.weaver.hrm.salary.entity.taxagent.dto.TaxAgentManageRangeListDTO;
|
||
|
|
import com.weaver.hrm.salary.entity.taxagent.param.*;
|
||
|
|
import com.weaver.hrm.salary.entity.taxagent.po.TaxAgentAdminPO;
|
||
|
|
import com.weaver.hrm.salary.entity.taxagent.po.TaxAgentPO;
|
||
|
|
import com.weaver.hrm.salary.exception.SalaryRunTimeException;
|
||
|
|
import com.weaver.hrm.salary.service.*;
|
||
|
|
import com.weaver.hrm.salary.util.SalaryAssert;
|
||
|
|
import com.weaver.hrm.salary.util.SalaryFormatUtil;
|
||
|
|
import com.weaver.hrm.salary.util.SalaryI18nUtil;
|
||
|
|
import com.weaver.hrm.salary.util.SalaryPageUtil;
|
||
|
|
import com.weaver.teams.domain.user.SimpleEmployee;
|
||
|
|
import com.weaver.teams.security.context.UserContext;
|
||
|
|
import org.apache.commons.collections.CollectionUtils;
|
||
|
|
import org.apache.commons.lang3.StringUtils;
|
||
|
|
import org.apache.commons.lang3.math.NumberUtils;
|
||
|
|
import org.springframework.beans.BeanUtils;
|
||
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
||
|
|
import org.springframework.stereotype.Component;
|
||
|
|
|
||
|
|
import javax.annotation.Resource;
|
||
|
|
import java.util.*;
|
||
|
|
import java.util.stream.Collectors;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @Description: 个税扣缴义务人
|
||
|
|
* @Author: wangxiangzhong
|
||
|
|
* @Date: 2022/3/11 14:09
|
||
|
|
*/
|
||
|
|
@Component
|
||
|
|
public class TaxAgentWrapper {
|
||
|
|
|
||
|
|
@Autowired
|
||
|
|
private TaxAgentBaseService taxAgentBaseService;
|
||
|
|
@Autowired
|
||
|
|
private TaxAgentAdminService taxAgentAdminService;
|
||
|
|
@Autowired
|
||
|
|
private TaxAgentService taxAgentService;
|
||
|
|
//
|
||
|
|
// private HrmCommonEmployeeService employeeService;
|
||
|
|
// @Autowired
|
||
|
|
// private TaxAgentManageRangeService taxAgentManageRangeService;
|
||
|
|
// @Autowired
|
||
|
|
// private PaymentAgencyService paymentAgencyService;
|
||
|
|
// @Autowired
|
||
|
|
// private SIEmployeeStatusMapper siEmployeeStatusMapper;
|
||
|
|
// @Autowired
|
||
|
|
// private HrmCommonHrmStatusService hrmCommonHrmStatusService;
|
||
|
|
// @Autowired
|
||
|
|
// private HrmConfigSetCache hrmConfigSetCache;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 是否是薪酬模块总管理员
|
||
|
|
*
|
||
|
|
* @param currentEmployeeId
|
||
|
|
* @param currentTenantKey
|
||
|
|
* @return
|
||
|
|
*/
|
||
|
|
public Boolean isChief(Long currentEmployeeId, String currentTenantKey) {
|
||
|
|
return taxAgentService.isChief(currentEmployeeId, currentTenantKey);
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 权限信息
|
||
|
|
*
|
||
|
|
* @param currentEmployeeId
|
||
|
|
* @param currentTenantKey
|
||
|
|
* @return
|
||
|
|
*/
|
||
|
|
public Map<String, Boolean> permission(Long currentEmployeeId, String currentTenantKey) {
|
||
|
|
Map<String, Boolean> resultMap = Maps.newHashMap();
|
||
|
|
Boolean isChief = isChief(currentEmployeeId, currentTenantKey);
|
||
|
|
Boolean isDefaultOpen = taxAgentService.isDefaultOpen(currentEmployeeId, currentTenantKey);
|
||
|
|
Boolean isAdminEnable = taxAgentService.isAdminEnable(currentEmployeeId, currentTenantKey);
|
||
|
|
resultMap.put("isChief", isChief);
|
||
|
|
resultMap.put("isDefaultOpen", isDefaultOpen);
|
||
|
|
resultMap.put("isAdminEnable", isAdminEnable);
|
||
|
|
return resultMap;
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 个税口角义务人列表
|
||
|
|
*
|
||
|
|
* @param queryParam
|
||
|
|
* @param currentEmployeeId
|
||
|
|
* @param currentTenantKey
|
||
|
|
* @return
|
||
|
|
*/
|
||
|
|
public WeaTable<LinkedHashMap> list(TaxAgentQueryParam queryParam, Long currentEmployeeId, String currentTenantKey) {
|
||
|
|
// 是否是总管理员
|
||
|
|
Boolean isChief = taxAgentService.isChief(currentEmployeeId, currentTenantKey);
|
||
|
|
// 是否开启分权
|
||
|
|
boolean isOpenDevolution = taxAgentBaseService.isOpenDevolution(currentTenantKey);
|
||
|
|
|
||
|
|
List<PaymentAgencyPO> paymentAgencyPOS = paymentAgencyService.listAll(currentTenantKey);
|
||
|
|
|
||
|
|
Page<TaxAgentPO> page = new Page<>(queryParam.getCurrent(), queryParam.getPageSize(), true);
|
||
|
|
if (isChief) {
|
||
|
|
page = taxAgentService.listPage(page, queryParam, currentTenantKey);
|
||
|
|
} else {
|
||
|
|
// 分权情况下,根据自己作为管理员过滤列表
|
||
|
|
if (isOpenDevolution) {
|
||
|
|
List<TaxAgentPO> list = taxAgentService.list(queryParam, currentTenantKey);
|
||
|
|
// 1.判断自己是否是管理员, 如果是管理员,就是能够操作所属个税扣缴义务人下的所有人的数据
|
||
|
|
List<TaxAgentAdminPO> taxAgentAdminList = taxAgentAdminService.listByTaxAgentIdsAndEmployeeId(list.stream().map(TaxAgentPO::getId).collect(Collectors.toList()),
|
||
|
|
currentEmployeeId, currentTenantKey);
|
||
|
|
// 是管理员的列表
|
||
|
|
List<Long> adminTaxAgentIds = taxAgentAdminList.stream().map(TaxAgentAdminPO::getTaxAgentId).collect(Collectors.toList());
|
||
|
|
// 分页参数
|
||
|
|
Page<TaxAgentPO> dtoPage = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize());
|
||
|
|
list = list.stream().filter(f -> adminTaxAgentIds.contains(f.getId())).collect(Collectors.toList());
|
||
|
|
// 填充总数和当页数据
|
||
|
|
dtoPage.setTotal(list.size());
|
||
|
|
dtoPage.setRecords(SalaryPageUtil.subList((int) dtoPage.getCurrent(), (int) dtoPage.getSize(), list));
|
||
|
|
page = dtoPage;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
Page<Map<String, Object>> listPage = new Page<>(page.getCurrent(), page.getSize(), page.getTotal(), page.isSearchCount());
|
||
|
|
|
||
|
|
String setLabel = SalaryI18nUtil.getI18nLabel(currentTenantKey, currentEmployeeId, 94614, "设置");
|
||
|
|
if (isOpenDevolution) {
|
||
|
|
List<Long> taxAgentIds = page.getRecords().stream().map(TaxAgentPO::getId).collect(Collectors.toList());
|
||
|
|
List<TaxAgentAdminPO> taxAgentAdmins = taxAgentAdminService.listByTaxAgentIds(taxAgentIds, currentTenantKey);
|
||
|
|
List<SimpleEmployee> adminList = employeeService.getEmployeeByIds(taxAgentAdmins.stream().map(TaxAgentAdminPO::getEmployeeId).distinct().collect(Collectors.toList()),
|
||
|
|
currentTenantKey);
|
||
|
|
listPage.setRecords(TaxAgentBO.convertToTableListDTO(page.getRecords(), paymentAgencyPOS, taxAgentAdmins, adminList, setLabel));
|
||
|
|
} else {
|
||
|
|
listPage.setRecords(TaxAgentBO.convertToTableListDTO(page.getRecords(), paymentAgencyPOS, setLabel));
|
||
|
|
}
|
||
|
|
WeaTable<LinkedHashMap> weaTable = FormatManager.<LinkedHashMap>getInstance().genTable(LinkedHashMap.class, listPage);
|
||
|
|
//构造表格
|
||
|
|
TaxAgentBO.buildTaxAgentTable(weaTable, isOpenDevolution, currentEmployeeId, currentTenantKey, listPage.getRecords().size());
|
||
|
|
if (isChief) {
|
||
|
|
// 在外展示操作按钮
|
||
|
|
weaTable.getOperates().get(0).setOuter(Boolean.TRUE);
|
||
|
|
} else {
|
||
|
|
// 去掉增删改权限
|
||
|
|
weaTable.getOperates().clear();
|
||
|
|
weaTable.getCheckBoxPermission().clear();
|
||
|
|
}
|
||
|
|
|
||
|
|
weaTable.setModule("hrmsalary");
|
||
|
|
return weaTable;
|
||
|
|
}
|
||
|
|
|
||
|
|
public List<Map<String, Object>> paymentAgencyList(TaxAgentQueryParam queryParam, Long currentEmployeeId, String currentTenantKey) {
|
||
|
|
List<TaxAgentPO> taxAgentPOS = taxAgentService.listByIds(queryParam.getIds(), currentTenantKey);
|
||
|
|
List<PaymentAgencyPO> paymentAgencyPOS = paymentAgencyService.listAll(currentTenantKey);
|
||
|
|
SalaryAssert.notEmpty(taxAgentPOS, "taxagent data is not exist");
|
||
|
|
TaxAgentPO taxAgentPO = taxAgentPOS.get(0);
|
||
|
|
return TaxAgentBO.buildPaymentAgency(taxAgentPO.getPaymentAgency(), paymentAgencyPOS);
|
||
|
|
}
|
||
|
|
|
||
|
|
public String paymentAgencySave(TaxAgentSaveParam param, Long currentEmploueeId, String currentTenantKey) {
|
||
|
|
List<TaxAgentPO> taxAgentPOS = taxAgentService.listByIds(Collections.singletonList(param.getId()), currentTenantKey);
|
||
|
|
SalaryAssert.notEmpty(taxAgentPOS, "data is not exist");
|
||
|
|
TaxAgentPO taxAgentPO = taxAgentPOS.get(0);
|
||
|
|
List<String> errorList = new ArrayList<>();
|
||
|
|
List<String> resultList = new ArrayList<>();
|
||
|
|
if (StringUtils.isNotBlank(taxAgentPO.getPaymentAgency())) {
|
||
|
|
List<String> originList = new ArrayList<>(Arrays.asList(taxAgentPO.getPaymentAgency().split(",")));
|
||
|
|
List<String> list = new ArrayList<>(Arrays.asList(param.getPaymentAgency().split(",")));
|
||
|
|
originList.removeAll(list);
|
||
|
|
if (CollectionUtils.isNotEmpty(originList)) {
|
||
|
|
originList.stream().forEach(e -> {
|
||
|
|
List<InsuranceEmployeeStatusPO> employeeStatusPOS = new LambdaQueryChainWrapper<>(siEmployeeStatusMapper)
|
||
|
|
.eq(InsuranceEmployeeStatusPO::getTenantKey, currentTenantKey)
|
||
|
|
.eq(InsuranceEmployeeStatusPO::getPaymentAgency, Long.valueOf(e))
|
||
|
|
.eq(InsuranceEmployeeStatusPO::getPaymentOrganization, param.getId())
|
||
|
|
.list();
|
||
|
|
if (CollectionUtils.isNotEmpty(employeeStatusPOS)) {
|
||
|
|
errorList.add(e);
|
||
|
|
}
|
||
|
|
});
|
||
|
|
}
|
||
|
|
if (CollectionUtils.isNotEmpty(errorList)) {
|
||
|
|
List<PaymentAgencyPO> paymentAgencyPOS = paymentAgencyService.listAll(currentTenantKey);
|
||
|
|
errorList.forEach(e -> {
|
||
|
|
Optional<PaymentAgencyPO> optionalPaymentAgencyPO = paymentAgencyPOS.stream().filter(po -> Objects.equals(e, String.valueOf(po.getId()))).findFirst();
|
||
|
|
optionalPaymentAgencyPO.ifPresent(paymentAgencyPO -> resultList.add(paymentAgencyPO.getAgencyName()));
|
||
|
|
});
|
||
|
|
}
|
||
|
|
}
|
||
|
|
if (CollectionUtils.isNotEmpty(resultList)) {
|
||
|
|
return SalaryI18nUtil.getI18nLabel(currentTenantKey, currentEmploueeId, 115128, "有员工在") + String.join(",", resultList) + SalaryI18nUtil.getI18nLabel(currentTenantKey,
|
||
|
|
currentEmploueeId, 115129, "缴纳社保福利,不可取消关联");
|
||
|
|
} else {
|
||
|
|
taxAgentPO.setPaymentAgency(param.getPaymentAgency());
|
||
|
|
taxAgentService.paymentAgencyUpdate(taxAgentPO, currentEmploueeId, currentTenantKey);
|
||
|
|
}
|
||
|
|
return "";
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 获取个税扣缴义务人表单
|
||
|
|
*
|
||
|
|
* @param id
|
||
|
|
* @param currentEmployeeId
|
||
|
|
* @param currentTenantKey
|
||
|
|
* @return
|
||
|
|
*/
|
||
|
|
public WeaForm getFrom(Long id, Long currentEmployeeId, String currentTenantKey) {
|
||
|
|
TaxAgentFormDTO taxAgentFromDTO = new TaxAgentFormDTO();
|
||
|
|
if (id != null) {
|
||
|
|
TaxAgentPO taxAgent = taxAgentService.getById(id, currentTenantKey);
|
||
|
|
if (taxAgent == null) {
|
||
|
|
throw new SalaryRunTimeException(String.format(SalaryI18nUtil.getI18nLabel(currentTenantKey, currentEmployeeId, 100543, "个税扣缴人不存在") + "[id:%s]", id));
|
||
|
|
}
|
||
|
|
BeanUtils.copyProperties(taxAgent, taxAgentFromDTO);
|
||
|
|
}
|
||
|
|
WeaForm weaForm = FormatManager.<TaxAgentFormDTO>getInstance().genForm(TaxAgentFormDTO.class, taxAgentFromDTO);
|
||
|
|
// 是否开启分权
|
||
|
|
boolean isOpenDevolution = taxAgentBaseService.isOpenDevolution(currentTenantKey);
|
||
|
|
if (isOpenDevolution) {
|
||
|
|
List<TaxAgentAdminPO> admins = taxAgentAdminService.listByTaxAgentIds(Collections.singletonList(id), currentTenantKey);
|
||
|
|
// 目前是一个
|
||
|
|
TaxAgentEmployeeOptionDTO taxAgentEmployee = new TaxAgentEmployeeOptionDTO();
|
||
|
|
taxAgentEmployee.setId(CollectionUtils.isEmpty(admins) ? null : admins.get(0).getEmployeeId());
|
||
|
|
if (taxAgentEmployee.getId() != null) {
|
||
|
|
SimpleEmployee employee = employeeService.getEmployeeById(taxAgentEmployee.getId(), currentTenantKey);
|
||
|
|
taxAgentEmployee.setContent(employee == null ? "" : employee.getUsername());
|
||
|
|
}
|
||
|
|
taxAgentFromDTO.setAdminUser(Collections.singletonList(taxAgentEmployee));
|
||
|
|
} else {
|
||
|
|
weaForm.getLayout().remove(1);
|
||
|
|
weaForm.getItems().remove("adminUser");
|
||
|
|
taxAgentFromDTO.setAdminUser(null);
|
||
|
|
}
|
||
|
|
weaForm.setData(JsonUtil.parseMap(taxAgentFromDTO, Object.class));
|
||
|
|
|
||
|
|
WeaFormItem nameItem = weaForm.getItems().get("name");
|
||
|
|
Map<String, Object> otherParams = Maps.newHashMap();
|
||
|
|
otherParams.put("showCount", true);
|
||
|
|
otherParams.put("placeholder", SalaryI18nUtil.getI18nLabel(currentTenantKey, currentEmployeeId, 85987, "请输入"));
|
||
|
|
nameItem.setOtherParams(otherParams);
|
||
|
|
weaForm.getItems().put("name", nameItem);
|
||
|
|
|
||
|
|
WeaFormItem descriptionItem = weaForm.getItems().get("description");
|
||
|
|
otherParams = Maps.newHashMap();
|
||
|
|
otherParams.put("showCount", true);
|
||
|
|
otherParams.put("placeholder", SalaryI18nUtil.getI18nLabel(currentTenantKey, currentEmployeeId, 85987, "请输入"));
|
||
|
|
descriptionItem.setOtherParams(otherParams);
|
||
|
|
weaForm.getItems().put("description", descriptionItem);
|
||
|
|
|
||
|
|
return weaForm;
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 保存个税扣缴义务人
|
||
|
|
*
|
||
|
|
* @param saveParam
|
||
|
|
* @param currentEmployeeId
|
||
|
|
* @param currentTenantKey
|
||
|
|
* @return
|
||
|
|
*/
|
||
|
|
public String save(TaxAgentSaveParam saveParam, Long currentEmployeeId, String currentTenantKey) {
|
||
|
|
return taxAgentService.save(saveParam, currentEmployeeId, currentTenantKey);
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 编辑个税扣缴义务人
|
||
|
|
*
|
||
|
|
* @param saveParam
|
||
|
|
* @param currentEmployeeId
|
||
|
|
* @param currentTenantKey
|
||
|
|
* @return
|
||
|
|
*/
|
||
|
|
public String update(TaxAgentSaveParam saveParam, Long currentEmployeeId, String currentTenantKey) {
|
||
|
|
return taxAgentService.update(saveParam, currentEmployeeId, currentTenantKey);
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 更换管理员校验
|
||
|
|
*
|
||
|
|
* @param checkParam
|
||
|
|
* @param currentEmployeeId
|
||
|
|
* @param currentTenantKey
|
||
|
|
* @return
|
||
|
|
*/
|
||
|
|
public Boolean adminChangeCheck(TaxAgentAdminChangeCheckParam checkParam, Long currentEmployeeId, String currentTenantKey) {
|
||
|
|
return taxAgentService.adminChangeCheck(checkParam, currentEmployeeId, currentTenantKey);
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 删除个税扣缴义务人
|
||
|
|
*
|
||
|
|
* @param ids
|
||
|
|
* @param currentEmployeeId
|
||
|
|
* @param currentTenantKey
|
||
|
|
* @return
|
||
|
|
*/
|
||
|
|
public String delete(Collection<Long> ids, Long currentEmployeeId, String currentTenantKey) {
|
||
|
|
return taxAgentService.delete(ids, currentEmployeeId, currentTenantKey);
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 个税扣缴义务人下拉列表
|
||
|
|
*
|
||
|
|
* @param currentEmployeeId
|
||
|
|
* @param currentTenantKey
|
||
|
|
* @return
|
||
|
|
*/
|
||
|
|
public List<Map<String, Object>> selectList(Long currentEmployeeId, String currentTenantKey) {
|
||
|
|
return taxAgentService.selectList(currentEmployeeId, currentTenantKey);
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 范围列表
|
||
|
|
*
|
||
|
|
* @param queryParam
|
||
|
|
* @param employeeId
|
||
|
|
* @param tenantKey
|
||
|
|
* @return
|
||
|
|
*/
|
||
|
|
public WeaTable<TaxAgentManageRangeListDTO> listRangeInclude(TaxAgentRangeQueryParam queryParam, Long employeeId, String tenantKey) {
|
||
|
|
Page<TaxAgentManageRangeListDTO> listPage = taxAgentManageRangeService.listPageByParamAndIncludeType(queryParam, NumberUtils.INTEGER_ONE, tenantKey);
|
||
|
|
WeaTable<TaxAgentManageRangeListDTO> weaTable = SalaryFormatUtil.<TaxAgentManageRangeListDTO>getInstance().buildTable(TaxAgentManageRangeListDTO.class, listPage);
|
||
|
|
weaTable.setModule("hrmsalary");
|
||
|
|
weaTable.setPageUid("taxAgentRangeIncludeList");
|
||
|
|
return weaTable;
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 范围排除列表
|
||
|
|
*
|
||
|
|
* @param queryParam
|
||
|
|
* @param employeeId
|
||
|
|
* @param tenantKey
|
||
|
|
* @return
|
||
|
|
*/
|
||
|
|
public WeaTable<TaxAgentManageRangeListDTO> listRangeExclude(TaxAgentRangeQueryParam queryParam, Long employeeId, String tenantKey) {
|
||
|
|
Page<TaxAgentManageRangeListDTO> listPage = taxAgentManageRangeService.listPageByParamAndIncludeType(queryParam, NumberUtils.INTEGER_ZERO, tenantKey);
|
||
|
|
WeaTable<TaxAgentManageRangeListDTO> weaTable = SalaryFormatUtil.<TaxAgentManageRangeListDTO>getInstance().buildTable(TaxAgentManageRangeListDTO.class, listPage);
|
||
|
|
weaTable.setModule("hrmsalary");
|
||
|
|
weaTable.setPageUid("taxAgentRangeExcludeList");
|
||
|
|
return weaTable;
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 获取管理范围表单
|
||
|
|
*
|
||
|
|
* @return
|
||
|
|
*/
|
||
|
|
public WeaForm getRangeFrom(String tenantKey) {
|
||
|
|
// 查询人员状态
|
||
|
|
List<HrmStatus> hrmStatusList = hrmCommonHrmStatusService.list(tenantKey);
|
||
|
|
List<WeaFormOption> weaFormOptions = hrmStatusList.stream().map(hrmStatus -> {
|
||
|
|
WeaFormOption weaFormOption = new WeaFormOption();
|
||
|
|
weaFormOption.setId("" + hrmStatus.getCodeId());
|
||
|
|
weaFormOption.setContent(hrmStatus.getName());
|
||
|
|
return weaFormOption;
|
||
|
|
}).collect(Collectors.toList());
|
||
|
|
Long employeeId = UserContext.getCurrentEmployeeId();
|
||
|
|
List<TypesBrowserOption> browserOptions = new ArrayList<>();
|
||
|
|
browserOptions.add(new TypesBrowserOption("user", SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 1869, "人员")));
|
||
|
|
browserOptions.add(new TypesBrowserOption("dept", SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 1250, "部门")));
|
||
|
|
if(hrmConfigSetCache.isSubcompanySupport(tenantKey)) {
|
||
|
|
browserOptions.add(new TypesBrowserOption("subcompany", SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 107369, "分部")));
|
||
|
|
}
|
||
|
|
browserOptions.add(new TypesBrowserOption("position", SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 1245, "岗位")));
|
||
|
|
|
||
|
|
WeaForm weaForm = SalaryFormatUtil.<TaxAgentManageRangeFormDTO>getInstance().buildForm(TaxAgentManageRangeFormDTO.class, TaxAgentManageRangeFormDTO.builder().targetOptions(browserOptions).build());
|
||
|
|
weaForm.getItems().forEach((key, value) -> {
|
||
|
|
if (StringUtils.equals("employeeStatus", key)) {
|
||
|
|
value.setOptions(weaFormOptions);
|
||
|
|
}
|
||
|
|
});
|
||
|
|
return weaForm;
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 保存管理范围
|
||
|
|
*
|
||
|
|
* @param saveParam
|
||
|
|
* @param employeeId
|
||
|
|
* @param tenantKey
|
||
|
|
* @return
|
||
|
|
*/
|
||
|
|
public String saveRange(TaxAgentRangeSaveParam saveParam, Long employeeId, String tenantKey) {
|
||
|
|
taxAgentManageRangeService.save(saveParam, employeeId, tenantKey);
|
||
|
|
return StringUtils.EMPTY;
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 删除管理范围
|
||
|
|
*
|
||
|
|
* @param ids
|
||
|
|
* @param tenantKey
|
||
|
|
* @return
|
||
|
|
*/
|
||
|
|
public String deleteRange(Collection<Long> ids, Long employeeId, String tenantKey) {
|
||
|
|
taxAgentManageRangeService.deleteByIds(ids, employeeId, tenantKey);
|
||
|
|
return StringUtils.EMPTY;
|
||
|
|
}
|
||
|
|
}
|