weaver-hrm-salary/src/com/engine/salary/cmd/datacollection/AddUpDeductionExportDetailC...

47 lines
1.5 KiB
Java
Raw Normal View History

2022-03-10 11:09:08 +08:00
package com.engine.salary.cmd.datacollection;
import com.engine.common.biz.AbstractCommonCommand;
import com.engine.common.entity.BizLogContext;
import com.engine.core.interceptor.CommandContext;
import com.engine.salary.biz.AddUpDeductionBiz;
import com.engine.salary.entity.datacollection.AddUpDeduction;
import com.engine.salary.entity.datacollection.param.AddUpDeductionQueryParam;
import com.engine.salary.exception.SalaryRunTimeException;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import weaver.hrm.User;
import java.util.Map;
public class AddUpDeductionExportDetailCmd extends AbstractCommonCommand<XSSFWorkbook> {
public AddUpDeductionExportDetailCmd(Map<String, Object> params, User user) {
this.user = user;
this.params = params;
}
@Override
public BizLogContext getLogContext() {
return null;
}
@Override
public XSSFWorkbook execute(CommandContext commandContext) {
AddUpDeductionQueryParam queryParam = (AddUpDeductionQueryParam) params.get("addUpDeductionQueryParam");
AddUpDeductionBiz biz = new AddUpDeductionBiz();
Long id = queryParam.getAccumulatedSpecialAdditionalDeductionId();
if (id == null) {
throw new SalaryRunTimeException("id不能为空");
}
AddUpDeduction po = biz.getById(id);
if (po == null) {
throw new SalaryRunTimeException(String.format("累计专项附加扣除不存在"+"[id:%s]", id));
}
XSSFWorkbook workbook = biz.exportDetail(queryParam);
return workbook;
}
}