统计订阅时间

This commit is contained in:
liuchengqian 2023-03-08 21:13:05 +08:00
parent 1b46c576ba
commit 261613980c

View File

@ -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<String> 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<String> subscribedCountyCodeList) {
try {
String paramContent = ListUtils.fromStringList(subscribedCountyCodeList, ",");
System.out.println(paramContent);
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: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();