Browse Source

Merge remote-tracking branch 'origin/develop' into develop

develop
wangsixiang 10 months ago
parent
commit
9a4e2afbaf
  1. 20
      zc-business/src/main/java/com/zc/business/controller/WeatherForecastController.java
  2. 16
      zc-business/src/main/java/com/zc/business/domain/DcDevice.java
  3. 8
      zc-business/src/main/java/com/zc/business/mapper/DcEventImportantFileMapper.java
  4. 29
      zc-business/src/main/java/com/zc/business/service/impl/DcEmergencyPlansServiceImpl.java
  5. 9
      zc-business/src/main/java/com/zc/business/service/impl/DcEventImportantFileServiceImpl.java
  6. 46
      zc-business/src/main/java/com/zc/business/service/impl/DcEventServiceImpl.java
  7. 3
      zc-business/src/main/resources/mapper/business/DcEventImportantFileMapper.xml

20
zc-business/src/main/java/com/zc/business/controller/WeatherForecastController.java

@ -68,7 +68,7 @@ public class WeatherForecastController extends BaseController {
String[] split1 = split[i].split("[+]");
String k = split1[0].replace("K", "");
int parseInt = Integer.parseInt(k);
numStake.append("K").append(parseInt).append("+000");
numStake.append("K").append(findNearestMultipleOfFive(parseInt)).append("+000");
if (i != split.length - 1) {
numStake.append("|");
}
@ -108,6 +108,24 @@ public class WeatherForecastController extends BaseController {
return AjaxResult.error("请求失败");
}
public static int findNearestMultipleOfFive(int number) {
// 计算除以5的余数
int remainder = number % 5;
// 如果余数为0,则number已经是5的倍数
if (remainder == 0) {
return number;
}
// 如果余数不为0,则最近的5的倍数要么是number减去余数(如果余数小于3),
// 要么是number加上(5 - 余数)(如果余数大于或等于3)
// 这里选择的是较小的那个值(向上或向下取整)
int lowerMultiple = number - remainder;
int higherMultiple = number + (5 - remainder);
// 返回两者中较小的那个
return (lowerMultiple < higherMultiple) ? lowerMultiple : higherMultiple;
}
/*
* 当前气象预警信息查询

16
zc-business/src/main/java/com/zc/business/domain/DcDevice.java

@ -35,8 +35,8 @@ public class DcDevice {
@ApiModelProperty("物联设备ID")
@Excel(name = "物联设备ID")
private String iotDeviceId;
@ApiModelProperty("组ID")
@Excel(name = "组ID")
@ApiModelProperty("所属机构")
//@Excel(name = "所属机构")
private Long groupId;
@ApiModelProperty("产品ID")
@Excel(name = "产品ID")
@ -45,7 +45,7 @@ public class DcDevice {
@Excel(name = "桩号")
private String stakeMark;
@ApiModelProperty("方向1-上行(菏泽方向),2-中,3-下行(济南方向)")
@Excel(name = "方向")
@Excel(name = "方向", readConverterExp = "1=菏泽方向,3=济南方向")
private String direction;
@ApiModelProperty("设备名称")
@Excel(name = "设备名称")
@ -54,7 +54,7 @@ public class DcDevice {
@Excel(name = "设备编号")
private String deviceCode;
@ApiModelProperty("设备类型")
@Excel(name = "设备类型")
@Excel(name = "设备类型", readConverterExp = "1=摄像机,2=可变信息标志,3=气象监测器,4=出口诱导灯,5=路段语音广播,6=护栏碰撞,7=毫米波雷达,8=合流区预警,9=智慧锥桶,10=激光疲劳唤醒,11=一类交通量调查站,12=行车诱导,13=智能设备箱,14=光线在线监测,15=太阳能板,16=远端机")
private String deviceType;
@ApiModelProperty("所属网段")
@Excel(name = "所属网段")
@ -75,10 +75,10 @@ public class DcDevice {
@Excel(name = "安装位置")
private String installationSite;
@ApiModelProperty("设备状态")
@Excel(name = "设备状态")
@Excel(name = "设备状态", readConverterExp = "0=异常,1=正常")
private String deviceState;
@ApiModelProperty("使用状态")
@Excel(name = "使用状态")
@Excel(name = "使用状态", readConverterExp = "0=使用中,1=未使用")
private Integer useState;
@ApiModelProperty("其他配置")
@Excel(name = "其他配置")
@ -87,7 +87,7 @@ public class DcDevice {
@Excel(name = "备注")
private String remark;
@ApiModelProperty("设施归属类型(0:默认1: 道路沿线2:桥梁3: 隧道4:收费广场5: 收费站6: 服务区等")
@Excel(name = "设施归属类型")
@Excel(name = "设施归属类型", readConverterExp = "0=默认,1=道路沿线,2=桥梁,3=隧道,4=收费广场,5=收费站,6=服务区")
private String facilitiesType;
@ApiModelProperty("设备ip")
@Excel(name = "设备ip")
@ -102,7 +102,7 @@ public class DcDevice {
@Excel(name = "修改时间")
private Date updateTime;
@ApiModelProperty("子类型")
@Excel(name = "子类型")
@Excel(name = "子类型", readConverterExp = "1-1=高清网络枪型固定摄像机,1-2=高清网络球形摄像机,1-3=桥下高清网络球形摄像机,1-4=360°全景摄像机,1-5=180°全景摄像机,2-1=门架式可变信息标志,2-2=站前可变信息标志,2-3=雨棚可变信息标志,2-4=站前悬臂式可变信息标")
private String childType;
@TableField(exist = false)
private String longitude;

8
zc-business/src/main/java/com/zc/business/mapper/DcEventImportantFileMapper.java

@ -68,4 +68,12 @@ public interface DcEventImportantFileMapper
* @return 结果
*/
int getImportantFileStatus(String eventId);
/**
* 获取重要事件的上报状态
*
* @param dcEventImportantFile 事件
* @return 结果
*/
int selectStatus(DcEventImportantFile dcEventImportantFile);
}

