火点审核新逻辑
This commit is contained in:
parent
618fc76e4d
commit
3ad5c9d71c
@ -75,7 +75,8 @@ class WebSecurityConfig extends WebSecurityConfigurerAdapter {
|
||||
.antMatchers(HttpMethod.GET, "/api/adm/getStreetList").permitAll()//根据区县编号获取街道列表
|
||||
.antMatchers(HttpMethod.GET, "/updateFirePointStreetCode").permitAll()
|
||||
// 所有其它请求需要身份认证
|
||||
.anyRequest().authenticated().and()
|
||||
.anyRequest().authenticated()
|
||||
.and()
|
||||
// 添加一个过滤器 所有访问 /login 的请求交给 JWTLoginFilter 来处理 这个类处理所有的JWT相关内容
|
||||
.addFilterBefore(new JwtLoginFilter("/api/login", authenticationManager()), UsernamePasswordAuthenticationFilter.class)
|
||||
// 添加一个过滤器验证其他请求的Token是否合法
|
||||
|
@ -135,23 +135,15 @@ public class FirePointServiceImpl implements FirePointService {
|
||||
e.printStackTrace();
|
||||
System.out.println("添加火点信息 逆地理编码请求街道编号失败:" + e.getMessage());
|
||||
}
|
||||
//如果开关已打开,就剔除山东的火点
|
||||
boolean switchOpened = isSwitchStateOpen();
|
||||
if (switchOpened && firePointEntity.getCountyCode().startsWith("37")) {
|
||||
if (firePointEntity.getCountyCode().startsWith("37")) {
|
||||
return null;
|
||||
}
|
||||
//如果开关已关闭,所有火点都入全国火点库
|
||||
FirePointEntity existFireCode = firePointDao.findByFireCode(firePointEntity.getFireCode());
|
||||
if (existFireCode != null) {
|
||||
return null;
|
||||
}
|
||||
log.info("-------发现新火点");
|
||||
FirePointEntity savedFirePointEntity = firePointDao.save(firePointEntity);
|
||||
//如果开关关闭了,山东的火点发送短信微信
|
||||
if ((!switchOpened) && firePointEntity.getCountyCode().startsWith("37")) {
|
||||
sendBroadcast(firePointEntity);
|
||||
}
|
||||
return savedFirePointEntity;
|
||||
return firePointDao.save(firePointEntity);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -172,47 +164,95 @@ public class FirePointServiceImpl implements FirePointService {
|
||||
if ("Himawari 8".equals(firePointQo.getSatelliteType()) && "N".equals(firePointQo.getConfidence())) {
|
||||
return null;
|
||||
}
|
||||
ShanDongFirePointEntity firePointEntity = new ShanDongFirePointEntity();
|
||||
firePointEntity.setFireCode(firePointQo.getFireCode());
|
||||
firePointEntity.setCountyCode(firePointQo.getCountyCode().toString());
|
||||
firePointEntity.setCountyName(firePointQo.getCountyName());
|
||||
firePointEntity.setSatelliteTime(DateTimeUtil.timeMillisToString(firePointQo.getSatelliteTimeTs().longValue()));
|
||||
firePointEntity.setLongitude(firePointQo.getLongitude());
|
||||
firePointEntity.setLatitude(firePointQo.getLatitude());
|
||||
firePointEntity.setFirePointAddress(AddressUtils.getLocal(firePointQo.getLatitude().toString(), firePointQo.getLongitude().toString()));
|
||||
firePointEntity.setSatelliteType(firePointQo.getSatelliteType());
|
||||
firePointEntity.setLandType(firePointQo.getLandtype());
|
||||
firePointEntity.setConfidence(firePointQo.getConfidence());
|
||||
firePointEntity.setAddTime(dateTimeToString(LocalDateTime.now()));
|
||||
firePointEntity.setFireType("0");
|
||||
firePointEntity.setFireImage(firePointQo.getFireImage());
|
||||
firePointEntity.setSatelliteImage(firePointQo.getSatelliteImage());
|
||||
firePointEntity.setVerifyState("0");
|
||||
ShanDongFirePointEntity shanDongFirePoint = new ShanDongFirePointEntity();
|
||||
shanDongFirePoint.setFireCode(firePointQo.getFireCode());
|
||||
shanDongFirePoint.setCountyCode(firePointQo.getCountyCode().toString());
|
||||
shanDongFirePoint.setCountyName(firePointQo.getCountyName());
|
||||
shanDongFirePoint.setSatelliteTime(DateTimeUtil.timeMillisToString(firePointQo.getSatelliteTimeTs().longValue()));
|
||||
shanDongFirePoint.setLongitude(firePointQo.getLongitude());
|
||||
shanDongFirePoint.setLatitude(firePointQo.getLatitude());
|
||||
shanDongFirePoint.setFirePointAddress(AddressUtils.getLocal(firePointQo.getLatitude().toString(), firePointQo.getLongitude().toString()));
|
||||
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");
|
||||
try {
|
||||
bindStreetCodeName(firePointEntity);
|
||||
bindStreetCodeName(shanDongFirePoint);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
System.out.println("添加山东火点信息 逆地理编码请求街道编号失败:" + e.getMessage());
|
||||
}
|
||||
//如果开关已打开,就把山东火点入山东火点库
|
||||
if (isSwitchStateOpen() && firePointEntity.getCountyCode().startsWith("37")) {
|
||||
ShanDongFirePointEntity existFireCode = shanDongFirePointDao.findByFireCode(firePointEntity.getFireCode());
|
||||
if (existFireCode != null) {
|
||||
//如果是山东的点,就入库
|
||||
if (shanDongFirePoint.getCountyCode().startsWith("37")) {
|
||||
if (isSwitchStateOpen()) {
|
||||
//如果开关已打开,就只将未审核的火点添加到山东临时表
|
||||
if (shanDongFirePointDao.findByFireCode(shanDongFirePoint.getFireCode()) != null) {
|
||||
//山东临时表已经有编号相同的火点存在,返回添加失败
|
||||
return null;
|
||||
}
|
||||
log.info("-------发现新山东火点");
|
||||
ShanDongFirePointEntity savedFirePointEntity = shanDongFirePointDao.save(firePointEntity);
|
||||
try {//微信消息通知工作组
|
||||
String messageContent = getMessageContent(firePointEntity);
|
||||
ShanDongFirePointEntity savedShanDongFirePoint = shanDongFirePointDao.save(shanDongFirePoint);
|
||||
try {//微信消息通知火点审核工作组
|
||||
String messageContent = getMessageContent(savedShanDongFirePoint);
|
||||
WDWxSendMsgUtil.sendMsg("18447024917@chatroom", messageContent, 0);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return savedFirePointEntity;
|
||||
return savedShanDongFirePoint;
|
||||
} else {
|
||||
//如果开关已关闭,就将火点添加到山东临时表,同时自动审核通过添加到全国火点表
|
||||
if (shanDongFirePointDao.findByFireCode(shanDongFirePoint.getFireCode()) != null) {
|
||||
//山东临时表已经有编号相同的火点存在,返回添加失败
|
||||
return null;
|
||||
}
|
||||
if (firePointDao.findByFireCode(shanDongFirePoint.getFireCode()) != null) {
|
||||
//全国火点表已经有编号相同的火点存在,返回添加失败
|
||||
return null;
|
||||
}
|
||||
log.info("-------发现新火点");
|
||||
shanDongFirePoint.setVerifyState("1");
|
||||
ShanDongFirePointEntity savedShanDongFirePoint = shanDongFirePointDao.save(shanDongFirePoint);
|
||||
|
||||
FirePointEntity firePoint = getFirePointByShanDongFirePoint(shanDongFirePoint);
|
||||
log.info("-------转存新火点");
|
||||
firePointDao.save(firePoint);
|
||||
//发送消息通知
|
||||
sendBroadcast(firePoint);
|
||||
return savedShanDongFirePoint;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据山东火点生成全国火点
|
||||
*/
|
||||
private FirePointEntity getFirePointByShanDongFirePoint(ShanDongFirePointEntity shanDongFirePoint) {
|
||||
FirePointEntity firePoint = new FirePointEntity();
|
||||
firePoint.setFireCode(shanDongFirePoint.getFireCode());
|
||||
firePoint.setCountyCode(shanDongFirePoint.getCountyCode());
|
||||
firePoint.setCountyName(shanDongFirePoint.getCountyName());
|
||||
firePoint.setSatelliteTime(shanDongFirePoint.getSatelliteTime());
|
||||
firePoint.setLongitude(shanDongFirePoint.getLongitude());
|
||||
firePoint.setLatitude(shanDongFirePoint.getLatitude());
|
||||
firePoint.setFirePointAddress(shanDongFirePoint.getFirePointAddress());
|
||||
firePoint.setSatelliteType(shanDongFirePoint.getSatelliteType());
|
||||
firePoint.setLandType(shanDongFirePoint.getLandType());
|
||||
firePoint.setConfidence(shanDongFirePoint.getConfidence());
|
||||
firePoint.setAddTime(shanDongFirePoint.getAddTime());
|
||||
firePoint.setFireType(shanDongFirePoint.getFireType());
|
||||
firePoint.setFireImage(shanDongFirePoint.getFireImage());
|
||||
firePoint.setSatelliteImage(shanDongFirePoint.getSatelliteImage());
|
||||
firePoint.setStreetCode(shanDongFirePoint.getStreetCode());
|
||||
firePoint.setStreetName(shanDongFirePoint.getStreetName());
|
||||
firePoint.setAuditFireType("0");//初始化火点为未审核状态
|
||||
return firePoint;
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回开关是否为打开状态
|
||||
*
|
||||
@ -273,10 +313,17 @@ public class FirePointServiceImpl implements FirePointService {
|
||||
public String updateVerifyStateByFireCode(String fireCode, String verifyState) {
|
||||
// 获取区域信息
|
||||
Locale locale = LocaleContextHolder.getLocale();
|
||||
if ((!"0".equals(verifyState)) && (!"1".equals(verifyState)) && (!"2".equals(verifyState))) {
|
||||
return outputEncapsulationObject(PromptMessageEnum.PARAM_ILLEGAL, "审核失败,审核状态参数错误", locale);
|
||||
}
|
||||
ShanDongFirePointEntity existShanDongFirePoint = shanDongFirePointDao.findByFireCode(fireCode);
|
||||
//山东火点表找不到这个火点,返回失败
|
||||
if (existShanDongFirePoint == null) {
|
||||
return outputEncapsulationObject(PromptMessageEnum.PROCESS_FAIL, "修改失败,没有指定的火点编号", locale);
|
||||
return outputEncapsulationObject(PromptMessageEnum.PROCESS_FAIL, "审核失败,没有指定的火点编号", locale);
|
||||
}
|
||||
if ("0".equals(existShanDongFirePoint.getVerifyState())) {
|
||||
if ("0".equals(verifyState)) {
|
||||
return outputEncapsulationObject(PromptMessageEnum.PROCESS_FAIL, "审核失败,审核状态不能被设置为未审核", locale);
|
||||
}
|
||||
if ("1".equals(verifyState)) {
|
||||
//火点表能找到这个火点,返回失败
|
||||
@ -284,37 +331,19 @@ public class FirePointServiceImpl implements FirePointService {
|
||||
if (existFirePoint != null) {
|
||||
return outputEncapsulationObject(PromptMessageEnum.PROCESS_FAIL, "修改失败,火点库已存在指定的火点编号", locale);
|
||||
}
|
||||
//完成第一步:将山东火点表中的火点转存到火点表,初始化为未审核状态
|
||||
FirePointEntity firePointEntity = new FirePointEntity();
|
||||
firePointEntity.setFireCode(existShanDongFirePoint.getFireCode());
|
||||
firePointEntity.setCountyCode(existShanDongFirePoint.getCountyCode());
|
||||
firePointEntity.setCountyName(existShanDongFirePoint.getCountyName());
|
||||
firePointEntity.setSatelliteTime(existShanDongFirePoint.getSatelliteTime());
|
||||
firePointEntity.setLongitude(existShanDongFirePoint.getLongitude());
|
||||
firePointEntity.setLatitude(existShanDongFirePoint.getLatitude());
|
||||
firePointEntity.setFirePointAddress(existShanDongFirePoint.getFirePointAddress());
|
||||
firePointEntity.setSatelliteType(existShanDongFirePoint.getSatelliteType());
|
||||
firePointEntity.setLandType(existShanDongFirePoint.getLandType());
|
||||
firePointEntity.setConfidence(existShanDongFirePoint.getConfidence());
|
||||
firePointEntity.setAddTime(existShanDongFirePoint.getAddTime());
|
||||
firePointEntity.setFireType(existShanDongFirePoint.getFireType());
|
||||
firePointEntity.setFireImage(existShanDongFirePoint.getFireImage());
|
||||
firePointEntity.setSatelliteImage(existShanDongFirePoint.getSatelliteImage());
|
||||
firePointEntity.setStreetCode(existShanDongFirePoint.getStreetCode());
|
||||
firePointEntity.setStreetName(existShanDongFirePoint.getStreetName());
|
||||
firePointEntity.setAuditFireType("0");//初始化火点为未审核状态
|
||||
//操作1:将火点编号对应的火点从山东火点表转存到火点表
|
||||
FirePointEntity firePoint = getFirePointByShanDongFirePoint(existShanDongFirePoint);
|
||||
log.info("-------转存新火点");
|
||||
firePointDao.save(firePointEntity);
|
||||
|
||||
//如果开关关闭了,山东的火点发送短信微信
|
||||
if (firePointEntity.getCountyCode().startsWith("37")) {
|
||||
sendBroadcast(firePointEntity);
|
||||
}
|
||||
firePointDao.save(firePoint);
|
||||
//发送消息通知
|
||||
sendBroadcast(firePoint);
|
||||
}
|
||||
//操作2:将山东火点表中的这个火点的审核状态更新
|
||||
shanDongFirePointDao.updateVerifyStateByFireCode(fireCode, verifyState);
|
||||
|
||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "修改成功", locale);
|
||||
}
|
||||
return outputEncapsulationObject(PromptMessageEnum.PROCESS_FAIL, "审核失败,火点不能被重复审核", locale);
|
||||
}
|
||||
|
||||
private void sendBroadcast(FirePointEntity firePointEntity) {
|
||||
//发送微信消息
|
||||
|
Loading…
Reference in New Issue
Block a user