bug修复,需求优化

This commit is contained in:
马三炮 2026-01-13 17:26:05 +08:00
parent 069d321dc9
commit 838afa36c9
7 changed files with 59 additions and 10 deletions

View File

@ -77,6 +77,10 @@ public class InspectionStationController extends BaseController {
return AjaxResult.success();
} else if (res == 2) {
return AjaxResult.error("已绑定人员");
} else if (res == 3) {
return AjaxResult.error("运检站下有计划,请勿删除");
} else if (res == 4) {
return AjaxResult.error("请先删除填报人员");
} else {
return AjaxResult.error("删除失败");
}

View File

@ -140,7 +140,11 @@ public class PlanManagementController extends BaseController {
ExcelUtil<PlanManagementVo> util = new ExcelUtil<PlanManagementVo>(PlanManagementVo.class);
List<PlanManagementVo> planManagementList = util.importExcel(file.getInputStream());
String message = planManagementService.importPlanManagement(planManagementList);
return success(message);
if ("导入成功".equals(message)) {
return success(message);
}else {
return AjaxResult.error(message);
}
} catch (Exception e) {
log.error(e.getMessage());
return AjaxResult.error("模板错误");

View File

@ -1,5 +1,6 @@
package com.bonus.digital.mapper;
import com.bonus.common.core.domain.entity.SysUser;
import com.bonus.digital.dao.InspectionStationVo;
import com.bonus.digital.dao.PersonnelClassificationVo;
import com.bonus.digital.dao.PersonnelVo;
@ -39,4 +40,6 @@ public interface PersonnelMapper {
PersonnelVo getPersonnelListByPhone(PersonnelVo personnelVo);
List<PersonnelVo> getPersonnelByInspection(InspectionStationVo inspectionStationVo);
List<SysUser> getUserList(SysUser sysUser);
}

View File

@ -1,11 +1,14 @@
package com.bonus.digital.service.impl;
import com.bonus.common.core.domain.entity.SysUser;
import com.bonus.common.utils.SecurityUtils;
import com.bonus.common.utils.StringUtils;
import com.bonus.digital.dao.InspectionStationVo;
import com.bonus.digital.dao.PersonnelVo;
import com.bonus.digital.dao.PlanManagementVo;
import com.bonus.digital.mapper.InspectionStationMapper;
import com.bonus.digital.mapper.PersonnelMapper;
import com.bonus.digital.mapper.PlanManagementMapper;
import com.bonus.digital.service.InspectionStationService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@ -30,6 +33,9 @@ public class InspectionStationServiceImpl implements InspectionStationService {
@Resource
private PersonnelMapper personnelMapper;
@Resource
private PlanManagementMapper planManagementMapper;
/**
* 获取0运检站1项目部
*/
@ -59,10 +65,25 @@ public class InspectionStationServiceImpl implements InspectionStationService {
*/
@Override
public int delInspectionStation(InspectionStationVo inspectionStationVo) {
//查看运检站是否绑定人员
List<PersonnelVo> personnelVoList = personnelMapper.getPersonnelByInspection(inspectionStationVo);
if (StringUtils.isNotEmpty(personnelVoList)) {
return 2;
}
//查看该运检站是否有计划
PlanManagementVo planManagementVo = new PlanManagementVo();
planManagementVo.setInspectionStationId(inspectionStationVo.getInspectionStationId());
List<PlanManagementVo> res = planManagementMapper.getPlanManagementList(planManagementVo);
if (StringUtils.isNotEmpty(res)) {
return 3;
}
SysUser sysUser = new SysUser();
sysUser.setDeptId((long) inspectionStationVo.getInspectionStationId());
//查看是否存在填报人
List<SysUser> userList = personnelMapper.getUserList(sysUser);
if (StringUtils.isNotEmpty(userList)) {
return 4;
}
return inspectionStationMapper.delInspectionStation(inspectionStationVo);
}

View File

@ -2,6 +2,7 @@ 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.InspectionStationVo;
import com.bonus.digital.dao.MonthlyPlanVo;
import com.bonus.digital.dao.PlanManagementVo;
@ -85,17 +86,27 @@ public class PlanManagementServiceImpl implements PlanManagementService {
public String importPlanManagement(List<PlanManagementVo> planManagementList) {
for (PlanManagementVo planManagementVo : planManagementList) {
//获取当前
//对必填项进行校验
if(StringUtils.isEmpty(planManagementVo.getPlanManagementMonth())
|| StringUtils.isEmpty(planManagementVo.getProjectName())
|| StringUtils.isEmpty(planManagementVo.getWorkContent())
|| StringUtils.isEmpty(planManagementVo.getInspectionStationName())
|| StringUtils.isEmpty(planManagementVo.getStareDate())
|| StringUtils.isEmpty(planManagementVo.getEndDate())
|| StringUtils.isEmpty(planManagementVo.getRiskLevel())
){
return "缺少必填项";
}
//获取运检站信息
InspectionStationVo inspectionStationVo = new InspectionStationVo();
inspectionStationVo.setInspectionStationName(planManagementVo.getInspectionStationName());
InspectionStationVo inspectionStationOld =inspectionStationMapper.getInspectionStationDetail(inspectionStationVo);
if (inspectionStationOld!=null){
planManagementVo.setInspectionStationId(inspectionStationOld.getInspectionStationId());
Long userId = SecurityUtils.getUserId();
planManagementVo.setCreateUser(userId.toString());
planManagementVo.setCreateTime(new Date());
planManagementMapper.addPlanManagement(planManagementVo);
}
planManagementVo.setInspectionStationId(inspectionStationOld.getInspectionStationId());
Long userId = SecurityUtils.getUserId();
planManagementVo.setCreateUser(userId.toString());
planManagementVo.setCreateTime(new Date());
planManagementMapper.addPlanManagement(planManagementVo);
}
return "导入成功";
}

View File

@ -258,7 +258,10 @@
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 tdp.day_plan_id = #{dayPlanId} and tdp.is_active = '1'
where tdp.is_active = '1'
<if test="dayPlanId!= null " >
AND tdp.day_plan_id = #{dayPlanId}
</if>
<if test="dayPlan!= null " >
AND tdp.day_plan = #{dayPlan}
</if>

View File

@ -136,4 +136,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
tis.create_user
from tb_personnel tis where tis.is_active='1' and tis.inspection_station_id = #{inspectionStationId}
</select>
<select id="getUserList" resultType="com.bonus.common.core.domain.entity.SysUser">
select dept_id from sys_user where dept_id = #{deptId} and del_flag = '0'
</select>
</mapper>