fix(多租户):多租户数据接口和数据表结构,noIgnoreSqls逻辑添加
This commit is contained in:
+8
-2
@@ -1,6 +1,7 @@
|
|||||||
package com.central.device.controller;
|
package com.central.device.controller;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.central.common.model.Result;
|
||||||
import com.central.device.service.LiveStreamService;
|
import com.central.device.service.LiveStreamService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
@@ -13,8 +14,13 @@ public class LiveStreamController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private LiveStreamService liveStreamService;
|
private LiveStreamService liveStreamService;
|
||||||
|
|
||||||
@GetMapping("/stream-urls")
|
@GetMapping("/live/stream-urls")
|
||||||
public JSONObject getStreamUrls(@RequestParam String deviceId) {
|
public JSONObject getJsonStreamUrls(@RequestParam String deviceId) {
|
||||||
return liveStreamService.generateStreamUrls(deviceId);
|
return liveStreamService.generateStreamUrls(deviceId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/stream-urls")
|
||||||
|
public Result<JSONObject> getStreamUrls(@RequestParam String deviceId) {
|
||||||
|
return Result.succeed(liveStreamService.generateStreamUrls(deviceId));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -28,6 +28,6 @@ public interface DeviceCenterService {
|
|||||||
@GetMapping("/wayline/sign/{id}")
|
@GetMapping("/wayline/sign/{id}")
|
||||||
String getLineFileSign(@PathVariable("id") String id);
|
String getLineFileSign(@PathVariable("id") String id);
|
||||||
|
|
||||||
@GetMapping("/stream-urls")
|
@GetMapping("/live/stream-urls")
|
||||||
JSONObject getStreamUrls(@RequestParam("deviceId") String deviceId) ;
|
JSONObject getStreamUrls(@RequestParam("deviceId") String deviceId) ;
|
||||||
}
|
}
|
||||||
|
|||||||
+11
-9
@@ -11,7 +11,6 @@ import com.central.order.feign.UserCenterService;
|
|||||||
import com.central.order.model.*;
|
import com.central.order.model.*;
|
||||||
import com.central.order.service.*;
|
import com.central.order.service.*;
|
||||||
import com.central.order.util.DateUtils;
|
import com.central.order.util.DateUtils;
|
||||||
import com.central.order.util.StringUtils;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -167,15 +166,16 @@ public class OrderStatusChangeListener {
|
|||||||
// 发送小程序订阅消息
|
// 发送小程序订阅消息
|
||||||
if (sysUser.getOpenId() != null) {
|
if (sysUser.getOpenId() != null) {
|
||||||
String tip = "支付成功,当前排第"+queue+"位";
|
String tip = "支付成功,当前排第"+queue+"位";
|
||||||
String amount = StringUtils.fenToYuan(order.getOrderAmount());
|
|
||||||
String orderName = tourism.getTourismName();
|
String orderName = tourism.getTourismName();
|
||||||
wxMiniSubscribeService.sendPaySuccessMsg(
|
String pageUrl = "pages/task/task";
|
||||||
|
wxMiniSubscribeService.sendServiceProcessMsg(
|
||||||
sysUser.getOpenId(),
|
sysUser.getOpenId(),
|
||||||
orderName,
|
orderName,
|
||||||
order.getOrderNo(),
|
|
||||||
tip,
|
tip,
|
||||||
amount,
|
order.getOrderNo(),
|
||||||
DateUtils.sdf.format(order.getPayTime())
|
DateUtils.sdf.format(order.getPayTime()),
|
||||||
|
"",
|
||||||
|
pageUrl
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -227,13 +227,15 @@ public class OrderStatusChangeListener {
|
|||||||
String activityName = tourism.getTourismName(); // 活动名称
|
String activityName = tourism.getTourismName(); // 活动名称
|
||||||
String remark = "即将为您进行拍摄服务";
|
String remark = "即将为您进行拍摄服务";
|
||||||
String activityNo = nextOrder.getOrderNo(); // 活动编号
|
String activityNo = nextOrder.getOrderNo(); // 活动编号
|
||||||
wxMiniSubscribeService.sendPaySuccessMsg(
|
String pageUrl = "pages/task/task";
|
||||||
|
wxMiniSubscribeService.sendServiceProcessMsg(
|
||||||
nextUser.getOpenId(),
|
nextUser.getOpenId(),
|
||||||
activityName,
|
activityName,
|
||||||
activityNo,
|
|
||||||
remark,
|
remark,
|
||||||
activityNo,
|
activityNo,
|
||||||
DateUtils.sdf.format(nextOrder.getPayTime())
|
DateUtils.sdf.format(nextOrder.getPayTime()),
|
||||||
|
"",
|
||||||
|
pageUrl
|
||||||
);
|
);
|
||||||
log.info("已通知下一个排队用户: userId={}, openId={}, orderNo={}", nextUser.getId(), nextUser.getOpenId(), activityNo);
|
log.info("已通知下一个排队用户: userId={}, openId={}, orderNo={}", nextUser.getId(), nextUser.getOpenId(), activityNo);
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-6
@@ -13,7 +13,6 @@ import com.central.order.model.Tourism;
|
|||||||
import com.central.order.model.dto.VideoEditStatus;
|
import com.central.order.model.dto.VideoEditStatus;
|
||||||
import com.central.order.service.*;
|
import com.central.order.service.*;
|
||||||
import com.central.order.util.DateUtils;
|
import com.central.order.util.DateUtils;
|
||||||
import com.central.order.util.StringUtils;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -197,14 +196,15 @@ public class VideoEditServiceImpl implements IVideoEditService {
|
|||||||
|
|
||||||
Tourism tourism = tourismService.getTourismById(order.getTourismId());
|
Tourism tourism = tourismService.getTourismById(order.getTourismId());
|
||||||
String result = "视频已生成请查阅";
|
String result = "视频已生成请查阅";
|
||||||
|
String pageUrl = "pages/album/album";
|
||||||
wxMiniSubscribeService.sendPaySuccessMsg(
|
wxMiniSubscribeService.sendServiceProcessMsg(
|
||||||
user.getOpenId(),
|
user.getOpenId(),
|
||||||
tourism.getTourismName(),
|
tourism.getTourismName(),
|
||||||
orderNo,
|
|
||||||
result,
|
result,
|
||||||
StringUtils.fenToYuan(order.getOrderAmount()),
|
orderNo,
|
||||||
DateUtils.sdf.format(order.getPayTime())
|
DateUtils.sdf.format(order.getPayTime()),
|
||||||
|
"",
|
||||||
|
pageUrl
|
||||||
);
|
);
|
||||||
log.info("已发送一键成片完成通知: userId={}, openId={}, orderNo={}", userId, user.getOpenId(), orderNo);
|
log.info("已发送一键成片完成通知: userId={}, openId={}, orderNo={}", userId, user.getOpenId(), orderNo);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|||||||
+4
-1
@@ -19,6 +19,9 @@ public class WxMiniSubscribeServiceImpl implements WxMiniSubscribeService {
|
|||||||
@Value("${wx.mini.template.pay-success}")
|
@Value("${wx.mini.template.pay-success}")
|
||||||
private String templateId;
|
private String templateId;
|
||||||
|
|
||||||
|
@Value("${wx.mini.template.service-process}")
|
||||||
|
private String serviceProcessTemplateId;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private WxMaService wxMaService;
|
private WxMaService wxMaService;
|
||||||
|
|
||||||
@@ -60,7 +63,7 @@ public class WxMiniSubscribeServiceImpl implements WxMiniSubscribeService {
|
|||||||
try {
|
try {
|
||||||
WxMaSubscribeMessage msg = new WxMaSubscribeMessage();
|
WxMaSubscribeMessage msg = new WxMaSubscribeMessage();
|
||||||
msg.setToUser(openId);
|
msg.setToUser(openId);
|
||||||
msg.setTemplateId(templateId);
|
msg.setTemplateId(serviceProcessTemplateId);
|
||||||
msg.setPage(pageUrl); // 可选跳转页面 "pages/task/task"
|
msg.setPage(pageUrl); // 可选跳转页面 "pages/task/task"
|
||||||
|
|
||||||
List<WxMaSubscribeMessage.MsgData> dataList = new ArrayList<>();
|
List<WxMaSubscribeMessage.MsgData> dataList = new ArrayList<>();
|
||||||
|
|||||||
@@ -40,10 +40,12 @@ zlt:
|
|||||||
- profit_sharing
|
- profit_sharing
|
||||||
- order_statistics
|
- order_statistics
|
||||||
ignoreSqls:
|
ignoreSqls:
|
||||||
# 用户关联角色时,显示所有角色
|
# 查询全部列表
|
||||||
- com.central.order.mapper.findList
|
- com.central.order.mapper.OrderMapper.findList
|
||||||
# 用户列表显示用户所关联的所有角色
|
# 获取某个订单
|
||||||
- com.central.user.mapper.SysUserRoleMapper.findRolesByUserIds
|
- com.central.order.mapper.OrderMapper.getOrderByNumber
|
||||||
|
noIgnoreSqls:
|
||||||
|
- com.central.order.mapper.OrderMapper.findList
|
||||||
# 微信支付商户号
|
# 微信支付商户号
|
||||||
tencent:
|
tencent:
|
||||||
merchantId: ${zlt.wxpay.merchantId}
|
merchantId: ${zlt.wxpay.merchantId}
|
||||||
|
|||||||
@@ -4,10 +4,10 @@ server:
|
|||||||
spring:
|
spring:
|
||||||
application:
|
application:
|
||||||
name: order-center
|
name: order-center
|
||||||
cloud:
|
# cloud:
|
||||||
nacos:
|
# nacos:
|
||||||
discovery:
|
# discovery:
|
||||||
ip: 81.70.164.178
|
# ip: 81.70.164.178
|
||||||
# cloud:
|
# cloud:
|
||||||
# nacos:
|
# nacos:
|
||||||
# discovery:
|
# discovery:
|
||||||
|
|||||||
+8
-1
@@ -4,7 +4,6 @@ import lombok.Data;
|
|||||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
import org.springframework.cloud.context.config.annotation.RefreshScope;
|
import org.springframework.cloud.context.config.annotation.RefreshScope;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -38,4 +37,12 @@ public class TenantProperties {
|
|||||||
"com.central.user.mapper.SysRoleMapper.findAll",
|
"com.central.user.mapper.SysRoleMapper.findAll",
|
||||||
"com.central.user.mapper.SysUserRoleMapper.findRolesByUserIds"
|
"com.central.user.mapper.SysUserRoleMapper.findRolesByUserIds"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 忽略租户的SQL
|
||||||
|
*/
|
||||||
|
private List<String> noIgnoreSqls = Arrays.asList(
|
||||||
|
"com.central.user.mapper.SysRoleMapper.findAll",
|
||||||
|
"com.central.user.mapper.SysUserRoleMapper.findRolesByUserIds"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -58,7 +58,7 @@ public class MybatisPlusAutoConfigure {
|
|||||||
//是否开启多租户隔离
|
//是否开启多租户隔离
|
||||||
if (enableTenant) {
|
if (enableTenant) {
|
||||||
CustomTenantInterceptor tenantInterceptor = new CustomTenantInterceptor(
|
CustomTenantInterceptor tenantInterceptor = new CustomTenantInterceptor(
|
||||||
tenantLineHandler, tenantProperties.getIgnoreSqls());
|
tenantLineHandler, tenantProperties.getIgnoreSqls(),tenantProperties.getNoIgnoreSqls());
|
||||||
mpInterceptor.addInnerInterceptor(tenantInterceptor);
|
mpInterceptor.addInnerInterceptor(tenantInterceptor);
|
||||||
}
|
}
|
||||||
if(dataScopeProperties.getEnabled()){
|
if(dataScopeProperties.getEnabled()){
|
||||||
|
|||||||
+11
-2
@@ -23,10 +23,12 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
public class CustomTenantInterceptor extends TenantLineInnerInterceptor {
|
public class CustomTenantInterceptor extends TenantLineInnerInterceptor {
|
||||||
private List<String> ignoreSqls;
|
private List<String> ignoreSqls;
|
||||||
|
private List<String> noIgnoreSqls;
|
||||||
|
|
||||||
public CustomTenantInterceptor(TenantLineHandler tenantLineHandler, List<String> ignoreSqls) {
|
public CustomTenantInterceptor(TenantLineHandler tenantLineHandler, List<String> ignoreSqls, List<String> noIgnoreSqls) {
|
||||||
super(tenantLineHandler);
|
super(tenantLineHandler);
|
||||||
this.ignoreSqls = ignoreSqls;
|
this.ignoreSqls = ignoreSqls;
|
||||||
|
this.noIgnoreSqls = noIgnoreSqls;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -35,10 +37,17 @@ public class CustomTenantInterceptor extends TenantLineInnerInterceptor {
|
|||||||
if (isIgnoreMappedStatement(ms.getId())) {
|
if (isIgnoreMappedStatement(ms.getId())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
super.beforeQuery(executor, ms, parameter, rowBounds, resultHandler, boundSql);
|
if (isNoIgnoreMappedStatement(ms.getId())) {
|
||||||
|
super.beforeQuery(executor, ms, parameter, rowBounds, resultHandler, boundSql);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isIgnoreMappedStatement(String msId) {
|
private boolean isIgnoreMappedStatement(String msId) {
|
||||||
return ignoreSqls.stream().anyMatch((e) -> e.equalsIgnoreCase(msId));
|
return ignoreSqls.stream().anyMatch((e) -> e.equalsIgnoreCase(msId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isNoIgnoreMappedStatement(String msId) {
|
||||||
|
return noIgnoreSqls.stream().anyMatch((e) -> e.equalsIgnoreCase(msId));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
########################## bootstrap级别通用配置 ##########################
|
########################## bootstrap级别通用配置 ##########################
|
||||||
# 默认开发环境
|
# 默认开发环境
|
||||||
spring.profiles.active=prod
|
spring.profiles.active=dev
|
||||||
|
|
||||||
##### nacos(注册中心和配置中心)地址
|
##### nacos(注册中心和配置中心)地址
|
||||||
spring.cloud.nacos.server-addr=81.70.164.178:8848
|
#spring.cloud.nacos.server-addr=81.70.164.178:8848
|
||||||
#spring.cloud.nacos.server-addr=127.0.0.1:8848
|
spring.cloud.nacos.server-addr=127.0.0.1:8848
|
||||||
spring.cloud.nacos.username=nacos
|
spring.cloud.nacos.username=nacos
|
||||||
#spring.cloud.nacos.password=nacos
|
spring.cloud.nacos.password=nacos
|
||||||
spring.cloud.nacos.password=nacosGFLY
|
#spring.cloud.nacos.password=nacosGFLY
|
||||||
spring.cloud.nacos.config.file-extension=yml
|
spring.cloud.nacos.config.file-extension=yml
|
||||||
spring.cloud.nacos.config.shared-configs[0].data-id=common.yml
|
spring.cloud.nacos.config.shared-configs[0].data-id=common.yml
|
||||||
spring.cloud.nacos.config.shared-configs[0].refresh=true
|
spring.cloud.nacos.config.shared-configs[0].refresh=true
|
||||||
|
|||||||
@@ -9,43 +9,43 @@
|
|||||||
export default {
|
export default {
|
||||||
dev: {
|
dev: {
|
||||||
'/api-uaa/': {
|
'/api-uaa/': {
|
||||||
target: 'http://119.45.169.13:9900',
|
// target: 'http://119.45.169.13:9900',
|
||||||
// target: 'http://127.0.0.1:9900',
|
target: 'http://127.0.0.1:9900',
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
},
|
},
|
||||||
'/api-user/': {
|
'/api-user/': {
|
||||||
target: 'http://119.45.169.13:9900',
|
// target: 'http://119.45.169.13:9900',
|
||||||
// target: 'http://127.0.0.1:9900',
|
target: 'http://127.0.0.1:9900',
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
},
|
},
|
||||||
'/api-log/': {
|
'/api-log/': {
|
||||||
target: 'http://119.45.169.13:9900',
|
// target: 'http://119.45.169.13:9900',
|
||||||
// target: 'http://127.0.0.1:9900',
|
target: 'http://127.0.0.1:9900',
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
},
|
},
|
||||||
'/api-search/': {
|
'/api-search/': {
|
||||||
target: 'http://119.45.169.13:9900',
|
// target: 'http://119.45.169.13:9900',
|
||||||
// target: 'http://127.0.0.1:9900',
|
target: 'http://127.0.0.1:9900',
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
},
|
},
|
||||||
'/api-generator/': {
|
'/api-generator/': {
|
||||||
target: 'http://119.45.169.13:9900',
|
// target: 'http://119.45.169.13:9900',
|
||||||
// target: 'http://127.0.0.1:9900',
|
target: 'http://127.0.0.1:9900',
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
},
|
},
|
||||||
'/api-file/': {
|
'/api-file/': {
|
||||||
target: 'http://119.45.169.13:9900',
|
// target: 'http://119.45.169.13:9900',
|
||||||
// target: 'http://127.0.0.1:9900',
|
target: 'http://127.0.0.1:9900',
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
},
|
},
|
||||||
'/api-order/': {
|
'/api-order/': {
|
||||||
target: 'http://119.45.169.13:9900',
|
// target: 'http://119.45.169.13:9900',
|
||||||
// target: 'http://127.0.0.1:9900',
|
target: 'http://127.0.0.1:9900',
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
},
|
},
|
||||||
'/api-device/': {
|
'/api-device/': {
|
||||||
target: 'http://119.45.169.13:9900',
|
// target: 'http://119.45.169.13:9900',
|
||||||
// target: 'http://127.0.0.1:9900',
|
target: 'http://127.0.0.1:9900',
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user