添加功能

This commit is contained in:
马宝龙
2026-07-03 18:47:55 +08:00
parent 174b92b7d1
commit 5e91e0f25a
12 changed files with 731 additions and 3 deletions

View File

@@ -36,6 +36,8 @@ public enum ModelTemplateTypeEnum {
MODEL_DEMAND_MONITOR_INDUSTRY_INCREASE("劳动力动态监测系统-劳动力需求产业增加值"),
MODEL_DEMAND_MONITOR_INDUSTRY_TREND("劳动力动态监测系统-劳动力需求分行业需求趋势分析"),
MODEL_DEMAND_MONITOR_MAJOR_INDUSTRY_TREND("劳动力动态监测系统-劳动力需求重点产业需求趋势分析"),
;
private final String desc;
}

View File

@@ -0,0 +1,104 @@
package com.ruoyi.cms.controller;
import com.ruoyi.cms.domain.ModelDemandMonitorMajorIndustryTrend;
import com.ruoyi.cms.domain.vo.ModelDemandMonitorMajorIndustryTrendVo;
import com.ruoyi.cms.service.ModelDemandMonitorMajorIndustryTrendService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.validation.Valid;
/**
* 劳动力需求重点产业需求趋势分析
*
* @author 马宝龙
* @date 2026/7/3
*/
@RestController
@RequestMapping("/model/demandMonitorMajorIndustryTrend")
@RequiredArgsConstructor
public class ModelDemandMonitorMajorIndustryTrendController extends BaseController {
private final ModelDemandMonitorMajorIndustryTrendService modelDemandMonitorMajorIndustryTrendService;
/**
* 创建
*
* @param modelDemandMonitorMajorIndustryTrend 劳动力需求重点产业需求趋势分析
* @return 创建结果
*/
@PostMapping("/create")
public AjaxResult create(@Valid @RequestBody ModelDemandMonitorMajorIndustryTrend modelDemandMonitorMajorIndustryTrend) {
modelDemandMonitorMajorIndustryTrendService.create(modelDemandMonitorMajorIndustryTrend);
return AjaxResult.success();
}
/**
* 更新
*
* @param modelDemandMonitorMajorIndustryTrend 劳动力需求重点产业需求趋势分析
* @return 更新结果
*/
@PutMapping("/update")
public AjaxResult update(@Valid @RequestBody ModelDemandMonitorMajorIndustryTrend modelDemandMonitorMajorIndustryTrend) {
modelDemandMonitorMajorIndustryTrendService.update(modelDemandMonitorMajorIndustryTrend);
return AjaxResult.success();
}
/**
* 删除
*
* @param id ID
* @return 删除结果
*/
@DeleteMapping("/delete")
public AjaxResult delete(@RequestParam Long id) {
modelDemandMonitorMajorIndustryTrendService.delete(id);
return AjaxResult.success();
}
/**
* 清空
*
* @return 清空结果
*/
@DeleteMapping("/clear")
public AjaxResult clear() {
modelDemandMonitorMajorIndustryTrendService.clear();
return AjaxResult.success();
}
/**
* 查询详情
*
* @param id ID
* @return 劳动力需求重点产业需求趋势分析
*/
@GetMapping("/detail")
public AjaxResult detail(@RequestParam Long id) {
ModelDemandMonitorMajorIndustryTrend data = modelDemandMonitorMajorIndustryTrendService.detail(id);
return AjaxResult.success(data);
}
/**
* 查询列表
*
* @param modelDemandMonitorMajorIndustryTrend 劳动力需求重点产业需求趋势分析
* @return 列表
*/
@PostMapping("/list")
public AjaxResult list(@RequestBody ModelDemandMonitorMajorIndustryTrend modelDemandMonitorMajorIndustryTrend) {
ModelDemandMonitorMajorIndustryTrendVo list =
modelDemandMonitorMajorIndustryTrendService.listDemand(modelDemandMonitorMajorIndustryTrend);
return AjaxResult.success(list);
}
}

View File

