Merge branch 'master' into cc_20251016_async

# Conflicts:
#	coolstore-partner-common/src/main/java/com/cool/store/executor/MdcTaskExecutor.java
#	coolstore-partner-service/src/main/java/com/cool/store/service/impl/MessageTemplateServiceImpl.java
This commit is contained in:
苏竹红
2025-10-16 17:29:07 +08:00
47 changed files with 1084 additions and 18 deletions

View File

@@ -35,6 +35,65 @@
</dependency>
</dependencies>
<profiles>
<profile>
<id>dev</id>
<properties>
<profileActive>dev</profileActive>
</properties>
</profile>
<profile>
<id>dev2</id>
<properties>
<profileActive>dev2</profileActive>
</properties>
</profile>
<profile>
<id>local</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<profileActive>local</profileActive>
</properties>
</profile>
<profile>
<id>test</id>
<properties>
<profileActive>test</profileActive>
</properties>
</profile>
<profile>
<id>test3</id>
<properties>
<profileActive>test3</profileActive>
</properties>
</profile>
<profile>
<id>ab</id>
<properties>
<profileActive>ab</profileActive>
</properties>
</profile>
<profile>
<id>online</id>
<properties>
<profileActive>online</profileActive>
</properties>
</profile>
<profile>
<id>hd</id>
<properties>
<profileActive>hd</profileActive>
</properties>
</profile>
<profile>
<id>zcb</id>
<properties>
<profileActive>zcb</profileActive>
</properties>
</profile>
</profiles>
<build>
<plugins>

View File

@@ -40,4 +40,16 @@ public class PartnerWebApplication {
return defaultDataSourceProperties().initializeDataSourceBuilder().type(HikariDataSource.class).build();
}
@Bean
@ConfigurationProperties("platform.datasource")
public DataSourceProperties platformDataSourceProperties() {
return new DataSourceProperties();
}
@Bean
@ConfigurationProperties("spring.datasource.hikari")
public DataSource platformDataSource() {
return platformDataSourceProperties().initializeDataSourceBuilder().type(HikariDataSource.class).build();
}
}

View File

@@ -0,0 +1,37 @@
package com.cool.store.aspect;
import com.cool.store.annotation.PlatformDB;
import com.cool.store.datasource.DataSourceContextHolder;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.AfterThrowing;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.springframework.stereotype.Component;
/**
* <p>
* 数据源切换 切面
* </p>
*
* @author wangff
* @since 2025/9/4
*/
@Aspect
@Component
public class DataSourceAspect {
@Before("@annotation(platformDB)")
public void before(PlatformDB platformDB) {
DataSourceContextHolder.setDataSourceType("platform");
}
@After("@annotation(platformDB)")
public void after(PlatformDB platformDB) {
DataSourceContextHolder.clearDataSourceType();
}
@AfterThrowing("@annotation(platformDB)")
public void afterThrowing(PlatformDB platformDB) {
DataSourceContextHolder.clearDataSourceType();
}
}

View File

@@ -60,7 +60,8 @@ public class SignValidateFilter implements Filter {
"/zxjp/**/api/audit/result",
"/zxjp/**/api/license",
"/zxjp/mini/line/getRegionPayPic",
"/zxjp/mini/miniProgram/getUserInfoByToken"
"/zxjp/mini/miniProgram/getUserInfoByToken",
"/zxjp/ws/**"
);

View File

@@ -52,7 +52,10 @@ public class TokenValidateFilter implements Filter {
"/zxjp/pc/sysRole/**",
"/zxjp/**/api/audit/result",
"/zxjp/pc/video/**",
"/zxjp/**/api/license"
"/zxjp/**/api/license",
"/zxjp/pc/v3/login/accountLogin",
"/zxjp/pc/v3/login/refreshLogin",
"/zxjp/ws/**"
);

View File

