Browse Source

感知事件转交通事件修改,机构外键删除提示

develop
wangsixiang 1 year ago
parent
commit
7d835ce242
  1. 12
      zc-business/src/main/java/com/zc/business/controller/DcOrganizationController.java
  2. 7
      zc-business/src/main/java/com/zc/business/mapper/DcOrganizationMapper.java
  3. 2
      zc-business/src/main/java/com/zc/business/mapper/DcWarningMapper.java
  4. 6
      zc-business/src/main/java/com/zc/business/service/IDcOrganizationService.java
  5. 16
      zc-business/src/main/java/com/zc/business/service/impl/DcOrganizationServiceImpl.java
  6. 17
      zc-business/src/main/java/com/zc/business/service/impl/DcWarningServiceImpl.java
  7. 14
      zc-business/src/main/resources/mapper/business/DcOrganizationMapper.xml
  8. 2
      zc-business/src/main/resources/mapper/business/DcWarningMapper.xml

12
zc-business/src/main/java/com/zc/business/controller/DcOrganizationController.java

@ -118,6 +118,18 @@ public class DcOrganizationController extends BaseController
if (aLong!=0){ if (aLong!=0){
return AjaxResult.error("id为存在下级不可删除"); 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)); return toAjax(dcOrganizationService.deleteDcOrganizationByIds(ids));
} }

7
zc-business/src/main/java/com/zc/business/mapper/DcOrganizationMapper.java

@ -66,7 +66,12 @@ public interface DcOrganizationMapper
int deleteDcOrganizationByIds(Long[] ids); int deleteDcOrganizationByIds(Long[] ids);
//查询是否存在下级 //查询是否存在下级
public Long selectParen(@Param("id") 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);
//查询机构的关联的车辆数据 //查询机构的关联的车辆数据
List<HashMap> selectDcOrganizationCar(Long id); List<HashMap> selectDcOrganizationCar(Long id);
//计算机构人数 //计算机构人数

2
zc-business/src/main/java/com/zc/business/mapper/DcWarningMapper.java

@ -62,5 +62,5 @@ public interface DcWarningMapper
int deleteDcWarningByIds(Integer[] ids); int deleteDcWarningByIds(Integer[] ids);
int selectCount(); int selectCount();
//修改感知事件状态为已完成 //修改感知事件状态为已完成
int updateState(String id,Long userId); int updateState(DcWarning dcWarning);
} }

6
zc-business/src/main/java/com/zc/business/service/IDcOrganizationService.java

@ -66,4 +66,10 @@ public interface IDcOrganizationService
int deleteDcOrganizationById(Long id); int deleteDcOrganizationById(Long id);
//查询是否存在上级 //查询是否存在上级
public Long selectParen(@Param("id") 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);
} }

16
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) { public Long selectParen(Long id) {
return dcOrganizationMapper.selectParen(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);
}
} }

17
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) @Transactional(rollbackFor = Exception.class)
public AjaxResult updateWarningConvert(DcWarning dcWarning) { public AjaxResult updateWarningConvert(DcWarning dcWarning) {
if (dcWarning==null||dcWarning.getId()==null|| StringUtils.isBlank(dcWarning.getStakeMark())|| if (dcWarning==null||dcWarning.getId()==null|| StringUtils.isBlank(dcWarning.getStakeMark())||
StringUtils.isBlank(dcWarning.getDirection())||dcWarning.getDeptId()==null){ StringUtils.isBlank(dcWarning.getDirection())){
return AjaxResult.error("参数错误"); return AjaxResult.error("参数错误");
} }
int updateState = dcWarningMapper.updateState(dcWarning.getId(),SecurityUtils.getUserId());//感知事件状态改变为已完成 dcWarning.setUserId(SecurityUtils.getUserId());
int updateState = dcWarningMapper.updateState(dcWarning);//感知事件状态改变为已完成
if (updateState==0){ if (updateState==0){
return AjaxResult.error("操作失败"); return AjaxResult.error("操作失败");
} }
@ -134,10 +135,18 @@ public class DcWarningServiceImpl implements IDcWarningService
dcEvent.setDirection(dcWarning.getDirection());//方向 dcEvent.setDirection(dcWarning.getDirection());//方向
dcEvent.setDeptId(dcWarning.getDeptId());//部门 dcEvent.setDeptId(dcWarning.getDeptId());//部门
dcEvent.setOccurrenceTime(dcWarning.getWarningTime());//预警时间 dcEvent.setOccurrenceTime(dcWarning.getWarningTime());//预警时间
if (dcWarning.getWarningLevel()!=null) {
dcEvent.setEventLevel(dcWarning.getWarningLevel().longValue());//事件等级 dcEvent.setEventLevel(dcWarning.getWarningLevel().longValue());//事件等级
dcEvent.setEventSource((long)ValueConverter.convertValueSource(dcWarning.getWarningSource()));//事件来源 }
dcEvent.setEventType((long)ValueConverter.convertValueHost(dcWarning.getWarningType()));//事件主类 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.setEventSubclass(ValueConverter.convertValueSon(dcWarning.getWarningSubclass()));//事件子类
}
dcEvent.setEventTitle(dcWarning.getWarningTitle());//标题 dcEvent.setEventTitle(dcWarning.getWarningTitle());//标题
dcEvent.setLang(dcWarning.getLane());//车道 dcEvent.setLang(dcWarning.getLane());//车道
dcEvent.setRemark(dcEvent.getRemark());//备注 dcEvent.setRemark(dcEvent.getRemark());//备注

14
zc-business/src/main/resources/mapper/business/DcOrganizationMapper.xml

@ -52,9 +52,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectParen" resultType="java.lang.Long"> <select id="selectParen" resultType="java.lang.Long">
select count(1) from dc_organization where parent_id=#{id} select count(1) from dc_organization where parent_id=#{id}
</select> </select>
<select id="selectEmployees" resultType="java.lang.Long">
select count(1) from dc_employees where organization_id=#{organizationId}
</select>
<select id="selectVehicles" resultType="java.lang.Long">
select count(1) from dc_vehicles where organization_id=#{organizationId}
</select>
<select id="selectDispatch" resultType="java.lang.Long">
select count(1) from dc_dispatch where organization_id=#{organizationId}
</select>
<insert id="insertDcOrganization" parameterType="DcOrganization"> <insert id="insertDcOrganization" parameterType="DcOrganization">
insert into dc_organization insert into dc_organization
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
@ -124,4 +130,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
dc_stake_mark where stake_mark=#{stakeMark} and direction=#{direction} dc_stake_mark where stake_mark=#{stakeMark} and direction=#{direction}
</select> </select>
</mapper> </mapper>

2
zc-business/src/main/resources/mapper/business/DcWarningMapper.xml

@ -138,7 +138,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where id = #{id} where id = #{id}
</update> </update>
<update id="updateState"> <update id="updateState">
update dc_warning set warning_state=2 where id=#{id} update dc_warning set warning_state=2,user_id=#{userId} where id=#{id}
</update> </update>
<delete id="deleteDcWarningById" parameterType="Integer"> <delete id="deleteDcWarningById" parameterType="Integer">

Loading…
Cancel
Save