mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 02:55:04 +08:00
3427 lines
158 KiB
Java
3427 lines
158 KiB
Java
import cn.hutool.json.JSONUtil;
|
||
import com.alibaba.fastjson2.JSON;
|
||
import com.alibaba.fastjson2.JSONArray;
|
||
import com.alibaba.fastjson2.JSONObject;
|
||
import com.alipay.easysdk.base.oauth.models.AlipaySystemOauthTokenResponse;
|
||
import com.alipay.easysdk.factory.Factory;
|
||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||
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.Payment;
|
||
import com.huifu.adapay.model.PaymentReverse;
|
||
import com.huifu.adapay.model.Refund;
|
||
import com.jsowell.JsowellApplication;
|
||
import com.jsowell.adapay.config.AbstractAdapayConfig;
|
||
import com.jsowell.adapay.dto.*;
|
||
import com.jsowell.adapay.factory.AdapayConfigFactory;
|
||
import com.jsowell.adapay.operation.PaymentReverseOperation;
|
||
import com.jsowell.adapay.response.*;
|
||
import com.jsowell.adapay.service.AdapayService;
|
||
import com.jsowell.adapay.vo.AdapayCorpMemberVO;
|
||
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.core.domain.entity.SysDictData;
|
||
import com.jsowell.common.core.domain.ykc.LoginRequestData;
|
||
import com.jsowell.common.core.domain.ykc.TransactionRecordsData;
|
||
import com.jsowell.common.core.redis.RedisCache;
|
||
import com.jsowell.common.enums.AcquirerEnum;
|
||
import com.jsowell.common.enums.DelFlagEnum;
|
||
import com.jsowell.common.enums.ykc.*;
|
||
import com.jsowell.common.exception.BusinessException;
|
||
import com.jsowell.common.util.*;
|
||
import com.jsowell.common.util.Cp56Time2a.Cp56Time2aUtil;
|
||
import com.jsowell.common.util.http.HttpUtils;
|
||
import com.jsowell.common.util.id.IdUtils;
|
||
import com.jsowell.common.util.id.SnowflakeIdWorker;
|
||
import com.jsowell.common.util.ip.AddressUtils;
|
||
import com.jsowell.netty.handler.HeartbeatRequestHandler;
|
||
import com.jsowell.netty.handler.TransactionRecordsRequestHandler;
|
||
import com.jsowell.netty.service.camera.impl.CameraBusinessServiceImpl;
|
||
import com.jsowell.netty.service.yunkuaichong.YKCBusinessService;
|
||
import com.jsowell.pile.domain.*;
|
||
import com.jsowell.pile.domain.ykcCommond.IssueQRCodeCommand;
|
||
import com.jsowell.pile.domain.ykcCommond.ProofreadTimeCommand;
|
||
import com.jsowell.pile.dto.*;
|
||
import com.jsowell.pile.dto.amap.GetStationInfoDTO;
|
||
import com.jsowell.pile.dto.lutongyunting.BindCouponDTO;
|
||
import com.jsowell.pile.mapper.MemberBasicInfoMapper;
|
||
import com.jsowell.pile.mapper.PileBillingTemplateMapper;
|
||
import com.jsowell.pile.service.*;
|
||
import com.jsowell.pile.service.programlogic.AbstractProgramLogic;
|
||
import com.jsowell.pile.service.programlogic.ProgramLogicFactory;
|
||
import com.jsowell.pile.thirdparty.CommonParamsDTO;
|
||
import com.jsowell.pile.transaction.dto.OrderTransactionDTO;
|
||
import com.jsowell.pile.transaction.service.TransactionService;
|
||
import com.jsowell.pile.util.SnUtils;
|
||
import com.jsowell.pile.vo.base.MemberWalletVO;
|
||
import com.jsowell.pile.vo.base.PileInfoVO;
|
||
import com.jsowell.pile.vo.uniapp.CurrentTimePriceDetails;
|
||
import com.jsowell.pile.vo.uniapp.MemberVO;
|
||
import com.jsowell.pile.vo.uniapp.PileConnectorDetailVO;
|
||
import com.jsowell.pile.vo.web.*;
|
||
import com.jsowell.service.MemberService;
|
||
import com.jsowell.service.OrderService;
|
||
import com.jsowell.service.PileService;
|
||
import com.jsowell.service.TempService;
|
||
import com.jsowell.thirdparty.amap.service.AMapService;
|
||
import com.jsowell.thirdparty.common.NotificationDTO;
|
||
import com.jsowell.thirdparty.common.NotificationService;
|
||
import com.jsowell.thirdparty.huawei.HuaWeiService;
|
||
import com.jsowell.thirdparty.lianlian.service.LianLianService;
|
||
import com.jsowell.thirdparty.lutongyunting.service.LTYTService;
|
||
import com.jsowell.thirdparty.platform.util.Cryptos;
|
||
import com.jsowell.thirdparty.platform.util.Encodes;
|
||
import com.jsowell.thirdparty.platform.util.GBSignUtils;
|
||
import com.jsowell.wxpay.common.WeChatPayParameter;
|
||
import com.jsowell.wxpay.dto.AppletTemplateMessageSendDTO;
|
||
import com.jsowell.wxpay.response.WechatPayRefundRequest;
|
||
import com.jsowell.wxpay.service.WxAppletRemoteService;
|
||
import org.apache.commons.collections4.CollectionUtils;
|
||
import org.apache.commons.lang3.RandomStringUtils;
|
||
import org.junit.Test;
|
||
import org.junit.runner.RunWith;
|
||
import org.springframework.beans.factory.annotation.Autowired;
|
||
import org.springframework.boot.test.context.SpringBootTest;
|
||
import org.springframework.test.context.ActiveProfiles;
|
||
import org.springframework.test.context.junit4.SpringRunner;
|
||
import org.springframework.util.StopWatch;
|
||
|
||
import java.io.UnsupportedEncodingException;
|
||
import java.math.BigDecimal;
|
||
import java.math.RoundingMode;
|
||
import java.nio.charset.StandardCharsets;
|
||
import java.text.ParseException;
|
||
import java.text.SimpleDateFormat;
|
||
import java.util.*;
|
||
import java.util.stream.Collectors;
|
||
|
||
@ActiveProfiles("dev")
|
||
@SpringBootTest(classes = JsowellApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
|
||
@RunWith(SpringRunner.class)
|
||
public class SpringBootTestController {
|
||
|
||
private static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||
|
||
String wechatAppId1 = "wxbb3e0d474569481d"; // 万车充
|
||
|
||
String wechatAppId2 = "wx20abc5210391649c"; // 嘉佳充电
|
||
|
||
@Autowired
|
||
private SnUtils snUtils;
|
||
|
||
@Autowired
|
||
private PileService pileService;
|
||
|
||
@Autowired
|
||
private YKCPushCommandService ykcPushCommandService;
|
||
|
||
@Autowired
|
||
private AdapayMemberAccountService adapayMemberAccountService;
|
||
|
||
@Autowired
|
||
private PileMsgRecordService pileMsgRecordService;
|
||
|
||
@Autowired
|
||
private PileStationInfoService pileStationInfoService;
|
||
|
||
@Autowired
|
||
private YKCPushCommandService ykcPushBusinessService;
|
||
|
||
@Autowired
|
||
private HeartbeatRequestHandler heartbeatRequestHandler;
|
||
|
||
@Autowired
|
||
private YKCBusinessService ykcBusinessService;
|
||
|
||
@Autowired
|
||
private PileBillingTemplateMapper pileBillingTemplateMapper;
|
||
|
||
@Autowired
|
||
private PileRemoteService pileRemoteService;
|
||
|
||
@Autowired
|
||
private MemberService memberService;
|
||
|
||
@Autowired
|
||
private OrderService orderService;
|
||
|
||
@Autowired
|
||
private PileBillingTemplateService pileBillingTemplateService;
|
||
|
||
@Autowired
|
||
private MemberBasicInfoMapper memberBasicInfoMapper;
|
||
|
||
@Autowired
|
||
private SimCardService simCardService;
|
||
|
||
@Autowired
|
||
private PileBasicInfoService pileBasicInfoService;
|
||
|
||
@Autowired
|
||
private WechatPayService wechatPayService;
|
||
|
||
@Autowired
|
||
private OrderBasicInfoService orderBasicInfoService;
|
||
|
||
@Autowired
|
||
private WxpayCallbackRecordService wxpayCallbackRecordService;
|
||
|
||
@Autowired
|
||
private WxAppletRemoteService wxAppletRemoteService;
|
||
|
||
@Autowired
|
||
private RedisCache redisCache;
|
||
|
||
@Autowired
|
||
private PileAuthCardService pileAuthCardService;
|
||
|
||
@Autowired
|
||
private LianLianService lianLianService;
|
||
|
||
@Autowired
|
||
private MemberPlateNumberRelationService memberPlateNumberRelationService;
|
||
|
||
static final String MAC_KEY = "53TtFpc4gdVZbF3x";
|
||
|
||
static final String ALGORITHM_MAC = "HmacMD5";
|
||
|
||
@Autowired
|
||
private AdapayCallbackRecordService adapayCallbackRecordService;
|
||
|
||
@Autowired
|
||
private AdapayRefundRecordService adapayRefundRecordService;
|
||
|
||
@Autowired
|
||
private AdapayService adapayService;
|
||
|
||
@Autowired
|
||
private AMapService aMapService;
|
||
|
||
@Autowired
|
||
private PileConnectorInfoService pileConnectorInfoService;
|
||
|
||
@Autowired
|
||
private TransactionRecordsRequestHandler transactionRecordsRequestHandler;
|
||
|
||
@Autowired
|
||
private MemberBasicInfoService memberBasicInfoService;
|
||
|
||
@Autowired
|
||
private ClearingWithdrawInfoService clearingWithdrawInfoService;
|
||
|
||
@Autowired
|
||
private OrderPileOccupyService orderPileOccupyService;
|
||
|
||
@Autowired
|
||
private CameraBusinessServiceImpl cameraBusinessServiceImpl;
|
||
|
||
@Autowired
|
||
private LTYTService ltytService;
|
||
|
||
@Autowired
|
||
private PileMerchantInfoService pileMerchantInfoService;
|
||
|
||
@Autowired
|
||
private MemberAdapayRecordService memberAdapayRecordService;
|
||
|
||
@Autowired
|
||
private TransactionService transactionService;
|
||
|
||
@Autowired
|
||
private OrderPayRecordService orderPayRecordService;
|
||
|
||
@Autowired
|
||
private TempService tempService;
|
||
|
||
@Autowired
|
||
private MemberWalletInfoService memberWalletInfoService;
|
||
|
||
@Autowired
|
||
private MemberGroupService memberGroupService;
|
||
|
||
@Autowired
|
||
private HuaWeiService huaWeiService;
|
||
|
||
@Autowired
|
||
private NotificationService notificationService;
|
||
|
||
@Test
|
||
public void alipayLoginTest() {
|
||
String refreshToken = "";
|
||
String auth_code = "1741970ec0e7445fb2dd2712480dYX91";
|
||
try {
|
||
// AlipaySystemOauthTokenResponse alipaySystemOauthTokenResponse = Factory.Base.OAuth().refreshToken(refreshToken);
|
||
// System.out.println(JSON.toJSONString(alipaySystemOauthTokenResponse));
|
||
AlipaySystemOauthTokenResponse token = Factory.Base.OAuth().getToken(auth_code);
|
||
System.out.println(JSON.toJSONString(token));
|
||
} catch (Exception e) {
|
||
throw new RuntimeException(e);
|
||
}
|
||
}
|
||
|
||
@Test
|
||
public void getOrderRefundInfoListTest() {
|
||
String orderCode = "C44565166677";
|
||
OrderBasicInfo orderBasicInfo = new OrderBasicInfo();
|
||
orderBasicInfo.setOrderCode(orderCode);
|
||
orderBasicInfo.setMerchantId("33");
|
||
orderBasicInfo.setPayMode("4");
|
||
// 查询退款明细
|
||
List<OrderDetailInfoVO.OrderRefundInfo> orderRefundInfoList = orderBasicInfoService.getOrderRefundInfoList(orderBasicInfo);
|
||
System.out.println(JSON.toJSONString(orderRefundInfoList));
|
||
}
|
||
|
||
@Test
|
||
public void getSnowflakeIdTest() {
|
||
for (int i = 0; i < 100; i++) {
|
||
String snowflakeId = SnowflakeIdWorker.getSnowflakeId();
|
||
System.out.println("第" + i + "个snowflakeId:" + snowflakeId);
|
||
}
|
||
}
|
||
|
||
@Test
|
||
public void getOrderCodeTest() {
|
||
for (int i = 0; i < 10; i++) {
|
||
String orderCode = IdUtils.getOrderCode();
|
||
System.out.println("第" + i + 1 + "个orderCode:" + orderCode);
|
||
}
|
||
}
|
||
|
||
@Test
|
||
public void notificationStationInfoTest() {
|
||
String stationId = "19";
|
||
NotificationDTO dto = new NotificationDTO();
|
||
dto.setStationId(stationId);
|
||
dto.setPlatformType("1");
|
||
notificationService.notificationStationInfo(dto);
|
||
}
|
||
|
||
@Test
|
||
public void queryBillingPriceTest() {
|
||
String stationId = "19";
|
||
// List<BillingPriceVO> billingPriceVOS = pileBillingTemplateService.queryBillingPriceOld(stationId);
|
||
// System.out.println("老版:" + JSON.toJSONString(billingPriceVOS));
|
||
//
|
||
// List<BillingPriceVO> billingPriceVOS1 = pileBillingTemplateService.queryBillingPrice(stationId);
|
||
// System.out.println("新版:" + JSON.toJSONString(billingPriceVOS1));
|
||
|
||
CurrentTimePriceDetails currentTimePriceDetails = pileBillingTemplateService.getCurrentTimePriceDetails(stationId);
|
||
System.out.println("currentTimePriceDetails:" + JSON.toJSONString(currentTimePriceDetails));
|
||
}
|
||
|
||
@Test
|
||
public void queryPaymentRefundTest() {
|
||
String paymentId = "002212023122615542010585629628950949888";
|
||
try {
|
||
adapayService.queryPaymentRefund(paymentId, wechatAppId2);
|
||
} catch (BaseAdaPayException e) {
|
||
throw new RuntimeException(e);
|
||
}
|
||
}
|
||
|
||
@Test
|
||
public void testnotificationOperationSystemInfo() {
|
||
// HWStationInfo hwStationInfo = huaWeiService.notificationOperationSystemInfo("19");
|
||
// String s = JSON.toJSONString(hwStationInfo);
|
||
// System.out.println(s);
|
||
}
|
||
|
||
@Test
|
||
public void selectByMemberWalletListTest() {
|
||
String memberId = "12345678";
|
||
List<MemberWalletVO> memberWalletVOS = memberWalletInfoService.selectByMemberWalletList(memberId);
|
||
System.out.println(JSON.toJSONString(memberWalletVOS));
|
||
}
|
||
|
||
@Test
|
||
public void testMqttSendMsg() throws InterruptedException {
|
||
String channelId = "94dd42b6";
|
||
String topic = "/GroundlockStatus";
|
||
JSONObject jsonObject = new JSONObject();
|
||
jsonObject.put("sign","F4213AD90EBC72C678E03450E4E091EE");
|
||
jsonObject.put("sn","e27f089d-5fadf6c6");
|
||
jsonObject.put("timestamp","2021-07-01 12:00:01");
|
||
jsonObject.put("msg_id","GS2021070112000101");
|
||
jsonObject.put("msg_type","GroundlockStatus");
|
||
jsonObject.put("msg_data",null);
|
||
|
||
// ChannelFuture future = cameraBusinessServiceImpl.sendMsg(channelId, topic, JSON.toJSONString());
|
||
// System.out.println(future.toString());
|
||
}
|
||
|
||
@Test
|
||
public void testDeliverEquipBusinessPolicy() {
|
||
|
||
String result = huaWeiService.deliverEquipBusinessPolicy("test123451694073123456", "8823000000073501");
|
||
|
||
System.out.println(result);
|
||
}
|
||
|
||
|
||
@Test
|
||
public void testDiscount() {
|
||
OrderBasicInfo orderBasicInfo = new OrderBasicInfo();
|
||
orderBasicInfo.setMemberId("12345678");
|
||
orderBasicInfo.setMerchantId("1");
|
||
orderBasicInfo.setStationId("19");
|
||
orderBasicInfo.setPayAmount(new BigDecimal("200"));
|
||
|
||
OrderDetail orderDetail = new OrderDetail();
|
||
orderDetail.setTotalElectricityAmount(new BigDecimal("3"));
|
||
orderDetail.setTotalServiceAmount(new BigDecimal("0.18"));
|
||
|
||
|
||
String memberId = orderBasicInfo.getMemberId(); // 会员id
|
||
String merchantId = orderBasicInfo.getMerchantId(); // 运营商id
|
||
String stationId = orderBasicInfo.getStationId(); // 站点id
|
||
|
||
// 电费折扣金额
|
||
BigDecimal discountElectricityAmount = BigDecimal.ZERO;
|
||
// 服务费折扣金额
|
||
BigDecimal discountServiceAmount = BigDecimal.ZERO;
|
||
|
||
BigDecimal afterServiceAmountDiscount = BigDecimal.ZERO;
|
||
BigDecimal afterElectricityAmountDiscount = BigDecimal.ZERO;
|
||
|
||
// 查询会员在此站点会员折扣
|
||
MemberDiscountVO memberDiscountVO = memberGroupService.queryMemberDiscount(merchantId, stationId, memberId);
|
||
if (memberDiscountVO != null) {
|
||
BigDecimal discount = memberDiscountVO.getDiscount(); // 折扣率
|
||
String groupType = memberDiscountVO.getGroupType(); // 类型(1-服务费折扣,2-电费折扣 ,3-电费和服务费一起折扣)
|
||
BigDecimal totalElectricityAmount = orderDetail.getTotalElectricityAmount(); // 电费
|
||
BigDecimal totalServiceAmount = orderDetail.getTotalServiceAmount(); // 服务费
|
||
|
||
afterServiceAmountDiscount = totalServiceAmount;
|
||
afterElectricityAmountDiscount = totalElectricityAmount;
|
||
if (Constants.ONE.equals(groupType)) {
|
||
afterServiceAmountDiscount = totalServiceAmount.multiply(discount).setScale(4, RoundingMode.DOWN);
|
||
discountServiceAmount = totalServiceAmount.subtract(afterServiceAmountDiscount);
|
||
} else if (Constants.TWO.equals(groupType)) {
|
||
afterElectricityAmountDiscount = totalElectricityAmount.multiply(discount).setScale(4, RoundingMode.DOWN);
|
||
discountElectricityAmount = totalElectricityAmount.subtract(afterElectricityAmountDiscount);
|
||
} else {
|
||
// BigDecimal afterServiceAmountDiscount = totalServiceAmount.multiply(discount).setScale(2, RoundingMode.DOWN);
|
||
// discountServiceAmount = totalServiceAmount.subtract(afterServiceAmountDiscount);
|
||
// BigDecimal afterElectricityAmountDiscount = totalElectricityAmount.multiply(discount).setScale(2, RoundingMode.DOWN);
|
||
// discountElectricityAmount = totalElectricityAmount.subtract(afterElectricityAmountDiscount);
|
||
afterServiceAmountDiscount = totalServiceAmount.multiply(discount).setScale(4, RoundingMode.DOWN);
|
||
afterElectricityAmountDiscount = totalElectricityAmount.multiply(discount).setScale(4, RoundingMode.DOWN);
|
||
|
||
discountServiceAmount = totalServiceAmount.subtract(afterServiceAmountDiscount);
|
||
discountElectricityAmount = totalElectricityAmount.subtract(afterElectricityAmountDiscount);
|
||
}
|
||
}
|
||
// 订单折扣金额
|
||
BigDecimal discountAmount = discountServiceAmount.add(discountElectricityAmount);
|
||
orderBasicInfo.setDiscountAmount(discountAmount);
|
||
// 更新退款金额 = 退款金额 - 折扣金额
|
||
// BigDecimal refundAmount = orderBasicInfo.getRefundAmount().subtract(discountAmount);
|
||
|
||
// 总消费金额 = 折扣后电费 + 折扣后服务费
|
||
BigDecimal totalConsumeAmount = afterServiceAmountDiscount.add(afterElectricityAmountDiscount);
|
||
// 更新退款金额
|
||
BigDecimal refundAmount = orderBasicInfo.getPayAmount().subtract(totalConsumeAmount).setScale(2, RoundingMode.DOWN);
|
||
orderBasicInfo.setRefundAmount(refundAmount);
|
||
|
||
orderDetail.setDiscountElectricityAmount(discountElectricityAmount);
|
||
orderDetail.setDiscountServiceAmount(discountServiceAmount);
|
||
}
|
||
|
||
@Test
|
||
public void queryPaymentByOrderNoTest() {
|
||
String orderNo = "C88850447008_20240415083226";
|
||
String orderCode = orderNo.substring(0, orderNo.indexOf("_"));
|
||
String wechatAppId = wechatAppId1;
|
||
try {
|
||
// List<AdaPayment> adaPayments = adapayService.queryPaymentsByOrderNo(orderNo, wechatAppId);
|
||
// System.out.println(JSON.toJSONString(adaPayments));
|
||
|
||
Set<PaymentInfo> paymentInfoSet = Sets.newHashSet();
|
||
|
||
List<PaymentInfo> paymentInfos = adapayService.queryPaymentInfosByOrderNo(orderNo, wechatAppId);
|
||
paymentInfoSet.addAll(paymentInfos);
|
||
System.out.println("1111:" + JSON.toJSONString(paymentInfos));
|
||
|
||
List<OrderPayRecord> orderPayRecordList = orderPayRecordService.getOrderPayRecordList(orderCode);
|
||
if (CollectionUtils.isNotEmpty(orderPayRecordList)) {
|
||
for (OrderPayRecord orderPayRecord : orderPayRecordList) {
|
||
List<PaymentInfo> paymentInfos2 = orderPayRecordService.parseDeductionRecord(orderPayRecord.getDeductionRecord());
|
||
paymentInfoSet.addAll(paymentInfos2);
|
||
System.out.println("2222:" + JSON.toJSONString(paymentInfos2));
|
||
}
|
||
}
|
||
|
||
System.out.println("set:" + JSON.toJSONString(paymentInfoSet));
|
||
|
||
} catch (BaseAdaPayException e) {
|
||
throw new RuntimeException(e);
|
||
}
|
||
}
|
||
|
||
@Test
|
||
public void checkPaymentTest() {
|
||
QueryOrderDTO dto = new QueryOrderDTO();
|
||
String startTime = "2023-09-01 00:00:00";
|
||
String endTime = "2023-09-30 23:59:59";
|
||
dto.setStartTime(startTime);
|
||
dto.setEndTime(endTime);
|
||
|
||
try {
|
||
tempService.checkPayment(dto);
|
||
} catch (BaseAdaPayException e) {
|
||
throw new RuntimeException(e);
|
||
}
|
||
}
|
||
|
||
@Test
|
||
public void toStringTest() {
|
||
String jsonString = "{\"business\":\"00\",\"communicationVersion\":\"v1.5\",\"connectorNum\":\"01\",\"iccid\":\"89860620180085681816\",\"internetConnection\":\"00\",\"pileSn\":\"88230000000259\",\"pileType\":\"01\",\"programVersion\":\"gyk-V29\\u0000\"}";
|
||
LoginRequestData loginRequestData = JSONObject.parseObject(jsonString, LoginRequestData.class);
|
||
System.out.println(loginRequestData.toString());
|
||
}
|
||
|
||
/**
|
||
* 单元测试,测试订单流程
|
||
*/
|
||
@Test
|
||
public void testTheOrderProcess() throws Exception {
|
||
// 生成订单
|
||
// OrderBasicInfo orderBasicInfo = generateAnOrder();
|
||
// System.out.println(orderBasicInfo);
|
||
// // 支付订单
|
||
// int a = payOrder(orderBasicInfo);
|
||
// System.out.println(a);
|
||
// 结算订单
|
||
OrderBasicInfo orderBasicInfo = orderBasicInfoService.getOrderInfoByOrderCode("C46006767636");
|
||
settleOrder(orderBasicInfo);
|
||
// 订单退款
|
||
BigDecimal payAmount = orderBasicInfo.getPayAmount();
|
||
BigDecimal settleAmount = orderBasicInfo.getSettleAmount();
|
||
|
||
BigDecimal refundAmt = payAmount.subtract(settleAmount);
|
||
// 延时分账的,可以部分解冻
|
||
memberAdapayRecordService.updateRefundAmountFromFreezeAmount("1234", refundAmt);
|
||
|
||
// 实时分账,全部解冻
|
||
// memberAdapayRecordService.unfreezeAmountAndUpdateSpendAmount("test01", payAmount, refundAmt);
|
||
}
|
||
|
||
// 生成订单
|
||
private OrderBasicInfo generateAnOrder() throws ParseException {
|
||
GenerateOrderDTO dto = new GenerateOrderDTO();
|
||
PileConnectorDetailVO vo = new PileConnectorDetailVO();
|
||
vo.setStationId("2");
|
||
dto.setPileConnector(vo);
|
||
|
||
dto.setMemberId("1");
|
||
dto.setStartMode("1");
|
||
dto.setPayMode("4");
|
||
dto.setPileSn("88000000000001");
|
||
dto.setConnectorCode("01");
|
||
dto.setChargeAmount(new BigDecimal("10"));
|
||
// 查询充电桩的计费模板
|
||
BillingTemplateVO billingTemplateVO = pileBillingTemplateService.selectBillingTemplateDetailByPileSn(dto.getPileSn());
|
||
dto.setBillingTemplate(billingTemplateVO);
|
||
OrderBasicInfo orderBasicInfo = orderBasicInfoService.saveOrder2Database(dto);
|
||
|
||
return orderBasicInfo;
|
||
}
|
||
|
||
// 支付订单
|
||
private int payOrder(OrderBasicInfo orderBasicInfo) throws Exception {
|
||
// PayOrderDTO dto = new PayOrderDTO();
|
||
// dto.setMemberId(orderBasicInfo.getMemberId());
|
||
// dto.setOrderCode(orderBasicInfo.getOrderCode());
|
||
// dto.setStartMode(orderBasicInfo.getStartMode());
|
||
// dto.setPayMode(orderBasicInfo.getPayMode());
|
||
// dto.setPayAmount(orderBasicInfo.getPayAmount());
|
||
//
|
||
// Map<String, Object> map = orderBasicInfoService.payOrder(dto);
|
||
// return map;
|
||
String paymentId = "1234";
|
||
BigDecimal amount = orderBasicInfo.getPayAmount();
|
||
String orderCode = orderBasicInfo.getOrderCode();
|
||
|
||
JSONObject json = new JSONObject();
|
||
json.put("paymentId", paymentId);
|
||
json.put("amount", amount);
|
||
|
||
// 记录订单支付流水
|
||
OrderPayRecord orderPayRecord = OrderPayRecord.builder()
|
||
.orderCode(orderCode)
|
||
.payMode(OrderPayRecordEnum.WECHATPAY_PAYMENT.getValue())
|
||
.payAmount(amount)
|
||
.acquirer(AcquirerEnum.ADAPAY.getValue())
|
||
.deductionRecord(json.toJSONString())
|
||
.createBy(null)
|
||
.delFlag(DelFlagEnum.NORMAL.getValue())
|
||
.build();
|
||
orderPayRecordService.batchInsert(Lists.newArrayList(orderPayRecord));
|
||
|
||
// 更新冻结金额 支付成功后全部冻结
|
||
memberAdapayRecordService.updateFreezeAmount(paymentId, amount);
|
||
|
||
// 支付订单成功
|
||
PayOrderSuccessCallbackDTO callbackDTO = PayOrderSuccessCallbackDTO.builder()
|
||
.orderCode(orderCode)
|
||
.payAmount(amount)
|
||
.payMode(OrderPayModeEnum.PAYMENT_OF_WECHATPAY.getValue())
|
||
.acquirer(AcquirerEnum.ADAPAY.getValue())
|
||
.build();
|
||
// 订单支付成功 支付回调
|
||
// orderBasicInfoService.payOrderSuccessCallback(callbackDTO);
|
||
OrderBasicInfo orderInfo = orderBasicInfoService.getOrderInfoByOrderCode(callbackDTO.getOrderCode());
|
||
|
||
// 修改订单
|
||
orderInfo.setPayMode(callbackDTO.getPayMode());
|
||
orderInfo.setPayStatus(Constants.ONE);
|
||
orderInfo.setPayAmount(callbackDTO.getPayAmount());
|
||
orderInfo.setPayTime(new Date());
|
||
orderInfo.setChargeStartTime(new Date());
|
||
orderInfo.setOrderStatus(OrderStatusEnum.IN_THE_CHARGING.getValue());
|
||
return orderBasicInfoService.updateOrderBasicInfo(orderInfo);
|
||
|
||
}
|
||
|
||
// 结算订单
|
||
private void settleOrder(OrderBasicInfo orderBasicInfo) {
|
||
TransactionRecordsData data = TransactionRecordsData.builder()
|
||
.transactionCode(orderBasicInfo.getTransactionCode())
|
||
.pileSn(orderBasicInfo.getPileSn())
|
||
.connectorCode(orderBasicInfo.getConnectorCode())
|
||
.startTime("2023-03-10 17:10:24")
|
||
.endTime("2023-03-10 17:10:46")
|
||
.sharpPrice("1.10000")
|
||
.sharpUsedElectricity("2.0000")
|
||
.sharpAmount("2.2000")
|
||
.peakPrice("1.20000")
|
||
.peakUsedElectricity("0")
|
||
.peakAmount("0")
|
||
.flatPrice("1.30000")
|
||
.flatUsedElectricity("0")
|
||
.flatAmount("0")
|
||
.valleyPrice("1.40000")
|
||
.valleyUsedElectricity("0")
|
||
.valleyAmount("0")
|
||
.totalElectricity("2")
|
||
.consumptionAmount("5.3000")
|
||
.vinCode("\\u0000\\u0000\\u0000\\u0000\\u0000\\u0000\\u0000\\u0000\\u0000\\u0000\\u0000\\u0000\\u0000\\u0000\\u0000\\u0000\\u0000")
|
||
.transactionIdentifier("01")
|
||
.transactionTime("2023-03-10 17:10:46")
|
||
.stopReasonMsg("结束充电,APP远程停止")
|
||
.logicCard("0")
|
||
.createTime(new Date())
|
||
|
||
.build();
|
||
|
||
// orderBasicInfoService.settleOrder(data, orderBasicInfo);
|
||
// 获取更新数据后的orderBasicInfo对象
|
||
orderBasicInfoService.returnUpdateOrderBasicInfo(orderBasicInfo, data);
|
||
// 获取更新数据后的orderDetail对象/更新订单详情 查询订单详情 修改订单数据
|
||
OrderDetail orderDetail = orderBasicInfoService.returnUpdateOrderDetail(orderBasicInfo, data);
|
||
// 更新数据库
|
||
OrderTransactionDTO dto = new OrderTransactionDTO();
|
||
dto.setOrderBasicInfo(orderBasicInfo);
|
||
dto.setOrderDetail(orderDetail);
|
||
transactionService.doUpdateOrder(dto);
|
||
}
|
||
|
||
public static List<BigDecimal> calculateRefund(BigDecimal totalAmount, List<BigDecimal> payments) {
|
||
List<BigDecimal> refundList = new ArrayList<>();
|
||
BigDecimal remainingAmount = totalAmount;
|
||
|
||
for (BigDecimal payment : payments) {
|
||
if (remainingAmount.compareTo(BigDecimal.ZERO) <= 0) {
|
||
// refundList.add(BigDecimal.ZERO);
|
||
refundList.add(payment);
|
||
} else {
|
||
BigDecimal refundPerPayment = remainingAmount.min(payment);
|
||
// refundList.add(refundPerPayment);
|
||
refundList.add(payment.subtract(refundPerPayment));
|
||
remainingAmount = remainingAmount.subtract(refundPerPayment);
|
||
}
|
||
}
|
||
|
||
return refundList;
|
||
}
|
||
|
||
/**
|
||
* 测试多笔支付情况,解冻部分金额
|
||
*/
|
||
@Test
|
||
public void calculateUnfreezeAmountTest() {
|
||
BigDecimal orderAmount = new BigDecimal("0.06");
|
||
List<OrderPayRecord> payRecordList = Lists.newArrayList();
|
||
// 第一笔支付记录
|
||
JSONObject jsonObject = new JSONObject();
|
||
jsonObject.put("paymentId", "002212023083114213410543206907226374144");
|
||
jsonObject.put("amount", "0.97");
|
||
|
||
JSONObject jsonObject2 = new JSONObject();
|
||
jsonObject2.put("paymentId", "002212023083114213410543206907226374144");
|
||
jsonObject2.put("amount", "1");
|
||
|
||
JSONArray jsonArray = new JSONArray();
|
||
jsonArray.add(jsonObject);
|
||
jsonArray.add(jsonObject2);
|
||
|
||
OrderPayRecord build = OrderPayRecord.builder()
|
||
.payAmount(new BigDecimal("1.97"))
|
||
.deductionRecord(jsonArray.toJSONString())
|
||
.build();
|
||
payRecordList.add(build);
|
||
|
||
AbstractProgramLogic orderLogic = ProgramLogicFactory.getProgramLogic("1");
|
||
List<Map<String, Object>> maps = orderLogic.calculateUnfreezeAmount(orderAmount, payRecordList);
|
||
System.out.println(maps);
|
||
}
|
||
|
||
@Test
|
||
public void unfreezeAmountAndUpdateSpendAmountTest() {
|
||
String paymentId = "123";
|
||
memberAdapayRecordService.updateRefundAmount(paymentId, new BigDecimal("5"));
|
||
// memberAdapayRecordService.updateRefundAmountFromFreezeAmount(paymentId, new BigDecimal("20"));
|
||
// BigDecimal unfreezeAmount = new BigDecimal("32");
|
||
// BigDecimal spendAmount = new BigDecimal("10");
|
||
// memberAdapayRecordService.unfreezeAmountAndUpdateSpendAmount(paymentId, unfreezeAmount, spendAmount);
|
||
// memberAdapayRecordService.updateRefundAmountFromFreezeAmount(paymentId, new BigDecimal("2"));
|
||
}
|
||
|
||
@Test
|
||
public void getFirstLevelMerchantByMerchantIdTest() {
|
||
String merchantId = "13";
|
||
PileMerchantInfo merchantInfo = pileMerchantInfoService.getFirstLevelMerchantByMerchantId(merchantId);
|
||
System.out.println(JSON.toJSONString(merchantInfo));
|
||
}
|
||
|
||
@Test
|
||
public void queryPaymentInfoTest() throws BaseAdaPayException {
|
||
String paymentId = "002212023082514501110541039779091623936";
|
||
// 在完成初始化设置情况下,调用查询方法,获取 Payment 查询结果
|
||
Map<String, Object> response = Payment.query(paymentId, wechatAppId1);
|
||
System.out.println(response);
|
||
}
|
||
|
||
/**
|
||
* 【用户需要换绑银行卡 1-删除结算账户信息,2-使用新账户信息创建结算账户】
|
||
* 删除结算账户信息
|
||
* @throws BaseAdaPayException
|
||
*/
|
||
@Test
|
||
public void createDeleteSettleAccountRequestTest() throws BaseAdaPayException {
|
||
String adapayMemberId = "AM40919405";
|
||
String settleAccountId = "0540761871278208";
|
||
adapayService.createDeleteSettleAccountRequest(adapayMemberId, settleAccountId, wechatAppId1);
|
||
}
|
||
|
||
/**
|
||
* 手动变更银行卡信息
|
||
*/
|
||
@Test
|
||
public void createSettleAccountRequestTest() throws BaseAdaPayException {
|
||
SettleAccountDTO dto = new SettleAccountDTO();
|
||
dto.setCardId("45050160425000000627");
|
||
dto.setCardName("广西昂晟节能科技有限公司");
|
||
dto.setTelNo("19163816451");
|
||
dto.setBankCode("01050000");
|
||
dto.setBankAcctType("1");
|
||
dto.setProvCode("0045");
|
||
dto.setAreaCode("4501");
|
||
String adapayMemberId = "ACM82792551";
|
||
adapayService.createSettleAccountRequest(dto, adapayMemberId, wechatAppId1);
|
||
}
|
||
|
||
@Test
|
||
public void queryDrawcashDetailTest() throws BaseAdaPayException {
|
||
String orderNo = "drawcash_1692339516947";
|
||
DrawCashDetailVO drawCashDetailVO = adapayService.queryDrawCashDetail(orderNo, wechatAppId1);
|
||
System.out.println(drawCashDetailVO);
|
||
}
|
||
|
||
@Test
|
||
public void refundOrderTest() {
|
||
String orderCode = "C80410085692";
|
||
OrderBasicInfo orderBasicInfo = orderBasicInfoService.getOrderInfoByOrderCode(orderCode);
|
||
String mode = pileMerchantInfoService.getDelayModeByMerchantId(orderBasicInfo.getMerchantId());
|
||
AbstractProgramLogic orderLogic = ProgramLogicFactory.getProgramLogic(mode);
|
||
orderLogic.refundOrder(orderBasicInfo);
|
||
}
|
||
|
||
@Test
|
||
public void queryPaymentConfirmListTest() {
|
||
QueryPaymentConfirmDTO dto = new QueryPaymentConfirmDTO();
|
||
dto.setWechatAppId(wechatAppId1);
|
||
dto.setPaymentId("002212023122208033310584061601344237568");
|
||
QueryPaymentConfirmDetailResponse response = adapayService.queryPaymentConfirmList(dto);
|
||
List<QueryPaymentConfirmDetailResponse.PaymentConfirmInfo> paymentConfirms = response.getPaymentConfirms();
|
||
// 如果没有分账信息,说明没有清分
|
||
String clearingStatus = null;
|
||
if (org.springframework.util.CollectionUtils.isEmpty(paymentConfirms)) {
|
||
clearingStatus = "未清分";
|
||
} else {
|
||
clearingStatus = "已清分";
|
||
}
|
||
System.out.println(clearingStatus);
|
||
}
|
||
|
||
@Test
|
||
public void queryAcctFlowListTest() {
|
||
QueryAcctFlowDTO dto = new QueryAcctFlowDTO();
|
||
try {
|
||
dto.setPageNo(1);
|
||
dto.setPageSize(100);
|
||
dto.setAcctType("01");
|
||
dto.setWechatAppId(wechatAppId1);
|
||
dto.setAdapayMemberId("ACM69424215");
|
||
dto.setBeginDate("20230823");
|
||
dto.setEndDate("20230823");
|
||
adapayService.queryAcctFlowList(dto);
|
||
} catch (BaseAdaPayException e) {
|
||
throw new RuntimeException(e);
|
||
}
|
||
}
|
||
|
||
@Test
|
||
public void testCalculateTheBalanceDeductionAmount() {
|
||
String memberId = "123456";
|
||
BigDecimal amount = new BigDecimal("20");
|
||
|
||
List<BalanceDeductionAmountVO> resultList = Lists.newArrayList();
|
||
// 查询会员的余额充值记录 按照充值时间正序
|
||
List<MemberAdapayRecord> memberAdapayRecords = Lists.newArrayList();
|
||
memberAdapayRecords.add(MemberAdapayRecord.builder().paymentId("1").balanceAmt(new BigDecimal("50")).build());
|
||
memberAdapayRecords.add(MemberAdapayRecord.builder().paymentId("2").balanceAmt(new BigDecimal("60")).build());
|
||
memberAdapayRecords.add(MemberAdapayRecord.builder().paymentId("3").balanceAmt(new BigDecimal("10")).build());
|
||
|
||
// 定义一个临时金额等于消费金额
|
||
BigDecimal tempAmount = new BigDecimal(amount.toString());
|
||
for (MemberAdapayRecord memberAdapayRecord : memberAdapayRecords) {
|
||
// 该笔支付剩余金额 取出一笔判断是否剩余金额够支付订单消费吗
|
||
BigDecimal balanceAmt = memberAdapayRecord.getBalanceAmt();
|
||
// 该笔支付扣除金额
|
||
BigDecimal deductionAmount;
|
||
// 获取延时分账模式 延时分账的使用撤销方法退款,实时分账的使用退款方法
|
||
// AdapayCallbackRecord callbackRecord = adapayCallbackRecordService.selectByPaymentId(memberAdapayRecord.getPaymentId());
|
||
// String payMode = null;
|
||
// if (callbackRecord != null) {
|
||
// JSONObject expendJsonObject = JSON.parseObject(callbackRecord.getExpend());
|
||
// payMode = expendJsonObject.getString("payMode");
|
||
// }
|
||
// 消费金额 - 剩余金额
|
||
tempAmount = tempAmount.subtract(balanceAmt);
|
||
if (tempAmount.compareTo(BigDecimal.ZERO) >= 0) {
|
||
// 计算以后,大于等于0,说明这笔支付剩余金额需要扣完
|
||
deductionAmount = balanceAmt;
|
||
BalanceDeductionAmountVO build = BalanceDeductionAmountVO.builder()
|
||
.memberId(memberId)
|
||
.paymentId(memberAdapayRecord.getPaymentId())
|
||
.deductionAmount(deductionAmount)
|
||
.build();
|
||
resultList.add(build);
|
||
} else {
|
||
// 如果小于0,则说明剩余的钱用不完,扣除金额等于消费金额,并结束循环
|
||
deductionAmount = balanceAmt.add(tempAmount);
|
||
BalanceDeductionAmountVO build = BalanceDeductionAmountVO.builder()
|
||
.memberId(memberId)
|
||
.paymentId(memberAdapayRecord.getPaymentId())
|
||
.deductionAmount(deductionAmount)
|
||
.build();
|
||
resultList.add(build);
|
||
break;
|
||
}
|
||
}
|
||
|
||
System.out.println(JSON.toJSONString(resultList));
|
||
}
|
||
|
||
@Test
|
||
public void testGenerateOccupyPileOrder() {
|
||
String memberId = "67569684";
|
||
String pileSn = "88230000000135";
|
||
String connectorCode = "01";
|
||
GenerateOccupyOrderDTO dto = new GenerateOccupyOrderDTO();
|
||
dto.setMemberId(memberId);
|
||
dto.setPileSn(pileSn);
|
||
dto.setConnectorCode(connectorCode);
|
||
|
||
orderPileOccupyService.generateOccupyPileOrder(dto);
|
||
}
|
||
|
||
@Test
|
||
public void testQueryConfirmReverse() throws BaseAdaPayException {
|
||
QueryConfirmReverseDTO dto = QueryConfirmReverseDTO.builder()
|
||
.paymentConfirmId("0022120231023104957990562360205131259904")
|
||
.wechatAppId(wechatAppId1)
|
||
.build();
|
||
adapayService.queryConfirmReverse(dto);
|
||
}
|
||
|
||
|
||
@Test
|
||
public void testStopOccupyPileOrder() {
|
||
String wechatAppId = "54135135";
|
||
AbstractAdapayConfig config = AdapayConfigFactory.getConfig(wechatAppId);
|
||
System.out.println(JSON.toJSONString(config));
|
||
|
||
AbstractAdapayConfig config2 = AdapayConfigFactory.getConfig(wechatAppId1);
|
||
System.out.println(JSON.toJSONString(config2));
|
||
}
|
||
|
||
// 需要重新分账的订单信息(针对未分账的订单)
|
||
public JSONArray getPaymentList() {
|
||
String jsonArrayString = "[" +
|
||
"{\"orderCode\":\"C44778282947\", \"settleAmount\":\"8.38\", \"paymentId\":\"002212023101608315910559788773415297024\"}" +
|
||
"]";
|
||
return JSONArray.parseArray(jsonArrayString);
|
||
}
|
||
|
||
/**
|
||
* 批量执行分账
|
||
*/
|
||
@Test
|
||
public void batchCreatePaymentConfirm() {
|
||
JSONArray paymentList = getPaymentList();
|
||
// TODO 获取默认结算账户,如需分给对应商户就填写正确的汇付会员id
|
||
// AdapayMemberAccount adapayMemberAccount = adapayMemberAccountService.getDefault();
|
||
AdapayMemberAccount adapayMemberAccount = new AdapayMemberAccount();
|
||
adapayMemberAccount.setAdapayMemberId("0");
|
||
for (int i = 0; i < paymentList.size(); i++) {
|
||
JSONObject jsonObject = (JSONObject) paymentList.get(i);
|
||
BigDecimal confirmAmt = jsonObject.getBigDecimal("settleAmount"); // 确认金额就是结算金额
|
||
String paymentId = jsonObject.getString("paymentId"); // 支付id
|
||
String orderCode = jsonObject.getString("orderCode"); // 订单编号
|
||
|
||
// 延时分账,使用确认交易API
|
||
PaymentConfirmResponse paymentConfirmResponse = adapayService.createPaymentConfirmRequest(paymentId,
|
||
adapayMemberAccount, confirmAmt, orderCode, wechatAppId1);
|
||
System.out.println(JSON.toJSONString(paymentConfirmResponse));
|
||
}
|
||
}
|
||
|
||
/**
|
||
* 查询分账信息
|
||
* @throws BaseAdaPayException
|
||
*/
|
||
@Test
|
||
public void queryCreateConfirmReverse() throws BaseAdaPayException {
|
||
List<String> paymentIdList = getPaymentIdList(); // 查询分账信息
|
||
|
||
List<String> unSplitList = Lists.newArrayList(); //
|
||
List<String> splitList = Lists.newArrayList(); //
|
||
|
||
BigDecimal total = BigDecimal.ZERO;
|
||
List<String> selfList = Lists.newArrayList();
|
||
|
||
Map<String, BigDecimal> map = Maps.newHashMap();
|
||
for (String paymentId : paymentIdList) {
|
||
if (StringUtils.isBlank(paymentId)) {
|
||
continue;
|
||
}
|
||
// 查询支付确认id
|
||
QueryPaymentConfirmDTO dto = new QueryPaymentConfirmDTO();
|
||
dto.setPaymentId(paymentId);
|
||
dto.setWechatAppId(wechatAppId1);
|
||
// 查询分账信息
|
||
QueryPaymentConfirmDetailResponse response = adapayService.queryPaymentConfirmList(dto);
|
||
if (response != null) {
|
||
List<QueryPaymentConfirmDetailResponse.PaymentConfirmInfo> confirms = response.getPaymentConfirms();
|
||
if (CollectionUtils.isEmpty(confirms)) {
|
||
unSplitList.add(paymentId);
|
||
} else {
|
||
splitList.add(paymentId);
|
||
for (QueryPaymentConfirmDetailResponse.PaymentConfirmInfo confirm : confirms) {
|
||
if (queryConfirmReverseStatus(confirm)) {
|
||
System.out.println("支付确认id:" + confirm.getId() + "撤销了。。。");
|
||
continue;
|
||
}
|
||
JSONObject jsonObject = JSON.parseObject(confirm.getDescription());
|
||
String adapayMemberId = jsonObject.getString("adapayMemberId");
|
||
BigDecimal confirmedAmt = new BigDecimal(confirm.getConfirmedAmt());
|
||
|
||
total = total.add(confirmedAmt);
|
||
|
||
// 放map
|
||
map.merge(adapayMemberId, confirmedAmt, BigDecimal::add);
|
||
|
||
if (StringUtils.equals(adapayMemberId, "0")) {
|
||
selfList.add(paymentId);
|
||
}
|
||
}
|
||
}
|
||
} else {
|
||
unSplitList.add(paymentId);
|
||
}
|
||
}
|
||
System.out.println("=================未分账:" + JSON.toJSONString(unSplitList) + ", 数量:" + unSplitList.size());
|
||
System.out.println("=================已分账:" + JSON.toJSONString(map) + ", 总分账:" + total + ", 数量:" + splitList.size());
|
||
System.out.println("=================自己:" + JSON.toJSONString(selfList) + ", 数量:" + selfList.size());
|
||
}
|
||
|
||
private boolean queryConfirmReverseStatus(QueryPaymentConfirmDetailResponse.PaymentConfirmInfo confirm) throws BaseAdaPayException {
|
||
boolean result = false;
|
||
|
||
QueryConfirmReverseDTO dto = QueryConfirmReverseDTO.builder()
|
||
.paymentConfirmId(confirm.getId())
|
||
.wechatAppId(wechatAppId1)
|
||
.build();
|
||
ConfirmReverseResponse confirmReverseResponse = adapayService.queryConfirmReverse(dto);
|
||
if (confirmReverseResponse.isSuccess()) {
|
||
result = true;
|
||
}
|
||
|
||
return result;
|
||
}
|
||
|
||
/**
|
||
* 延迟分账未确认调撤销调撤销接口退款
|
||
*/
|
||
@Test
|
||
public void createPaymentReverseRequestTest() {
|
||
String paymentId = "002212023082409392010540599165461884928";
|
||
BigDecimal refundAmount = new BigDecimal("0.09");
|
||
String memberId = null;
|
||
|
||
// 延迟分账未确认调撤销调撤销接口退款
|
||
PaymentReverseOperation operation = new PaymentReverseOperation();
|
||
operation.setPaymentId(paymentId);
|
||
operation.setReverseAmt(refundAmount);
|
||
operation.setMerchantKey(wechatAppId2);
|
||
operation.setMemberId(memberId);
|
||
operation.setScenarioType(ScenarioEnum.ORDER.getValue());
|
||
operation.setOrderCode(null);
|
||
PaymentReverseResponse response = adapayService.createPaymentReverseRequest(operation);
|
||
System.out.println(JSON.toJSONString(response));
|
||
}
|
||
|
||
/**
|
||
* 测试创建退款请求
|
||
*/
|
||
@Test
|
||
public void createRefundRequestTest() {
|
||
String paymentId = "0022120231226155420105856296289509498883333";
|
||
BigDecimal refundAmount = new BigDecimal("11.62");
|
||
String memberId = "46487809";
|
||
String orderCode = "C80414417003";
|
||
// 调汇付的交易退款接口
|
||
RefundResponse response = adapayService.createRefundRequest(paymentId, refundAmount,
|
||
wechatAppId2, memberId, ScenarioEnum.ORDER.getValue(), orderCode);
|
||
System.out.println(JSON.toJSONString(response));
|
||
}
|
||
|
||
/**
|
||
* 批量支付确认撤销
|
||
* @throws BaseAdaPayException
|
||
*/
|
||
@Test
|
||
public void testCreateConfirmReverse() throws BaseAdaPayException {
|
||
List<String> list = getPaymentIdList(); // 批量支付确认撤销
|
||
for (String paymentId : list) {
|
||
// 查询支付确认id
|
||
QueryPaymentConfirmDTO dto = new QueryPaymentConfirmDTO();
|
||
dto.setPaymentId(paymentId);
|
||
dto.setWechatAppId(wechatAppId1);
|
||
QueryPaymentConfirmDetailResponse response = adapayService.queryPaymentConfirmList(dto);
|
||
if (response != null) {
|
||
List<QueryPaymentConfirmDetailResponse.PaymentConfirmInfo> confirms = response.getPaymentConfirms();
|
||
System.out.println("支付id:" + paymentId + ", 确认信息:" + JSON.toJSONString(confirms));
|
||
if (CollectionUtils.isNotEmpty(confirms)) {
|
||
for (QueryPaymentConfirmDetailResponse.PaymentConfirmInfo confirm : confirms) {
|
||
adapayService.createConfirmReverse(confirm.getId(), wechatAppId1);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
/**
|
||
* 查询撤销列表
|
||
* @throws BaseAdaPayException
|
||
*/
|
||
@Test
|
||
public void queryPaymentReverseListTest() throws BaseAdaPayException {
|
||
JSONArray jsonList = getJsonList();
|
||
|
||
List<String> idList = Lists.newArrayList();
|
||
for (int i = 0; i < jsonList.size(); i++) {
|
||
JSONObject jsonObject = (JSONObject) jsonList.get(i);
|
||
// System.out.println(JSON.toJSONString());
|
||
BigDecimal refundAmount = jsonObject.getBigDecimal("refundAmount");
|
||
String paymentId = jsonObject.getString("paymentId");
|
||
|
||
adapayService.createPaymentReverseRequest(paymentId, refundAmount, wechatAppId1, "", ScenarioEnum.ORDER.getValue(), "");
|
||
|
||
}
|
||
System.out.println("需要撤销idList:" + idList);
|
||
}
|
||
|
||
public JSONArray getJsonList() {
|
||
String jsonArrayString = "[{\"refundAmount\":\"354.84\", \"paymentId\":\"002212023102509474610563069333816762368\"}]";
|
||
JSONArray jsonArray = JSONArray.parseArray(jsonArrayString);
|
||
return jsonArray;
|
||
}
|
||
|
||
|
||
private List<String> getPaymentIdList1() {
|
||
List<String> list = Lists.newArrayList();
|
||
list.add("002212024010105140910587642852073115648");
|
||
list.add("002212024010105164010587643484248064000");
|
||
list.add("002212024010108281310587691691265712128");
|
||
list.add("002212024010109223110587705352690479104");
|
||
list.add("002212024010109534910587713230205759488");
|
||
list.add("002212024010110300810587722370920607744");
|
||
list.add("002212024010111190010587734668495249408");
|
||
list.add("002212024010111555510587743958016831488");
|
||
list.add("002212024010112261110587751575549341696");
|
||
list.add("002212024010113305410587767861726371840");
|
||
list.add("002212024010113312110587767973720502272");
|
||
list.add("002212024010113322510587768244083724288");
|
||
list.add("002212024010113395010587770109632729088");
|
||
list.add("002212024010114110810587777987342086144");
|
||
list.add("002212024010115105610587793034673369088");
|
||
list.add("002212024010115233910587796236878852096");
|
||
list.add("002212024010115405810587800595778441216");
|
||
list.add("002212024010116222510587811026888945664");
|
||
list.add("002212024010117175210587824980144885760");
|
||
list.add("002212024010117283110587827661843685376");
|
||
list.add("002212024010117483210587832697992654848");
|
||
list.add("002212024010117510710587833348917256192");
|
||
list.add("002212024010117580010587835079405219840");
|
||
list.add("002212024010118485310587847884872216576");
|
||
list.add("002212024010120172810587870177805045760");
|
||
list.add("002212024010121581610587895543306432512");
|
||
list.add("002212024010122005410587896209115287552");
|
||
list.add("002212024010123400710587921176524206080");
|
||
list.add("002212024010201052810587942653671444480");
|
||
list.add("");
|
||
list.add("002212024010208004610588047170942676992");
|
||
list.add("002212024010208442110588058135178096640");
|
||
list.add("002212024010209494210588074583666298880");
|
||
list.add("002212024010210433510588088142478405632");
|
||
list.add("002212024010212162310588111498239307776");
|
||
list.add("002212024010212193110588112286479925248");
|
||
list.add("002212024010212405210588117657447165952");
|
||
list.add("002212024010213013210588122857758142464");
|
||
list.add("002212024010213274910588129475047698432");
|
||
list.add("002212024010213291310588129824899186688");
|
||
list.add("002212024010213301710588130093398110208");
|
||
list.add("002212024010213392810588132405930389504");
|
||
list.add("002212024010214393910588147549470601216");
|
||
list.add("002212024010214411610588147957548412928");
|
||
list.add("002212024010214581710588152242047070208");
|
||
list.add("002212024010215033310588153564514242560");
|
||
list.add("");
|
||
list.add("002212024010215101710588155259517886464");
|
||
list.add("002212024010215431010588163534376767488");
|
||
list.add("002212024010215542710588166375175032832");
|
||
list.add("002212024010216405110588178052995461120");
|
||
list.add("002212024010217183210588187533857288192");
|
||
list.add("");
|
||
list.add("002212024010218183010588202627551838208");
|
||
list.add("002212024010221363810588252487987777536");
|
||
list.add("002212024010223003910588273630469525504");
|
||
list.add("002212024010223283610588280666732474368");
|
||
list.add("002212024010302584510588333553947357184");
|
||
list.add("002212024010305401010588374171870662656");
|
||
list.add("002212024010310292510588446965722820608");
|
||
list.add("002212024010311105610588457413943455744");
|
||
list.add("002212024010311592510588469614441336832");
|
||
list.add("002212024010312195010588474754456334336");
|
||
list.add("002212024010312205310588475015696347136");
|
||
list.add("002212024010312511810588482672879841280");
|
||
list.add("002212024010313013910588485277455347712");
|
||
list.add("002212024010314224310588505676416651264");
|
||
list.add("002212024010315432510588525984907112448");
|
||
list.add("002212024010316272410588537054307926016");
|
||
list.add("002212024010316380410588539738533015552");
|
||
list.add("002212024010317100210588547785655103488");
|
||
list.add("002212024010317200310588550303411974144");
|
||
list.add("002212024010317433110588556211036073984");
|
||
list.add("002212024010318022810588560981031251968");
|
||
list.add("002212024010318404310588570607421853696");
|
||
list.add("002212024010319074310588577400032350208");
|
||
list.add("002212024010319091810588577798165585920");
|
||
list.add("002212024010319264510588582188912865280");
|
||
list.add("002212024010319511310588588347325173760");
|
||
list.add("002212024010321260810588612235363577856");
|
||
list.add("002212024010403220610588701817823948800");
|
||
list.add("002212024010408064310588773441416572928");
|
||
list.add("002212024010410201110588807029942267904");
|
||
list.add("002212024010412072710588834022674513920");
|
||
list.add("002212024010412440910588843261602934784");
|
||
list.add("002212024010412571410588846554176532480");
|
||
list.add("002212024010413225210588853004072062976");
|
||
list.add("002212024010414045510588863586674348032");
|
||
list.add("002212024010414245510588868621276246016");
|
||
list.add("002212024010414343110588871034695184384");
|
||
list.add("002212024010414530910588875723984191488");
|
||
list.add("002212024010415550710588891316875542528");
|
||
list.add("002212024010416204510588897770757910528");
|
||
list.add("002212024010416233110588898465537527808");
|
||
list.add("002212024010416383310588902249646219264");
|
||
list.add("002212024010418024210588923427149254656");
|
||
list.add("002212024010418063110588924386491740160");
|
||
list.add("002212024010418192010588927611642417152");
|
||
list.add("002212024010419322710588946011228147712");
|
||
list.add("002212024010421565310588982358823170048");
|
||
list.add("002212024010422264210588989865398571008");
|
||
list.add("002212024010503422310589069309852102656");
|
||
list.add("002212024010508493210589146603667206144");
|
||
list.add("002212024010512203810589199729497038848");
|
||
list.add("002212024010513012910589210008453681152");
|
||
list.add("002212024010513390410589219469042761728");
|
||
list.add("002212024010514102910589227375142412288");
|
||
list.add("002212024010514260210589231287828983808");
|
||
list.add("002212024010514300910589232325934698496");
|
||
list.add("002212024010514575810589239325632008192");
|
||
list.add("002212024010516015010589255399119294464");
|
||
list.add("002212024010516045810589256187476480000");
|
||
list.add("002212024010516071610589256763717459968");
|
||
list.add("002212024010516123810589258113776287744");
|
||
list.add("002212024010518274310589292110518616064");
|
||
list.add("002212024010518555010589299186311524352");
|
||
list.add("002212024010519083810589302405275619328");
|
||
list.add("002212024010519202310589305361828978688");
|
||
list.add("002212024010519253710589306681909424128");
|
||
list.add("002212024010520085910589317595099197440");
|
||
list.add("002212024010522214210589350993572749312");
|
||
list.add("002212024010522333210589353971115212800");
|
||
list.add("002212024010523011310589360936974266368");
|
||
list.add("002212024010601270010589397625907118080");
|
||
list.add("002212024010604344310589444866759032832");
|
||
list.add("002212024010609525110589524925455106048");
|
||
list.add("002212024010609542310589525315029393408");
|
||
list.add("002212024010611352110589550722119204864");
|
||
list.add("002212024010611500210589554415880151040");
|
||
list.add("002212024010612433110589567876705710080");
|
||
list.add("002212024010613145810589575791161319424");
|
||
list.add("002212024010614575410589601694792065024");
|
||
list.add("002212024010615073610589604134962057216");
|
||
list.add("002212024010615350210589611042544123904");
|
||
list.add("002212024010616253110589623746114658304");
|
||
list.add("002212024010616304210589625051192913920");
|
||
list.add("002212024010616391610589627205286785024");
|
||
list.add("002212024010616492410589629756543496192");
|
||
list.add("002212024010617552110589646350352654336");
|
||
list.add("002212024010618084710589649732601217024");
|
||
list.add("002212024010619101210589665189306679296");
|
||
list.add("002212024010620024510589678413608919040");
|
||
list.add("002212024010701191410589758059547234304");
|
||
list.add("002212024010703080510589785453448433664");
|
||
list.add("002212024010709192910589878916212568064");
|
||
list.add("002212024010709301410589881625295831040");
|
||
list.add("002212024010709374410589883510933463040");
|
||
list.add("002212024010709460610589885615266955264");
|
||
list.add("002212024010711341810589912844171591680");
|
||
list.add("002212024010712174210589923769393987584");
|
||
list.add("002212024010712293410589926753890213888");
|
||
list.add("002212024010713294310589941889740251136");
|
||
list.add("002212024010714162410589953639011618816");
|
||
list.add("002212024010715053310589966009022644224");
|
||
list.add("002212024010715220810589970180526288896");
|
||
list.add("002212024010715394110589974598291644416");
|
||
list.add("002212024010715530310589977960951783424");
|
||
list.add("002212024010715535710589978190702080000");
|
||
list.add("002212024010715553010589978580159811584");
|
||
list.add("002212024010715575210589979173691748352");
|
||
list.add("002212024010716114710589982677215981568");
|
||
list.add("002212024010716155510589983715766292480");
|
||
list.add("002212024010716301310589987316148629504");
|
||
list.add("002212024010716355710589988759131639808");
|
||
list.add("002212024010716512710589992661342420992");
|
||
list.add("002212024010717142210589998424360120320");
|
||
list.add("002212024010717304610590002552651100160");
|
||
list.add("002212024010717340310590003381306433536");
|
||
list.add("002212024010718595910590025005585387520");
|
||
list.add("002212024010719303310590032700077604864");
|
||
list.add("002212024010719431610590035900214116352");
|
||
list.add("002212024010720441710590051255371259904");
|
||
list.add("002212024010721262510590061858348171264");
|
||
list.add("002212024010722163510590074482951434240");
|
||
list.add("002212024010723310810590093240771178496");
|
||
list.add("002212024010801234210590121571174932480");
|
||
list.add("002212024010808200210590226343585894400");
|
||
list.add("002212024010808575910590235895560183808");
|
||
list.add("002212024010809182810590241051781668864");
|
||
list.add("002212024010810093010590253895061430272");
|
||
list.add("002212024010811275210590273616585695232");
|
||
list.add("002212024010812011510590282017054597120");
|
||
list.add("002212024010813083010590298937834274816");
|
||
list.add("002212024010813570510590311164752805888");
|
||
list.add("002212024010814322810590320071982301184");
|
||
list.add("002212024010815504110590339752872214528");
|
||
list.add("002212024010816241510590348203136233472");
|
||
list.add("002212024010816333010590350528305111040");
|
||
list.add("002212024010816345010590350867406356480");
|
||
list.add("002212024010817524710590370480527806464");
|
||
list.add("002212024010817531510590370600776048640");
|
||
list.add("002212024010819442110590398558322667520");
|
||
list.add("002212024010820311610590410365399445504");
|
||
list.add("002212024010821194610590422571309899776");
|
||
list.add("002212024010821224810590423334787317760");
|
||
list.add("002212024010903394410590518191898869760");
|
||
list.add("002212024010906435610590564548453584896");
|
||
list.add("002212024010911460110590640571849752576");
|
||
list.add("002212024010912395510590654134638858240");
|
||
list.add("002212024010913004510590659378532409344");
|
||
list.add("002212024010913223210590664859952726016");
|
||
list.add("002212024010914100910590676840871997440");
|
||
list.add("002212024010914155910590678309669445632");
|
||
list.add("002212024010914465110590686078906912768");
|
||
list.add("002212024010915103310590692044332539904");
|
||
list.add("002212024010915272510590696288296411136");
|
||
list.add("002212024010917000310590719599549988864");
|
||
list.add("002212024010917142910590723233272676352");
|
||
list.add("002212024010917392610590729511610810368");
|
||
list.add("002212024010917492210590732010741129216");
|
||
list.add("002212024010917562610590733788495421440");
|
||
list.add("002212024010918313610590742640133648384");
|
||
list.add("002212024010920025210590765606946250752");
|
||
list.add("002212024010920051810590766218583584768");
|
||
list.add("002212024010920251910590771257604296704");
|
||
list.add("002212024010920453610590776359274663936");
|
||
list.add("002212024010921160810590784043145428992");
|
||
list.add("002212024011001463910590852120421756928");
|
||
list.add("002212024011003360910590879678332178432");
|
||
list.add("002212024011007572510590945429954736128");
|
||
list.add("002212024011008275110590953085801603072");
|
||
list.add("002212024011008425310590956872182906880");
|
||
list.add("002212024011009271910590968054200700928");
|
||
list.add("002212024011009275910590968222245965824");
|
||
list.add("002212024011012221410591012072433655808");
|
||
list.add("002212024011012292910591013895922630656");
|
||
list.add("002212024011012554610591020512596574208");
|
||
list.add("002212024011013273810591028529017253888");
|
||
list.add("002212024011013433210591032533925482496");
|
||
list.add("002212024011014372610591046095351799808");
|
||
list.add("002212024011014375210591046206713450496");
|
||
list.add("002212024011015045010591052990007640064");
|
||
list.add("002212024011015095210591054259711217664");
|
||
list.add("002212024011015152910591055673510518784");
|
||
list.add("002212024011015182610591056415863296000");
|
||
list.add("002212024011015235410591057791130755072");
|
||
list.add("002212024011015360310591060847420145664");
|
||
list.add("002212024011016361010591075978081570816");
|
||
list.add("002212024011016482210591079046616403968");
|
||
list.add("002212024011017070910591083773309124608");
|
||
list.add("002212024011018100810591099625657810944");
|
||
list.add("002212024011018542010591110745493852160");
|
||
list.add("002212024011019384910591121941026734080");
|
||
list.add("002212024011020361510591136396656472064");
|
||
list.add("002212024011022074310591159411961221120");
|
||
list.add("002212024011022443710591168698979676160");
|
||
list.add("002212024011100455410591199221220216832");
|
||
list.add("002212024011103460110591244550372253696");
|
||
list.add("002212024011104583010591262792289722368");
|
||
list.add("002212024011107201010591298441709461504");
|
||
list.add("002212024011111023710591354425660252160");
|
||
list.add("002212024011111183810591358453657755648");
|
||
list.add("002212024011111372010591363161638166528");
|
||
list.add("002212024011113224510591389688611434496");
|
||
list.add("002212024011114355110591408086924869632");
|
||
list.add("002212024011114413110591409513868947456");
|
||
list.add("002212024011115234210591420127512002560");
|
||
list.add("002212024011116222410591434900089065472");
|
||
list.add("002212024011116334110591437740936609792");
|
||
list.add("002212024011117550110591458205978255360");
|
||
list.add("002212024011118262010591466090003857408");
|
||
list.add("002212024011119001310591474614765309952");
|
||
list.add("002212024011119281010591481650923388928");
|
||
list.add("002212024011120465310591501461268545536");
|
||
list.add("002212024011121431810591515656835907584");
|
||
list.add("002212024011202055610591581749288493056");
|
||
list.add("002212024011208453010591682306620747776");
|
||
list.add("002212024011209480510591698054968721408");
|
||
list.add("002212024011210321110591709150938480640");
|
||
list.add("002212024011210565610591715381020622848");
|
||
list.add("002212024011212160010591735280043778048");
|
||
list.add("002212024011212181710591735855118409728");
|
||
list.add("002212024011212221310591736845650968576");
|
||
list.add("002212024011213045610591747595688427520");
|
||
list.add("002212024011213592810591761317389623296");
|
||
list.add("002212024011215080510591778585540665344");
|
||
list.add("002212024011215403510591786764712140800");
|
||
list.add("002212024011215592710591791512444895232");
|
||
list.add("002212024011216090210591793923649077248");
|
||
list.add("002212024011216105310591794388513972224");
|
||
list.add("002212024011216482910591803853729656832");
|
||
list.add("002212024011217030510591807527790039040");
|
||
list.add("002212024011217072010591808595729006592");
|
||
list.add("002212024011217255310591813263572762624");
|
||
list.add("002212024011217341310591815362836918272");
|
||
list.add("002212024011217341510591815369501396992");
|
||
list.add("002212024011218145710591825613780058112");
|
||
list.add("002212024011218213010591827258970398720");
|
||
list.add("002212024011221032210591867994465071104");
|
||
list.add("002212024011222134110591885690146758656");
|
||
list.add("002212024011302212310591948024930058240");
|
||
list.add("002212024011309181510592052934661062656");
|
||
list.add("002212024011309271110592055183661584384");
|
||
list.add("002212024011309323410592056539401900032");
|
||
list.add("002212024011311455410592090093296238592");
|
||
list.add("002212024011312133910592097076208418816");
|
||
list.add("002212024011313344610592117489365807104");
|
||
list.add("002212024011314364310592133079880134656");
|
||
list.add("002212024011314411210592134208486588416");
|
||
list.add("002212024011314513710592136828158033920");
|
||
list.add("002212024011315051210592140249305874432");
|
||
list.add("002212024011315263310592145622158909441");
|
||
list.add("002212024011315373610592148400582127616");
|
||
list.add("002212024011315495610592151507333472256");
|
||
list.add("002212024011316051910592155375091970048");
|
||
list.add("002212024011317134310592172591542075392");
|
||
list.add("002212024011317151010592172954869288960");
|
||
list.add("002212024011317241610592175243017310208");
|
||
list.add("002212024011317342510592177801358139392");
|
||
list.add("002212024011318090810592186535455334400");
|
||
list.add("002212024011318571310592198634839314432");
|
||
list.add("002212024011320030310592215204944232448");
|
||
list.add("002212024011320443710592225665992085504");
|
||
list.add("002212024011320452710592225872905428992");
|
||
list.add("002212024011321355510592238574350491648");
|
||
list.add("002212024011400560510592288949676003328");
|
||
list.add("002212024011401515710592303006843916288");
|
||
list.add("002212024011409265910592417518954704896");
|
||
list.add("002212024011410391110592435691809595392");
|
||
list.add("002212024011410432810592436767558332416");
|
||
list.add("002212024011410483710592438063986364416");
|
||
list.add("002212024011411434910592451955699343360");
|
||
list.add("002212024011412425910592466847619981312");
|
||
list.add("002212024011412465610592467841403445248");
|
||
list.add("002212024011413312610592479039473704960");
|
||
list.add("002212024011413540910592484756123475968");
|
||
list.add("002212024011414144310592489932594429952");
|
||
list.add("002212024011414351810592495112661401600");
|
||
list.add("002212024011415505310592514132070227968");
|
||
list.add("002212024011416024910592517133612716032");
|
||
list.add("002212024011416142010592520032212410368");
|
||
list.add("002212024011416294310592523903176503296");
|
||
list.add("002212024011416564710592530716501315584");
|
||
list.add("002212024011417015910592532025912958976");
|
||
list.add("002212024011417103710592534198113697792");
|
||
list.add("002212024011418001910592546703697108992");
|
||
list.add("002212024011418115110592549609018335232");
|
||
list.add("002212024011418484310592558885858021376");
|
||
list.add("002212024011419173610592566152900890624");
|
||
list.add("002212024011419343610592570432802099200");
|
||
list.add("002212024011419353610592570685307588608");
|
||
list.add("002212024011420024910592577532735627264");
|
||
list.add("002212024011420210810592582141426130944");
|
||
list.add("002212024011420220210592582367522164736");
|
||
list.add("002212024011420540910592590450201825280");
|
||
list.add("002212024011421300610592599498044436480");
|
||
list.add("002212024011423185310592626873663590400");
|
||
list.add("002212024011509494910592785655947456512");
|
||
list.add("002212024011509561810592787287614324736");
|
||
list.add("002212024011512152610592822301650141184");
|
||
list.add("002212024011512190510592823220656570368");
|
||
list.add("002212024011513172410592837894982524928");
|
||
list.add("002212024011513220410592839070252433408");
|
||
list.add("002212024011515094210592866156293079040");
|
||
list.add("002212024011515175510592868222430306304");
|
||
list.add("002212024011517003010592894041168994304");
|
||
list.add("002212024011517271010592900751760510976");
|
||
list.add("002212024011517391710592903799480860672");
|
||
list.add("002212024011520134810592942686232829952");
|
||
list.add("002212024011520163710592943393296777216");
|
||
list.add("002212024011521051810592955646988738560");
|
||
list.add("002212024011521483010592966519358590976");
|
||
list.add("002212024011522013210592969798484353024");
|
||
list.add("002212024011522013410592969805348458496");
|
||
list.add("002212024011523031810592985341578928128");
|
||
list.add("002212024011600225310593005370859012096");
|
||
list.add("002212024011604303910593067719815176192");
|
||
list.add("002212024011608364310593129644301385728");
|
||
list.add("002212024011611585510593180532999618560");
|
||
list.add("002212024011612102310593183419309334528");
|
||
list.add("002212024011612191910593185665405083648");
|
||
list.add("002212024011612415910593191370413498368");
|
||
list.add("002212024011613251410593202252646313984");
|
||
list.add("002212024011614305510593218782040588288");
|
||
list.add("002212024011614362210593220156639256576");
|
||
list.add("002212024011615003510593226250044473344");
|
||
list.add("002212024011615530110593239444016758784");
|
||
list.add("002212024011615541410593239748970246144");
|
||
list.add("002212024011617093510593258713292337152");
|
||
list.add("002212024011618182810593276048531120128");
|
||
list.add("002212024011620082310593303708087832576");
|
||
list.add("002212024011621071210593318512451551232");
|
||
list.add("002212024011621293710593324150976577536");
|
||
list.add("002212024011708054210593484229904388096");
|
||
list.add("002212024011708290410593490109518827520");
|
||
list.add("002212024011708483910593495037628747776");
|
||
list.add("002212024011709344410593506636509966336");
|
||
list.add("002212024011710230210593518791625003008");
|
||
list.add("002212024013113261410598638323451650048");
|
||
list.add("002212024011711544010593541850900688896");
|
||
list.add("002212024012115200010595043076939075584");
|
||
list.add("002212024011714061810593574975631630336");
|
||
list.add("002212024012110330610594970874455695360");
|
||
list.add("002212024011714491910593585802325483520");
|
||
list.add("002212024011715094310593590937179078656");
|
||
list.add("002212024011715360810593597582103793664");
|
||
list.add("002212024011718460210593645373444190208");
|
||
list.add("002212024011719071310593650706055155712");
|
||
list.add("002212024011719375810593658445124157440");
|
||
list.add("002212024011720430310593674822353899520");
|
||
list.add("002212024011722592410593709135519367168");
|
||
list.add("002212024011810170710593879688734474240");
|
||
list.add("002212024011811015810593890977072144384");
|
||
list.add("002212024011811070210593892248565743616");
|
||
list.add("002212024011812160510593909626577195008");
|
||
list.add("002212024011813181110593925253643735040");
|
||
list.add("002212024011815023010593951506652450816");
|
||
list.add("002212024011815460810593962487097229312");
|
||
list.add("002212024011816410810593976329233358848");
|
||
list.add("002212024011817133610593984498777055232");
|
||
list.add("002212024011819021410594011837596622848");
|
||
list.add("002212024011819281010594018364520218624");
|
||
list.add("002212024011819295910594018823575019520");
|
||
list.add("002212024011819565910594025617147985920");
|
||
list.add("002212024011820481010594038499168182272");
|
||
list.add("002212024011821103410594044136689582080");
|
||
list.add("002212024011821532510594054916756373504");
|
||
list.add("002212024011900475210594098819414749184");
|
||
list.add("002212024011909535010594236217586999296");
|
||
list.add("002212024011912043610594269124712067072");
|
||
list.add("002212024011912181810594272573607280640");
|
||
list.add("002212024011912484510594280238151852032");
|
||
list.add("002212024011913211310594288404700151808");
|
||
list.add("002212024011913475210594295114394988544");
|
||
list.add("002212024011913560010594297160600821760");
|
||
list.add("002212024011914333110594306602034466816");
|
||
list.add("002212024011914391710594308053214810112");
|
||
list.add("002212024011914502310594310845945761792");
|
||
list.add("002212024011914551310594312064577429504");
|
||
list.add("002212024011915163310594317429507481600");
|
||
list.add("002212024011915292310594320660709593088");
|
||
list.add("002212024011915515710594326340069642240");
|
||
list.add("002212024011916395410594338407247634432");
|
||
list.add("002212024011917463410594355185384574976");
|
||
list.add("002212024011918041410594359631212597248");
|
||
list.add("002212024011918344410594367306148446208");
|
||
list.add("002212024011918424710594369331184443392");
|
||
list.add("002212024011918430310594369397831622656");
|
||
list.add("002212024011920062610594390382367674368");
|
||
list.add("002212024011920462110594400429641736192");
|
||
list.add("002212024011920470210594400600587063296");
|
||
list.add("002212024011921114010594406799775305728");
|
||
list.add("002212024011921594110594418882618478592");
|
||
list.add("002212024011922153610594422889777057792");
|
||
list.add("002212024012008270810594576786891046912");
|
||
list.add("002212024012011254510594621737931235328");
|
||
list.add("002212024012011275510594622281237823488");
|
||
list.add("002212024012013130710594648754859397120");
|
||
list.add("002212024012013173010594649859567767552");
|
||
list.add("002212024012014140110594664081477533696");
|
||
list.add("002212024012014492210594672978996928512");
|
||
list.add("002212024012016074210594692693024796672");
|
||
list.add("002212024012016312610594698662851026944");
|
||
list.add("002212024012016421110594701367658315776");
|
||
list.add("002212024012017260610594712420651794432");
|
||
list.add("002212024012017414010594716338950393856");
|
||
list.add("002212024012018331210594729307904057344");
|
||
list.add("002212024012019324310594744286936158208");
|
||
list.add("002212024012019561010594750186792853504");
|
||
list.add("002212024012020132710594754534655819776");
|
||
list.add("002212024012021300910594773839804166144");
|
||
list.add("002212024012023041010594797499689291776");
|
||
list.add("002212024012108374910594941863177650176");
|
||
list.add("002212024012109052110594948790294007808");
|
||
list.add("002212024012109202510594952583963312128");
|
||
list.add("002212024012110105210594965280795774976");
|
||
list.add("002212024012110335210594971066146082816");
|
||
list.add("002212024012110552710594976500804132864");
|
||
list.add("002212024012110593910594977554249900032");
|
||
list.add("002212024012111242810594983803232317440");
|
||
list.add("002212024012111243810594983843470336000");
|
||
list.add("002212024012111254210594984110821560320");
|
||
list.add("002212024012112065310594994476939038720");
|
||
list.add("002212024012112272110594999624358289408");
|
||
list.add("002212024012113344110595016571717357568");
|
||
list.add("002212024012114193010595027851712098304");
|
||
list.add("002212024012114364710595032199309676544");
|
||
list.add("002212024012114450310595034278006509568");
|
||
list.add("002212024012114514910595035983689457664");
|
||
list.add("002212024012115085910595040302446534656");
|
||
list.add("002212024012115202110595043161746006016");
|
||
list.add("002212024012115272310595044933001707520");
|
||
list.add("002212024012115512010595050958892003328");
|
||
list.add("002212024012116213910595058590057062400");
|
||
list.add("002212024012117022210595068836906434560");
|
||
list.add("002212024012117110610595071036043939840");
|
||
list.add("002212024012117233610595074181759324160");
|
||
list.add("002212024012117371010595077595782381568");
|
||
list.add("002212024012117490210595080582085414912");
|
||
list.add("002212024012118293210595090774054576128");
|
||
list.add("002212024012118442910595094536980910080");
|
||
list.add("002212024012119025110595099156243369984");
|
||
list.add("002212024012119051710595099771472146432");
|
||
list.add("002212024012120005810595113782077227008");
|
||
list.add("002212024012120403210595123740844429312");
|
||
list.add("002212024012121224010595134344283201536");
|
||
list.add("002212024012122203110595148902776115200");
|
||
list.add("002212024012123421210595169459005980672");
|
||
list.add("002212024012208093710595297152465522688");
|
||
list.add("002212024012208493210595307199736434688");
|
||
list.add("002212024012208502610595307425409470464");
|
||
list.add("002212024012212010710595355410677231616");
|
||
list.add("002212024012212033410595356030977044480");
|
||
list.add("002212024012212144710595358851435917312");
|
||
list.add("002212024012212252710595361535787134976");
|
||
list.add("002212024012212533810595368629079314432");
|
||
list.add("002212024012213551110595384118188068864");
|
||
list.add("002212024012214263710595392027851915264");
|
||
list.add("002212024012215102210595403040186585088");
|
||
list.add("002212024012215203910595405628225265664");
|
||
list.add("002212024012215254410595406904377114624");
|
||
list.add("002212024012217451810595442029139755008");
|
||
list.add("002212024012218214410595451199487332352");
|
||
list.add("002212024012218294110595453199761367040");
|
||
list.add("002212024012220381410595485549092270080");
|
||
list.add("002212024012221131810595494372460687360");
|
||
list.add("002212024012300055310595537806275993600");
|
||
list.add("002212024012310393910595697296881348608");
|
||
list.add("002212024012311043810595703587223724032");
|
||
list.add("002212024012311484710595714695089221632");
|
||
list.add("002212024012312005110595717732028706816");
|
||
list.add("002212024012312210410595722820309082112");
|
||
list.add("002212024012312464210595729270310084608");
|
||
list.add("002212024012312491710595729921895497728");
|
||
list.add("002212024012312545610595731343019831296");
|
||
list.add("002212024012312595710595732606544674816");
|
||
list.add("002212024012313035310595733595709132800");
|
||
list.add("002212024012314475810595759790186426368");
|
||
list.add("002212024012315034410595763758213799936");
|
||
list.add("002212024012315170110595767102269644800");
|
||
list.add("002212024012315563310595777049392930816");
|
||
list.add("002212024012316284910595785169015840768");
|
||
list.add("002212024012317485010595805308169285632");
|
||
list.add("002212024012318392710595818044966719488");
|
||
list.add("002212024012319514410595836233372463104");
|
||
list.add("002212024012320393710595848286006996992");
|
||
list.add("002212024012321414710595863929003343872");
|
||
list.add("002212024012322240910595874591164198912");
|
||
list.add("002212024012323544510595897392660054016");
|
||
list.add("002212024012408194610596024483331903488");
|
||
list.add("002212024012408233810596025456998969344");
|
||
list.add("002212024012408481210596031638941814784");
|
||
list.add("002212024012410242610596055857016688640");
|
||
list.add("002212024012412165710596084171367350272");
|
||
list.add("002212024012412170810596084219007930368");
|
||
list.add("002212024012412333610596088361923805184");
|
||
list.add("002212024012413215710596100531070607360");
|
||
list.add("002212024012413265910596101795888144384");
|
||
list.add("002212024012413314810596103010269462528");
|
||
list.add("002212024012414330910596118446654447616");
|
||
list.add("002212024012414384010596119835849981952");
|
||
list.add("002212024012416590610596155176922284032");
|
||
list.add("002212024012417193210596160319806885888");
|
||
list.add("002212024012417531910596168822533279744");
|
||
list.add("002212024012418023210596171141509664768");
|
||
list.add("002212024012418132110596173865229942784");
|
||
list.add("002212024012418411010596180862836789248");
|
||
list.add("002212024012418461810596182156704083968");
|
||
list.add("002212024012418502610596183197950009344");
|
||
list.add("002212024012418592710596185465428811776");
|
||
list.add("002212024012419261010596192187700858880");
|
||
list.add("002212024012419471510596197496491728896");
|
||
list.add("002212024012420001310596200758301777920");
|
||
list.add("002212024012420162710596204841320280064");
|
||
list.add("002212024012420262210596207338624811008");
|
||
list.add("002212024012421205510596221065204948992");
|
||
list.add("002212024012421443610596227025446432768");
|
||
list.add("002212024012501255010596282703742201856");
|
||
list.add("002212024012502044110596292479570268160");
|
||
list.add("002212024012506345910596360502397431808");
|
||
list.add("002212024012509212610596402390780280832");
|
||
list.add("002212024012510403710596422316644044800");
|
||
list.add("002212024012512340810596450884852768768");
|
||
list.add("002212024012512572910596456759921012736");
|
||
list.add("002212024012513005510596457624776933376");
|
||
list.add("002212024012513223410596463073396948992");
|
||
list.add("002212024012514344110596481223897767936");
|
||
list.add("002212024012514352010596481387453075456");
|
||
list.add("002212024012514404210596482737805021184");
|
||
list.add("002212024012515170110596491877333770240");
|
||
list.add("002212024012515265610596494372105969664");
|
||
list.add("002212024012515402110596497746068144128");
|
||
list.add("002212024012516160610596506745774501888");
|
||
list.add("002212024012517111710596520631047417856");
|
||
list.add("002212024012517223710596523484640645120");
|
||
list.add("002212024012518165810596537163835920384");
|
||
list.add("002212024012519170710596552299563651072");
|
||
list.add("002212024012519322410596556145680023552");
|
||
list.add("002212024012519502010596560659456319488");
|
||
list.add("002212024012520371210596572454165774336");
|
||
list.add("002212024012521304810596585940093620224");
|
||
list.add("002212024012521555210596592248970739712");
|
||
list.add("002212024012522240610596599354531610624");
|
||
list.add("002212024012523301810596616012768935936");
|
||
list.add("002212024012600585410596638312314634240");
|
||
list.add("002212024012606262410596720731743522816");
|
||
list.add("002212024012607420110596739758508855296");
|
||
list.add("002212024012609332910596767811508756480");
|
||
list.add("002212024012609515110596772432593190912");
|
||
list.add("002212024012610325710596782774197542912");
|
||
list.add("002212024012612212310596810063106924544");
|
||
list.add("002212024012612482810596816878410522624");
|
||
list.add("002212024012613441710596830928433803264");
|
||
list.add("002212024012614035310596835860938166272");
|
||
list.add("002212024012614211210596840215802642432");
|
||
list.add("002212024012614412910596845323146883072");
|
||
list.add("002212024012614413910596845364449763328");
|
||
list.add("002212024012615022710596850596368314368");
|
||
list.add("002212024012615205110596855228946386944");
|
||
list.add("002212024012615395210596860016099979264");
|
||
list.add("002212024012616540710596878700264443904");
|
||
list.add("002212024012616584010596879846060290048");
|
||
list.add("002212024012617355710596889226555809792");
|
||
list.add("002212024012617451910596891583902584832");
|
||
list.add("002212024012618301010596902872956948480");
|
||
list.add("002212024012618524710596908561800712192");
|
||
list.add("002212024012618561210596909423199428608");
|
||
list.add("002212024012619262210596917016171204608");
|
||
list.add("002212024012619520910596923504868347904");
|
||
list.add("002212024012621195810596945602563362816");
|
||
list.add("002212024012621292710596947991619010560");
|
||
list.add("002212024012621403510596950793050218496");
|
||
list.add("002212024012622133810596959108552781824");
|
||
list.add("002212024012622482610596967866885328896");
|
||
list.add("002212024012708330510597114998998007808");
|
||
list.add("002212024012708393810597116645996331008");
|
||
list.add("002212024012709322910597129947783225344");
|
||
list.add("002212024012710562310597151059592695808");
|
||
list.add("002212024012710572910597151337391448064");
|
||
list.add("002212024012712082510597169188075065344");
|
||
list.add("002212024012712342010597175709751988224");
|
||
list.add("002212024012712385110597176846051856384");
|
||
list.add("002212024012713350010597190976532082688");
|
||
list.add("002212024012713452610597193603714084864");
|
||
list.add("002212024012714125610597200523545116672");
|
||
list.add("002212024012714343910597205991234596864");
|
||
list.add("002212024012714375110597206796276723712");
|
||
list.add("002212024012715005410597212597221289984");
|
||
list.add("002212024012715154110597216315425648640");
|
||
list.add("002212024012715403010597222559943315456");
|
||
list.add("002212024012716374310597236960556646400");
|
||
list.add("002212024012717070010597244331493289984");
|
||
list.add("002212024012717361210597251676298407936");
|
||
list.add("002212024012717435310597253613708840960");
|
||
list.add("002212024012718131510597261003888427008");
|
||
list.add("002212024012718300610597265242211807232");
|
||
list.add("002212024012718402610597267844295905280");
|
||
list.add("002212024012719111310597275588897763328");
|
||
list.add("002212024012720370610597297203772977152");
|
||
list.add("002212024012720540410597301471511465984");
|
||
list.add("002212024012720573510597302358994755584");
|
||
list.add("002212024012721202510597308102834323456");
|
||
list.add("002212024012721562110597317148712521728");
|
||
list.add("002212024012801552610597377316330557440");
|
||
list.add("002212024012808345110597477830614745088");
|
||
list.add("002212024012809564410597498438242136064");
|
||
list.add("002212024012810041210597500316680019968");
|
||
list.add("002212024012810194010597504209398910976");
|
||
list.add("002212024012810213410597504688790237184");
|
||
list.add("002212024012810261710597505875258986496");
|
||
list.add("002212024012810595010597514315141541888");
|
||
list.add("002212024012812403610597539675238166528");
|
||
list.add("002212024012812480510597541559172558848");
|
||
list.add("002212024012813022810597545180037242880");
|
||
list.add("002212024012813083610597546720593117184");
|
||
list.add("002212024012813220610597550119937499136");
|
||
list.add("002212024012813235810597550588448034816");
|
||
list.add("002212024012814012010597559994200981504");
|
||
list.add("002212024012816095910597592367947804672");
|
||
list.add("002212024012816253410597596290841899008");
|
||
list.add("002212024012816463010597601558219653120");
|
||
list.add("002212024012817093910597607386240479232");
|
||
list.add("002212024012817204910597610194229850112");
|
||
list.add("002212024012818231110597625888744833024");
|
||
list.add("002212024012819235410597641170214154240");
|
||
list.add("002212024012819392810597645088558043136");
|
||
list.add("002212024012820054910597651719708934144");
|
||
list.add("002212024012820253610597656695134347264");
|
||
list.add("002212024012820595910597665350501208064");
|
||
list.add("002212024012821040710597666388156731392");
|
||
list.add("002212024012822285610597687734697807872");
|
||
list.add("002212024012900310410597718469377462272");
|
||
list.add("002212024012901282310597732895592980480");
|
||
list.add("002212024012911350910597885593121460224");
|
||
list.add("002212024012911494710597889275216257024");
|
||
list.add("002212024012912004510597892034807558144");
|
||
list.add("002212024012912473510597903821860245504");
|
||
list.add("002212024012912593610597906846337822720");
|
||
list.add("002212024012913303810597914655524216832");
|
||
list.add("002212024012913304910597914699695599616");
|
||
list.add("002212024012914302010597929679041982464");
|
||
list.add("002212024012915162310597941269026439168");
|
||
list.add("002212024012915292510597944548227149824");
|
||
list.add("002212024012916034810597953200531550208");
|
||
list.add("002212024012916473710597964225750347776");
|
||
list.add("002212024012917004210597967519790403584");
|
||
list.add("002212024012917553910597981350647812096");
|
||
list.add("002212024012917585010597982148297220096");
|
||
list.add("002212024012918242410597988582271475712");
|
||
list.add("002212024012919084210597999733049118720");
|
||
list.add("002212024012919145010598001275155382272");
|
||
list.add("002212024012921565910598042082611478528");
|
||
list.add("002212024012922322810598051012159680512");
|
||
list.add("002212024012922353210598051783814332416");
|
||
list.add("002212024013001031810598088968948768768");
|
||
list.add("002212024013008240010598199877948137472");
|
||
list.add("002212024013008341010598202435459559424");
|
||
list.add("002212024013009341310598217548523253760");
|
||
list.add("002212024013011001910598239212842905600");
|
||
list.add("002212024013011175110598243627769270272");
|
||
list.add("002212024013011334610598247631366656000");
|
||
list.add("002212024013011412410598249554917064704");
|
||
list.add("002212024013011440610598250232417345536");
|
||
list.add("002212024013012394910598264254885781504");
|
||
list.add("002212024013012405110598264513237966848");
|
||
list.add("002212024013014021510598284999956312064");
|
||
list.add("002212024013014431110598295300709654528");
|
||
list.add("002212024013015054410598300974251864064");
|
||
list.add("002212024013015201010598304608440553472");
|
||
list.add("002212024013015311410598307391990607872");
|
||
list.add("002212024013016584810598329430364381184");
|
||
list.add("002212024013017233110598335649209389056");
|
||
list.add("002212024013017560510598343845003259904");
|
||
list.add("002212024013018341010598353429926760448");
|
||
list.add("002212024013018490610598357186822017024");
|
||
list.add("002212024013018514510598357852907778048");
|
||
list.add("002212024013019224110598365637195440128");
|
||
list.add("002212024013021421410598400758027304960");
|
||
list.add("002212024013021574310598404654998630400");
|
||
list.add("002212024013021584610598404919967199232");
|
||
list.add("002212024013022033810598406145270181888");
|
||
list.add("002212024013022575010598419785089654784");
|
||
list.add("002212024013023093110598422723187847168");
|
||
list.add("002212024013108025410598556953917468672");
|
||
list.add("002212024013109374010598580804117688320");
|
||
list.add("002212024013109490410598583672145653760");
|
||
list.add("002212024013110185610598591187321221120");
|
||
list.add("002212024013110300910598594009295597568");
|
||
list.add("002212024013111524310598614788732080128");
|
||
list.add("002212024013111571410598615924988653568");
|
||
list.add("002212024013112164810598620849395048448");
|
||
list.add("002212024013112233410598622552137789440");
|
||
list.add("002212024013113260210598638274593165312");
|
||
list.add("002212024013113270610598638540718211072");
|
||
list.add("002212024013114024910598647531979325440");
|
||
list.add("002212024013115110510598664711185457152");
|
||
list.add("002212024013115125810598665185726705664");
|
||
list.add("002212024013115143310598665583746969600");
|
||
list.add("002212024013115211510598667269731868672");
|
||
list.add("002212024013116031010598677817391935488");
|
||
list.add("002212024013116243410598683202429304832");
|
||
list.add("002212024013117103210598694770658111488");
|
||
list.add("002212024013117364710598701377501618176");
|
||
list.add("002212024013117392610598702041871147008");
|
||
list.add("002212024013118273610598714166080811008");
|
||
list.add("002212024013118550110598721065975132160");
|
||
list.add("002212024013118591410598722127382540288");
|
||
list.add("002212024013119273510598729261521436672");
|
||
list.add("002212024013119275610598729347382587392");
|
||
list.add("002212024013119282510598729472011497472");
|
||
list.add("002212024013119384310598732060087169024");
|
||
list.add("002212024013119410610598732662236692480");
|
||
list.add("002212024013119482610598734508616265728");
|
||
list.add("002212024013120144410598741127241281536");
|
||
list.add("002212024013120353110598746354702094336");
|
||
list.add("002212024013121122110598755626863931392");
|
||
list.add("002212024013121310510598760338438844416");
|
||
list.add("002212024013122244310598773835959619584");
|
||
return list;
|
||
}
|
||
|
||
public List<String> getPaymentIdList() {
|
||
List<String> paymentIdList1 = getPaymentIdList1();
|
||
List<String> resultList = Lists.newArrayList();
|
||
resultList.addAll(paymentIdList1);
|
||
return resultList;
|
||
}
|
||
|
||
@Test
|
||
public void testClearingWithdraw() {
|
||
// 保存提现记录
|
||
ClearingWithdrawInfo record = new ClearingWithdrawInfo();
|
||
record.setWithdrawCode("132321354");
|
||
record.setWithdrawStatus(Constants.ZERO);
|
||
Date now = new Date();
|
||
record.setApplicationTime(now);
|
||
record.setCreateTime(now);
|
||
record.setDelFlag(DelFlagEnum.NORMAL.getValue());
|
||
clearingWithdrawInfoService.insertOrUpdate(record);
|
||
}
|
||
|
||
@Test
|
||
public void testGetPileTypeNum() {
|
||
Long stationId = 1L;
|
||
pileConnectorInfoService.getPileTypeNum(stationId);
|
||
}
|
||
|
||
@Test
|
||
public void testUpdateStatus() {
|
||
String pileConnectorCode = "8800000000012601";
|
||
String status = "0";
|
||
pileConnectorInfoService.updateConnectorStatus(pileConnectorCode, status);
|
||
}
|
||
|
||
@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();
|
||
returnAmountMap.put("returnPrincipal", new BigDecimal("16.8700"));
|
||
// 更新会员钱包
|
||
BigDecimal returnPrincipal = returnAmountMap.get("returnPrincipal");
|
||
// if (returnPrincipal != null && principalPayRecord != null) {
|
||
// principalPayRecord.setRefundAmount(returnPrincipal);
|
||
// updatePayRecordList.add(principalPayRecord);
|
||
// }
|
||
BigDecimal returnGift = returnAmountMap.get("returnGift");
|
||
|
||
System.out.println(returnPrincipal);
|
||
// if (returnGift != null && giftPayRecord != null) {
|
||
// giftPayRecord.setRefundAmount(returnGift);
|
||
// updatePayRecordList.add(giftPayRecord);
|
||
// // 支付的赠送金额-退回的赠送金额 = 实际使用赠送金额消费的部分
|
||
// virtualAmount = giftPay.subtract(returnGift);
|
||
// }
|
||
// UpdateMemberBalanceDTO updateMemberBalanceDTO = UpdateMemberBalanceDTO.builder()
|
||
// .memberId(orderBasicInfo.getMemberId())
|
||
// .type(MemberWalletEnum.TYPE_IN.getValue()) // 进账
|
||
// .subType(MemberWalletEnum.SUBTYPE_ORDER_SETTLEMENT_REFUND.getValue()) // 订单结算退款
|
||
// .updatePrincipalBalance(returnPrincipal)
|
||
// .updateGiftBalance(returnGift)
|
||
// .relatedOrderCode(orderBasicInfo.getOrderCode())
|
||
// .build();
|
||
// memberBasicInfoService.updateMemberBalance(updateMemberBalanceDTO);
|
||
}
|
||
|
||
|
||
@Test
|
||
public void testVin() {
|
||
String vinCode = "tango";
|
||
MemberPlateNumberRelation memberPlateInfoByVinCode = memberPlateNumberRelationService.getMemberPlateInfoByVinCode(vinCode);
|
||
System.out.println(memberPlateInfoByVinCode);
|
||
}
|
||
|
||
@Test
|
||
public void testParking() throws UnsupportedEncodingException {
|
||
// GetTokenDTO dto = new GetTokenDTO();
|
||
// dto.setAppId("I2qa3hdr116100dc");
|
||
// dto.setSecretKey("2qa3hdr13754a8e");
|
||
// String token = ltytService.getToken(dto);
|
||
// System.out.println(token);
|
||
|
||
BindCouponDTO dto = new BindCouponDTO();
|
||
dto.setAppId("I2qa3hdr116100dc");
|
||
dto.setSecretKey("2qa3hdr13754a8e");
|
||
dto.setMerchantId("3prv98bm8db70a9");
|
||
dto.setCouponId("3prvd0q7a4817bf");
|
||
dto.setPlateNumber("贵A12345");
|
||
dto.setPlateColor(1);
|
||
String s = ltytService.bindCoupon(dto);
|
||
System.out.println(s);
|
||
}
|
||
|
||
@Test
|
||
public void testUpdateConnectorStatus() {
|
||
String pileConnectorCode = "8800000000000101";
|
||
String status = PileConnectorStatusEnum.FREE.getValue();
|
||
pileConnectorInfoService.updateConnectorStatus(pileConnectorCode, status);
|
||
}
|
||
|
||
@Test
|
||
public void testOrder() throws Exception {
|
||
// 通过vin码查询数据库绑定用户信息
|
||
MemberPlateNumberRelation plateInfo = memberPlateNumberRelationService.getMemberPlateInfoByVinCode("LNBSCC4H1LT107646");
|
||
GenerateOrderDTO dto = new GenerateOrderDTO();
|
||
dto.setMemberPlateNumberRelation(plateInfo);
|
||
dto.setPileSn("88000000000126");
|
||
dto.setConnectorCode("01");
|
||
dto.setStartMode(StartModeEnum.VIN_CODE.getValue());
|
||
dto.setMemberId(plateInfo.getMemberId());
|
||
// 通过memberId获取账户余额
|
||
MemberVO memberVO = memberBasicInfoService.queryMemberInfoByMemberId(dto.getMemberId());
|
||
if (memberVO == null) {
|
||
throw new BusinessException(ReturnCodeEnum.CODE_GET_MEMBER_ACCOUNT_AMOUNT_ERROR);
|
||
}
|
||
BigDecimal totalAccountAmount = memberVO.getTotalAccountAmount();
|
||
if (totalAccountAmount.compareTo(BigDecimal.ZERO) <= 0) {
|
||
throw new BusinessException(ReturnCodeEnum.CODE_BALANCE_IS_INSUFFICIENT);
|
||
}
|
||
|
||
dto.setChargeAmount(totalAccountAmount); // 充电金额
|
||
dto.setPayMode(OrderPayModeEnum.PAYMENT_OF_BALANCE.getValue()); // 1-余额支付
|
||
|
||
OrderBasicInfo basicInfo = orderBasicInfoService.generateOrder(dto);
|
||
|
||
// 支付订单
|
||
PayOrderDTO payOrderDTO = new PayOrderDTO();
|
||
payOrderDTO.setOrderCode(basicInfo.getOrderCode());
|
||
payOrderDTO.setPayAmount(totalAccountAmount);
|
||
payOrderDTO.setPayMode(dto.getPayMode());
|
||
payOrderDTO.setMemberId(dto.getMemberId());
|
||
// payOrderDTO.setCode();
|
||
// payOrderDTO.setLockValue();
|
||
// payOrderDTO.setOrderBasicInfo(basicInfo);
|
||
|
||
// Map<String, Object> map = orderBasicInfoService.payOrder(payOrderDTO);
|
||
// System.out.println(map);
|
||
}
|
||
|
||
@Test
|
||
public void testTransactionRecord() {
|
||
// 获取消息体
|
||
String msg = "8823000000123302230707215317078588230000001233020000341507071763023615070717b02a0200a00f0000000000003016000090dc010000000000000000000000000020c50100000000000000000000000000888a0100000000000000000000000000b0220749005032074900a00f000000000000e01500004c4e425343433448314c543130373634360563023615070717450000000000000000";
|
||
byte[] msgBody = BytesUtil.str2Bcd(msg);
|
||
|
||
int startIndex = 0;
|
||
int length = 16;
|
||
|
||
// 交易流水号
|
||
byte[] orderCodeByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||
String transactionCode = BytesUtil.bcd2Str(orderCodeByteArr);
|
||
|
||
// 桩编码
|
||
startIndex += length;
|
||
length = 7;
|
||
byte[] pileSnByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||
String pileSn = BytesUtil.bcd2Str(pileSnByteArr);
|
||
|
||
// 枪号
|
||
startIndex += length;
|
||
length = 1;
|
||
byte[] connectorCodeByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||
String connectorCode = BytesUtil.bcd2Str(connectorCodeByteArr);
|
||
|
||
|
||
// 开始时间 CP56Time2a 格式
|
||
startIndex += length;
|
||
length = 7;
|
||
byte[] startTimeByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||
// String binary = BytesUtil.binary(startTimeByteArr, 16);
|
||
Date startDate = Cp56Time2aUtil.byte2Hdate(startTimeByteArr);
|
||
String startTime = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, startDate);
|
||
|
||
|
||
// 结束时间 CP56Time2a 格式
|
||
startIndex += length;
|
||
byte[] endTimeByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||
Date endDate = Cp56Time2aUtil.byte2Hdate(endTimeByteArr);
|
||
String endTime = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, endDate);
|
||
|
||
// 尖单价 精确到小数点后五位(尖电费+尖服务费,见费率帧)
|
||
startIndex += length;
|
||
length = 4;
|
||
byte[] sharpPriceByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||
String sharpPrice = YKCUtils.convertDecimalPoint(sharpPriceByteArr, 5);
|
||
|
||
// 尖电量 精确到小数点后四位
|
||
startIndex += length;
|
||
length = 4;
|
||
byte[] sharpUsedElectricityByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||
String sharpUsedElectricity = YKCUtils.convertDecimalPoint(sharpUsedElectricityByteArr, 4);
|
||
|
||
// 计损尖电量
|
||
startIndex += length;
|
||
byte[] sharpPlanLossElectricityByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||
String sharpPlanLossElectricity = YKCUtils.convertDecimalPoint(sharpPlanLossElectricityByteArr, 4);
|
||
|
||
// 尖金额
|
||
startIndex += length;
|
||
byte[] sharpAmountByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||
String sharpAmount = YKCUtils.convertDecimalPoint(sharpAmountByteArr, 4);
|
||
|
||
// 峰单价 精确到小数点后五位(峰电费+峰服务费)
|
||
startIndex += length;
|
||
byte[] peakPriceByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||
String peakPrice = YKCUtils.convertDecimalPoint(peakPriceByteArr, 5);
|
||
|
||
// 峰电量
|
||
startIndex += length;
|
||
byte[] peakUsedElectricityByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||
String peakUsedElectricity = YKCUtils.convertDecimalPoint(peakUsedElectricityByteArr, 4);
|
||
|
||
// 计损峰电量
|
||
startIndex += length;
|
||
byte[] peakPlanLossElectricityByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||
String peakPlanLossElectricity = YKCUtils.convertDecimalPoint(peakPlanLossElectricityByteArr, 4);
|
||
|
||
// 峰金额
|
||
startIndex += length;
|
||
byte[] peakAmountByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||
String peakAmount = YKCUtils.convertDecimalPoint(peakAmountByteArr, 4);
|
||
|
||
// 平单价 精确到小数点后五位(平电费+平服务费)
|
||
startIndex += length;
|
||
byte[] flatPriceByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||
String flatPrice = YKCUtils.convertDecimalPoint(flatPriceByteArr, 5);
|
||
|
||
// 平电量
|
||
startIndex += length;
|
||
byte[] flatUsedElectricityByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||
String flatUsedElectricity = YKCUtils.convertDecimalPoint(flatUsedElectricityByteArr, 4);
|
||
|
||
// 计损平电量
|
||
startIndex += length;
|
||
byte[] flatPlanLossElectricityByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||
String flatPlanLossElectricity = YKCUtils.convertDecimalPoint(flatPlanLossElectricityByteArr, 4);
|
||
|
||
// 平金额
|
||
startIndex += length;
|
||
byte[] flatAmountByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||
String flatAmount = YKCUtils.convertDecimalPoint(flatAmountByteArr, 4);
|
||
|
||
// 谷单价 精确到小数点后五位(谷电费+谷 服务费)
|
||
startIndex += length;
|
||
byte[] valleyPriceByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||
String valleyPrice = YKCUtils.convertDecimalPoint(valleyPriceByteArr, 5);
|
||
|
||
// 谷电量
|
||
startIndex += length;
|
||
byte[] valleyUsedElectricityByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||
String valleyUsedElectricity = YKCUtils.convertDecimalPoint(valleyUsedElectricityByteArr, 4);
|
||
|
||
// 计损谷电量
|
||
startIndex += length;
|
||
byte[] valleyPlanLossElectricityByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||
String valleyPlanLossElectricity = YKCUtils.convertDecimalPoint(valleyPlanLossElectricityByteArr, 4);
|
||
|
||
// 谷金额
|
||
startIndex += length;
|
||
byte[] valleyAmountByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||
String valleyAmount = YKCUtils.convertDecimalPoint(valleyAmountByteArr, 4);
|
||
|
||
// 电表总起值
|
||
startIndex += length;
|
||
length = 5;
|
||
byte[] ammeterTotalStartByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||
String ammeterTotalStart = YKCUtils.convertDecimalPoint(ammeterTotalStartByteArr, 4);
|
||
|
||
// 电表总止值
|
||
startIndex += length;
|
||
byte[] ammeterTotalEndByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||
String ammeterTotalEnd = YKCUtils.convertDecimalPoint(ammeterTotalEndByteArr, 4);
|
||
|
||
// 总电量
|
||
startIndex += length;
|
||
length = 4;
|
||
byte[] totalElectricityByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||
String totalElectricity = YKCUtils.convertDecimalPoint(totalElectricityByteArr, 4);
|
||
|
||
// 计损总电量
|
||
startIndex += length;
|
||
byte[] planLossTotalElectricityByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||
String planLossTotalElectricity = YKCUtils.convertDecimalPoint(planLossTotalElectricityByteArr, 4);
|
||
|
||
// 消费金额 精确到小数点后四位,包含电费、 服务费
|
||
startIndex += length;
|
||
byte[] consumptionAmountByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||
String consumptionAmount = YKCUtils.convertDecimalPoint(consumptionAmountByteArr, 4);
|
||
|
||
// VIN 码 VIN 码,此处 VIN 码和充电时 VIN 码不同, 正序直接上传, 无需补 0 和反序
|
||
startIndex += length;
|
||
length = 17;
|
||
byte[] vinCodeByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||
String vinCode = BytesUtil.ascii2Str(vinCodeByteArr);
|
||
|
||
/**
|
||
* 交易标识
|
||
* 0x01: app 启动
|
||
* 0x02:卡启动
|
||
* 0x04:离线卡启动
|
||
* 0x05: vin 码启动充电
|
||
*/
|
||
startIndex += length;
|
||
length = 1;
|
||
byte[] transactionIdentifierByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||
String transactionIdentifier = BytesUtil.bcd2Str(transactionIdentifierByteArr);
|
||
|
||
// 交易时间 CP56Time2a 格式
|
||
startIndex += length;
|
||
length = 7;
|
||
byte[] transactionTimeByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||
Date transactionDate = Cp56Time2aUtil.byte2Hdate(transactionTimeByteArr);
|
||
String transactionTime = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, transactionDate);
|
||
|
||
// 停止原因
|
||
startIndex += length;
|
||
length = 1;
|
||
byte[] stopReasonByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||
String stopReason = BytesUtil.bin2HexStr(stopReasonByteArr);
|
||
String stopReasonMsg = YKCChargingStopReasonEnum.getMsgByCode(Integer.parseInt(stopReason, 16));
|
||
|
||
// 物理卡号 不足 8 位补 0
|
||
startIndex += length;
|
||
length = 8;
|
||
byte[] cardNumByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||
// byte[] logicCardNum = BytesUtil.checkLengthAndBehindAppendZero(cardNumByteArr, 16);
|
||
String logicCard = BytesUtil.binary(cardNumByteArr, 16);
|
||
// log.info("桩号:{}发送交易记录物理卡号:{}", pileSn, logicCard);
|
||
//
|
||
// log.info("[===交易记录===]交易流水号:{}, 桩编号:{}, 枪号:{}, 开始时间:{}, 结束时间:{}, 尖单价:{}, 尖电量:{}, 计损尖电量:{}, 尖金额:{}, " +
|
||
// "峰单价:{}, 峰电量:{}, 计损峰电量:{}, 峰金额:{}, 平单价:{}, 平电量:{}, 计损平电量:{}, 平金额:{}, " +
|
||
// "谷单价:{}, 谷电量:{}, 计损谷电量:{}, 谷金额:{}, 电表总起值:{}, 电表总止值:{}, 总电量:{}, 计损总电量:{}, 消费金额:{}, " +
|
||
// "电动汽车唯一标识:{}, 交易标识:{}, 交易日期、时间:{}, 停止原因码:{}, 停止原因描述:{}, 物理卡号:{}",
|
||
// transactionCode, pileSn, connectorCode, startTime, endTime, sharpPrice, sharpUsedElectricity, sharpPlanLossElectricity, sharpAmount,
|
||
// peakPrice, peakUsedElectricity, peakPlanLossElectricity, peakAmount, flatPrice, flatUsedElectricity, flatPlanLossElectricity, flatAmount,
|
||
// valleyPrice, valleyUsedElectricity, valleyPlanLossElectricity, valleyAmount, ammeterTotalStart, ammeterTotalEnd, totalElectricity, planLossTotalElectricity,
|
||
// consumptionAmount, vinCode, transactionIdentifier, transactionTime, stopReason, stopReasonMsg, logicCard);
|
||
|
||
// 交易记录封装到对象里
|
||
TransactionRecordsData data = TransactionRecordsData.builder()
|
||
// .orderCode(transactionCode)
|
||
.transactionCode(transactionCode)
|
||
.pileSn(pileSn)
|
||
.connectorCode(connectorCode)
|
||
.startTime(startTime)
|
||
.endTime(endTime)
|
||
.sharpPrice(sharpPrice)
|
||
.sharpUsedElectricity(sharpUsedElectricity)
|
||
.sharpPlanLossElectricity(sharpPlanLossElectricity)
|
||
.sharpAmount(sharpAmount)
|
||
.peakPrice(peakPrice)
|
||
.peakUsedElectricity(peakUsedElectricity)
|
||
.peakPlanLossElectricity(peakPlanLossElectricity)
|
||
.peakAmount(peakAmount)
|
||
.flatPrice(flatPrice)
|
||
.flatUsedElectricity(flatUsedElectricity)
|
||
.flatPlanLossElectricity(flatPlanLossElectricity)
|
||
.flatAmount(flatAmount)
|
||
.valleyPrice(valleyPrice)
|
||
.valleyUsedElectricity(valleyUsedElectricity)
|
||
.valleyPlanLossElectricity(valleyPlanLossElectricity)
|
||
.valleyAmount(valleyAmount)
|
||
.ammeterTotalStart(ammeterTotalStart)
|
||
.ammeterTotalEnd(ammeterTotalEnd)
|
||
.totalElectricity(totalElectricity)
|
||
.planLossTotalElectricity(planLossTotalElectricity)
|
||
.consumptionAmount(consumptionAmount)
|
||
.vinCode(vinCode)
|
||
.transactionIdentifier(transactionIdentifier)
|
||
.transactionTime(transactionTime)
|
||
.stopReasonMsg(stopReasonMsg)
|
||
.logicCard(logicCard)
|
||
.build();
|
||
|
||
// boolean flag = !StringUtils.equals("0000000000000000", "a511101970000000");
|
||
// System.out.println(flag);
|
||
|
||
// 处理订单加锁
|
||
String lockKey = "settle_order_" + transactionCode;
|
||
String uuid = IdUtils.fastUUID();
|
||
try {
|
||
// redis锁
|
||
Boolean isLock = redisCache.lock(lockKey, uuid, 1500);
|
||
if (isLock) {
|
||
// transactionRecordsRequestHandler.processOrder(data);
|
||
}
|
||
} catch (Exception e) {
|
||
System.out.println("处理订单发生异常: " + e);
|
||
} finally {
|
||
if (uuid.equals(redisCache.getCacheObject(lockKey).toString())) {
|
||
redisCache.unLock(lockKey);
|
||
}
|
||
}
|
||
}
|
||
|
||
@Test
|
||
public void testFault() {
|
||
StringBuffer sb = new StringBuffer("0100");
|
||
String lowOrder = sb.substring(0, 2);
|
||
String highOrder = sb.substring(2, 4);
|
||
|
||
// String hardwareFault = highOrder + lowOrder;
|
||
byte[] hardwareFaultByteArr = BytesUtil.str2Bcd(highOrder + lowOrder);
|
||
String binStr = BytesUtil.bytes2BinStr(hardwareFaultByteArr);
|
||
// log.info("binStr:{}", binStr); // 0000 0000 0000 0001
|
||
int faultCode = 0;
|
||
for (int i = 0; i < binStr.length(); i++) {
|
||
if (binStr.charAt(i) == '1') {
|
||
faultCode = 15 - i;
|
||
break;
|
||
}
|
||
}
|
||
String faultReason = YKCPileFaultReasonEnum.getValueByCode(faultCode);
|
||
System.out.println(faultReason);
|
||
}
|
||
|
||
|
||
@Test
|
||
public void testQueryCorpMember() {
|
||
List<AdapayMemberAccount> accountList = adapayMemberAccountService.selectAdapayMemberAccountList(new AdapayMemberAccount());
|
||
if (CollectionUtils.isNotEmpty(accountList)) {
|
||
List<String> ids = accountList.stream().map(x -> x.getId() + "").collect(Collectors.toList());
|
||
adapayMemberAccountService.deleteAdapayMemberAccountByIds(ids);
|
||
}
|
||
|
||
// try {
|
||
// Map<String, Object> map = adapayMemberService.selectAdapayMember("5");
|
||
//
|
||
// String adapayMemberId = "ACM29562569";
|
||
// AdapayCorpMemberVO adapayCorpMemberVO = adapayMemberService.queryCorpAdapayMemberInfo(adapayMemberId);
|
||
// System.out.println(adapayCorpMemberVO);
|
||
//
|
||
//
|
||
// } catch (BaseAdaPayException e) {
|
||
// throw new RuntimeException(e);
|
||
// }
|
||
}
|
||
|
||
@Test
|
||
public void testGetPileListByStationIdList() {
|
||
|
||
// List<String> stationIdList = Lists.newArrayList("2");
|
||
// Map<String, List<AMapEquipmentInfo>> pileListByStationIdList = aMapService.getPileListByStationIdList(stationIdList);
|
||
// System.out.println(pileListByStationIdList);
|
||
|
||
GetStationInfoDTO dto = new GetStationInfoDTO();
|
||
dto.setType("page");
|
||
aMapService.getStationInfosV2(dto);
|
||
}
|
||
|
||
@Test
|
||
public void testMultiSave() {
|
||
String prefix = "test_multi_save:";
|
||
|
||
Map<String, Object> redisMap = Maps.newHashMap();
|
||
|
||
for (int i = 0; i < 1000; i++) {
|
||
redisMap.put(prefix + i, PileInfoVO.builder().pileSn(i + "").build());
|
||
}
|
||
redisCache.multiSave(redisMap, 60);
|
||
}
|
||
|
||
|
||
@Test
|
||
public void testBillingTemplate() {
|
||
pileBillingTemplateService.queryStationBillingTemplateListForUniApp("2");
|
||
}
|
||
|
||
|
||
/**
|
||
* 查询汇付会员信息
|
||
*/
|
||
@Test
|
||
public void testQueryAdapayMemberInfo() {
|
||
String adapayMemberId = "ACM82792551";
|
||
String settleAccountId = null;
|
||
try {
|
||
AdapayCorpMemberVO adapayCorpMemberVO = adapayService.queryCorpAdapayMemberInfo(adapayMemberId, wechatAppId1);
|
||
// AdapaySettleAccountVO vo = adapayService.queryAdapaySettleAccount(adapayMemberId, settleAccountId, wechatAppId1);
|
||
System.out.println(JSON.toJSONString(adapayCorpMemberVO));
|
||
} catch (BaseAdaPayException e) {
|
||
throw new RuntimeException(e);
|
||
}
|
||
}
|
||
|
||
@Test
|
||
public void testSaveAdapayCallbackRecord() throws JsonProcessingException {
|
||
String data = "{\n" +
|
||
" \"object\": \"refund\",\n" +
|
||
" \"status\": \"succeeded\",\n" +
|
||
" \"prod_mode\": \"true\",\n" +
|
||
" \"id\": \"0022120230531111946980509821471137853440\",\n" +
|
||
" \"refund_order_no\": \"823725974557265920\",\n" +
|
||
" \"payment_id\": \"002212023053110524210509814658135928832\",\n" +
|
||
" \"payment_order_no\": \"C27262970851\",\n" +
|
||
" \"refund_amt\": \"7.82\",\n" +
|
||
" \"fee_amt\": \"0.04\",\n" +
|
||
" \"channel_no\": \"2023053121R064uj\",\n" +
|
||
" \"created_time\": \"1685503187000\",\n" +
|
||
" \"succeed_time\": \"1685503199000\",\n" +
|
||
" \"app_id\": \"app_d0c80cb1-ffc8-48cb-a030-fe9bec823aaa\",\n" +
|
||
" \"reason\": \"\",\n" +
|
||
" \"notify_url\": \"https://api.jsowellcloud.com/uniapp/pay/adapayRefundCallback\"\n" +
|
||
"}";
|
||
|
||
JSONObject jsonObject = JSON.parseObject(data);
|
||
ObjectMapper mapper = new ObjectMapper();
|
||
mapper.setPropertyNamingStrategy(PropertyNamingStrategies.SNAKE_CASE);
|
||
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||
AdapayRefundRecord adapayRefundRecord = mapper.readValue(jsonObject.toJSONString(), AdapayRefundRecord.class);
|
||
adapayRefundRecord.setRefundId(jsonObject.getString("id"));
|
||
// 保存到数据库
|
||
adapayRefundRecordService.insertAdapayRefundRecord(adapayRefundRecord);
|
||
}
|
||
|
||
@Test
|
||
public void testQueryCallback() {
|
||
AdapayCallbackRecord aaaa = adapayCallbackRecordService.selectByOrderCode("aaaa");
|
||
System.out.println(aaaa);
|
||
}
|
||
|
||
@Test
|
||
public void testAdapayRefund() {
|
||
// 创建汇付退款对象 在完成初始化设置情况下,调用方法,获取 Refund对象
|
||
try {
|
||
String id = "002212023052710075810508353847861903360";
|
||
String refundAmount = "0.01";
|
||
Map<String, Object> refundParams = Maps.newHashMap();
|
||
refundParams.put("refund_amt", AdapayUtil.formatAmount(refundAmount));
|
||
refundParams.put("refund_order_no", SnowflakeIdWorker.getSnowflakeId());
|
||
refundParams.put("notify_url", "https://api.jsowellcloud.com/uniapp/pay/adapayRefundCallback");
|
||
Map<String, Object> response = Refund.create(id, refundParams);
|
||
System.out.println(JSON.toJSONString(response));
|
||
// if (response != null && !response.isEmpty()) {
|
||
// JSONObject jsonObject = JSONObject.parseObject(response.get("expend").toString());
|
||
// JSONObject pay_info = jsonObject.getJSONObject("pay_info");
|
||
// Map<String, Object> resultMap = JSONObject.parseObject(pay_info.toJSONString(), new TypeReference<Map<String, Object>>() {});
|
||
// }
|
||
} catch (Exception e) {
|
||
System.out.println(e);
|
||
}
|
||
}
|
||
|
||
@Test
|
||
public void testSaveCallback() throws JsonProcessingException {
|
||
String data = "{\"app_id2\":\"app_d0c80cb1-ffc8-48cb-a030-fe9bec823aaa\",\"created_time\":\"20230530132956\",\"description\":\"{\\\"orderCode\\\":\\\"C29505932783\\\",\\\"type\\\":\\\"order\\\"}\",\"end_time\":\"20230530133027\",\"expend\":{\"bank_type\":\"OTHERS\",\"open_id\":\"o8jhot6PJF93EPhNISsXi28dKdS8\",\"sub_open_id\":\"o4REX5MprZfTaLnVNxfdOY-wnwGI\"},\"fee_amt\":\"0.11\",\"id\":\"002212023053013295610509491838664794112\",\"order_no\":\"C29505932783\",\"out_trans_id\":\"4200001855202305308670391485\",\"party_order_id\":\"02212305304859640306711\",\"pay_amt\":\"20.00\",\"pay_channel\":\"wx_lite\",\"real_amt\":\"20.00\",\"share_eq\":\"Y\",\"status\":\"succeeded\",\"wx_user_id\":\"\"}";
|
||
JSONObject jsonObject = JSON.parseObject(data);
|
||
ObjectMapper mapper = new ObjectMapper();
|
||
mapper.setPropertyNamingStrategy(PropertyNamingStrategies.SNAKE_CASE);
|
||
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||
AdapayCallbackRecord adapayCallbackRecord = mapper.readValue(jsonObject.toJSONString(), AdapayCallbackRecord.class);
|
||
adapayCallbackRecord.setExpend(jsonObject.getString("expend"));
|
||
adapayCallbackRecord.setPaymentId(jsonObject.getString("id"));
|
||
// adapayCallbackRecordService.saveAdapayCallbackRecord(adapayCallbackRecord);
|
||
|
||
}
|
||
|
||
@Test
|
||
public void testAMap() throws Exception {
|
||
String pileConnectorCode = "8800000000012601";
|
||
// String s = aMapService.pushChargingDeviceDynamics(pileConnectorCode);
|
||
GetStationInfoDTO dto = new GetStationInfoDTO();
|
||
dto.setType("page");
|
||
aMapService.getStationInfos(dto);
|
||
}
|
||
|
||
@Test
|
||
public void testVinCode() {
|
||
String msg = "880000000000210203000000000000000000000000000000000000000000000000004C5257594743454B584D43303437313434";
|
||
// 获取消息体
|
||
byte[] msgBody = BytesUtil.str2Bcd(msg);
|
||
|
||
int startIndex = 0;
|
||
int length = 7;
|
||
|
||
// 桩编码
|
||
byte[] pileSnByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||
String pileSn = BytesUtil.binary(pileSnByteArr, 16);
|
||
|
||
// 保存时间
|
||
// saveLastTime(pileSn, channel);
|
||
|
||
// 枪号
|
||
startIndex += length;
|
||
length = 1;
|
||
byte[] connectorNumByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||
String connectorCode = BytesUtil.bcd2Str(connectorNumByteArr);
|
||
|
||
// 启动方式
|
||
// 0x01 表示通过刷卡启动充电
|
||
// 0x02 表求通过帐号启动充电 (暂不支持)
|
||
// 0x03 表示vin码启动充电
|
||
startIndex += length;
|
||
byte[] startModeByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||
String startMode = BytesUtil.bcd2Str(startModeByteArr);
|
||
|
||
// 是否需要密码 0x00 不需要 0x01 需要
|
||
startIndex += length;
|
||
byte[] needPasswordFlagByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||
String needPasswordFlag = BytesUtil.bcd2Str(needPasswordFlagByteArr);
|
||
|
||
// 物理卡号 不足 8 位补 0
|
||
startIndex += length;
|
||
length = 8;
|
||
byte[] cardNumByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||
String physicsCard = BytesUtil.binary(cardNumByteArr, 16);
|
||
|
||
// 输入密码 对用户输入的密码进行16 位MD5 加密,采用小写上传
|
||
startIndex += length;
|
||
length = 16;
|
||
byte[] inputPasswordByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||
|
||
// VIN码
|
||
startIndex += length;
|
||
length = 17;
|
||
byte[] vinCodeByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||
String vinCode = BytesUtil.ascii2Str(vinCodeByteArr);
|
||
System.out.println("桩号:" + pileSn + "申请充电VIN码:" + vinCode);
|
||
|
||
/**
|
||
* 刷卡启动充电
|
||
*/
|
||
String logicCard = "";
|
||
byte[] authenticationFlagByteArr = Constants.zeroByteArray; // 鉴权成功标识
|
||
byte[] accountBalanceByteArr = Constants.zeroByteArray; // 账户余额
|
||
String transactionCode = "";
|
||
|
||
try {
|
||
/**
|
||
* VIN码启动充电
|
||
*/
|
||
if (StringUtils.equals("03", startMode)) {
|
||
// 通过vin码查询数据库绑定用户信息
|
||
MemberPlateNumberRelation plateInfo = memberPlateNumberRelationService.getMemberPlateInfoByVinCode(vinCode);
|
||
if (plateInfo == null) {
|
||
throw new BusinessException("", "未查到绑定用户信息");
|
||
}
|
||
if (!StringUtils.equals("1", plateInfo.getVinStatus())) {
|
||
// 1- 正常使用
|
||
throw new BusinessException("", "vin状态不正确");
|
||
}
|
||
// vin码生成订单 vin启动充电
|
||
GenerateOrderDTO dto = new GenerateOrderDTO();
|
||
dto.setMemberPlateNumberRelation(plateInfo);
|
||
dto.setPileSn(pileSn);
|
||
dto.setConnectorCode(connectorCode);
|
||
dto.setStartMode(StartModeEnum.VIN_CODE.getValue());
|
||
Map<String, Object> map = orderBasicInfoService.generateOrderByCard(dto);
|
||
if (map != null) {
|
||
transactionCode = (String) map.get("transactionCode");
|
||
accountBalanceByteArr = YKCUtils.getPriceByte(String.valueOf(map.get("accountBalance")), 2);
|
||
// 鉴权成功标识 0x00 失败 0x01 成功
|
||
authenticationFlagByteArr = Constants.oneByteArray;
|
||
} else {
|
||
throw new BusinessException("", "生成vin订单失败");
|
||
}
|
||
}
|
||
} catch (BusinessException e) {
|
||
e.printStackTrace();
|
||
System.out.println("1");
|
||
// log.error("VIN码启动充电鉴权 error:{}, {}", e.getCode(), e.getMessage());
|
||
} catch (Exception e) {
|
||
e.printStackTrace();
|
||
System.out.println("2");
|
||
transactionCode = "00000000000000000000000000000000";
|
||
accountBalanceByteArr = BytesUtil.checkLengthAndBehindAppendZero(accountBalanceByteArr, 8);
|
||
authenticationFlagByteArr = Constants.zeroByteArray;
|
||
// log.error("VIN码启动充电鉴权 error", e);
|
||
}
|
||
byte[] serialNumByteArr = BytesUtil.str2Bcd(transactionCode);
|
||
|
||
byte[] defeatReasonByteArr = Constants.zeroByteArray;
|
||
|
||
// 不足位数的值补零
|
||
// cardNumByteArr = BytesUtil.checkLengthAndBehindAppendZero(cardNumByteArr, 16);
|
||
// serialNumByteArr = BytesUtil.checkLengthAndBehindAppendZero(serialNumByteArr, 32);
|
||
// pileSnByteArr = BytesUtil.checkLengthAndBehindAppendZero(pileSnByteArr, 14);
|
||
// accountBalanceByteArr = BytesUtil.checkLengthAndBehindAppendZero(accountBalanceByteArr, 8);
|
||
|
||
// 拼装消息体
|
||
byte[] msgBodyByteArr = Bytes.concat(serialNumByteArr, pileSnByteArr, connectorNumByteArr, cardNumByteArr, accountBalanceByteArr,
|
||
authenticationFlagByteArr, defeatReasonByteArr);
|
||
|
||
String s = BytesUtil.bin2HexStr(msgBodyByteArr);
|
||
System.out.println(s);
|
||
}
|
||
|
||
@Test
|
||
public void testGenerateLianlianToken() throws UnsupportedEncodingException {
|
||
String OperatorID = "425010765";
|
||
String OperatorSecret = "123123123123aaaa"; // 1234567890abcdef
|
||
|
||
//请求dataX
|
||
Map<String, String> data = new HashMap<>();
|
||
data.put("OperatorID", OperatorID);
|
||
data.put("OperatorSecret", OperatorSecret);
|
||
String dataJson = JSONUtil.toJsonStr(data);
|
||
|
||
//加密
|
||
byte[] encryptText = Cryptos.aesEncrypt(dataJson.getBytes(StandardCharsets.UTF_8),
|
||
OperatorSecret.getBytes(), OperatorSecret.getBytes());
|
||
String strData = Encodes.encodeBase64(encryptText);
|
||
|
||
Map<String, String> request = new LinkedHashMap<>();
|
||
request.put("OperatorID", OperatorID);
|
||
request.put("Data", strData);
|
||
request.put("TimeStamp", System.currentTimeMillis() + "");
|
||
request.put("Seq", "0001");
|
||
|
||
//生成签名
|
||
String sig = GBSignUtils.sign(request, OperatorSecret);
|
||
request.put("Sig", sig);
|
||
String tokenRequest = JSONUtil.toJsonStr(request);
|
||
|
||
CommonParamsDTO dto = JSONObject.parseObject(tokenRequest, CommonParamsDTO.class);
|
||
|
||
lianLianService.generateToken(dto);
|
||
}
|
||
|
||
@Test
|
||
public void testupdateElecAmount() {
|
||
// orderBasicInfoService.updateElecAmount();
|
||
}
|
||
|
||
@Test
|
||
public void testSelectSomeStatusCardInfo() {
|
||
PileAuthCard pileAuthCard = pileAuthCardService.selectCardInfoByLogicCard("1111111111111111");
|
||
System.out.println(pileAuthCard);
|
||
}
|
||
|
||
@Test
|
||
public void testLianLian() throws UnsupportedEncodingException {
|
||
// 获取令牌
|
||
// LianLianGetTokenDTO dto = new LianLianGetTokenDTO();
|
||
// dto.setOperatorId("MA1JLFUU8");
|
||
// dto.setOperatorSecret("Nh62XxlIR5OjAzFj");
|
||
// String token = lianLianService.getToken("", "MA1JLFUU8", "fGwLsxW1HdzLw7jp");
|
||
// System.out.println("token:" + token);
|
||
|
||
String operatorId = "425010765";
|
||
String operatorSecret = "3DSBTWHVIC6KVCKI";
|
||
// 请求data
|
||
// Map<String, String> data = new HashMap<>();
|
||
// data.put("OperatorID", operatorId);
|
||
// data.put("OperatorSecret", operatorSecret);
|
||
// String dataJson = JSONUtil.toJsonStr(data);
|
||
|
||
JSONObject json = new JSONObject();
|
||
// json.put("StationIDs", com.google.common.collect.Lists.newArrayList("1", "2"));
|
||
json.put("LastQueryTime", "2023-05-29 10:00:00");
|
||
json.put("PageNo", 1);
|
||
json.put("PageSize", 10);
|
||
|
||
String dataJson = JSON.toJSONString(json);
|
||
// 加密
|
||
byte[] encryptText = Cryptos.aesEncrypt(dataJson.getBytes(StandardCharsets.UTF_8),
|
||
operatorSecret.getBytes(), operatorSecret.getBytes());
|
||
String strData = Encodes.encodeBase64(encryptText);
|
||
String timeStamp = DateUtils.parseDateToStr(DateUtils.YYYYMMDDHHMMSS, new Date());
|
||
Map<String, String> request = new LinkedHashMap<>();
|
||
request.put("OperatorID", operatorId);
|
||
request.put("Data", strData);
|
||
request.put("TimeStamp", timeStamp);
|
||
request.put("Seq", "0001");
|
||
|
||
// 生成签名
|
||
String sig = GBSignUtils.sign(request, operatorSecret);
|
||
request.put("Sig", sig);
|
||
JSONObject jsonObject = new JSONObject(request);
|
||
System.out.println(jsonObject);
|
||
// CommonParamsDTO dto = new CommonParamsDTO();
|
||
// dto.setOperatorID(operatorId);
|
||
// dto.setData(strData);
|
||
// dto.setTimeStamp(timeStamp);
|
||
// dto.setSeq("0001");
|
||
// dto.setSig(sig);
|
||
// Map<String, String> map = lianLianService.generateToken(dto);
|
||
QueryStationInfoDTO dto = new QueryStationInfoDTO();
|
||
dto.setOperatorId(operatorId);
|
||
Map<String, String> map = lianLianService.query_stations_info(dto);
|
||
// String data1 = map.get("Data");
|
||
// 解密data
|
||
// String data1 = "JudlP17tnYuQc2zwOzmjJAb9hgghIymefG5v3ZzSOlPDh5+bJHIedsYzKMD56tHlmlg6Cb7vG+o6KjMSSpn1fyqBH3UVaEFF7uEc+lOuEc9c1vUzq20vBQ7N3EpDKqVBKjZbOezMsKYaCX7Br8XTsCYT8VCQui/np3cn+phi3VC+0s1coNxBX7xoEDZ7iuPjPoSWL7g3J0uOw2SoGaIdBQG3eTxaZJ5L+vBmuDF0pEXgazTMnuKml1mx1QHkig2F7h/ILT0VEKVXWMmmogYgiBk5ItO0DyzRl+ASb184gOhYGo82GJmWRiXrAXmceCiSNvTGg6aL26imIGKkJNfOx9/9mTqjGvy6kzxvWJ29PBU=";
|
||
// byte[] plainText = Cryptos.aesDecrypt(Encodes.decodeBase64(data1),
|
||
// operatorSecret.getBytes(), operatorSecret.getBytes());
|
||
// String dataStr = new String(plainText, "UTF-8");
|
||
// Map<String, String> resultMap = (Map<String, String>) JSON.parse(dataStr);
|
||
//
|
||
// String token = resultMap.get("AccessToken");
|
||
//
|
||
// System.out.println("解密后token:" + token);
|
||
|
||
// LianLianPushStationInfoDTO dto1 = LianLianPushStationInfoDTO.builder()
|
||
// .OperatorID("MA1JLFUU8")
|
||
// .DataSecret("HVicnbRZbhPdIdpF")
|
||
// .DataSecretIV("JNvcjSOn1vhrE11M")
|
||
// .SigSecret("53TtFpc4gdVZbF3x")
|
||
// // .token(token)
|
||
// .stationId(2L)
|
||
//
|
||
// .build();
|
||
// lianLianService.pushStationInfo(dto1);
|
||
|
||
// 推送订单状态
|
||
// lianLianService.pushConnectorStatus("8800000000000101", "1");
|
||
|
||
// 推送订单信息
|
||
// lianLianService.pushOrderInfo("C27680791529");
|
||
|
||
// 推送启动充电结果
|
||
// lianLianService.pushStartChargeResult("C27680791529");
|
||
|
||
// 推送充电状态
|
||
// lianLianService.pushChargeStatus("C27680791529");
|
||
|
||
// 推送停止充电结果
|
||
// lianLianService.pushStopChargeResult("C27680791529");
|
||
|
||
// 推送充电订单信息
|
||
// lianLianService.pushChargeOrderInfo("C27680791529");
|
||
|
||
// 推送订单结算信息
|
||
// lianLianService.pushOrderSettlementInfo("C27680791529");
|
||
|
||
// 查询订单结算信息
|
||
// lianLianService.queryOrderSettlementInfo("C27680791529");
|
||
|
||
// 推送订单对账结果信息
|
||
// lianLianService.pushOrderReconciliationInfo("C27680791529");
|
||
|
||
// 测试生成、解密令牌
|
||
// long ttlMillis = 60 * 60 * 24 * 1000;
|
||
// String token = JWTUtils.createToken(operatorId, operatorSecret, ttlMillis);
|
||
// System.out.println(JWTUtils.checkThirdPartyToken(token));
|
||
|
||
JSONObject jsonObject1 = new JSONObject(map);
|
||
jsonObject1.put("OperatorID", "425010765");
|
||
jsonObject1.put("Data", "Ntu99RpveEOm2VUNq6RpD7OuOPXRbNxMOPmaBl67nkLk0nD/VmhipdSpq/Qfswhe1o55YMT+3Z7e6xe3fiJA3cZcvetxOEUF6sjvKLRq2rU=");
|
||
jsonObject1.put("TimeStamp", "20230530090132");
|
||
jsonObject1.put("Seq", "0001");
|
||
jsonObject1.put("Sig", "1568D2D35B245A0205B33D0EF92E7981");
|
||
|
||
String jsonString = JSON.toJSONString(jsonObject1);
|
||
|
||
String result = HttpUtils.sendPostContentType("http://localhost:8080/LianLian/v1/query_stations_info", jsonString, "application/json");
|
||
JSONObject object = JSONObject.parseObject(result);
|
||
String data1 = (String) object.get("data");
|
||
// 解密data
|
||
byte[] plainText = Cryptos.aesDecrypt(Encodes.decodeBase64(data1),
|
||
operatorSecret.getBytes(), operatorSecret.getBytes());
|
||
String dataStr = new String(plainText, StandardCharsets.UTF_8);
|
||
Map<String, String> resultMap = (Map<String, String>) JSON.parse(dataStr);
|
||
}
|
||
|
||
|
||
@Test
|
||
public void testRefundForBalance() {
|
||
BigDecimal refundAmount = new BigDecimal("2");
|
||
// 退款金额 元转分 123
|
||
int refundTotalCents = refundAmount.multiply(new BigDecimal(100)).intValue();
|
||
|
||
// 查询用户充值余额订单 过滤掉已经退款的充值订单 refundableOrder
|
||
List<RefundableWxPayOrderData> recordList = Lists.newArrayList();
|
||
// recordList.add(RefundableWxPayOrderData.builder().outTradeNo("1").transactionId("1").payerAmount(new BigDecimal("1000")).refundableAmount(new BigDecimal("0")).build());
|
||
// recordList.add(RefundableWxPayOrderData.builder().outTradeNo("2").transactionId("2").payerAmount(new BigDecimal("1000")).refundableAmount(new BigDecimal("0")).build());
|
||
recordList.add(RefundableWxPayOrderData.builder().outTradeNo("3").transactionId("3").payerAmount(Constants.WHITELIST_DEFAULT_AMOUNT).refundableAmount(new BigDecimal("300")).build());
|
||
|
||
// 也许需要多笔支付订单才够退款
|
||
List<WechatPayRefundRequest> requestList = com.google.common.collect.Lists.newArrayList();
|
||
WechatPayRefundRequest request;
|
||
for (RefundableWxPayOrderData record : recordList) {
|
||
int refundableTotal = record.getRefundableAmount().intValue(); // 该笔支付订单的可退金额,单位分
|
||
int payerTotal = record.getPayerAmount().intValue(); // 该笔支付订单的支付金额,单位分
|
||
// 用户申请退款金额-可退金额
|
||
refundTotalCents = refundTotalCents - refundableTotal; // 123 - 100
|
||
request = new WechatPayRefundRequest();
|
||
request.setTransaction_id(record.getTransactionId()); // 微信支付单号
|
||
request.setOut_trade_no(record.getOutTradeNo()); // 商户订单号
|
||
request.setOut_refund_no(SnowflakeIdWorker.getSnowflakeId()); // 商户退款单号
|
||
request.setNotify_url(WeChatPayParameter.refundNotifyUrl); // 回调接口
|
||
request.setReason("用户余额退款");
|
||
request.setFunds_account("AVAILABLE");
|
||
if (refundTotalCents > 0) {
|
||
// 如果大于0说明,这笔单退完也不够
|
||
WechatPayRefundRequest.Amount amount = new WechatPayRefundRequest.Amount();
|
||
amount.setRefund(refundableTotal); // 退款金额
|
||
amount.setTotal(payerTotal); // 原订单金额
|
||
request.setAmount(amount);
|
||
requestList.add(request);
|
||
} else {
|
||
// 如果小于0,这笔单退一部分
|
||
// 生成退款单号
|
||
WechatPayRefundRequest.Amount amount = new WechatPayRefundRequest.Amount();
|
||
// 部分退
|
||
int i = refundableTotal + refundTotalCents;
|
||
amount.setRefund(i); // 退款金额
|
||
amount.setTotal(payerTotal); // 原订单金额
|
||
request.setAmount(amount);
|
||
requestList.add(request);
|
||
break;
|
||
}
|
||
}
|
||
|
||
System.out.println(requestList);
|
||
}
|
||
|
||
@Test
|
||
public void testCloseStartFailedOrder() {
|
||
String startTime = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, DateUtils.addDays(new Date(), -2));
|
||
String endTime = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, new Date());
|
||
orderBasicInfoService.closeStartFailedOrder(startTime, endTime);
|
||
}
|
||
|
||
@Test
|
||
public void testRedisSaveRealTimeData() {
|
||
String pileSn = "88000000000001";
|
||
String connectorCode = "01";
|
||
String orderCode = "88000000000001012211161342359448";
|
||
|
||
String pileConnectorCode = pileSn + connectorCode;
|
||
String redisKey = CacheConstants.PILE_REAL_TIME_MONITOR_DATA + pileConnectorCode + "_" + orderCode;
|
||
|
||
// for (int i = 0; i < 10; i++) {
|
||
// try {
|
||
// Thread.sleep(10000);
|
||
// } catch (InterruptedException e) {
|
||
// e.printStackTrace();
|
||
// }
|
||
// Date now = new Date();
|
||
// redisCache.hset(redisKey, DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:00", now), i + ":" + DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss", now));
|
||
// }
|
||
|
||
orderBasicInfoService.getChargingRealTimeData(orderCode);
|
||
}
|
||
|
||
@Test
|
||
public void testuniformMessageSend() {
|
||
AppletTemplateMessageSendDTO appletTemplateMessageSendDTO = new AppletTemplateMessageSendDTO();
|
||
// String openId = wxAppletRemoteService.getOpenIdByCode("0537u2100jTXsP1Y0Y300j426t47u210");
|
||
// System.out.println("openId:" + openId);
|
||
|
||
appletTemplateMessageSendDTO.setTouser("o4REX5MprZfTaLnVNxfdOY-wnwGI"); // openid
|
||
|
||
String templateId = "UyBPbADlZfsCj89rh_xvfZGlxTW5J5KURpZtt9CNFrY";
|
||
appletTemplateMessageSendDTO.setTemplate_id(templateId);
|
||
// appletTemplateMessageSendDTO.setPage("跳转的页面");
|
||
Map<String, Object> map = new HashMap<>();
|
||
map.put("amount17", ImmutableMap.of("value", "¥100")); // 结束时间
|
||
map.put("time3", ImmutableMap.of("value", "2022-12-30")); // 结束时间
|
||
map.put("thing7", ImmutableMap.of("value", "thing7")); // 结束原因
|
||
|
||
// map.put("thing5", ImmutableMap.of("value", "thing5")); // 结束原因
|
||
// map.put("time2", ImmutableMap.of("value", "time2")); // 结束原因
|
||
appletTemplateMessageSendDTO.setData(map);
|
||
|
||
wxAppletRemoteService.uniformMessageSend(appletTemplateMessageSendDTO);
|
||
}
|
||
|
||
@Test
|
||
public void testWeChatRefund() {
|
||
ApplyRefundDTO dto = new ApplyRefundDTO();
|
||
dto.setRefundType("2");
|
||
dto.setMemberId("82100864");
|
||
dto.setRefundAmount(new BigDecimal("1.23"));
|
||
orderBasicInfoService.weChatRefund(dto);
|
||
}
|
||
|
||
@Test
|
||
public void testSelectBalanceRechargeRecord() {
|
||
List<WxpayCallbackRecord> list = wxpayCallbackRecordService.queryBalanceRechargeRecordOfTheLatestYear("82100864");
|
||
System.out.println(list);
|
||
}
|
||
|
||
@Test
|
||
public void testSelectOrderBasicInfoList() {
|
||
QueryOrderDTO orderBasicInfo = new QueryOrderDTO();
|
||
orderBasicInfo.setPileSn("88000000000001");
|
||
orderBasicInfo.setOrderStatus(OrderStatusEnum.IN_THE_CHARGING.getValue());
|
||
List<OrderListVO> orderListVOS = orderBasicInfoService.selectOrderBasicInfoList(orderBasicInfo);
|
||
System.out.println(orderListVOS);
|
||
for (OrderListVO orderListVO : orderListVOS) {
|
||
if (StringUtils.equals(orderListVO.getOrderStatus(), OrderStatusEnum.IN_THE_CHARGING.getValue())) {
|
||
// 修改数据库订单状态
|
||
OrderBasicInfo info = OrderBasicInfo.builder()
|
||
.id(Integer.parseInt(orderListVO.getId()))
|
||
.orderStatus(OrderStatusEnum.ABNORMAL.getValue())
|
||
.build();
|
||
orderBasicInfoService.updateOrderBasicInfo(info);
|
||
}
|
||
}
|
||
}
|
||
|
||
@Test
|
||
public void testWechatRefund() throws JsonProcessingException {
|
||
WechatPayRefundRequest request = new WechatPayRefundRequest();
|
||
request.setTransaction_id("4200001656202212302746036536"); // 微信支付单号
|
||
request.setOut_trade_no("768677222373363712"); // 商户订单号
|
||
// 生成退款单号
|
||
request.setOut_refund_no(SnowflakeIdWorker.getSnowflakeId()); // 商户退款单号
|
||
request.setNotify_url(WeChatPayParameter.refundNotifyUrl); // 回调接口
|
||
WechatPayRefundRequest.Amount amount = new WechatPayRefundRequest.Amount();
|
||
amount.setRefund(10 * 100); // 退款金额
|
||
amount.setTotal(10 * 100); // 原订单金额
|
||
request.setAmount(amount);
|
||
request.setReason("结算退款");
|
||
request.setFunds_account("AVAILABLE");
|
||
|
||
wechatPayService.ApplyForWechatPayRefundV3(request);
|
||
|
||
// 退款方法
|
||
|
||
}
|
||
|
||
@Test
|
||
public void testUpdatePileSimInfo() {
|
||
String pileSn = "88000000000001";
|
||
String iccid = "89860402102091089943";
|
||
pileBasicInfoService.updatePileSimInfo(pileSn, iccid);
|
||
}
|
||
|
||
@Test
|
||
public void testPay() {
|
||
String code = "081zIoGa11GamE0iVVIa1aaJ4G0zIoGE";
|
||
String openId = memberService.getOpenIdByCode(code);
|
||
Map<String, Object> pay = null;
|
||
try {
|
||
WeixinPayDTO dto = new WeixinPayDTO();
|
||
dto.setOpenId(openId);
|
||
dto.setAmount("0.01");
|
||
pay = orderService.weixinPayV3(dto);
|
||
} catch (Exception e) {
|
||
e.printStackTrace();
|
||
}
|
||
System.out.println(JSON.toJSONString(pay));
|
||
}
|
||
|
||
@Test
|
||
public void testMemberRegisterAndLogin() throws BaseAdaPayException {
|
||
|
||
|
||
}
|
||
|
||
@Test
|
||
public void testMemberBasicInfoMapper() {
|
||
// String memberId = "21772870";
|
||
// BigDecimal principalBalance = new BigDecimal("-10");
|
||
// BigDecimal giftBalance = new BigDecimal("-110");
|
||
// Integer version = 2;
|
||
// int i = memberBasicInfoMapper.updateMemberBalance(memberId, principalBalance, giftBalance, version);
|
||
// if (i == 1) {
|
||
// System.out.println("更新余额成功");
|
||
// } else {
|
||
// System.out.println("更新余额失败");
|
||
// }
|
||
|
||
Map<String, Object> refundParams = new HashMap<>(2);
|
||
refundParams.put("payment_id", "002212023071011321210524320114191904768");
|
||
// refundParams.put("refund_id", refund_id);
|
||
// refundParams.put("refund_order_no", refund_order_no);
|
||
try {
|
||
Map<String, Object> refund = Refund.query(refundParams);
|
||
System.out.println(refund);
|
||
} catch (BaseAdaPayException e) {
|
||
throw new RuntimeException(e);
|
||
}
|
||
}
|
||
|
||
/**
|
||
* 查询退款信息
|
||
*/
|
||
@Test
|
||
public void queryRefundTest() {
|
||
List<String> list = getPaymentIdList(); // 查询退款信息
|
||
for (String paymentId : list) {
|
||
Map<String, Object> refundParams = Maps.newHashMap();
|
||
refundParams.put("payment_id", paymentId);
|
||
try {
|
||
Map<String, Object> refund = Refund.query(refundParams, wechatAppId2);
|
||
System.out.println("支付id:" + paymentId + ", 退款信息:" + JSON.toJSONString(refund));
|
||
System.out.println();
|
||
} catch (BaseAdaPayException e) {
|
||
throw new RuntimeException(e);
|
||
}
|
||
}
|
||
}
|
||
|
||
/**
|
||
* 查询支付撤销信息
|
||
*/
|
||
@Test
|
||
public void queryPaymentReverseTest() {
|
||
List<String> list = getPaymentIdList(); // 查询支付撤销信息
|
||
for (String paymentId : list) {
|
||
try {
|
||
Map<String, Object> reverse = Maps.newHashMap();
|
||
reverse.put("payment_id", paymentId);
|
||
reverse.put("app_id", wechatAppId2);
|
||
Map<String, Object> response = PaymentReverse.queryList(reverse, wechatAppId2);
|
||
System.out.printf("支付id: %s, 支付撤销信息: %s%n", paymentId, JSON.toJSONString(response));
|
||
System.out.println();
|
||
} catch (BaseAdaPayException e) {
|
||
throw new RuntimeException(e);
|
||
}
|
||
}
|
||
}
|
||
|
||
@Test
|
||
public void testGenerateBillingTemplateMsgBody() {
|
||
String pileSn = "88000000000001";
|
||
// 根据桩号查询计费模板
|
||
BillingTemplateVO billingTemplateVO = pileBillingTemplateService.selectBillingTemplateDetailByPileSn(pileSn);
|
||
|
||
byte[] messageBody = pileBillingTemplateService.generateBillingTemplateMsgBody(pileSn, billingTemplateVO);
|
||
System.out.println(BytesUtil.binary(messageBody, 16));
|
||
}
|
||
|
||
@Test
|
||
public void testAnalysisPileParameter() {
|
||
BasicPileDTO dto = new BasicPileDTO();
|
||
// 3个都不传的情况
|
||
try {
|
||
System.out.println("3个都不传的情况");
|
||
dto.setPileSn("");
|
||
dto.setConnectorCode("");
|
||
dto.setPileConnectorCode("");
|
||
// orderService.analysisPileParameter(dto);
|
||
System.out.println("数据正确");
|
||
} catch (BusinessException e) {
|
||
System.out.println(e.getMessage());
|
||
}
|
||
System.out.println();
|
||
|
||
// 只传sn的情况
|
||
try {
|
||
System.out.println("只传sn的情况");
|
||
dto.setConnectorCode("");
|
||
dto.setPileConnectorCode("");
|
||
dto.setPileSn("88000000000001");
|
||
// orderService.analysisPileParameter(dto);
|
||
System.out.println("数据正确");
|
||
} catch (BusinessException e) {
|
||
System.out.println(e.getMessage());
|
||
}
|
||
System.out.println();
|
||
|
||
//
|
||
try {
|
||
System.out.println("只穿枪口号的情况");
|
||
dto.setConnectorCode("01");
|
||
dto.setPileConnectorCode("");
|
||
dto.setPileSn("");
|
||
// orderService.analysisPileParameter(dto);
|
||
System.out.println("数据正确");
|
||
} catch (BusinessException e) {
|
||
System.out.println(e.getMessage());
|
||
}
|
||
System.out.println();
|
||
|
||
// 只传充电桩枪口编号的情况
|
||
try {
|
||
System.out.println("只传充电桩枪口编号的情况");
|
||
dto.setPileConnectorCode("8800000000000101");
|
||
dto.setConnectorCode("");
|
||
dto.setPileSn("");
|
||
// orderService.analysisPileParameter(dto);
|
||
System.out.println("数据正确");
|
||
} catch (BusinessException e) {
|
||
System.out.println(e.getMessage());
|
||
}
|
||
|
||
try {
|
||
System.out.println();
|
||
System.out.println("传充电桩枪sn+枪口号的情况");
|
||
dto.setPileConnectorCode("");
|
||
dto.setConnectorCode("01");
|
||
dto.setPileSn("88000000000001");
|
||
// orderService.analysisPileParameter(dto);
|
||
System.out.println("数据正确");
|
||
} catch (BusinessException e) {
|
||
System.out.println(e.getMessage());
|
||
}
|
||
}
|
||
|
||
@Test
|
||
public void testImportBillingTemplate() {
|
||
ImportBillingTemplateDTO dto = new ImportBillingTemplateDTO();
|
||
dto.setBillingTemplateId("1");
|
||
// 查询公共计费模板是否存在
|
||
PileBillingTemplate pileBillingTemplate = pileBillingTemplateMapper.selectPileBillingTemplateById(Long.valueOf(dto.getBillingTemplateId()));
|
||
if (pileBillingTemplate == null) {
|
||
|
||
}
|
||
List<PileBillingDetail> billingDetailList = pileBillingTemplate.getPileBillingDetailList();
|
||
}
|
||
|
||
@Test
|
||
public void testProcess() {
|
||
// 62 68
|
||
String msgString = "680da300000388000000000001010020d06840a40000130000000000000000000000000000000088000000000001010202000000000000000000000000000000000000000000000000000000000000000000001516";
|
||
byte[] msg = BytesUtil.str2Bcd(msgString);
|
||
boolean b = YKCUtils.checkMsg(msg);
|
||
// ykcBusinessService.process(msg, null);
|
||
}
|
||
|
||
@Test
|
||
public void testHeartbeat() {
|
||
// heartbeatRequestHandler.updateStatus("88000000000001", "01", "0");
|
||
|
||
// heartbeatRequestHandler.updateStatus("88000000000001", "02", "0");
|
||
}
|
||
|
||
@Test
|
||
public void testPush() {
|
||
byte[] msg = new byte[]{};
|
||
String pileSn = "88000000000001";
|
||
// ykcPushBusinessService.push(msg, pileSn, YKCFrameTypeCode.READ_REAL_TIME_MONITOR_DATA_CODE);
|
||
}
|
||
|
||
@Test
|
||
public void TestMapUtils() {
|
||
String address = "淀山湖镇黄浦江南路278号";
|
||
String areaCode = "320000,320500,320583";
|
||
Map<String, String> longitudeAndLatitude = AddressUtils.getLongitudeAndLatitude(areaCode, address);
|
||
System.out.println(longitudeAndLatitude);
|
||
}
|
||
|
||
@Test
|
||
public void testCreatePile() {
|
||
BatchCreatePileDTO dto = BatchCreatePileDTO.builder()
|
||
.merchantId("1")
|
||
.stationId("1")
|
||
.softwareProtocol("1")
|
||
// .connectorNum(1)
|
||
// .num(10)
|
||
// .productionDate(new Date())
|
||
.build();
|
||
pileService.batchCreatePile(dto);
|
||
}
|
||
|
||
@Test
|
||
public void testGetIncre() {
|
||
StopWatch stopWatch = new StopWatch();
|
||
|
||
// 生成100个
|
||
stopWatch.start("生成100个sn号");
|
||
List<String> list2 = snUtils.generateSN(1);
|
||
stopWatch.stop();
|
||
System.out.println(list2);
|
||
|
||
System.out.println(stopWatch.getLastTaskTimeMillis());
|
||
}
|
||
|
||
@Test
|
||
public void testDict() {
|
||
// String dictValue = DictUtils.getDictValue("query_pile_info", "url");
|
||
// String station_type = DictUtils.getDictLabel("station_type", "1");
|
||
// System.out.println(station_type);
|
||
// System.out.println("123");
|
||
|
||
List<SysDictData> adapay_station = DictUtils.getDictCache("adapay_station");
|
||
List<String> stationIdList = com.google.common.collect.Lists.newArrayList();
|
||
if (CollectionUtils.isNotEmpty(adapay_station)) {
|
||
for (SysDictData sysDictData : adapay_station) {
|
||
stationIdList.add(sysDictData.getDictValue());
|
||
}
|
||
}
|
||
System.out.println(stationIdList);
|
||
}
|
||
|
||
@Test
|
||
public void testSelectByMerchantId() {
|
||
List<PileStationInfo> list = pileStationInfoService.selectStationListByMerchantId(Long.valueOf(Constants.ONE));
|
||
System.out.println(list);
|
||
}
|
||
|
||
@Test
|
||
public void testStr2Bcd() {
|
||
String logicCardNum = "00000000";
|
||
byte[] logicCardNumByteArr = BytesUtil.str2Bcd(logicCardNum);
|
||
System.out.println(Arrays.toString(logicCardNumByteArr));
|
||
}
|
||
|
||
@Test
|
||
public void testBigDecimalMultiply() {
|
||
BigDecimal a = new BigDecimal("216.5");
|
||
BigDecimal b = new BigDecimal("11.5");
|
||
|
||
BigDecimal result = a.multiply(b).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||
System.out.println(result);
|
||
}
|
||
|
||
@Test
|
||
public void testRemoteUpdate() {
|
||
ArrayList<String> list = new ArrayList<>();
|
||
list.add("88000000000001");
|
||
// pileRemoteService.updateFirmware(list);
|
||
}
|
||
|
||
@Test
|
||
public void testGetUserPhoneNum() {
|
||
String code = "0e5394cfa4eb41c6181ed257f2368a86dfe4ebdac0a4fac85df63657637e6cc3";
|
||
wxAppletRemoteService.getMobileNumberByCode(code);
|
||
}
|
||
|
||
@Test
|
||
public void testDistance() {
|
||
QueryStationDTO dto = new QueryStationDTO();
|
||
dto.setStationLat("123.2222");
|
||
dto.setStationLng("55.6232");
|
||
|
||
// pileStationInfoService.uniAppQueryStationInfos(dto);
|
||
}
|
||
|
||
/**
|
||
* 生成英文字母随机数 RandomStringUtils.randomAlphabetic(10);
|
||
* 生成数字随机数 RandomStringUtils.randomNumeric(10);
|
||
* 字母+数字结合 RandomStringUtils.randomAlphanumeric(10);
|
||
*/
|
||
@Test
|
||
public void Test() throws ParseException {
|
||
/*String s = RandomStringUtils.randomAlphanumeric(32);
|
||
System.out.println(s); // PuLe4Tyyg1jSFNPhF5d2Ts9ejRn6E8KQ
|
||
String str = "JS160829";
|
||
System.out.println(Md5Utils.hash(str).toUpperCase(Locale.ROOT));
|
||
*/
|
||
String s = RandomStringUtils.randomAlphanumeric(16).toUpperCase(Locale.ROOT);
|
||
System.out.println(s);
|
||
|
||
Date startTimeDate = sdf.parse("2022-11-26 10:44:11");
|
||
Date endTimeDate = sdf.parse("2022-11-27 12:45:11");
|
||
|
||
System.out.println(DateUtils.getDatePoor(endTimeDate, startTimeDate)); // 1天2小时1分钟
|
||
|
||
|
||
|
||
|
||
/*String stra = "sp_mchid=1632405339&sub_mchid=1632405339&out_trade_no=1217752501201407033233368318&sp_appid=wxbb3e0d474569481d&sub_appid=wxbb3e0d474569481d" +
|
||
"bbac689f4654b209de4d6944808ec80b";
|
||
System.out.println(Md5Utils.hash(stra).toUpperCase(Locale.ROOT));*/
|
||
}
|
||
|
||
@Test
|
||
public void testSimCard() throws ParseException {
|
||
ArrayList<String> list = Lists.newArrayList();
|
||
Collections.addAll(list, "898607B9102090253556", "898607B9102090253560");
|
||
// String s = list.toString().replaceAll("(?:\\[|null|\\]| +)", "");
|
||
// System.out.println(s);
|
||
// List<SimCardVO> simCardVOList = simCardService.selectSimCardInfoByIccId(list);
|
||
// System.out.println(simCardVOList.toString());
|
||
|
||
// simCardService.XunZhongSimRenewal(list, 12);
|
||
// System.out.println(s);
|
||
|
||
// SimCardVO simCardVO = simCardService.searchByLoop("898607B9102090253556");
|
||
//
|
||
// System.out.println(simCardVO.toString());
|
||
|
||
simCardService.WuLianSimRenew(list, 1);
|
||
|
||
|
||
}
|
||
|
||
@Test
|
||
public void testRefund() {
|
||
OrderBasicInfo orderInfo = orderBasicInfoService.getOrderInfoByOrderCode("88000000000001012212171045412218");
|
||
orderInfo.setReason("充电异常中止,急停开入");
|
||
|
||
TransactionRecordsData data = TransactionRecordsData.builder()
|
||
.transactionCode("88000000000001012212171045412218")
|
||
.consumptionAmount(String.valueOf(0.00))
|
||
.stopReasonMsg(orderInfo.getReason())
|
||
.totalElectricity("0")
|
||
.sharpUsedElectricity("0")
|
||
.peakUsedElectricity("0")
|
||
.flatUsedElectricity("0")
|
||
.valleyUsedElectricity("0")
|
||
.build();
|
||
|
||
// orderBasicInfoService.settleOrder(data, orderInfo);
|
||
}
|
||
|
||
|
||
@Test
|
||
public void testLoginHandler() {
|
||
String msg = "8800000000001001010f63362d333000000000898604b319227036282200";
|
||
byte[] msgBody = BytesUtil.str2Bcd(msg);
|
||
|
||
int startIndex = 0;
|
||
int length = 7;
|
||
|
||
// 桩编码
|
||
byte[] pileSnByte = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||
String pileSn = BytesUtil.binary(pileSnByte, 16);
|
||
// log.info("桩号:{}", pileSn);
|
||
|
||
|
||
// 桩类型 0 表示直流桩, 1 表示交流桩
|
||
startIndex += length;
|
||
length = 1;
|
||
byte[] pileTypeByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||
String pileType = BytesUtil.bcd2Str(pileTypeByteArr);
|
||
|
||
// 充电枪数量
|
||
startIndex += length;
|
||
byte[] connectorNumByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||
String connectorNum = BytesUtil.bcd2Str(connectorNumByteArr);
|
||
|
||
// 通信协议版本 版本号乘 10,v1.0 表示 0x0A
|
||
startIndex += length;
|
||
byte[] communicationVersionByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||
// int i = Integer.parseInt(BytesUtil.bcd2Str(communicationVersionByteArr)); // 0F --> 15
|
||
BigDecimal bigDecimal = new BigDecimal(BytesUtil.bcd2Str(communicationVersionByteArr));
|
||
BigDecimal communicationVersionTemp = bigDecimal.divide(new BigDecimal(10));
|
||
String communicationVersion = "v" + communicationVersionTemp;
|
||
|
||
// 程序版本
|
||
startIndex += length;
|
||
length = 8;
|
||
byte[] programVersionByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||
String programVersion = BytesUtil.bcd2Str(programVersionByteArr);
|
||
|
||
// 网络连接类型 0x00 SIM 卡 0x01 LAN 0x02 WAN 0x03 其他
|
||
startIndex += length;
|
||
length = 1;
|
||
byte[] internetConnectionTypeByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||
String internetConnection = BytesUtil.bcd2Str(internetConnectionTypeByteArr);
|
||
|
||
// sim卡
|
||
startIndex += length;
|
||
length = 10;
|
||
byte[] simCardNumByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||
String iccid = BytesUtil.bin2HexStr(simCardNumByteArr);
|
||
|
||
// 运营商 0x00 移动 0x02 电信 0x03 联通 0x04 其他
|
||
startIndex += length;
|
||
length = 1;
|
||
byte[] businessTypeByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||
String business = BytesUtil.bcd2Str(businessTypeByteArr);
|
||
|
||
LoginRequestData loginRequestData = LoginRequestData.builder()
|
||
.pileSn(pileSn)
|
||
.pileType(pileType)
|
||
.connectorNum(connectorNum)
|
||
.communicationVersion(communicationVersion)
|
||
.programVersion(programVersion)
|
||
.internetConnection(internetConnection)
|
||
.iccid(iccid)
|
||
.business(business)
|
||
.build();
|
||
|
||
// 结果(默认 0x01:登录失败)
|
||
byte[] flag = Constants.oneByteArray;
|
||
|
||
// 通过桩编码SN查询数据库,如果有数据,则登录成功,否则登录失败
|
||
QueryPileDTO dto = new QueryPileDTO();
|
||
dto.setPileSn(pileSn);
|
||
List<PileDetailVO> list = pileBasicInfoService.queryPileInfos(dto);
|
||
if (CollectionUtils.isNotEmpty(list)) {
|
||
flag = Constants.zeroByteArray;
|
||
// 登录成功,保存桩号和channel的关系
|
||
|
||
// PileChannelEntity.put(pileSn, channel);
|
||
// 更改桩和该桩下的枪口状态分别为 在线、空闲
|
||
// pileBasicInfoService.updatePileStatus(pileSn, PileStatusEnum.ON_LINE.getValue());
|
||
// pileConnectorInfoService.updateConnectorStatusByPileSn(pileSn, PileConnectorDataBaseStatusEnum.FREE.getValue());
|
||
|
||
// 对时
|
||
ProofreadTimeCommand command = ProofreadTimeCommand.builder().pileSn(pileSn).build();
|
||
ykcPushCommandService.pushProofreadTimeCommand(command);
|
||
|
||
// 公共方法修改状态
|
||
pileBasicInfoService.updateStatus(BytesUtil.bcd2Str(new byte[]{0x01}), pileSn, null, null, null);
|
||
|
||
|
||
// 下发二维码
|
||
IssueQRCodeCommand issueQRCodeCommand = IssueQRCodeCommand.builder().pileSn(pileSn).build();
|
||
ykcPushCommandService.pushIssueQRCodeCommand(issueQRCodeCommand);
|
||
|
||
}
|
||
|
||
|
||
// 充电桩使用的sim卡,把信息存库
|
||
if (StringUtils.equals("00", internetConnection)) {
|
||
try {
|
||
pileBasicInfoService.updatePileSimInfo(pileSn, iccid);
|
||
} catch (Exception e) {
|
||
// log.error("更新充电桩sim卡信息失败", e);
|
||
System.out.println(e.getMessage());
|
||
}
|
||
}
|
||
|
||
// 保存报文
|
||
String jsonMsg = JSON.toJSONString(loginRequestData);
|
||
// pileMsgRecordService.save(pileSn, pileSn, type, jsonMsg, ykcDataProtocol.getHEXString());
|
||
|
||
// // 消息体
|
||
// byte[] messageBody = Bytes.concat(pileSnByte, flag);
|
||
// return getResult(ykcDataProtocol, messageBody);
|
||
}
|
||
|
||
@Test
|
||
public void testGetMemberToken() {
|
||
String memberId = JWTUtils.getMemberId("eyJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE2NzY1MTY5MzgsImV4cCI6MTY3OTEwODkzOH0.4MwhZIOpnCfQloR7zEm2hwPOh2yyI2qxbBbTcv_SnZ4");
|
||
System.out.println(memberId);
|
||
}
|
||
|
||
/**
|
||
* 测试更新银行卡
|
||
*/
|
||
@Test
|
||
public void changeBankCardTest() throws BaseAdaPayException {
|
||
ChangeBankCardDTO dto = new ChangeBankCardDTO();
|
||
dto.setCardId("1018810800000168");
|
||
dto.setCardName("海南信祥物业管理有限公司");
|
||
dto.setTelNo("17384941319");
|
||
dto.setBankCode("88000835");
|
||
dto.setBankAcctType("1");
|
||
dto.setProvCode("0046");
|
||
dto.setAreaCode("4601");
|
||
|
||
String wechatAppId = wechatAppId1;
|
||
// 1-删除结算账户信息
|
||
// String adapayMemberId = account.getAdapayMemberId();
|
||
String adapayMemberId = "ACM69867986";
|
||
String settleAccountId = null;
|
||
AdapayCorpMemberVO adapayCorpMemberVO = adapayService.queryCorpAdapayMemberInfo(adapayMemberId, wechatAppId);
|
||
if (adapayCorpMemberVO != null) {
|
||
settleAccountId = adapayCorpMemberVO.getSettleAccountId();
|
||
}
|
||
adapayService.createDeleteSettleAccountRequest(adapayMemberId, settleAccountId, wechatAppId);
|
||
// 2-使用新账户信息创建结算账户
|
||
SettleAccountDTO settleAccountDTO = new SettleAccountDTO();
|
||
settleAccountDTO.setCardId(dto.getCardId());
|
||
settleAccountDTO.setCardName(dto.getCardName());
|
||
settleAccountDTO.setTelNo(dto.getTelNo());
|
||
settleAccountDTO.setBankCode(dto.getBankCode());
|
||
settleAccountDTO.setBankAcctType(dto.getBankAcctType());
|
||
settleAccountDTO.setProvCode(dto.getProvCode());
|
||
settleAccountDTO.setAreaCode(dto.getAreaCode());
|
||
adapayService.createSettleAccountRequest(settleAccountDTO, adapayMemberId, wechatAppId);
|
||
}
|
||
|
||
public static void main(String[] args) {
|
||
String data = "{\"total\":1,\"stationStatusInfo\":{\"operationID\":\"123456789\",\"stationID\":\"111111111111111\",\"connectorStatusInfos\":{\"connectorID\":1,\"equipmentID\":\"10000000000000000000001\",\"status\":4,\"currentA\":0,\"currentB\":0,\"currentC\":0,\"voltageA\":0,\"voltageB\":0,\"voltageC\":0,\"soc\":10}}}";
|
||
String dataSecret = "1234567890abcdef";
|
||
String dataSecretIv = "1234567890abcdef";
|
||
|
||
// 加密数据
|
||
String encryptData = Cryptos.encrypt(JSON.toJSONString(data), dataSecret, dataSecretIv);
|
||
String encryptData2 = Cryptos.aesEncrypt(JSON.toJSONString(data), dataSecret, dataSecretIv);
|
||
System.out.println(StringUtils.equals(encryptData, encryptData2));
|
||
String str = "il7B0BSEjFdzpyKzfOFpvg/Se1CP802RItKYFPfSLRxJ3jf0bVl9hvYOEktPAYW2nd7S8MBcyHYyacHKbI" +
|
||
"Sq5iTmDzG+ivnR+SZJv3USNTYVMz9rCQVSxd0cLlqsJauko79NnwQJbzDTyLooYoIwz75qBOH2/x" +
|
||
"OMirpeEqRJrF/EQjWekJmGk9RtboXePu2rka+Xm51syBPhiXJAq0GfbfaFu9tNqs/e2Vjja/ltE1M0lq" +
|
||
"vxfXQ6da6HrThsm5id4ClZFIi0acRfrsPLRixS/IQYtksxghvJwbqOsbIsITail9Ayy4tKcogeEZiOO+4Ed2" +
|
||
"64NSKmk7l3wKwJLAFjCFogBx8GE3OBz4pqcAn/ydA=";
|
||
|
||
System.out.println(StringUtils.equals(encryptData, str));
|
||
System.out.println(StringUtils.equals(encryptData2, str));
|
||
}
|
||
|
||
}
|