@@ -0,0 +1,48 @@
package com.ruoyi.cms.domain;
import com.ruoyi.common.annotation.Excel;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* 劳动力需求重点产业需求趋势分析
*
* @author 马宝龙
* @date 2026/7/3
*/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class ModelDemandMonitorMajorIndustryTrend implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
private Long id;
/**
* 年月
*/
@Excel(name = "年月")
private String yearMonth;
/**
* 产业编号
*/
@Excel(name = "产业编号")
private String industryCode;
/**
* 产业名称
*/
@Excel(name = "产业名称")
private String industryName;
/**
* 需求人数
*/
@Excel(name = "需求人数")
private Integer demandCount;
}

View File

@@ -0,0 +1,29 @@
package com.ruoyi.cms.domain.vo;
import com.ruoyi.cms.domain.dto.ExcelRow;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.List;
/**
* 劳动力需求重点产业需求趋势分析
*
* @author 马宝龙
* @date 2026/7/3
*/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class ModelDemandMonitorMajorIndustryTrendVo implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 数据列表
*/
private List<ExcelRow> dataList;
}

View File

@@ -0,0 +1,64 @@
package com.ruoyi.cms.mapper;
import com.ruoyi.cms.domain.ModelDemandMonitorMajorIndustryTrend;
import java.util.List;
/**
* 劳动力需求重点产业需求趋势分析
*
* @author 马宝龙
* @date 2026/7/3
*/
public interface ModelDemandMonitorMajorIndustryTrendMapper {
/**
* 新增
*
* @param modelDemandMonitorMajorIndustryTrend 劳动力需求重点产业需求趋势分析
*/
void insert(ModelDemandMonitorMajorIndustryTrend modelDemandMonitorMajorIndustryTrend);
/**
* 修改
*
* @param modelDemandMonitorMajorIndustryTrend 劳动力需求重点产业需求趋势分析
*/
void update(ModelDemandMonitorMajorIndustryTrend modelDemandMonitorMajorIndustryTrend);
/**
* 通过ID删除
*
* @param id ID
*/
void deleteById(Long id);
/**
* 清空
*/
void clear();
/**
* 通过ID查询
*
* @param id ID
* @return 劳动力需求重点产业需求趋势分析
*/
ModelDemandMonitorMajorIndustryTrend selectById(Long id);
/**
* 查询唯一(按年月+产业编号)
*
* @param modelDemandMonitorMajorIndustryTrend 劳动力需求重点产业需求趋势分析
* @return 劳动力需求重点产业需求趋势分析
*/
ModelDemandMonitorMajorIndustryTrend findUnique(ModelDemandMonitorMajorIndustryTrend modelDemandMonitorMajorIndustryTrend);
/**
* 查询列表
*
* @param modelDemandMonitorMajorIndustryTrend 劳动力需求重点产业需求趋势分析
* @return 列表
*/
List<ModelDemandMonitorMajorIndustryTrend> list(ModelDemandMonitorMajorIndustryTrend modelDemandMonitorMajorIndustryTrend);
}

View File

@@ -0,0 +1,84 @@
package com.ruoyi.cms.service;
import com.ruoyi.cms.domain.ModelDemandMonitorMajorIndustryTrend;
import com.ruoyi.cms.domain.dto.ModelExportParamDto;
import com.ruoyi.cms.domain.vo.ModelDemandMonitorMajorIndustryTrendVo;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 劳动力需求重点产业需求趋势分析
*
* @author 马宝龙
* @date 2026/7/3
*/
public interface ModelDemandMonitorMajorIndustryTrendService {
/**
* 创建
*
* @param modelDemandMonitorMajorIndustryTrend 劳动力需求重点产业需求趋势分析
*/
void create(ModelDemandMonitorMajorIndustryTrend modelDemandMonitorMajorIndustryTrend);
/**
* 更新
*
* @param modelDemandMonitorMajorIndustryTrend 劳动力需求重点产业需求趋势分析
*/
void update(ModelDemandMonitorMajorIndustryTrend modelDemandMonitorMajorIndustryTrend);
/**
* 删除
*
* @param id ID
*/
void delete(Long id);
/**
* 清空
*/
void clear();
/**
* 查询详情
*
* @param id ID
* @return 劳动力需求重点产业需求趋势分析
*/
ModelDemandMonitorMajorIndustryTrend detail(Long id);
/**
* 查询列表
*
* @param modelDemandMonitorMajorIndustryTrend 劳动力需求重点产业需求趋势分析
* @return 列表
*/
List<ModelDemandMonitorMajorIndustryTrend> list(ModelDemandMonitorMajorIndustryTrend modelDemandMonitorMajorIndustryTrend);
/**
* 查询需求列表
*
* @param modelDemandMonitorMajorIndustryTrend 劳动力需求重点产业需求趋势分析
* @return 需求列表
*/
ModelDemandMonitorMajorIndustryTrendVo listDemand(ModelDemandMonitorMajorIndustryTrend modelDemandMonitorMajorIndustryTrend);
/**
* 导入数据
*
* @param file 文件
* @return 导入结果
*/
String importExcel(MultipartFile file);
/**
* 导出数据
*
* @param response 响应体
* @param dto 导出参数
*/
void exportExcel(HttpServletResponse response, ModelExportParamDto dto);
}

