统计订阅时间

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.bean.LocalDateTimeRange;
import com.xkrs.model.entity.FirePointChannelConfigEntity; import com.xkrs.model.entity.FirePointChannelConfigEntity;
import com.xkrs.model.entity.SysUserEntity; import com.xkrs.model.entity.SysUserEntity;
import com.xkrs.utilsnew.JsonUtils; import com.xkrs.utilsnew.*;
import com.xkrs.utilsnew.VipTimeRangeUtils; import org.slf4j.Logger;
import com.xkrs.utilsnew.DateTimeUtils; import org.slf4j.LoggerFactory;
import com.xkrs.utilsnew.FirePointCodeUtils;
import com.xkrs.utilsnew.ListUtils;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.*; import java.util.*;
import static com.xkrs.utilsold.HttpClientUtils.sendHttpPost; import static com.xkrs.utilsold.HttpClientUtils.sendHttpPostTextPlain;
@Component @Component
public class FirePointSubscribeManager { public class FirePointSubscribeManager {
private static final Logger log = LoggerFactory.getLogger(FirePointSubscribeManager.class);
@Resource @Resource
private FirePointChannelConfigDao channelConfigDao; private FirePointChannelConfigDao channelConfigDao;
@ -31,8 +31,13 @@ public class FirePointSubscribeManager {
private SysUserDao sysUserDao; private SysUserDao sysUserDao;
public String autoSync() { public String autoSync() {
long timeTag1 = System.currentTimeMillis();
List<String> subscribedCountyCodeList = obtainSubscribedCountyCodeList(); 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) { private String updateSubscribedCountyCodeList(List<String> subscribedCountyCodeList) {
try { try {
String paramContent = ListUtils.fromStringList(subscribedCountyCodeList, ","); String paramContent = ListUtils.fromStringList(subscribedCountyCodeList, ",");
System.out.println(paramContent);
String subscribeUrl = "http://118.24.27.47:5060/push-firepoint/ModifySystemMessages"; String subscribeUrl = "http://118.24.27.47:5060/push-firepoint/ModifySystemMessages";
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("name", "秸秆火系统"); map.put("name", "秸秆火系统");
map.put("url", "http://118.24.27.47:6802/insertFirePointChannelPrecise"); map.put("url", "http://118.24.27.47:6802/insertFirePointChannelPrecise");
map.put("param", paramContent); map.put("param", paramContent);
map.put("typeOfLand", "耕地"); map.put("typeOfLand", "耕地");
return sendHttpPost(subscribeUrl, new ObjectMapper().writeValueAsString(map)); return sendHttpPostTextPlain(subscribeUrl, new ObjectMapper().writeValueAsString(map));
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
return e.getMessage(); return e.getMessage();