From 1b997e49979ec42dbb62671b0bc40f962de86955 Mon Sep 17 00:00:00 2001 From: xuhy <3313886187@qq.com> Date: 星期五, 11 四月 2025 19:39:17 +0800 Subject: [PATCH] Merge branch 'xizang-changyun' of https://gitee.com/xiaochen991015/xizang into dev --- ruoyi-admin/src/test/java/com/ruoyi/web/test/BaseTest.java | 63 +++++++++++++++++++++++++++++++ ruoyi-system/src/main/resources/mapper/system/TFlowManagementMapper.xml | 8 ++-- ruoyi-admin/pom.xml | 12 +++++- ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TBillServiceImpl.java | 4 + 4 files changed, 80 insertions(+), 7 deletions(-) diff --git a/ruoyi-admin/pom.xml b/ruoyi-admin/pom.xml index 2d19f0b..8097033 100644 --- a/ruoyi-admin/pom.xml +++ b/ruoyi-admin/pom.xml @@ -37,7 +37,11 @@ <artifactId>spring-boot-devtools</artifactId> <optional>true</optional> <!-- 表示依赖不会传递 --> </dependency> - + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-test</artifactId> + <scope>test</scope> + </dependency> <!-- swagger3--> <dependency> <groupId>io.springfox</groupId> @@ -116,7 +120,6 @@ <dependency> <groupId>org.springframework</groupId> <artifactId>spring-test</artifactId> - <version>5.1.3.RELEASE</version> </dependency> <!-- <dependency>--> <!-- <groupId>org.apache.httpcomponents</groupId>--> @@ -142,6 +145,11 @@ <artifactId>dysmsapi20170525</artifactId> <version>2.0.10</version> </dependency> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <scope>test</scope> + </dependency> <!-- excel工具 --> <!-- Apache POI核心依赖 --> diff --git a/ruoyi-admin/src/test/java/com/ruoyi/web/test/BaseTest.java b/ruoyi-admin/src/test/java/com/ruoyi/web/test/BaseTest.java new file mode 100644 index 0000000..0d179c8 --- /dev/null +++ b/ruoyi-admin/src/test/java/com/ruoyi/web/test/BaseTest.java @@ -0,0 +1,63 @@ +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); + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TBillServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TBillServiceImpl.java index c5bd162..f3ece0a 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TBillServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TBillServiceImpl.java @@ -154,7 +154,7 @@ if (presist.getPayFeesStatus().equals("3")){ throw new ServiceException("该账单已缴费完成"); } - save.setBusinessDeptId(presist.getBusinessDeptId()); + switch (type){ // 仅更新除金额字段外的属性 case 1: @@ -211,6 +211,7 @@ break; } + save.setBusinessDeptId(presist.getBusinessDeptId()); updateById(save); return save; }finally { @@ -419,6 +420,7 @@ } + /** * 根据发票编号查询账单列表 * @param invoiceId diff --git a/ruoyi-system/src/main/resources/mapper/system/TFlowManagementMapper.xml b/ruoyi-system/src/main/resources/mapper/system/TFlowManagementMapper.xml index 6e2d276..74c2699 100644 --- a/ruoyi-system/src/main/resources/mapper/system/TFlowManagementMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/TFlowManagementMapper.xml @@ -39,10 +39,10 @@ <!-- 统计总额和微信支付金额 --> <select id="getPaymentStats" resultMap="PaymentStatsResultMap"> - SELECT ifnull(SUM(flow_money),0) AS total_amount, - ifnull(SUM(CASE WHEN pay_type = 1 THEN flow_money ELSE 0 END ) ,0)AS wechat_amount, - ifnull(SUM(CASE WHEN pay_type = 2 THEN flow_money ELSE 0 END ),0) AS alipay_amount, - ifnull(SUM(CASE WHEN pay_type = 3 THEN flow_money ELSE 0 END ),0) AS offline_amount + SELECT ifnull(SUM(pre_outstand-remaining_money),0) AS total_amount, + ifnull(SUM(CASE WHEN pay_type = 1 THEN (pre_outstand-remaining_money) ELSE 0 END ) ,0)AS wechat_amount, + ifnull(SUM(CASE WHEN pay_type = 2 THEN (pre_outstand-remaining_money) ELSE 0 END ),0) AS alipay_amount, + ifnull(SUM(CASE WHEN pay_type = 3 THEN (pre_outstand-remaining_money) ELSE 0 END ),0) AS offline_amount FROM t_flow_management <where> -- Gitblit v1.7.1