From c0aeb2020cb8839f0f469d4067d3e77800e7bc1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A9=AC=E4=B8=89=E7=82=AE?= <15856818120@163.com> Date: Fri, 26 Dec 2025 10:54:38 +0800 Subject: [PATCH] =?UTF-8?q?=E8=81=94=E8=B0=83=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/MonthlyPlanController.java | 28 ++++++--- .../controller/PlanManagementController.java | 4 +- .../com/bonus/digital/dao/MonthlyPlanVo.java | 25 ++++++++ .../digital/mapper/MonthlyPlanMapper.java | 12 ++-- .../digital/mapper/PlanManagementMapper.java | 8 +++ .../service/impl/MonthlyPlanServiceImpl.java | 9 +++ .../impl/PlanManagementServiceImpl.java | 10 ++++ .../main/resources/mapper/MonthPlanMapper.xml | 59 ++++++++++++++++++- .../resources/mapper/PlanManagementMapper.xml | 33 +++++++++++ 9 files changed, 173 insertions(+), 15 deletions(-) diff --git a/bonus-business/src/main/java/com/bonus/digital/controller/MonthlyPlanController.java b/bonus-business/src/main/java/com/bonus/digital/controller/MonthlyPlanController.java index 35be91c..1d0d265 100644 --- a/bonus-business/src/main/java/com/bonus/digital/controller/MonthlyPlanController.java +++ b/bonus-business/src/main/java/com/bonus/digital/controller/MonthlyPlanController.java @@ -1,5 +1,6 @@ package com.bonus.digital.controller; +import com.alibaba.fastjson2.JSONObject; import com.bonus.business.controller.tool.MonthPlanExcelExporter; import com.bonus.business.controller.tool.ResourceSummaryExcelExporter; import com.bonus.business.controller.tool.WorkloadAndCarSummaryExcelExporter; @@ -10,6 +11,7 @@ import com.bonus.common.core.page.TableDataInfo; import com.bonus.common.enums.BusinessType; import com.bonus.digital.dao.*; import com.bonus.digital.service.MonthlyPlanService; +import com.bonus.framework.config.FastJson2JsonRedisSerializer; import lombok.extern.slf4j.Slf4j; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.*; @@ -90,8 +92,10 @@ public class MonthlyPlanController extends BaseController { public AjaxResult delMonthlyPlan(@RequestBody MonthlyPlanVo monthlyPlanVo) { try { int res = monthlyPlanService.delMonthlyPlanList(monthlyPlanVo); - if (res > 0) { + if (res == 1) { return AjaxResult.success(); + } else if (res == 2) { + return AjaxResult.error("已有日计划绑定"); } else { return AjaxResult.error("删除失败"); } @@ -123,9 +127,9 @@ public class MonthlyPlanController extends BaseController { @Log(title = "导出人员安排表", businessType = BusinessType.EXPORT) @PreAuthorize("@ss.hasPermi('monthly:plan:export')") @PostMapping("/export") - public void export(HttpServletResponse response, @RequestBody MonthlyPlanVo monthlyPlanVo) throws Exception { - List list = monthlyPlanService.exportMonthlyPlanPerson(monthlyPlanVo); + public void export(HttpServletResponse response, MonthlyPlanVo monthlyPlanVo) { + List list = monthlyPlanService.exportMonthlyPlanPerson(monthlyPlanVo); // 动态解析年月,添加兜底逻辑 int year = LocalDate.now().getYear(); int month = LocalDate.now().getMonthValue(); @@ -141,14 +145,19 @@ public class MonthlyPlanController extends BaseController { String sheetName = month + "月运检人员安排"; // 传入动态年月 - MonthPlanExcelExporter.exportToExcel(response, list, year, month, sheetName); + try { + MonthPlanExcelExporter.exportToExcel(response, list, year, month, sheetName); + } catch (Exception e) { + log.error(e.getMessage()); + throw new RuntimeException(e); + } } @Log(title = "导出工作量汇总表", businessType = BusinessType.EXPORT) @PreAuthorize("@ss.hasPermi('monthly:plan:export')") @PostMapping("/exportWorkloadSummary") public void exportWorkloadSummary(HttpServletResponse response, - @RequestBody MonthlyPlanVo monthlyPlanVo) throws Exception { + MonthlyPlanVo monthlyPlanVo) { // 1. 获取工作量导出数据 List workloadList = monthlyPlanService.exportWorkloadSummary(monthlyPlanVo); @@ -166,14 +175,19 @@ public class MonthlyPlanController extends BaseController { month = monthParam.replace("-", ""); } - WorkloadAndCarSummaryExcelExporter.exportMergeSummary(response, workloadList, carList, month); + try { + WorkloadAndCarSummaryExcelExporter.exportMergeSummary(response, workloadList, carList, month); + } catch (Exception e) { + log.error(e.getMessage()); + throw new RuntimeException(e); + } } @Log(title = "导出月计划资源汇总表", businessType = BusinessType.EXPORT) @PreAuthorize("@ss.hasPermi('monthly:plan:export')") @PostMapping("/exportResourceSummary") public void exportResourceSummary(HttpServletResponse response, - @RequestBody MonthlyPlanVo monthlyPlanVo) throws IOException { + MonthlyPlanVo monthlyPlanVo) throws IOException { // 1. 查询汇总数据 List dataList = monthlyPlanService.exportResourceSummary(monthlyPlanVo); // 2. 调用工具类导出 diff --git a/bonus-business/src/main/java/com/bonus/digital/controller/PlanManagementController.java b/bonus-business/src/main/java/com/bonus/digital/controller/PlanManagementController.java index d129bfb..e9b88c7 100644 --- a/bonus-business/src/main/java/com/bonus/digital/controller/PlanManagementController.java +++ b/bonus-business/src/main/java/com/bonus/digital/controller/PlanManagementController.java @@ -93,8 +93,10 @@ public class PlanManagementController extends BaseController { public AjaxResult delPlanManagement(@RequestBody PlanManagementVo planManagementVo) { try { int res = planManagementService.delPlanManagement(planManagementVo); - if (res > 0) { + if (res ==1) { return AjaxResult.success(); + } else if (res ==2) { + return AjaxResult.error("计划已绑定月计划"); } else { return AjaxResult.error("删除失败"); } diff --git a/bonus-business/src/main/java/com/bonus/digital/dao/MonthlyPlanVo.java b/bonus-business/src/main/java/com/bonus/digital/dao/MonthlyPlanVo.java index a5df258..a20db42 100644 --- a/bonus-business/src/main/java/com/bonus/digital/dao/MonthlyPlanVo.java +++ b/bonus-business/src/main/java/com/bonus/digital/dao/MonthlyPlanVo.java @@ -22,6 +22,11 @@ public class MonthlyPlanVo { */ private String monthlyPlan; + /** + * 计划月份 + */ + private Integer planManagementId; + /** * 运检站id */ @@ -37,11 +42,21 @@ public class MonthlyPlanVo { */ private Integer planMajorId; + /** + * 计划专业名称 + */ + private String planMajorName; + /** * 业务类型id */ private Integer businessTypeId; + /** + * 业务类型id + */ + private String businessTypeName; + /** * 项目名称 */ @@ -57,6 +72,11 @@ public class MonthlyPlanVo { */ private Integer planCategoryId; + /** + * 计划类别名称 + */ + private String planCategoryName; + /** * 塔基数 */ @@ -178,4 +198,9 @@ public class MonthlyPlanVo { */ private String riskLevel; + /** + * 关键字 + */ + private String keyWord; + } diff --git a/bonus-business/src/main/java/com/bonus/digital/mapper/MonthlyPlanMapper.java b/bonus-business/src/main/java/com/bonus/digital/mapper/MonthlyPlanMapper.java index 6f6a860..95a2686 100644 --- a/bonus-business/src/main/java/com/bonus/digital/mapper/MonthlyPlanMapper.java +++ b/bonus-business/src/main/java/com/bonus/digital/mapper/MonthlyPlanMapper.java @@ -1,9 +1,6 @@ package com.bonus.digital.mapper; -import com.bonus.digital.dao.MonthlyPlanVo; -import com.bonus.digital.dao.PersonnelArrangementVo; -import com.bonus.digital.dao.ResourceSummaryVo; -import com.bonus.digital.dao.WorkloadVo; +import com.bonus.digital.dao.*; import java.util.List; @@ -74,4 +71,11 @@ public interface MonthlyPlanMapper { * 获取月计划详情 */ MonthlyPlanVo getMonthlyPlanById(MonthlyPlanVo monthlyPlanVo); + + /** + * 根据月计划id获取绑定的日计划 + * @param monthlyPlanVo + * @return + */ + List getDayPlanByMonthPlanId(MonthlyPlanVo monthlyPlanVo); } diff --git a/bonus-business/src/main/java/com/bonus/digital/mapper/PlanManagementMapper.java b/bonus-business/src/main/java/com/bonus/digital/mapper/PlanManagementMapper.java index f986cbd..18fd06e 100644 --- a/bonus-business/src/main/java/com/bonus/digital/mapper/PlanManagementMapper.java +++ b/bonus-business/src/main/java/com/bonus/digital/mapper/PlanManagementMapper.java @@ -1,5 +1,6 @@ package com.bonus.digital.mapper; +import com.bonus.digital.dao.MonthlyPlanVo; import com.bonus.digital.dao.PlanManagementVo; import java.util.List; @@ -24,4 +25,11 @@ public interface PlanManagementMapper { * 修改计划管理 */ int updatePlanManagement(PlanManagementVo planManagementVo); + + /** + * 根据计划id获取绑定的月计划 + * @param planManagementVo + * @return + */ + List getMonthPlanByPlanId(PlanManagementVo planManagementVo); } diff --git a/bonus-business/src/main/java/com/bonus/digital/service/impl/MonthlyPlanServiceImpl.java b/bonus-business/src/main/java/com/bonus/digital/service/impl/MonthlyPlanServiceImpl.java index 03478ab..4375b27 100644 --- a/bonus-business/src/main/java/com/bonus/digital/service/impl/MonthlyPlanServiceImpl.java +++ b/bonus-business/src/main/java/com/bonus/digital/service/impl/MonthlyPlanServiceImpl.java @@ -1,5 +1,6 @@ package com.bonus.digital.service.impl; +import com.bonus.common.core.domain.model.LoginUser; import com.bonus.common.utils.SecurityUtils; import com.bonus.common.utils.StringUtils; import com.bonus.digital.dao.*; @@ -41,6 +42,10 @@ public class MonthlyPlanServiceImpl implements MonthlyPlanService { @Override public List getPlanMajorList(MonthlyPlanVo monthlyPlanVo) { try { + if (StringUtils.isNotEmpty(SecurityUtils.getDeptId().toString())){ + Long deptId = SecurityUtils.getDeptId(); + monthlyPlanVo.setPlanManagementId(deptId.intValue()); + } List monthlyPlanVoList = monthlyPlanMapper.getPlanMajorList(monthlyPlanVo); for (MonthlyPlanVo monthlyPlanVo2 : monthlyPlanVoList) { if (StringUtils.isNotEmpty(monthlyPlanVo2.getPlanPersonnel())){ @@ -87,6 +92,10 @@ public class MonthlyPlanServiceImpl implements MonthlyPlanService { @Override @Transactional public int delMonthlyPlanList(MonthlyPlanVo monthlyPlanVo) { + List dayPlanVoList = monthlyPlanMapper.getDayPlanByMonthPlanId(monthlyPlanVo); + if (dayPlanVoList.size()>0){ + return 2; + } monthlyPlanMapper.delPersonnelArrangement(monthlyPlanVo); monthlyPlanMapper.delWorkload(monthlyPlanVo); return monthlyPlanMapper.delMonthlyPlanList(monthlyPlanVo); diff --git a/bonus-business/src/main/java/com/bonus/digital/service/impl/PlanManagementServiceImpl.java b/bonus-business/src/main/java/com/bonus/digital/service/impl/PlanManagementServiceImpl.java index d0ec2ab..873adf9 100644 --- a/bonus-business/src/main/java/com/bonus/digital/service/impl/PlanManagementServiceImpl.java +++ b/bonus-business/src/main/java/com/bonus/digital/service/impl/PlanManagementServiceImpl.java @@ -1,7 +1,9 @@ package com.bonus.digital.service.impl; +import com.bonus.common.core.domain.model.LoginUser; import com.bonus.common.utils.SecurityUtils; import com.bonus.digital.dao.InspectionStationVo; +import com.bonus.digital.dao.MonthlyPlanVo; import com.bonus.digital.dao.PlanManagementVo; import com.bonus.digital.mapper.InspectionStationMapper; import com.bonus.digital.mapper.PlanManagementMapper; @@ -34,6 +36,10 @@ public class PlanManagementServiceImpl implements PlanManagementService { */ @Override public List getPlanManagementList(PlanManagementVo planManagementVo) { + + Long userId = SecurityUtils.getUserId(); + planManagementVo.setCreateUser(userId.toString()); + planManagementVo.setCreateTime(new Date()); return planManagementMapper.getPlanManagementList(planManagementVo); } @@ -53,6 +59,10 @@ public class PlanManagementServiceImpl implements PlanManagementService { */ @Override public int delPlanManagement(PlanManagementVo planManagementVo) { + List monthlyPlanVoList = planManagementMapper.getMonthPlanByPlanId(planManagementVo); + if (!monthlyPlanVoList.isEmpty()){ + return 2; + } return planManagementMapper.delPlanManagement(planManagementVo); } diff --git a/bonus-business/src/main/resources/mapper/MonthPlanMapper.xml b/bonus-business/src/main/resources/mapper/MonthPlanMapper.xml index 714032d..731beb4 100644 --- a/bonus-business/src/main/resources/mapper/MonthPlanMapper.xml +++ b/bonus-business/src/main/resources/mapper/MonthPlanMapper.xml @@ -4,11 +4,11 @@ "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - insert into tb_monthly_plan (monthly_plan,inspection_station_id,inspection_station_name,plan_major_id,business_type_id, + insert into tb_monthly_plan (monthly_plan,plan_management_id,inspection_station_id,inspection_station_name,plan_major_id,business_type_id, project_name,work_content,plan_category_id,tower_base_number,planned_start_time, planned_end_time,plan_personnel,plan_car_num,plan_skilled_worker_num,plan_auxiliary_worker_num, plan_sub_car_num,create_user,create_time,actual_working_day,risk_level) - values (#{monthlyPlan},#{inspectionStationId},#{inspectionStationName},#{planMajorId},#{businessTypeId}, + values (#{monthlyPlan},#{planManagementId},#{inspectionStationId},#{inspectionStationName},#{planMajorId},#{businessTypeId}, #{projectName},#{workContent},#{planCategoryId},#{towerBaseNumber},#{plannedStartTime},#{plannedEndTime}, #{planPersonnel},#{planCarNum},#{planSkilledWorkerNum},#{planAuxiliaryWorkerNum},#{planSubCarNum}, #{createUser},#{createTime},#{actualWorkingDay},#{riskLevel}) @@ -109,17 +109,22 @@ tmp.inspection_station_id, tmp.inspection_station_name, tmp.plan_major_id, + tpm.plan_major_name as planMajorName, tmp.business_type_id, + tpm2.plan_major_name as businessTypeName, tmp.project_name, tmp.work_content, tmp.plan_category_id, + tpm3.plan_major_name as planCategoryName, tmp.tower_base_number, tmp.planned_start_time, tmp.planned_end_time, tmp.plan_personnel, tmp.plan_car_num, tmp.plan_skilled_worker_num, + tmp.plan_skilled_worker_day, tmp.plan_auxiliary_worker_num, + tmp.plan_auxiliary_worker_day, tmp.plan_sub_car_num, tmp.create_user, tmp.create_time, @@ -127,10 +132,31 @@ tmp.actual_working_day from tb_monthly_plan tmp left join tb_plan_major tpm on tmp.plan_major_id = tpm.plan_major_id + left join tb_plan_major tpm2 on tmp.business_type_id = tpm2.plan_major_id + left join tb_plan_major tpm3 on tmp.plan_category_id = tpm3.plan_major_id where tmp.is_active = '1' + + AND tmp.inspection_station_id = #{inspectionStationId} + + + AND tmp.monthly_plan = #{monthlyPlan} + + + AND tmp.plan_major_id = #{planMajorId} + + + AND tmp.business_type_id = #{businessTypeId} + + + AND tmp.risk_level = #{riskLevel} + + + AND (tmp.project_name like concat('%', #{keyWord}, '%') + or tmp.work_content like concat('%', #{keyWord}, '%')) + + diff --git a/bonus-business/src/main/resources/mapper/PlanManagementMapper.xml b/bonus-business/src/main/resources/mapper/PlanManagementMapper.xml index 9653803..96bb4c5 100644 --- a/bonus-business/src/main/resources/mapper/PlanManagementMapper.xml +++ b/bonus-business/src/main/resources/mapper/PlanManagementMapper.xml @@ -78,4 +78,37 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" or tpm.work_content like concat('%', #{keyWord}, '%')) +