View File

@@ -6,6 +6,7 @@ import com.ruoyi.cms.service.ModelCommonService;
import com.ruoyi.cms.service.ModelDemandMonitorEmploymentService;
import com.ruoyi.cms.service.ModelDemandMonitorIndustryIncreaseService;
import com.ruoyi.cms.service.ModelDemandMonitorIndustryTrendService;
import com.ruoyi.cms.service.ModelDemandMonitorMajorIndustryTrendService;
import com.ruoyi.cms.service.ModelSupplyMonitorIndustryPopulationService;
import com.ruoyi.cms.service.ModelSupplyMonitorLaborJoinRateService;
import com.ruoyi.cms.service.ModelSupplyMonitorOccupationPopulationService;
@@ -50,6 +51,7 @@ public class ModelCommonServiceImpl implements ModelCommonService {
private final ModelDemandMonitorEmploymentService modelDemandMonitorEmploymentService;
private final ModelDemandMonitorIndustryIncreaseService modelDemandMonitorIndustryIncreaseService;
private final ModelDemandMonitorIndustryTrendService modelDemandMonitorIndustryTrendService;
private final ModelDemandMonitorMajorIndustryTrendService modelDemandMonitorMajorIndustryTrendService;
@Override
public void template(HttpServletResponse response,
@@ -111,6 +113,8 @@ public class ModelCommonServiceImpl implements ModelCommonService {
return modelDemandMonitorIndustryIncreaseService.importExcel(file);
case MODEL_DEMAND_MONITOR_INDUSTRY_TREND:
return modelDemandMonitorIndustryTrendService.importExcel(file);
case MODEL_DEMAND_MONITOR_MAJOR_INDUSTRY_TREND:
return modelDemandMonitorMajorIndustryTrendService.importExcel(file);
default:
throw new ServiceException("模板类型错误");
}
@@ -153,6 +157,9 @@ public class ModelCommonServiceImpl implements ModelCommonService {
case MODEL_DEMAND_MONITOR_INDUSTRY_TREND:
modelDemandMonitorIndustryTrendService.exportExcel(response, dto);
break;
case MODEL_DEMAND_MONITOR_MAJOR_INDUSTRY_TREND:
modelDemandMonitorMajorIndustryTrendService.exportExcel(response, dto);
break;
default:
throw new ServiceException("模板类型错误");
}

View File

@@ -2,6 +2,7 @@ package com.ruoyi.cms.service.impl;
import com.ruoyi.cms.constant.enums.ModelTemplateTypeEnum;
import com.ruoyi.cms.domain.ModelDemandMonitorIndustryTrend;
import com.ruoyi.cms.domain.ModelDemandMonitorMajorIndustryTrend;
import com.ruoyi.cms.domain.dto.ExcelRow;
import com.ruoyi.cms.domain.dto.ModelExportParamDto;
import com.ruoyi.cms.domain.vo.ModelDemandMonitorIndustryTrendVo;
@@ -169,6 +170,7 @@ public class ModelDemandMonitorIndustryTrendServiceImpl implements ModelDemandMo
List<String> firstRow = new ArrayList<>();
firstRow.add("年月");
firstRow.add("总需求人数");
for (String industryCode : industryCodeList) {
firstRow.add(industryName.get(industryCode));
}
@@ -181,11 +183,15 @@ public class ModelDemandMonitorIndustryTrendServiceImpl implements ModelDemandMo
for (ModelDemandMonitorIndustryTrend trend : trends) {
trendMap.put(trend.getIndustryCode(), trend);
}
int totalDemandCount = 0;
for (String industryCode : industryCodeList) {
rows.add(Optional.ofNullable(trendMap.get(industryCode))
Integer demandCount = Optional.ofNullable(trendMap.get(industryCode))
.map(ModelDemandMonitorIndustryTrend::getDemandCount)
.orElse(0).toString());
.orElse(0);
totalDemandCount += demandCount;
rows.add(demandCount.toString());
}
rows.add(1, Integer.toString(totalDemandCount));
dataList.add(new ExcelRow(rows.toArray(new String[0])));
}
vo.setDataList(dataList);

View File

@@ -0,0 +1,274 @@
package com.ruoyi.cms.service.impl;
import com.ruoyi.cms.constant.enums.ModelTemplateTypeEnum;
import com.ruoyi.cms.domain.ModelDemandMonitorMajorIndustryTrend;
import com.ruoyi.cms.domain.dto.ExcelRow;
import com.ruoyi.cms.domain.dto.ModelExportParamDto;
import com.ruoyi.cms.domain.vo.ModelDemandMonitorMajorIndustryTrendVo;
import com.ruoyi.cms.mapper.ModelDemandMonitorMajorIndustryTrendMapper;
import com.ruoyi.cms.service.ModelDemandMonitorMajorIndustryTrendService;
import com.ruoyi.cms.util.document.ExcelUtil;
import com.ruoyi.cms.util.document.MultiSheetExcelUtil;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.bean.BeanValidators;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Validator;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
/**
* 劳动力需求重点产业需求趋势分析
*
* @author 马宝龙
* @date 2026/7/3
*/
@Slf4j
@Service
@Validated
@RequiredArgsConstructor
public class ModelDemandMonitorMajorIndustryTrendServiceImpl implements ModelDemandMonitorMajorIndustryTrendService {
private final ModelDemandMonitorMajorIndustryTrendMapper modelDemandMonitorMajorIndustryTrendMapper;
private final Validator validator;
@Override
public void create(ModelDemandMonitorMajorIndustryTrend modelDemandMonitorMajorIndustryTrend) {
check(modelDemandMonitorMajorIndustryTrend);
// 查询唯一(按年月+产业编号)
Optional<ModelDemandMonitorMajorIndustryTrend> optional = findUnique(modelDemandMonitorMajorIndustryTrend);
if (optional.isPresent()) {
// 更新
ModelDemandMonitorMajorIndustryTrend exists = optional.get();
modelDemandMonitorMajorIndustryTrend.setId(exists.getId());
modelDemandMonitorMajorIndustryTrendMapper.update(modelDemandMonitorMajorIndustryTrend);
} else {
// 新增
modelDemandMonitorMajorIndustryTrendMapper.insert(modelDemandMonitorMajorIndustryTrend);
}
}
/**
* 检查
*
* @param modelDemandMonitorMajorIndustryTrend 劳动力需求重点产业需求趋势分析
*/
void check(ModelDemandMonitorMajorIndustryTrend modelDemandMonitorMajorIndustryTrend) {
if (StringUtils.isBlank(modelDemandMonitorMajorIndustryTrend.getYearMonth())) {
throw new ServiceException("年月不能为空");
}
if (StringUtils.isBlank(modelDemandMonitorMajorIndustryTrend.getIndustryCode())) {
throw new ServiceException("产业编号不能为空");
}
if (StringUtils.isBlank(modelDemandMonitorMajorIndustryTrend.getIndustryName())) {
throw new ServiceException("产业名称不能为空");
}
if (Objects.isNull(modelDemandMonitorMajorIndustryTrend.getDemandCount())) {
throw new ServiceException("需求人数不能为空");
}
}
@Override
public void update(ModelDemandMonitorMajorIndustryTrend modelDemandMonitorMajorIndustryTrend) {
check(modelDemandMonitorMajorIndustryTrend);
if (Objects.isNull(modelDemandMonitorMajorIndustryTrend.getId())) {
throw new ServiceException("id不能为空");
}
Optional<ModelDemandMonitorMajorIndustryTrend> unique = findUnique(modelDemandMonitorMajorIndustryTrend);
if (!unique.isPresent()) {
modelDemandMonitorMajorIndustryTrendMapper.update(modelDemandMonitorMajorIndustryTrend);
return;
}
ModelDemandMonitorMajorIndustryTrend exists = unique.get();
if (!exists.getId().equals(modelDemandMonitorMajorIndustryTrend.getId())) {
throw new ServiceException("数据已存在");
}
modelDemandMonitorMajorIndustryTrendMapper.update(modelDemandMonitorMajorIndustryTrend);
}
@Override
public void delete(Long id) {
if (Objects.isNull(id)) {
throw new ServiceException("id不能为空");
}
modelDemandMonitorMajorIndustryTrendMapper.deleteById(id);
}
@Override
public void clear() {
modelDemandMonitorMajorIndustryTrendMapper.clear();
}
@Override
public ModelDemandMonitorMajorIndustryTrend detail(Long id) {
if (Objects.isNull(id)) {
throw new ServiceException("id不能为空");
}
return modelDemandMonitorMajorIndustryTrendMapper.selectById(id);
}
/**
* 查询唯一
*
* @param modelDemandMonitorMajorIndustryTrend 劳动力需求重点产业需求趋势分析
* @return 劳动力需求重点产业需求趋势分析
*/
private Optional<ModelDemandMonitorMajorIndustryTrend> findUnique(ModelDemandMonitorMajorIndustryTrend modelDemandMonitorMajorIndustryTrend) {
ModelDemandMonitorMajorIndustryTrend unique =
modelDemandMonitorMajorIndustryTrendMapper.findUnique(modelDemandMonitorMajorIndustryTrend);
return Optional.ofNullable(unique);
}
@Override
public List<ModelDemandMonitorMajorIndustryTrend> list(ModelDemandMonitorMajorIndustryTrend modelDemandMonitorMajorIndustryTrend) {
return modelDemandMonitorMajorIndustryTrendMapper.list(modelDemandMonitorMajorIndustryTrend);
}
@Override
public ModelDemandMonitorMajorIndustryTrendVo listDemand(ModelDemandMonitorMajorIndustryTrend modelDemandMonitorMajorIndustryTrend) {
ModelDemandMonitorMajorIndustryTrendVo vo = ModelDemandMonitorMajorIndustryTrendVo.builder().build();
List<ModelDemandMonitorMajorIndustryTrend> list = list(modelDemandMonitorMajorIndustryTrend);
if (CollectionUtils.isEmpty(list)) {
return vo;
}
Set<String> industryCodeSet = new HashSet<>();
Map<String, String> industryName = new HashMap<>();
Map<String, List<ModelDemandMonitorMajorIndustryTrend>> map = new HashMap<>();
for (ModelDemandMonitorMajorIndustryTrend trend : list) {
industryCodeSet.add(trend.getIndustryCode());
industryName.put(trend.getIndustryCode(), trend.getIndustryName());
List<ModelDemandMonitorMajorIndustryTrend> trendList = Optional.ofNullable(map.get(trend.getYearMonth()))
.orElse(new ArrayList<>());
trendList.add(trend);
map.put(trend.getYearMonth(), trendList);
}
List<ExcelRow> dataList = new ArrayList<>();
List<String> industryCodeList = new ArrayList<>(industryCodeSet);
Collections.sort(industryCodeList);
List<String> firstRow = new ArrayList<>();
firstRow.add("年月");
firstRow.add("总需求人数");
for (String industryCode : industryCodeList) {
firstRow.add(industryName.get(industryCode));
}
dataList.add(new ExcelRow(firstRow.toArray(new String[0])));
for (Map.Entry<String, List<ModelDemandMonitorMajorIndustryTrend>> entry : map.entrySet()) {
List<String> rows = new ArrayList<>();
rows.add(entry.getKey());
List<ModelDemandMonitorMajorIndustryTrend> trends = entry.getValue();
Map<String, ModelDemandMonitorMajorIndustryTrend> trendMap = new HashMap<>();
for (ModelDemandMonitorMajorIndustryTrend trend : trends) {
trendMap.put(trend.getIndustryCode(), trend);
}
int totalDemandCount = 0;
for (String industryCode : industryCodeList) {
Integer demandCount = Optional.ofNullable(trendMap.get(industryCode))
.map(ModelDemandMonitorMajorIndustryTrend::getDemandCount)
.orElse(0);
totalDemandCount += demandCount;
rows.add(demandCount.toString());
}
rows.add(1, Integer.toString(totalDemandCount));
dataList.add(new ExcelRow(rows.toArray(new String[0])));
}
vo.setDataList(dataList);
return vo;
}
@Override
public String importExcel(MultipartFile file) {
try {
ExcelUtil<ModelDemandMonitorMajorIndustryTrend> util =
new ExcelUtil<>(ModelDemandMonitorMajorIndustryTrend.class);
List<ModelDemandMonitorMajorIndustryTrend> list = util.importExcel(file.getInputStream());
ModelDemandMonitorMajorIndustryTrend exists;
int successNum = 0;
int failureNum = 0;
StringBuilder successMsg = new StringBuilder();
StringBuilder failureMsg = new StringBuilder();
for (ModelDemandMonitorMajorIndustryTrend item : list) {
try {
check(item);
exists = modelDemandMonitorMajorIndustryTrendMapper.findUnique(item);
if (exists == null) {
BeanValidators.validateWithException(validator, item);
modelDemandMonitorMajorIndustryTrendMapper.insert(item);
successNum++;
String msg =
"<br/>" + successNum + "" + "年月:" + item.getYearMonth() + "产业:" + item.getIndustryName() + "数据导入成功。";
successMsg.append(msg);
} else {
item.setId(exists.getId());
BeanValidators.validateWithException(validator, item);
modelDemandMonitorMajorIndustryTrendMapper.update(item);
successNum++;
String msg =
"<br/>" + successNum + "" + "年月:" + item.getYearMonth() + "产业:" + item.getIndustryName() + "数据更新成功。";
successMsg.append(msg);
}
} catch (Exception e) {
failureNum++;
String msg =
"<br/>" + failureNum + "" + "年月:" + item.getYearMonth() + "产业:" + item.getIndustryName() + "数据导入失败:";
failureMsg.append(msg).append(e.getMessage());
log.error(msg, e);
}
}
if (failureNum > 0) {
failureMsg.insert(0, "导入失败!共 " + failureNum + " 条数据出现问题,错误如下:");
throw new ServiceException(failureMsg.toString());
} else {
successMsg.insert(0, "数据已全部导入成功!共 " + successNum + " 条:");
}
return successMsg.toString();
} catch (Exception e) {
log.error("数据导入失败", e);
throw new ServiceException("数据导入失败");
}
}
@Override
public void exportExcel(HttpServletResponse response, ModelExportParamDto dto) {
try {
ModelDemandMonitorMajorIndustryTrendVo vo = listDemand(ModelDemandMonitorMajorIndustryTrend.builder()
.yearMonth(dto.getYearMonth())
.build());
MultiSheetExcelUtil multiSheetExcelUtil = new MultiSheetExcelUtil();
ExcelUtil<ExcelRow> basicSituationExcelUtil = new com.ruoyi.cms.util.document.ExcelUtil<>(ExcelRow.class);
basicSituationExcelUtil.setDataList(vo.getDataList());
basicSituationExcelUtil.setSheetName("重点产业需求趋势分析");
multiSheetExcelUtil.addSheet(basicSituationExcelUtil);
multiSheetExcelUtil.setFileName(ModelTemplateTypeEnum.MODEL_DEMAND_MONITOR_MAJOR_INDUSTRY_TREND.getDesc());
multiSheetExcelUtil.exportExcel(response);
} catch (Exception e) {
log.error("数据导出失败", e);
throw new ServiceException("数据导出失败");
}
}
}