weaver-hrm-salary/src/com/engine/salary/wrapper/SalarySobRangeWrapper.java

193 lines
7.4 KiB
Java
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package com.engine.salary.wrapper;
import cn.hutool.core.util.StrUtil;
import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.salary.entity.SalarySobExtRangePO;
import com.engine.salary.entity.salarysob.dto.SalarySobRangeListDTO;
import com.engine.salary.entity.salarysob.param.SalarySobRangeExtSaveParam;
import com.engine.salary.entity.salarysob.param.SalarySobRangeImportParam;
import com.engine.salary.entity.salarysob.param.SalarySobRangeQueryParam;
import com.engine.salary.entity.salarysob.param.SalarySobRangeSaveParam;
import com.engine.salary.service.SalarySobExtRangeService;
import com.engine.salary.service.SalarySobRangeService;
import com.engine.salary.service.impl.SalarySobExtRangeServiceImpl;
import com.engine.salary.service.impl.SalarySobRangeServiceImpl;
import com.engine.salary.util.page.PageInfo;
import org.apache.commons.lang.math.NumberUtils;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import weaver.hrm.User;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Map;
import java.util.Optional;
/**
* 薪资账套的人员范围
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
public class SalarySobRangeWrapper extends Service {
private SalarySobRangeService getSalarySobRangeService(User user) {
return ServiceUtil.getService(SalarySobRangeServiceImpl.class, user);
}
private SalarySobExtRangeService getSalarySobExtRangeService(User user) {
return ServiceUtil.getService(SalarySobExtRangeServiceImpl.class, user);
}
/**
* 薪资账套的人员范围列表(关联人员范围)
*
* @param queryParam 列表查询条件
* @return
*/
public PageInfo<SalarySobRangeListDTO> listPage4Include(SalarySobRangeQueryParam queryParam) {
return getSalarySobRangeService(user).listPageByParamAndIncludeType(queryParam, NumberUtils.INTEGER_ONE);
}
/**
* 薪资账套的人员范围列表(从范围中排除)
*
* @param queryParam 列表查询条件
* @return
*/
public PageInfo<SalarySobRangeListDTO> listPage4Exclude(SalarySobRangeQueryParam queryParam) {
return getSalarySobRangeService(user).listPageByParamAndIncludeType(queryParam, NumberUtils.INTEGER_ZERO);
}
/**
* 获取薪资账套的人员范围列表添加人员的表单
*
* @return
*/
// public WeaForm getForm() {
// return SalaryFormatUtil.<SalarySobRangeFormDTO>getInstance().buildForm(SalarySobRangeFormDTO.class, new SalarySobRangeFormDTO());
// }
/**
* 保存
*
* @param saveParam 保存参数
*/
public void save(SalarySobRangeSaveParam saveParam) {
Optional.ofNullable(saveParam.getTargetParams()).orElse(new ArrayList<>())
.forEach(targetParam -> {
if (StrUtil.isNotBlank(targetParam.getTarget())) {
targetParam.setTarget(targetParam.getTarget()
.replace("", "select")
.replace("", "SELECT")
.replace("", "join")
.replace("", "JOIN")
.replace("", "and")
.replace("", "AND")
.replace("", "or")
.replace("", "OR")
.replace("", "in")
.replace("", "IN")
.replace("", "like")
.replace("", "LIKE")
.replace("", "exists")
.replace("", "EXISTS")
.replace("", "between")
.replace("", "BETWEEN")
.replace("", "union")
.replace("", "UNION"));
}
});
getSalarySobRangeService(user).save(saveParam);
}
public void edit(SalarySobRangeSaveParam param) {
Optional.ofNullable(param.getTargetParams()).orElse(new ArrayList<>())
.forEach(targetParam -> {
if (StrUtil.isNotBlank(targetParam.getTarget())) {
targetParam.setTarget(targetParam.getTarget()
.replace("", "select")
.replace("", "SELECT")
.replace("", "join")
.replace("", "JOIN")
.replace("", "and")
.replace("", "AND")
.replace("", "or")
.replace("", "OR")
.replace("", "in")
.replace("", "IN")
.replace("", "like")
.replace("", "LIKE")
.replace("", "exists")
.replace("", "EXISTS")
.replace("", "between")
.replace("", "BETWEEN")
.replace("", "union")
.replace("", "UNION"));
}
});
getSalarySobRangeService(user).edit(param);
}
/**
* 保存
*
* @param saveParam 保存参数
*/
public void saveExtRange(SalarySobRangeExtSaveParam saveParam) {
getSalarySobExtRangeService(user).saveExtRange(saveParam);
}
public PageInfo<SalarySobExtRangePO> listPage4Ext(SalarySobRangeQueryParam param) {
return getSalarySobExtRangeService(user).listPage4Ext(param);
}
/**
* 删除
*
* @param ids 薪资账套的人员范围的主键id
*/
public void delete(Collection<Long> ids) {
getSalarySobRangeService(user).deleteByIds(ids);
}
public void deleteSalarySobExtRange(Collection<Long> ids) {
getSalarySobExtRangeService(user).deleteSalarySobExtRange(ids);
}
/***
* @description 下载薪资账套人员范围导入模板
* @return XSSFWorkbook
* @author Harryxzy
* @date 2023/1/9 11:32
*/
public XSSFWorkbook exportImportTemplate() {
return getSalarySobRangeService(user).downloadTemplateRange();
}
/**
* @return void
* @description 薪资账套人员范围导入预览
* @author Harryxzy
* @date 2023/1/9 13:37
*/
public Map<String, Object> preview(SalarySobRangeImportParam importParam) {
return getSalarySobRangeService(user).preview(importParam);
}
/**
* @return Map<String, Object>
* @description 导入薪资账套人员范围
* @author Harryxzy
* @date 2023/1/9 14:10
*/
public Map<String, Object> importData(SalarySobRangeImportParam importParam) {
return getSalarySobRangeService(user).importData(importParam);
}
}