58 Commits
Author SHA1 Message Date
duzhichao 3ab75fc1b6 Merge pull request 'Test' (#2) from test into prod
Reviewed-on: #2
2026-11-19 07:44:04 +00:00
duzhichao 5123bf3463 Merge pull request 'test' (#89) from test into prod
Reviewed-on: http://220.205.16.27:18081/goflytec/GoFly-platform-services/pulls/89
2026-03-27 10:32:56 +00:00
duzhichao 47b752117a Merge pull request 'test' (#87) from test into prod
Reviewed-on: http://220.205.16.27:18081/goflytec/GoFly-platform-services/pulls/87
2026-03-17 10:08:40 +00:00
duzhichao 42d8e9537c Merge pull request 'test' (#85) from test into prod
Reviewed-on: http://220.205.16.27:18081/goflytec/GoFly-platform-services/pulls/85
2026-03-11 13:31:37 +00:00
duzhichao cd11540b6a Merge pull request 'test' (#83) from test into prod
Reviewed-on: http://220.205.16.27:18081/goflytec/GoFly-platform-services/pulls/83
2026-03-10 15:03:24 +00:00
duzhichao 9d09102190 Merge pull request 'test' (#81) from test into prod
Reviewed-on: http://220.205.16.27:18081/goflytec/GoFly-platform-services/pulls/81
2026-03-10 14:14:40 +00:00
duzhichao c6dfad912d Merge pull request 'test' (#79) from test into prod
Reviewed-on: http://220.205.16.27:18081/goflytec/GoFly-platform-services/pulls/79
2026-03-04 12:54:21 +00:00
duzhichao ad3190c850 Merge pull request 'test' (#77) from test into prod
Reviewed-on: http://220.205.16.27:18081/goflytec/GoFly-platform-services/pulls/77
2026-03-04 12:42:47 +00:00
duzhichao c429d14d43 Merge pull request 'test' (#75) from test into prod
Reviewed-on: http://220.205.16.27:18081/goflytec/GoFly-platform-services/pulls/75
2026-03-01 13:50:24 +00:00
duzhichao efea836e50 Merge pull request 'test' (#73) from test into prod
Reviewed-on: http://220.205.16.27:18081/goflytec/GoFly-platform-services/pulls/73
2026-02-26 11:58:49 +00:00
duzhichao 9a27919956 Merge pull request 'test' (#71) from test into prod
Reviewed-on: http://220.205.16.27:18081/goflytec/GoFly-platform-services/pulls/71
2026-02-19 16:34:29 +00:00
duzhichao 4cf7ea7768 Merge pull request 'test' (#69) from test into prod
Reviewed-on: http://220.205.16.27:18081/goflytec/GoFly-platform-services/pulls/69
2026-02-19 10:55:15 +00:00
duzhichao 0ae7b493f7 Merge pull request 'test' (#67) from test into prod
Reviewed-on: http://220.205.16.27:18081/goflytec/GoFly-platform-services/pulls/67
2026-02-11 13:05:28 +00:00
duzhichao a9d2711532 Merge pull request 'test' (#65) from test into prod
Reviewed-on: http://220.205.16.27:18081/goflytec/GoFly-platform-services/pulls/65
2026-02-11 11:51:22 +00:00
duzhichao bc66fab897 Merge pull request 'test' (#63) from test into prod
Reviewed-on: http://220.205.16.27:18081/goflytec/GoFly-platform-services/pulls/63
2026-02-05 12:45:31 +00:00
duzhichao fe24d44834 Merge pull request 'test' (#61) from test into prod
Reviewed-on: http://220.205.16.27:18081/goflytec/GoFly-platform-services/pulls/61
2026-02-05 12:12:26 +00:00
duzhichao 9c56e54f69 Merge pull request 'test' (#59) from test into prod
Reviewed-on: http://220.205.16.27:18081/goflytec/GoFly-platform-services/pulls/59
2026-02-05 11:36:56 +00:00
duzhichao 527e591619 Merge pull request 'test' (#57) from test into prod
Reviewed-on: http://220.205.16.27:18081/goflytec/GoFly-platform-services/pulls/57
2026-02-05 10:48:05 +00:00
duzhichao 273c34b44a Merge pull request 'test' (#53) from test into prod
Reviewed-on: http://220.205.16.27:18081/goflytec/GoFly-platform-services/pulls/53
2026-01-30 10:14:14 +00:00
duzhichao 971a0d4817 Merge pull request 'test' (#51) from test into prod
Reviewed-on: http://220.205.16.27:18081/goflytec/GoFly-platform-services/pulls/51
2026-01-30 09:47:00 +00:00
duzhichao 84bd74d324 Merge pull request 'test' (#49) from test into prod
Reviewed-on: http://220.205.16.27:18081/goflytec/GoFly-platform-services/pulls/49
2026-01-29 08:58:41 +00:00
duzhichao 2b730a00c5 Merge pull request 'test' (#47) from test into prod
Reviewed-on: http://220.205.16.27:18081/goflytec/GoFly-platform-services/pulls/47
2026-01-28 09:37:01 +00:00
duzhichao b7e75456ef Merge pull request 'test' (#45) from test into prod
Reviewed-on: http://220.205.16.27:18081/goflytec/GoFly-platform-services/pulls/45
2026-01-26 07:23:26 +00:00
duzhichao e6e99a5ea6 Merge pull request 'test' (#43) from test into prod
Reviewed-on: http://220.205.16.27:18081/goflytec/GoFly-platform-services/pulls/43
2026-01-26 05:24:43 +00:00
duzhichao abf1e93ae3 Merge pull request 'test' (#41) from test into prod
Reviewed-on: http://220.205.16.27:18081/goflytec/GoFly-platform-services/pulls/41
2026-01-22 10:49:33 +00:00
duzhichao 118145ab54 Merge pull request '合并到生产环境' (#39) from test into prod
Reviewed-on: http://220.205.16.27:18081/goflytec/GoFly-platform-services/pulls/39
2026-01-22 09:40:27 +00:00
duzhichao ed6a331e6e Merge pull request 'test' (#37) from test into prod
Reviewed-on: http://220.205.16.27:18081/goflytec/GoFly-platform-services/pulls/37
2026-01-15 08:47:05 +00:00
duzhichao e8eeed90fb Merge pull request 'test' (#35) from test into prod
Reviewed-on: http://220.205.16.27:18081/goflytec/GoFly-platform-services/pulls/35
2026-01-15 08:17:17 +00:00
duzhichao 29b2e743ab Merge pull request 'test' (#33) from test into prod
Reviewed-on: http://220.205.16.27:18081/goflytec/GoFly-platform-services/pulls/33
2026-01-15 08:08:45 +00:00
duzhichao cc96117b7d Merge pull request 'test' (#31) from test into prod
Reviewed-on: http://220.205.16.27:18081/goflytec/GoFly-platform-services/pulls/31
2026-01-15 07:35:49 +00:00
duzhichao 08f8f19178 Merge pull request 'test' (#29) from test into prod
Reviewed-on: http://220.205.16.27:18081/goflytec/GoFly-platform-services/pulls/29
2026-01-15 06:35:32 +00:00
duzhichao f4f8771378 Merge pull request 'test' (#27) from test into prod
Reviewed-on: http://220.205.16.27:18081/goflytec/GoFly-platform-services/pulls/27
2026-01-09 13:35:28 +00:00
duzhichao 9043e8d698 Merge pull request 'test' (#25) from test into prod
Reviewed-on: http://220.205.16.27:18081/goflytec/GoFly-platform-services/pulls/25
2026-01-09 13:21:04 +00:00
duzhichao e035219ed1 Merge pull request 'test' (#23) from test into prod
Reviewed-on: http://220.205.16.27:18081/goflytec/GoFly-platform-services/pulls/23
2026-01-09 12:27:41 +00:00
duzhichao 89de206bcb Merge pull request 'test' (#21) from test into prod
Reviewed-on: http://220.205.16.27:18081/goflytec/GoFly-platform-services/pulls/21
2026-01-04 13:29:02 +00:00
duzhichao 1579a9a31c Merge pull request 'feat: 设备管理添加经纬度以及高度和租户' (#19) from feature_dzc into prod
Reviewed-on: http://220.205.16.27:18081/goflytec/GoFly-platform-services/pulls/19
2026-01-04 13:16:42 +00:00
duzhichao d6996a20fc Merge pull request 'test' (#18) from test into prod
Reviewed-on: http://220.205.16.27:18081/goflytec/GoFly-platform-services/pulls/18
2026-01-04 12:39:05 +00:00
duzhichao 8465bcd1c4 Merge pull request 'test' (#16) from test into prod
Reviewed-on: http://220.205.16.27:18081/goflytec/GoFly-platform-services/pulls/16
2025-12-30 09:15:56 +00:00
duzhichao 2a70b54435 Merge pull request 'test' (#14) from test into prod
Reviewed-on: http://220.205.16.27:18081/goflytec/GoFly-platform-services/pulls/14
2025-12-25 09:17:53 +00:00
duzhichao 2a4f2cbc69 Merge pull request 'test' (#12) from test into prod
Reviewed-on: http://220.205.16.27:18081/goflytec/GoFly-platform-services/pulls/12
2025-12-24 11:05:26 +00:00
duzhichao 1872025c95 Merge pull request 'test' (#10) from test into prod
Reviewed-on: http://220.205.16.27:18081/goflytec/GoFly-platform-services/pulls/10
2025-12-24 08:12:38 +00:00
duzhichao 5e004678b6 Merge pull request 'test' (#8) from test into prod
Reviewed-on: http://220.205.16.27:18081/goflytec/GoFly-platform-services/pulls/8
2025-12-23 11:45:07 +00:00
duzhichao 2697eac46b Merge pull request 'test' (#6) from test into prod
Reviewed-on: http://220.205.16.27:18081/goflytec/GoFly-platform-services/pulls/6
2025-12-21 06:30:47 +00:00
duzhichao fe8636ada2 Merge pull request 'test' (#4) from test into prod
Reviewed-on: http://220.205.16.27:18081/goflytec/GoFly-platform-services/pulls/4
2025-12-17 14:18:45 +00:00
duzhichao 0611f17b21 Merge pull request '合并到生产' (#2) from test into prod
Reviewed-on: http://220.205.16.27:18081/goflytec/GoFly-platform-services/pulls/2
2025-12-01 11:58:06 +00:00
duzhichao 9702534db7 !72 !71 feat: 首页查询景区返回二维码code
Merge pull request !72 from 鸭先知/test
2025-11-12 08:07:52 +00:00
duzhichao d62be7adc2 !70 !69 feat: 1:视频剪辑模板管理
Merge pull request !70 from 鸭先知/test
2025-11-11 04:11:14 +00:00
duzhichao 46178e1a0e !68 !67 feat: 优惠券打包
Merge pull request !68 from 鸭先知/test
2025-11-07 10:39:32 +00:00
duzhichao 464c166a70 !64 !63 feat: 1:优化景区素材,查询景区素材从套餐中获取
Merge pull request !64 from 鸭先知/test
2025-11-07 08:39:00 +00:00
duzhichao a05dc8cda3 !62 !61 feat: 1:资源列表批量下载优化,可以下载为zip
Merge pull request !62 from 鸭先知/test
2025-11-06 11:36:34 +00:00
duzhichao 811b405ef3 !58 !57 feat: 航线管理页面优化
Merge pull request !58 from 鸭先知/test
2025-11-04 07:00:03 +00:00
duzhichao 490f3a65cc !56 !55 feat: 暂时去掉定时任务,等小程序正式使用后再放开,现在还是用以前的服务定时任务
Merge pull request !56 from 鸭先知/test
2025-10-30 09:05:37 +00:00
duzhichao a98eb63bcf !54 !53 feat: 优化退款审核页面
Merge pull request !54 from 鸭先知/test
2025-10-30 08:50:19 +00:00
duzhichao cc500ccb1b !52 !51 feat: 优化退款审核页面
Merge pull request !52 from 鸭先知/test
2025-10-30 07:17:18 +00:00
duzhichao 9f72363638 !50 !49 feat: 退款订单与订单列表整合5
Merge pull request !50 from 鸭先知/test
2025-10-29 10:14:48 +00:00
duzhichao e44dd4496a !48 !47 feat: 退款订单与订单列表整合
Merge pull request !48 from 鸭先知/test
2025-10-29 08:05:27 +00:00
duzhichao 6518a80148 !46 !45 feat: 二维码新增或者编辑绑定景区素材
Merge pull request !46 from 鸭先知/test
2025-10-26 09:00:55 +00:00
duzhichao eae7264ab9 !44 !43 feat: 修改首页,添加景区订单列表统计
Merge pull request !44 from 鸭先知/test
2025-10-22 07:42:08 +00:00
9 changed files with 15 additions and 175 deletions
-5
View File
@@ -80,11 +80,6 @@
<groupId>io.micrometer</groupId> <groupId>io.micrometer</groupId>
<artifactId>micrometer-registry-prometheus</artifactId> <artifactId>micrometer-registry-prometheus</artifactId>
</dependency> </dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>test</scope>
</dependency>
<dependency> <dependency>
<groupId>junit</groupId> <groupId>junit</groupId>
<artifactId>junit</artifactId> <artifactId>junit</artifactId>
@@ -210,10 +210,8 @@ public class AliPayController {
throw new IllegalStateException("订单不存在: " + outTradeNo); throw new IllegalStateException("订单不存在: " + outTradeNo);
} }
// 与微信回调保持一致:仅待支付订单受理,避免重复通知把已执行订单拉回排队队列 if (OrderStatus.PAID.getId().equals(order.getOrderStatus())) {
if (!OrderStatus.UNPAID.getId().equals(order.getOrderStatus())) { log.info("订单已支付,跳过: {}", outTradeNo);
log.warn("订单状态非待支付,忽略本次支付成功通知: orderNo={}, status={}, tradeNo:{}",
outTradeNo, order.getOrderStatus(), tradeNo);
return; return;
} }
@@ -82,7 +82,7 @@ public class RefundController {
/** /**
* 列表 * 列表
*/ */
@Operation(summary = "按订单所属景区查询当前租户范围内的退款列表") @Operation(summary = "查询全部列表")
@Parameters({ @Parameters({
@Parameter(name = "page",description = "分页起始位置",required = true,in= ParameterIn.QUERY), @Parameter(name = "page",description = "分页起始位置",required = true,in= ParameterIn.QUERY),
@Parameter(name = "limit",description = "分页结束位置",required = true,in=ParameterIn.QUERY) @Parameter(name = "limit",description = "分页结束位置",required = true,in=ParameterIn.QUERY)
@@ -157,20 +157,11 @@ public class WxPayController {
return; return;
} }
// 微信会重复推送同一笔通知,仅待支付订单受理,避免把已执行的订单重新拉回排队队列造成重复飞行
if (!OrderStatus.UNPAID.getId().equals(order.getOrderStatus())) {
log.warn("订单状态非待支付,忽略本次支付成功通知: orderNo={}, status={}, transactionId={}",
outTradeNo, order.getOrderStatus(), transaction.getTransactionId());
return;
}
// 2. 更新订单状态 // 2. 更新订单状态
order.setOrderStatus(OrderStatus.PAID.getId()); order.setOrderStatus(OrderStatus.PAID.getId());
order.setPayType(PayTypeEnum.WECHAT_PAY.getCode()); order.setPayType(PayTypeEnum.WECHAT_PAY.getCode());
order.setPayTime(new Date()); order.setPayTime(new Date());
if (!orderService.updateOrder(order)) { orderService.updateOrder(order);
log.error("支付成功但订单状态未更新,订单可能仍停留在待支付: orderNo={}", outTradeNo);
}
// === 携程分销订单创建 === // === 携程分销订单创建 ===
if (Integer.valueOf(1).equals(qrCode.getEnableCtripOrder())) { if (Integer.valueOf(1).equals(qrCode.getEnableCtripOrder())) {
@@ -229,20 +220,11 @@ public class WxPayController {
return; return;
} }
// 微信会重复推送同一笔通知,仅待支付订单受理,避免把已执行的订单重新拉回排队队列造成重复飞行
if (!OrderStatus.UNPAID.getId().equals(order.getOrderStatus())) {
log.warn("订单状态非待支付,忽略本次支付成功通知: orderNo={}, status={}, transactionId={}",
outTradeNo, order.getOrderStatus(), transaction.getTransactionId());
return;
}
// 2. 更新订单状态 // 2. 更新订单状态
order.setOrderStatus(OrderStatus.PAID.getId()); order.setOrderStatus(OrderStatus.PAID.getId());
order.setPayType(PayTypeEnum.WECHAT_PAY.getCode()); order.setPayType(PayTypeEnum.WECHAT_PAY.getCode());
order.setPayTime(new Date()); order.setPayTime(new Date());
if (!orderService.updateOrder(order)) { orderService.updateOrder(order);
log.error("支付成功但订单状态未更新,订单可能仍停留在待支付: orderNo={}", outTradeNo);
}
// === 携程分销订单创建 === // === 携程分销订单创建 ===
if (Integer.valueOf(1).equals(qrCode.getEnableCtripOrder())) { if (Integer.valueOf(1).equals(qrCode.getEnableCtripOrder())) {
@@ -7,6 +7,7 @@ import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* Order information * Order information
@@ -16,7 +17,13 @@ import java.util.List;
*/ */
@Mapper @Mapper
public interface RefundMapper extends SuperMapper<Refund> { public interface RefundMapper extends SuperMapper<Refund> {
List<Refund> findList(Page<Refund> page, @Param("tenantIds") List<String> tenantIds); /**
* 分页查询用户列表
* @param page
* @param params
* @return
*/
List<Refund> findList(Page<Refund> page, @Param("p") Map<String, Object> params);
/** /**
* 根据订单编码查询退款详情 * 根据订单编码查询退款详情
@@ -2,7 +2,6 @@ package com.central.order.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.central.common.context.LoginUserContextHolder;
import com.central.common.feign.UserService; import com.central.common.feign.UserService;
import com.central.common.model.PageResult; import com.central.common.model.PageResult;
import com.central.common.model.SysUser; import com.central.common.model.SysUser;
@@ -18,8 +17,6 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.MapUtils; import org.apache.commons.collections4.MapUtils;
import org.springframework.context.annotation.Primary; import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.*; import java.util.*;
@@ -51,12 +48,8 @@ public class RefundServiceImpl extends SuperServiceImpl<RefundMapper, Refund> im
*/ */
@Override @Override
public PageResult<Refund> findList(Map<String, Object> params){ public PageResult<Refund> findList(Map<String, Object> params){
List<String> tenantIds = resolveRefundTenantIds(MapUtils.getString(params, "tenantId"));
if (CollectionUtils.isEmpty(tenantIds)) {
return PageResult.<Refund>builder().data(List.of()).resp_code(0).count(0L).build();
}
Page<Refund> page = new Page<>(MapUtils.getInteger(params, "page"), MapUtils.getInteger(params, "limit")); Page<Refund> page = new Page<>(MapUtils.getInteger(params, "page"), MapUtils.getInteger(params, "limit"));
List<Refund> list = baseMapper.findList(page, tenantIds); List<Refund> list = baseMapper.findList(page, params);
if(list!=null && list.size()>0){ if(list!=null && list.size()>0){
for (Refund refund: list){ for (Refund refund: list){
//用户手机号 //用户手机号
@@ -81,21 +74,6 @@ public class RefundServiceImpl extends SuperServiceImpl<RefundMapper, Refund> im
return PageResult.<Refund>builder().data(list).resp_code(0).count(page.getTotal()).build(); return PageResult.<Refund>builder().data(list).resp_code(0).count(page.getTotal()).build();
} }
private List<String> resolveRefundTenantIds(String requestedTenant) {
String currentTenant = LoginUserContextHolder.getCurrentTenantId();
if (!StringUtils.hasText(currentTenant)) {
return List.of();
}
List<String> allowed = userService.getSonTenantIds(currentTenant);
if (!StringUtils.hasText(requestedTenant) || currentTenant.equals(requestedTenant)) {
return allowed;
}
if (CollectionUtils.isEmpty(allowed) || !allowed.contains(requestedTenant)) {
return List.of();
}
return userService.getSonTenantIds(requestedTenant);
}
@Override @Override
public boolean createRefund(Refund refund) { public boolean createRefund(Refund refund) {
@@ -4,14 +4,7 @@
<mapper namespace="com.central.order.mapper.RefundMapper"> <mapper namespace="com.central.order.mapper.RefundMapper">
<select id="findList" resultType="com.central.order.model.Refund"> <select id="findList" resultType="com.central.order.model.Refund">
SELECT r.* FROM orders_refund r select * from orders_refund t ORDER BY id DESC
WHERE EXISTS (
SELECT 1 FROM orders o
JOIN tourisms t ON t.id = o.tourism_id AND t.is_del = 0
WHERE o.order_no = r.order_no AND t.tenant_id IN
<foreach collection="tenantIds" item="tenantId" open="(" separator="," close=")">#{tenantId}</foreach>
)
ORDER BY r.id DESC
</select> </select>
<!-- 根据订单编码查询退款详情 --> <!-- 根据订单编码查询退款详情 -->
@@ -1,109 +0,0 @@
package com.central.order.service.impl;
import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.core.MybatisConfiguration;
import com.baomidou.mybatisplus.core.MybatisSqlSessionFactoryBuilder;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import com.central.common.context.LoginUserContextHolder;
import com.central.common.feign.UserService;
import com.central.common.model.LoginAppUser;
import com.central.common.model.PageResult;
import com.central.order.mapper.RefundMapper;
import com.central.order.model.Refund;
import com.central.order.service.IOrderService;
import org.apache.ibatis.builder.xml.XMLMapperBuilder;
import org.apache.ibatis.datasource.unpooled.UnpooledDataSource;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.mapping.Environment;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.transaction.jdbc.JdbcTransactionFactory;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.test.util.ReflectionTestUtils;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
class RefundListTenantTest {
private final RefundServiceImpl service = new RefundServiceImpl();
private final UserService users = mock(UserService.class);
private SqlSession session;
@BeforeEach
void setUp() throws Exception {
var dataSource = new UnpooledDataSource("org.h2.Driver", "jdbc:h2:mem:" + UUID.randomUUID() + ";MODE=MySQL", "sa", "");
var config = new MybatisConfiguration(new Environment("test", new JdbcTransactionFactory(), dataSource));
var pagination = new MybatisPlusInterceptor();
pagination.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
config.addInterceptor(pagination);
String resource = "mapper/RefundMapper.xml";
try (var xml = Resources.getResourceAsStream(resource)) {
new XMLMapperBuilder(xml, config, resource, config.getSqlFragments()).parse();
}
session = new MybatisSqlSessionFactoryBuilder().build(config).openSession();
try (var sql = session.getConnection().createStatement()) {
sql.execute("CREATE TABLE tourisms (id BIGINT PRIMARY KEY, tenant_id VARCHAR(32), is_del INT)");
sql.execute("CREATE TABLE orders (order_no VARCHAR(32) PRIMARY KEY, tourism_id BIGINT)");
sql.execute("CREATE TABLE orders_refund (id BIGINT PRIMARY KEY, order_no VARCHAR(32), tenant_id VARCHAR(32))");
sql.execute("INSERT INTO tourisms VALUES (1,'parent',0),(2,'child',0),(3,'other',0),(4,'parent',1)");
sql.execute("INSERT INTO orders VALUES ('P',1),('C',2),('O',3),('D',4)");
sql.execute("INSERT INTO orders_refund VALUES (1,'P','parent'),(2,'C','platform'),(3,'O','parent'),(4,'D','parent'),(5,'missing','parent')");
}
ReflectionTestUtils.setField(service, "baseMapper", session.getMapper(RefundMapper.class));
ReflectionTestUtils.setField(service, "userService", users);
ReflectionTestUtils.setField(service, "orderService", mock(IOrderService.class));
when(users.getSonTenantIds("parent")).thenReturn(List.of("parent", "child"));
when(users.getSonTenantIds("child")).thenReturn(List.of("child"));
when(users.getSonTenantIds("other")).thenReturn(List.of("other"));
}
@AfterEach
void tearDown() {
LoginUserContextHolder.clear();
if (session != null) session.close();
}
@Test
void pagesByOriginalOrderScenicAreaIncludingChildren() {
login("parent");
assertPage(service.findList(Map.of("page", 1, "limit", 1)), 2, 2L);
assertPage(service.findList(Map.of("page", 2, "limit", 1)), 2, 1L);
login("other");
assertPage(service.findList(Map.of("page", 1, "limit", 10)), 1, 3L);
}
@Test
void tenantSelectionCanNarrowButNotExpandTheScope() {
login("parent");
assertPage(service.findList(Map.of("page", 1, "limit", 10, "tenantId", "child")), 1, 2L);
assertPage(service.findList(Map.of("page", 1, "limit", 10, "tenantId", "other")), 0);
}
@Test
void noTenantOrNoVisibleScenicAreaReturnsEmptyPage() {
assertPage(service.findList(Map.of("page", 1, "limit", 10, "tenantId", "parent")), 0);
login("unresolved");
assertPage(service.findList(Map.of("page", 1, "limit", 10)), 0);
login("empty");
when(users.getSonTenantIds("empty")).thenReturn(List.of("empty"));
assertPage(service.findList(Map.of("page", 1, "limit", 10)), 0);
}
private void login(String tenantId) {
var user = new LoginAppUser();
user.setCompany(tenantId);
LoginUserContextHolder.setUser(user);
}
private void assertPage(PageResult<Refund> page, long total, Long... ids) {
assertEquals(total, page.getCount());
assertEquals(List.of(ids), page.getData().stream().map(Refund::getId).toList());
}
}
@@ -12,9 +12,6 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
/** /**
* 支付宝小程序二维码服务 * 支付宝小程序二维码服务
* <p> * <p>
@@ -74,7 +71,6 @@ public class AlipayQrcodeService {
biz.put("url_param", urlParam); biz.put("url_param", urlParam);
biz.put("query_param", (queryKey == null || queryKey.isEmpty() ? "uuid" : queryKey) + "=" + codeId); biz.put("query_param", (queryKey == null || queryKey.isEmpty() ? "uuid" : queryKey) + "=" + codeId);
biz.put("describe", trimDescribe(describe)); biz.put("describe", trimDescribe(describe));
log.info("支付宝小程序码 bizContent: {}", biz.toJSONString());
request.setBizContent(biz.toJSONString()); request.setBizContent(biz.toJSONString());
if (Boolean.TRUE.equals(cfg.getIsServiceMode()) && cfg.getAuthToken() != null) { if (Boolean.TRUE.equals(cfg.getIsServiceMode()) && cfg.getAuthToken() != null) {