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.AddUpSituationBiz; import com.engine.salary.entity.datacollection.AddUpSituation; import com.engine.salary.entity.datacollection.param.AddUpSituationQueryParam; import com.engine.salary.exception.SalaryRunTimeException; import org.apache.poi.xssf.usermodel.XSSFWorkbook; import weaver.hrm.User; import java.util.Map; public class AddUpSituationExportDetailCmd extends AbstractCommonCommand { public AddUpSituationExportDetailCmd(Map params, User user) { this.user = user; this.params = params; } @Override public BizLogContext getLogContext() { return null; } @Override public XSSFWorkbook execute(CommandContext commandContext) { AddUpSituationQueryParam queryParam = (AddUpSituationQueryParam) params.get("queryParam"); AddUpSituationBiz biz = new AddUpSituationBiz(); Long id = queryParam.getAccumulatedSituationId(); if (id == null) { throw new SalaryRunTimeException("id不能为空"); } AddUpSituation po = biz.getById(id); if (po == null) { throw new SalaryRunTimeException(String.format("累计情况不存在"+"[id:%s]", id)); } XSSFWorkbook workbook = biz.exportDetail(queryParam); return workbook; } }