只接收陈勇的火点通道
This commit is contained in:
parent
cd54841e88
commit
bdfc4a7bea
@ -54,7 +54,6 @@ class WebSecurityConfig extends WebSecurityConfigurerAdapter {
|
||||
.antMatchers(HttpMethod.GET, "/api/user/booleanUserName").permitAll()
|
||||
.antMatchers(HttpMethod.GET, "/queryzzhd").permitAll()
|
||||
.antMatchers(HttpMethod.POST, "/insertFirePoint").permitAll()
|
||||
.antMatchers(HttpMethod.POST, "/insertfirepointchanneltwo").permitAll()
|
||||
.antMatchers(HttpMethod.POST, "/insertAppTask").permitAll()
|
||||
.antMatchers(HttpMethod.GET, "/selectAppTask").permitAll()
|
||||
.antMatchers(HttpMethod.GET, "/selectFirePointBetweenSeven").permitAll()
|
||||
|
@ -1,6 +1,5 @@
|
||||
package com.xkrs.controller;
|
||||
|
||||
import cn.hutool.core.date.SystemClock;
|
||||
import com.xkrs.common.encapsulation.PromptMessageEnum;
|
||||
import com.xkrs.common.tool.TokenUtil;
|
||||
import com.xkrs.dao.FirePointDao;
|
||||
@ -8,16 +7,14 @@ import com.xkrs.dao.ShanDongFirePointDao;
|
||||
import com.xkrs.dao.SysUserDao;
|
||||
import com.xkrs.model.entity.FirePointEntity;
|
||||
import com.xkrs.model.entity.ShanDongFirePointEntity;
|
||||
import com.xkrs.model.entity.StreetEntity;
|
||||
import com.xkrs.model.entity.SysUserEntity;
|
||||
import com.xkrs.model.qo.AuditFireTypeQo;
|
||||
import com.xkrs.model.qo.FirePointQo;
|
||||
import com.xkrs.model.qo.ShanDongFirePointVerifyStateQo;
|
||||
import com.xkrs.model.vo.GaoDeIgGeocodeVo;
|
||||
import com.xkrs.service.FirePointService;
|
||||
import com.xkrs.service.StreetService;
|
||||
import com.xkrs.service.impl.FirePointServiceImpl;
|
||||
import com.xkrs.utils.*;
|
||||
import com.xkrs.utils.FirePointQueryHelper;
|
||||
import org.apache.hc.core5.util.TextUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@ -31,15 +28,12 @@ import javax.persistence.criteria.Predicate;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.transaction.Transactional;
|
||||
import java.io.File;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.xkrs.common.encapsulation.OutputEncapsulation.outputEncapsulationObject;
|
||||
import static com.xkrs.utils.DateTimeUtil.dateTimeToString;
|
||||
|
||||
@RestController
|
||||
public class FirePointController {
|
||||
@ -104,23 +98,6 @@ public class FirePointController {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加火点数据
|
||||
*
|
||||
* @param firePointQo
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/insertfirepointchanneltwo")
|
||||
public String insertFirePointChannelTwo(@RequestBody FirePointQo firePointQo) {
|
||||
log.info("insertFirePointChannelTwo 接收到火点信息:" + firePointQo.toString());
|
||||
boolean success = firePointService.insertFirePointChannelTwo(firePointQo);
|
||||
if (success) {
|
||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "添加成功", locale);
|
||||
} else {
|
||||
return outputEncapsulationObject(PromptMessageEnum.PROCESS_FAIL, "添加失败", locale);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询山东临时火点表
|
||||
*
|
||||
|
@ -20,14 +20,6 @@ public interface FirePointService {
|
||||
*/
|
||||
boolean insertFirePoint(FirePointQo firePointQo);
|
||||
|
||||
/**
|
||||
* 添加火点信息
|
||||
*
|
||||
* @param firePointQo
|
||||
* @return
|
||||
*/
|
||||
boolean insertFirePointChannelTwo(FirePointQo firePointQo);
|
||||
|
||||
/**
|
||||
* 查询今天的火点信息
|
||||
*
|
||||
@ -86,7 +78,7 @@ public interface FirePointService {
|
||||
*/
|
||||
String downloadVipUserFilePoint(HttpServletRequest request, HttpServletResponse response);
|
||||
|
||||
String downloadFirePoint(HttpServletRequest request, HttpServletResponse response,String ids);
|
||||
String downloadFirePoint(HttpServletRequest request, HttpServletResponse response, String ids);
|
||||
|
||||
/**
|
||||
* 动态多条件查询火点列表
|
||||
|
@ -1,6 +1,5 @@
|
||||
package com.xkrs.service.impl;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.xkrs.common.encapsulation.PromptMessageEnum;
|
||||
import com.xkrs.dao.*;
|
||||
import com.xkrs.model.entity.*;
|
||||
@ -116,34 +115,29 @@ public class FirePointServiceImpl implements FirePointService {
|
||||
firePointEntity.setSatelliteImage(firePointQo.getSatelliteImage());
|
||||
firePointEntity.setAuditFireType("0");//初始化火点为未审核状态
|
||||
bindAddress(firePointEntity);
|
||||
|
||||
if (checkDuplicatedData(firePointEntity)) {
|
||||
log.info("-------该火点和历史火点重复,不入库");
|
||||
return false;
|
||||
}
|
||||
if (firePointEntity.getCountyCode().startsWith("37")) {
|
||||
if (isSwitchStateOpen()) {
|
||||
//如果是山东的非耕地火点,就考虑入库
|
||||
if (!"耕地".equals(firePointEntity.getLandType())) {
|
||||
//如果开关已打开,就只将未审核的火点添加到山东临时表
|
||||
log.info("-------发现新山东火点");
|
||||
ShanDongFirePointEntity shanDongFirePointByFirePoint = getShanDongFirePointByFirePoint(firePointEntity);
|
||||
ShanDongFirePointEntity savedShanDongFirePoint = shanDongFirePointDao.save(shanDongFirePointByFirePoint);
|
||||
//微信消息通知火点审核工作组
|
||||
try {
|
||||
String messageContent = getMessageContent(savedShanDongFirePoint);
|
||||
WDWxSendMsgUtil.sendMsg("18447024917@chatroom", messageContent, 0);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
log.info("-------发现新火点");
|
||||
firePointDao.save(firePointEntity);
|
||||
//发送消息通知
|
||||
sendBroadcast(firePointEntity);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
// if (firePointEntity.getCountyCode().startsWith("37")) {
|
||||
// //如果开关已打开,就只将未审核的火点添加到山东临时表
|
||||
// log.info("-------发现新山东火点");
|
||||
// ShanDongFirePointEntity shanDongFirePointByFirePoint = getShanDongFirePointByFirePoint(firePointEntity);
|
||||
// ShanDongFirePointEntity savedShanDongFirePoint = shanDongFirePointDao.save(shanDongFirePointByFirePoint);
|
||||
// //微信消息通知火点审核工作组
|
||||
// try {
|
||||
// String messageContent = getMessageContent(savedShanDongFirePoint);
|
||||
// WDWxSendMsgUtil.sendMsg("18447024917@chatroom", messageContent, 0);
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// return true;
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
@ -179,91 +173,6 @@ public class FirePointServiceImpl implements FirePointService {
|
||||
return duplicatedDataList != null && duplicatedDataList.size() > 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加火点信息
|
||||
*/
|
||||
@CacheEvict(value = "FirePointServiceCache", allEntries = true)
|
||||
@Override
|
||||
public boolean insertFirePointChannelTwo(FirePointQo firePointQo) {
|
||||
if ("水体".equals(firePointQo.getLandtype())) {
|
||||
return false;
|
||||
}
|
||||
if ("Himawari 8".equals(firePointQo.getSatelliteType())) {
|
||||
if ("N".equals(firePointQo.getConfidence()) || "L".equals(firePointQo.getConfidence())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
ShanDongFirePointEntity shanDongFirePoint = new ShanDongFirePointEntity();
|
||||
shanDongFirePoint.setFireCode(firePointQo.getFireCode());
|
||||
shanDongFirePoint.setCountyCode(firePointQo.getCountyCode().toString());
|
||||
shanDongFirePoint.setCountyName(firePointQo.getCountyName());
|
||||
|
||||
// //设置乡镇街道区划编码和名称---Start
|
||||
// String townCode = firePointQo.getTowncode();
|
||||
// shanDongFirePoint.setStreetCode(townCode);
|
||||
// shanDongFirePoint.setStreetName("");
|
||||
// List<StreetEntity> streetList = streetService.findByStreetCode(townCode);
|
||||
// if (null != streetList && streetList.size() > 0) {
|
||||
// StreetEntity street = streetList.get(0);
|
||||
// shanDongFirePoint.setStreetName(street.getStreetName());
|
||||
// if (!street.getCountyCode().equals(shanDongFirePoint.getCountyCode())) {//这三个错误日志可以监视接收的towncode有木有问题,日志里不出现"发生重大错误"就是没问题
|
||||
// log.info("发生重大错误,接收的countyCode是" + shanDongFirePoint.getCountyCode() + ",本地表中根据streetCode(towncode)" + townCode + "找到的countyCode是" + street.getCountyCode() + ",firePointQo详情=" + firePointQo.toString());
|
||||
// }
|
||||
// if (!street.getCountyName().equals(shanDongFirePoint.getCountyName())) {
|
||||
// log.info("发生重大错误,接收的countyName是" + shanDongFirePoint.getCountyName() + ",本地表中根据streetCode(towncode)" + townCode + "找到的countyName是" + street.getCountyName() + ",firePointQo详情=" + firePointQo.toString());
|
||||
// }
|
||||
// } else {
|
||||
// log.info("发生重大错误,传过来的towncode(" + townCode + ")连找都找不到,firePointQo详情=" + firePointQo.toString());
|
||||
// }
|
||||
// //设置乡镇街道区划编码和名称---End
|
||||
|
||||
shanDongFirePoint.setSatelliteTime(DateTimeUtil.timeMillisToString(firePointQo.getSatelliteTimeTs().longValue()));
|
||||
shanDongFirePoint.setLongitude(firePointQo.getLongitude());
|
||||
shanDongFirePoint.setLatitude(firePointQo.getLatitude());
|
||||
shanDongFirePoint.setSatelliteType(firePointQo.getSatelliteType());
|
||||
shanDongFirePoint.setLandType(firePointQo.getLandtype());
|
||||
shanDongFirePoint.setConfidence(firePointQo.getConfidence());
|
||||
shanDongFirePoint.setAddTime(dateTimeToString(LocalDateTime.now()));
|
||||
shanDongFirePoint.setFireType("0");
|
||||
shanDongFirePoint.setFireImage(firePointQo.getFireImage());
|
||||
shanDongFirePoint.setSatelliteImage(firePointQo.getSatelliteImage());
|
||||
shanDongFirePoint.setVerifyState("0");
|
||||
bindAddress(shanDongFirePoint);
|
||||
|
||||
if (checkDuplicatedDataX(shanDongFirePoint) || checkDuplicatedData(shanDongFirePoint)) {
|
||||
return false;
|
||||
}
|
||||
//如果是山东的点,就入库
|
||||
if (shanDongFirePoint.getCountyCode().startsWith("37")) {
|
||||
if (isSwitchStateOpen()) {
|
||||
//如果开关已打开,就只将未审核的火点添加到山东临时表
|
||||
log.info("-------发现新山东火点");
|
||||
ShanDongFirePointEntity savedShanDongFirePoint = shanDongFirePointDao.save(shanDongFirePoint);
|
||||
//微信消息通知火点审核工作组
|
||||
try {
|
||||
String messageContent = getMessageContent(savedShanDongFirePoint);
|
||||
WDWxSendMsgUtil.sendMsg("18447024917@chatroom", messageContent, 0);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
//如果开关已关闭,就将火点添加到山东临时表,同时自动审核通过添加到全国火点表
|
||||
log.info("-------发现新火点");
|
||||
shanDongFirePoint.setVerifyState("1");
|
||||
shanDongFirePointDao.save(shanDongFirePoint);
|
||||
FirePointEntity firePoint = getFirePointByShanDongFirePoint(shanDongFirePoint);
|
||||
log.info("-------转存新火点");
|
||||
firePointDao.save(firePoint);
|
||||
forwardPoint(firePoint);
|
||||
//发送消息通知
|
||||
sendBroadcast(firePoint);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据山东火点生成全国火点
|
||||
*/
|
||||
@ -314,20 +223,6 @@ public class FirePointServiceImpl implements FirePointService {
|
||||
return shanDongFirePoint;
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回开关是否为打开状态
|
||||
*
|
||||
* @return true:已打开,false:已关闭
|
||||
*/
|
||||
private boolean isSwitchStateOpen() {
|
||||
List<SettingEntity> settingEntityList = settingDao.findAll();
|
||||
if (settingEntityList.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
SettingEntity settingEntity = settingEntityList.get(0);
|
||||
return "1".equals(settingEntity.getSwitchState());
|
||||
}
|
||||
|
||||
/**
|
||||
* 为实体类绑定地址、编号、名称
|
||||
*/
|
||||
@ -347,25 +242,6 @@ public class FirePointServiceImpl implements FirePointService {
|
||||
firePointEntity.setStreetName(addressComponent.getTownship());
|
||||
}
|
||||
|
||||
/**
|
||||
* 为实体类绑定地址、编号、名称
|
||||
*/
|
||||
private void bindAddress(ShanDongFirePointEntity firePointEntity) {
|
||||
List<String> locationList = new ArrayList<>();
|
||||
locationList.add(firePointEntity.getLongitude() + "," + firePointEntity.getLatitude());
|
||||
GaoDeIgGeocodeVo geocode = GaoDeApiUtil.geocode(locationList);
|
||||
GaoDeIgGeocodeVo.Regeocode reGeoCode = geocode.getRegeocodes().get(0);
|
||||
String formattedAddress = reGeoCode.getFormatted_address();
|
||||
firePointEntity.setFirePointAddress(formattedAddress);
|
||||
GaoDeIgGeocodeVo.AddressComponent addressComponent = reGeoCode.getAddressComponent().get(0);
|
||||
firePointEntity.setCountyCode(addressComponent.getAdcode());
|
||||
firePointEntity.setCountyName(addressComponent.getDistrict());
|
||||
String townCode = addressComponent.getTowncode();
|
||||
String fixedTownCode = townCode.length() > 9 ? townCode.substring(0, 9) : townCode;
|
||||
firePointEntity.setStreetCode(fixedTownCode);
|
||||
firePointEntity.setStreetName(addressComponent.getTownship());
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据火点编号更新审核状态
|
||||
* 操作1:将火点编号对应的火点从山东火点表转存到火点表
|
||||
@ -396,7 +272,6 @@ public class FirePointServiceImpl implements FirePointService {
|
||||
FirePointEntity firePoint = getFirePointByShanDongFirePoint(existShanDongFirePoint);
|
||||
log.info("-------转存新火点");
|
||||
firePointDao.save(firePoint);
|
||||
forwardPoint(firePoint);
|
||||
//发送消息通知
|
||||
sendBroadcast(firePoint);
|
||||
}
|
||||
@ -497,15 +372,6 @@ public class FirePointServiceImpl implements FirePointService {
|
||||
return content;
|
||||
}
|
||||
|
||||
private void forwardPoint(FirePointEntity firePointEntity) {
|
||||
try {
|
||||
String url = "http://121.36.229.60:6811/insertfirepointchannelThree";
|
||||
HttpClientUtils.sendHttpPostTextPlain(url, new ObjectMapper().writeValueAsString(firePointEntity));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载VIP用户火点数据
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user