火点重构

This commit is contained in:
liuchengqian 2023-03-29 15:29:56 +08:00
parent 8a14852894
commit 98bdecd7ba
10 changed files with 139 additions and 25 deletions

View File

@ -33,7 +33,7 @@ class WebSecurityConfig extends WebSecurityConfigurerAdapter {
.antMatchers(HttpMethod.OPTIONS).permitAll()
.antMatchers("/push/**").permitAll()
.antMatchers("/insertFirePoint").permitAll()
.antMatchers("/insertFirePointChannelPrecise").permitAll()
.antMatchers("/updateFirePoint").permitAll()
.antMatchers("/queryFirePointBroadcast").permitAll()
.antMatchers("/autoSync").permitAll()
.antMatchers("/debug").permitAll()

View File

@ -7,6 +7,7 @@ import com.xkrs.dao.StreetDao;
import com.xkrs.dao.SysUserDao;
import com.xkrs.helper.FirePointSubscribeManager;
import com.xkrs.model.qo.AllFirePointQo;
import com.xkrs.model.qo.UpdateFirePointQo;
import com.xkrs.service.DispatchFirePointService;
import com.xkrs.service.impl.FirePointServiceImpl;
import org.slf4j.Logger;
@ -85,20 +86,19 @@ public class DispatchFirePointController {
}
/**
* 普通渠道推送火点到秸秆系统
* 推送火点到秸秆系统
*/
// @PostMapping("/insertFirePointChannelOrdinary")
@PostMapping("/insertFirePoint")
public String insertFirePointChannelOrdinary(@RequestBody AllFirePointQo firePointQo) {
return firePointService.insertFirePointChannelOrdinary(firePointQo);
public String insertFirePoint(@RequestBody AllFirePointQo firePointQo) {
return firePointService.insertFirePoint(firePointQo);
}
/**
* 精准渠道推送火点到秸秆系统
* 更新火点状态
*/
@PostMapping("/insertFirePointChannelPrecise")
public String insertFirePointChannelPrecise(@RequestBody AllFirePointQo firePointQo) {
return firePointService.insertFirePointChannelPrecise(firePointQo);
@PostMapping("/updateFirePoint")
public String updateFirePoint(@RequestBody UpdateFirePointQo updateFirePointQo) {
return firePointService.updateFirePoint(updateFirePointQo);
}
}

View File

@ -70,7 +70,7 @@ public class FirePointSubscribeManager {
String subscribeUrl = "http://118.24.27.47:5060/push-firepoint/ModifySystemMessages";
Map<String, Object> map = new HashMap<>();
map.put("name", "秸秆火系统正式版");
map.put("url", "http://118.24.27.47:6801/insertFirePointChannelPrecise");
map.put("url", "http://118.24.27.47:6801/updateFirePoint");
map.put("param", paramContent);
map.put("typeOfLand", "耕地");
return sendHttpPostTextPlain(subscribeUrl, new ObjectMapper().writeValueAsString(map));

View File

@ -24,6 +24,14 @@ public class FirePointOrdinaryEntity implements Serializable {
@Column(length = 64, unique = true, columnDefinition = "varchar(64)")
private String fireCode;
/**
* 火点状态
* 0真火点
* 1或null伪火点
*/
@Column(length = 32, columnDefinition = "varchar(32)")
private String fireStatus;
/**
* 卫星监测的时间
*/
@ -161,6 +169,14 @@ public class FirePointOrdinaryEntity implements Serializable {
this.fireCode = fireCode;
}
public String getFireStatus() {
return fireStatus;
}
public void setFireStatus(String fireStatus) {
this.fireStatus = fireStatus;
}
public String getSatelliteTime() {
return satelliteTime;
}
@ -326,6 +342,7 @@ public class FirePointOrdinaryEntity implements Serializable {
return "FirePointOrdinaryEntity{" +
"id=" + id +
", fireCode='" + fireCode + '\'' +
", fireStatus='" + fireStatus + '\'' +
", satelliteTime='" + satelliteTime + '\'' +
", longitude=" + longitude +
", latitude=" + latitude +

View File

@ -24,6 +24,14 @@ public class FirePointPreciseEntity implements Serializable {
@Column(length = 64, unique = true, columnDefinition = "varchar(64)")
private String fireCode;
/**
* 火点状态
* 0真火点
* 1或null伪火点
*/
@Column(length = 32, columnDefinition = "varchar(32)")
private String fireStatus;
/**
* 卫星监测的时间
*/
@ -161,6 +169,14 @@ public class FirePointPreciseEntity implements Serializable {
this.fireCode = fireCode;
}
public String getFireStatus() {
return fireStatus;
}
public void setFireStatus(String fireStatus) {
this.fireStatus = fireStatus;
}
public String getSatelliteTime() {
return satelliteTime;
}
@ -326,6 +342,7 @@ public class FirePointPreciseEntity implements Serializable {
return "FirePointPreciseEntity{" +
"id=" + id +
", fireCode='" + fireCode + '\'' +
", fireStatus='" + fireStatus + '\'' +
", satelliteTime='" + satelliteTime + '\'' +
", longitude=" + longitude +
", latitude=" + latitude +

View File

@ -0,0 +1,48 @@
package com.xkrs.model.qo;
import com.xkrs.model.va.FirePointQoUpdate;
import javax.validation.constraints.NotNull;
import java.util.List;
public class UpdateFirePointQo {
@NotNull(message = "{UpdateFirePointQo.data.blank}", groups = {FirePointQoUpdate.class})
private List<DataDTO> data;
public static class DataDTO {
@NotNull(message = "{UpdateFirePointQo.DataDTO.fireCode.blank}", groups = {FirePointQoUpdate.class})
private String fireCode;
@NotNull(message = "{UpdateFirePointQo.DataDTO.status.blank}", groups = {FirePointQoUpdate.class})
private String status;
public String getFireCode() {
return fireCode;
}
public void setFireCode(String fireCode) {
this.fireCode = fireCode;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
}
public UpdateFirePointQo() {
}
public List<DataDTO> getData() {
return data;
}
public void setData(List<DataDTO> data) {
this.data = data;
}
}

View File

@ -0,0 +1,4 @@
package com.xkrs.model.va;
public interface FirePointQoUpdate {
}

View File

@ -12,6 +12,13 @@ public class AllFirePointVo {
*/
private String fireCode;
/**
* 火点状态
* 0真火点
* 1或null伪火点
*/
private String fireStatus;
/**
* 卫星监测的时间
*/
@ -131,6 +138,14 @@ public class AllFirePointVo {
this.fireCode = fireCode;
}
public String getFireStatus() {
return fireStatus;
}
public void setFireStatus(String fireStatus) {
this.fireStatus = fireStatus;
}
public String getSatelliteTime() {
return satelliteTime;
}
@ -296,6 +311,7 @@ public class AllFirePointVo {
return "AllFirePointVo{" +
"id=" + id +
", fireCode='" + fireCode + '\'' +
", fireStatus='" + fireStatus + '\'' +
", satelliteTime='" + satelliteTime + '\'' +
", longitude=" + longitude +
", latitude=" + latitude +

View File

@ -1,17 +1,18 @@
package com.xkrs.service;
import com.xkrs.model.qo.AllFirePointQo;
import com.xkrs.model.qo.UpdateFirePointQo;
public interface DispatchFirePointService {
/**
* 普通渠道推送火点到秸秆系统
* 推送火点到秸秆系统
*/
String insertFirePointChannelOrdinary(AllFirePointQo firePointQo);
String insertFirePoint(AllFirePointQo firePointQo);
/**
* 精准渠道推送火点到秸秆系统
* 更新火点状态
*/
String insertFirePointChannelPrecise(AllFirePointQo firePointQo);
String updateFirePoint(UpdateFirePointQo updateFirePointQo);
}

View File

@ -9,6 +9,7 @@ import com.xkrs.model.bean.DataWrapper2;
import com.xkrs.model.entity.FirePointOrdinaryEntity;
import com.xkrs.model.entity.StreetEntity;
import com.xkrs.model.qo.AllFirePointQo;
import com.xkrs.model.qo.UpdateFirePointQo;
import com.xkrs.service.DispatchFirePointService;
import com.xkrs.utilsnew.DateTimeUtils;
import com.xkrs.utilsnew.FirePointFilterUtils;
@ -20,6 +21,7 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.util.List;
import java.util.Locale;
import static com.xkrs.common.encapsulation.OutputEncapsulation.outputEncapsulationObject;
@ -53,10 +55,10 @@ public class DispatchFirePointServiceImpl implements DispatchFirePointService {
private StreetDao streetDao;
/**
* 普通渠道推送火点到秸秆系统
* 推送火点到秸秆系统
*/
@Override
public String insertFirePointChannelOrdinary(AllFirePointQo firePointQo) {
public String insertFirePoint(AllFirePointQo firePointQo) {
DataWrapper2<Boolean, String> checkLandTypeWrapper = FirePointFilterUtils.checkLandType(firePointQo.getLandtype());
if (!checkLandTypeWrapper.getData1()) {
return outputEncapsulationObject(PromptMessageEnum.PROCESS_FAIL, checkLandTypeWrapper.getData2(), locale);
@ -66,7 +68,7 @@ public class DispatchFirePointServiceImpl implements DispatchFirePointService {
return outputEncapsulationObject(PromptMessageEnum.PROCESS_FAIL, checkSatelliteTypeWrapper.getData2(), locale);
}
log.info("insertFirePointChannelOrdinary 接收到火点信息:" + firePointQo.toString());
log.info("insertFirePoint 接收到火点信息:" + firePointQo.toString());
String fireCode = firePointQo.getFireCode();
Long satelliteTimeTs = firePointQo.getSatelliteTimeTs();
@ -123,14 +125,6 @@ public class DispatchFirePointServiceImpl implements DispatchFirePointService {
return null;
}
/**
* 精准渠道推送火点到秸秆系统
*/
@Override
public String insertFirePointChannelPrecise(AllFirePointQo firePointQo) {
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "", locale);
}
/**
* 绑定火点位置
* 如果能接收到TownCode山东省内会判断CountyCodeCountyNameTownCode
@ -160,4 +154,21 @@ public class DispatchFirePointServiceImpl implements DispatchFirePointService {
}
}
/**
* 更新火点状态
*/
@Override
public String updateFirePoint(UpdateFirePointQo updateFirePointQo) {
List<UpdateFirePointQo.DataDTO> list = updateFirePointQo.getData();
for (UpdateFirePointQo.DataDTO item : list) {
try {
String fireCode = item.getFireCode();
String status = item.getStatus();
} catch (Exception e) {
e.printStackTrace();
}
}
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "添加成功", locale);
}
}