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 9147ce2..6ce90ea 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 @@ -32,6 +32,8 @@ public enum ModelTemplateTypeEnum { MODEL_SUPPLY_MONITOR_OCCUPATION_POPULATION_RESULT("劳动力动态监测系统-劳动力供给结果分职业劳动力人口"), MODEL_DEMAND_MONITOR_EMPLOYMENT("劳动力动态监测系统-劳动力需求就业人数"), + + MODEL_DEMAND_MONITOR_INDUSTRY_INCREASE("劳动力动态监测系统-劳动力需求产业增加值"), ; private final String desc; } diff --git a/ruoyi-bussiness/src/main/java/com/ruoyi/cms/controller/ModelDemandMonitorIndustryIncreaseController.java b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/controller/ModelDemandMonitorIndustryIncreaseController.java new file mode 100644 index 0000000..a11a8ad --- /dev/null +++ b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/controller/ModelDemandMonitorIndustryIncreaseController.java @@ -0,0 +1,104 @@ +package com.ruoyi.cms.controller; + +import com.ruoyi.cms.domain.ModelDemandMonitorIndustryIncrease; +import com.ruoyi.cms.service.ModelDemandMonitorIndustryIncreaseService; +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; +import java.util.List; + +/** + * 劳动力需求产业增加值 + * + * @author 马宝龙 + * @date 2026/7/3 + */ +@RestController +@RequestMapping("/model/demandMonitorIndustryIncrease") +@RequiredArgsConstructor +public class ModelDemandMonitorIndustryIncreaseController extends BaseController { + + private final ModelDemandMonitorIndustryIncreaseService modelDemandMonitorIndustryIncreaseService; + + /** + * 创建 + * + * @param modelDemandMonitorIndustryIncrease 劳动力需求产业增加值 + * @return 创建结果 + */ + @PostMapping("/create") + public AjaxResult create(@Valid @RequestBody ModelDemandMonitorIndustryIncrease modelDemandMonitorIndustryIncrease) { + modelDemandMonitorIndustryIncreaseService.create(modelDemandMonitorIndustryIncrease); + return AjaxResult.success(); + } + + /** + * 更新 + * + * @param modelDemandMonitorIndustryIncrease 劳动力需求产业增加值 + * @return 更新结果 + */ + @PutMapping("/update") + public AjaxResult update(@Valid @RequestBody ModelDemandMonitorIndustryIncrease modelDemandMonitorIndustryIncrease) { + modelDemandMonitorIndustryIncreaseService.update(modelDemandMonitorIndustryIncrease); + return AjaxResult.success(); + } + + /** + * 删除 + * + * @param id ID + * @return 删除结果 + */ + @DeleteMapping("/delete") + public AjaxResult delete(@RequestParam Long id) { + modelDemandMonitorIndustryIncreaseService.delete(id); + return AjaxResult.success(); + } + + /** + * 清空 + * + * @return 清空结果 + */ + @DeleteMapping("/clear") + public AjaxResult clear() { + modelDemandMonitorIndustryIncreaseService.clear(); + return AjaxResult.success(); + } + + /** + * 查询详情 + * + * @param id ID + * @return 劳动力需求产业增加值 + */ + @GetMapping("/detail") + public AjaxResult detail(@RequestParam Long id) { + ModelDemandMonitorIndustryIncrease data = modelDemandMonitorIndustryIncreaseService.detail(id); + return AjaxResult.success(data); + } + + /** + * 查询列表 + * + * @param modelDemandMonitorIndustryIncrease 劳动力需求产业增加值 + * @return 列表 + */ + @PostMapping("/list") + public AjaxResult list(@RequestBody ModelDemandMonitorIndustryIncrease modelDemandMonitorIndustryIncrease) { + List list = + modelDemandMonitorIndustryIncreaseService.list(modelDemandMonitorIndustryIncrease); + return AjaxResult.success(list); + } +} \ No newline at end of file diff --git a/ruoyi-bussiness/src/main/java/com/ruoyi/cms/domain/ModelDemandMonitorEmployment.java b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/domain/ModelDemandMonitorEmployment.java index 7f69054..459d3f4 100644 --- a/ruoyi-bussiness/src/main/java/com/ruoyi/cms/domain/ModelDemandMonitorEmployment.java +++ b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/domain/ModelDemandMonitorEmployment.java @@ -7,6 +7,7 @@ import lombok.Data; import lombok.NoArgsConstructor; import java.io.Serializable; +import java.math.BigDecimal; /** * 劳动力需求就业人数 @@ -34,20 +35,20 @@ public class ModelDemandMonitorEmployment implements Serializable { * 总就业人数(万人) */ @Excel(name = "总就业人数(万人)") - private Integer totalCount; + private BigDecimal totalCount; /** * 第一产业就业人数(万人) */ @Excel(name = "第一产业就业人数(万人)") - private Integer firstIndustryCount; + private BigDecimal firstIndustryCount; /** * 第二产业就业人数(万人) */ @Excel(name = "第二产业就业人数(万人)") - private Integer secondIndustryCount; + private BigDecimal secondIndustryCount; /** * 第三产业就业人数(万人) */ @Excel(name = "第三产业就业人数(万人)") - private Integer thirdIndustryCount; + private BigDecimal thirdIndustryCount; } \ No newline at end of file diff --git a/ruoyi-bussiness/src/main/java/com/ruoyi/cms/domain/ModelDemandMonitorIndustryIncrease.java b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/domain/ModelDemandMonitorIndustryIncrease.java new file mode 100644 index 0000000..b0d5a0d --- /dev/null +++ b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/domain/ModelDemandMonitorIndustryIncrease.java @@ -0,0 +1,54 @@ +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; +import java.math.BigDecimal; + +/** + * 劳动力需求产业增加值 + * + * @author 马宝龙 + * @date 2026/7/3 + */ +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +public class ModelDemandMonitorIndustryIncrease implements Serializable { + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private Long id; + /** + * 年份 + */ + @Excel(name = "年份") + private Integer year; + /** + * 生产总值(亿元) + */ + @Excel(name = "生产总值(亿元)") + private BigDecimal totalAmount; + /** + * 第一产业增加值(亿元) + */ + @Excel(name = "第一产业增加值(亿元)") + private BigDecimal firstIndustryAmount; + /** + * 第二产业增加值(亿元) + */ + @Excel(name = "第二产业增加值(亿元)") + private BigDecimal secondIndustryAmount; + /** + * 第三产业增加值(亿元) + */ + @Excel(name = "第三产业增加值(亿元)") + private BigDecimal thirdIndustryAmount; +} \ No newline at end of file diff --git a/ruoyi-bussiness/src/main/java/com/ruoyi/cms/mapper/ModelDemandMonitorIndustryIncreaseMapper.java b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/mapper/ModelDemandMonitorIndustryIncreaseMapper.java new file mode 100644 index 0000000..12bbe69 --- /dev/null +++ b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/mapper/ModelDemandMonitorIndustryIncreaseMapper.java @@ -0,0 +1,64 @@ +package com.ruoyi.cms.mapper; + +import com.ruoyi.cms.domain.ModelDemandMonitorIndustryIncrease; + +import java.util.List; + +/** + * 劳动力需求产业增加值 + * + * @author 马宝龙 + * @date 2026/7/3 + */ +public interface ModelDemandMonitorIndustryIncreaseMapper { + + /** + * 新增 + * + * @param modelDemandMonitorIndustryIncrease 劳动力需求产业增加值 + */ + void insert(ModelDemandMonitorIndustryIncrease modelDemandMonitorIndustryIncrease); + + /** + * 修改 + * + * @param modelDemandMonitorIndustryIncrease 劳动力需求产业增加值 + */ + void update(ModelDemandMonitorIndustryIncrease modelDemandMonitorIndustryIncrease); + + /** + * 通过ID删除 + * + * @param id ID + */ + void deleteById(Long id); + + /** + * 清空 + */ + void clear(); + + /** + * 通过ID查询 + * + * @param id ID + * @return 劳动力需求产业增加值 + */ + ModelDemandMonitorIndustryIncrease selectById(Long id); + + /** + * 查询唯一(按年份) + * + * @param modelDemandMonitorIndustryIncrease 劳动力需求产业增加值 + * @return 劳动力需求产业增加值 + */ + ModelDemandMonitorIndustryIncrease findUnique(ModelDemandMonitorIndustryIncrease modelDemandMonitorIndustryIncrease); + + /** + * 查询列表 + * + * @param modelDemandMonitorIndustryIncrease 劳动力需求产业增加值 + * @return 列表 + */ + List list(ModelDemandMonitorIndustryIncrease modelDemandMonitorIndustryIncrease); +} \ No newline at end of file diff --git a/ruoyi-bussiness/src/main/java/com/ruoyi/cms/service/ModelDemandMonitorIndustryIncreaseService.java b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/service/ModelDemandMonitorIndustryIncreaseService.java new file mode 100644 index 0000000..ec7fd65 --- /dev/null +++ b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/service/ModelDemandMonitorIndustryIncreaseService.java @@ -0,0 +1,75 @@ +package com.ruoyi.cms.service; + +import com.ruoyi.cms.domain.ModelDemandMonitorIndustryIncrease; +import com.ruoyi.cms.domain.dto.ModelExportParamDto; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; + +/** + * 劳动力需求产业增加值 + * + * @author 马宝龙 + * @date 2026/7/3 + */ +public interface ModelDemandMonitorIndustryIncreaseService { + + /** + * 创建 + * + * @param modelDemandMonitorIndustryIncrease 劳动力需求产业增加值 + */ + void create(ModelDemandMonitorIndustryIncrease modelDemandMonitorIndustryIncrease); + + /** + * 更新 + * + * @param modelDemandMonitorIndustryIncrease 劳动力需求产业增加值 + */ + void update(ModelDemandMonitorIndustryIncrease modelDemandMonitorIndustryIncrease); + + /** + * 删除 + * + * @param id ID + */ + void delete(Long id); + + /** + * 清空 + */ + void clear(); + + /** + * 查询详情 + * + * @param id ID + * @return 劳动力需求产业增加值 + */ + ModelDemandMonitorIndustryIncrease detail(Long id); + + /** + * 查询列表 + * + * @param modelDemandMonitorIndustryIncrease 劳动力需求产业增加值 + * @return 列表 + */ + List list(ModelDemandMonitorIndustryIncrease modelDemandMonitorIndustryIncrease); + + /** + * 导入数据 + * + * @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 9eb529c..5e59e69 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 @@ -4,6 +4,7 @@ import com.ruoyi.cms.constant.enums.ModelTemplateTypeEnum; 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.ModelSupplyMonitorIndustryPopulationService; import com.ruoyi.cms.service.ModelSupplyMonitorLaborJoinRateService; import com.ruoyi.cms.service.ModelSupplyMonitorOccupationPopulationService; @@ -46,6 +47,7 @@ public class ModelCommonServiceImpl implements ModelCommonService { private final ModelSupplyMonitorIndustryPopulationService modelSupplyMonitorIndustryPopulationService; private final ModelSupplyMonitorOccupationPopulationService modelSupplyMonitorOccupationPopulationService; private final ModelDemandMonitorEmploymentService modelDemandMonitorEmploymentService; + private final ModelDemandMonitorIndustryIncreaseService modelDemandMonitorIndustryIncreaseService; @Override public void template(HttpServletResponse response, @@ -103,6 +105,8 @@ public class ModelCommonServiceImpl implements ModelCommonService { return modelSupplyMonitorOccupationPopulationService.importExcel(file); case MODEL_DEMAND_MONITOR_EMPLOYMENT: return modelDemandMonitorEmploymentService.importExcel(file); + case MODEL_DEMAND_MONITOR_INDUSTRY_INCREASE: + return modelDemandMonitorIndustryIncreaseService.importExcel(file); default: throw new ServiceException("模板类型错误"); } @@ -139,6 +143,9 @@ public class ModelCommonServiceImpl implements ModelCommonService { case MODEL_DEMAND_MONITOR_EMPLOYMENT: modelDemandMonitorEmploymentService.exportExcel(response, dto); break; + case MODEL_DEMAND_MONITOR_INDUSTRY_INCREASE: + modelDemandMonitorIndustryIncreaseService.exportExcel(response, dto); + break; default: throw new ServiceException("模板类型错误"); } diff --git a/ruoyi-bussiness/src/main/java/com/ruoyi/cms/service/impl/ModelDemandMonitorEmploymentServiceImpl.java b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/service/impl/ModelDemandMonitorEmploymentServiceImpl.java index 1e8a04a..1b165aa 100644 --- a/ruoyi-bussiness/src/main/java/com/ruoyi/cms/service/impl/ModelDemandMonitorEmploymentServiceImpl.java +++ b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/service/impl/ModelDemandMonitorEmploymentServiceImpl.java @@ -74,10 +74,10 @@ public class ModelDemandMonitorEmploymentServiceImpl implements ModelDemandMonit if (Objects.isNull(modelDemandMonitorEmployment.getThirdIndustryCount())) { throw new ServiceException("第三产业就业人数不能为空"); } - if (modelDemandMonitorEmployment.getTotalCount() != - (modelDemandMonitorEmployment.getFirstIndustryCount() + - modelDemandMonitorEmployment.getSecondIndustryCount() + - modelDemandMonitorEmployment.getThirdIndustryCount())) { + if (modelDemandMonitorEmployment.getTotalCount().compareTo( + (modelDemandMonitorEmployment.getFirstIndustryCount() + .add(modelDemandMonitorEmployment.getSecondIndustryCount()) + .add(modelDemandMonitorEmployment.getThirdIndustryCount()))) != 0) { throw new ServiceException("总就业人数和第一产业就业人数、第二产业就业人数、第三产业就业人数不相等"); } } diff --git a/ruoyi-bussiness/src/main/java/com/ruoyi/cms/service/impl/ModelDemandMonitorIndustryIncreaseServiceImpl.java b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/service/impl/ModelDemandMonitorIndustryIncreaseServiceImpl.java new file mode 100644 index 0000000..5b9f4dc --- /dev/null +++ b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/service/impl/ModelDemandMonitorIndustryIncreaseServiceImpl.java @@ -0,0 +1,209 @@ +package com.ruoyi.cms.service.impl; + +import com.ruoyi.cms.constant.enums.ModelTemplateTypeEnum; +import com.ruoyi.cms.domain.ModelDemandMonitorIndustryIncrease; +import com.ruoyi.cms.domain.dto.ModelExportParamDto; +import com.ruoyi.cms.mapper.ModelDemandMonitorIndustryIncreaseMapper; +import com.ruoyi.cms.service.ModelDemandMonitorIndustryIncreaseService; +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.utils.bean.BeanValidators; +import com.ruoyi.common.utils.poi.ExcelUtil; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +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.List; +import java.util.Objects; +import java.util.Optional; + +/** + * 劳动力需求产业增加值 + * + * @author 马宝龙 + * @date 2026/7/3 + */ +@Slf4j +@Service +@Validated +@RequiredArgsConstructor +public class ModelDemandMonitorIndustryIncreaseServiceImpl implements ModelDemandMonitorIndustryIncreaseService { + + private final ModelDemandMonitorIndustryIncreaseMapper modelDemandMonitorIndustryIncreaseMapper; + private final Validator validator; + + @Override + public void create(ModelDemandMonitorIndustryIncrease modelDemandMonitorIndustryIncrease) { + + check(modelDemandMonitorIndustryIncrease); + + // 查询唯一(按年份) + Optional optional = findUnique(modelDemandMonitorIndustryIncrease); + if (optional.isPresent()) { + // 更新 + ModelDemandMonitorIndustryIncrease exists = optional.get(); + modelDemandMonitorIndustryIncrease.setId(exists.getId()); + modelDemandMonitorIndustryIncreaseMapper.update(modelDemandMonitorIndustryIncrease); + } else { + // 新增 + modelDemandMonitorIndustryIncreaseMapper.insert(modelDemandMonitorIndustryIncrease); + } + } + + /** + * 检查 + * + * @param modelDemandMonitorIndustryIncrease 劳动力需求产业增加值 + */ + void check(ModelDemandMonitorIndustryIncrease modelDemandMonitorIndustryIncrease) { + if (Objects.isNull(modelDemandMonitorIndustryIncrease.getYear())) { + throw new ServiceException("年份不能为空"); + } + if (Objects.isNull(modelDemandMonitorIndustryIncrease.getTotalAmount())) { + throw new ServiceException("生产总值不能为空"); + } + if (Objects.isNull(modelDemandMonitorIndustryIncrease.getFirstIndustryAmount())) { + throw new ServiceException("第一产业增加值不能为空"); + } + if (Objects.isNull(modelDemandMonitorIndustryIncrease.getSecondIndustryAmount())) { + throw new ServiceException("第二产业增加值不能为空"); + } + if (Objects.isNull(modelDemandMonitorIndustryIncrease.getThirdIndustryAmount())) { + throw new ServiceException("第三产业增加值不能为空"); + } + if (modelDemandMonitorIndustryIncrease.getTotalAmount().compareTo( + (modelDemandMonitorIndustryIncrease.getFirstIndustryAmount() + .add(modelDemandMonitorIndustryIncrease.getSecondIndustryAmount()) + .add(modelDemandMonitorIndustryIncrease.getThirdIndustryAmount()))) != 0) { + throw new ServiceException("生产总值和第一产业增加值、第二产业增加值、第三产业增加值之和不相等"); + } + } + + @Override + public void update(ModelDemandMonitorIndustryIncrease modelDemandMonitorIndustryIncrease) { + + check(modelDemandMonitorIndustryIncrease); + + if (Objects.isNull(modelDemandMonitorIndustryIncrease.getId())) { + throw new ServiceException("id不能为空"); + } + Optional unique = findUnique(modelDemandMonitorIndustryIncrease); + if (!unique.isPresent()) { + modelDemandMonitorIndustryIncreaseMapper.update(modelDemandMonitorIndustryIncrease); + return; + } + ModelDemandMonitorIndustryIncrease exists = unique.get(); + if (!exists.getId().equals(modelDemandMonitorIndustryIncrease.getId())) { + throw new ServiceException("数据已存在"); + } + modelDemandMonitorIndustryIncreaseMapper.update(modelDemandMonitorIndustryIncrease); + } + + @Override + public void delete(Long id) { + if (Objects.isNull(id)) { + throw new ServiceException("id不能为空"); + } + modelDemandMonitorIndustryIncreaseMapper.deleteById(id); + } + + @Override + public void clear() { + modelDemandMonitorIndustryIncreaseMapper.clear(); + } + + @Override + public ModelDemandMonitorIndustryIncrease detail(Long id) { + if (Objects.isNull(id)) { + throw new ServiceException("id不能为空"); + } + return modelDemandMonitorIndustryIncreaseMapper.selectById(id); + } + + /** + * 查询唯一 + * + * @param modelDemandMonitorIndustryIncrease 劳动力需求产业增加值 + * @return 劳动力需求产业增加值 + */ + private Optional findUnique(ModelDemandMonitorIndustryIncrease modelDemandMonitorIndustryIncrease) { + ModelDemandMonitorIndustryIncrease unique = + modelDemandMonitorIndustryIncreaseMapper.findUnique(modelDemandMonitorIndustryIncrease); + return Optional.ofNullable(unique); + } + + @Override + public List list(ModelDemandMonitorIndustryIncrease modelDemandMonitorIndustryIncrease) { + return modelDemandMonitorIndustryIncreaseMapper.list(modelDemandMonitorIndustryIncrease); + } + + @Override + public String importExcel(MultipartFile file) { + try { + ExcelUtil util = new ExcelUtil<>(ModelDemandMonitorIndustryIncrease.class); + List list = util.importExcel(file.getInputStream()); + + ModelDemandMonitorIndustryIncrease exists; + int successNum = 0; + int failureNum = 0; + StringBuilder successMsg = new StringBuilder(); + StringBuilder failureMsg = new StringBuilder(); + for (ModelDemandMonitorIndustryIncrease item : list) { + try { + check(item); + exists = modelDemandMonitorIndustryIncreaseMapper.findUnique(item); + if (exists == null) { + BeanValidators.validateWithException(validator, item); + modelDemandMonitorIndustryIncreaseMapper.insert(item); + successNum++; + String msg = + "
" + successNum + "、" + "年份:" + item.getYear() + "数据导入成功。"; + successMsg.append(msg); + } else { + item.setId(exists.getId()); + BeanValidators.validateWithException(validator, item); + modelDemandMonitorIndustryIncreaseMapper.update(item); + successNum++; + String msg = + "
" + successNum + "、" + "年份:" + item.getYear() + "数据更新成功。"; + successMsg.append(msg); + } + } catch (Exception e) { + failureNum++; + String msg = "
" + failureNum + "、" + "年份:" + item.getYear() + "数据导入失败:"; + 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 { + + List list = list(ModelDemandMonitorIndustryIncrease.builder() + .year(dto.getYear()) + .build()); + ExcelUtil util = new ExcelUtil<>(ModelDemandMonitorIndustryIncrease.class); + util.exportExcel(response, list, ModelTemplateTypeEnum.MODEL_DEMAND_MONITOR_INDUSTRY_INCREASE.getDesc()); + + } catch (Exception e) { + log.error("数据导出失败", e); + throw new ServiceException("数据导出失败"); + } + } +} \ No newline at end of file diff --git a/ruoyi-bussiness/src/main/resources/mapper/ModelDemandMonitorIndustryIncreaseMapper.xml b/ruoyi-bussiness/src/main/resources/mapper/ModelDemandMonitorIndustryIncreaseMapper.xml new file mode 100644 index 0000000..d7888d3 --- /dev/null +++ b/ruoyi-bussiness/src/main/resources/mapper/ModelDemandMonitorIndustryIncreaseMapper.xml @@ -0,0 +1,75 @@ + + + + + + INSERT INTO model_demand_monitor_industry_increase (year, total_amount, first_industry_amount, second_industry_amount, third_industry_amount) + VALUES (#{year}, #{totalAmount}, #{firstIndustryAmount}, #{secondIndustryAmount}, #{thirdIndustryAmount}) + + + + UPDATE model_demand_monitor_industry_increase + SET year = #{year}, + total_amount = #{totalAmount}, + first_industry_amount = #{firstIndustryAmount}, + second_industry_amount = #{secondIndustryAmount}, + third_industry_amount = #{thirdIndustryAmount} + WHERE id = #{id} + + + + DELETE + FROM model_demand_monitor_industry_increase + WHERE id = #{id} + + + + DELETE FROM model_demand_monitor_industry_increase + 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 0000000..b3c04ee Binary files /dev/null and b/ruoyi-bussiness/src/main/resources/template/劳动力动态监测系统-劳动力需求产业增加值.xlsx differ diff --git a/sql/datadashboard/table.sql b/sql/datadashboard/table.sql index 7ee5602..abe03b3 100644 --- a/sql/datadashboard/table.sql +++ b/sql/datadashboard/table.sql @@ -1078,10 +1078,10 @@ CREATE TABLE shz_data_dashboard.model_demand_monitor_employment ( id serial PRIMARY KEY, year integer NOT NULL, - total_count integer NOT NULL, - first_industry_count integer NOT NULL, - second_industry_count integer NOT NULL, - third_industry_count integer NOT NULL + total_count numeric(10, 2) NOT NULL, + first_industry_count numeric(10, 2) NOT NULL, + second_industry_count numeric(10, 2) NOT NULL, + third_industry_count numeric(10, 2) NOT NULL ) ; @@ -1107,4 +1107,41 @@ COMMENT ON COLUMN shz_data_dashboard.model_demand_monitor_employment.third_industry_count IS '第三产业就业人数(万人)'; COMMENT -ON TABLE shz_data_dashboard.model_demand_monitor_employment IS '劳动力需求就业人数'; \ No newline at end of file +ON TABLE shz_data_dashboard.model_demand_monitor_employment IS '劳动力需求就业人数'; + + +--劳动力需求产业增加值 +CREATE TABLE shz_data_dashboard.model_demand_monitor_industry_increase +( + id serial PRIMARY KEY, + year integer NOT NULL, + total_amount numeric(10, 2) NOT NULL, + first_industry_amount numeric(10, 2) NOT NULL, + second_industry_amount numeric(10, 2) NOT NULL, + third_industry_amount numeric(10, 2) NOT NULL +) +; + +ALTER TABLE shz_data_dashboard.model_demand_monitor_industry_increase + OWNER TO sysdba; + +COMMENT +ON COLUMN shz_data_dashboard.model_demand_monitor_industry_increase.id IS '主键'; + +COMMENT +ON COLUMN shz_data_dashboard.model_demand_monitor_industry_increase.year IS '年份'; + +COMMENT +ON COLUMN shz_data_dashboard.model_demand_monitor_industry_increase.total_amount IS '生产总值(亿元)'; + +COMMENT +ON COLUMN shz_data_dashboard.model_demand_monitor_industry_increase.first_industry_amount IS '第一产业增加值(亿元)'; + +COMMENT +ON COLUMN shz_data_dashboard.model_demand_monitor_industry_increase.second_industry_amount IS '第二产业增加值(亿元)'; + +COMMENT +ON COLUMN shz_data_dashboard.model_demand_monitor_industry_increase.third_industry_amount IS '第三产业增加值(亿元)'; + +COMMENT +ON TABLE shz_data_dashboard.model_demand_monitor_industry_increase IS '劳动力需求产业增加值'; \ No newline at end of file