From 11d717a74ef2efc19c74d7d74c7ce92e27877dc2 Mon Sep 17 00:00:00 2001 From: wangsixiang <2970484253@qq.com> Date: Wed, 20 Mar 2024 18:32:31 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BF=87=E6=BB=A4=E7=AD=96=E7=95=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../zc/business/domain/DcWaringStrategy.java | 123 +++++++ .../zc/business/mapper/DcWarningMapper.java | 12 +- .../business/service/IDcWarningService.java | 2 +- .../service/impl/DcWarningServiceImpl.java | 319 +++++++++--------- .../mapper/business/DcWarningMapper.xml | 15 +- 5 files changed, 307 insertions(+), 164 deletions(-) create mode 100644 zc-business/src/main/java/com/zc/business/domain/DcWaringStrategy.java diff --git a/zc-business/src/main/java/com/zc/business/domain/DcWaringStrategy.java b/zc-business/src/main/java/com/zc/business/domain/DcWaringStrategy.java new file mode 100644 index 00000000..213957ca --- /dev/null +++ b/zc-business/src/main/java/com/zc/business/domain/DcWaringStrategy.java @@ -0,0 +1,123 @@ +package com.zc.business.domain; + +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.core.domain.BaseEntity; + +/** + * 预警事件配置对象 dc_waring_strategy + * + * @author ruoyi + * @date 2024-03-19 + */ +public class DcWaringStrategy extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** $column.columnComment */ + private Long id; + + /** 事件源 */ + @Excel(name = "事件源") + private Integer warningSource; + + /** 事件主类 */ + @Excel(name = "事件主类") + private Integer warningType; + + /** 事件子类 */ + @Excel(name = "事件子类") + private String warningSubclass; + + /** 过期策略 */ + @Excel(name = "过期策略") + private Integer strategy; + + /** 策略时间 */ + @Excel(name = "策略时间", width = 30, dateFormat = "yyyy-MM-dd") + private Integer strategyTime; + + //优先级 + private String priority; + + public String getPriority() { + return priority; + } + + public void setPriority(String priority) { + this.priority = priority; + } + + public void setId(Long id) + { + this.id = id; + } + + public Long getId() + { + return id; + } + public void setWarningSource(Integer warningSource) + { + this.warningSource = warningSource; + } + + public Integer getWarningSource() + { + return warningSource; + } + public void setWarningType(Integer warningType) + { + this.warningType = warningType; + } + + public Integer getWarningType() + { + return warningType; + } + public void setWarningSubclass(String warningSubclass) + { + this.warningSubclass = warningSubclass; + } + + public String getWarningSubclass() + { + return warningSubclass; + } + public void setStrategy(Integer strategy) + { + this.strategy = strategy; + } + + public Integer getStrategy() + { + return strategy; + } + + public Integer getStrategyTime() { + return strategyTime; + } + + public void setStrategyTime(Integer strategyTime) { + this.strategyTime = strategyTime; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("warningSource", getWarningSource()) + .append("warningType", getWarningType()) + .append("warningSubclass", getWarningSubclass()) + .append("strategy", getStrategy()) + .append("strategyTime", getStrategyTime()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} 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 70c353a1..81af54ab 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 @@ -2,6 +2,9 @@ package com.zc.business.mapper; import java.util.HashMap; import java.util.List; + +import cn.hutool.core.lang.hash.Hash; +import com.zc.business.domain.DcWaringStrategy; import com.zc.business.domain.DcWarning; import org.apache.ibatis.annotations.Param; @@ -19,7 +22,7 @@ public interface DcWarningMapper * @param id 预警信息主键 * @return 预警信息 */ - public DcWarning selectDcWarningById(String id); + public HashMap selectDcWarningById(String id); /** * 查询预警信息列表 @@ -73,4 +76,11 @@ public interface DcWarningMapper boolean batchUpdateState(@Param("userId") Long userId,@Param("dcWarningList") List dcWarningList); boolean batchDelete(@Param("dcWarningList") List dcWarningList); + + //查询预警配置信息 + public List selectDcWaringStrategyList(DcWaringStrategy dcWaringStrategy); + public List selectDcWaringStrategyList(); + + //修改配置 + public Integer updateOtherConfig(@Param("id")String id,@Param("otherConfig")String otherConfig); } diff --git a/zc-business/src/main/java/com/zc/business/service/IDcWarningService.java b/zc-business/src/main/java/com/zc/business/service/IDcWarningService.java index 8ad61ccc..d046a7ef 100644 --- a/zc-business/src/main/java/com/zc/business/service/IDcWarningService.java +++ b/zc-business/src/main/java/com/zc/business/service/IDcWarningService.java @@ -22,7 +22,7 @@ public interface IDcWarningService * @param id 预警信息主键 * @return 预警信息 */ - public DcWarning selectDcWarningById(String id); + public HashMap selectDcWarningById(String 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 c6b28825..266a685e 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 @@ -1,11 +1,16 @@ package com.zc.business.service.impl; -import com.alibaba.fastjson.JSONObject; + + import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.redis.RedisCache; import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.uuid.IdUtils; -import com.zc.business.domain.*; +import com.zc.business.domain.DcEvent; +import com.zc.business.domain.DcWaringStrategy; +import com.zc.business.domain.DcWarning; +import com.zc.business.domain.DcWarningBatchConvert; import com.zc.business.enums.ValueConverter; import com.zc.business.mapper.DcEventMapper; import com.zc.business.mapper.DcWarningMapper; @@ -16,11 +21,14 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import javax.annotation.Resource; import java.util.ArrayList; -import java.util.Calendar; import java.util.HashMap; import java.util.List; - +import java.util.Map; +import java.util.concurrent.TimeUnit; +import org.json.JSONObject; +import org.json.JSONArray; /** * 预警信息Service业务层处理 * @@ -37,6 +45,12 @@ public class DcWarningServiceImpl implements IDcWarningService private DcEventMapper dcEventMapper; @Autowired private IDcEventService dcEventService; + @Resource + private RedisCache redisCache; + + private static final String WARNINGSTRATEGY = "warningStrategy";//redis策略缓存的key + private static final String WARNINGDATA = "warningData:";//redis事件缓存的key + private static String JUDGE = "1"; //自定义判断参数,1为满足0为不满足 /** * 查询预警信息 * @@ -44,7 +58,7 @@ public class DcWarningServiceImpl implements IDcWarningService * @return 预警信息 */ @Override - public DcWarning selectDcWarningById(String id) + public HashMap selectDcWarningById(String id) { return dcWarningMapper.selectDcWarningById(id); } @@ -75,15 +89,149 @@ public class DcWarningServiceImpl implements IDcWarningService @Override public int insertDcWarning(DcWarning dcWarning) { + dcWarning.setCreateTime(DateUtils.getNowDate()); - if (dcWarning.getId()==null) { - //设置事件Id UUID无下划线格式32 - String uuid = IdUtils.fastSimpleUUID(); - dcWarning.setId(uuid); + //设置事件Id UUID无下划线格式32 + String uuid = IdUtils.fastSimpleUUID(); + dcWarning.setId(uuid); + int priority = new DcWarningServiceImpl().priority(dcWarning); + if (priority==0){ + return 0; } return dcWarningMapper.insertDcWarning(dcWarning); } + //优先级策略 + public int priority(DcWarning dcWarning){ + if (StringUtils.isBlank(dcWarning.getStakeMark())||dcWarning.getWarningSource()==null||dcWarning.getWarningType()==null|| + StringUtils.isBlank(dcWarning.getWarningSubclass())||StringUtils.isBlank(dcWarning.getDirection())){ + return 0; + } + String redisKye=dcWarning.getWarningSource().toString()+dcWarning.getWarningType().toString()+dcWarning.getWarningSubclass();//配置数据的key 事件源+事件类型+策略 + Map redisWarningStrategy = redisCache.getCacheMap(WARNINGSTRATEGY);//获取缓存全部的配置数据 + if (redisWarningStrategy==null){//如果缓存为空,查询数据重新加入缓存 + Map redisMap = new HashMap<>(); + List dcWaringStrategies = dcWarningMapper.selectDcWaringStrategyList();//数据库全部配置数据 + for (DcWaringStrategy waringStrategy : dcWaringStrategies) { + String key = waringStrategy.getWarningSource().toString() + waringStrategy.getWarningType().toString() + + waringStrategy.getWarningSubclass()+waringStrategy.getStrategy().toString();//redis配置数据key + JSONObject jsonObject = new JSONObject(); + jsonObject.put("strategy", waringStrategy.getStrategy());//策略模式 + jsonObject.put("strategyTime", waringStrategy.getStrategyTime());//模式时长,单位为分钟 + jsonObject.put("priority", waringStrategy.getPriority());//策略模式 + redisMap.put(key, jsonObject); + } + redisCache.setCacheMap(WARNINGSTRATEGY, redisMap);//数据库配置数据加入缓存中 + redisWarningStrategy = redisCache.getCacheMap(WARNINGSTRATEGY);//缓存数据为空重新加入到缓存在取出缓存的配置 + } + String key=dcWarning.getStakeMark()+dcWarning.getDirection()+dcWarning.getWarningSource(). + toString()+dcWarning.getWarningType().toString()+dcWarning.getWarningSubclass();//key,redis存储事件的key(桩号+方向+事件源+类型) + String dataId = redisCache.getCacheObject(WARNINGDATA + key);//查看redis是否存在数据(id的值) + JSONObject redisValueOne = redisWarningStrategy.get(redisKye+"1");//查看传入的事件类型是否配置策略1(优先级策略) + if(redisValueOne!=null){//执行策略1(暂时未定义,定义后开发) + + } + JSONObject redisValueTwo = redisWarningStrategy.get(redisKye+"2");//查看传入的事件类型是否配置策略2(延迟策略) + if (redisValueOne==null&&redisValueTwo!=null){ //执行策略2,执行到这里说明1不存在或者1未满足过滤条件 + String strategyTime = redisValueTwo.getString("strategyTime").toString();//策略时长 + if (dataId==null){//如果不存在直接加入数据库,加入缓存,配置对应的过期时间 + int insertDcWarning = new DcWarningServiceImpl().insertDcWarning(dcWarning);//加入数据库 + if (insertDcWarning==0){ + return 0; + } + String id = dcWarning.getId();//取出加入后的id作为value + redisCache.setCacheObject(WARNINGDATA+key,id,Integer.parseInt(strategyTime),TimeUnit.MINUTES);//加入缓存并设置延迟时间(单位分钟) + } + //redis存在数据,取出redis的id找对对应事件的配置,合成事件配置,重新定义延迟时间 + HashMap map = dcWarningMapper.selectDcWarningById(dataId); + String otherConfig = map.get("otherConfig").toString();//取出原id的配置信息 + String otherConfigString = dcWarning.getOtherConfig();//新增的配置信息 + JSONObject jsonObjectOne = new JSONObject(otherConfig); + JSONObject jsonObjectTwo = new JSONObject(otherConfigString); + JSONObject jsonObject = new DcWarningServiceImpl().mergeJsonObjects(jsonObjectOne, jsonObjectTwo);//合成新的json + Integer integer = dcWarningMapper.updateOtherConfig(dataId, jsonObject.toString());//修改数据库配置 + redisCache.setCacheObject(WARNINGDATA+key,dataId,Integer.parseInt(strategyTime),TimeUnit.MINUTES);//重新设置延迟时间 + if (integer==0){ + return 0; + } + return 1; + } + JSONObject redisValueThree = redisWarningStrategy.get(redisKye+"3");//查看传入的事件类型是否配置策略3(时间窗口策略) + if (redisValueOne==null&&redisValueTwo==null&&redisValueThree!=null){ //执行策略3,执行到这里说明1不存在或者2不存在或者1未满足过滤条件 + if (dataId==null){//如果不存在直接加入数据库,加入缓存,配置对应的过期时间(30分钟) + int insertDcWarning = new DcWarningServiceImpl().insertDcWarning(dcWarning);//加入数据库 + if (insertDcWarning==0){ + return 0; + } + String id = dcWarning.getId();//取出加入后的id作为value + redisCache.setCacheObject(WARNINGDATA+key,id,30,TimeUnit.MINUTES);//加入缓存并设置延迟时间(单位分钟) + } + //redis存在数据,取出redis的id找对对应事件的配置,合成事件配置 + HashMap map = dcWarningMapper.selectDcWarningById(dataId); + String otherConfig = map.get("otherConfig").toString();//取出原id的配置信息 + String otherConfigString = dcWarning.getOtherConfig();//新增的配置信息 + JSONObject jsonObjectOne = new JSONObject(otherConfig); + JSONObject jsonObjectTwo = new JSONObject(otherConfigString); + JSONObject jsonObject = new DcWarningServiceImpl().mergeJsonObjects(jsonObjectOne, jsonObjectTwo);//合成新的json + Integer integer = dcWarningMapper.updateOtherConfig(dataId, jsonObject.toString());//修改数据库配置 + if (integer==0){ + return 0; + } + return 1; + } + JSONObject redisValueFour = redisWarningStrategy.get(redisKye+"4");//查看传入的事件类型是否配置策略3(自动结束策略) + if (redisValueOne==null&&redisValueTwo==null&&redisValueThree==null&&redisValueFour!=null){ //执行策略4,执行到这里说明1不存在或者2、3不存在或者1未满足过滤条件 + if (dataId==null){//如果不存在直接加入数据库,加入缓存 + int insertDcWarning = new DcWarningServiceImpl().insertDcWarning(dcWarning);//加入数据库 + if (insertDcWarning==0){ + return 0; + } + String id = dcWarning.getId();//取出加入后的id作为value + redisCache.setCacheObject(WARNINGDATA+key,id);//加入缓存????存在问题会数据累计 + } + //redis存在数据,取出redis的id找对对应事件的配置,合成事件配置 + HashMap map = dcWarningMapper.selectDcWarningById(dataId); + String otherConfig = map.get("otherConfig").toString();//取出原id的配置信息 + String otherConfigString = dcWarning.getOtherConfig();//新增的配置信息 + JSONObject jsonObjectOne = new JSONObject(otherConfig); + JSONObject jsonObjectTwo = new JSONObject(otherConfigString); + JSONObject jsonObject = new DcWarningServiceImpl().mergeJsonObjects(jsonObjectOne, jsonObjectTwo);//合成新的json + Integer integer = dcWarningMapper.updateOtherConfig(dataId, jsonObject.toString());//修改数据库配置 + redisCache.deleteObject(WARNINGDATA + key);//删除对应的合成事件 + if (integer==0){ + return 0; + } + return 1; + } + return 1; + } + private JSONObject mergeJsonObjects(JSONObject jsonObjectOne, JSONObject jsonObjectTwo){ + // 合并videoList + if (jsonObjectTwo.has("videoList")) { + JSONArray videoListTwo = jsonObjectTwo.getJSONArray("videoList"); + JSONArray videoListOne = jsonObjectOne.optJSONArray("videoList"); + if (videoListOne == null) { + videoListOne = new JSONArray(); + } + for (int i = 0; i < videoListTwo.length(); i++) { + videoListOne.put(videoListTwo.get(i)); + } + jsonObjectOne.put("videoList", videoListOne); + } + // 合并pictures + if (jsonObjectTwo.has("pictures")) { + JSONArray picturesTwo = jsonObjectTwo.getJSONArray("pictures"); + JSONArray picturesOne = jsonObjectOne.optJSONArray("pictures"); + if (picturesOne == null) { + picturesOne = new JSONArray(); + } + for (int i = 0; i < picturesTwo.length(); i++) { + picturesOne.put(picturesTwo.get(i)); + } + jsonObjectOne.put("pictures", picturesOne); + } + return jsonObjectOne; + } /** * 修改预警信息 * @@ -203,7 +351,7 @@ public class DcWarningServiceImpl implements IDcWarningService if ("0".equals(dcWarningBatchConvert.getType())){ dcWarningMapper.batchDelete(dcWarningList); } else { - //确认,批量转换为事件 + //确认,批量转换为事件 List dcEventList = new ArrayList<>(); for (DcWarning dcWarning : dcWarningList) { if (dcWarning == null || dcWarning.getId() == null || StringUtils.isBlank(dcWarning.getStakeMark()) || @@ -238,156 +386,6 @@ public class DcWarningServiceImpl implements IDcWarningService dcEvent.setCreateTime(DateUtils.getNowDate());//创建时间 dcEvent.setUserId(SecurityUtils.getUserId());//处置人员 - Calendar cal = Calendar.getInstance(); - cal.add(Calendar.HOUR,3); - dcEvent.setEstimatedEndTime(cal.getTime()); //预计解除时间 - dcEvent.setRoadId(1L); //道路id - dcEvent.setRoadName("济菏高速"); //道路id - dcEvent.setInTunnel(0); //是否处在隧道 - - - Integer warningType = dcWarning.getWarningType(); - if (warningType == 1){ - - //交通拥堵 - DcEventTrafficCongestion dcEventTrafficCongestion = new DcEventTrafficCongestion(); - dcEventTrafficCongestion.setId(dcWarning.getId()); - dcEventTrafficCongestion.setCongestionCause(5L); - dcEventTrafficCongestion.setCongestionMileage(0F); - dcEventTrafficCongestion.setMaxCongestionMileage(0F); - dcEvent.setDcEventTrafficCongestion(dcEventTrafficCongestion); - } else if (warningType == 4) { - //停车 - DcEventVehicleAccident dcEventVehicleAccident = new DcEventVehicleAccident(); - dcEventVehicleAccident.setId(dcWarning.getId()); - - if (dcWarning.getWarningSource() == 1) { - dcEventVehicleAccident.setReporterName("视频AI"); - } else if (dcWarning.getWarningSource() == 2) { - dcEventVehicleAccident.setReporterName("雷达识别"); - } else if (dcWarning.getWarningSource() == 3) { - dcEventVehicleAccident.setReporterName("智慧锥桶"); - } else if (dcWarning.getWarningSource() == 4) { - dcEventVehicleAccident.setReporterName("护栏碰撞"); - } else if (dcWarning.getWarningSource() == 6) { - dcEventVehicleAccident.setReporterName("非机预警"); - } - dcEventVehicleAccident.setReporterPhoneNumber("96659"); - dcEventVehicleAccident.setLocationType(1L); - dcEventVehicleAccident.setTrafficJam(0L); - dcEventVehicleAccident.setWeatherCondition(1L); - dcEventVehicleAccident.setCongestionAhead(1); - dcEventVehicleAccident.setAtIntersection(1); - dcEventVehicleAccident.setOnCurve(1); - dcEventVehicleAccident.setSmallCar(0L); - dcEventVehicleAccident.setTrucks(0L); - dcEventVehicleAccident.setBuses(0L); - dcEventVehicleAccident.setTankers(0L); - dcEventVehicleAccident.setMinorInjuries(0L); - dcEventVehicleAccident.setSeriousInjuries(0L); - dcEventVehicleAccident.setFatalities(0L); - dcEvent.setDcEventVehicleAccident(dcEventVehicleAccident); - } else if (warningType == 7){ - //道路施工 - - } else if (warningType == 8) { - //异常天气 - DcEventAbnormalWeather dcEventAbnormalWeather = new DcEventAbnormalWeather(); - dcEventAbnormalWeather.setId(dcWarning.getId()); - dcEventAbnormalWeather.setEmergencyLevel(1L); - dcEvent.setDcEventAbnormalWeather(dcEventAbnormalWeather); - } else if (warningType == 9) { - //护栏碰撞 - DcEventAccident dcEventAccident = new DcEventAccident(); - dcEventAccident.setId(dcWarning.getId()); - if (dcWarning.getWarningSource() == 1) { - dcEventAccident.setReporterName("视频AI"); - dcEventAccident.setReporterPhoneNumber("96659"); - } else if (dcWarning.getWarningSource() == 2) { - dcEventAccident.setReporterName("雷达识别"); - dcEventAccident.setReporterPhoneNumber("96659"); - } else if (dcWarning.getWarningSource() == 3) { - dcEventAccident.setReporterName("智慧锥桶"); - dcEventAccident.setReporterPhoneNumber("96659"); - } else if (dcWarning.getWarningSource() == 4) { - dcEventAccident.setReporterName("护栏碰撞"); - dcEventAccident.setReporterPhoneNumber("96659"); - } else if (dcWarning.getWarningSource() == 5) { - dcEventAccident.setReporterName("扫码报警"); - JSONObject otherConfig = JSONObject.parseObject(dcWarning.getOtherConfig()); - if (otherConfig != null && otherConfig.containsKey("phone")) { - dcEventAccident.setReporterPhoneNumber(otherConfig.getString("phone")); - dcEventAccident.setVehicleOwnerPhone(otherConfig.getString("phone")); - } - } else if (dcWarning.getWarningSource() == 6) { - dcEventAccident.setReporterName("非机预警"); - dcEventAccident.setReporterPhoneNumber("96659"); - } - dcEventAccident.setLocationType(1L); - dcEventAccident.setTrafficJam(0f); - dcEventAccident.setWeatherCondition(1L); - dcEventAccident.setImpactLevel(1L); - dcEventAccident.setIsReverseCargo(0); - dcEventAccident.setIsMaintenance(0); - dcEventAccident.setCongestionAhead(0); - dcEventAccident.setOnCurve(0); - dcEventAccident.setSmallCar(0L); - dcEventAccident.setTrucks(0L); - dcEventAccident.setBuses(0L); - dcEventAccident.setTankers(0L); - dcEventAccident.setMinorInjuries(0L); - dcEventAccident.setSeriousInjuries(0L); - dcEventAccident.setFatalities(0L); - dcEvent.setDcEventAccident(dcEventAccident); - } else if (warningType == 10) { - //交通事故 - DcEventAccident dcEventAccident = new DcEventAccident(); - - - } else if (warningType == 11) { - //车辆故障 - DcEventVehicleAccident dcEventVehicleAccident = new DcEventVehicleAccident(); - dcEventVehicleAccident.setId(dcWarning.getId()); - - if (dcWarning.getWarningSource() == 1) { - dcEventVehicleAccident.setReporterName("视频AI"); - dcEventVehicleAccident.setReporterPhoneNumber("96659"); - } else if (dcWarning.getWarningSource() == 2) { - dcEventVehicleAccident.setReporterName("雷达识别"); - dcEventVehicleAccident.setReporterPhoneNumber("96659"); - } else if (dcWarning.getWarningSource() == 3) { - dcEventVehicleAccident.setReporterName("智慧锥桶"); - dcEventVehicleAccident.setReporterPhoneNumber("96659"); - } else if (dcWarning.getWarningSource() == 4) { - dcEventVehicleAccident.setReporterName("护栏碰撞"); - dcEventVehicleAccident.setReporterPhoneNumber("96659"); - } else if (dcWarning.getWarningSource() == 5) { - dcEventVehicleAccident.setReporterName("扫码报警"); - JSONObject otherConfig = JSONObject.parseObject(dcWarning.getOtherConfig()); - if (otherConfig != null && otherConfig.containsKey("phone")) { - dcEventVehicleAccident.setReporterPhoneNumber(otherConfig.getString("phone")); - } - } else if (dcWarning.getWarningSource() == 6) { - dcEventVehicleAccident.setReporterName("非机预警"); - dcEventVehicleAccident.setReporterPhoneNumber("96659"); - } - dcEventVehicleAccident.setLocationType(1L); - dcEventVehicleAccident.setTrafficJam(0L); - dcEventVehicleAccident.setWeatherCondition(1L); - dcEventVehicleAccident.setCongestionAhead(1); - dcEventVehicleAccident.setAtIntersection(1); - dcEventVehicleAccident.setOnCurve(1); - dcEventVehicleAccident.setSmallCar(0L); - dcEventVehicleAccident.setTrucks(0L); - dcEventVehicleAccident.setBuses(0L); - dcEventVehicleAccident.setTankers(0L); - dcEventVehicleAccident.setMinorInjuries(0L); - dcEventVehicleAccident.setSeriousInjuries(0L); - dcEventVehicleAccident.setFatalities(0L); - dcEvent.setDcEventVehicleAccident(dcEventVehicleAccident); - } - - dcEventList.add(dcEvent); } @@ -395,7 +393,6 @@ public class DcWarningServiceImpl implements IDcWarningService dcWarningMapper.batchUpdateState(SecurityUtils.getUserId(),dcWarningList); //批量插入事件表 dcEventService.batchInsertDcEventWarning(dcEventList); - } diff --git a/zc-business/src/main/resources/mapper/business/DcWarningMapper.xml b/zc-business/src/main/resources/mapper/business/DcWarningMapper.xml index 070a93bd..b0d6e2c7 100644 --- a/zc-business/src/main/resources/mapper/business/DcWarningMapper.xml +++ b/zc-business/src/main/resources/mapper/business/DcWarningMapper.xml @@ -64,7 +64,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - where id = #{id} @@ -159,6 +159,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + update dc_warning set other_config=#{otherConfig} where id=#{id} + delete from dc_warning where id = #{id} @@ -197,5 +200,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and warning_subclass = #{warningSubclass} +