29
zc-business/src/main/java/com/zc/business/service/impl/DcEmergencyPlansServiceImpl.java

@ -79,7 +79,9 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService {
.filter(dcEmergencyPlans1 -> StringUtils.isNotEmpty(dcEmergencyPlans1.getControllableDevice()))
.forEach(dcEmergencyPlans1 -> {
List<String> deviceIds = Arrays.asList(dcEmergencyPlans1.getControllableDevice().split(","));
List<DcDevice> deviceList = dcDeviceService.listByIds(deviceIds);
LambdaQueryWrapper<DcDevice> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.in(DcDevice::getIotDeviceId, deviceIds);
List<DcDevice> deviceList = dcDeviceService.list(lambdaQueryWrapper);
StringBuilder stringBuilder = new StringBuilder();
deviceList.forEach(dcDevice -> {
stringBuilder.append(",");
@ -485,7 +487,12 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService {
}
});
if (dcDevices.size() > 0) {
dcDevices = dcDevices.subList(0, dcExecuteAction.getNumber());
if (dcExecuteAction.getNumber() > dcDevices.size()) {
dcDevices = dcDevices.subList(0, dcDevices.size());
}else {
dcDevices = dcDevices.subList(0, dcExecuteAction.getNumber());
}
}
} else {
// 下行 取最小的几个
@ -503,7 +510,11 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService {
}
});
if (dcDevices.size() > 0) {
dcDevices = dcDevices.subList(0, dcExecuteAction.getNumber());
if (dcExecuteAction.getNumber() > dcDevices.size()) {
dcDevices = dcDevices.subList(0, dcDevices.size());
}else {
dcDevices = dcDevices.subList(0, dcExecuteAction.getNumber());
}
}
}
@ -525,7 +536,11 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService {
}
});
if (dcDevices.size() > 0) {
dcDevices = dcDevices.subList(0, dcExecuteAction.getNumber());
if (dcExecuteAction.getNumber() > dcDevices.size()) {
dcDevices = dcDevices.subList(0, dcDevices.size());
}else {
dcDevices = dcDevices.subList(0, dcExecuteAction.getNumber());
}
}
} else {
@ -545,7 +560,11 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService {
});
// 需要对查出的设备,按照桩号进行排序从小到大
if (dcDevices.size() > 0) {
dcDevices = dcDevices.subList(0, dcExecuteAction.getNumber());
if (dcExecuteAction.getNumber() > dcDevices.size()) {
dcDevices = dcDevices.subList(0, dcDevices.size());
}else {
dcDevices = dcDevices.subList(0, dcExecuteAction.getNumber());
}
}
}
} else {

9
zc-business/src/main/java/com/zc/business/service/impl/DcEventImportantFileServiceImpl.java

@ -62,6 +62,15 @@ public class DcEventImportantFileServiceImpl implements IDcEventImportantFileSer
@Override
public List<DcEventImportantFile> selectDcEventImportantFileList(DcEventImportantFile dcEventImportantFile)
{
int type = dcEventImportantFileMapper.getImportantFileStatus(dcEventImportantFile.getEventId());
//已初报待续报的, 如果查初报只能查上报了的
if ((type == 1 || type == 2) && dcEventImportantFile.getType().equals("1")){
dcEventImportantFile.setStatus("1");
} else if (type == 3){
//已终报的, 不管查什么类型的都只能查已上报状态的
dcEventImportantFile.setStatus("1");
}
return dcEventImportantFileMapper.selectDcEventImportantFileList(dcEventImportantFile);
}

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

@ -160,6 +160,10 @@ public class DcEventServiceImpl extends ServiceImpl<DcEventMapper, DcEvent> impl
dcEvent.setCreateTime(DateUtils.getNowDate());
if (eventType != 1 && eventType != 2){
dcEvent.setOccurrenceTime(DateUtils.getNowDate());//默认发生时间
}
//处理无桩号事件
//交通事故
if (eventType == 1 && dcEvent.getDcEventAccident().getFacilityId() != null) {
@ -221,6 +225,9 @@ public class DcEventServiceImpl extends ServiceImpl<DcEventMapper, DcEvent> impl
dcEvent.getDcEventAccident().setId(uuid);
int i1 = dcEventAccidentMapper.insertDcEventAccident(dcEvent.getDcEventAccident());
if (dcEvent.getEventState() ==1){
updateDcEventState(uuid,1);//直接确认
}
}
break;
//车辆事故
@ -228,6 +235,9 @@ public class DcEventServiceImpl extends ServiceImpl<DcEventMapper, DcEvent> impl
if (dcEvent.getDcEventVehicleAccident() != null) {
dcEvent.getDcEventVehicleAccident().setId(uuid);
int i5 = dcEventVehicleAccidentMapper.insertDcEventVehicleAccident(dcEvent.getDcEventVehicleAccident());
if (dcEvent.getEventState() ==1){
updateDcEventState(uuid,1);//直接确认
}
}
break;
//交通管制
@ -239,12 +249,13 @@ public class DcEventServiceImpl extends ServiceImpl<DcEventMapper, DcEvent> impl
if (dcEvent.getDcEventTrafficControl().getFacilityIds() == null) {
dcEvent.getDcEventTrafficControl().setId(uuid);
int i6 = dcEventTrafficControlMapper.insertDcEventTrafficControl(dcEvent.getDcEventTrafficControl());
updateDcEventState(uuid,1);//直接确认
break;
}
}
//事件处置页
if (dcEvent.getEventState() == 1 && dcEvent.getDcEventTrafficControl().getFacilityIds() == null) {//新增的数据不是收费站
updateDcEventState(dcEvent.getId(), 1);
updateDcEventState(dcEvent.getId(), 1);//直接确认
dcEvent.getDcEventTrafficControl().setId(uuid);
int i6 = dcEventTrafficControlMapper.insertDcEventTrafficControl(dcEvent.getDcEventTrafficControl());
//查询事件
@ -264,7 +275,9 @@ public class DcEventServiceImpl extends ServiceImpl<DcEventMapper, DcEvent> impl
dcEvent1.setId(dcEventId);//事件id
if (dcEvent2.getEventType() != 3) {
dcEvent1.setEventNature(1l);//首发事件
dcEvent1.setLinkId(dcEvent2.getLinkId() + "," + uuid);//关联管制事件id
dcEventMapper.updateDcEventLinkId(dcEvent1);//修改事件性质
}
}
@ -282,7 +295,11 @@ public class DcEventServiceImpl extends ServiceImpl<DcEventMapper, DcEvent> impl
dcEvent1.setId(dcEventId);//事件id
if (dcEvent2.getEventType() != 3) {
dcEvent1.setEventNature(1l);//首发事件
dcEvent1.setLinkId(dcEvent2.getLinkId()+","+uuid);//关联管制事件id
if (dcEvent2.getLinkId()!=null) {
dcEvent1.setLinkId(dcEvent2.getLinkId()+","+uuid);//关联管制事件id
}else {
dcEvent1.setLinkId(uuid);//关联管制事件id
}
dcEventMapper.updateDcEventLinkId(dcEvent1);//修改事件性质
}
@ -298,6 +315,8 @@ public class DcEventServiceImpl extends ServiceImpl<DcEventMapper, DcEvent> impl
dcEvent.getDcEventTrafficControl().setId(uuid);
dcEvent.getDcEventTrafficControl().setFacilityId(dcEvent.getDcEventTrafficControl().getFacilityIds()[0]);//取出数组字段赋值 设施id
int i6 = dcEventTrafficControlMapper.insertDcEventTrafficControl(dcEvent.getDcEventTrafficControl());
updateDcEventState(uuid,1);//直接确认
}
} else if (dcEvent.getDcEventTrafficControl().getFacilityIds().length > 1) {//facilityIds1=1 说明只选择了多个收费站
@ -327,7 +346,11 @@ public class DcEventServiceImpl extends ServiceImpl<DcEventMapper, DcEvent> impl
a++;
}
String linkId2 = sb2.toString();
dcEvent1.setLinkId(dcEvent2.getLinkId()+","+linkId2);//关联管制事件id
if (dcEvent2.getLinkId() !=null){
dcEvent1.setLinkId(dcEvent2.getLinkId()+","+linkId2);//关联管制事件id
}else {
dcEvent1.setLinkId(linkId2);//关联管制事件id
}
if (dcEvent2.getEventType() != 3) {
dcEventMapper.updateDcEventLinkId(dcEvent1);//修改事件性质
@ -365,11 +388,13 @@ public class DcEventServiceImpl extends ServiceImpl<DcEventMapper, DcEvent> impl
String facilityId = String.valueOf(dcEvent.getDcEventTrafficControl().getFacilityIds()[i]);
dcEvent.setStakeMark(extracted(facilityId));
}
dcEvent.setOccurrenceTime(DateUtils.getNowDate());//默认发生时间
dcEventMapper.insertDcEvent(dcEvent);
//首页事件 交通管制事件 添加 状态默认为 1 处置中
updateDcEventState(map.get("facilityId" + i), 1);
int i6 = dcEventTrafficControlMapper.insertDcEventTrafficControl(dcEvent.getDcEventTrafficControl());
updateDcEventState(map.get("facilityId" + i),1);//直接确认
}
} else {
@ -419,10 +444,12 @@ public class DcEventServiceImpl extends ServiceImpl<DcEventMapper, DcEvent> impl
dcEvent.setStakeMark(extracted(facilityId));
}
dcEvent.setOccurrenceTime(DateUtils.getNowDate());//默认发生时间
dcEventMapper.insertDcEvent(dcEvent);
extracted(dcEvent);
int i6 = dcEventTrafficControlMapper.insertDcEventTrafficControl(dcEvent.getDcEventTrafficControl());
updateDcEventState(map.get("facilityId" + i),1);//直接确认
}
}
}
@ -436,6 +463,9 @@ public class DcEventServiceImpl extends ServiceImpl<DcEventMapper, DcEvent> impl
if (dcEvent.getDcEventTrafficCongestion() != null) {
dcEvent.getDcEventTrafficCongestion().setId(uuid);
int i4 = dcEventTrafficCongestionMapper.insertDcEventTrafficCongestion(dcEvent.getDcEventTrafficCongestion());
updateDcEventState(uuid,1);//直接确认
}
break;
@ -450,6 +480,8 @@ public class DcEventServiceImpl extends ServiceImpl<DcEventMapper, DcEvent> impl
if (dcEvent.getDcEventConstruction() != null) {
dcEvent.getDcEventConstruction().setId(uuid);
int i2 = dcEventConstructionMapper.insertDcEventConstruction(dcEvent.getDcEventConstruction());
updateDcEventState(uuid,1);//直接确认
}
break;
@ -458,6 +490,8 @@ public class DcEventServiceImpl extends ServiceImpl<DcEventMapper, DcEvent> impl
if (dcEvent.getDcEventServiceArea() != null) {
dcEvent.getDcEventServiceArea().setId(uuid);
int i3 = dcEventServiceAreaMapper.insertDcEventServiceArea(dcEvent.getDcEventServiceArea());
updateDcEventState(uuid,1);//直接确认
}
break;
//设施设备隐患
@ -468,6 +502,8 @@ public class DcEventServiceImpl extends ServiceImpl<DcEventMapper, DcEvent> impl
if (dcEvent.getDcEventAbnormalWeather() != null) {
dcEvent.getDcEventAbnormalWeather().setId(uuid);
int i = dcEventAbnormalWeatherMapper.insertDcEventAbnormalWeather(dcEvent.getDcEventAbnormalWeather());
updateDcEventState(uuid,1);//直接确认
}
break;
//其他事件
@ -481,6 +517,7 @@ public class DcEventServiceImpl extends ServiceImpl<DcEventMapper, DcEvent> impl
dcEventMapper.updateDcEventLinkId(dcEvent1);//修改事件性质
dcEvent.setEventNature(2l);
dcEventMapper.updateDcEventLinkId(dcEvent);//修改 新添加的 事件性质
updateDcEventState(uuid,1);//直接确认
}
break;
@ -783,6 +820,7 @@ public class DcEventServiceImpl extends ServiceImpl<DcEventMapper, DcEvent> impl
* @return 结果
*/
@Override
public int updateDcEvent(DcEvent dcEvent) {
/*
//事件类型校验

3
zc-business/src/main/resources/mapper/business/DcEventImportantFileMapper.xml

@ -48,6 +48,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
FROM `dc_event_important_file`
where event_id = #{eventId} and status = '1'
</select>
<select id="selectStatus" parameterType="DcEventImportantFile" resultType="java.lang.Integer">
select IFNULL(max(status),0) status from dc_event_important_file where event_id = #{eventId} and type = #{type}
</select>
<insert id="insertDcEventImportantFile" parameterType="DcEventImportantFile" useGeneratedKeys="true" keyProperty="id">
insert into dc_event_important_file

Loading…
Cancel
Save