浏览代码

client增加com.fjhx路径扫描

home 2 年之前
父节点
当前提交
c42806279c

+ 42 - 42
bladex-tool/blade-core-cloud/src/main/java/org/springblade/core/cloud/feign/EnableBladeFeign.java

@@ -31,51 +31,51 @@ import java.lang.annotation.*;
 @Documented
 @Target(ElementType.TYPE)
 @Retention(RetentionPolicy.RUNTIME)
-@EnableFeignClients(AppConstant.BASE_PACKAGES)
+@EnableFeignClients({AppConstant.BASE_PACKAGES, AppConstant.HX_BASE_PACKAGES})
 public @interface EnableBladeFeign {
-	/**
-	 * Alias for the {@link #basePackages()} attribute. Allows for more concise annotation
-	 * declarations e.g.: {@code @ComponentScan("org.my.pkg")} instead of
-	 * {@code @ComponentScan(basePackages="org.my.pkg")}.
-	 *
-	 * @return the array of 'basePackages'.
-	 */
-	String[] value() default {};
+    /**
+     * Alias for the {@link #basePackages()} attribute. Allows for more concise annotation
+     * declarations e.g.: {@code @ComponentScan("org.my.pkg")} instead of
+     * {@code @ComponentScan(basePackages="org.my.pkg")}.
+     *
+     * @return the array of 'basePackages'.
+     */
+    String[] value() default {};
 
-	/**
-	 * Base packages to scan for annotated components.
-	 * <p>
-	 * {@link #value()} is an alias for (and mutually exclusive with) this attribute.
-	 * <p>
-	 * Use {@link #basePackageClasses()} for a type-safe alternative to String-based
-	 * package names.
-	 *
-	 * @return the array of 'basePackages'.
-	 */
-	String[] basePackages() default {};
+    /**
+     * Base packages to scan for annotated components.
+     * <p>
+     * {@link #value()} is an alias for (and mutually exclusive with) this attribute.
+     * <p>
+     * Use {@link #basePackageClasses()} for a type-safe alternative to String-based
+     * package names.
+     *
+     * @return the array of 'basePackages'.
+     */
+    String[] basePackages() default {};
 
-	/**
-	 * Type-safe alternative to {@link #basePackages()} for specifying the packages to
-	 * scan for annotated components. The package of each class specified will be scanned.
-	 * <p>
-	 * Consider creating a special no-op marker class or interface in each package that
-	 * serves no purpose other than being referenced by this attribute.
-	 *
-	 * @return the array of 'basePackageClasses'.
-	 */
-	Class<?>[] basePackageClasses() default {};
+    /**
+     * Type-safe alternative to {@link #basePackages()} for specifying the packages to
+     * scan for annotated components. The package of each class specified will be scanned.
+     * <p>
+     * Consider creating a special no-op marker class or interface in each package that
+     * serves no purpose other than being referenced by this attribute.
+     *
+     * @return the array of 'basePackageClasses'.
+     */
+    Class<?>[] basePackageClasses() default {};
 
-	/**
-	 * A custom <code>@Configuration</code> for all feign clients. Can contain override
-	 * <code>@Bean</code> definition for the pieces that make up the client, for instance
-	 * {@link feign.codec.Decoder}, {@link feign.codec.Encoder}, {@link feign.Contract}.
-	 */
-	Class<?>[] defaultConfiguration() default {};
+    /**
+     * A custom <code>@Configuration</code> for all feign clients. Can contain override
+     * <code>@Bean</code> definition for the pieces that make up the client, for instance
+     * {@link feign.codec.Decoder}, {@link feign.codec.Encoder}, {@link feign.Contract}.
+     */
+    Class<?>[] defaultConfiguration() default {};
 
-	/**
-	 * List of classes annotated with @FeignClient. If not empty, disables classpath scanning.
-	 *
-	 * @return
-	 */
-	Class<?>[] clients() default {};
+    /**
+     * List of classes annotated with @FeignClient. If not empty, disables classpath scanning.
+     *
+     * @return
+     */
+    Class<?>[] clients() default {};
 }

+ 5 - 0
bladex-tool/blade-core-launch/src/main/java/org/springblade/core/launch/constant/AppConstant.java

