From 261613980c4d3d7122dfd465c804fee40a310a5a Mon Sep 17 00:00:00 2001 From: liuchengqian Date: Wed, 8 Mar 2023 21:13:05 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=9F=E8=AE=A1=E8=AE=A2=E9=98=85=E6=97=B6?= =?UTF-8?q?=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../helper/FirePointSubscribeManager.java | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/xkrs/helper/FirePointSubscribeManager.java b/src/main/java/com/xkrs/helper/FirePointSubscribeManager.java index c38114a..0295f85 100644 --- a/src/main/java/com/xkrs/helper/FirePointSubscribeManager.java +++ b/src/main/java/com/xkrs/helper/FirePointSubscribeManager.java @@ -8,22 +8,22 @@ import com.xkrs.model.bean.FirePointChannelConfigBean; import com.xkrs.model.bean.LocalDateTimeRange; import com.xkrs.model.entity.FirePointChannelConfigEntity; import com.xkrs.model.entity.SysUserEntity; -import com.xkrs.utilsnew.JsonUtils; -import com.xkrs.utilsnew.VipTimeRangeUtils; -import com.xkrs.utilsnew.DateTimeUtils; -import com.xkrs.utilsnew.FirePointCodeUtils; -import com.xkrs.utilsnew.ListUtils; +import com.xkrs.utilsnew.*; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; import javax.annotation.Resource; import java.time.LocalDateTime; import java.util.*; -import static com.xkrs.utilsold.HttpClientUtils.sendHttpPost; +import static com.xkrs.utilsold.HttpClientUtils.sendHttpPostTextPlain; @Component public class FirePointSubscribeManager { + private static final Logger log = LoggerFactory.getLogger(FirePointSubscribeManager.class); + @Resource private FirePointChannelConfigDao channelConfigDao; @@ -31,8 +31,13 @@ public class FirePointSubscribeManager { private SysUserDao sysUserDao; public String autoSync() { + long timeTag1 = System.currentTimeMillis(); List subscribedCountyCodeList = obtainSubscribedCountyCodeList(); - return updateSubscribedCountyCodeList(subscribedCountyCodeList); + long timeTag2 = System.currentTimeMillis(); + String updateResult = updateSubscribedCountyCodeList(subscribedCountyCodeList); + long timeTag3 = System.currentTimeMillis(); + log.info("更新订阅总耗时:" + ((timeTag3 - timeTag1) / 1000D) + "秒,计算耗时:" + ((timeTag2 - timeTag1) / 1000D) + "秒,请求耗时:" + ((timeTag3 - timeTag2) / 1000D) + "秒。"); + return updateResult; } /** @@ -59,14 +64,13 @@ public class FirePointSubscribeManager { private String updateSubscribedCountyCodeList(List subscribedCountyCodeList) { try { String paramContent = ListUtils.fromStringList(subscribedCountyCodeList, ","); - System.out.println(paramContent); 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:6802/insertFirePointChannelPrecise"); map.put("param", paramContent); map.put("typeOfLand", "耕地"); - return sendHttpPost(subscribeUrl, new ObjectMapper().writeValueAsString(map)); + return sendHttpPostTextPlain(subscribeUrl, new ObjectMapper().writeValueAsString(map)); } catch (Exception e) { e.printStackTrace(); return e.getMessage();