diff --git a/src/main/java/com/xkrs/common/config/WebSecurityConfig.java b/src/main/java/com/xkrs/common/config/WebSecurityConfig.java index fb3c5c8..6d3c8a1 100644 --- a/src/main/java/com/xkrs/common/config/WebSecurityConfig.java +++ b/src/main/java/com/xkrs/common/config/WebSecurityConfig.java @@ -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() diff --git a/src/main/java/com/xkrs/controller/DispatchFirePointController.java b/src/main/java/com/xkrs/controller/DispatchFirePointController.java index 768bd80..8a4d368 100644 --- a/src/main/java/com/xkrs/controller/DispatchFirePointController.java +++ b/src/main/java/com/xkrs/controller/DispatchFirePointController.java @@ -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); } } diff --git a/src/main/java/com/xkrs/helper/FirePointSubscribeManager.java b/src/main/java/com/xkrs/helper/FirePointSubscribeManager.java index baa4239..a97b3b9 100644 --- a/src/main/java/com/xkrs/helper/FirePointSubscribeManager.java +++ b/src/main/java/com/xkrs/helper/FirePointSubscribeManager.java @@ -70,7 +70,7 @@ public class FirePointSubscribeManager { String subscribeUrl = "http://118.24.27.47:5060/push-firepoint/ModifySystemMessages"; Map 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)); diff --git a/src/main/java/com/xkrs/model/entity/FirePointOrdinaryEntity.java b/src/main/java/com/xkrs/model/entity/FirePointOrdinaryEntity.java index abc17a7..7491f6e 100644 --- a/src/main/java/com/xkrs/model/entity/FirePointOrdinaryEntity.java +++ b/src/main/java/com/xkrs/model/entity/FirePointOrdinaryEntity.java @@ -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 + diff --git a/src/main/java/com/xkrs/model/entity/FirePointPreciseEntity.java b/src/main/java/com/xkrs/model/entity/FirePointPreciseEntity.java index a5052e0..631c123 100644 --- a/src/main/java/com/xkrs/model/entity/FirePointPreciseEntity.java +++ b/src/main/java/com/xkrs/model/entity/FirePointPreciseEntity.java @@ -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 + diff --git a/src/main/java/com/xkrs/model/qo/UpdateFirePointQo.java b/src/main/java/com/xkrs/model/qo/UpdateFirePointQo.java new file mode 100644 index 0000000..b69d515 --- /dev/null +++ b/src/main/java/com/xkrs/model/qo/UpdateFirePointQo.java @@ -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 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 getData() { + return data; + } + + public void setData(List data) { + this.data = data; + } +} diff --git a/src/main/java/com/xkrs/model/va/FirePointQoUpdate.java b/src/main/java/com/xkrs/model/va/FirePointQoUpdate.java new file mode 100644 index 0000000..d54e1ac --- /dev/null +++ b/src/main/java/com/xkrs/model/va/FirePointQoUpdate.java @@ -0,0 +1,4 @@ +package com.xkrs.model.va; + +public interface FirePointQoUpdate { +} diff --git a/src/main/java/com/xkrs/model/vo/AllFirePointVo.java b/src/main/java/com/xkrs/model/vo/AllFirePointVo.java index e859a76..9bd66e0 100644 --- a/src/main/java/com/xkrs/model/vo/AllFirePointVo.java +++ b/src/main/java/com/xkrs/model/vo/AllFirePointVo.java @@ -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 + diff --git a/src/main/java/com/xkrs/service/DispatchFirePointService.java b/src/main/java/com/xkrs/service/DispatchFirePointService.java index 7967f06..da3a4f6 100644 --- a/src/main/java/com/xkrs/service/DispatchFirePointService.java +++ b/src/main/java/com/xkrs/service/DispatchFirePointService.java @@ -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); } diff --git a/src/main/java/com/xkrs/service/impl/DispatchFirePointServiceImpl.java b/src/main/java/com/xkrs/service/impl/DispatchFirePointServiceImpl.java index 31fdb76..e11ad44 100644 --- a/src/main/java/com/xkrs/service/impl/DispatchFirePointServiceImpl.java +++ b/src/main/java/com/xkrs/service/impl/DispatchFirePointServiceImpl.java @@ -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 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(山东省内),会判断CountyCode、CountyName、TownCode, @@ -160,4 +154,21 @@ public class DispatchFirePointServiceImpl implements DispatchFirePointService { } } + /** + * 更新火点状态 + */ + @Override + public String updateFirePoint(UpdateFirePointQo updateFirePointQo) { + List 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); + } + }