Merge branch 'dev' into prod

This commit is contained in:
2025-11-07 14:58:38 +08:00
30 changed files with 65 additions and 231 deletions

View File

@@ -48,14 +48,3 @@ seata:
server-addr: 121.40.109.122:8848 server-addr: 121.40.109.122:8848
namespace: namespace:
group: group_seata group: group_seata
# TraceID
management:
tracing:
enabled: true
sampling:
probability: 1.0 # 100% 采样,生产可降低
zipkin:
tracing:
endpoint: http://192.168.1.42:9411/api/v2/spans

View File

@@ -52,13 +52,3 @@ seata:
group: group_seata group: group_seata
# TraceID
management:
tracing:
enabled: true
sampling:
probability: 1.0 # 100% 采样,生产可降低
zipkin:
tracing:
endpoint: http://121.40.109.122:9411/api/v2/spans

View File

@@ -52,13 +52,3 @@ seata:
group: group_seata group: group_seata
# TraceID
management:
tracing:
enabled: true
sampling:
probability: 1.0 # 100% 采样,生产可降低
zipkin:
tracing:
endpoint: http://192.168.1.42:9411/api/v2/spans

View File

@@ -3,7 +3,7 @@ server:
spring: spring:
application: application:
name: account-server name: account
profiles: profiles:
active: dev active: dev
include: tools include: tools

View File

@@ -72,5 +72,14 @@ public class ADiscountActivityController {
return CzgResult.success(); return CzgResult.success();
} }
/**
* 分页
*/
@GetMapping
public CzgResult<MkDiscountActivityDTO> getActivity(@RequestParam Long shopId) {
MkDiscountActivityDTO data = discountActivityService.getActivityByShopId(shopId);
return CzgResult.success(data);
}
} }

View File

@@ -3,6 +3,7 @@ package com.czg.controller.admin;
import com.czg.TimeQueryParam; import com.czg.TimeQueryParam;
import com.czg.log.annotation.OperationLog; import com.czg.log.annotation.OperationLog;
import com.czg.market.dto.MkLimitTimeDiscountDTO; import com.czg.market.dto.MkLimitTimeDiscountDTO;
import com.czg.market.entity.MkLimitTimeDiscount;
import com.czg.market.service.MkLimitTimeDiscountService; import com.czg.market.service.MkLimitTimeDiscountService;
import com.czg.resp.CzgResult; import com.czg.resp.CzgResult;
import com.czg.sa.StpKit; import com.czg.sa.StpKit;
@@ -71,5 +72,13 @@ public class ALimitTimeDiscountController {
return CzgResult.success(); return CzgResult.success();
} }
/**
* 获取限时折扣
*/
@GetMapping
public CzgResult<MkLimitTimeDiscount> getActivity(@RequestParam Long shopId) {
MkLimitTimeDiscount data = limitTimeDiscountService.getLimitTimeDiscountByShopId(shopId);
return CzgResult.success(data);
}
} }

View File

@@ -1,7 +1,6 @@
package com.czg.controller.admin; package com.czg.controller.admin;
import com.czg.BaseQueryParam; import com.czg.BaseQueryParam;
import com.czg.TimeQueryParam;
import com.czg.log.annotation.OperationLog; import com.czg.log.annotation.OperationLog;
import com.czg.market.dto.MkProductSmartSuggestDTO; import com.czg.market.dto.MkProductSmartSuggestDTO;
import com.czg.market.service.MkProductSmartSuggestService; import com.czg.market.service.MkProductSmartSuggestService;
@@ -16,6 +15,8 @@ import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.Map;
/** /**
* 点单智能推荐 * 点单智能推荐
* *
@@ -73,4 +74,13 @@ public class AProductSmartSuggestController {
} }
/**
* 获取点单智能推荐
*/
@GetMapping
public CzgResult<Map<String, Object>> getActivity(@RequestParam Long shopId) {
Map<String, Object> map = suggestService.getProductSmartSuggestByShopId(shopId);
return CzgResult.success(map);
}
} }

View File

@@ -55,13 +55,3 @@ seata:
namespace: namespace:
group: group_seata group: group_seata
# TraceID
management:
tracing:
enabled: true
sampling:
probability: 1.0 # 100% 采样,生产可降低
zipkin:
tracing:
endpoint: http://192.168.1.42:9411/api/v2/spans

View File

@@ -48,14 +48,3 @@ seata:
server-addr: 121.40.109.122:8848 server-addr: 121.40.109.122:8848
namespace: namespace:
group: group_seata group: group_seata
# TraceID
management:
tracing:
enabled: true
sampling:
probability: 1.0 # 100% 采样,生产可降低
zipkin:
tracing:
endpoint: http://121.40.109.122:9411/api/v2/spans

