Pu Zhibing
2025-03-06 9ea18e97ce0a2318619a608a5a4585e7378553ea
修改bug和漏洞修复
1个文件已修改
364 ■■■■ 已修改文件
ruoyi-service/ruoyi-order/src/test/java/com/ruoyi/order/RuoYiOrderApplicationTests.java 364 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/test/java/com/ruoyi/order/RuoYiOrderApplicationTests.java
@@ -1,182 +1,182 @@
package com.ruoyi.order;
import com.alibaba.fastjson2.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ruoyi.account.api.feignClient.*;
import com.ruoyi.account.api.model.TAppUserCar;
import com.ruoyi.chargingPile.api.feignClient.*;
import com.ruoyi.chargingPile.api.model.Site;
import com.ruoyi.chargingPile.api.model.TChargingGun;
import com.ruoyi.chargingPile.api.model.TChargingPile;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.redis.service.RedisService;
import com.ruoyi.common.security.service.TokenService;
import com.ruoyi.integration.api.feignClient.*;
import com.ruoyi.integration.api.model.ChargingHandshake;
import com.ruoyi.integration.api.model.UploadRealTimeMonitoringData;
import com.ruoyi.order.api.feignClient.AccountingStrategyDetailOrderClient;
import com.ruoyi.order.api.model.TChargingOrder;
import com.ruoyi.order.api.model.TChargingOrderAccountingStrategy;
import com.ruoyi.order.api.vo.AccountingStrategyDetailOrderVo;
import com.ruoyi.order.api.vo.ChargingOrderInfoVO;
import com.ruoyi.order.api.vo.TransactionRecordMessageVO;
import com.ruoyi.order.dto.ChargingDetails;
import com.ruoyi.order.dto.MyChargingOrderInfo;
import com.ruoyi.order.mapper.TSettlementConfirmMapper;
import com.ruoyi.order.service.*;
import com.ruoyi.order.vo.EndOfChargePageInfo;
import com.ruoyi.other.api.feignClient.IntegralRuleClient;
import com.ruoyi.other.api.feignClient.UserTagClient;
import com.ruoyi.other.api.feignClient.VipClient;
import com.ruoyi.payment.api.feignClient.AliPaymentClient;
import com.ruoyi.payment.api.feignClient.WxPaymentClient;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import javax.annotation.Resource;
import java.io.PrintWriter;
import java.math.BigDecimal;
import java.util.*;
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = RuoYiOrderApplication.class)
public class RuoYiOrderApplicationTests {
    @Resource
    private TChargingOrderService chargingOrderService;
    @Resource
    private ChargingGunClient chargingGunClient;
    @Resource
    private TSettlementConfirmMapper tSettlementConfirmMapper;
    @Resource
    private SiteClient siteClient;
    @Resource
    private AppUserCarClient appUserCarClient;
    @Resource
    private AppUserClient appUserClient;
    @Resource
    private ChargingPileClient chargingPileClient;
    @Resource
    private TChargingOrderAccountingStrategyService chargingOrderAccountingStrategyService;
    @Resource
    private TokenService tokenService;
    @Resource
    private WxPaymentClient wxPaymentClient;
    @Resource
    private AliPaymentClient aliPaymentClient;
    @Resource
    private AppCouponClient appCouponClient;
    @Resource
    private AppUserVipDetailClient appUserVipDetailClient;
    @Resource
    private RedisService redisService;
    @Resource
    private UploadRealTimeMonitoringDataClient uploadRealTimeMonitoringDataClient;
    @Resource
    private ChargingHandshakeClient chargingHandshakeClient;
    @Resource
    private SendMessageClient sendMessageClient;
    @Resource
    private TOrderEvaluateService orderEvaluateService;
    @Resource
    private AccountingStrategyDetailClient accountingStrategyDetailClient;
    @Resource
    private AccountingStrategyDetailOrderClient accountingStrategyDetailOrderClient;
    @Resource
    private AccountingStrategyClient accountingStrategyClient;
    @Resource
    private PlatformStartChargingReplyClient platformStartChargingReplyClient;
    @Resource
    private TChargingOrderRefundService chargingOrderRefundService;
    @Resource
    private PlatformStopChargingReplyClient platformStopChargingReplyClient;
    @Resource
    private AccountingStrategyOrderService accountingStrategyOrderService;
    @Resource
    private AccountingStrategyDetailOrderService accountingStrategyDetailOrderService;
    @Resource
    private InviteUserClient inviteUserClient;
    @Resource
    private AppUserIntegralChangeClient appUserIntegralChangeClient;
    @Resource
    private IntegralRuleClient integralRuleClient;
    @Resource
    private VipClient vipClient;
    @Resource
    private UserTagClient userTagClient;
    @Resource
    private AppUserTagClient appUserTagClient;
    @Resource
    private SecurityDetectionClient securityDetectionClient;
    @Test
    public void test(){
        TransactionRecordMessageVO vo = JSON.parseObject("{\n" +
                "\t\"charging_gun_code\": \"01\",\n" +
                "\t\"charging_pile_code\": \"2024123100001005\",\n" +
                "\t\"end_time\": \"2025-03-04 00:00:43.00\",\n" +
                "\t\"flat_amount2\": 0.000000,\n" +
                "\t\"flat_amount4\": 0.000000,\n" +
                "\t\"flat_amount6\": 2.350000,\n" +
                "\t\"flat_charge2\": 0.000000,\n" +
                "\t\"flat_charge4\": 0.000000,\n" +
                "\t\"flat_charge6\": 1.989000,\n" +
                "\t\"loss_peak_charge3\": 0,\n" +
                "\t\"loss_peak_charge5\": 0,\n" +
                "\t\"loss_total_electricity\": 0,\n" +
                "\t\"loss_valley_charge1\": 0,\n" +
                "\t\"loss_valley_charge7\": 0,\n" +
                "\t\"payment_amount\": 27.320000,\n" +
                "\t\"peak_amount3\": 0.000000,\n" +
                "\t\"peak_amount5\": 0.000000,\n" +
                "\t\"peak_charge3\": 0.000000,\n" +
                "\t\"peak_charge5\": 0.000000,\n" +
                "\t\"physical_card_number\": \"1234567812345678\",\n" +
                "\t\"result\": \"{\\\"service_id\\\":\\\"transaction_record\\\",\\\"transaction_serial_number\\\":\\\"CD38820250303225620557\\\",\\\"charging_pile_code\\\":\\\"2024123100001005\\\",\\\"charging_gun_code\\\":\\\"01\\\",\\\"start_time\\\":\\\"2025-03-03 22:56:18.00\\\",\\\"end_time\\\":\\\"2025-03-04 00:00:43.00\\\",\\\"valley_charge1\\\":\\\"0.066000\\\",\\\"loss_valley_charge1\\\":\\\"0\\\",\\\"valley_amount1\\\":\\\"0.040000\\\",\\\"flat_charge2\\\":\\\"0.000000\\\",\\\"loss_flat_charg2\\\":\\\"0\\\",\\\"flat_amount2\\\":\\\"0.000000\\\",\\\"peak_charge3\\\":\\\"0.000000\\\",\\\"loss_peak_charge3\\\":\\\"0\\\",\\\"peak_amount3\\\":\\\"0.000000\\\",\\\"flat_charge4\\\":\\\"0.000000\\\",\\\"loss_flat_charg4\\\":\\\"0\\\",\\\"flat_amount4\\\":\\\"0.000000\\\",\\\"peak_charge5\\\":\\\"0.000000\\\",\\\"loss_peak_charge5\\\":\\\"0\\\",\\\"peak_amount5\\\":\\\"0.000000\\\",\\\"flat_charge6\\\":\\\"1.989000\\\",\\\"loss_flat_charg6\\\":\\\"0\\\",\\\"flat_amount6\\\":\\\"2.350000\\\",\\\"valley_charge7\\\":\\\"33.103000\\\",\\\"loss_valley_charge7\\\":\\\"0\\\",\\\"valley_amount7\\\":\\\"24.910000\\\",\\\"total_electricity\\\":\\\"35.158001\\\",\\\"loss_total_electricity\\\":\\\"0\\\",\\\"payment_amount\\\":\\\"27.320000\\\",\\\"trade_date\\\":\\\"0\\\",\\\"stop_reason\\\":\\\"1\\\",\\\"physical_card_number\\\":\\\"1234567812345678\\\"}\",\n" +
                "\t\"retryTimes\": 0,\n" +
                "\t\"sendTime\": 1741017648977,\n" +
                "\t\"serviceId\": \"transaction_record\",\n" +
                "\t\"source\": \"\",\n" +
                "\t\"start_time\": \"2025-03-03 22:56:18.00\",\n" +
                "\t\"stop_reason\": 1,\n" +
                "\t\"total_electricity\": 35.158001,\n" +
                "\t\"trade_date\": \"0\",\n" +
                "\t\"transaction_serial_number\": \"CD38820250303225620557\",\n" +
                "\t\"valley_amount1\": 0.040000,\n" +
                "\t\"valley_amount7\": 24.910000,\n" +
                "\t\"valley_charge1\": 0.066000,\n" +
                "\t\"valley_charge7\": 33.103000\n" +
                "}", TransactionRecordMessageVO.class);
        chargingOrderService.endChargeBillingCharge(vo);
    }
}
//package com.ruoyi.order;
//
//import com.alibaba.fastjson2.JSON;
//import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
//import com.ruoyi.account.api.feignClient.*;
//import com.ruoyi.account.api.model.TAppUserCar;
//import com.ruoyi.chargingPile.api.feignClient.*;
//import com.ruoyi.chargingPile.api.model.Site;
//import com.ruoyi.chargingPile.api.model.TChargingGun;
//import com.ruoyi.chargingPile.api.model.TChargingPile;
//import com.ruoyi.common.core.web.domain.AjaxResult;
//import com.ruoyi.common.redis.service.RedisService;
//import com.ruoyi.common.security.service.TokenService;
//import com.ruoyi.integration.api.feignClient.*;
//import com.ruoyi.integration.api.model.ChargingHandshake;
//import com.ruoyi.integration.api.model.UploadRealTimeMonitoringData;
//import com.ruoyi.order.api.feignClient.AccountingStrategyDetailOrderClient;
//import com.ruoyi.order.api.model.TChargingOrder;
//import com.ruoyi.order.api.model.TChargingOrderAccountingStrategy;
//import com.ruoyi.order.api.vo.AccountingStrategyDetailOrderVo;
//import com.ruoyi.order.api.vo.ChargingOrderInfoVO;
//import com.ruoyi.order.api.vo.TransactionRecordMessageVO;
//import com.ruoyi.order.dto.ChargingDetails;
//import com.ruoyi.order.dto.MyChargingOrderInfo;
//import com.ruoyi.order.mapper.TSettlementConfirmMapper;
//import com.ruoyi.order.service.*;
//import com.ruoyi.order.vo.EndOfChargePageInfo;
//import com.ruoyi.other.api.feignClient.IntegralRuleClient;
//import com.ruoyi.other.api.feignClient.UserTagClient;
//import com.ruoyi.other.api.feignClient.VipClient;
//import com.ruoyi.payment.api.feignClient.AliPaymentClient;
//import com.ruoyi.payment.api.feignClient.WxPaymentClient;
//import org.junit.jupiter.api.Test;
//import org.springframework.boot.test.context.SpringBootTest;
//
//import javax.annotation.Resource;
//import java.io.PrintWriter;
//import java.math.BigDecimal;
//import java.util.*;
//
//@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = RuoYiOrderApplication.class)
//public class RuoYiOrderApplicationTests {
//
//    @Resource
//    private TChargingOrderService chargingOrderService;
//
//    @Resource
//    private ChargingGunClient chargingGunClient;
//    @Resource
//    private TSettlementConfirmMapper tSettlementConfirmMapper;
//
//    @Resource
//    private SiteClient siteClient;
//
//    @Resource
//    private AppUserCarClient appUserCarClient;
//    @Resource
//    private AppUserClient appUserClient;
//
//    @Resource
//    private ChargingPileClient chargingPileClient;
//
//    @Resource
//    private TChargingOrderAccountingStrategyService chargingOrderAccountingStrategyService;
//
//    @Resource
//    private TokenService tokenService;
//
//    @Resource
//    private WxPaymentClient wxPaymentClient;
//
//    @Resource
//    private AliPaymentClient aliPaymentClient;
//
//    @Resource
//    private AppCouponClient appCouponClient;
//
//    @Resource
//    private AppUserVipDetailClient appUserVipDetailClient;
//
//    @Resource
//    private RedisService redisService;
//
//    @Resource
//    private UploadRealTimeMonitoringDataClient uploadRealTimeMonitoringDataClient;
//
//    @Resource
//    private ChargingHandshakeClient chargingHandshakeClient;
//
//    @Resource
//    private SendMessageClient sendMessageClient;
//
//    @Resource
//    private TOrderEvaluateService orderEvaluateService;
//
//    @Resource
//    private AccountingStrategyDetailClient accountingStrategyDetailClient;
//
//    @Resource
//    private AccountingStrategyDetailOrderClient accountingStrategyDetailOrderClient;
//
//    @Resource
//    private AccountingStrategyClient accountingStrategyClient;
//
//    @Resource
//    private PlatformStartChargingReplyClient platformStartChargingReplyClient;
//
//    @Resource
//    private TChargingOrderRefundService chargingOrderRefundService;
//
//    @Resource
//    private PlatformStopChargingReplyClient platformStopChargingReplyClient;
//
//    @Resource
//    private AccountingStrategyOrderService accountingStrategyOrderService;
//
//    @Resource
//    private AccountingStrategyDetailOrderService accountingStrategyDetailOrderService;
//
//    @Resource
//    private InviteUserClient inviteUserClient;
//
//    @Resource
//    private AppUserIntegralChangeClient appUserIntegralChangeClient;
//
//    @Resource
//    private IntegralRuleClient integralRuleClient;
//
//    @Resource
//    private VipClient vipClient;
//
//    @Resource
//    private UserTagClient userTagClient;
//
//    @Resource
//    private AppUserTagClient appUserTagClient;
//
//    @Resource
//    private SecurityDetectionClient securityDetectionClient;
//
//
//    @Test
//    public void test(){
//        TransactionRecordMessageVO vo = JSON.parseObject("{\n" +
//                "\t\"charging_gun_code\": \"01\",\n" +
//                "\t\"charging_pile_code\": \"2024123100001005\",\n" +
//                "\t\"end_time\": \"2025-03-04 00:00:43.00\",\n" +
//                "\t\"flat_amount2\": 0.000000,\n" +
//                "\t\"flat_amount4\": 0.000000,\n" +
//                "\t\"flat_amount6\": 2.350000,\n" +
//                "\t\"flat_charge2\": 0.000000,\n" +
//                "\t\"flat_charge4\": 0.000000,\n" +
//                "\t\"flat_charge6\": 1.989000,\n" +
//                "\t\"loss_peak_charge3\": 0,\n" +
//                "\t\"loss_peak_charge5\": 0,\n" +
//                "\t\"loss_total_electricity\": 0,\n" +
//                "\t\"loss_valley_charge1\": 0,\n" +
//                "\t\"loss_valley_charge7\": 0,\n" +
//                "\t\"payment_amount\": 27.320000,\n" +
//                "\t\"peak_amount3\": 0.000000,\n" +
//                "\t\"peak_amount5\": 0.000000,\n" +
//                "\t\"peak_charge3\": 0.000000,\n" +
//                "\t\"peak_charge5\": 0.000000,\n" +
//                "\t\"physical_card_number\": \"1234567812345678\",\n" +
//                "\t\"result\": \"{\\\"service_id\\\":\\\"transaction_record\\\",\\\"transaction_serial_number\\\":\\\"CD38820250303225620557\\\",\\\"charging_pile_code\\\":\\\"2024123100001005\\\",\\\"charging_gun_code\\\":\\\"01\\\",\\\"start_time\\\":\\\"2025-03-03 22:56:18.00\\\",\\\"end_time\\\":\\\"2025-03-04 00:00:43.00\\\",\\\"valley_charge1\\\":\\\"0.066000\\\",\\\"loss_valley_charge1\\\":\\\"0\\\",\\\"valley_amount1\\\":\\\"0.040000\\\",\\\"flat_charge2\\\":\\\"0.000000\\\",\\\"loss_flat_charg2\\\":\\\"0\\\",\\\"flat_amount2\\\":\\\"0.000000\\\",\\\"peak_charge3\\\":\\\"0.000000\\\",\\\"loss_peak_charge3\\\":\\\"0\\\",\\\"peak_amount3\\\":\\\"0.000000\\\",\\\"flat_charge4\\\":\\\"0.000000\\\",\\\"loss_flat_charg4\\\":\\\"0\\\",\\\"flat_amount4\\\":\\\"0.000000\\\",\\\"peak_charge5\\\":\\\"0.000000\\\",\\\"loss_peak_charge5\\\":\\\"0\\\",\\\"peak_amount5\\\":\\\"0.000000\\\",\\\"flat_charge6\\\":\\\"1.989000\\\",\\\"loss_flat_charg6\\\":\\\"0\\\",\\\"flat_amount6\\\":\\\"2.350000\\\",\\\"valley_charge7\\\":\\\"33.103000\\\",\\\"loss_valley_charge7\\\":\\\"0\\\",\\\"valley_amount7\\\":\\\"24.910000\\\",\\\"total_electricity\\\":\\\"35.158001\\\",\\\"loss_total_electricity\\\":\\\"0\\\",\\\"payment_amount\\\":\\\"27.320000\\\",\\\"trade_date\\\":\\\"0\\\",\\\"stop_reason\\\":\\\"1\\\",\\\"physical_card_number\\\":\\\"1234567812345678\\\"}\",\n" +
//                "\t\"retryTimes\": 0,\n" +
//                "\t\"sendTime\": 1741017648977,\n" +
//                "\t\"serviceId\": \"transaction_record\",\n" +
//                "\t\"source\": \"\",\n" +
//                "\t\"start_time\": \"2025-03-03 22:56:18.00\",\n" +
//                "\t\"stop_reason\": 1,\n" +
//                "\t\"total_electricity\": 35.158001,\n" +
//                "\t\"trade_date\": \"0\",\n" +
//                "\t\"transaction_serial_number\": \"CD38820250303225620557\",\n" +
//                "\t\"valley_amount1\": 0.040000,\n" +
//                "\t\"valley_amount7\": 24.910000,\n" +
//                "\t\"valley_charge1\": 0.066000,\n" +
//                "\t\"valley_charge7\": 33.103000\n" +
//                "}", TransactionRecordMessageVO.class);
//        chargingOrderService.endChargeBillingCharge(vo);
//    }
//}