|
@@ -1,12 +1,24 @@
|
|
|
package com.jeeplus.test.cw.workClientInfo.controller;
|
|
|
|
|
|
+import cn.hutool.core.date.DateUnit;
|
|
|
+import cn.hutool.core.util.ObjectUtil;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.jeeplus.aop.logging.annotation.ApiLog;
|
|
|
import com.jeeplus.common.utils.ResponseUtil;
|
|
|
+import com.jeeplus.core.excel.ExcelOptions;
|
|
|
+import com.jeeplus.core.excel.ExportMode;
|
|
|
+import com.jeeplus.core.excel.utils.EasyPoiUtil;
|
|
|
+import com.jeeplus.core.query.QueryWrapperGenerator;
|
|
|
import com.jeeplus.sys.constant.enums.LogTypeEnum;
|
|
|
+import com.jeeplus.sys.utils.DictUtils;
|
|
|
+import com.jeeplus.sys.utils.StringUtils;
|
|
|
import com.jeeplus.test.cw.workClientInfo.service.CwWorkClientService;
|
|
|
import com.jeeplus.test.cw.workClientInfo.service.dto.CwWorkClientBaseDTO;
|
|
|
+import com.jeeplus.test.jobPosion.domain.JobPosition;
|
|
|
+import com.jeeplus.test.jobPosion.service.dto.JobPositionDTO;
|
|
|
+import com.jeeplus.test.jobPosion.service.mapstruct.JobPositionWrapper;
|
|
|
import com.jeeplus.test.klgBase.question.service.dto.KlgBaseQuestionsDTO;
|
|
|
import com.jeeplus.test.knowledge.domain.KnowledgeShareComment;
|
|
|
import com.jeeplus.test.knowledge.domain.KnowledgeShareDetail;
|
|
@@ -15,12 +27,21 @@ import com.jeeplus.test.knowledge.service.dto.KnowledgeShareInfoDto;
|
|
|
import com.jeeplus.test.knowledge.service.dto.KnowledgeShareListDto;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
+import org.apache.http.client.utils.DateUtils;
|
|
|
+import org.flowable.engine.impl.el.DateUtil;
|
|
|
import org.springframework.http.ResponseEntity;
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
import javax.validation.Valid;
|
|
|
+import java.text.ParseException;
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.Date;
|
|
|
+import java.util.List;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
@RestController
|
|
|
@Api("客户信息")
|
|
@@ -110,4 +131,58 @@ public class CwWorkClientController {
|
|
|
}
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
+ * 导出客户数据
|
|
|
+ *
|
|
|
+ * @param cwWorkClientBaseDTO
|
|
|
+ * @param page
|
|
|
+ * @param response
|
|
|
+ * @throws Exception
|
|
|
+ */
|
|
|
+ @ApiLog(value = "导出客户数据", type = LogTypeEnum.EXPORT)
|
|
|
+ @GetMapping("export")
|
|
|
+ @ApiOperation(value = "导出客户数据")
|
|
|
+ public void exportFile(CwWorkClientBaseDTO cwWorkClientBaseDTO, Page <CwWorkClientBaseDTO> page, ExcelOptions options, HttpServletResponse response) throws Exception {
|
|
|
+ String fileName = options.getFilename();
|
|
|
+ String sheetName = options.getSheetName();
|
|
|
+ List<CwWorkClientBaseDTO> result = new ArrayList<>();
|
|
|
+ if ( ExportMode.current.equals ( options.getMode() ) ) {
|
|
|
+ result = cwWorkClientService.findList (page,cwWorkClientBaseDTO).getRecords();
|
|
|
+ } else if (ExportMode.selected.equals ( options.getMode() )) {
|
|
|
+ result = cwWorkClientService.findList (page,cwWorkClientBaseDTO).getRecords().stream ( ).filter ( item ->
|
|
|
+ options.getSelectIds ( ).contains ( item.getId ( ) )
|
|
|
+ ).collect ( Collectors.toList ( ) );
|
|
|
+ } else {
|
|
|
+ page.setSize (-1);
|
|
|
+ page.setCurrent (0);
|
|
|
+ result = cwWorkClientService.findList (page,cwWorkClientBaseDTO).getRecords();
|
|
|
+ }
|
|
|
+ result.stream().forEach(item -> {
|
|
|
+ if (StringUtils.isNotBlank(item.getType())){
|
|
|
+ item.setType(DictUtils.getDictLabel(item.getType(),"cw_work_client_type",""));
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotBlank(item.getIndustry())){
|
|
|
+ item.setIndustry(DictUtils.getDictLabel(item.getIndustry(),"cw_work_client_industry",""));
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotBlank(item.getIsListed())) {
|
|
|
+ item.setIsListed(DictUtils.getDictLabel(item.getIsListed(),"yes_no",""));
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotBlank(item.getAffiliation())){
|
|
|
+ item.setAffiliation(DictUtils.getDictLabel(item.getAffiliation(),"cw_work_client_affiliation",""));
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotBlank(item.getOwnershipType())){
|
|
|
+ item.setOwnershipType(DictUtils.getDictLabel(item.getOwnershipType(),"cw_work_client_ownership_type",""));
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotBlank(item.getReportType())){
|
|
|
+ item.setReportType(DictUtils.getDictLabel(item.getReportType(),"cw_work_client_report_type",""));
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotBlank(item.getStatus())){
|
|
|
+ item.setStatus(DictUtils.getDictLabel(item.getStatus(),"cw_status",""));
|
|
|
+ }
|
|
|
+ });
|
|
|
+ EasyPoiUtil.exportExcel ( result, sheetName, sheetName, CwWorkClientBaseDTO.class, fileName, response );
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|