This commit is contained in:
2023-07-17 16:44:04 +08:00
parent cb5ac32f7b
commit 2111525345
6 changed files with 66 additions and 27 deletions

View File

@@ -8,6 +8,7 @@ import com.fasterxml.jackson.databind.PropertyNamingStrategies;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import com.google.common.primitives.Bytes;
import com.huifu.adapay.core.exception.BaseAdaPayException;
import com.huifu.adapay.model.Refund;
@@ -184,6 +185,21 @@ public class SpringBootTestController {
@Autowired
private IMemberBasicInfoService memberBasicInfoService;
@Test
public void testRedisSet() {
String redisKey = "push_station_connector";
redisCache.setCacheSet(redisKey, Sets.newHashSet("1"));
redisCache.setCacheSet(redisKey, Sets.newHashSet("3"));
redisCache.setCacheSet(redisKey, Sets.newHashSet("5"));
redisCache.setCacheSet(redisKey, Sets.newHashSet("1"));
redisCache.setCacheSet(redisKey, Sets.newHashSet("1"));
redisCache.setCacheSet(redisKey, Sets.newHashSet("7"));
redisCache.setCacheSet(redisKey, Sets.newHashSet("3"));
Set<Object> cacheSet = redisCache.getCacheSet(redisKey);
System.out.println(cacheSet);
}
@Test
public void testSettleOrder() {
Map<String, BigDecimal> returnAmountMap = Maps.newHashMap();
@@ -827,7 +843,7 @@ public class SpringBootTestController {
@Test
public void testupdateElecAmount() {
orderBasicInfoService.updateElecAmount();
// orderBasicInfoService.updateElecAmount();
}
@Test

View File

@@ -19,6 +19,8 @@ public class CacheConstants {
public static final int cache_expire_time_1d = 60 * 60 * 24;
public static final String PUSH_STATION_CONNECTOR = "push_station_connector";
public static final String PLATFORM_TESTER = "platform_tester:";
public static final String GET_PILE_MODEL_INFO_BY_MODEL_ID = "get_pile_model_info_by_model_id:";

View File

@@ -35,30 +35,6 @@ public interface IPileConnectorInfoService {
List<PileConnectorInfo> selectPileConnectorInfoList(String pileSn);
/**
* 新增充电桩枪口信息
*
* @param pileConnectorInfo 充电桩枪口信息
* @return 结果
*/
// int insertPileConnectorInfo(PileConnectorInfo pileConnectorInfo);
/**
* 修改充电桩枪口信息
*
* @param pileConnectorInfo 充电桩枪口信息
* @return 结果
*/
// int updatePileConnectorInfo(PileConnectorInfo pileConnectorInfo);
/**
* 批量删除充电桩枪口信息
*
* @param ids 需要删除的充电桩枪口信息主键集合
* @return 结果
*/
// int deletePileConnectorInfoByIds(Integer[] ids);
int deletePileConnectorInfoByPileSnList(List<String> pileSnList);
int batchInsertConnectorInfo(List<PileConnectorInfo> pileConnectorInfoList);

View File

@@ -5,6 +5,7 @@ import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import com.jsowell.common.constant.CacheConstants;
import com.jsowell.common.constant.Constants;
import com.jsowell.common.core.domain.ykc.RealTimeMonitorData;
@@ -531,10 +532,23 @@ public class PileConnectorInfoServiceImpl implements IPileConnectorInfoService {
// TODO 推送联联平台 设备状态变化推送接口 ConnectorStatusInfo
// 异步放缓存
CompletableFuture.runAsync(() -> statusChange(pileConnectorCode));
}
return num;
}
// 枪口状态变更站点id放缓存
private void statusChange(String pileConnectorCode) {
// 查询枪口信息
PileConnectorInfoVO connectorInfoVO = getPileConnectorInfoByConnectorCode(pileConnectorCode);
if (connectorInfoVO == null) {
return;
}
String redisKey = CacheConstants.PUSH_STATION_CONNECTOR;
redisCache.setCacheSet(redisKey, Sets.newHashSet(connectorInfoVO.getStationId()));
}
/**
* 批量获取桩状态
* 桩的状态有 在线 离线 故障

View File

@@ -39,13 +39,16 @@
<dependency>
<groupId>com.jsowell</groupId>
<artifactId>jsowell-pile</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>com.jsowell</groupId>
<artifactId>jsowell-netty</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>com.jsowell</groupId>
<artifactId>jsowell-thirdparty</artifactId>
</dependency>
</dependencies>

View File

@@ -1,6 +1,8 @@
package com.jsowell.quartz.task;
import com.jsowell.common.constant.CacheConstants;
import com.jsowell.common.constant.Constants;
import com.jsowell.common.core.redis.RedisCache;
import com.jsowell.common.util.DateUtils;
import com.jsowell.common.util.StringUtils;
import com.jsowell.pile.domain.OrderBasicInfo;
@@ -12,6 +14,7 @@ import com.jsowell.pile.service.IPileBillingTemplateService;
import com.jsowell.pile.service.IPileStationInfoService;
import com.jsowell.pile.service.YKCPushCommandService;
import com.jsowell.pile.vo.web.BillingTemplateVO;
import com.jsowell.thirdparty.amap.service.AMapService;
import org.apache.commons.collections4.CollectionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -23,6 +26,7 @@ import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;
import java.util.Set;
@Component("jsowellTask")
public class JsowellTask {
@@ -41,6 +45,12 @@ public class JsowellTask {
@Autowired
private IPileStationInfoService pileStationInfoService;
@Autowired
private RedisCache redisCache;
@Autowired
private AMapService aMapService;
/**
* 关闭15分钟未支付的订单
* close15MinutesOfUnpaidOrders
@@ -126,4 +136,22 @@ public class JsowellTask {
}
}
}
/**
* 站点的枪口数据推送到高德
*/
public void pushToAMap() {
Set<String> stationIds = redisCache.getCacheSet(CacheConstants.PUSH_STATION_CONNECTOR);
if (CollectionUtils.isEmpty(stationIds)) {
return;
}
log.info("推送到高德的stationId:{}", stationIds);
// for (String stationId : stationIds) {
// try {
// aMapService.pushChargingDeviceDynamics(stationId);
// } catch (Exception e) {
// log.error("推送到高德error", e);
// }
// }
}
}