@@ -0,0 +1,72 @@
package com.cool.store.config.websocket;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.messaging.simp.config.MessageBrokerRegistry;
import org.springframework.scheduling.TaskScheduler;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
import org.springframework.web.socket.config.annotation.EnableWebSocketMessageBroker;
import org.springframework.web.socket.config.annotation.StompEndpointRegistry;
import org.springframework.web.socket.config.annotation.WebSocketMessageBrokerConfigurer;
/**
* <p>
* WebSocket配置类
* </p>
*
* @author wangff
* @since 2025/9/2
*/
@Configuration
@EnableWebSocketMessageBroker
@Slf4j
public class WebSocketConfig implements WebSocketMessageBrokerConfigurer {
@Override
public void registerStompEndpoints(StompEndpointRegistry registry) {
registry.addEndpoint("/ws/zxzs")
.setAllowedOrigins("*")
.withSockJS(); // 启用SockJS支持
}
@Override
public void configureMessageBroker(MessageBrokerRegistry registry) {
// 配置消息代理
registry.enableSimpleBroker("/topic", "/queue") // 启用简单代理,用于广播和点对点消息
.setHeartbeatValue(new long[]{0, 10000})
.setTaskScheduler(webSocketTaskScheduler());
registry.setApplicationDestinationPrefixes("/app"); // 设置应用程序端点前缀
// registry.setUserDestinationPrefix("/user");
}
@Bean
public TaskScheduler webSocketTaskScheduler() {
ThreadPoolTaskScheduler taskScheduler = new ThreadPoolTaskScheduler();
taskScheduler.setPoolSize(1);
taskScheduler.setThreadNamePrefix("websocket-heartbeat-");
taskScheduler.initialize();
return taskScheduler;
}
// @Override
// public void configureClientInboundChannel(ChannelRegistration registration) {
// registration.interceptors(new ChannelInterceptor() {
// @Override
// public Message<?> preSend(Message<?> message, MessageChannel channel) {
// StompHeaderAccessor accessor = StompHeaderAccessor.wrap(message);
//
// if (StompCommand.CONNECT.equals(accessor.getCommand())) {
// // 从STOMP头部获取login字段作为用户标识
// String login = accessor.getLogin();
// log.info("用户login:{}", login);
// if (login != null && !login.isEmpty()) {
// // 设置用户身份
// accessor.setUser(() -> login);
// }
// }
// return message;
// }
// });
// }
}

View File

@@ -0,0 +1,47 @@
package com.cool.store.controller.webb;
import com.cool.store.dto.login.UserLoginDTO;
import com.cool.store.dto.login.UserRefreshLoginDTO;
import com.cool.store.response.ResponseResult;
import com.cool.store.service.login.LoginBaseService;
import com.cool.store.service.login.LoginStrategy;
import com.cool.store.utils.SpringContextUtil;
import com.cool.store.vo.login.UserLoginVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
/**
* <p>
* 登录 前端控制器
* </p>
*
* @author wangff
* @since 2025/9/4
*/
@Api(tags = "登录")
@RestController
@RequestMapping("/pc/v3/login")
@RequiredArgsConstructor
public class LoginController {
private final LoginBaseService loginBaseService;
@ApiOperation("账号密码登录")
@PostMapping("/accountLogin")
public ResponseResult<UserLoginVO> accountLogin(@RequestBody UserLoginDTO param) {
return SpringContextUtil.getBean(param.getLoginType().getClazzName(), LoginStrategy.class).login(param);
}
@ApiOperation("refresh登录")
@PostMapping("/refreshLogin")
public ResponseResult<UserLoginVO> refreshLogin(@RequestBody UserRefreshLoginDTO param) {
return loginBaseService.refreshLogin(param);
}
@ApiOperation("登出")
@PostMapping("/logout")
public ResponseResult logout() {
return loginBaseService.logout();
}
}

View File

@@ -0,0 +1,34 @@
package com.cool.store.controller.webb;
import com.cool.store.common.PageBasicInfo;
import com.cool.store.context.CurrentUserHolder;
import com.cool.store.response.MiniShopsResponse;
import com.cool.store.response.ResponseResult;
import com.cool.store.service.StoreService;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
/**
* <p>
* PC门店 前端控制器
* </p>
*
* @author wangff
* @since 2025/9/9
*/
@Api(tags = "PC门店")
@RestController
@RequestMapping("/pc/stores")
@RequiredArgsConstructor
public class PCStoreController {
private final StoreService storeService;
@ApiOperation("当前用户门店列表")
@PostMapping("/userStoreList")
public ResponseResult<PageInfo<MiniShopsResponse>> getCurrentUserStoreList(@RequestBody PageBasicInfo request) {
return ResponseResult.success(storeService.getStoreListByMobile(CurrentUserHolder.getUser().getMobile(), request.getPageNum(), request.getPageSize(), null, null));
}
}

View File

@@ -8,7 +8,6 @@ import com.cool.store.dto.ShopAccount.ShopAccountDTO;
import com.cool.store.request.GetPasswordDTO;
import com.cool.store.response.ResponseResult;
import com.cool.store.service.*;
import com.cool.store.vo.PartnerUserInfoVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
@@ -95,7 +94,7 @@ public class MiniShopAccountController {
@ApiOperation("获取标品登录token")
@GetMapping("/getAccessToken")
public ResponseResult<String> getAccessToken() {
return ResponseResult.success(enterpriseService.getAccessToken(PartnerUserHolder.getUser().getMobile()));
return ResponseResult.success(enterpriseService.getLoginInfo(PartnerUserHolder.getUser().getMobile()).getAccessToken());
}
}

View File