@@ -34,6 +34,11 @@ public interface AppConstant {
 	String BASE_PACKAGES = "org.springblade";
 
 	/**
+	 * 基础包
+	 */
+	String HX_BASE_PACKAGES = "com.fjhx";
+
+	/**
 	 * 应用名前缀
 	 */
 	String APPLICATION_NAME_PREFIX = "blade-";

+ 2 - 2
hx-common/client-util/src/main/java/com/fjhx/utils/FileClientUtil.java

@@ -37,7 +37,7 @@ public class FileClientUtil {
      */
     public static void bindingFile(Long businessId, Integer businessType, List<FileInfoParam> paramList) {
         if (ObjectUtil.isEmpty(paramList)) return;
-        R result = fileClient.bindingFile(APPLICATION_NAME, businessId, businessType, paramList);
+        R result = fileClient.bindingFileList(APPLICATION_NAME, businessId, businessType, paramList);
         Assert.eqTrue(result.isSuccess(), "保存文件信息失败");
     }
 
@@ -63,7 +63,7 @@ public class FileClientUtil {
      */
     public static void againBindingFile(Long businessId, Integer businessType, List<FileInfoParam> paramList) {
         if (ObjectUtil.isEmpty(paramList)) return;
-        R result = fileClient.againBindingFile(APPLICATION_NAME, businessId, businessType, paramList);
+        R result = fileClient.againBindingFileList(APPLICATION_NAME, businessId, businessType, paramList);
         Assert.eqTrue(result.isSuccess(), "保存文件信息失败");
     }
 

+ 23 - 7
hx-service-api/file-service-api/src/main/java/com/fjhx/feign/IFileClient.java

@@ -5,6 +5,8 @@ import com.fjhx.params.FileInfoParam;
 import org.springblade.core.tool.api.R;
 import org.springframework.cloud.openfeign.FeignClient;
 import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestParam;
 
 import java.util.List;
 
@@ -37,7 +39,10 @@ public interface IFileClient {
      * @param param        文件信息
      */
     @PostMapping(BINDING_FILE)
-    R bindingFile(String applicationName, Long businessId, Integer businessType, FileInfoParam param);
+    R bindingFile(@RequestParam("applicationName") String applicationName,
+                  @RequestParam("businessId") Long businessId,
+                  @RequestParam("businessType") Integer businessType,
+                  @RequestBody FileInfoParam param);
 
     /**
      * 文件绑定业务id
@@ -47,7 +52,10 @@ public interface IFileClient {
      * @param paramList    文件信息
      */
     @PostMapping(BINDING_FILE_LIST)
-    R bindingFile(String applicationName, Long businessId, Integer businessType, List<FileInfoParam> paramList);
+    R bindingFileList(@RequestParam("applicationName") String applicationName,
+                      @RequestParam("businessId") Long businessId,
+                      @RequestParam("businessType") Integer businessType,
+                      @RequestBody List<FileInfoParam> paramList);
 
     /**
      * 修改文件绑定信息
@@ -57,7 +65,10 @@ public interface IFileClient {
      * @param param        文件信息
      */
     @PostMapping(AGAIN_BINDING_FILE)
-    R againBindingFile(String applicationName, Long businessId, Integer businessType, FileInfoParam param);
+    R againBindingFile(@RequestParam("applicationName") String applicationName,
+                       @RequestParam("businessId") Long businessId,
+                       @RequestParam("businessType") Integer businessType,
+                       @RequestBody FileInfoParam param);
 
     /**
      * 修改文件绑定信息
@@ -67,7 +78,10 @@ public interface IFileClient {
      * @param paramList    文件信息
      */
     @PostMapping(AGAIN_BINDING_FILE_List)
-    R againBindingFile(String applicationName, Long businessId, Integer businessType, List<FileInfoParam> paramList);
+    R againBindingFileList(@RequestParam("applicationName") String applicationName,
+                           @RequestParam("businessId") Long businessId,
+                           @RequestParam("businessType") Integer businessType,
+                           @RequestBody List<FileInfoParam> paramList);
 
     /**
      * 删除文件绑定信息
@@ -75,7 +89,7 @@ public interface IFileClient {
      * @param businessId 业务id
      */
     @PostMapping(RELIEVE_BINDING_FILE)
-    R relieveBindingFile(Long businessId);
+    R relieveBindingFile(@RequestParam("businessId") Long businessId);
 
     /**
      * 获取文件信息
@@ -83,7 +97,8 @@ public interface IFileClient {
      * @param businessId 业务id
      */
     @PostMapping(GET_FILE_INFO)
-    R<FileInfoParam> getFileInfo(Long businessId, Integer businessType);
+    R<FileInfoParam> getFileInfo(@RequestParam("businessId") Long businessId,
+                                 @RequestParam("businessType") Integer businessType);
 
     /**
      * 获取文件信息
@@ -91,6 +106,7 @@ public interface IFileClient {
      * @param businessId 业务id
      */
     @PostMapping(GET_FILE_INFO_LIST)
-    R<List<FileInfoParam>> getFileInfoList(Long businessId, Integer businessType);
+    R<List<FileInfoParam>> getFileInfoList(@RequestParam("businessId") Long businessId,
+                                           @RequestParam("businessType") Integer businessType);
 
 }

+ 33 - 0
hx-service-api/iot-management-api/src/main/java/com/fjhx/params/bom/BomEx.java

@@ -0,0 +1,33 @@
+package com.fjhx.params.bom;
+
+import com.fjhx.entity.bom.Bom;
+import com.fjhx.params.FileInfoParam;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * bom
+ *
+ * @author ${author}
+ * @since 2022-07-01
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class BomEx extends Bom {
+
+    /**
+     * 更新人名称
+     */
+    private String updateUserName;
+
+    /**
+     * 分类名称
+     */
+    private String classifName;
+
+    /**
+     * 文件信息
+     */
+    private FileInfoParam fileInfoParam;
+
+}

+ 0 - 10
hx-service-api/iot-management-api/src/main/java/com/fjhx/params/bom/BomVo.java

@@ -16,16 +16,6 @@ import lombok.EqualsAndHashCode;
 public class BomVo extends Bom {
 
     /**
-     * 更新人名称
-     */
-    private String updateUserName;
-
-    /**
-     * 分类名称
-     */
-    private String classifName;
-
-    /**
      * 文件信息
      */
     private FileInfoParam fileInfoParam;

+ 1 - 1
hx-service/file-service/src/main/java/com/fjhx/FileServeApplication.java

@@ -4,7 +4,7 @@ import org.springblade.core.launch.BladeApplication;
 import org.springframework.cloud.client.SpringCloudApplication;
 
 /**
- * 杰生模块启动器
+ * 文件模块启动器
  */
 @SpringCloudApplication
 public class FileServeApplication {

+ 2 - 2
hx-service/file-service/src/main/java/com/fjhx/feign/FileClient.java

@@ -24,7 +24,7 @@ public class FileClient implements IFileClient {
 
     @PostMapping(BINDING_FILE_LIST)
     @Override
-    public R bindingFile(String applicationName, Long businessId, Integer businessType, List<FileInfoParam> paramList) {
+    public R bindingFileList(String applicationName, Long businessId, Integer businessType, List<FileInfoParam> paramList) {
         fileInfoService.bindingFile(applicationName, businessId, businessType, paramList);
         return R.success();
     }
@@ -38,7 +38,7 @@ public class FileClient implements IFileClient {
 
     @PostMapping(AGAIN_BINDING_FILE_List)
     @Override
-    public R againBindingFile(String applicationName, Long businessId, Integer businessType, List<FileInfoParam> paramList) {
+    public R againBindingFileList(String applicationName, Long businessId, Integer businessType, List<FileInfoParam> paramList) {
         fileInfoService.againBindingFile(applicationName, businessId, businessType, paramList);
         return R.success();
     }

+ 2 - 1
hx-service/iot-management/src/main/java/com/fjhx/bom/controller/BomController.java

@@ -3,6 +3,7 @@ package com.fjhx.bom.controller;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.fjhx.entity.bom.Bom;
 import com.fjhx.bom.service.BomService;
+import com.fjhx.params.bom.BomEx;
 import com.fjhx.params.bom.BomVo;
 import org.springblade.core.tool.api.R;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -30,7 +31,7 @@ public class BomController {
 
     @PostMapping("/page")
     public R page(@RequestBody Map<String, String> condition) {
-        Page<BomVo> result = bomService.getPage(condition);
+        Page<BomEx> result = bomService.getPage(condition);
         return R.success(result);
     }
 

+ 2 - 1
hx-service/iot-management/src/main/java/com/fjhx/bom/mapper/BomMapper.java

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.fjhx.entity.bom.Bom;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.fjhx.params.bom.BomEx;
 import com.fjhx.params.bom.BomVo;
 import org.apache.ibatis.annotations.Param;
 
@@ -17,6 +18,6 @@ import org.apache.ibatis.annotations.Param;
  */
 public interface BomMapper extends BaseMapper<Bom> {
 
-    Page<BomVo> getPage(@Param("page") Page<Bom> page, @Param("ew") QueryWrapper<?> wrapper);
+    Page<BomEx> getPage(@Param("page") Page<Bom> page, @Param("ew") QueryWrapper<?> wrapper);
 
 }

+ 1 - 1
hx-service/iot-management/src/main/java/com/fjhx/bom/mapper/BomMapper.xml

@@ -2,7 +2,7 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.fjhx.bom.mapper.BomMapper">
 
-    <select id="getPage" resultType="com.fjhx.params.bom.BomVo">
+    <select id="getPage" resultType="com.fjhx.params.bom.BomEx">
         select b.id,
                b.edition,
                b.introduce,

+ 2 - 1
hx-service/iot-management/src/main/java/com/fjhx/bom/service/BomService.java

@@ -2,6 +2,7 @@ package com.fjhx.bom.service;
 
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.fjhx.entity.bom.Bom;
+import com.fjhx.params.bom.BomEx;
 import com.fjhx.params.bom.BomVo;
 import com.fjhx.base.BaseService;
 
@@ -17,7 +18,7 @@ import java.util.Map;
  */
 public interface BomService extends BaseService<Bom> {
 
-    Page<BomVo> getPage(Map<String, String> condition);
+    Page<BomEx> getPage(Map<String, String> condition);
 
     void add(BomVo bomVo);
 

+ 14 - 5
hx-service/iot-management/src/main/java/com/fjhx/bom/service/impl/BomServiceImpl.java

@@ -4,15 +4,18 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.fjhx.bom.mapper.BomMapper;
-import com.fjhx.utils.FileClientUtil;
-import com.fjhx.utils.UserClientUtil;
+import com.fjhx.bom.service.BomService;
 import com.fjhx.constants.StatusConstant;
 import com.fjhx.entity.bom.Bom;
 import com.fjhx.enums.bom.BomTypeEnum;
+import com.fjhx.feign.IFileClient;
 import com.fjhx.params.FileInfoParam;
+import com.fjhx.params.bom.BomEx;
 import com.fjhx.params.bom.BomVo;
-import com.fjhx.bom.service.BomService;
+import com.fjhx.utils.FileClientUtil;
+import com.fjhx.utils.UserClientUtil;
 import com.fjhx.utils.WrapperUtil;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
@@ -29,8 +32,11 @@ import java.util.Map;
 @Service
 public class BomServiceImpl extends ServiceImpl<BomMapper, Bom> implements BomService {
 
+    @Autowired
+    private IFileClient fileClient;
+
     @Override
-    public Page<BomVo> getPage(Map<String, String> condition) {
+    public Page<BomEx> getPage(Map<String, String> condition) {
 
         QueryWrapper<?> wrapper = WrapperUtil.init(condition)
                 .eq("p.classif_id", "classifId") // 分类查询
@@ -43,11 +49,13 @@ public class BomServiceImpl extends ServiceImpl<BomMapper, Bom> implements BomSe
         wrapper.eq("b.current_edition", StatusConstant.YES); // 当前版本
         wrapper.orderByAsc("p.code"); // 产品编码排序
 
-        Page<BomVo> result = baseMapper.getPage(createPage(condition), wrapper);
+        Page<BomEx> result = baseMapper.getPage(createPage(condition), wrapper);
 
         // 赋值最后修改人
         Map<Long, String> userNameMap = UserClientUtil.getUserNameMapFunctionLong(result.getRecords(), Bom::getUpdateUser);
         result.getRecords().forEach(item -> item.setUpdateUserName(userNameMap.get(item.getUpdateUser())));
+
+
         return result;
     }
 
@@ -57,6 +65,7 @@ public class BomServiceImpl extends ServiceImpl<BomMapper, Bom> implements BomSe
 
         save(bomVo);
 
+        // 绑定文件
         FileInfoParam fileInfoParam = bomVo.getFileInfoParam();
         FileClientUtil.bindingFile(bomVo.getId(), 1, fileInfoParam);