bug修复

This commit is contained in:
马三炮 2025-12-30 13:03:33 +08:00
parent 0782501f3f
commit 3abb4bc6b4
15 changed files with 182 additions and 36 deletions

View File

@ -31,7 +31,11 @@ public class DayPlanController extends BaseController {
@Resource @Resource
private DayPlanService dayPlanService; private DayPlanService dayPlanService;
//日计划列表 /**
* 获取日计划列表
* @param dayPlanVo
* @return
*/
@PreAuthorize("@ss.hasPermi('day:plan:list')") @PreAuthorize("@ss.hasPermi('day:plan:list')")
@GetMapping("/getDayPlanList") @GetMapping("/getDayPlanList")
public TableDataInfo getMonthlyPlanList(DayPlanVo dayPlanVo) { public TableDataInfo getMonthlyPlanList(DayPlanVo dayPlanVo) {
@ -45,6 +49,23 @@ public class DayPlanController extends BaseController {
} }
} }
/**
* 获取日计划详情
* @param dayPlanVo
* @return
*/
@PreAuthorize("@ss.hasPermi('day:plan:list')")
@GetMapping("/getDayPlanById")
public AjaxResult getDayPlanById(DayPlanVo dayPlanVo) {
try {
DayPlanVo res = dayPlanService.getDayPlanById(dayPlanVo);
return AjaxResult.success(res);
} catch (Exception e) {
log.error(e.getMessage());
return AjaxResult.error("获取数据失败");
}
}
//新增日计划 //新增日计划
@PreAuthorize("@ss.hasPermi('day:plan:add')") @PreAuthorize("@ss.hasPermi('day:plan:add')")
@PostMapping("/addDayPlan") @PostMapping("/addDayPlan")
@ -106,13 +127,13 @@ public class DayPlanController extends BaseController {
@PreAuthorize("@ss.hasPermi('day:plan:export')") @PreAuthorize("@ss.hasPermi('day:plan:export')")
@PostMapping("/exportWorkloadSummary") @PostMapping("/exportWorkloadSummary")
public void exportWorkloadSummary(HttpServletResponse response, public void exportWorkloadSummary(HttpServletResponse response,
@RequestBody DayPlanVo dayPlanVo) throws Exception { DayPlanVo dayPlanVo) throws Exception {
// 1. 获取工作量导出数据 // 1. 获取工作量导出数据
List<WorkloadSummaryExcelVo> workloadList = dayPlanService.exportWorkloadSummary(dayPlanVo); List<WorkloadSummaryExcelVo> workloadList = dayPlanService.exportWorkloadSummary(dayPlanVo);
// 2. 提取前端传入的 startTime endTime格式yyyy-MM-dd // 2. 提取前端传入的 startTime endTime格式yyyy-MM-dd
String startTime = dayPlanVo.getStartTime(); String startTime = dayPlanVo.getStartDate();
String endTime = dayPlanVo.getEndTime(); String endTime = dayPlanVo.getEndDate();
// 3. 日期格式化器解析yyyy-MM-dd 输出x月x日 // 3. 日期格式化器解析yyyy-MM-dd 输出x月x日
DateTimeFormatter parseFormatter = DateTimeFormatter.ISO_LOCAL_DATE; // 解析yyyy-MM-dd DateTimeFormatter parseFormatter = DateTimeFormatter.ISO_LOCAL_DATE; // 解析yyyy-MM-dd

View File

@ -32,7 +32,7 @@ public class DownloadController {
private IDownloadService downloadService; private IDownloadService downloadService;
@GetMapping(value = "dayPlanStatistics") @PostMapping(value = "dayPlanStatistics")
@ApiOperation(notes = "日计划统计下载", value = "日计划统计下载") @ApiOperation(notes = "日计划统计下载", value = "日计划统计下载")
public void downloadExcelDayPlanStatistics(HttpServletRequest request, HttpServletResponse response, ParamsDto dto) { public void downloadExcelDayPlanStatistics(HttpServletRequest request, HttpServletResponse response, ParamsDto dto) {
String startDate = dto.getStartDate(); String startDate = dto.getStartDate();

View File

@ -81,6 +81,7 @@ public class InspectionStationController extends BaseController {
return AjaxResult.error("删除失败"); return AjaxResult.error("删除失败");
} }
}catch (Exception e) { }catch (Exception e) {
log.error(e.getMessage());
return AjaxResult.error("系统异常,请联系管理员"); return AjaxResult.error("系统异常,请联系管理员");
} }
} }

View File

@ -50,7 +50,6 @@ public class PersonnelController extends BaseController {
@GetMapping("/getPersonnelListSelect") @GetMapping("/getPersonnelListSelect")
public AjaxResult getPersonnelListSelect(PersonnelVo personnelVo) { public AjaxResult getPersonnelListSelect(PersonnelVo personnelVo) {
try { try {
List<PersonnelVo> list = personnelService.getPersonnelList(personnelVo); List<PersonnelVo> list = personnelService.getPersonnelList(personnelVo);
return AjaxResult.success(list); return AjaxResult.success(list);
} catch (Exception e) { } catch (Exception e) {
@ -149,6 +148,7 @@ public class PersonnelController extends BaseController {
return AjaxResult.error("修改失败"); return AjaxResult.error("修改失败");
} }
} catch (Exception e) { } catch (Exception e) {
log.error(e.getMessage());
return AjaxResult.error("系统异常,请联系管理员"); return AjaxResult.error("系统异常,请联系管理员");
} }
} }

View File

@ -148,18 +148,18 @@ public class PlanManagementController extends BaseController {
InputStream inputStream = null; InputStream inputStream = null;
ServletOutputStream servletOutputStream = null; ServletOutputStream servletOutputStream = null;
try { try {
String path = "download/" + "计划管理.xlsx"; String path = "download/" + "计划导入模板.xlsx";
inputStream = this.getClass().getClassLoader().getResourceAsStream(path); inputStream = this.getClass().getClassLoader().getResourceAsStream(path);
response.setContentType("application/vnd.ms-excel"); response.setContentType("application/vnd.ms-excel");
response.addHeader("Cache-Control", "no-cache, no-store, must-revalidate"); response.addHeader("Cache-Control", "no-cache, no-store, must-revalidate");
response.addHeader("charset", "utf-8"); response.addHeader("charset", "utf-8");
response.addHeader("Pragma", "no-cache"); response.addHeader("Pragma", "no-cache");
String encodeName = URLEncoder.encode("计划管理导入摸板.xlsx", StandardCharsets.UTF_8.toString()); String encodeName = URLEncoder.encode("计划导入模板.xlsx", StandardCharsets.UTF_8.toString());
response.setHeader("Content-Disposition", "attachment; filename=\"" + encodeName + "\"; filename*=utf-8''" + encodeName); response.setHeader("Content-Disposition", "attachment; filename=\"" + encodeName + "\"; filename*=utf-8''" + encodeName);
servletOutputStream = response.getOutputStream(); servletOutputStream = response.getOutputStream();
IOUtils.copy(inputStream, servletOutputStream); IOUtils.copy(inputStream, servletOutputStream);
response.flushBuffer(); response.flushBuffer();
//log.info("文件下载成功!!"); log.info("文件下载成功!!");
} catch (Exception e) { } catch (Exception e) {
log.error(e.getMessage()); log.error(e.getMessage());
e.printStackTrace(); e.printStackTrace();

View File

@ -22,6 +22,11 @@ public class DayPlanVo {
*/ */
private Integer monthlyPlanId; private Integer monthlyPlanId;
/**
* 运检站id
*/
private Integer inspectionStationId;
/** /**
* 运检站名称 * 运检站名称
*/ */
@ -190,14 +195,14 @@ public class DayPlanVo {
private String dayPlanType; private String dayPlanType;
/** /**
* 开始时间 * 开始日期
*/ */
private String startTime; private String startDate;
/** /**
* 结束时间 * 结束日期
*/ */
private String endTime; private String endDate;
// 拟投入高处作业人员data_source=2 // 拟投入高处作业人员data_source=2
private String proposedHighPersonnelNames; // 姓名拼接 private String proposedHighPersonnelNames; // 姓名拼接
@ -222,4 +227,9 @@ public class DayPlanVo {
private String riskLevel; private String riskLevel;
private List<ProposedPersonnelVo> proposedPersonnelList; private List<ProposedPersonnelVo> proposedPersonnelList;
/**
* 工作量列表
*/
private List<WorkloadVo> workloadList;
} }

View File

@ -18,6 +18,11 @@ public interface DayPlanMapper {
Integer updateDayPlan(DayPlanVo dayPlanVo); Integer updateDayPlan(DayPlanVo dayPlanVo);
/**
* 获取日计划列表
* @param dayPlanVo
* @return
*/
List<DayPlanVo> getDayPlanList(DayPlanVo dayPlanVo); List<DayPlanVo> getDayPlanList(DayPlanVo dayPlanVo);
List<MonthlyPlanVo> getWorkloadSummary(DayPlanVo dayPlanVo); List<MonthlyPlanVo> getWorkloadSummary(DayPlanVo dayPlanVo);
@ -27,4 +32,11 @@ public interface DayPlanMapper {
void delProposedPersonnel(DayPlanVo dayPlanVo); void delProposedPersonnel(DayPlanVo dayPlanVo);
List<ProposedPersonnelVo> getProposedPersonnelList(DayPlanVo dayPlanVo1); List<ProposedPersonnelVo> getProposedPersonnelList(DayPlanVo dayPlanVo1);
/**
* 获取日计划详情
* @param dayPlanVo
* @return
*/
DayPlanVo getDayPlanById(DayPlanVo dayPlanVo);
} }

View File

@ -19,9 +19,19 @@ public interface DayPlanService {
int updateDayPlan(DayPlanVo dayPlanVo); int updateDayPlan(DayPlanVo dayPlanVo);
/**
* 获取日计划列表
* @param dayPlanVo
* @return
*/
List<DayPlanVo> getDayPlanList(DayPlanVo dayPlanVo); List<DayPlanVo> getDayPlanList(DayPlanVo dayPlanVo);
List<WorkloadSummaryExcelVo> exportWorkloadSummary(DayPlanVo dayPlanVo); List<WorkloadSummaryExcelVo> exportWorkloadSummary(DayPlanVo dayPlanVo);
/**
* 获取日计划详情
* @param dayPlanVo
* @return
*/
DayPlanVo getDayPlanById(DayPlanVo dayPlanVo);
} }

View File

@ -1,11 +1,10 @@
package com.bonus.digital.service.impl; package com.bonus.digital.service.impl;
import com.bonus.common.utils.SecurityUtils; import com.bonus.common.utils.SecurityUtils;
import com.bonus.digital.dao.DayPlanVo; import com.bonus.digital.dao.*;
import com.bonus.digital.dao.MonthlyPlanVo;
import com.bonus.digital.dao.ProposedPersonnelVo;
import com.bonus.digital.dao.WorkloadSummaryExcelVo;
import com.bonus.digital.mapper.DayPlanMapper; import com.bonus.digital.mapper.DayPlanMapper;
import com.bonus.digital.mapper.MonthlyPlanMapper;
import com.bonus.digital.mapper.WorkloadCategoryMapper;
import com.bonus.digital.service.DayPlanService; import com.bonus.digital.service.DayPlanService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -24,6 +23,12 @@ public class DayPlanServiceImpl implements DayPlanService {
@Resource @Resource
private DayPlanMapper dayPlanMapper; private DayPlanMapper dayPlanMapper;
@Resource
private MonthlyPlanMapper monthlyPlanMapper;
@Resource
private WorkloadCategoryMapper workloadCategoryMapper;
@Override @Override
@Transactional @Transactional
public int addMonthlyPlan(List<DayPlanVo> dayPlanVo) { public int addMonthlyPlan(List<DayPlanVo> dayPlanVo) {
@ -48,16 +53,40 @@ public class DayPlanServiceImpl implements DayPlanService {
dayPlanMapper.delProposedPersonnel(dayPlanVo); dayPlanMapper.delProposedPersonnel(dayPlanVo);
dayPlanMapper.addProposedPersonnelList(proposedPersonnelList); dayPlanMapper.addProposedPersonnelList(proposedPersonnelList);
} }
//保存工作量信息
List<WorkloadVo> workloadVoList = dayPlanVo.getWorkloadList();
if (workloadVoList != null && !workloadVoList.isEmpty()) {
for (WorkloadVo w : workloadVoList) {
w.setPlanId(dayPlanVo.getDayPlanId());
w.setDataSource("1");
monthlyPlanMapper.addWorkload(w);
}
}
return dayPlanMapper.updateDayPlan(dayPlanVo); return dayPlanMapper.updateDayPlan(dayPlanVo);
} }
/**
* 获取日计划列表
* @param dayPlanVo
* @return
*/
@Override @Override
public List<DayPlanVo> getDayPlanList(DayPlanVo dayPlanVo) { public List<DayPlanVo> getDayPlanList(DayPlanVo dayPlanVo) {
if (SecurityUtils.getLoginUser().getDeptId()!=null){
Long deptId = SecurityUtils.getDeptId();
dayPlanVo.setInspectionStationId(deptId.intValue());
}
List<DayPlanVo> res = dayPlanMapper.getDayPlanList(dayPlanVo); List<DayPlanVo> res = dayPlanMapper.getDayPlanList(dayPlanVo);
if (res != null && !res.isEmpty()) { if (res != null && !res.isEmpty()) {
for (DayPlanVo dayPlanVo1 : res) { for (DayPlanVo dayPlanVo1 : res) {
List<ProposedPersonnelVo> proposedPersonnelList =dayPlanMapper.getProposedPersonnelList(dayPlanVo1); List<ProposedPersonnelVo> proposedPersonnelList =dayPlanMapper.getProposedPersonnelList(dayPlanVo1);
dayPlanVo1.setProposedPersonnelList(proposedPersonnelList); dayPlanVo1.setProposedPersonnelList(proposedPersonnelList);
WorkloadVo workloadVo = new WorkloadVo();
workloadVo.setPlanId(dayPlanVo1.getDayPlanId());
workloadVo.setDataSource("1");
List<WorkloadVo> workloadVoList = workloadCategoryMapper.getWorkloadList(workloadVo);
dayPlanVo1.setWorkloadList(workloadVoList);
} }
} }
return res; return res;
@ -91,4 +120,24 @@ public class DayPlanServiceImpl implements DayPlanService {
return exportList; return exportList;
} }
/**
* 获取日计划详情
* @param dayPlanVo
* @return
*/
@Override
public DayPlanVo getDayPlanById(DayPlanVo dayPlanVo) {
DayPlanVo res = dayPlanMapper.getDayPlanById(dayPlanVo);
if (res != null ) {
List<ProposedPersonnelVo> proposedPersonnelList =dayPlanMapper.getProposedPersonnelList(res);
res.setProposedPersonnelList(proposedPersonnelList);
WorkloadVo workloadVo = new WorkloadVo();
workloadVo.setPlanId(res.getDayPlanId());
workloadVo.setDataSource("1");
List<WorkloadVo> workloadVoList = workloadCategoryMapper.getWorkloadList(workloadVo);
res.setWorkloadList(workloadVoList);
}
return res;
}
} }

View File

@ -1,5 +1,6 @@
package com.bonus.digital.service.impl; package com.bonus.digital.service.impl;
import com.bonus.common.core.domain.entity.SysUser;
import com.bonus.common.core.domain.model.LoginUser; import com.bonus.common.core.domain.model.LoginUser;
import com.bonus.common.utils.SecurityUtils; import com.bonus.common.utils.SecurityUtils;
import com.bonus.common.utils.StringUtils; import com.bonus.common.utils.StringUtils;
@ -42,9 +43,9 @@ public class MonthlyPlanServiceImpl implements MonthlyPlanService {
@Override @Override
public List<MonthlyPlanVo> getPlanMajorList(MonthlyPlanVo monthlyPlanVo) { public List<MonthlyPlanVo> getPlanMajorList(MonthlyPlanVo monthlyPlanVo) {
try { try {
if (StringUtils.isNotEmpty(SecurityUtils.getDeptId().toString())){ if (SecurityUtils.getLoginUser().getDeptId()!=null){
Long deptId = SecurityUtils.getDeptId(); Long deptId = SecurityUtils.getDeptId();
monthlyPlanVo.setPlanManagementId(deptId.intValue()); monthlyPlanVo.setInspectionStationId(deptId.intValue());
} }
List<MonthlyPlanVo> monthlyPlanVoList = monthlyPlanMapper.getPlanMajorList(monthlyPlanVo); List<MonthlyPlanVo> monthlyPlanVoList = monthlyPlanMapper.getPlanMajorList(monthlyPlanVo);
for (MonthlyPlanVo monthlyPlanVo2 : monthlyPlanVoList) { for (MonthlyPlanVo monthlyPlanVo2 : monthlyPlanVoList) {

View File

@ -126,7 +126,7 @@
</delete> </delete>
<select id="getDayPlanList" resultType="com.bonus.digital.dao.DayPlanVo"> <select id="getDayPlanList" resultType="com.bonus.digital.dao.DayPlanVo">
SELECT SELECT
tdp.day_plan_id AS dayPlanId, tdp.day_plan_id AS dayPlanId,
tdp.monthly_plan_id AS monthlyPlanId, tdp.monthly_plan_id AS monthlyPlanId,
@ -167,12 +167,21 @@
left join tb_plan_major tpm on tmp.plan_major_id = tpm.plan_major_id left join tb_plan_major tpm on tmp.plan_major_id = tpm.plan_major_id
where tdp.is_active = '1' where tdp.is_active = '1'
<!-- 原有查询条件保留,按需调整 --> <!-- 原有查询条件保留,按需调整 -->
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''"> <if test="startDate != null and startDate != '' and endDate != null and endDate != ''">
AND DATE_FORMAT(tdp.day_plan, '%Y-%m-%d') BETWEEN #{startTime} AND #{endTime} AND DATE_FORMAT(tdp.day_plan, '%Y-%m-%d') BETWEEN #{startDate} AND #{endDate}
</if> </if>
<if test="dayPlanType != null and dayPlanType != ''"> <if test="dayPlanType != null and dayPlanType != ''">
AND tdp.day_plan_type = #{dayPlanType} AND tdp.day_plan_type = #{dayPlanType}
</if> </if>
<if test="projectName!= null " >
AND tmp.project_name like concat('%', #{projectName}, '%')
</if>
<if test="planCompletionStatus!= null " >
AND tdp.plan_completion_status = #{planCompletionStatus}
</if>
<if test="inspectionStationId!= null " >
AND tmp.inspectionStationId = #{inspectionStationId}
</if>
</select> </select>
<select id="getWorkloadSummary" resultType="com.bonus.digital.dao.MonthlyPlanVo"> <select id="getWorkloadSummary" resultType="com.bonus.digital.dao.MonthlyPlanVo">
@ -192,8 +201,8 @@
left join tb_plan_management pm left join tb_plan_management pm
on pm.plan_management_id = tmp.plan_management_id on pm.plan_management_id = tmp.plan_management_id
where tmp.is_active = '1' where tmp.is_active = '1'
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''"> <if test="startDate != null and startDate != '' and endDate != null and endDate != ''">
AND DATE_FORMAT(tdp.day_plan, '%Y-%m-%d') BETWEEN #{startTime} AND #{endTime} AND DATE_FORMAT(tdp.day_plan, '%Y-%m-%d') BETWEEN #{startDate} AND #{endDate}
</if> </if>
GROUP BY GROUP BY
tmp.inspection_station_id, tmp.inspection_station_id,
@ -206,5 +215,46 @@
select day_plan_id,inspection_station_name,personnel_id,name,data_source select day_plan_id,inspection_station_name,personnel_id,name,data_source
from tb_proposed_personnel where day_plan_id = #{dayPlanId} from tb_proposed_personnel where day_plan_id = #{dayPlanId}
</select> </select>
<select id="getDayPlanById" 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,
tdp.proposed_proficient_personnel AS proposedProficientPersonnel,
tdp.proposed_proficient_day AS proposedProficientDay,
tdp.proposed_assistance_personnel AS proposedAssistancePersonnel,
tdp.proposed_assistance_day AS proposedAssistanceDay,
tdp.proposed_long_time_car AS proposedLongTimeCar,
tdp.proposed_temporary_car AS proposedTemporaryCar,
tdp.proposed_sub_car AS proposedSubCar,
tdp.actual_proficient_personnel AS actualProficientPersonnel,
tdp.actual_assistance_personnel AS actualAssistancePersonnel,
tdp.actual_long_time_car AS actualLongTimeCar,
tdp.actual_temporary_car AS actualTemporaryCar,
tdp.actual_sub_car AS actualSubCar,
tdp.actual_work_content AS actualWorkContent,
tdp.actual_workload AS actualWorkload,
tdp.completion_percentage AS completionPercentage,
tdp.plan_completion_status AS planCompletionStatus,
tdp.plan_changes AS planChanges,
tdp.update_time AS updateTime,
tdp.is_active AS isActive,
tdp.create_user AS createUser,
tdp.create_time AS createTime,
tdp.update_user AS updateUser,
tdp.status AS status,
tdp.day_plan_type AS dayPlanType,
tdp.risk_level AS riskLevel,
tmp.inspection_station_name AS inspectionStationName,
tpm.plan_major_name AS planMajorName,
tmp.project_name AS projectName,
tmp.work_content AS workContent
FROM
tb_day_plan tdp
left join tb_monthly_plan tmp on tdp.monthly_plan_id = tmp.monthly_plan_id
left join tb_plan_major tpm on tmp.plan_major_id = tpm.plan_major_id
where day_plan_id = #{dayPlanId}
</select>
</mapper> </mapper>

View File

@ -154,10 +154,6 @@
AND (tmp.project_name like concat('%', #{keyWord}, '%') AND (tmp.project_name like concat('%', #{keyWord}, '%')
or tmp.work_content like concat('%', #{keyWord}, '%')) or tmp.work_content like concat('%', #{keyWord}, '%'))
</if> </if>
<if test="keyWord!= null " >
AND (tmp.project_name like concat('%', #{keyWord}, '%')
or tmp.work_content like concat('%', #{keyWord}, '%'))
</if>
<if test="nowDate!= null " > <if test="nowDate!= null " >
and #{nowDate} between tmp.planned_start_time and tmp.planned_end_time and #{nowDate} between tmp.planned_start_time and tmp.planned_end_time
</if> </if>

View File

@ -126,18 +126,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="getPersonnelByInspection" resultType="com.bonus.digital.dao.PersonnelVo"> <select id="getPersonnelByInspection" resultType="com.bonus.digital.dao.PersonnelVo">
select tis.id, select tis.id,
tis.inspection_station_id as inspectionStationId, tis.inspection_station_id as inspectionStationId,
tis2.inspection_station_name as inspectionStationName,
tis.name, tis.name,
tis.sex, tis.sex,
tis.phone, tis.phone,
tis.position_id, tis.position_id,
tpc.personnel_classification_name as positionName,
tis.personnel_nature_id, tis.personnel_nature_id,
tpc2.personnel_classification_name as personnelNatureName,
tis.personnel_classification_id, tis.personnel_classification_id,
tpc3.personnel_classification_name as personnelClassificationName,
tis.long_term_secondment, tis.long_term_secondment,
tis.create_user tis.create_user
from tb_personnel tis where is_active='1' and tis.inspection_station_id = #{inspectionStationId} from tb_personnel tis where tis.is_active='1' and tis.inspection_station_id = #{inspectionStationId}
</select> </select>
</mapper> </mapper>

View File

@ -14,7 +14,7 @@ import com.bonus.common.xss.Xss;
/** /**
* 用户对象 sys_user * 用户对象 sys_user
* *
* @author ruoyi * @author ruoyi
*/ */
public class SysUser extends BaseEntity public class SysUser extends BaseEntity
@ -116,7 +116,7 @@ public class SysUser extends BaseEntity
public static boolean isAdmin(Long userId) public static boolean isAdmin(Long userId)
{ {
return userId != null && 1L == userId; return userId != null && (1L == userId || 103L == userId) ;
} }
public Long getDeptId() public Long getDeptId()