优化
This commit is contained in:
parent
49254d02a2
commit
b2cb99885d
@ -1,6 +1,8 @@
|
|||||||
package com.xkrs.straw.service.impl;
|
package com.xkrs.straw.service.impl;
|
||||||
|
|
||||||
import com.xkrs.common.encapsulation.PromptMessageEnum;
|
import com.xkrs.common.encapsulation.PromptMessageEnum;
|
||||||
|
import com.xkrs.dao.StreetDao;
|
||||||
|
import com.xkrs.model.entity.StreetEntity;
|
||||||
import com.xkrs.straw.dao.FirePointChannelConfigDao;
|
import com.xkrs.straw.dao.FirePointChannelConfigDao;
|
||||||
import com.xkrs.straw.dao.FirePointOrdinaryDao;
|
import com.xkrs.straw.dao.FirePointOrdinaryDao;
|
||||||
import com.xkrs.straw.dao.FirePointPreciseDao;
|
import com.xkrs.straw.dao.FirePointPreciseDao;
|
||||||
@ -46,15 +48,18 @@ public class DispatchFirePointServiceImpl implements DispatchFirePointService {
|
|||||||
@Resource
|
@Resource
|
||||||
private FirePointPreciseDao firePointPreciseDao;
|
private FirePointPreciseDao firePointPreciseDao;
|
||||||
|
|
||||||
@Resource
|
|
||||||
private SysUserDao sysUserDao;
|
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private FirePointQueryManager firePointQueryManager;
|
private FirePointQueryManager firePointQueryManager;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private FirePointPushManager firePointPushManager;
|
private FirePointPushManager firePointPushManager;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private SysUserDao sysUserDao;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private StreetDao streetDao;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 普通渠道推送火点到秸秆系统
|
* 普通渠道推送火点到秸秆系统
|
||||||
*/
|
*/
|
||||||
@ -74,8 +79,6 @@ public class DispatchFirePointServiceImpl implements DispatchFirePointService {
|
|||||||
String messagePrecise = "";
|
String messagePrecise = "";
|
||||||
|
|
||||||
String fireCode = firePointQo.getFireCode();
|
String fireCode = firePointQo.getFireCode();
|
||||||
Long countyCode = firePointQo.getCountyCode();
|
|
||||||
String countyName = firePointQo.getCountyName();
|
|
||||||
Long satelliteTimeTs = firePointQo.getSatelliteTimeTs();
|
Long satelliteTimeTs = firePointQo.getSatelliteTimeTs();
|
||||||
Double longitude = firePointQo.getLongitude();
|
Double longitude = firePointQo.getLongitude();
|
||||||
Double latitude = firePointQo.getLatitude();
|
Double latitude = firePointQo.getLatitude();
|
||||||
@ -84,6 +87,8 @@ public class DispatchFirePointServiceImpl implements DispatchFirePointService {
|
|||||||
String confidence = firePointQo.getConfidence();
|
String confidence = firePointQo.getConfidence();
|
||||||
String fireImage = firePointQo.getFireImage();
|
String fireImage = firePointQo.getFireImage();
|
||||||
String satelliteImage = firePointQo.getSatelliteImage();
|
String satelliteImage = firePointQo.getSatelliteImage();
|
||||||
|
String countyCode = String.valueOf(firePointQo.getCountyCode());
|
||||||
|
String countyName = firePointQo.getCountyName();
|
||||||
String townCode = firePointQo.getTownCode();
|
String townCode = firePointQo.getTownCode();
|
||||||
|
|
||||||
LocalDateTime satelliteLocalDateTime = LocalDateTime.ofEpochSecond(satelliteTimeTs, 0, ZoneOffset.ofHours(8));
|
LocalDateTime satelliteLocalDateTime = LocalDateTime.ofEpochSecond(satelliteTimeTs, 0, ZoneOffset.ofHours(8));
|
||||||
@ -91,28 +96,37 @@ public class DispatchFirePointServiceImpl implements DispatchFirePointService {
|
|||||||
String addTime = DateTimeUtils.localDateTimeToString(LocalDateTime.now());//添加时间
|
String addTime = DateTimeUtils.localDateTimeToString(LocalDateTime.now());//添加时间
|
||||||
|
|
||||||
//普通渠道来的火点直接入库普通火点库
|
//普通渠道来的火点直接入库普通火点库
|
||||||
FirePointOrdinaryEntity firePointOrdinaryEntity = new FirePointOrdinaryEntity();
|
{
|
||||||
firePointOrdinaryEntity.setFireCode(fireCode);
|
FirePointOrdinaryEntity firePointOrdinaryEntity = new FirePointOrdinaryEntity();
|
||||||
firePointOrdinaryEntity.setSatelliteTime(satelliteTime);
|
firePointOrdinaryEntity.setFireCode(fireCode);
|
||||||
firePointOrdinaryEntity.setLongitude(longitude);
|
firePointOrdinaryEntity.setSatelliteTime(satelliteTime);
|
||||||
firePointOrdinaryEntity.setLatitude(latitude);
|
firePointOrdinaryEntity.setLongitude(longitude);
|
||||||
firePointOrdinaryEntity.setSatelliteType(satelliteType);
|
firePointOrdinaryEntity.setLatitude(latitude);
|
||||||
firePointOrdinaryEntity.setLandType(landType);
|
firePointOrdinaryEntity.setSatelliteType(satelliteType);
|
||||||
firePointOrdinaryEntity.setConfidence(confidence);
|
firePointOrdinaryEntity.setLandType(landType);
|
||||||
firePointOrdinaryEntity.setFireImage(fireImage);
|
firePointOrdinaryEntity.setConfidence(confidence);
|
||||||
firePointOrdinaryEntity.setSatelliteImage(satelliteImage);
|
firePointOrdinaryEntity.setFireImage(fireImage);
|
||||||
firePointOrdinaryEntity.setTownCode(townCode);
|
firePointOrdinaryEntity.setSatelliteImage(satelliteImage);
|
||||||
firePointOrdinaryEntity.setAddTime(addTime);
|
firePointOrdinaryEntity.setAddTime(addTime);
|
||||||
firePointOrdinaryEntity.setCountyCode(String.valueOf(countyCode));
|
StreetEntity streetEntity = obtainInfoByCountyCode(countyCode);
|
||||||
firePointOrdinaryEntity.setCountyName(countyName);
|
if (streetEntity != null) {
|
||||||
bindFirePointAddress(firePointOrdinaryEntity);
|
firePointOrdinaryEntity.setProCode(streetEntity.getProCode().substring(0, 2));
|
||||||
DataWrapper2<Boolean, String> checkDuplicatedWrapper1 = FirePointFilterUtils.checkDuplicated(firePointOrdinaryDao, firePointOrdinaryEntity);
|
firePointOrdinaryEntity.setProName(streetEntity.getProName());
|
||||||
if (checkDuplicatedWrapper1.getData1()) {
|
firePointOrdinaryEntity.setCityCode(streetEntity.getCityCode().substring(0, 4));
|
||||||
messageOrdinary = checkDuplicatedWrapper1.getData2();
|
firePointOrdinaryEntity.setCityName(streetEntity.getCityName());
|
||||||
} else {
|
}
|
||||||
messageOrdinary = "普通火点添加成功";
|
firePointOrdinaryEntity.setCountyCode(countyCode);
|
||||||
firePointOrdinaryDao.save(firePointOrdinaryEntity);
|
firePointOrdinaryEntity.setCountyName(countyName);
|
||||||
firePointPushManager.pushNotification(firePointOrdinaryEntity);
|
firePointOrdinaryEntity.setTownCode(townCode);
|
||||||
|
bindFirePointAddress(firePointOrdinaryEntity);
|
||||||
|
DataWrapper2<Boolean, String> checkDuplicatedWrapper1 = FirePointFilterUtils.checkDuplicated(firePointOrdinaryDao, firePointOrdinaryEntity);
|
||||||
|
if (checkDuplicatedWrapper1.getData1()) {
|
||||||
|
messageOrdinary = checkDuplicatedWrapper1.getData2();
|
||||||
|
} else {
|
||||||
|
messageOrdinary = "普通火点添加成功";
|
||||||
|
firePointOrdinaryDao.save(firePointOrdinaryEntity);
|
||||||
|
firePointPushManager.pushNotification(firePointOrdinaryEntity);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
List<FirePointChannelConfigEntity> firePointChannelConfigEntityList = channelConfigDao.findAll();
|
List<FirePointChannelConfigEntity> firePointChannelConfigEntityList = channelConfigDao.findAll();
|
||||||
boolean inPreciseTimeRange = FirePointDispatchUtils.ifInFireSeason(fireCode, satelliteLocalDateTime, firePointChannelConfigEntityList);
|
boolean inPreciseTimeRange = FirePointDispatchUtils.ifInFireSeason(fireCode, satelliteLocalDateTime, firePointChannelConfigEntityList);
|
||||||
@ -128,10 +142,17 @@ public class DispatchFirePointServiceImpl implements DispatchFirePointService {
|
|||||||
firePointPreciseEntity.setConfidence(confidence);
|
firePointPreciseEntity.setConfidence(confidence);
|
||||||
firePointPreciseEntity.setFireImage(fireImage);
|
firePointPreciseEntity.setFireImage(fireImage);
|
||||||
firePointPreciseEntity.setSatelliteImage(satelliteImage);
|
firePointPreciseEntity.setSatelliteImage(satelliteImage);
|
||||||
firePointPreciseEntity.setTownCode(townCode);
|
|
||||||
firePointPreciseEntity.setAddTime(addTime);
|
firePointPreciseEntity.setAddTime(addTime);
|
||||||
firePointPreciseEntity.setCountyCode(String.valueOf(countyCode));
|
StreetEntity streetEntity = obtainInfoByCountyCode(countyCode);
|
||||||
|
if (streetEntity != null) {
|
||||||
|
firePointPreciseEntity.setProCode(streetEntity.getProCode().substring(0, 2));
|
||||||
|
firePointPreciseEntity.setProName(streetEntity.getProName());
|
||||||
|
firePointPreciseEntity.setCityCode(streetEntity.getCityCode().substring(0, 4));
|
||||||
|
firePointPreciseEntity.setCityName(streetEntity.getCityName());
|
||||||
|
}
|
||||||
|
firePointPreciseEntity.setCountyCode(countyCode);
|
||||||
firePointPreciseEntity.setCountyName(countyName);
|
firePointPreciseEntity.setCountyName(countyName);
|
||||||
|
firePointPreciseEntity.setTownCode(townCode);
|
||||||
bindFirePointAddress(firePointPreciseEntity);
|
bindFirePointAddress(firePointPreciseEntity);
|
||||||
DataWrapper2<Boolean, String> checkDuplicatedWrapper2 = FirePointFilterUtils.checkDuplicated(firePointPreciseDao, firePointPreciseEntity);
|
DataWrapper2<Boolean, String> checkDuplicatedWrapper2 = FirePointFilterUtils.checkDuplicated(firePointPreciseDao, firePointPreciseEntity);
|
||||||
if (checkDuplicatedWrapper2.getData1()) {
|
if (checkDuplicatedWrapper2.getData1()) {
|
||||||
@ -145,6 +166,15 @@ public class DispatchFirePointServiceImpl implements DispatchFirePointService {
|
|||||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, messageOrdinary + messagePrecise, locale);
|
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, messageOrdinary + messagePrecise, locale);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private StreetEntity obtainInfoByCountyCode(String countyCode) {
|
||||||
|
try {
|
||||||
|
return streetDao.findByCountyCode(countyCode).get(0);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 精准渠道推送火点到秸秆系统
|
* 精准渠道推送火点到秸秆系统
|
||||||
*/
|
*/
|
||||||
@ -163,8 +193,6 @@ public class DispatchFirePointServiceImpl implements DispatchFirePointService {
|
|||||||
String messagePrecise = "";
|
String messagePrecise = "";
|
||||||
|
|
||||||
String fireCode = firePointQo.getFireCode();
|
String fireCode = firePointQo.getFireCode();
|
||||||
Long countyCode = firePointQo.getCountyCode();
|
|
||||||
String countyName = firePointQo.getCountyName();
|
|
||||||
Long satelliteTimeTs = firePointQo.getSatelliteTimeTs();
|
Long satelliteTimeTs = firePointQo.getSatelliteTimeTs();
|
||||||
Double longitude = firePointQo.getLongitude();
|
Double longitude = firePointQo.getLongitude();
|
||||||
Double latitude = firePointQo.getLatitude();
|
Double latitude = firePointQo.getLatitude();
|
||||||
@ -173,6 +201,8 @@ public class DispatchFirePointServiceImpl implements DispatchFirePointService {
|
|||||||
String confidence = firePointQo.getConfidence();
|
String confidence = firePointQo.getConfidence();
|
||||||
String fireImage = firePointQo.getFireImage();
|
String fireImage = firePointQo.getFireImage();
|
||||||
String satelliteImage = firePointQo.getSatelliteImage();
|
String satelliteImage = firePointQo.getSatelliteImage();
|
||||||
|
String countyCode = String.valueOf(firePointQo.getCountyCode());
|
||||||
|
String countyName = firePointQo.getCountyName();
|
||||||
String townCode = firePointQo.getTownCode();
|
String townCode = firePointQo.getTownCode();
|
||||||
|
|
||||||
LocalDateTime satelliteLocalDateTime = LocalDateTime.ofEpochSecond(satelliteTimeTs, 0, ZoneOffset.ofHours(8));
|
LocalDateTime satelliteLocalDateTime = LocalDateTime.ofEpochSecond(satelliteTimeTs, 0, ZoneOffset.ofHours(8));
|
||||||
@ -193,10 +223,17 @@ public class DispatchFirePointServiceImpl implements DispatchFirePointService {
|
|||||||
firePointPreciseEntity.setConfidence(confidence);
|
firePointPreciseEntity.setConfidence(confidence);
|
||||||
firePointPreciseEntity.setFireImage(fireImage);
|
firePointPreciseEntity.setFireImage(fireImage);
|
||||||
firePointPreciseEntity.setSatelliteImage(satelliteImage);
|
firePointPreciseEntity.setSatelliteImage(satelliteImage);
|
||||||
firePointPreciseEntity.setTownCode(townCode);
|
|
||||||
firePointPreciseEntity.setAddTime(addTime);
|
firePointPreciseEntity.setAddTime(addTime);
|
||||||
firePointPreciseEntity.setCountyCode(String.valueOf(countyCode));
|
StreetEntity streetEntity = obtainInfoByCountyCode(countyCode);
|
||||||
|
if (streetEntity != null) {
|
||||||
|
firePointPreciseEntity.setProCode(streetEntity.getProCode().substring(0, 2));
|
||||||
|
firePointPreciseEntity.setProName(streetEntity.getProName());
|
||||||
|
firePointPreciseEntity.setCityCode(streetEntity.getCityCode().substring(0, 4));
|
||||||
|
firePointPreciseEntity.setCityName(streetEntity.getCityName());
|
||||||
|
}
|
||||||
|
firePointPreciseEntity.setCountyCode(countyCode);
|
||||||
firePointPreciseEntity.setCountyName(countyName);
|
firePointPreciseEntity.setCountyName(countyName);
|
||||||
|
firePointPreciseEntity.setTownCode(townCode);
|
||||||
bindFirePointAddress(firePointPreciseEntity);
|
bindFirePointAddress(firePointPreciseEntity);
|
||||||
DataWrapper2<Boolean, String> checkDuplicatedWrapper2 = FirePointFilterUtils.checkDuplicated(firePointPreciseDao, firePointPreciseEntity);
|
DataWrapper2<Boolean, String> checkDuplicatedWrapper2 = FirePointFilterUtils.checkDuplicated(firePointPreciseDao, firePointPreciseEntity);
|
||||||
if (checkDuplicatedWrapper2.getData1()) {
|
if (checkDuplicatedWrapper2.getData1()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user