|
@ -6,6 +6,7 @@ import com.ruoyi.common.utils.SecurityUtils; |
|
|
import com.ruoyi.common.utils.uuid.IdUtils; |
|
|
import com.ruoyi.common.utils.uuid.IdUtils; |
|
|
import com.zc.business.domain.DcEvent; |
|
|
import com.zc.business.domain.DcEvent; |
|
|
import com.zc.business.domain.DcWarning; |
|
|
import com.zc.business.domain.DcWarning; |
|
|
|
|
|
import com.zc.business.domain.DcWarningBatchConvert; |
|
|
import com.zc.business.enums.ValueConverter; |
|
|
import com.zc.business.enums.ValueConverter; |
|
|
import com.zc.business.mapper.DcEventMapper; |
|
|
import com.zc.business.mapper.DcEventMapper; |
|
|
import com.zc.business.mapper.DcWarningMapper; |
|
|
import com.zc.business.mapper.DcWarningMapper; |
|
@ -16,6 +17,7 @@ import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
import java.util.HashMap; |
|
|
import java.util.HashMap; |
|
|
import java.util.List; |
|
|
import java.util.List; |
|
|
|
|
|
|
|
@ -170,4 +172,79 @@ public class DcWarningServiceImpl implements IDcWarningService |
|
|
{ |
|
|
{ |
|
|
return dcWarningMapper.selectDcWarningoTherConfig(dcWarning); |
|
|
return dcWarningMapper.selectDcWarningoTherConfig(dcWarning); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* @Description 感知事件批量转换 |
|
|
|
|
|
* |
|
|
|
|
|
* @author liuwenge |
|
|
|
|
|
* @date 2024/3/16 16:36 |
|
|
|
|
|
* @param dcWarningBatchConvert |
|
|
|
|
|
* @return com.ruoyi.common.core.domain.AjaxResult |
|
|
|
|
|
*/ |
|
|
|
|
|
@Override |
|
|
|
|
|
@Transactional |
|
|
|
|
|
public AjaxResult batchConvert(DcWarningBatchConvert dcWarningBatchConvert){ |
|
|
|
|
|
|
|
|
|
|
|
if (StringUtils.isBlank(dcWarningBatchConvert.getType())){ |
|
|
|
|
|
return AjaxResult.error("请选择操作类型"); |
|
|
|
|
|
} |
|
|
|
|
|
List<DcWarning> dcWarningList = dcWarningBatchConvert.getWarningList(); |
|
|
|
|
|
|
|
|
|
|
|
if (dcWarningList != null && dcWarningList.size() > 0){ |
|
|
|
|
|
|
|
|
|
|
|
//误报,批量删除
|
|
|
|
|
|
if ("0".equals(dcWarningBatchConvert.getType())){ |
|
|
|
|
|
dcWarningMapper.batchDelete(dcWarningList); |
|
|
|
|
|
} else { |
|
|
|
|
|
//确认,批量转换为事件
|
|
|
|
|
|
List<DcEvent> dcEventList = new ArrayList<>(); |
|
|
|
|
|
for (DcWarning dcWarning : dcWarningList) { |
|
|
|
|
|
if (dcWarning == null || dcWarning.getId() == null || StringUtils.isBlank(dcWarning.getStakeMark()) || |
|
|
|
|
|
StringUtils.isBlank(dcWarning.getDirection())) { |
|
|
|
|
|
return AjaxResult.error("参数错误"); |
|
|
|
|
|
} |
|
|
|
|
|
dcWarning.setUserId(SecurityUtils.getUserId()); |
|
|
|
|
|
|
|
|
|
|
|
DcEvent dcEvent = new DcEvent(); |
|
|
|
|
|
dcEvent.setId(dcWarning.getId());//id
|
|
|
|
|
|
dcEvent.setStakeMark(dcWarning.getStakeMark());//桩号
|
|
|
|
|
|
dcEvent.setDirection(dcWarning.getDirection());//方向
|
|
|
|
|
|
dcEvent.setDeptId(dcWarning.getDeptId());//部门
|
|
|
|
|
|
dcEvent.setOccurrenceTime(dcWarning.getWarningTime());//预警时间
|
|
|
|
|
|
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());//备注
|
|
|
|
|
|
dcEvent.setIsPerceived(1);//是否感知事件
|
|
|
|
|
|
dcEvent.setEventState(Long.valueOf(1));//状态为处理中
|
|
|
|
|
|
dcEvent.setCreateTime(DateUtils.getNowDate());//创建时间
|
|
|
|
|
|
dcEvent.setUserId(SecurityUtils.getUserId());//处置人员
|
|
|
|
|
|
|
|
|
|
|
|
dcEventList.add(dcEvent); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//批量更改感知事件状态
|
|
|
|
|
|
dcWarningMapper.batchUpdateState(SecurityUtils.getUserId(),dcWarningList); |
|
|
|
|
|
//批量插入事件表
|
|
|
|
|
|
dcEventService.batchInsertDcEventWarning(dcEventList); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
return AjaxResult.error("请选择感知事件"); |
|
|
|
|
|
} |
|
|
|
|
|
return AjaxResult.success("批量操作成功"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|