From 174b92b7d1eddc32b0bb925cb696c21f6fda5c42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A9=AC=E5=AE=9D=E9=BE=99?= Date: Fri, 3 Jul 2026 18:19:48 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../constant/enums/ModelTemplateTypeEnum.java | 2 + ...lDemandMonitorIndustryTrendController.java | 104 +++++++ .../ModelDemandMonitorIndustryTrend.java | 48 ++++ .../cms/domain/dto/ModelExportParamDto.java | 8 +- .../vo/ModelDemandMonitorIndustryTrendVo.java | 34 +++ ...ModelDemandMonitorIndustryTrendMapper.java | 64 +++++ ...odelDemandMonitorIndustryTrendService.java | 84 ++++++ .../service/impl/ModelCommonServiceImpl.java | 7 + ...DemandMonitorIndustryTrendServiceImpl.java | 268 ++++++++++++++++++ .../ModelDemandMonitorIndustryTrendMapper.xml | 78 +++++ ...Ѝæ€ç›‘测系统-劳动力需求分行业需求趋势分æž.xlsx | Bin 0 -> 10418 bytes sql/datadashboard/table.sql | 42 ++- 12 files changed, 733 insertions(+), 6 deletions(-) create mode 100644 ruoyi-bussiness/src/main/java/com/ruoyi/cms/controller/ModelDemandMonitorIndustryTrendController.java create mode 100644 ruoyi-bussiness/src/main/java/com/ruoyi/cms/domain/ModelDemandMonitorIndustryTrend.java create mode 100644 ruoyi-bussiness/src/main/java/com/ruoyi/cms/domain/vo/ModelDemandMonitorIndustryTrendVo.java create mode 100644 ruoyi-bussiness/src/main/java/com/ruoyi/cms/mapper/ModelDemandMonitorIndustryTrendMapper.java create mode 100644 ruoyi-bussiness/src/main/java/com/ruoyi/cms/service/ModelDemandMonitorIndustryTrendService.java create mode 100644 ruoyi-bussiness/src/main/java/com/ruoyi/cms/service/impl/ModelDemandMonitorIndustryTrendServiceImpl.java create mode 100644 ruoyi-bussiness/src/main/resources/mapper/ModelDemandMonitorIndustryTrendMapper.xml create mode 100644 ruoyi-bussiness/src/main/resources/template/劳动力动æ€ç›‘测系统-劳动力需求分行业需求趋势分æž.xlsx diff --git a/ruoyi-bussiness/src/main/java/com/ruoyi/cms/constant/enums/ModelTemplateTypeEnum.java b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/constant/enums/ModelTemplateTypeEnum.java index 6ce90ea..778ba02 100644 --- a/ruoyi-bussiness/src/main/java/com/ruoyi/cms/constant/enums/ModelTemplateTypeEnum.java +++ b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/constant/enums/ModelTemplateTypeEnum.java @@ -34,6 +34,8 @@ public enum ModelTemplateTypeEnum { MODEL_DEMAND_MONITOR_EMPLOYMENT("劳动力动æ€ç›‘测系统-劳动力需求就业人数"), MODEL_DEMAND_MONITOR_INDUSTRY_INCREASE("劳动力动æ€ç›‘测系统-劳动力需求产业增加值"), + + MODEL_DEMAND_MONITOR_INDUSTRY_TREND("劳动力动æ€ç›‘测系统-劳动力需求分行业需求趋势分æž"), ; private final String desc; } diff --git a/ruoyi-bussiness/src/main/java/com/ruoyi/cms/controller/ModelDemandMonitorIndustryTrendController.java b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/controller/ModelDemandMonitorIndustryTrendController.java new file mode 100644 index 0000000..bb37ef4 --- /dev/null +++ b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/controller/ModelDemandMonitorIndustryTrendController.java @@ -0,0 +1,104 @@ +package com.ruoyi.cms.controller; + +import com.ruoyi.cms.domain.ModelDemandMonitorIndustryTrend; +import com.ruoyi.cms.domain.vo.ModelDemandMonitorIndustryTrendVo; +import com.ruoyi.cms.service.ModelDemandMonitorIndustryTrendService; +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/demandMonitorIndustryTrend") +@RequiredArgsConstructor +public class ModelDemandMonitorIndustryTrendController extends BaseController { + + private final ModelDemandMonitorIndustryTrendService modelDemandMonitorIndustryTrendService; + + /** + * 创建 + * + * @param modelDemandMonitorIndustryTrend åŠ³åŠ¨åŠ›éœ€æ±‚åˆ†è¡Œä¸šéœ€æ±‚è¶‹åŠ¿åˆ†æž + * @return 创建结果 + */ + @PostMapping("/create") + public AjaxResult create(@Valid @RequestBody ModelDemandMonitorIndustryTrend modelDemandMonitorIndustryTrend) { + modelDemandMonitorIndustryTrendService.create(modelDemandMonitorIndustryTrend); + return AjaxResult.success(); + } + + /** + * æ›´æ–° + * + * @param modelDemandMonitorIndustryTrend åŠ³åŠ¨åŠ›éœ€æ±‚åˆ†è¡Œä¸šéœ€æ±‚è¶‹åŠ¿åˆ†æž + * @return 更新结果 + */ + @PutMapping("/update") + public AjaxResult update(@Valid @RequestBody ModelDemandMonitorIndustryTrend modelDemandMonitorIndustryTrend) { + modelDemandMonitorIndustryTrendService.update(modelDemandMonitorIndustryTrend); + return AjaxResult.success(); + } + + /** + * 删除 + * + * @param id ID + * @return 删除结果 + */ + @DeleteMapping("/delete") + public AjaxResult delete(@RequestParam Long id) { + modelDemandMonitorIndustryTrendService.delete(id); + return AjaxResult.success(); + } + + /** + * 清空 + * + * @return 清空结果 + */ + @DeleteMapping("/clear") + public AjaxResult clear() { + modelDemandMonitorIndustryTrendService.clear(); + return AjaxResult.success(); + } + + /** + * 查询详情 + * + * @param id ID + * @return åŠ³åŠ¨åŠ›éœ€æ±‚åˆ†è¡Œä¸šéœ€æ±‚è¶‹åŠ¿åˆ†æž + */ + @GetMapping("/detail") + public AjaxResult detail(@RequestParam Long id) { + ModelDemandMonitorIndustryTrend data = modelDemandMonitorIndustryTrendService.detail(id); + return AjaxResult.success(data); + } + + /** + * 查询列表 + * + * @param modelDemandMonitorIndustryTrend åŠ³åŠ¨åŠ›éœ€æ±‚åˆ†è¡Œä¸šéœ€æ±‚è¶‹åŠ¿åˆ†æž + * @return 列表 + */ + @PostMapping("/list") + public AjaxResult list(@RequestBody ModelDemandMonitorIndustryTrend modelDemandMonitorIndustryTrend) { + ModelDemandMonitorIndustryTrendVo list = + modelDemandMonitorIndustryTrendService.listDemand(modelDemandMonitorIndustryTrend); + return AjaxResult.success(list); + } +} \ No newline at end of file diff --git a/ruoyi-bussiness/src/main/java/com/ruoyi/cms/domain/ModelDemandMonitorIndustryTrend.java b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/domain/ModelDemandMonitorIndustryTrend.java new file mode 100644 index 0000000..47e1bd1 --- /dev/null +++ b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/domain/ModelDemandMonitorIndustryTrend.java @@ -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 ModelDemandMonitorIndustryTrend 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; +} \ No newline at end of file diff --git a/ruoyi-bussiness/src/main/java/com/ruoyi/cms/domain/dto/ModelExportParamDto.java b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/domain/dto/ModelExportParamDto.java index 7f70658..a04afe0 100644 --- a/ruoyi-bussiness/src/main/java/com/ruoyi/cms/domain/dto/ModelExportParamDto.java +++ b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/domain/dto/ModelExportParamDto.java @@ -30,7 +30,11 @@ public class ModelExportParamDto implements Serializable { */ private String indicatorCode; /** - * æŒ‡æ ‡ç¼–ç  + * 年份 */ private Integer year; -} + /** + * 年月 + */ + private String yearMonth; +} \ No newline at end of file diff --git a/ruoyi-bussiness/src/main/java/com/ruoyi/cms/domain/vo/ModelDemandMonitorIndustryTrendVo.java b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/domain/vo/ModelDemandMonitorIndustryTrendVo.java new file mode 100644 index 0000000..162e4ca --- /dev/null +++ b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/domain/vo/ModelDemandMonitorIndustryTrendVo.java @@ -0,0 +1,34 @@ +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 ModelDemandMonitorIndustryTrendVo implements Serializable { + private static final long serialVersionUID = 1L; + + /** + * 标题列表 + */ +// private List titleList; + + /** + * æ•°æ®åˆ—表 + */ + private List dataList; +} \ No newline at end of file diff --git a/ruoyi-bussiness/src/main/java/com/ruoyi/cms/mapper/ModelDemandMonitorIndustryTrendMapper.java b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/mapper/ModelDemandMonitorIndustryTrendMapper.java new file mode 100644 index 0000000..e68c4d9 --- /dev/null +++ b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/mapper/ModelDemandMonitorIndustryTrendMapper.java @@ -0,0 +1,64 @@ +package com.ruoyi.cms.mapper; + +import com.ruoyi.cms.domain.ModelDemandMonitorIndustryTrend; + +import java.util.List; + +/** + * åŠ³åŠ¨åŠ›éœ€æ±‚åˆ†è¡Œä¸šéœ€æ±‚è¶‹åŠ¿åˆ†æž + * + * @author 马å®é¾™ + * @date 2026/7/3 + */ +public interface ModelDemandMonitorIndustryTrendMapper { + + /** + * 新增 + * + * @param modelDemandMonitorIndustryTrend åŠ³åŠ¨åŠ›éœ€æ±‚åˆ†è¡Œä¸šéœ€æ±‚è¶‹åŠ¿åˆ†æž + */ + void insert(ModelDemandMonitorIndustryTrend modelDemandMonitorIndustryTrend); + + /** + * 修改 + * + * @param modelDemandMonitorIndustryTrend åŠ³åŠ¨åŠ›éœ€æ±‚åˆ†è¡Œä¸šéœ€æ±‚è¶‹åŠ¿åˆ†æž + */ + void update(ModelDemandMonitorIndustryTrend modelDemandMonitorIndustryTrend); + + /** + * 通过ID删除 + * + * @param id ID + */ + void deleteById(Long id); + + /** + * 清空 + */ + void clear(); + + /** + * 通过ID查询 + * + * @param id ID + * @return åŠ³åŠ¨åŠ›éœ€æ±‚åˆ†è¡Œä¸šéœ€æ±‚è¶‹åŠ¿åˆ†æž + */ + ModelDemandMonitorIndustryTrend selectById(Long id); + + /** + * 查询唯一(按年月+行业编å·ï¼‰ + * + * @param modelDemandMonitorIndustryTrend åŠ³åŠ¨åŠ›éœ€æ±‚åˆ†è¡Œä¸šéœ€æ±‚è¶‹åŠ¿åˆ†æž + * @return åŠ³åŠ¨åŠ›éœ€æ±‚åˆ†è¡Œä¸šéœ€æ±‚è¶‹åŠ¿åˆ†æž + */ + ModelDemandMonitorIndustryTrend findUnique(ModelDemandMonitorIndustryTrend modelDemandMonitorIndustryTrend); + + /** + * 查询列表 + * + * @param modelDemandMonitorIndustryTrend åŠ³åŠ¨åŠ›éœ€æ±‚åˆ†è¡Œä¸šéœ€æ±‚è¶‹åŠ¿åˆ†æž + * @return 列表 + */ + List list(ModelDemandMonitorIndustryTrend modelDemandMonitorIndustryTrend); +} \ No newline at end of file diff --git a/ruoyi-bussiness/src/main/java/com/ruoyi/cms/service/ModelDemandMonitorIndustryTrendService.java b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/service/ModelDemandMonitorIndustryTrendService.java new file mode 100644 index 0000000..51b021c --- /dev/null +++ b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/service/ModelDemandMonitorIndustryTrendService.java @@ -0,0 +1,84 @@ +package com.ruoyi.cms.service; + +import com.ruoyi.cms.domain.ModelDemandMonitorIndustryTrend; +import com.ruoyi.cms.domain.dto.ModelExportParamDto; +import com.ruoyi.cms.domain.vo.ModelDemandMonitorIndustryTrendVo; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; + +/** + * åŠ³åŠ¨åŠ›éœ€æ±‚åˆ†è¡Œä¸šéœ€æ±‚è¶‹åŠ¿åˆ†æž + * + * @author 马å®é¾™ + * @date 2026/7/3 + */ +public interface ModelDemandMonitorIndustryTrendService { + + /** + * 创建 + * + * @param modelDemandMonitorIndustryTrend åŠ³åŠ¨åŠ›éœ€æ±‚åˆ†è¡Œä¸šéœ€æ±‚è¶‹åŠ¿åˆ†æž + */ + void create(ModelDemandMonitorIndustryTrend modelDemandMonitorIndustryTrend); + + /** + * æ›´æ–° + * + * @param modelDemandMonitorIndustryTrend åŠ³åŠ¨åŠ›éœ€æ±‚åˆ†è¡Œä¸šéœ€æ±‚è¶‹åŠ¿åˆ†æž + */ + void update(ModelDemandMonitorIndustryTrend modelDemandMonitorIndustryTrend); + + /** + * 删除 + * + * @param id ID + */ + void delete(Long id); + + /** + * 清空 + */ + void clear(); + + /** + * 查询详情 + * + * @param id ID + * @return åŠ³åŠ¨åŠ›éœ€æ±‚åˆ†è¡Œä¸šéœ€æ±‚è¶‹åŠ¿åˆ†æž + */ + ModelDemandMonitorIndustryTrend detail(Long id); + + /** + * 查询列表 + * + * @param modelDemandMonitorIndustryTrend åŠ³åŠ¨åŠ›éœ€æ±‚åˆ†è¡Œä¸šéœ€æ±‚è¶‹åŠ¿åˆ†æž + * @return 列表 + */ + List list(ModelDemandMonitorIndustryTrend modelDemandMonitorIndustryTrend); + + /** + * 查询需求列表 + * + * @param modelDemandMonitorIndustryTrend åŠ³åŠ¨åŠ›éœ€æ±‚åˆ†è¡Œä¸šéœ€æ±‚è¶‹åŠ¿åˆ†æž + * @return 需求列表 + */ + ModelDemandMonitorIndustryTrendVo listDemand(ModelDemandMonitorIndustryTrend modelDemandMonitorIndustryTrend); + + /** + * å¯¼å…¥æ•°æ® + * + * @param file 文件 + * @return 导入结果 + */ + String importExcel(MultipartFile file); + + /** + * å¯¼å‡ºæ•°æ® + * + * @param response å“应体 + * @param dto å¯¼å‡ºå‚æ•° + */ + void exportExcel(HttpServletResponse response, ModelExportParamDto dto); +} \ No newline at end of file diff --git a/ruoyi-bussiness/src/main/java/com/ruoyi/cms/service/impl/ModelCommonServiceImpl.java b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/service/impl/ModelCommonServiceImpl.java index 5e59e69..dd99fb2 100644 --- a/ruoyi-bussiness/src/main/java/com/ruoyi/cms/service/impl/ModelCommonServiceImpl.java +++ b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/service/impl/ModelCommonServiceImpl.java @@ -5,6 +5,7 @@ import com.ruoyi.cms.domain.dto.ModelExportParamDto; 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.ModelSupplyMonitorIndustryPopulationService; import com.ruoyi.cms.service.ModelSupplyMonitorLaborJoinRateService; import com.ruoyi.cms.service.ModelSupplyMonitorOccupationPopulationService; @@ -48,6 +49,7 @@ public class ModelCommonServiceImpl implements ModelCommonService { private final ModelSupplyMonitorOccupationPopulationService modelSupplyMonitorOccupationPopulationService; private final ModelDemandMonitorEmploymentService modelDemandMonitorEmploymentService; private final ModelDemandMonitorIndustryIncreaseService modelDemandMonitorIndustryIncreaseService; + private final ModelDemandMonitorIndustryTrendService modelDemandMonitorIndustryTrendService; @Override public void template(HttpServletResponse response, @@ -107,6 +109,8 @@ public class ModelCommonServiceImpl implements ModelCommonService { return modelDemandMonitorEmploymentService.importExcel(file); case MODEL_DEMAND_MONITOR_INDUSTRY_INCREASE: return modelDemandMonitorIndustryIncreaseService.importExcel(file); + case MODEL_DEMAND_MONITOR_INDUSTRY_TREND: + return modelDemandMonitorIndustryTrendService.importExcel(file); default: throw new ServiceException("模æ¿ç±»åž‹é”™è¯¯"); } @@ -146,6 +150,9 @@ public class ModelCommonServiceImpl implements ModelCommonService { case MODEL_DEMAND_MONITOR_INDUSTRY_INCREASE: modelDemandMonitorIndustryIncreaseService.exportExcel(response, dto); break; + case MODEL_DEMAND_MONITOR_INDUSTRY_TREND: + modelDemandMonitorIndustryTrendService.exportExcel(response, dto); + break; default: throw new ServiceException("模æ¿ç±»åž‹é”™è¯¯"); } diff --git a/ruoyi-bussiness/src/main/java/com/ruoyi/cms/service/impl/ModelDemandMonitorIndustryTrendServiceImpl.java b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/service/impl/ModelDemandMonitorIndustryTrendServiceImpl.java new file mode 100644 index 0000000..8a07bb2 --- /dev/null +++ b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/service/impl/ModelDemandMonitorIndustryTrendServiceImpl.java @@ -0,0 +1,268 @@ +package com.ruoyi.cms.service.impl; + +import com.ruoyi.cms.constant.enums.ModelTemplateTypeEnum; +import com.ruoyi.cms.domain.ModelDemandMonitorIndustryTrend; +import com.ruoyi.cms.domain.dto.ExcelRow; +import com.ruoyi.cms.domain.dto.ModelExportParamDto; +import com.ruoyi.cms.domain.vo.ModelDemandMonitorIndustryTrendVo; +import com.ruoyi.cms.mapper.ModelDemandMonitorIndustryTrendMapper; +import com.ruoyi.cms.service.ModelDemandMonitorIndustryTrendService; +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 ModelDemandMonitorIndustryTrendServiceImpl implements ModelDemandMonitorIndustryTrendService { + + private final ModelDemandMonitorIndustryTrendMapper modelDemandMonitorIndustryTrendMapper; + private final Validator validator; + + @Override + public void create(ModelDemandMonitorIndustryTrend modelDemandMonitorIndustryTrend) { + + check(modelDemandMonitorIndustryTrend); + + // 查询唯一(按年月+行业编å·ï¼‰ + Optional optional = findUnique(modelDemandMonitorIndustryTrend); + if (optional.isPresent()) { + // æ›´æ–° + ModelDemandMonitorIndustryTrend exists = optional.get(); + modelDemandMonitorIndustryTrend.setId(exists.getId()); + modelDemandMonitorIndustryTrendMapper.update(modelDemandMonitorIndustryTrend); + } else { + // 新增 + modelDemandMonitorIndustryTrendMapper.insert(modelDemandMonitorIndustryTrend); + } + } + + /** + * 检查 + * + * @param modelDemandMonitorIndustryTrend åŠ³åŠ¨åŠ›éœ€æ±‚åˆ†è¡Œä¸šéœ€æ±‚è¶‹åŠ¿åˆ†æž + */ + void check(ModelDemandMonitorIndustryTrend modelDemandMonitorIndustryTrend) { + if (StringUtils.isBlank(modelDemandMonitorIndustryTrend.getYearMonth())) { + throw new ServiceException("年月ä¸èƒ½ä¸ºç©º"); + } + if (StringUtils.isBlank(modelDemandMonitorIndustryTrend.getIndustryCode())) { + throw new ServiceException("行业编å·ä¸èƒ½ä¸ºç©º"); + } + if (StringUtils.isBlank(modelDemandMonitorIndustryTrend.getIndustryName())) { + throw new ServiceException("行业åç§°ä¸èƒ½ä¸ºç©º"); + } + if (Objects.isNull(modelDemandMonitorIndustryTrend.getDemandCount())) { + throw new ServiceException("需求人数ä¸èƒ½ä¸ºç©º"); + } + } + + @Override + public void update(ModelDemandMonitorIndustryTrend modelDemandMonitorIndustryTrend) { + + check(modelDemandMonitorIndustryTrend); + + if (Objects.isNull(modelDemandMonitorIndustryTrend.getId())) { + throw new ServiceException("idä¸èƒ½ä¸ºç©º"); + } + Optional unique = findUnique(modelDemandMonitorIndustryTrend); + if (!unique.isPresent()) { + modelDemandMonitorIndustryTrendMapper.update(modelDemandMonitorIndustryTrend); + return; + } + ModelDemandMonitorIndustryTrend exists = unique.get(); + if (!exists.getId().equals(modelDemandMonitorIndustryTrend.getId())) { + throw new ServiceException("æ•°æ®å·²å­˜åœ¨"); + } + modelDemandMonitorIndustryTrendMapper.update(modelDemandMonitorIndustryTrend); + } + + @Override + public void delete(Long id) { + if (Objects.isNull(id)) { + throw new ServiceException("idä¸èƒ½ä¸ºç©º"); + } + modelDemandMonitorIndustryTrendMapper.deleteById(id); + } + + @Override + public void clear() { + modelDemandMonitorIndustryTrendMapper.clear(); + } + + @Override + public ModelDemandMonitorIndustryTrend detail(Long id) { + if (Objects.isNull(id)) { + throw new ServiceException("idä¸èƒ½ä¸ºç©º"); + } + return modelDemandMonitorIndustryTrendMapper.selectById(id); + } + + /** + * 查询唯一 + * + * @param modelDemandMonitorIndustryTrend åŠ³åŠ¨åŠ›éœ€æ±‚åˆ†è¡Œä¸šéœ€æ±‚è¶‹åŠ¿åˆ†æž + * @return åŠ³åŠ¨åŠ›éœ€æ±‚åˆ†è¡Œä¸šéœ€æ±‚è¶‹åŠ¿åˆ†æž + */ + private Optional findUnique(ModelDemandMonitorIndustryTrend modelDemandMonitorIndustryTrend) { + ModelDemandMonitorIndustryTrend unique = + modelDemandMonitorIndustryTrendMapper.findUnique(modelDemandMonitorIndustryTrend); + return Optional.ofNullable(unique); + } + + @Override + public List list(ModelDemandMonitorIndustryTrend modelDemandMonitorIndustryTrend) { + return modelDemandMonitorIndustryTrendMapper.list(modelDemandMonitorIndustryTrend); + } + + @Override + public ModelDemandMonitorIndustryTrendVo listDemand(ModelDemandMonitorIndustryTrend modelDemandMonitorIndustryTrend) { + + ModelDemandMonitorIndustryTrendVo vo = ModelDemandMonitorIndustryTrendVo.builder().build(); + + List list = list(modelDemandMonitorIndustryTrend); + if (CollectionUtils.isEmpty(list)) { + return vo; + } + Set industryCodeSet = new HashSet<>(); + Map industryName = new HashMap<>(); + Map> map = new HashMap<>(); + for (ModelDemandMonitorIndustryTrend trend : list) { + industryCodeSet.add(trend.getIndustryCode()); + industryName.put(trend.getIndustryCode(), trend.getIndustryName()); + List trendList = Optional.ofNullable(map.get(trend.getYearMonth())) + .orElse(new ArrayList<>()); + trendList.add(trend); + map.put(trend.getYearMonth(), trendList); + } + + List dataList = new ArrayList<>(); + List industryCodeList = new ArrayList<>(industryCodeSet); + Collections.sort(industryCodeList); + + List firstRow = new ArrayList<>(); + firstRow.add("年月"); + for (String industryCode : industryCodeList) { + firstRow.add(industryName.get(industryCode)); + } + dataList.add(new ExcelRow(firstRow.toArray(new String[0]))); + for (Map.Entry> entry : map.entrySet()) { + List rows = new ArrayList<>(); + rows.add(entry.getKey()); + List trends = entry.getValue(); + Map trendMap = new HashMap<>(); + for (ModelDemandMonitorIndustryTrend trend : trends) { + trendMap.put(trend.getIndustryCode(), trend); + } + for (String industryCode : industryCodeList) { + rows.add(Optional.ofNullable(trendMap.get(industryCode)) + .map(ModelDemandMonitorIndustryTrend::getDemandCount) + .orElse(0).toString()); + } + dataList.add(new ExcelRow(rows.toArray(new String[0]))); + } + vo.setDataList(dataList); + return vo; + } + + @Override + public String importExcel(MultipartFile file) { + try { + ExcelUtil util = new ExcelUtil<>(ModelDemandMonitorIndustryTrend.class); + List list = util.importExcel(file.getInputStream()); + + ModelDemandMonitorIndustryTrend exists; + int successNum = 0; + int failureNum = 0; + StringBuilder successMsg = new StringBuilder(); + StringBuilder failureMsg = new StringBuilder(); + for (ModelDemandMonitorIndustryTrend item : list) { + try { + check(item); + exists = modelDemandMonitorIndustryTrendMapper.findUnique(item); + if (exists == null) { + BeanValidators.validateWithException(validator, item); + modelDemandMonitorIndustryTrendMapper.insert(item); + successNum++; + String msg = + "
" + successNum + "ã€" + "年月:" + item.getYearMonth() + "行业:" + item.getIndustryName() + "æ•°æ®å¯¼å…¥æˆåŠŸã€‚"; + successMsg.append(msg); + } else { + item.setId(exists.getId()); + BeanValidators.validateWithException(validator, item); + modelDemandMonitorIndustryTrendMapper.update(item); + successNum++; + String msg = + "
" + successNum + "ã€" + "年月:" + item.getYearMonth() + "行业:" + item.getIndustryName() + "æ•°æ®æ›´æ–°æˆåŠŸã€‚"; + successMsg.append(msg); + } + } catch (Exception e) { + failureNum++; + String msg = + "
" + 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 { + + ModelDemandMonitorIndustryTrendVo vo = listDemand(ModelDemandMonitorIndustryTrend.builder() + .yearMonth(dto.getYearMonth()) + .build()); + + MultiSheetExcelUtil multiSheetExcelUtil = new MultiSheetExcelUtil(); + ExcelUtil 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_INDUSTRY_TREND.getDesc()); + multiSheetExcelUtil.exportExcel(response); + + } catch (Exception e) { + log.error("æ•°æ®å¯¼å‡ºå¤±è´¥", e); + throw new ServiceException("æ•°æ®å¯¼å‡ºå¤±è´¥"); + } + } +} \ No newline at end of file diff --git a/ruoyi-bussiness/src/main/resources/mapper/ModelDemandMonitorIndustryTrendMapper.xml b/ruoyi-bussiness/src/main/resources/mapper/ModelDemandMonitorIndustryTrendMapper.xml new file mode 100644 index 0000000..2ba93fe --- /dev/null +++ b/ruoyi-bussiness/src/main/resources/mapper/ModelDemandMonitorIndustryTrendMapper.xml @@ -0,0 +1,78 @@ + + + + + + INSERT INTO model_demand_monitor_industry_trend (year_month, industry_code, industry_name, demand_count) + VALUES (#{yearMonth}, #{industryCode}, #{industryName}, #{demandCount}) + + + + UPDATE model_demand_monitor_industry_trend + SET year_month = #{yearMonth}, + industry_code = #{industryCode}, + industry_name = #{industryName}, + demand_count = #{demandCount} + WHERE id = #{id} + + + + DELETE + FROM model_demand_monitor_industry_trend + WHERE id = #{id} + + + + DELETE FROM model_demand_monitor_industry_trend + WHERE id IS NOT NULL; + + + + + + + + + \ No newline at end of file diff --git a/ruoyi-bussiness/src/main/resources/template/劳动力动æ€ç›‘测系统-劳动力需求分行业需求趋势分æž.xlsx b/ruoyi-bussiness/src/main/resources/template/劳动力动æ€ç›‘测系统-劳动力需求分行业需求趋势分æž.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..9250fbe0147173f9d330aefd88bf9adcee23b1ca GIT binary patch literal 10418 zcmeHtWmH|uvM#~hLeSt4+=9EiI|O%^g}b{2cL{F6f(Lg9x^PGc?(Pm3l5=);a`rpp zzMpT5*FUDLRnqgT?&|95l9L1jhXr|V!7?j+&-Z^fn5PFr8v{8z8(VuixhFETryrny zkXb%18#ufG0r>z50)qT^GCf;cS{EzJjMz2_a0cXF_YP<1?Ur?b`uSl zIr?-Wkz>^h#NVf#5GR75wx~+-6__?>*~ElLR)Rl{zlP6K)+g(G4C;M{=3(8$%7n)T ziykSSzqC~tF`ZvIzYRX{g^y1n(ZRU+Qyi$CVV7dsG6Cs+uY&=L?s;$r_K`k=7HwI$ z-)l~G=*dL3#zWPK9K&Ev@^?W@n<{pJt&V!7h(;OM!7SL^-wu=BQa8ddW3E_}t%ve$UE2;U#8tO|6rdE`OU2Hf~AE(>P@$yneZ2aZ) zTfhOK&b~5^r=O#AA)L@lKccamxX5z2GtIJ93pDo8+BK`fY(6MkQ)O-KwN84Vx=T&Q zi(MRBc>=S(0E)2@_bz%TeWmc~S> z(F#Lir+Qye2q1#c(M%8NrO6*I+$z7^v(r_sq384_oft@@!W# zi1f=I?`|xcX);@%jU|96A>P+~yOu7p`|8uo9iQFK(bslpPtj{ArM84;i1uB-&yZ}L zw5h3Lx=2bqwZ{-;q9!LE2tm9?(?>SLq%*?D%>BR%z=|tPHhk5H6%xJ|;Q|_OaFF$= z<@Mrsj2Sw_Q3Rhb4tT=&M3t0n7Cj}~T00K z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