New file |
| | |
| | | package com.ruoyi.web.test; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.TypeReference; |
| | | import com.ruoyi.RuoYiApplication; |
| | | import com.ruoyi.system.service.TBillService; |
| | | import com.taxi591.bankapi.dto.ChargeBillRequest; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | 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.boot.test.context.SpringBootTest.WebEnvironment; |
| | | import org.springframework.context.ApplicationContext; |
| | | import org.springframework.context.ApplicationContextAware; |
| | | import org.springframework.context.EnvironmentAware; |
| | | import org.springframework.core.env.Environment; |
| | | import org.springframework.test.context.junit4.SpringRunner; |
| | | |
| | | @RunWith(SpringRunner.class) |
| | | @SpringBootTest(classes = RuoYiApplication.class,webEnvironment = WebEnvironment.MOCK) |
| | | @Slf4j |
| | | public class BaseTest implements ApplicationContextAware, EnvironmentAware { |
| | | |
| | | static { |
| | | System.setProperty("spring.profiles.active","test"); |
| | | } |
| | | |
| | | protected ApplicationContext applicationContext; |
| | | protected Environment environment; |
| | | |
| | | @Override |
| | | public void setApplicationContext(ApplicationContext applicationContext) { |
| | | this.applicationContext = applicationContext; |
| | | } |
| | | |
| | | public ApplicationContext getApplicationContext() { |
| | | return applicationContext; |
| | | } |
| | | |
| | | @Override |
| | | public void setEnvironment(Environment environment) { |
| | | this.environment = environment; |
| | | } |
| | | |
| | | public Environment getEnvironment() { |
| | | return environment; |
| | | } |
| | | |
| | | |
| | | @Autowired |
| | | TBillService tBillService; |
| | | |
| | | |
| | | @Test |
| | | public void test(){ |
| | | String params = "{\"format\":\"json\",\"message\":{\"head\":{\"channel\":\"OPEN\",\"transCode\":\"chargeBill\",\"transFlag\":\"01\",\"transSeqNum\":\"BP250411141205A19694\",\"timeStamp\":\"20250411141205218\",\"branchCode\":\"2540\"},\"info\":{\"epayCode\":\"JF-EPAY2025030510983\",\"merchantId\":\"103882597000441\",\"traceNo\":\"JF250411141154364902\",\"input1\":\"25041114115300100000000000069356\",\"userId\":\"o4mMu5Ry-Uv3hpLt81DrXVSCe9hA\",\"amtRule\":\"0\",\"payBillCount\":\"1\",\"payBillAmt\":\"0.01\",\"payBillNo\":\"25041114115300100000000000069356\",\"payType\":\"EP139\",\"transPaySeq\":\"4BEC2514080908013408\",\"transDate\":\"20250411\",\"transTime\":\"141205\",\"settleDate\":\"20250411\",\"clearType\":\"ZHSYT\",\"resendTimes\":\"0\",\"numOpenMerchantOrder\":\"10388259700044143807189441315960\"}}}"; |
| | | ChargeBillRequest chargeBillRequest = JSON.parseObject(params, |
| | | new TypeReference<ChargeBillRequest>() { |
| | | }); |
| | | tBillService.completePay(chargeBillRequest); |
| | | } |
| | | } |