Bladeren bron

feign远程调用配置

tangyishan 4 weken geleden
bovenliggende
commit
b3ba848ec9

+ 1 - 1
sckw-common/sckw-common-remote/src/main/java/com/sckw/remote/annotation/SckwRemoteApplication.java

@@ -12,6 +12,6 @@ import java.lang.annotation.*;
 @Inherited
 @EnableDubbo
 @EnableFeignClients({"com.sckw.*.api.feign"})
-@ComponentScan(basePackages = {"com.sckw.message.consumer","com.sckw.file.config", "com.sckw.payment.config", "com.sckw.fleet.config", "com.sckw.remote.filter", "com.sckw.*.dao","com.sckw.*.controller", "com.sckw.*.service", "com.sckw.*.repository", "com.sckw.*.dubbo", "com.sckw.*.model", "com.sckw.transport.*", "com.sckw.*.serivce","com.sckw.transport.config"})
+@ComponentScan(basePackages = {"com.sckw.message.consumer","com.sckw.file.config", "com.sckw.payment.config", "com.sckw.fleet.config", "com.sckw.remote.filter", "com.sckw.*.dao","com.sckw.*.controller", "com.sckw.*.service", "com.sckw.*.repository", "com.sckw.*.dubbo", "com.sckw.*.model", "com.sckw.transport.*", "com.sckw.*.serivce","com.sckw.transport.config","com.sckw.contract.config"})
 public @interface SckwRemoteApplication {
 }

+ 1 - 1
sckw-modules-api/sckw-fleet-api/src/main/java/com/sckw/fleet/api/model/dto/UpdateDriverScoreDto.java

