Browse Source

增加elasticsearch依赖

ssk 1 month ago
parent
commit
603d40b24d

+ 0 - 3
alien-job/src/main/java/META-INF/MANIFEST.MF

@@ -1,3 +0,0 @@
-Manifest-Version: 1.0
-Main-Class: shop.alien.xxljob.XxlJobApplication
-

+ 22 - 20
alien-job/src/main/java/shop/alien/xxljob/jobhandler/SampleXxlJob.java

@@ -16,12 +16,12 @@ import java.util.concurrent.TimeUnit;
 
 /**
  * XxlJob开发示例(Bean模式)
- *
+ * <p>
  * 开发步骤:
- *      1、任务开发:在Spring Bean实例中,开发Job方法;
- *      2、注解配置:为Job方法添加注解 "@XxlJob(value="自定义jobhandler名称", init = "JobHandler初始化方法", destroy = "JobHandler销毁方法")",注解value值对应的是调度中心新建任务的JobHandler属性的值。
- *      3、执行日志:需要通过 "XxlJobHelper.log" 打印执行日志;
- *      4、任务结果:默认任务结果为 "成功" 状态,不需要主动设置;如有诉求,比如设置任务结果为失败,可以通过 "XxlJobHelper.handleFail/handleSuccess" 自主设置任务结果;
+ * 1、任务开发:在Spring Bean实例中,开发Job方法;
+ * 2、注解配置:为Job方法添加注解 "@XxlJob(value="自定义jobhandler名称", init = "JobHandler初始化方法", destroy = "JobHandler销毁方法")",注解value值对应的是调度中心新建任务的JobHandler属性的值。
+ * 3、执行日志:需要通过 "XxlJobHelper.log" 打印执行日志;
+ * 4、任务结果:默认任务结果为 "成功" 状态,不需要主动设置;如有诉求,比如设置任务结果为失败,可以通过 "XxlJobHelper.handleFail/handleSuccess" 自主设置任务结果;
  *
  * @author xuxueli 2019-12-11 21:52:51
  */
@@ -109,7 +109,7 @@ public class SampleXxlJob {
         if (exitValue == 0) {
             // default success
         } else {
-            XxlJobHelper.handleFail("command exit value("+exitValue+") is failed");
+            XxlJobHelper.handleFail("command exit value(" + exitValue + ") is failed");
         }
 
     }
