Browse Source

1.关联管制事件操作记录

2.侧重要素操作记录
develop
lau572 8 months ago
parent
commit
46095c229d
  1. 21
      zc-business/src/main/java/com/zc/business/enums/ValueConverter.java
  2. 63
      zc-business/src/main/java/com/zc/business/service/impl/DcEventImportantServiceImpl.java
  3. 77
      zc-business/src/main/java/com/zc/business/service/impl/DcEventServiceImpl.java

21
zc-business/src/main/java/com/zc/business/enums/ValueConverter.java

@ -30,6 +30,8 @@ public class ValueConverter {
private static final Map<String, String> eventSubclassName = new HashMap<>();
// 事件字段
private static final Map<String, String> eventLabel = new HashMap<>();
// 事件侧重要素字段
private static final Map<String, String> eventImportantLabel = new HashMap<>();
static {
valueMappingSource.put(1,5);
@ -287,6 +289,18 @@ public class ValueConverter {
eventLabel.put("dcEventTrafficControl.classify","分类");
eventLabel.put("dcEventTrafficControl.limitedType","限制类型");
// eventLabel.put("dcEventTrafficControl.vehicleType","车辆类型");
eventImportantLabel.put("plateNumber","车型及车牌号");
eventImportantLabel.put("diversionPoint","分流点名称及桩号");
eventImportantLabel.put("currentProgress","目前处置进度");
eventImportantLabel.put("takeSteps","已采取的措施");
eventImportantLabel.put("planStatus","是否启动应急预案");
eventImportantLabel.put("trafficPoliceStatus","交警是否到达");
eventImportantLabel.put("medicalStatus","医疗是否到达");
eventImportantLabel.put("boardStatus","是否做好情报板提示");
eventImportantLabel.put("chemicalsStatus","是否有危化品泄露");
eventImportantLabel.put("fireStatus","消防是否到达");
}
}
@ -312,6 +326,9 @@ public class ValueConverter {
public static Map<String, String> getEventLabel() {
return ValueMappingHolder.eventLabel;
}
public static Map<String, String> getEventImportantLabel() {
return ValueMappingHolder.eventImportantLabel;
}
public static Map<String, String> getEventSubclassName() {
return ValueMappingHolder.eventSubclassName;
@ -354,6 +371,10 @@ public class ValueConverter {
Map<String, String> mapping = getEventSubclassName();
return mapping.getOrDefault(inputValue, inputValue);
}
public static String eventImportantLabel(String inputValue) {
Map<String, String> mapping = getEventImportantLabel();
return mapping.getOrDefault(inputValue, "");
}
//测试
// @Test

63
zc-business/src/main/java/com/zc/business/service/impl/DcEventImportantServiceImpl.java

@ -1,13 +1,19 @@
package com.zc.business.service.impl;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import com.alibaba.fastjson.JSON;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.StringUtils;
import com.zc.business.domain.*;
import com.zc.business.enums.ValueConverter;
import com.zc.business.utils.diff.Diff;
import com.zc.business.utils.diff.model.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zc.business.mapper.DcEventImportantMapper;
import com.zc.business.domain.DcEventImportant;
import com.zc.business.service.IDcEventImportantService;
/**
@ -21,6 +27,8 @@ public class DcEventImportantServiceImpl implements IDcEventImportantService
{
@Autowired
private DcEventImportantMapper dcEventImportantMapper;
@Autowired
private DcEventProcessServiceImpl dcEventProcessService;
/**
* 查询事件侧重要素
@ -70,10 +78,23 @@ public class DcEventImportantServiceImpl implements IDcEventImportantService
if (StringUtils.isEmpty(dcEventImportant.getEventId())){
return AjaxResult.error("事件id不能为空");
}
int i = dcEventImportantMapper.updateDcEventImportant(dcEventImportant);
if (i < 1){
DcEventImportant oldData = dcEventImportantMapper.selectDcEventImportantByEventId(dcEventImportant.getEventId());
if (oldData != null){
dcEventImportantMapper.updateDcEventImportant(dcEventImportant);
} else {
dcEventImportantMapper.insertDcEventImportant(dcEventImportant);
}
String context = comparisonInfo(oldData,dcEventImportant);
if (context.length() > 0) {
//事件处置流程记录
DcEventProcess dcEventProcess = new DcEventProcess();
dcEventProcess.setEventId(dcEventImportant.getEventId());
dcEventProcess.setSource(1);
dcEventProcess.setContext(context);
dcEventProcessService.insertDcEventProcess(dcEventProcess);
}
return AjaxResult.success("侧重要素添加成功");
}
@ -100,4 +121,40 @@ public class DcEventImportantServiceImpl implements IDcEventImportantService
{
return dcEventImportantMapper.deleteDcEventImportantByEventId(id);
}
public String comparisonInfo(DcEventImportant oldData, DcEventImportant newData) {
String context = "上报侧重要素,";
if (oldData == null ) {
oldData = new DcEventImportant();
}
Diff diff = new Diff();
List<Result> diffList = diff.diff(JSON.toJSON(oldData).toString(), JSON.toJSON(newData).toString());
for (Result result : diffList) {
if ("ADD".equals(result.getDiffType()) || "MODIFY".equals(result.getDiffType())) {
if ("planStatus".equals(result.getRightPath())
|| "trafficPoliceStatus".equals(result.getRightPath())
|| "medicalStatus".equals(result.getRightPath())
|| "boardStatus".equals(result.getRightPath())
|| "chemicalsStatus".equals(result.getRightPath())
|| "fireStatus".equals(result.getRightPath())) {
if ("0".equals(result.getRight())) {
result.setRight("否");
} else if ("1".equals(result.getRight())) {
result.setRight("是");
}
}
String label = ValueConverter.eventImportantLabel(result.getRightPath());
if (StringUtils.isNotEmpty(label)) {
context = context + label + "修改为:" + result.getRight() + ",";
}
}
}
if (context.length() > 0) {
context = context.substring(0, context.length() - 1);
}
return context;
}
}

77
zc-business/src/main/java/com/zc/business/service/impl/DcEventServiceImpl.java

@ -294,7 +294,39 @@ public class DcEventServiceImpl extends ServiceImpl<DcEventMapper, DcEvent> impl
dcEventMapper.updateDcEventLinkId(dcEvent1);//修改事件性质
}
}
DcEventProcess dcEventProcess = new DcEventProcess();
dcEventProcess.setEventId(dcEventId);
dcEventProcess.setSource(1);
String context = "新增管制事件:";
if ("3-1".equals(dcEvent.getSubclass())){
context += dcEvent.getStakeMark();
if ("1".equals(dcEvent.getDirection())){
context += "菏泽方向";
} else if ("3".equals(dcEvent.getDirection())){
context += "菏泽方向";
}
if (dcEvent.getDcEventTrafficControl().getControlType() == 1){
context += "主线封闭";
} else {
context += "主线限行";
}
} else if ("3-3".equals(dcEvent.getSubclass()) || "3-4".equals(dcEvent.getSubclass())){
String facilityId = String.valueOf(dcEvent.getDcEventTrafficControl().getFacilityId());
DcFacility facility = dcFacilityService.getFacility(facilityId);
context += facility.getFacilityName();
if ("1".equals(dcEvent.getDirection())){
context += "菏泽方向";
} else if ("3".equals(dcEvent.getDirection())){
context += "菏泽方向";
}
if (dcEvent.getDcEventTrafficControl().getControlType() == 1){
context += "封闭";
} else {
context += "限行";
}
}
dcEventProcess.setContext(context);
dcEventProcessService.insertDcEventProcess(dcEventProcess);
break;
}
@ -322,6 +354,27 @@ public class DcEventServiceImpl extends ServiceImpl<DcEventMapper, DcEvent> impl
int i6 = dcEventTrafficControlMapper.insertDcEventTrafficControl(dcEvent.getDcEventTrafficControl());//
//首页事件 交通管制事件 添加 状态默认为 1 处置中
updateDcEventState(dcEvent.getId(), 1);
DcEventProcess dcEventProcess = new DcEventProcess();
dcEventProcess.setEventId(dcEventId);
dcEventProcess.setSource(1);
String context = "新增管制事件:";
String facilityId = String.valueOf(dcEvent.getDcEventTrafficControl().getFacilityIds()[0]);
DcFacility facility = dcFacilityService.getFacility(facilityId);
context += facility.getFacilityName();
if ("1".equals(dcEvent.getDirection())){
context += "菏泽方向";
} else if ("3".equals(dcEvent.getDirection())){
context += "菏泽方向";
}
if (dcEvent.getDcEventTrafficControl().getControlType() == 1){
context += "封闭";
} else {
context += "限行";
}
dcEventProcess.setContext(context);
dcEventProcessService.insertDcEventProcess(dcEventProcess);
} else {
// extracted(dcEvent);//事件推送到 首页
@ -408,6 +461,28 @@ public class DcEventServiceImpl extends ServiceImpl<DcEventMapper, DcEvent> impl
updateDcEventState(map.get("facilityId" + i),1);//直接确认
}
DcEventProcess dcEventProcess = new DcEventProcess();
dcEventProcess.setEventId(dcEventId);
dcEventProcess.setSource(1);
String context = "新增管制事件:";
Long[] facilityIds = dcEvent.getDcEventTrafficControl().getFacilityIds();
for (Long facilityId : facilityIds) {
DcFacility facility = dcFacilityService.getFacility(facilityId.toString());
context += facility.getFacilityName() + "、";
}
context = context.substring(0,context.length() -1);
if ("1".equals(dcEvent.getDirection())){
context += "菏泽方向";
} else if ("3".equals(dcEvent.getDirection())){
context += "菏泽方向";
}
if (dcEvent.getDcEventTrafficControl().getControlType() == 1){
context += "封闭";
} else {
context += "限行";
}
dcEventProcess.setContext(context);
dcEventProcessService.insertDcEventProcess(dcEventProcess);
} else {
dcEventMapper.deleteDcEventById(uuid);//删除添加的事件主类

Loading…
Cancel
Save