View File

@@ -47,15 +47,4 @@ seata:
nacos: nacos:
server-addr: 121.40.109.122:8848 server-addr: 121.40.109.122:8848
namespace: namespace:
group: group_seata group: group_seata
# TraceID
management:
tracing:
enabled: true
sampling:
probability: 1.0 # 100% 采样,生产可降低
zipkin:
tracing:
endpoint: http://192.168.1.42:9411/api/v2/spans

View File

@@ -3,7 +3,7 @@ server:
spring: spring:
application: application:
name: market-server name: market
profiles: profiles:
active: dev active: dev
include: tools include: tools

View File

@@ -49,14 +49,3 @@ seata:
server-addr: 121.40.109.122:8848 server-addr: 121.40.109.122:8848
namespace: namespace:
group: group_seata group: group_seata
# TraceID
management:
tracing:
enabled: true
sampling:
probability: 1.0 # 100% 采样,生产可降低
zipkin:
tracing:
endpoint: http://192.168.1.42:9411/api/v2/spans

View File

@@ -53,15 +53,3 @@ seata:
server-addr: 121.40.109.122:8848 server-addr: 121.40.109.122:8848
namespace: namespace:
group: group_seata group: group_seata
# TraceID
management:
tracing:
enabled: true
sampling:
probability: 1.0 # 100% 采样,生产可降低
zipkin:
tracing:
endpoint: http://121.40.109.122:9411/api/v2/spans

View File

@@ -53,15 +53,3 @@ seata:
server-addr: 121.40.109.122:8848 server-addr: 121.40.109.122:8848
namespace: namespace:
group: group_seata group: group_seata
# TraceID
management:
tracing:
enabled: true
sampling:
probability: 1.0 # 100% 采样,生产可降低
zipkin:
tracing:
endpoint: http://192.168.1.42:9411/api/v2/spans

View File

@@ -3,7 +3,7 @@ server:
spring: spring:
application: application:
name: order-server name: order
profiles: profiles:
active: dev active: dev
include: tools include: tools

View File

@@ -53,15 +53,4 @@ seata:
nacos: nacos:
server-addr: 121.40.109.122:8848 server-addr: 121.40.109.122:8848
namespace: namespace:
group: group_seata group: group_seata
# TraceID
management:
tracing:
enabled: true
sampling:
probability: 1.0 # 100% 采样,生产可降低
zipkin:
tracing:
endpoint: http://192.168.1.42:9411/api/v2/spans

View File

@@ -48,14 +48,3 @@ seata:
server-addr: 121.40.109.122:8848 server-addr: 121.40.109.122:8848
namespace: namespace:
group: group_seata group: group_seata
# TraceID
management:
tracing:
enabled: true
sampling:
probability: 1.0 # 100% 采样,生产可降低
zipkin:
tracing:
endpoint: http://121.40.109.122:9411/api/v2/spans

View File

@@ -48,14 +48,3 @@ seata:
server-addr: 121.40.109.122:8848 server-addr: 121.40.109.122:8848
namespace: namespace:
group: group_seata group: group_seata
# TraceID
management:
tracing:
enabled: true
sampling:
probability: 1.0 # 100% 采样,生产可降低
zipkin:
tracing:
endpoint: http://192.168.1.42:9411/api/v2/spans

View File

@@ -3,7 +3,7 @@ server:
spring: spring:
application: application:
name: product-server name: product
profiles: profiles:
active: dev active: dev
include: tools include: tools

View File

@@ -50,14 +50,3 @@ seata:
namespace: namespace:
group: group_seata group: group_seata
# TraceID
management:
tracing:
enabled: true
sampling:
probability: 1.0 # 100% 采样,生产可降低
zipkin:
tracing:
endpoint: http://192.168.1.42:9411/api/v2/spans

View File

@@ -51,14 +51,3 @@ seata:
namespace: namespace:
group: group_seata group: group_seata
# TraceID
management:
tracing:
enabled: true
sampling:
probability: 1.0 # 100% 采样,生产可降低
zipkin:
tracing:
endpoint: http://121.40.109.122:9411/api/v2/spans

View File

@@ -51,14 +51,3 @@ seata:
namespace: namespace:
group: group_seata group: group_seata
# TraceID
management:
tracing:
enabled: true
sampling:
probability: 1.0 # 100% 采样,生产可降低
zipkin:
tracing:
endpoint: http://192.168.1.42:9411/api/v2/spans

