|
@@ -17,7 +17,6 @@ import com.bizmatics.mhfire.persistence.mapper.vo.LocateInfo;
|
|
|
import com.bizmatics.mhfire.service.AlertService;
|
|
|
import com.bizmatics.mhfire.service.FireStatisticsService;
|
|
|
import com.bizmatics.mhfire.service.util.Arith;
|
|
|
-import com.bizmatics.mhfire.service.util.CaculateDistance;
|
|
|
import com.bizmatics.mhfire.service.util.GouldUtil;
|
|
|
import com.bizmatics.mhfire.service.vo.AlertMapVO;
|
|
|
import com.bizmatics.mhfire.service.vo.AlertStatisticsVO;
|
|
@@ -137,37 +136,28 @@ public class AlertServiceImpl extends AbstractCrudService<AlertMapper, Alert> im
|
|
|
@Override
|
|
|
public Alert getOne(String id) {
|
|
|
Alert alert = this.getById(id);
|
|
|
- Date startTime = DateUtils.addMonths(alert.getLasj(), -30);
|
|
|
- Date endTime = DateUtils.addMonths(alert.getLasj(), 30);
|
|
|
- String replace = alert.getAfdz().replace("(", " ");
|
|
|
- String replace1 = replace.replace(")", " ");
|
|
|
- String [] arr = replace1.split("\\s+");
|
|
|
- for (String address:arr) {
|
|
|
- if (!address.contains("闵行")){
|
|
|
- List<FireStatisticsPO> list = fireStatisticsService.list(null, null, address);
|
|
|
- System.out.println(list.size());
|
|
|
+ if (alert.getAjlx().equals(ALERT_TYPE[0])){
|
|
|
+ Date startTime = DateUtils.addMonths(alert.getLasj(), -30);
|
|
|
+ Date endTime = DateUtils.addMonths(alert.getLasj(), 30);
|
|
|
+ List<LocateInfo> lonLat = GouldUtil.getLonLat(alert.getAfdz());
|
|
|
+ LocateInfo locateInfo = lonLat.get(0);
|
|
|
+ List<FireStatisticsPO> list = fireStatisticsService.distanceList(locateInfo.getLongitude(), locateInfo.getLatitude(), startTime, endTime);
|
|
|
+ System.out.println(list);
|
|
|
+ if (CollectionUtils.isNotEmpty(list)){
|
|
|
+ FireStatisticsPO fireStatisticsPo = list.get(0);
|
|
|
+ alert.setPropertyLoss(fireStatisticsPo.getPropertyLoss());
|
|
|
+ alert.setDeathToll(fireStatisticsPo.getDeathToll());
|
|
|
+ alert.setNonFatal(fireStatisticsPo.getNonFatal());
|
|
|
}
|
|
|
}
|
|
|
- List<FireStatisticsPO> list = fireStatisticsService.list(startTime, endTime, alert.getAfdz());
|
|
|
- List<FireStatisticsPO> collect = list.stream()
|
|
|
- .filter(fp -> {
|
|
|
- List<LocateInfo> lonLat = null;
|
|
|
- if (0.00 == fp.getLatitude()) {
|
|
|
- lonLat = GouldUtil.getLonLat(fp.getAddress());
|
|
|
- }
|
|
|
- if (CollectionUtils.isNotEmpty(lonLat)) {
|
|
|
- double distance = CaculateDistance.getDistance(Double.parseDouble(alert.getGisX()),
|
|
|
- Double.parseDouble(alert.getGisY()),
|
|
|
- lonLat.get(0).getLatitude(),
|
|
|
- lonLat.get(0).getLongitude());
|
|
|
- return distance > 100;
|
|
|
- }
|
|
|
- return false;
|
|
|
- }).collect(Collectors.toList());
|
|
|
- System.out.println(collect.size());
|
|
|
return alert;
|
|
|
}
|
|
|
|
|
|
+ public String checkAddress(String address){
|
|
|
+ String s = address.replaceAll(" ", "");
|
|
|
+ return s.substring(0,s.indexOf("("));
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public List<AlertStatisticsVO> getAlertStatistics(Date startTime, Date endTime) {
|
|
|
|