Commit a6784d7f by guojuxing

下载组件完善

parent 5f524ec7
......@@ -4,11 +4,6 @@ import java.util.*;
import javax.servlet.http.HttpServletRequest;
import com.gic.commons.util.DateUtil;
import com.gic.download.utils.DataDownloadUtils;
import com.gic.download.utils.DownloadReport;
import com.gic.download.utils.ExecutorPoolSingleton;
import com.gic.enterprise.utils.UserDetail;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -26,15 +21,20 @@ import com.gic.auth.qo.MenuListQO;
import com.gic.auth.service.CollaboratorApiService;
import com.gic.auth.service.MenuApiService;
import com.gic.auth.web.vo.CollaboratorDetailVO;
import com.gic.commons.util.DateUtil;
import com.gic.commons.webapi.reponse.RestResponse;
import com.gic.download.utils.BaseUtils;
import com.gic.download.utils.DataDownloadUtils;
import com.gic.download.utils.DownloadReport;
import com.gic.download.utils.DownloadUtils;
import com.gic.download.utils.ExecutorPoolSingleton;
import com.gic.enterprise.response.EnterpriseRestResponse;
import com.gic.enterprise.utils.ResultControllerUtils;
import com.gic.enterprise.utils.UserDetail;
import com.gic.enterprise.utils.UserDetailUtils;
@RestController
@RequestMapping("/collaborator")
public class CollaboratorController extends BaseUtils{
public class CollaboratorController extends DownloadUtils{
private static final Logger LOGGER = LogManager.getLogger(CollaboratorController.class);
@Autowired
......@@ -55,18 +55,12 @@ public class CollaboratorController extends BaseUtils{
}
@RequestMapping("/download-test")
public RestResponse downloadTest(CollaboratorListQO params, HttpServletRequest request, int fileType) throws Exception {
public RestResponse downloadTest(CollaboratorListQO params, HttpServletRequest request, Integer excelExtensionCode) throws Exception {
UserDetail userDetail = UserDetailUtils.getUserDetail();
params.setEnterpriseId(userDetail.getEnterpriseId());
//查询totalCount
ServiceResponse<Page<CollaboratorListDTO>> result = collaboratorApiService.page(params);
String fileName = "北丐测试";
String suffix;
if (fileType == 1) {
suffix = ".csv";
} else {
suffix = ".xlsx";
}
//生成报表中心记录
DownloadReport report = new DownloadReport();
report.setApplyUserId(userDetail.getUserInfo().getUserId());
......@@ -91,11 +85,11 @@ public class CollaboratorController extends BaseUtils{
return result.getResult().getResult();
}
};
String[] hearders = new String[] {"协作人名称", "手机号"};
String[] headers = new String[] {"协作人名称", "手机号"};
String[] fields = new String[] { "collaboratorName", "phone" };
String path = request.getSession().getServletContext().getRealPath("/excel/csv/collaborator/file/");
try {
download(path, reportId, fileName + suffix, Arrays.asList(hearders), null, loader, Arrays.asList(fields));
download(path, reportId, fileName, excelExtensionCode, Arrays.asList(headers), Arrays.asList(fields), loader, null);
} catch (Exception e) {
LOGGER.warn(e);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment