204 lines
7.2 KiB
Java
204 lines
7.2 KiB
Java
package com.engine.salary.wrapper;
|
||
|
||
import com.api.browser.bean.SearchConditionGroup;
|
||
import com.api.browser.bean.SearchConditionItem;
|
||
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.SpecialAddDeductionListDTO;
|
||
import com.engine.salary.entity.datacollection.dto.SpecialAddDeductionRecordDTO;
|
||
import com.engine.salary.entity.datacollection.param.*;
|
||
import com.engine.salary.entity.datacollection.po.SpecialAddDeductionPO;
|
||
import com.engine.salary.exception.SalaryRunTimeException;
|
||
import com.engine.salary.service.SalaryEmployeeService;
|
||
import com.engine.salary.service.SpecialAddDeductionService;
|
||
import com.engine.salary.service.TaxAgentService;
|
||
import com.engine.salary.service.impl.SalaryEmployeeServiceImpl;
|
||
import com.engine.salary.service.impl.SpecialAddDeductionServiceImpl;
|
||
import com.engine.salary.service.impl.TaxAgentServiceImpl;
|
||
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 java.util.*;
|
||
|
||
/**
|
||
* 专项附加扣除
|
||
*/
|
||
public class SpecialAddDeductionWrapper extends Service {
|
||
private SpecialAddDeductionService getSpecialAddDeductionService(User user) {
|
||
return ServiceUtil.getService(SpecialAddDeductionServiceImpl.class, user);
|
||
}
|
||
private TaxAgentService getTaxAgentV2Service(User user) {
|
||
return ServiceUtil.getService(TaxAgentServiceImpl.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<>();
|
||
ConditionFactory conditionFactory = new ConditionFactory(user);
|
||
|
||
//条件组
|
||
List<SearchConditionGroup> addGroups = new ArrayList<>();
|
||
|
||
List<SearchConditionItem> conditionItems = new ArrayList<>();
|
||
|
||
//文本输入框
|
||
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);
|
||
|
||
addGroups.add(new SearchConditionGroup("常用条件", true, conditionItems));
|
||
|
||
apidatas.put("condition", addGroups);
|
||
return apidatas;
|
||
}
|
||
|
||
/**
|
||
* 数据采集-专项附加扣除列表(分页)
|
||
*
|
||
* @param queryParam
|
||
* @return
|
||
*/
|
||
public PageInfo<SpecialAddDeductionListDTO> list(SpecialAddDeductionQueryParam queryParam) {
|
||
return getSpecialAddDeductionService(user).listPage(queryParam);
|
||
|
||
}
|
||
|
||
/**
|
||
* 数据采集-专项附加扣除详情列表(分页)
|
||
*
|
||
* @param queryParam
|
||
* @return
|
||
*/
|
||
public PageInfo<SpecialAddDeductionRecordDTO> getDetailList(SpecialAddDeductionQueryParam queryParam) {
|
||
Long id = queryParam.getSpecialAddDeductionId();
|
||
|
||
SpecialAddDeductionPO po = getSpecialAddDeductionService(user).getById(id);
|
||
if (po == null) {
|
||
throw new SalaryRunTimeException(String.format(SalaryI18nUtil.getI18nLabel(100415, "专项附加扣除不存在") + "[id:%s]", id));
|
||
}
|
||
queryParam.setEmployeeId(po.getEmployeeId());
|
||
|
||
return getSpecialAddDeductionService(user).recordListPage(queryParam);
|
||
}
|
||
|
||
/**
|
||
* 导出-专项附加扣除列表
|
||
*
|
||
* @param queryParam
|
||
* @return
|
||
*/
|
||
public XSSFWorkbook export(SpecialAddDeductionQueryParam queryParam) {
|
||
return getSpecialAddDeductionService(user).export(queryParam, false);
|
||
}
|
||
|
||
/**
|
||
* 导出-专项附加扣除详情列表
|
||
*
|
||
* @param queryParam
|
||
* @return
|
||
*/
|
||
public XSSFWorkbook exportDetail(SpecialAddDeductionQueryParam queryParam) {
|
||
Long id = queryParam.getSpecialAddDeductionId();
|
||
SpecialAddDeductionPO po = getSpecialAddDeductionService(user).getById(id);
|
||
if (po == null) {
|
||
throw new SalaryRunTimeException(String.format(SalaryI18nUtil.getI18nLabel( 100415, "专项附加扣除不存在") + "[id:%s]", id));
|
||
}
|
||
return getSpecialAddDeductionService(user).exportDetail(queryParam);
|
||
}
|
||
|
||
/**
|
||
* 下载导入模板
|
||
*
|
||
* @param queryParam
|
||
* @return
|
||
*/
|
||
public XSSFWorkbook downloadTemplate(SpecialAddDeductionQueryParam queryParam) {
|
||
return getSpecialAddDeductionService(user).export(queryParam, true);
|
||
}
|
||
|
||
/**
|
||
* 预览
|
||
*/
|
||
public Map<String, Object> preview(SpecialAddDeductionImportParam importParam){
|
||
return getSpecialAddDeductionService(user).preview(importParam);
|
||
}
|
||
|
||
/**
|
||
* 导入数据
|
||
*/
|
||
public Map<String, Object> importData(SpecialAddDeductionImportParam importParam){
|
||
return getSpecialAddDeductionService(user).importData(importParam);
|
||
}
|
||
|
||
/**
|
||
* 编辑数据
|
||
*/
|
||
public void editData(SpecialAddDeductionParam specialAddDeductionParam) {
|
||
getSpecialAddDeductionService(user).editData(specialAddDeductionParam);
|
||
}
|
||
|
||
|
||
/**
|
||
* 新增数据
|
||
*/
|
||
public void createData(SpecialAddDeductionParam specialAddDeductionParam) {
|
||
getSpecialAddDeductionService(user).createData(specialAddDeductionParam);
|
||
}
|
||
|
||
/**
|
||
* 删除所选数据
|
||
*/
|
||
public void deleteSelectData(SpecialAddDeductionRecordDeleteParam deleteParam) {
|
||
getSpecialAddDeductionService(user).deleteSelectData(deleteParam);
|
||
}
|
||
|
||
/**
|
||
* 一键清空所有数据
|
||
*/
|
||
public void deleteAllData(SpecialAddDeductionRecordDeleteParam deleteParam) {
|
||
getSpecialAddDeductionService(user).deleteAllData(deleteParam);
|
||
}
|
||
|
||
public SpecialAddDeductionRecordDTO getRecordById(Long id) {
|
||
if (id == null) {
|
||
throw new SalaryRunTimeException("专项附加扣除主键[id]必传");
|
||
}
|
||
return getSpecialAddDeductionService(user).getRecordById(id);
|
||
}
|
||
}
|