@@ -23,7 +23,7 @@ public class UpdateDriverScoreDto {
     private Long providerEntId;
 
     /** 物流企业id */
-    @NotNull()
+    @NotNull(message = "物流企业id不能为空")
     private Long logisticsEntId;
 
     /** 变动评分 */

+ 3 - 2
sckw-modules/sckw-contract/src/main/java/com/sckw/contract/config/FeignConfig.java

@@ -3,6 +3,7 @@ package com.sckw.contract.config;
 
 import com.sckw.core.model.constant.Global;
 import feign.RequestInterceptor;
+import jakarta.servlet.http.HttpServletRequest;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.web.context.request.RequestContextHolder;
@@ -17,11 +18,11 @@ import org.springframework.web.context.request.ServletRequestAttributes;
 @Configuration
 public class FeignConfig {
 
-    @Bean("requestInterceptor")
+    @Bean
     public RequestInterceptor requestInterceptor() {
         return requestTemplate -> {
             ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
-            jakarta.servlet.http.HttpServletRequest request = attributes.getRequest();
+            HttpServletRequest request = attributes.getRequest();
             String userInfoStrEncode = request.getHeader(Global.USER_INFO_STR_ENCODE);
             String entInfoStrEncode = request.getHeader(Global.ENT_INFO_STR_ENCODE);
             requestTemplate.header(Global.USER_INFO_STR_ENCODE, userInfoStrEncode);

+ 3 - 2
sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/config/FeignConfig.java

@@ -3,6 +3,7 @@ package com.sckw.fleet.config;
 
 import com.sckw.core.model.constant.Global;
 import feign.RequestInterceptor;
+import jakarta.servlet.http.HttpServletRequest;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.web.context.request.RequestContextHolder;
@@ -17,11 +18,11 @@ import org.springframework.web.context.request.ServletRequestAttributes;
 @Configuration
 public class FeignConfig {
 
-    @Bean("requestInterceptor")
+    @Bean
     public RequestInterceptor requestInterceptor() {
          return requestTemplate -> {
              ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
-             jakarta.servlet.http.HttpServletRequest request = attributes.getRequest();
+             HttpServletRequest request = attributes.getRequest();
              String userInfoStrEncode = request.getHeader(Global.USER_INFO_STR_ENCODE);
              String entInfoStrEncode = request.getHeader(Global.ENT_INFO_STR_ENCODE);
              requestTemplate.header(Global.USER_INFO_STR_ENCODE, userInfoStrEncode);

+ 1 - 1
sckw-modules/sckw-fleet/src/main/java/com/sckw/fleet/controller/KwfDriverScoreController.java

@@ -30,7 +30,7 @@ public class KwfDriverScoreController {
     private KwfDriverScoreService kwfDriverScoreService;
 
     /**
-     * 更新司机评分
+     * 修改企业评分更新司机评分接口
      */
     @PostMapping("/update")
     public HttpResult update(@Validated @RequestBody UpdateDriverScoreDto updateDriverScoreDto) {

+ 8 - 8
sql/2025/12/09/2025_12_09_tys_creat.sql

@@ -3,9 +3,9 @@ CREATE TABLE `kwc_contract_logistics_score` (
     `provider_ent_id` bigint NOT NULL COMMENT '供应商企业id',
     `logistics_ent_id` bigint NOT NULL COMMENT '物流企业id',
     `score` decimal(10,2) NOT NULL COMMENT '物流企业评分',
-    `create_by` bigint NOT NULL,
+    `create_by` bigint NOT NULL DEFAULT '-1',
     `create_time` datetime NOT NULL,
-    `update_by` bigint NOT NULL,
+    `update_by` bigint NOT NULL DEFAULT '-1',
     `update_time` datetime NOT NULL COMMENT '更新时间',
     `del_flag` int NOT NULL DEFAULT '0' COMMENT '是否删除(0未删除,1删除)',
     PRIMARY KEY (`id`) USING BTREE,
@@ -21,9 +21,9 @@ CREATE TABLE `kwc_contract_logistics_score_detail` (
    `score_change` decimal(10,2) DEFAULT NULL COMMENT '评分变动',
    `score` decimal(10,2) DEFAULT NULL COMMENT '变动后评分',
    `status` int NOT NULL DEFAULT '1' COMMENT '审核状态0-待审核,1-审核通过',
-   `create_by` bigint NOT NULL,
+   `create_by` bigint NOT NULL DEFAULT '-1',
    `create_time` datetime NOT NULL,
-   `update_by` bigint NOT NULL,
+   `update_by` bigint NOT NULL DEFAULT '-1',
    `update_time` datetime NOT NULL,
    `del_flag` int NOT NULL DEFAULT '0' COMMENT '是否删除(0未删除,1删除)',
    PRIMARY KEY (`id`) USING BTREE,
@@ -37,9 +37,9 @@ CREATE TABLE `kwf_driver_score` (
     `logistics_ent_id` bigint NOT NULL COMMENT '物流企业id',
     `driver_id` bigint NOT NULL COMMENT '司机id',
     `score` decimal(10,2) NOT NULL DEFAULT '60.00' COMMENT '司机评分',
-    `create_by` bigint NOT NULL,
+    `create_by` bigint NOT NULL DEFAULT '-1',
     `create_time` datetime NOT NULL,
-    `update_by` bigint NOT NULL,
+    `update_by` bigint NOT NULL DEFAULT '-1',
     `update_time` datetime NOT NULL COMMENT '更新时间',
     `del_flag` int NOT NULL DEFAULT '0' COMMENT '是否删除(0未删除,1删除)',
     PRIMARY KEY (`id`) USING BTREE,
@@ -54,9 +54,9 @@ CREATE TABLE `kwf_driver_score_detail` (
    `action` varchar(400) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '行为',
    `score_change` decimal(10,2) DEFAULT NULL COMMENT '评分变动',
    `score` decimal(10,2) DEFAULT NULL COMMENT '变动后评分',
-   `create_by` bigint NOT NULL,
+   `create_by` bigint NOT NULL DEFAULT '-1',
    `create_time` datetime NOT NULL,
-   `update_by` bigint NOT NULL,
+   `update_by` bigint NOT NULL DEFAULT '-1',
    `update_time` datetime NOT NULL,
    `del_flag` int NOT NULL DEFAULT '0' COMMENT '是否删除(0未删除,1删除)',
    PRIMARY KEY (`id`) USING BTREE,