75 lines
2.5 KiB
Java
75 lines
2.5 KiB
Java
|
|
package com.engine.salary.wrapper;
|
||
|
|
|
||
|
|
import com.engine.common.util.ServiceUtil;
|
||
|
|
import com.engine.core.impl.Service;
|
||
|
|
import com.engine.salary.entity.salaryformula.ExpressFormula;
|
||
|
|
import com.engine.salary.entity.salaryformula.param.SalaryFormulaSaveParam;
|
||
|
|
import com.engine.salary.entity.salaryformula.po.FormulaVar;
|
||
|
|
import com.engine.salary.entity.salaryformula.bo.SalaryFormulaBO;
|
||
|
|
import com.engine.salary.entity.salaryformula.dto.ExpressFormulaDTO;
|
||
|
|
import com.engine.salary.entity.salaryformula.param.SalaryFormulaFieldQueryParam;
|
||
|
|
import com.engine.salary.exception.SalaryRunTimeException;
|
||
|
|
import com.engine.salary.service.RemoteExcelService;
|
||
|
|
import com.engine.salary.service.SalaryFormulaService;
|
||
|
|
import com.engine.salary.service.impl.RemoteExcelServiceImpl;
|
||
|
|
import com.engine.salary.service.impl.SalaryFormulaServiceImpl;
|
||
|
|
import org.apache.commons.collections4.CollectionUtils;
|
||
|
|
import weaver.hrm.User;
|
||
|
|
|
||
|
|
import java.util.Collections;
|
||
|
|
import java.util.List;
|
||
|
|
import java.util.Map;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 薪资项目
|
||
|
|
* <p>Copyright: Copyright (c) 2022</p>
|
||
|
|
* <p>Company: 泛微软件</p>
|
||
|
|
*
|
||
|
|
* @author qiantao
|
||
|
|
* @version 1.0
|
||
|
|
**/
|
||
|
|
public class SalaryFormulaWrapper extends Service {
|
||
|
|
|
||
|
|
private RemoteExcelService getRemoteExcelService(User user) {
|
||
|
|
return (RemoteExcelService) ServiceUtil.getService(RemoteExcelServiceImpl.class, user);
|
||
|
|
}
|
||
|
|
|
||
|
|
private SalaryFormulaService getSalaryFormulaService(User user) {
|
||
|
|
return (SalaryFormulaService) ServiceUtil.getService(SalaryFormulaServiceImpl.class, user);
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 公式字段列表
|
||
|
|
*
|
||
|
|
* @param param 查询参数
|
||
|
|
* @return
|
||
|
|
*/
|
||
|
|
public List<FormulaVar> fieldList(SalaryFormulaFieldQueryParam param) {
|
||
|
|
return getRemoteExcelService(user).fieldList(param.getSourceId(), param.getExtendParam());
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 公式字段分类
|
||
|
|
*
|
||
|
|
* @param param 查询参数
|
||
|
|
* @return
|
||
|
|
*/
|
||
|
|
public List<Map<String, Object>> fieldGroupList(Map<String, Object> param) {
|
||
|
|
return getRemoteExcelService(user).fieldGroupList(param);
|
||
|
|
}
|
||
|
|
|
||
|
|
public ExpressFormulaDTO detail(Long formulaId) {
|
||
|
|
List<ExpressFormula> expressFormulas = getSalaryFormulaService(user).listExpressFormula(Collections.singleton(formulaId));
|
||
|
|
if (CollectionUtils.isEmpty(expressFormulas)) {
|
||
|
|
throw new SalaryRunTimeException("获取公式详情失败");
|
||
|
|
}
|
||
|
|
return SalaryFormulaBO.convert2DTO(expressFormulas).get(0);
|
||
|
|
}
|
||
|
|
|
||
|
|
public void save(SalaryFormulaSaveParam salaryFormulaSaveParam) {
|
||
|
|
getSalaryFormulaService(user).save(salaryFormulaSaveParam);
|
||
|
|
}
|
||
|
|
}
|