@@ -117,18 +117,18 @@ public class SampleXxlJob {
 
     /**
      * 4、跨平台Http任务
-     *  参数示例:
-     *      "url: http://www.baidu.com\n" +
-     *      "method: get\n" +
-     *      "data: content\n";
+     * 参数示例:
+     * "url: http://www.baidu.com\n" +
+     * "method: get\n" +
+     * "data: content\n";
      */
     @XxlJob("httpJobHandler")
     public void httpJobHandler() throws Exception {
 
         // param parse
         String param = XxlJobHelper.getJobParam();
-        if (param==null || param.trim().length()==0) {
-            XxlJobHelper.log("param["+ param +"] invalid.");
+        if (param == null || param.trim().length() == 0) {
+            XxlJobHelper.log("param[" + param + "] invalid.");
 
             XxlJobHelper.handleFail();
             return;
@@ -138,7 +138,7 @@ public class SampleXxlJob {
         String url = null;
         String method = null;
         String data = null;
-        for (String httpParam: httpParams) {
+        for (String httpParam : httpParams) {
             if (httpParam.startsWith("url:")) {
                 url = httpParam.substring(httpParam.indexOf("url:") + 4).trim();
             }
@@ -151,14 +151,14 @@ public class SampleXxlJob {
         }
 
         // param valid
-        if (url==null || url.trim().length()==0) {
-            XxlJobHelper.log("url["+ url +"] invalid.");
+        if (url == null || url.trim().length() == 0) {
+            XxlJobHelper.log("url[" + url + "] invalid.");
 
             XxlJobHelper.handleFail();
             return;
         }
-        if (method==null || !Arrays.asList("GET", "POST").contains(method)) {
-            XxlJobHelper.log("method["+ method +"] invalid.");
+        if (method == null || !Arrays.asList("GET", "POST").contains(method)) {
+            XxlJobHelper.log("method[" + method + "] invalid.");
 
             XxlJobHelper.handleFail();
             return;
@@ -188,7 +188,7 @@ public class SampleXxlJob {
             connection.connect();
 
             // data
-            if (isPostMethod && data!=null && data.trim().length()>0) {
+            if (isPostMethod && data != null && data.trim().length() > 0) {
                 DataOutputStream dataOutputStream = new DataOutputStream(connection.getOutputStream());
                 dataOutputStream.write(data.getBytes("UTF-8"));
                 dataOutputStream.flush();
@@ -240,11 +240,13 @@ public class SampleXxlJob {
     public void demoJobHandler2() throws Exception {
         XxlJobHelper.log("XXL-JOB, Hello World.");
     }
-    public void init(){
+
+    public void init() {
         log.info("init");
 
     }
-    public void destroy(){
+
+    public void destroy() {
         log.info("destroy");
     }
 

+ 0 - 164
alien-job/src/main/java/shop/alien/xxljob/jobhandler/douyin/AuthorizationJob.java

@@ -1,164 +0,0 @@
-package shop.alien.xxljob.jobhandler.douyin;
-
-import cc.xiaokuihua.entity.analysis.entity.AnalysisToken;
-import cc.xiaokuihua.entity.analysis.entity.AnalysisUser;
-import cc.xiaokuihua.util.date.DateUtils;
-import cc.xiaokuihua.util.httpsend.apache.HttpGetRequestUtil;
-import cc.xiaokuihua.util.httpsend.apache.HttpPostWithForm;
-import shop.alien.xxljob.service.AnalysisTokenService;
-import shop.alien.xxljob.service.AnalysisUserService;
-import com.alibaba.fastjson.JSONObject;
-import com.xxl.job.core.context.XxlJobHelper;
-import com.xxl.job.core.handler.annotation.XxlJob;
-import lombok.RequiredArgsConstructor;
-import org.springframework.stereotype.Component;
-
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * 鉴权接口
- *
- * @author ssk
- * @version 1.0
- * @date 2023/5/9 15:25
- */
-@Component
-@RequiredArgsConstructor
-public class AuthorizationJob {
-
-    /**
-     * 解析用户Service
-     */
-    private final AnalysisUserService analysisUserService;
-
-    /**
-     * 解析Token Service
-     */
-    private final AnalysisTokenService analysisTokenService;
-
-    /**
-     * 抖音解析-登录获取API访问令牌
-     */
-    @XxlJob("loginForAccessTokenJobHandler")
-    public void loginForAccessTokenJobHandler() {
-        XxlJobHelper.log("抖音解析-登录获取API访问令牌");
-        String id = XxlJobHelper.getJobParam();
-        if (null == id || "".equals(id)) {
-            XxlJobHelper.handleFail("获取参数失败");
-            return;
-        }
-        AnalysisUser analysisUser = analysisUserService.getOne(Integer.valueOf(id));
-        XxlJobHelper.log("用户信息: " + analysisUser.toString());
-        String url = "https://api.tikhub.io/user/login?token_expiry_minutes=525600&keep_login=true";
-        Map<String, String> param = new HashMap<>();
-        param.put("grant_type", "password");
-        param.put("scope", "");
-        param.put("username", analysisUser.getEmail());
-        param.put("password", analysisUser.getPassword());
-        Map<String, String> headerMap = new HashMap<>();
-        String s = HttpPostWithForm.httpPostWithForm(url, param, headerMap);
-        //转json
-        JSONObject jsonObject = JSONObject.parseObject(s);
-        if (jsonObject != null) {
-            if ("true".equals(jsonObject.getString("status"))) {
-                String token = jsonObject.getJSONObject("request_headers").getString("Authorization");
-                XxlJobHelper.log("Token: " + token);
-                if (!"".equals(token)) {
-                    AnalysisToken analysisToken = analysisTokenService.getOne(analysisUser.getId());
-                    if (null != analysisToken) {
-                        //更新Token
-                        analysisToken.setToken(token);
-                        if (analysisTokenService.updateToken(analysisToken)) {
-                            XxlJobHelper.handleSuccess("Token更新成功");
-                        } else {
-                            XxlJobHelper.handleFail("Token更新失败");
-                        }
-                    } else {
-                        //新增Token
-                        analysisToken = new AnalysisToken();
-                        analysisToken.setAnalysisUserId(analysisUser.getId());
-                        analysisToken.setToken(token);
-                        analysisToken.setTokenExpiryMinutes(525600);
-                        if (analysisTokenService.insertToken(analysisToken)) {
-                            XxlJobHelper.handleSuccess("Token新增成功");
-                        } else {
-                            XxlJobHelper.handleFail("Token新增失败");
-                        }
-                    }
-                } else {
-                    XxlJobHelper.handleFail("解析返回Token为空");
-                }
-            } else {
-                XxlJobHelper.handleFail(jsonObject.getString("message"));
-            }
-        } else {
-            XxlJobHelper.handleFail("返回数据为空");
-        }
-    }
-
-    /**
-     * 抖音解析-每日签到
-     * 一小时执行一次即可
-     */
-    @XxlJob("dailyCheckInJobHandler")
-    public void dailyCheckInJobHandler() {
-        try {
-            XxlJobHelper.log("抖音解析-每日签到");
-            int count = 0;
-            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-            List<AnalysisUser> allUser = analysisUserService.getAllUser();
-            for (AnalysisUser analysisUser : allUser) {
-                //签到时间+1天
-                Date nextCheckIn = DateUtils.calcDays(analysisUser.getLastCheckIn(), 1);
-                XxlJobHelper.log("账号: " + analysisUser.getEmail());
-                XxlJobHelper.log("上次签到时间: " + sdf.format(analysisUser.getLastCheckIn()));
-                XxlJobHelper.log("下次签到时间: " + sdf.format(nextCheckIn));
-                //对比当前时间和下次执行时间
-                if (DateUtils.dateCompare(new Date(), nextCheckIn)) {
-                    //获取Token
-                    AnalysisToken analysisToken = analysisTokenService.getByUserId(analysisUser.getId());
-                    String url = "https://api.tikhub.io/promotion/daily_check_in";
-                    Map<String, String> headerMap = new HashMap<>();
-                    headerMap.put("Authorization", analysisToken.getToken());
-                    String s = HttpGetRequestUtil.getRequest(url, new HashMap<>(), headerMap);
-                    JSONObject jsonObject = JSONObject.parseObject(s);
-                    if (jsonObject != null) {
-                        //更新签到时间
-                        JSONObject user_info = jsonObject.getJSONObject("user_info");
-                        String last_check_in = user_info.getString("last_check_in").substring(0, 19).replace("T", " ");
-                        Date lastCheckInDate = sdf.parse(last_check_in);
-                        analysisUser.setLastCheckIn(DateUtils.calcHours(lastCheckInDate, 15));
-                        if ("true".equals(jsonObject.getString("status"))) {
-                            //更新可用次数
-                            analysisUser.setRemainingTimes(user_info.getString("requests_remain"));
-                            XxlJobHelper.log("账号'" + analysisUser.getEmail() + "', " + jsonObject.getString("message"));
-                            count++;
-                        } else {
-                            XxlJobHelper.log("账号'" + analysisUser.getEmail() + "', " + jsonObject.getString("message"));
-                        }
-                        analysisUserService.updateAnalysisUser(analysisUser);
-                    } else {
-                        XxlJobHelper.log("账号'" + analysisUser.getEmail() + "'请求结果为空");
-                    }
-                } else {
-                    XxlJobHelper.log("账号'" + analysisUser.getEmail() + "'暂不需要签到");
-                }
-                XxlJobHelper.log("---------------------");
-            }
-            if (count == allUser.size()) {
-                XxlJobHelper.handleSuccess("全部签到成功");
-            } else if (count > 0) {
-                XxlJobHelper.handleSuccess("部分签到成功");
-            } else {
-                XxlJobHelper.handleSuccess("暂无需要签到的账号");
-            }
-        } catch (Exception e) {
-            XxlJobHelper.handleFail("执行失败, Error: " + e.getMessage());
-        }
-
-    }
-}

+ 0 - 54
alien-job/src/main/java/shop/alien/xxljob/service/AnalysisTokenService.java

@@ -1,54 +0,0 @@
-package shop.alien.xxljob.service;
-
-import cc.xiaokuihua.entity.analysis.entity.AnalysisToken;
-
-import java.util.List;
-
-/**
- * 解析用户TokenService
- *
- * @author ssk
- * @version 1.0
- * @date 2023/5/22 17:02
- */
-public interface AnalysisTokenService {
-
-    /**
-     * 根据id获取单条
-     *
-     * @param id 主键
-     * @return AnalysisToken
-     */
-    AnalysisToken getOne(Integer id);
-
-    /**
-     * 根据用户id获取单条
-     *
-     * @param id 主键
-     * @return AnalysisToken
-     */
-    AnalysisToken getByUserId(Integer id);
-
-    /**
-     * 查询所有
-     *
-     * @return list
-     */
-    List<AnalysisToken> selectAll();
-
-    /**
-     * 新增
-     *
-     * @param analysisToken token对象
-     * @return int
-     */
-    boolean insertToken(AnalysisToken analysisToken);
-
-    /**
-     * 修改
-     *
-     * @param analysisToken token对象
-     * @return int
-     */
-    boolean updateToken(AnalysisToken analysisToken);
-}

+ 0 - 38
alien-job/src/main/java/shop/alien/xxljob/service/AnalysisUserService.java

@@ -1,38 +0,0 @@
-package shop.alien.xxljob.service;
-
-import cc.xiaokuihua.entity.analysis.entity.AnalysisUser;
-
-import java.util.List;
-
-/**
- * 解析用户Service
- *
- * @author ssk
- * @version 1.0
- * @date 2023/5/22 15:38
- */
-public interface AnalysisUserService {
-
-    /**
-     * 获取所有用户
-     *
-     * @return List
-     */
-    List<AnalysisUser> getAllUser();
-
-    /**
-     * 获取单个用户
-     *
-     * @param id 主键
-     * @return AnalysisUser
-     */
-    AnalysisUser getOne(Integer id);
-
-    /**
-     * 修改
-     *
-     * @param analysisUser 用户对象
-     * @return boolean
-     */
-    boolean updateAnalysisUser(AnalysisUser analysisUser);
-}

+ 0 - 77
alien-job/src/main/java/shop/alien/xxljob/service/impl/AnalysisTokenServiceImpl.java

@@ -1,77 +0,0 @@
-package shop.alien.xxljob.service.impl;
-
-import cc.xiaokuihua.entity.analysis.entity.AnalysisToken;
-import cc.xiaokuihua.entity.analysis.mapper.AnalysisTokenMapper;
-import shop.alien.xxljob.service.AnalysisTokenService;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import org.springframework.stereotype.Service;
-
-import java.util.List;
-
-/**
- * 解析用户Token impl
- *
- * @author ssk
- * @version 1.0
- * @date 2023/5/23 13:21
- */
-@Service
-public class AnalysisTokenServiceImpl extends ServiceImpl<AnalysisTokenMapper, AnalysisToken> implements AnalysisTokenService {
-
-    /**
-     * 根据id获取单条
-     *
-     * @param id 主键
-     * @return AnalysisToken
-     */
-    @Override
-    public AnalysisToken getOne(Integer id) {
-        return this.getById(id);
-    }
-
-    /**
-     * 根据用户id获取单条
-     *
-     * @param id 主键
-     * @return AnalysisToken
-     */
-    @Override
-    public AnalysisToken getByUserId(Integer id) {
-        QueryWrapper<AnalysisToken> queryWrapper = new QueryWrapper<>();
-        queryWrapper.eq("analysis_user_id", id);
-        return this.getOne(queryWrapper);
-    }
-
-    /**
-     * 查询所有
-     *
-     * @return list
-     */
-    @Override
-    public List<AnalysisToken> selectAll() {
-        return this.list();
-    }
-
-    /**
-     * 新增
-     *
-     * @param analysisToken token对象
-     * @return boolean
-     */
-    @Override
-    public boolean insertToken(AnalysisToken analysisToken) {
-        return this.save(analysisToken);
-    }
-
-    /**
-     * 修改
-     *
-     * @param analysisToken token对象
-     * @return boolean
-     */
-    @Override
-    public boolean updateToken(AnalysisToken analysisToken) {
-        return this.updateById(analysisToken);
-    }
-}

+ 0 - 53
alien-job/src/main/java/shop/alien/xxljob/service/impl/AnalysisUserServiceImpl.java

@@ -1,53 +0,0 @@
-package shop.alien.xxljob.service.impl;
-
-import cc.xiaokuihua.entity.analysis.entity.AnalysisUser;
-import cc.xiaokuihua.entity.analysis.mapper.AnalysisUserMapper;
-import shop.alien.xxljob.service.AnalysisUserService;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import org.springframework.stereotype.Service;
-
-import java.util.List;
-
-/**
- * 解析用户impl
- *
- * @author ssk
- * @version 1.0
- * @date 2023/5/22 16:21
- */
-@Service
-public class AnalysisUserServiceImpl extends ServiceImpl<AnalysisUserMapper, AnalysisUser> implements AnalysisUserService {
-
-    /**
-     * 获取单个用户
-     *
-     * @param id 主键
-     * @return AnalysisUser
-     */
-    @Override
-    public AnalysisUser getOne(Integer id) {
-        return this.getById(id);
-    }
-
-    /**
-     * 修改
-     *
-     * @param analysisUser 用户对象
-     * @return boolean
-     */
-    @Override
-    public boolean updateAnalysisUser(AnalysisUser analysisUser) {
-        return this.updateById(analysisUser);
-    }
-
-    /**
-     * 获取所有用户
-     *
-     * @return List
-     */
-    @Override
-    public List<AnalysisUser> getAllUser() {
-        return this.list();
-    }
-
-}

+ 0 - 13
alien-second/src/test/java/shop/alien/second/AlienSecondApplicationTests.java

@@ -1,13 +0,0 @@
-package shop.alien.second;
-
-import org.junit.jupiter.api.Test;
-import org.springframework.boot.test.context.SpringBootTest;
-
-@SpringBootTest
-class AlienSecondApplicationTests {
-
-    @Test
-    void contextLoads() {
-    }
-
-}

+ 5 - 6
alien-store/pom.xml

@@ -47,7 +47,6 @@
             <artifactId>spring-boot-starter-data-redis</artifactId>
         </dependency>
 
-        <!--redis连接池需要此依赖-->
         <dependency>
             <groupId>org.apache.commons</groupId>
             <artifactId>commons-pool2</artifactId>
@@ -58,11 +57,10 @@
             <artifactId>spring-boot-starter-websocket</artifactId>
         </dependency>
 
-<!--        <dependency>-->
-<!--            <groupId>org.elasticsearch.client</groupId>-->
-<!--            <artifactId>elasticsearch-rest-high-level-client</artifactId>-->
-<!--            <version>7.9.3</version>-->
-<!--        </dependency>-->
+        <dependency>
+            <groupId>org.elasticsearch.client</groupId>
+            <artifactId>elasticsearch-rest-high-level-client</artifactId>
+        </dependency>
 
         <dependency>
             <groupId>com.alibaba</groupId>
@@ -210,6 +208,7 @@
         <!--            <version>1.5.5</version> &lt;!&ndash; 请使用最新版本 &ndash;&gt;-->
         <!--        </dependency>-->
 
+
         <dependency>
             <groupId>com.alipay.sdk</groupId>
             <artifactId>alipay-sdk-java</artifactId>

+ 215 - 195
alien-store/src/main/java/shop/alien/store/config/ElasticSearchComponent.java

@@ -5,6 +5,26 @@ import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.http.HttpHost;
+import org.elasticsearch.action.DocWriteResponse;
+import org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest;
+import org.elasticsearch.action.bulk.BulkRequest;
+import org.elasticsearch.action.bulk.BulkResponse;
+import org.elasticsearch.action.get.GetRequest;
+import org.elasticsearch.action.get.GetResponse;
+import org.elasticsearch.action.index.IndexRequest;
+import org.elasticsearch.action.index.IndexResponse;
+import org.elasticsearch.action.search.SearchRequest;
+import org.elasticsearch.action.search.SearchResponse;
+import org.elasticsearch.client.RequestOptions;
+import org.elasticsearch.client.RestClient;
+import org.elasticsearch.client.RestClientBuilder;
+import org.elasticsearch.client.RestHighLevelClient;
+import org.elasticsearch.client.indices.CreateIndexRequest;
+import org.elasticsearch.common.xcontent.XContentType;
+import org.elasticsearch.index.query.QueryBuilders;
+import org.elasticsearch.search.SearchHit;
+import org.elasticsearch.search.SearchHits;
+import org.elasticsearch.search.builder.SearchSourceBuilder;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Component;
@@ -20,203 +40,203 @@ import java.util.UUID;
  * @date 2025/4/22 9:10
  */
 @Slf4j
-//@Component
+@Component
 public class ElasticSearchComponent {
 
-//    @Autowired
-//    private RestHighLevelClient restHighLevelClient;
-//
-//    @Value("${spring.elasticsearch.rest.uris}")
-//    private String elasticSearchUrl;
-//
-//    /**
-//     * 创建客户端
-//     */
-//    @PostConstruct
-//    public void init() {
-//        HttpHost host = HttpHost.create(elasticSearchUrl);
-//        RestClientBuilder builder = RestClient.builder(host);
-//        restHighLevelClient = new RestHighLevelClient(builder);
-//        log.info("ElasticSearchComponent.init 客户端已打开");
-//    }
-//
-//    /**
-//     * 关闭客户端
-//     */
-//    @PreDestroy
-//    public void close() {
-//        try {
-//            restHighLevelClient.close();
-//            log.info("ElasticSearchComponent.init 客户端已关闭");
-//        } catch (Exception e) {
-//            log.error("ElasticSearchComponent.close ERROR Msg={}", e.getMessage());
-//        }
-//    }
-//
-//    /**
-//     * 创建索引
-//     *
-//     * @param indexName 索引名称
-//     * @return boolean
-//     */
-//    public boolean createIndex(String indexName) {
-//        try {
-//            CreateIndexRequest request = new CreateIndexRequest(indexName);
-//            restHighLevelClient.indices().create(request, RequestOptions.DEFAULT);
-//            return true;
-//        } catch (Exception e) {
-//            log.error("ElasticSearchComponent.createIndex ERROR Msg={}", e.getMessage());
-//            return false;
-//        }
-//    }
-//
-//    /**
-//     * 创建索引
-//     *
-//     * @param indexName 索引名称
-//     * @param json      分词器json
-//     * @return boolean
-//     */
-//    public boolean createIndex(String indexName, String json) {
-//        try {
-//            //在通过ES客户端创建索引
-//            CreateIndexRequest request = new CreateIndexRequest(indexName);
-//            //设置请求中的参数(添加分词器)
-//            request.source(json, XContentType.JSON);
-//            restHighLevelClient.indices().create(request, RequestOptions.DEFAULT);
-//            return true;
-//        } catch (Exception e) {
-//            log.error("ElasticSearchComponent.createIndex ERROR Msg={}", e.getMessage());
-//            return false;
-//        }
-//    }
-//
-//
-//    /**
-//     * 删除索引
-//     *
-//     * @param indexName 索引库名
-//     * @return boolean
-//     */
-//    public boolean deleteIndex(String indexName) {
-//        try {
-//            DeleteIndexRequest request = new DeleteIndexRequest(indexName);
-//            restHighLevelClient.indices().delete(request, RequestOptions.DEFAULT);
-//            return true;
-//        } catch (Exception e) {
-//            log.error("ElasticSearchComponent.deleteIndex ERROR Msg={}", e.getMessage());
-//            return false;
-//        }
-//    }
-//
-//    /**
-//     * 添加文档-单条
-//     *
-//     * @param indexName 索引名称
-//     * @param t         单个实体类
-//     * @return boolean
-//     */
-//    public <T> boolean createIndexDocOne(String indexName, T t) {
-//        try {
-//            String json = JSON.toJSONString(t);
-//            //指定添加的文档的id为getId()/uuid,需要添加文档的索引为indexName
-//            IndexRequest request = new IndexRequest(indexName);
-//            //传入数据
-//            request.source(json, XContentType.JSON);
-//            IndexResponse index = restHighLevelClient.index(request, RequestOptions.DEFAULT);
-//            DocWriteResponse.Result result = index.getResult();
-//            return result == DocWriteResponse.Result.CREATED;
-//        } catch (Exception e) {
-//            log.error("ElasticSearchComponent.createIndexDocOne ERROR Msg={}", e.getMessage());
-//            return false;
-//        }
-//    }
-//
-//    /**
-//     * 添加文档-多条
-//     *
-//     * @param indexName 索引名称
-//     * @param t         单个实体类
-//     * @return boolean
-//     */
-//    public <T> boolean createIndexDocMore(String indexName, List<T> t) {
-//        try {
-//            //BulkRequest的对象,可以将该对象理解为是一个保存request对象的容器,
-//            //将所有的请求都初始化好后,添加到BulkRequest对象中,再使用BulkRequest对象的bulk方法,一次性执行完毕
-//            BulkRequest bulk = new BulkRequest();
-//            for (T t1 : t) {
-//                String json = JSON.toJSONString(t1);
-//                //指定添加的文档的id为getId()/uuid,需要添加文档的索引为indexName
-//                IndexRequest request = new IndexRequest(indexName).id(UUID.randomUUID().toString());
-//                //传入数据
-//                request.source(json, XContentType.JSON);
-//                //把数据放进BulkRequest对象里面
-//                bulk.add(request);
-//            }
-//            BulkResponse bulk1 = restHighLevelClient.bulk(bulk, RequestOptions.DEFAULT);
-//            return !bulk1.hasFailures();
-//        } catch (Exception e) {
-//            log.error("ElasticSearchComponent.createIndexDocMore ERROR Msg={}", e.getMessage());
-//            return false;
-//        }
-//    }
-//
-//    /**
-//     * 查询文档
-//     *
-//     * @param indexName 索引名称
-//     * @param id        文档id
-//     * @return JSONObject
-//     */
-//    public JSONObject getDoc(String indexName, String id) {
-//        try {
-//            // 根据id查询
-////            GetRequest request = new GetRequest(indexName, id);
-//            GetRequest request = new GetRequest();
-//            GetResponse response = restHighLevelClient.get(request, RequestOptions.DEFAULT);
-//            //获取查询到的数据中的source属性的数据
-//            String json = response.getSourceAsString();
-//            return JSON.parseObject(json);
-//        } catch (Exception e) {
-//            log.error("ElasticSearchComponent.getDoc ERROR Msg={}", e.getMessage());
-//            return null;
-//        }
-//    }
-//
-//    /**
-//     * 搜索文档
-//     *
-//     * @param indexName 索引名称
-//     * @param fieldName 字段名称
-//     * @param content   查询内容
-//     * @return JSONArray
-//     */
-//    public JSONArray searchDoc(String indexName, String fieldName, String content) {
-//        try {
-//            SearchRequest request = new SearchRequest(indexName);
-//            //创建条件查询对象
-//            SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
-//            //设置查询条件,对指定字段执行精确匹配查询。
-////            searchSourceBuilder.query(QueryBuilders.termQuery(fieldName, content));
-//            //对指定字段执行全文搜索查询。默认会对文本进行分词处理,然后进行搜索。
-//            searchSourceBuilder.query(QueryBuilders.matchQuery(fieldName, content));
-//            //把查询条件放进请求中
-//            request.source(searchSourceBuilder);
-//            //根据请求获取返回数据
-//            SearchResponse response = restHighLevelClient.search(request, RequestOptions.DEFAULT);
-//            //获取返回数据里面的hits属性(获取的具体属性,可以看上面的postman操作)
-//            SearchHits hits = response.getHits();
-//            JSONArray jsonArray = new JSONArray();
-//            for (SearchHit hit : hits) {
-//                String source = hit.getSourceAsString();
-//                jsonArray.add(JSON.parseObject(source));
-//            }
-//            return jsonArray;
-//        } catch (Exception e) {
-//            log.error("ElasticSearchComponent.searchDoc ERROR Msg={}", e.getMessage());
-//            return null;
-//        }
-//    }
+    @Autowired
+    private RestHighLevelClient restHighLevelClient;
+
+    @Value("${spring.elasticsearch.rest.uris}")
+    private String elasticSearchUrl;
+
+    /**
+     * 创建客户端
+     */
+    @PostConstruct
+    public void init() {
+        HttpHost host = HttpHost.create(elasticSearchUrl);
+        RestClientBuilder builder = RestClient.builder(host);
+        restHighLevelClient = new RestHighLevelClient(builder);
+        log.info("ElasticSearchComponent.init 客户端已打开");
+    }
+
+    /**
+     * 关闭客户端
+     */
+    @PreDestroy
+    public void close() {
+        try {
+            restHighLevelClient.close();
+            log.info("ElasticSearchComponent.init 客户端已关闭");
+        } catch (Exception e) {
+            log.error("ElasticSearchComponent.close ERROR Msg={}", e.getMessage());
+        }
+    }
+
+    /**
+     * 创建索引
+     *
+     * @param indexName 索引名称
+     * @return boolean
+     */
+    public boolean createIndex(String indexName) {
+        try {
+            CreateIndexRequest request = new CreateIndexRequest(indexName);
+            restHighLevelClient.indices().create(request, RequestOptions.DEFAULT);
+            return true;
+        } catch (Exception e) {
+            log.error("ElasticSearchComponent.createIndex ERROR Msg={}", e.getMessage());
+            return false;
+        }
+    }
+
+    /**
+     * 创建索引
+     *
+     * @param indexName 索引名称
+     * @param json      分词器json
+     * @return boolean
+     */
+    public boolean createIndex(String indexName, String json) {
+        try {
+            //在通过ES客户端创建索引
+            CreateIndexRequest request = new CreateIndexRequest(indexName);
+            //设置请求中的参数(添加分词器)
+            request.source(json, XContentType.JSON);
+            restHighLevelClient.indices().create(request, RequestOptions.DEFAULT);
+            return true;
+        } catch (Exception e) {
+            log.error("ElasticSearchComponent.createIndex ERROR Msg={}", e.getMessage());
+            return false;
+        }
+    }
+
+
+    /**
+     * 删除索引
+     *
+     * @param indexName 索引库名
+     * @return boolean
+     */
+    public boolean deleteIndex(String indexName) {
+        try {
+            DeleteIndexRequest request = new DeleteIndexRequest(indexName);
+            restHighLevelClient.indices().delete(request, RequestOptions.DEFAULT);
+            return true;
+        } catch (Exception e) {
+            log.error("ElasticSearchComponent.deleteIndex ERROR Msg={}", e.getMessage());
+            return false;
+        }
+    }
+
+    /**
+     * 添加文档-单条
+     *
+     * @param indexName 索引名称
+     * @param t         单个实体类
+     * @return boolean
+     */
+    public <T> boolean createIndexDocOne(String indexName, T t) {
+        try {
+            String json = JSON.toJSONString(t);
+            //指定添加的文档的id为getId()/uuid,需要添加文档的索引为indexName
+            IndexRequest request = new IndexRequest(indexName);
+            //传入数据
+            request.source(json, XContentType.JSON);
+            IndexResponse index = restHighLevelClient.index(request, RequestOptions.DEFAULT);
+            DocWriteResponse.Result result = index.getResult();
+            return result == DocWriteResponse.Result.CREATED;
+        } catch (Exception e) {
+            log.error("ElasticSearchComponent.createIndexDocOne ERROR Msg={}", e.getMessage());
+            return false;
+        }
+    }
+
+    /**
+     * 添加文档-多条
+     *
+     * @param indexName 索引名称
+     * @param t         单个实体类
+     * @return boolean
+     */
+    public <T> boolean createIndexDocMore(String indexName, List<T> t) {
+        try {
+            //BulkRequest的对象,可以将该对象理解为是一个保存request对象的容器,
+            //将所有的请求都初始化好后,添加到BulkRequest对象中,再使用BulkRequest对象的bulk方法,一次性执行完毕
+            BulkRequest bulk = new BulkRequest();
+            for (T t1 : t) {
+                String json = JSON.toJSONString(t1);
+                //指定添加的文档的id为getId()/uuid,需要添加文档的索引为indexName
+                IndexRequest request = new IndexRequest(indexName).id(UUID.randomUUID().toString());
+                //传入数据
+                request.source(json, XContentType.JSON);
+                //把数据放进BulkRequest对象里面
+                bulk.add(request);
+            }
+            BulkResponse bulk1 = restHighLevelClient.bulk(bulk, RequestOptions.DEFAULT);
+            return !bulk1.hasFailures();
+        } catch (Exception e) {
+            log.error("ElasticSearchComponent.createIndexDocMore ERROR Msg={}", e.getMessage());
+            return false;
+        }
+    }
+
+    /**
+     * 查询文档
+     *
+     * @param indexName 索引名称
+     * @param id        文档id
+     * @return JSONObject
+     */
+    public JSONObject getDoc(String indexName, String id) {
+        try {
+            // 根据id查询
+//            GetRequest request = new GetRequest(indexName, id);
+            GetRequest request = new GetRequest();
+            GetResponse response = restHighLevelClient.get(request, RequestOptions.DEFAULT);
+            //获取查询到的数据中的source属性的数据
+            String json = response.getSourceAsString();
+            return JSON.parseObject(json);
+        } catch (Exception e) {
+            log.error("ElasticSearchComponent.getDoc ERROR Msg={}", e.getMessage());
+            return null;
+        }
+    }
+
+    /**
+     * 搜索文档
+     *
+     * @param indexName 索引名称
+     * @param fieldName 字段名称
+     * @param content   查询内容
+     * @return JSONArray
+     */
+    public JSONArray searchDoc(String indexName, String fieldName, String content) {
+        try {
+            SearchRequest request = new SearchRequest(indexName);
+            //创建条件查询对象
+            SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
+            //设置查询条件,对指定字段执行精确匹配查询。
+//            searchSourceBuilder.query(QueryBuilders.termQuery(fieldName, content));
+            //对指定字段执行全文搜索查询。默认会对文本进行分词处理,然后进行搜索。
+            searchSourceBuilder.query(QueryBuilders.matchQuery(fieldName, content));
+            //把查询条件放进请求中
+            request.source(searchSourceBuilder);
+            //根据请求获取返回数据
+            SearchResponse response = restHighLevelClient.search(request, RequestOptions.DEFAULT);
+            //获取返回数据里面的hits属性(获取的具体属性,可以看上面的postman操作)
+            SearchHits hits = response.getHits();
+            JSONArray jsonArray = new JSONArray();
+            for (SearchHit hit : hits) {
+                String source = hit.getSourceAsString();
+                jsonArray.add(JSON.parseObject(source));
+            }
+            return jsonArray;
+        } catch (Exception e) {
+            log.error("ElasticSearchComponent.searchDoc ERROR Msg={}", e.getMessage());
+            return null;
+        }
+    }
 
 
 }

+ 41 - 37
alien-store/src/main/java/shop/alien/store/controller/ElasticSearchController.java

@@ -1,13 +1,17 @@
 package shop.alien.store.controller;
 
-import io.swagger.annotations.Api;
+import com.alibaba.fastjson.JSONArray;
+import io.swagger.annotations.*;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
-import org.springframework.web.bind.annotation.CrossOrigin;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
+import shop.alien.entity.store.ElasticSearchLabel;
+import shop.alien.store.config.ElasticSearchComponent;
 import shop.alien.store.mapper.ElasticSearchMapper;
 
+import java.util.ArrayList;
+import java.util.List;
+
 /**
  * ElasticSearchController
  *
@@ -23,7 +27,7 @@ import shop.alien.store.mapper.ElasticSearchMapper;
 @RequiredArgsConstructor
 public class ElasticSearchController {
 
-//    private final ElasticSearchComponent elasticSearch;
+    private final ElasticSearchComponent elasticSearch;
 
     public final ElasticSearchMapper elasticSearchMapper;
 
@@ -64,37 +68,37 @@ public class ElasticSearchController {
 //    }
 //   }
 
-//    @ApiOperation("查询店铺, 菜单, 套餐, 位置")
-//    @ApiOperationSupport(order = 1)
-//    @ApiImplicitParams({
-//            @ApiImplicitParam(name = "content", value = "内容", dataType = "String", paramType = "query", required = true)
-//    })
-//    @GetMapping(value = "/search")
-//    public JSONArray search(@RequestParam("content") @NotNull String content) {
-//        String indexName = "alien_databases";
-//        String fieldName = "all";
-//        return elasticSearch.searchDoc(indexName, fieldName, content);
-//    }
-//
-//    @ApiOperation("新增数据")
-//    @ApiOperationSupport(order = 2)
-//    @PostMapping(value = "/insert")
-//    public boolean insert(@RequestBody List<ElasticSearchLabel> list) {
-//        return elasticSearch.createIndexDocMore("alien_databases", list);
-//    }
-//
-//    @ApiOperation("初始新增数据")
-//    @ApiOperationSupport(order = 3)
-//    @GetMapping(value = "/initInsert")
-//    public boolean initInsert() {
-//        List<ElasticSearchLabel> list = new ArrayList<>();
-//        List<ElasticSearchLabel> storeInfoList = elasticSearchMapper.getStoreInfoList();
-//        List<ElasticSearchLabel> storeMenuList = elasticSearchMapper.getStoreMenuList();
-//        List<ElasticSearchLabel> storePackageList = elasticSearchMapper.getStorePackageList();
-//        list.addAll(storeInfoList);
-//        list.addAll(storeMenuList);
-//        list.addAll(storePackageList);
-//        return elasticSearch.createIndexDocMore("alien_databases", list);
-//    }
+    @ApiOperation("查询店铺, 菜单, 套餐, 位置")
+    @ApiOperationSupport(order = 1)
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "content", value = "内容", dataType = "String", paramType = "query", required = true)
+    })
+    @GetMapping(value = "/search")
+    public JSONArray search(@RequestParam("content") String content) {
+        String indexName = "alien_databases";
+        String fieldName = "all";
+        return elasticSearch.searchDoc(indexName, fieldName, content);
+    }
+
+    @ApiOperation("新增数据")
+    @ApiOperationSupport(order = 2)
+    @PostMapping(value = "/insert")
+    public boolean insert(@RequestBody List<ElasticSearchLabel> list) {
+        return elasticSearch.createIndexDocMore("alien_databases", list);
+    }
+
+    @ApiOperation("初始新增数据")
+    @ApiOperationSupport(order = 3)
+    @GetMapping(value = "/initInsert")
+    public boolean initInsert() {
+        List<ElasticSearchLabel> list = new ArrayList<>();
+        List<ElasticSearchLabel> storeInfoList = elasticSearchMapper.getStoreInfoList();
+        List<ElasticSearchLabel> storeMenuList = elasticSearchMapper.getStoreMenuList();
+        List<ElasticSearchLabel> storePackageList = elasticSearchMapper.getStorePackageList();
+        list.addAll(storeInfoList);
+        list.addAll(storeMenuList);
+        list.addAll(storePackageList);
+        return elasticSearch.createIndexDocMore("alien_databases", list);
+    }
 
 }

+ 1 - 3
alien-store/src/main/java/shop/alien/store/controller/LifeReverseGroupBuyingController.java

@@ -12,8 +12,6 @@ import shop.alien.store.entity.vo.LifeReverseGroupBuyingStoreVo;
 import shop.alien.store.entity.vo.LifeReverseGroupBuyingUserVo;
 import shop.alien.store.service.LifeReverseGroupBuyingService;
 
-import javax.validation.constraints.NotNull;
-
 /**
  * 用户反向团购表 前端控制器
  *
@@ -73,7 +71,7 @@ public class LifeReverseGroupBuyingController {
     })
     @ApiOperationSupport(order = 3)
     @GetMapping("/getStoreList")
-    public R<IPage<LifeReverseGroupBuyingStoreVo>> getStoreList(Integer pageNum, Integer pageSize, Integer distance, Integer dateSort, String price, @NotNull Integer storeId) {
+    public R<IPage<LifeReverseGroupBuyingStoreVo>> getStoreList(Integer pageNum, Integer pageSize, Integer distance, Integer dateSort, String price, Integer storeId) {
         log.info("LifeReverseGroupBuyingController.getStoreList?pageNum={}&pageSize={}&distance={}&dateSort={}&price={}&storeId={}", pageNum, pageSize, distance, dateSort, price, storeId);
         return R.data(lifeReverseGroupBuyingService.getStoreList(pageNum, pageSize, distance, dateSort, price, storeId));
     }

+ 2 - 3
alien-store/src/main/java/shop/alien/store/controller/StoreCommentController.java

@@ -11,7 +11,6 @@ import shop.alien.store.entity.vo.StoreCommentVo;
 import shop.alien.store.entity.vo.StoreCommitPercentVo;
 import shop.alien.store.service.StoreCommentService;
 
-import javax.validation.constraints.NotNull;
 import java.util.Map;
 import java.util.Set;
 
@@ -92,7 +91,7 @@ public class StoreCommentController {
                                   Integer storeId,
                                   Integer userId,
                                   Integer replyId,
-                                  @NotNull String commentContent) {
+                                  String commentContent) {
         log.info("StoreCommentController.userComment?businessId={}&businessType={}&storeId={}&userId={}&replyId={}&commentContent={}", businessId, businessType, storeId, userId, replyId, commentContent);
         Set<String> fileNameSet = multipartRequest.getMultiFileMap().keySet();
         log.info(String.valueOf(fileNameSet.size()));
@@ -116,7 +115,7 @@ public class StoreCommentController {
             @ApiImplicitParam(name = "phoneId", value = "用户id", dataType = "String", paramType = "query")
     })
     @PostMapping("/saveComment")
-    public R<Integer> saveComment(MultipartRequest multipartRequest, Integer id, Integer businessId, Integer businessType, Integer storeId, Integer userId, Integer replyId, @NotNull(message = "请输入内容") String commentContent, Double score, String otherScore, Integer isAnonymous, String evaluationTags, @NotNull String phoneId) {
+    public R<Integer> saveComment(MultipartRequest multipartRequest, Integer id, Integer businessId, Integer businessType, Integer storeId, Integer userId, Integer replyId, String commentContent, Double score, String otherScore, Integer isAnonymous, String evaluationTags, String phoneId) {
         log.info("StoreCommentController.saveComment?id={}&businessId={}&businessType={}&storeId={}&userId={}&replyId={}&commentContent={}&score={}&otherScore={}&isAnonymous={}&evaluationTags={}&phoneId={}", id, businessId, businessType, storeId, userId, replyId, commentContent, score, otherScore, isAnonymous, evaluationTags, phoneId);
         Set<String> fileNameSet = multipartRequest.getMultiFileMap().keySet();
         log.info(String.valueOf(fileNameSet.size()));

+ 18 - 66
pom.xml

@@ -26,7 +26,7 @@
     <properties>
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
         <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
-        <spring-boot.version>2.2.2.RELEASE</spring-boot.version>
+        <spring-boot.version>2.3.2.RELEASE</spring-boot.version>
         <spring-cloud-nacos.version>2.2.5.RELEASE</spring-cloud-nacos.version>
         <spring.cloud.version>Hoxton.SR1</spring.cloud.version>
         <mybatisplus.version>3.2.0</mybatisplus.version>
@@ -50,58 +50,6 @@
                 <type>pom</type>
                 <scope>import</scope>
             </dependency>
-            <dependency>
-                <groupId>org.springframework.boot</groupId>
-                <artifactId>spring-boot-starter</artifactId>
-                <version>${spring-boot.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>org.springframework.boot</groupId>
-                <artifactId>spring-boot-starter-web</artifactId>
-                <version>${spring-boot.version}</version>
-            </dependency>
-
-            <dependency>
-                <groupId>org.springframework.boot</groupId>
-                <artifactId>spring-boot-starter-undertow</artifactId>
-                <version>${spring-boot.version}</version>
-            </dependency>
-
-            <dependency>
-                <groupId>org.springframework.boot</groupId>
-                <artifactId>spring-boot-starter-jdbc</artifactId>
-                <version>${spring-boot.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>org.springframework.boot</groupId>
-                <artifactId>spring-boot-starter-data-redis</artifactId>
-                <version>${spring-boot.version}</version>
-            </dependency>
-
-            <!-- springboot邮件 -->
-            <dependency>
-                <groupId>org.springframework.boot</groupId>
-                <artifactId>spring-boot-starter-mail</artifactId>
-                <version>${spring-boot.version}</version>
-            </dependency>
-
-            <dependency>
-                <groupId>org.springframework.cloud</groupId>
-                <artifactId>spring-cloud-starter-netflix-zuul</artifactId>
-                <version>${spring-boot.version}</version>
-            </dependency>
-
-            <dependency>
-                <groupId>org.springframework.boot</groupId>
-                <artifactId>spring-boot-starter-amqp</artifactId>
-                <version>${spring-boot.version}</version>
-            </dependency>
-
-            <dependency>
-                <groupId>org.springframework.cloud</groupId>
-                <artifactId>spring-cloud-starter-openfeign</artifactId>
-                <version>2.2.1.RELEASE</version>
-            </dependency>
 
             <dependency>
                 <groupId>io.github.openfeign</groupId>
@@ -125,11 +73,13 @@
                 <artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
                 <version>${spring-cloud-nacos.version}</version>
             </dependency>
+
             <dependency>
                 <groupId>com.alibaba.cloud</groupId>
                 <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
                 <version>${spring-cloud-nacos.version}</version>
             </dependency>
+
             <dependency>
                 <groupId>com.alibaba</groupId>
                 <artifactId>fastjson</artifactId>
@@ -143,32 +93,38 @@
                 <artifactId>commons-io</artifactId>
                 <version>2.4</version>
             </dependency>
+
             <dependency>
                 <groupId>org.apache.commons</groupId>
                 <artifactId>commons-lang3</artifactId>
                 <version>3.9</version>
             </dependency>
+
             <dependency>
                 <groupId>commons-codec</groupId>
                 <artifactId>commons-codec</artifactId>
                 <version>1.10</version>
             </dependency>
+
             <dependency>
                 <groupId>org.apache.httpcomponents</groupId>
                 <artifactId>httpclient</artifactId>
                 <version>4.5.11</version>
             </dependency>
+
             <!--redis连接池需要此依赖-->
             <dependency>
                 <groupId>org.apache.commons</groupId>
                 <artifactId>commons-pool2</artifactId>
                 <version>2.7.0</version>
             </dependency>
+
             <dependency>
                 <groupId>commons-fileupload</groupId>
                 <artifactId>commons-fileupload</artifactId>
                 <version>1.5</version>
             </dependency>
+
             <!--打印, pdf转换成img-->
             <dependency>
                 <groupId>org.apache.pdfbox</groupId>
@@ -205,21 +161,25 @@
                     </exclusion>
                 </exclusions>
             </dependency>
+
             <dependency>
                 <groupId>io.swagger</groupId>
                 <artifactId>swagger-annotations</artifactId>
                 <version>1.5.22</version>
             </dependency>
+
             <dependency>
                 <groupId>io.swagger</groupId>
                 <artifactId>swagger-models</artifactId>
                 <version>1.5.22</version>
             </dependency>
+
             <dependency>
                 <groupId>io.springfox</groupId>
                 <artifactId>springfox-swagger-ui</artifactId>
                 <version>2.9.2</version>
             </dependency>
+
             <dependency>
                 <groupId>com.github.xiaoymin</groupId>
                 <artifactId>swagger-bootstrap-ui</artifactId>
@@ -233,6 +193,7 @@
                 <artifactId>mybatis-plus-boot-starter</artifactId>
                 <version>${mybatisplus.version}</version>
             </dependency>
+
             <!-- mybatis-plus代码生成器 -->
             <dependency>
                 <groupId>com.baomidou</groupId>
@@ -253,22 +214,26 @@
                     </exclusion>
                 </exclusions>
             </dependency>
+
             <dependency>
                 <groupId>com.baomidou</groupId>
                 <artifactId>mybatis-plus-annotation</artifactId>
                 <version>${mybatisplus.version}</version>
             </dependency>
+
             <dependency>
                 <groupId>com.baomidou</groupId>
                 <artifactId>mybatis-plus-extension</artifactId>
                 <version>${mybatisplus.version}</version>
             </dependency>
+
             <dependency>
                 <groupId>com.baomidou</groupId>
                 <artifactId>mybatis-plus-core</artifactId>
                 <version>${mybatisplus.version}</version>
                 <scope>compile</scope>
             </dependency>
+
             <!-- mybatisPlus Freemarker 模版引擎 -->
             <dependency>
                 <groupId>org.freemarker</groupId>
@@ -372,24 +337,11 @@
             </dependency>
 
             <!--Other End-->
-
         </dependencies>
     </dependencyManagement>
 
     <build>
         <plugins>
-            <!--            <plugin>-->
-            <!--                <groupId>org.springframework.boot</groupId>-->
-            <!--                <artifactId>spring-boot-maven-plugin</artifactId>-->
-            <!--                <configuration>-->
-            <!--                    <excludes>-->
-            <!--                        <exclude>-->
-            <!--                            <groupId>org.projectlombok</groupId>-->
-            <!--                            <artifactId>lombok</artifactId>-->
-            <!--                        </exclude>-->
-            <!--                    </excludes>-->
-            <!--                </configuration>-->
-            <!--            </plugin>-->
             <plugin>
                 <groupId>org.springframework.boot</groupId>
                 <artifactId>spring-boot-maven-plugin</artifactId>