新增redis方法

This commit is contained in:
Guoqs
2024-11-28 15:35:48 +08:00
parent 963e86db2a
commit 3821d0506d
2 changed files with 64 additions and 3 deletions

View File

@@ -28,6 +28,7 @@ import com.jsowell.adapay.vo.DrawCashDetailVO;
import com.jsowell.adapay.vo.PaymentInfo;
import com.jsowell.common.constant.CacheConstants;
import com.jsowell.common.constant.Constants;
import com.jsowell.common.constant.RabbitConstants;
import com.jsowell.common.core.domain.entity.SysDictData;
import com.jsowell.common.core.domain.ykc.LoginRequestData;
import com.jsowell.common.core.domain.ykc.TransactionRecordsData;
@@ -91,6 +92,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.test.context.SpringBootTest;
@@ -270,10 +272,13 @@ public class SpringBootTestController {
private CarCouponRecordService carCouponRecordService;
@Autowired
private RabbitTemplate rabbitTemplate;
@Qualifier("zhongDianLianPlatformServiceImpl")
private ThirdPartyPlatformService platformLogic;
@Test
public void saveSOCTest() {
String transactionCode = "12345";
YKCUtils.saveSOC(transactionCode, "4");
@@ -324,6 +329,43 @@ public class SpringBootTestController {
Map<String, String> pileStatusV2 = pileConnectorInfoService.getPileStatusV2(pileSnList);
}
@Test
public void sendRabbitMqTest() {
OrderBasicInfo orderBasicInfo = OrderBasicInfo.builder()
.orderCode("C123456789")
.merchantId("1")
.stationId("2")
.payAmount(new BigDecimal(100))
.orderAmount(new BigDecimal(100))
.settleAmount(new BigDecimal(100))
.refundAmount(new BigDecimal(0))
.build();
OrderDetail orderDetail = OrderDetail.builder()
.totalElectricityAmount(new BigDecimal(50))
.discountElectricityAmount(new BigDecimal(0))
.totalServiceAmount(new BigDecimal(50))
.discountElectricityAmount(new BigDecimal(0))
.build();
AfterSettleOrderDTO afterSettleOrderDTO = AfterSettleOrderDTO.builder()
.orderCode(orderBasicInfo.getOrderCode())
.merchantId(orderBasicInfo.getMerchantId())
.stationId(orderBasicInfo.getStationId())
.orderPayAmount(orderBasicInfo.getPayAmount())
.orderConsumeAmount(orderBasicInfo.getOrderAmount())
.orderSettleAmount(orderBasicInfo.getSettleAmount())
.orderElectricityAmount(orderDetail.getTotalElectricityAmount())
.orderElectricityDiscountAmount(orderDetail.getDiscountElectricityAmount())
.orderServiceAmount(orderDetail.getTotalServiceAmount())
.orderServiceDiscountAmount(orderDetail.getDiscountServiceAmount())
.orderRefundAmount(orderBasicInfo.getRefundAmount())
.build();
for (int i = 0; i < 10; i++) {
rabbitTemplate.convertAndSend(RabbitConstants.YKC_EXCHANGE_NAME, RabbitConstants.QUEUE_CHARGE_ORDER_DATA, afterSettleOrderDTO);
}
}
@Test
public void getEBikePileSnTest() {
List<String> strings = pileSnGenerateService.generateEBikeSN(8);
@@ -3843,4 +3885,13 @@ public class SpringBootTestController {
System.out.println(StringUtils.equals(encryptData2, str));
}
@Test
public void addPileMsgTest() {
String redisKey = "pile_msg_list:" + "88000000000002";
for (int i = 0; i < 30; i++) {
redisCache.addPileMsg(redisKey, "充电桩报文第" + i + "") ;
}
System.out.println(redisCache.getCacheList(redisKey));
}
}