@@ -4,6 +4,10 @@ default.datasource.url=jdbc:mysql://dingpushcoolcollege.mysql.rds.aliyuncs.com:3
default.datasource.username=coolstore
default.datasource.password=CSCErYcXniNYm7bT
platform.datasource.url=jdbc:mysql://dingpushcoolcollege.mysql.rds.aliyuncs.com:3306/coolcollege_intelligent_config?useSSL=false&useUnicode=true&characterEncoding=utf8&allowMultiQueries=true&autoReconnect=true
platform.datasource.username=coolstore
platform.datasource.password=CSCErYcXniNYm7bT
#redis
redis.host.uri=http://userInfo:Cx111111@tstore-coolcollege.redis.rds.aliyuncs.com:6379/0

View File

@@ -1,9 +1,13 @@
#mysql config
default.datasource.url=jdbc:mysql://store10-coolcollege.mysql.rds.aliyuncs.com:3306/coolcollege_intelligent_10027?useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true&failOverReadOnly=false&serverTimezone=Asia/Shanghai&allowMultiQueries=true
default.datasource.url=jdbc:mysql://zx-coolstore.mysql.rds.aliyuncs.com:3306/coolcollege_intelligent_10027?useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true&failOverReadOnly=false&serverTimezone=Asia/Shanghai&allowMultiQueries=true
default.datasource.username=coolstore
default.datasource.password=CSCErYcXniNYm7bT
platform.datasource.url=jdbc:mysql://zx-coolstore.mysql.rds.aliyuncs.com:3306/coolcollege_intelligent_config?useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true&failOverReadOnly=false&serverTimezone=Asia/Shanghai&allowMultiQueries=true
platform.datasource.username=coolstore
platform.datasource.password=CSCErYcXniNYm7bT
#redis
redis.host.uri=http://userInfo:Cx111111@store-coolcollege.redis.rds.aliyuncs.com:6379/0

View File

@@ -4,6 +4,10 @@ default.datasource.url=jdbc:mysql://dingpushcoolcollege.mysql.rds.aliyuncs.com:3
default.datasource.username=coolstore
default.datasource.password=CSCErYcXniNYm7bT
platform.datasource.url=jdbc:mysql://dingpushcoolcollege.mysql.rds.aliyuncs.com:3306/coolcollege_intelligent_config?useSSL=false&useUnicode=true&characterEncoding=utf8&allowMultiQueries=true&autoReconnect=true
platform.datasource.username=coolstore
platform.datasource.password=CSCErYcXniNYm7bT
#redis
redis.host.uri=http://userInfo:Cx111111@tstore-coolcollege-open.redis.rds.aliyuncs.com:6379/0
@@ -133,3 +137,8 @@ special.user.id=wpayJeDAAAhGIFgUJpJN-zg39JuNbYhg_woayJeDAAA0TC8mkCJeXouw94hYA-D3
ask.bot.url=https://test.auth.wx.askbot.cn
hqt.token.url=https://tc.cloud.hecom.cn
hqt.token.username=18161486722
hqt.token.grant_type=client_credentials
hqt.token.client.id=WrPffdGpcWkcPsbN
hqt.token.client.secret=rYe9Cwug5LwQNIBJAiW0a7weF9CAhYCD

View File

@@ -3,6 +3,10 @@ default.datasource.url=jdbc:mysql://zx-coolstore.mysql.rds.aliyuncs.com:3306/coo
default.datasource.username=coolstore
default.datasource.password=CSCErYcXniNYm7bT
platform.datasource.url=jdbc:mysql://zx-coolstore.mysql.rds.aliyuncs.com:3306/coolcollege_intelligent_config?useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true&failOverReadOnly=false&serverTimezone=Asia/Shanghai&allowMultiQueries=true
platform.datasource.username=coolstore
platform.datasource.password=CSCErYcXniNYm7bT
#redis
redis.host.uri=http://userInfo:Cx111111@store-coolcollege.redis.rds.aliyuncs.com:6379/0

View File

@@ -4,6 +4,10 @@ default.datasource.url=jdbc:mysql://dingpushcoolcollege.mysql.rds.aliyuncs.com:3
default.datasource.username=coolstore
default.datasource.password=CSCErYcXniNYm7bT
platform.datasource.url=jdbc:mysql://dingpushcoolcollege.mysql.rds.aliyuncs.com:3306/coolcollege_intelligent_config?useSSL=false&useUnicode=true&characterEncoding=utf8&allowMultiQueries=true&autoReconnect=true
platform.datasource.username=coolstore
platform.datasource.password=CSCErYcXniNYm7bT
#redis
redis.host.uri=http://userInfo:Cx111111@tstore-coolcollege-open.redis.rds.aliyuncs.com:6379/0