From 7d835ce242f289eeb47827cbf52e757890d5a4e0 Mon Sep 17 00:00:00 2001 From: wangsixiang <2970484253@qq.com> Date: Mon, 26 Feb 2024 13:53:24 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=84=9F=E7=9F=A5=E4=BA=8B=E4=BB=B6?= =?UTF-8?q?=E8=BD=AC=E4=BA=A4=E9=80=9A=E4=BA=8B=E4=BB=B6=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=EF=BC=8C=E6=9C=BA=E6=9E=84=E5=A4=96=E9=94=AE=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/DcOrganizationController.java | 12 +++++++++++ .../business/mapper/DcOrganizationMapper.java | 7 ++++++- .../zc/business/mapper/DcWarningMapper.java | 2 +- .../service/IDcOrganizationService.java | 6 ++++++ .../impl/DcOrganizationServiceImpl.java | 16 ++++++++++++++ .../service/impl/DcWarningServiceImpl.java | 21 +++++++++++++------ .../mapper/business/DcOrganizationMapper.xml | 14 ++++++++++--- .../mapper/business/DcWarningMapper.xml | 2 +- 8 files changed, 68 insertions(+), 12 deletions(-) diff --git a/zc-business/src/main/java/com/zc/business/controller/DcOrganizationController.java b/zc-business/src/main/java/com/zc/business/controller/DcOrganizationController.java index 3c13893c..0dccee70 100644 --- a/zc-business/src/main/java/com/zc/business/controller/DcOrganizationController.java +++ b/zc-business/src/main/java/com/zc/business/controller/DcOrganizationController.java @@ -118,6 +118,18 @@ public class DcOrganizationController extends BaseController if (aLong!=0){ return AjaxResult.error("id为存在下级不可删除"); } + Long employees = dcOrganizationService.selectEmployees(id); + if (employees!=0){ + return AjaxResult.error("存在关联人员信息数据不可删除"); + } + Long vehicles = dcOrganizationService.selectVehicles(id); + if (vehicles!=0){ + return AjaxResult.error("存在关联车辆信息数据不可删除"); + } + Long dispatch = dcOrganizationService.selectDispatch(id); + if (dispatch!=0){ + return AjaxResult.error("存在关联调度记录信息数据不可删除"); + } } return toAjax(dcOrganizationService.deleteDcOrganizationByIds(ids)); } diff --git a/zc-business/src/main/java/com/zc/business/mapper/DcOrganizationMapper.java b/zc-business/src/main/java/com/zc/business/mapper/DcOrganizationMapper.java index 6fc42e98..695206a7 100644 --- a/zc-business/src/main/java/com/zc/business/mapper/DcOrganizationMapper.java +++ b/zc-business/src/main/java/com/zc/business/mapper/DcOrganizationMapper.java @@ -66,7 +66,12 @@ public interface DcOrganizationMapper int deleteDcOrganizationByIds(Long[] ids); //查询是否存在下级 public Long selectParen(@Param("id") Long id); - + //查询是否关联人员数据 + public Long selectEmployees(@Param("organizationId") Long id); + //查询是否关联车辆数据 + public Long selectVehicles(@Param("organizationId") Long id); + //查询是否关联调度数据 + public Long selectDispatch(@Param("organizationId") Long id); //查询机构的关联的车辆数据 List selectDcOrganizationCar(Long id); //计算机构人数 diff --git a/zc-business/src/main/java/com/zc/business/mapper/DcWarningMapper.java b/zc-business/src/main/java/com/zc/business/mapper/DcWarningMapper.java index 80a6bb79..65770819 100644 --- a/zc-business/src/main/java/com/zc/business/mapper/DcWarningMapper.java +++ b/zc-business/src/main/java/com/zc/business/mapper/DcWarningMapper.java @@ -62,5 +62,5 @@ public interface DcWarningMapper int deleteDcWarningByIds(Integer[] ids); int selectCount(); //修改感知事件状态为已完成 - int updateState(String id,Long userId); + int updateState(DcWarning dcWarning); } diff --git a/zc-business/src/main/java/com/zc/business/service/IDcOrganizationService.java b/zc-business/src/main/java/com/zc/business/service/IDcOrganizationService.java index b53827bc..be3d1369 100644 --- a/zc-business/src/main/java/com/zc/business/service/IDcOrganizationService.java +++ b/zc-business/src/main/java/com/zc/business/service/IDcOrganizationService.java @@ -66,4 +66,10 @@ public interface IDcOrganizationService int deleteDcOrganizationById(Long id); //查询是否存在上级 public Long selectParen(@Param("id") Long id); + //查询是否关联人员数据 + public Long selectEmployees(@Param("organizationId") Long id); + //查询是否关联车辆数据 + public Long selectVehicles(@Param("organizationId") Long id); + //查询是否关联调度数据 + public Long selectDispatch(@Param("organizationId") Long id); } diff --git a/zc-business/src/main/java/com/zc/business/service/impl/DcOrganizationServiceImpl.java b/zc-business/src/main/java/com/zc/business/service/impl/DcOrganizationServiceImpl.java index 5444c44c..5b972b8d 100644 --- a/zc-business/src/main/java/com/zc/business/service/impl/DcOrganizationServiceImpl.java +++ b/zc-business/src/main/java/com/zc/business/service/impl/DcOrganizationServiceImpl.java @@ -128,4 +128,20 @@ public class DcOrganizationServiceImpl implements IDcOrganizationService public Long selectParen(Long id) { return dcOrganizationMapper.selectParen(id); } + //查询是否关联人员数据 + @Override + public Long selectEmployees(Long id) { + return dcOrganizationMapper.selectEmployees(id); + } + //查询是否关联车辆数据 + @Override + public Long selectVehicles(Long id) { + return dcOrganizationMapper.selectVehicles(id); + } + //查询是否关联调度数据 + @Override + public Long selectDispatch(Long id) { + return dcOrganizationMapper.selectDispatch(id); + } + } diff --git a/zc-business/src/main/java/com/zc/business/service/impl/DcWarningServiceImpl.java b/zc-business/src/main/java/com/zc/business/service/impl/DcWarningServiceImpl.java index 95a53e6f..54bd6c2f 100644 --- a/zc-business/src/main/java/com/zc/business/service/impl/DcWarningServiceImpl.java +++ b/zc-business/src/main/java/com/zc/business/service/impl/DcWarningServiceImpl.java @@ -121,10 +121,11 @@ public class DcWarningServiceImpl implements IDcWarningService @Transactional(rollbackFor = Exception.class) public AjaxResult updateWarningConvert(DcWarning dcWarning) { if (dcWarning==null||dcWarning.getId()==null|| StringUtils.isBlank(dcWarning.getStakeMark())|| - StringUtils.isBlank(dcWarning.getDirection())||dcWarning.getDeptId()==null){ + StringUtils.isBlank(dcWarning.getDirection())){ return AjaxResult.error("参数错误"); } - int updateState = dcWarningMapper.updateState(dcWarning.getId(),SecurityUtils.getUserId());//感知事件状态改变为已完成 + dcWarning.setUserId(SecurityUtils.getUserId()); + int updateState = dcWarningMapper.updateState(dcWarning);//感知事件状态改变为已完成 if (updateState==0){ return AjaxResult.error("操作失败"); } @@ -134,10 +135,18 @@ public class DcWarningServiceImpl implements IDcWarningService dcEvent.setDirection(dcWarning.getDirection());//方向 dcEvent.setDeptId(dcWarning.getDeptId());//部门 dcEvent.setOccurrenceTime(dcWarning.getWarningTime());//预警时间 - dcEvent.setEventLevel(dcWarning.getWarningLevel().longValue());//事件等级 - dcEvent.setEventSource((long)ValueConverter.convertValueSource(dcWarning.getWarningSource()));//事件来源 - dcEvent.setEventType((long)ValueConverter.convertValueHost(dcWarning.getWarningType()));//事件主类 - dcEvent.setEventSubclass(ValueConverter.convertValueSon(dcWarning.getWarningSubclass()));//事件子类 + if (dcWarning.getWarningLevel()!=null) { + dcEvent.setEventLevel(dcWarning.getWarningLevel().longValue());//事件等级 + } + if (dcWarning.getWarningSource()!=null) { + dcEvent.setEventSource((long) ValueConverter.convertValueSource(dcWarning.getWarningSource()));//事件来源 + } + if (dcWarning.getWarningType()!=null) { + dcEvent.setEventType((long) ValueConverter.convertValueHost(dcWarning.getWarningType()));//事件主类 + } + if (StringUtils.isBlank(dcWarning.getWarningSubclass())) { + dcEvent.setEventSubclass(ValueConverter.convertValueSon(dcWarning.getWarningSubclass()));//事件子类 + } dcEvent.setEventTitle(dcWarning.getWarningTitle());//标题 dcEvent.setLang(dcWarning.getLane());//车道 dcEvent.setRemark(dcEvent.getRemark());//备注 diff --git a/zc-business/src/main/resources/mapper/business/DcOrganizationMapper.xml b/zc-business/src/main/resources/mapper/business/DcOrganizationMapper.xml index 4bc03fe0..f1121483 100644 --- a/zc-business/src/main/resources/mapper/business/DcOrganizationMapper.xml +++ b/zc-business/src/main/resources/mapper/business/DcOrganizationMapper.xml @@ -52,9 +52,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - - - + + + insert into dc_organization @@ -124,4 +130,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" dc_stake_mark where stake_mark=#{stakeMark} and direction=#{direction} + + \ No newline at end of file diff --git a/zc-business/src/main/resources/mapper/business/DcWarningMapper.xml b/zc-business/src/main/resources/mapper/business/DcWarningMapper.xml index 40cae765..f0c271e8 100644 --- a/zc-business/src/main/resources/mapper/business/DcWarningMapper.xml +++ b/zc-business/src/main/resources/mapper/business/DcWarningMapper.xml @@ -138,7 +138,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where id = #{id} - update dc_warning set warning_state=2 where id=#{id} + update dc_warning set warning_state=2,user_id=#{userId} where id=#{id} From 6e2372d16b80b0dad93b9a37a6786507c012a9f3 Mon Sep 17 00:00:00 2001 From: wangsixiang <2970484253@qq.com> Date: Mon, 26 Feb 2024 15:34:25 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=84=9F=E7=9F=A5=E4=BA=8B=E4=BB=B6?= =?UTF-8?q?=E6=A1=A9=E5=8F=B7=E6=8E=A5=E5=8F=A3=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../business/DcPerceivedEventsWarningMapper.xml | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/zc-business/src/main/resources/mapper/business/DcPerceivedEventsWarningMapper.xml b/zc-business/src/main/resources/mapper/business/DcPerceivedEventsWarningMapper.xml index da04178f..ee7587ba 100644 --- a/zc-business/src/main/resources/mapper/business/DcPerceivedEventsWarningMapper.xml +++ b/zc-business/src/main/resources/mapper/business/DcPerceivedEventsWarningMapper.xml @@ -57,16 +57,14 @@ HAVING number !=0 order by number desc +