联调问题

This commit is contained in:
马三炮 2025-12-26 10:54:38 +08:00
parent 133926eafb
commit c0aeb2020c
9 changed files with 173 additions and 15 deletions

View File

@ -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<ExportMonthPlanPersonVo> list = monthlyPlanService.exportMonthlyPlanPerson(monthlyPlanVo);
public void export(HttpServletResponse response, MonthlyPlanVo monthlyPlanVo) {
List<ExportMonthPlanPersonVo> 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<WorkloadSummaryExcelVo> 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<ResourceSummaryVo> dataList = monthlyPlanService.exportResourceSummary(monthlyPlanVo);
// 2. 调用工具类导出

View File

@ -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("删除失败");
}

View File

@ -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;
}

View File

@ -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<DayPlanVo> getDayPlanByMonthPlanId(MonthlyPlanVo monthlyPlanVo);
}

View File

@ -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<MonthlyPlanVo> getMonthPlanByPlanId(PlanManagementVo planManagementVo);
}

View File

@ -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<MonthlyPlanVo> getPlanMajorList(MonthlyPlanVo monthlyPlanVo) {
try {
if (StringUtils.isNotEmpty(SecurityUtils.getDeptId().toString())){
Long deptId = SecurityUtils.getDeptId();
monthlyPlanVo.setPlanManagementId(deptId.intValue());
}
List<MonthlyPlanVo> 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<DayPlanVo> dayPlanVoList = monthlyPlanMapper.getDayPlanByMonthPlanId(monthlyPlanVo);
if (dayPlanVoList.size()>0){
return 2;
}
monthlyPlanMapper.delPersonnelArrangement(monthlyPlanVo);
monthlyPlanMapper.delWorkload(monthlyPlanVo);
return monthlyPlanMapper.delMonthlyPlanList(monthlyPlanVo);

View File

@ -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<PlanManagementVo> 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<MonthlyPlanVo> monthlyPlanVoList = planManagementMapper.getMonthPlanByPlanId(planManagementVo);
if (!monthlyPlanVoList.isEmpty()){
return 2;
}
return planManagementMapper.delPlanManagement(planManagementVo);
}

View File

@ -4,11 +4,11 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.bonus.digital.mapper.MonthlyPlanMapper">
<insert id="addMonthlyPlanList" useGeneratedKeys="true" keyProperty="monthlyPlanId">
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'
<if test="inspectionStationId != null and inspectionStationId != ''">
AND tmp.inspection_station_id = #{inspectionStationId}
</if>
<if test="monthlyPlan != null and monthlyPlan != ''">
AND tmp.monthly_plan = #{monthlyPlan}
</if>
<if test="planMajorId != null and planMajorId != ''">
AND tmp.plan_major_id = #{planMajorId}
</if>
<if test="businessTypeId != null and businessTypeId != ''">
AND tmp.business_type_id = #{businessTypeId}
</if>
<if test="riskLevel != null and riskLevel != ''">
AND tmp.risk_level = #{riskLevel}
</if>
<if test="keyWord!= null " >
AND (tmp.project_name like concat('%', #{keyWord}, '%')
or tmp.work_content like concat('%', #{keyWord}, '%'))
</if>
</select>
<select id="getPersonnelArrangementList" resultType="com.bonus.digital.dao.PersonnelArrangementVo">
select personnel_arrangement_id,monthly_plan_id,"day",personnel_names
select personnel_arrangement_id,monthly_plan_id,day,personnel_names
from tb_personnel_arrangement where monthly_plan_id = #{monthlyPlanId}
</select>
<select id="getPlanMajorListByMonth" resultType="com.bonus.digital.dao.MonthlyPlanVo">
@ -438,17 +464,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,
@ -456,7 +487,29 @@
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.monthly_plan_id = #{monthlyPlanId}
</select>
<select id="getDayPlanByMonthPlanId" resultType="com.bonus.digital.dao.DayPlanVo">
SELECT
tdp.day_plan_id AS dayPlanId,
tdp.monthly_plan_id AS monthlyPlanId,
tdp.day_plan AS dayPlan,
tdp.planned_workload AS plannedWorkload,
-- 原有拟投入作业人员姓名通过子查询拼接替代主表存储的ID串
(SELECT GROUP_CONCAT(tp.NAME SEPARATOR ',')
FROM tb_personnel tp
WHERE FIND_IN_SET(tp.id, tdp.proposed_personnel)
AND tp.is_active = '1') AS proposedPersonnel,
-- 原有:拟投入作业人员数量
IF(tdp.proposed_personnel IS NULL OR tdp.proposed_personnel = '', 0,
LENGTH(tdp.proposed_personnel) - LENGTH(REPLACE(tdp.proposed_personnel, ',', '')) + 1)
AS proposedPersonnelNumber,
tdp.proposed_proficient_personnel AS proposedProficientPersonnel,
tdp.proposed_proficient_day AS proposedProficientDay,
tdp.proposed_assistance_personnel AS proposedAssistancePersonnel
from tb_day_plan tdp where monthly_plan_id=#{monthlyPlanId} and is_active ='1'
</select>
</mapper>

View File

@ -78,4 +78,37 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
or tpm.work_content like concat('%', #{keyWord}, '%'))
</if>
</select>
<select id="getMonthPlanByPlanId" resultType="com.bonus.digital.dao.MonthlyPlanVo">
select tmp.monthly_plan_id,
tmp.monthly_plan,
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,
tmp.risk_level,
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.plan_management_id = #{planManagementId} and tmp.is_active = '1'
</select>
</mapper>