优化
This commit is contained in:
parent
49254d02a2
commit
b2cb99885d
@ -1,6 +1,8 @@
|
||||
package com.xkrs.straw.service.impl;
|
||||
|
||||
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.FirePointOrdinaryDao;
|
||||
import com.xkrs.straw.dao.FirePointPreciseDao;
|
||||
@ -46,15 +48,18 @@ public class DispatchFirePointServiceImpl implements DispatchFirePointService {
|
||||
@Resource
|
||||
private FirePointPreciseDao firePointPreciseDao;
|
||||
|
||||
@Resource
|
||||
private SysUserDao sysUserDao;
|
||||
|
||||
@Resource
|
||||
private FirePointQueryManager firePointQueryManager;
|
||||
|
||||
@Resource
|
||||
private FirePointPushManager firePointPushManager;
|
||||
|
||||
@Resource
|
||||
private SysUserDao sysUserDao;
|
||||
|
||||
@Resource
|
||||
private StreetDao streetDao;
|
||||
|
||||
/**
|
||||
* 普通渠道推送火点到秸秆系统
|
||||
*/
|
||||
@ -74,8 +79,6 @@ public class DispatchFirePointServiceImpl implements DispatchFirePointService {
|
||||
String messagePrecise = "";
|
||||
|
||||
String fireCode = firePointQo.getFireCode();
|
||||
Long countyCode = firePointQo.getCountyCode();
|
||||
String countyName = firePointQo.getCountyName();
|
||||
Long satelliteTimeTs = firePointQo.getSatelliteTimeTs();
|
||||
Double longitude = firePointQo.getLongitude();
|
||||
Double latitude = firePointQo.getLatitude();
|
||||
@ -84,6 +87,8 @@ public class DispatchFirePointServiceImpl implements DispatchFirePointService {
|
||||
String confidence = firePointQo.getConfidence();
|
||||
String fireImage = firePointQo.getFireImage();
|
||||
String satelliteImage = firePointQo.getSatelliteImage();
|
||||
String countyCode = String.valueOf(firePointQo.getCountyCode());
|
||||
String countyName = firePointQo.getCountyName();
|
||||
String townCode = firePointQo.getTownCode();
|
||||
|
||||
LocalDateTime satelliteLocalDateTime = LocalDateTime.ofEpochSecond(satelliteTimeTs, 0, ZoneOffset.ofHours(8));
|
||||
@ -91,6 +96,7 @@ public class DispatchFirePointServiceImpl implements DispatchFirePointService {
|
||||
String addTime = DateTimeUtils.localDateTimeToString(LocalDateTime.now());//添加时间
|
||||
|
||||
//普通渠道来的火点直接入库普通火点库
|
||||
{
|
||||
FirePointOrdinaryEntity firePointOrdinaryEntity = new FirePointOrdinaryEntity();
|
||||
firePointOrdinaryEntity.setFireCode(fireCode);
|
||||
firePointOrdinaryEntity.setSatelliteTime(satelliteTime);
|
||||
@ -101,10 +107,17 @@ public class DispatchFirePointServiceImpl implements DispatchFirePointService {
|
||||
firePointOrdinaryEntity.setConfidence(confidence);
|
||||
firePointOrdinaryEntity.setFireImage(fireImage);
|
||||
firePointOrdinaryEntity.setSatelliteImage(satelliteImage);
|
||||
firePointOrdinaryEntity.setTownCode(townCode);
|
||||
firePointOrdinaryEntity.setAddTime(addTime);
|
||||
firePointOrdinaryEntity.setCountyCode(String.valueOf(countyCode));
|
||||
StreetEntity streetEntity = obtainInfoByCountyCode(countyCode);
|
||||
if (streetEntity != null) {
|
||||
firePointOrdinaryEntity.setProCode(streetEntity.getProCode().substring(0, 2));
|
||||
firePointOrdinaryEntity.setProName(streetEntity.getProName());
|
||||
firePointOrdinaryEntity.setCityCode(streetEntity.getCityCode().substring(0, 4));
|
||||
firePointOrdinaryEntity.setCityName(streetEntity.getCityName());
|
||||
}
|
||||
firePointOrdinaryEntity.setCountyCode(countyCode);
|
||||
firePointOrdinaryEntity.setCountyName(countyName);
|
||||
firePointOrdinaryEntity.setTownCode(townCode);
|
||||
bindFirePointAddress(firePointOrdinaryEntity);
|
||||
DataWrapper2<Boolean, String> checkDuplicatedWrapper1 = FirePointFilterUtils.checkDuplicated(firePointOrdinaryDao, firePointOrdinaryEntity);
|
||||
if (checkDuplicatedWrapper1.getData1()) {
|
||||
@ -114,6 +127,7 @@ public class DispatchFirePointServiceImpl implements DispatchFirePointService {
|
||||
firePointOrdinaryDao.save(firePointOrdinaryEntity);
|
||||
firePointPushManager.pushNotification(firePointOrdinaryEntity);
|
||||
}
|
||||
}
|
||||
List<FirePointChannelConfigEntity> firePointChannelConfigEntityList = channelConfigDao.findAll();
|
||||
boolean inPreciseTimeRange = FirePointDispatchUtils.ifInFireSeason(fireCode, satelliteLocalDateTime, firePointChannelConfigEntityList);
|
||||
//如果现在不属于精准渠道的时间范围,那么普通渠道来的火点就入库精准火点库
|
||||
@ -128,10 +142,17 @@ public class DispatchFirePointServiceImpl implements DispatchFirePointService {
|
||||
firePointPreciseEntity.setConfidence(confidence);
|
||||
firePointPreciseEntity.setFireImage(fireImage);
|
||||
firePointPreciseEntity.setSatelliteImage(satelliteImage);
|
||||
firePointPreciseEntity.setTownCode(townCode);
|
||||
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.setTownCode(townCode);
|
||||
bindFirePointAddress(firePointPreciseEntity);
|
||||
DataWrapper2<Boolean, String> checkDuplicatedWrapper2 = FirePointFilterUtils.checkDuplicated(firePointPreciseDao, firePointPreciseEntity);
|
||||
if (checkDuplicatedWrapper2.getData1()) {
|
||||
@ -145,6 +166,15 @@ public class DispatchFirePointServiceImpl implements DispatchFirePointService {
|
||||
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 fireCode = firePointQo.getFireCode();
|
||||
Long countyCode = firePointQo.getCountyCode();
|
||||
String countyName = firePointQo.getCountyName();
|
||||
Long satelliteTimeTs = firePointQo.getSatelliteTimeTs();
|
||||
Double longitude = firePointQo.getLongitude();
|
||||
Double latitude = firePointQo.getLatitude();
|
||||
@ -173,6 +201,8 @@ public class DispatchFirePointServiceImpl implements DispatchFirePointService {
|
||||
String confidence = firePointQo.getConfidence();
|
||||
String fireImage = firePointQo.getFireImage();
|
||||
String satelliteImage = firePointQo.getSatelliteImage();
|
||||
String countyCode = String.valueOf(firePointQo.getCountyCode());
|
||||
String countyName = firePointQo.getCountyName();
|
||||
String townCode = firePointQo.getTownCode();
|
||||
|
||||
LocalDateTime satelliteLocalDateTime = LocalDateTime.ofEpochSecond(satelliteTimeTs, 0, ZoneOffset.ofHours(8));
|
||||
@ -193,10 +223,17 @@ public class DispatchFirePointServiceImpl implements DispatchFirePointService {
|
||||
firePointPreciseEntity.setConfidence(confidence);
|
||||
firePointPreciseEntity.setFireImage(fireImage);
|
||||
firePointPreciseEntity.setSatelliteImage(satelliteImage);
|
||||
firePointPreciseEntity.setTownCode(townCode);
|
||||
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.setTownCode(townCode);
|
||||
bindFirePointAddress(firePointPreciseEntity);
|
||||
DataWrapper2<Boolean, String> checkDuplicatedWrapper2 = FirePointFilterUtils.checkDuplicated(firePointPreciseDao, firePointPreciseEntity);
|
||||
if (checkDuplicatedWrapper2.getData1()) {
|
||||
|
Loading…
Reference in New Issue
Block a user