View File

@@ -3,7 +3,7 @@ server:
spring: spring:
application: application:
name: system-server name: system
profiles: profiles:
active: dev active: dev

View File

@@ -54,6 +54,7 @@ public class ControllerAspect {
if(params.contains("jndi:rmi:")){ if(params.contains("jndi:rmi:")){
throw new RuntimeException("gun"); throw new RuntimeException("gun");
} }
Map<String, String> contextMap = MDC.getCopyOfContextMap();
// 执行被拦截的方法 // 执行被拦截的方法
Object result = pjp.proceed(); Object result = pjp.proceed();
long end = System.currentTimeMillis(); long end = System.currentTimeMillis();
@@ -63,7 +64,6 @@ public class ControllerAspect {
String requestIp = ServletUtil.getClientIP(request); String requestIp = ServletUtil.getClientIP(request);
long useTime = end - start; long useTime = end - start;
Map<String, String> contextMap = MDC.getCopyOfContextMap();
ThreadUtil.execAsync(() -> { ThreadUtil.execAsync(() -> {
if (contextMap != null) { if (contextMap != null) {
MDC.setContextMap(contextMap); MDC.setContextMap(contextMap);

View File

@@ -1,20 +1,35 @@
package com.czg.config; package com.czg.config;
import cn.hutool.core.util.IdUtil;
import jakarta.servlet.*; import jakarta.servlet.*;
import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse; import jakarta.servlet.http.HttpServletResponse;
import org.slf4j.MDC;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import java.io.IOException; import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
/** /**
* @author GYJoker * @author GYJoker
*/ */
@Configuration @Configuration
public class CorsFilter implements Filter { public class CorsFilter implements Filter {
@Value("${spring.application.name:unknown-service}")
private String applicationName;
@Override @Override
public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain) public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain)
throws IOException, ServletException { throws IOException, ServletException {
// traceId
Map<String, String> copyOfContextMap = MDC.getCopyOfContextMap();
if(copyOfContextMap == null){
copyOfContextMap = new HashMap<>();
}
copyOfContextMap.put("traceId",applicationName + IdUtil.fastSimpleUUID());
MDC.setContextMap(copyOfContextMap);
HttpServletResponse response = (HttpServletResponse) resp; HttpServletResponse response = (HttpServletResponse) resp;
HttpServletRequest reqs = (HttpServletRequest) req; HttpServletRequest reqs = (HttpServletRequest) req;
String curOrigin = reqs.getHeader("Origin"); String curOrigin = reqs.getHeader("Origin");
@@ -23,6 +38,12 @@ public class CorsFilter implements Filter {
response.setHeader("Access-Control-Max-Age", "3600"); response.setHeader("Access-Control-Max-Age", "3600");
response.setHeader("Access-Control-Allow-Headers", "token,Origin, X-Requested-With, Content-Type, Accept,shopId"); response.setHeader("Access-Control-Allow-Headers", "token,Origin, X-Requested-With, Content-Type, Accept,shopId");
response.setHeader("Access-Control-Allow-Credentials", "true"); response.setHeader("Access-Control-Allow-Credentials", "true");
chain.doFilter(req, resp); try {
// 原有 MDC 设置逻辑...
chain.doFilter(req, resp);
} finally {
// 清理当前线程的 traceId
MDC.remove("traceId");
}
} }
} }

View File

@@ -2,8 +2,8 @@ package com.czg.config;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import org.apache.dubbo.common.constants.CommonConstants; import org.apache.dubbo.common.constants.CommonConstants;
import org.apache.dubbo.rpc.*;
import org.apache.dubbo.common.extension.Activate; import org.apache.dubbo.common.extension.Activate;
import org.apache.dubbo.rpc.*;
import org.slf4j.MDC; import org.slf4j.MDC;
/** /**
@@ -22,11 +22,6 @@ public class TraceProviderFilter implements Filter {
// 设置到 MDC // 设置到 MDC
MDC.put("traceId", traceId); MDC.put("traceId", traceId);
return invoker.invoke(invocation);
try {
return invoker.invoke(invocation);
} finally {
MDC.clear();
}
} }
} }

View File

@@ -41,9 +41,6 @@
<weixin.java.miniapp.version>3.8.0</weixin.java.miniapp.version> <weixin.java.miniapp.version>3.8.0</weixin.java.miniapp.version>
<pinyin.version>2.5.1</pinyin.version> <pinyin.version>2.5.1</pinyin.version>
<IJPay.version>2.9.10</IJPay.version> <IJPay.version>2.9.10</IJPay.version>
<micrometer.version>1.6.0-M3</micrometer.version>
<zipkin-reporter.version>3.5.1</zipkin-reporter.version>
<actuator.version>4.0.0-M3</actuator.version>
</properties> </properties>
<dependencyManagement> <dependencyManagement>
@@ -245,28 +242,6 @@
<artifactId>excel-spring-boot-starter</artifactId> <artifactId>excel-spring-boot-starter</artifactId>
<version>3.4.0</version> <version>3.4.0</version>
</dependency> </dependency>
<!-- Micrometer Tracing 核心(必需) -->
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-tracing-bridge-brave</artifactId>
<version>${micrometer.version}</version>
</dependency>
<!-- Zipkin Reporter用于将数据发送到 Zipkin -->
<dependency>
<groupId>io.zipkin.reporter2</groupId>
<artifactId>zipkin-reporter-brave</artifactId>
<version>${zipkin-reporter.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
<version>${actuator.version}</version>
</dependency>
</dependencies> </dependencies>
</dependencyManagement> </dependencyManagement>

View File

@@ -119,6 +119,9 @@ public class ShopInfoServiceImpl extends ServiceImpl<ShopInfoMapper, ShopInfo> i
if (isHeadShop != null) { if (isHeadShop != null) {
queryWrapper.eq(ShopInfo::getIsHeadShop, isHeadShop); queryWrapper.eq(ShopInfo::getIsHeadShop, isHeadShop);
} }
CzgResult<SysParamsDTO> shopOrderPayBaseUrl = sysParamsService.getParamsByCode("shop_order_pay_base_url");
CzgResult<SysParamsDTO> shopOrderPayBaseUrl2 = sysParamsService.getParamsByCode("ali_account_app_id");
List<ShopInfo> shopAllList = getMapper().selectListByQuery(query().select(ShopInfo::getId, ShopInfo::getShopName)); List<ShopInfo> shopAllList = getMapper().selectListByQuery(query().select(ShopInfo::getId, ShopInfo::getShopName));
Map<Long, String> shopKv = shopAllList.stream().collect(Collectors.toMap(ShopInfo::getId, ShopInfo::getShopName)); Map<Long, String> shopKv = shopAllList.stream().collect(Collectors.toMap(ShopInfo::getId, ShopInfo::getShopName));
queryWrapper.orderBy(ShopInfo::getCreateTime, false); queryWrapper.orderBy(ShopInfo::getCreateTime, false);

View File

@@ -93,7 +93,7 @@ public class MkLimitTimeDiscountServiceImpl extends ServiceImpl<MkLimitTimeDisco
public MkLimitTimeDiscount getLimitTimeDiscountByShopId(Long shopId) { public MkLimitTimeDiscount getLimitTimeDiscountByShopId(Long shopId) {
Long mainShopId = shopInfoService.getMainIdByShopId(shopId); Long mainShopId = shopInfoService.getMainIdByShopId(shopId);
MkLimitTimeDiscount limitTimeDiscount = mapper.selectOneByShopId(mainShopId, shopId, CzgStrUtils.getStrWeek()); MkLimitTimeDiscount limitTimeDiscount = mapper.selectOneByShopId(mainShopId, shopId, CzgStrUtils.getStrWeek());
if (limitTimeDiscount != null && limitTimeDiscount.getFoodType() == 2 && StrUtil.isNotBlank(limitTimeDiscount.getFoods())) { if (limitTimeDiscount != null && limitTimeDiscount.getFoodType() == 2 && StrUtil.isNotBlank(limitTimeDiscount.getFoods()) && !shopId.equals(mainShopId)) {
List<String> foodIds = Arrays.stream(limitTimeDiscount.getFoods().split(",")) List<String> foodIds = Arrays.stream(limitTimeDiscount.getFoods().split(","))
.map(String::trim) .map(String::trim)
.filter(StrUtil::isNotBlank) .filter(StrUtil::isNotBlank)

View File

@@ -98,29 +98,5 @@
<artifactId>hibernate-validator</artifactId> <artifactId>hibernate-validator</artifactId>
<version>8.0.2.Final</version> <version>8.0.2.Final</version>
</dependency> </dependency>
<!-- Micrometer Tracing 核心(必需) -->
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-tracing-bridge-brave</artifactId>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-observation</artifactId>
</dependency>
<!-- Zipkin Reporter用于将数据发送到 Zipkin -->
<dependency>
<groupId>io.zipkin.reporter2</groupId>
<artifactId>zipkin-reporter-brave</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
</dependencies> </dependencies>
</project> </project>