瀏覽代碼

1、搜索接口bug修复。

jessie 5 年之前
父節點
當前提交
d1cd98e58a

+ 4 - 2
src/main/java/com/pavis/ai/app/fda/common/config/constants/Constants.java

@@ -25,10 +25,12 @@ public class Constants {
      * AppID(小程序ID)
      // */
     // public final static String APP_ID = "wx85f9298d699fc12f";
-    public final static String APP_ID = "wx24f8183c606b4916";
+    // public final static String APP_ID = "wx24f8183c606b4916";
+    public final static String APP_ID = "wxc9e688ef6559cea7";
 
     /**
      * AppSecret(小程序密钥)
      */
-    public final static String SECRET = "d594af73e610917d171e128d8e0ee056";
+    // public final static String SECRET = "d594af73e610917d171e128d8e0ee056";
+    public final static String SECRET = "8585a509d85331f0d5ef4d4a5869c89d";
 }

+ 11 - 0
src/main/java/com/pavis/ai/app/fda/common/utils/GeneralUtils.java

@@ -32,6 +32,17 @@ public class GeneralUtils {
         return b.setScale(2, BigDecimal.ROUND_HALF_UP).floatValue();
     }
 
+    /**
+     * 去除标点符号及非法字符。
+     *
+     * @param str
+     * @return
+     */
+    public static String removePunctuation(String str) {
+        return str.replaceAll("[\\p{P}+~$`^=|<>~`$^+=|<>¥×]", "");
+    }
+
+
     /**
      * json格式判定。
      *

+ 1 - 1
src/main/java/com/pavis/ai/app/fda/controller/BaseController.java

@@ -35,7 +35,7 @@ public class BaseController {
     private SearchService searchService;
 
 
-    @ApiOperation("根据行业id查询详情接口")
+    @ApiOperation("根据行业id获取详情接口")
     @ApiOperationSupport(order = 1)
     @PostMapping("/his/find")
     public ResultBody hisFind(@RequestBody List<FindDetail> findDetails) {

+ 4 - 2
src/main/java/com/pavis/ai/app/fda/controller/WechatController.java

@@ -1,5 +1,6 @@
 package com.pavis.ai.app.fda.controller;
 
+import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
 import com.github.xiaoymin.knife4j.annotations.ApiSort;
@@ -62,6 +63,7 @@ public class WechatController {
     @ApiOperationSupport(order = 3)
     @PostMapping("/follow")
     public ResultBody toFollow(@RequestBody Follower follower) {
+        log.info("关注:{}", JSON.toJSONString(follower));
         if (!StringUtils.isEmpty(follower.getPlateId()) && !StringUtils.isEmpty(follower.getUserId())) {
             int fId = searchService.toFollow(follower);
             if (fId > 0) {
@@ -86,7 +88,7 @@ public class WechatController {
                 return ResultBody.failed().data(fId).msg("您还未关注,不能取消噢");
             }
         } else {
-            return ResultBody.failed().data(null).msg("关注失败,参数不能为空。");
+            return ResultBody.failed().data(null).msg("关注失败,参数为空");
         }
     }
 
@@ -97,7 +99,7 @@ public class WechatController {
         if (!StringUtils.isEmpty(userId.getUserId())) {
             return ResultBody.ok().data(searchService.followDetails(userId.getUserId()));
         } else {
-            return ResultBody.failed().data(null).msg("获取失败,参数不能为空。");
+            return ResultBody.failed().data(null).msg("获取失败,参数为空。");
         }
     }
 }

+ 247 - 201
src/main/java/com/pavis/ai/app/fda/service/impl/SearchServiceImpl.java

@@ -222,12 +222,12 @@ public class SearchServiceImpl implements SearchService {
     @Override
     public int toFollow(Follower follower) {
         // 1、查询该用户已关注的行业。
-        List<FollowInfo> followInfos = getFollowed(follower.getUserId(),follower.getPlateId());
+        List<FollowInfo> followInfos = getFollowed(follower.getUserId(), follower.getPlateId());
         // 2、判断是否需要入库。
-        if (followInfos.size() > 0){
+        if (followInfos.size() > 0) {
             // 已关注过请勿重复关注。
             return -1;
-        }else {
+        } else {
             // 未关注过该行业,新增关注记录。
             FollowInfo followInfo = new FollowInfo();
             BeanUtils.copyProperties(follower, followInfo);
@@ -242,16 +242,16 @@ public class SearchServiceImpl implements SearchService {
 
     @Override
     public int toCancelFollow(Follower follower) {
-        List<FollowInfo> followInfos = getFollowed(follower.getUserId(),follower.getPlateId());
-        if (followInfos.size() < 0){
+        List<FollowInfo> followInfos = getFollowed(follower.getUserId(), follower.getPlateId());
+        if (followInfos.size() < 0) {
             return -1;
-        }else {
+        } else {
             int deletedId = 0;
             for (FollowInfo followInfo : followInfos) {
                 QueryWrapper<FollowInfo> queryWrapper = new QueryWrapper<>();
                 queryWrapper.lambda()
-                        .eq(FollowInfo::getUserId,follower.getUserId())
-                        .eq(FollowInfo::getPlateId,follower.getPlateId());
+                        .eq(FollowInfo::getUserId, follower.getUserId())
+                        .eq(FollowInfo::getPlateId, follower.getPlateId());
                 deletedId = followInfoMapper.delete(queryWrapper);
             }
             return deletedId;
@@ -262,7 +262,7 @@ public class SearchServiceImpl implements SearchService {
     public List<IncInfo> followDetails(String userId) {
         QueryWrapper<FollowInfo> followInfoQueryWrapper = new QueryWrapper<>();
         followInfoQueryWrapper.lambda()
-                .eq(FollowInfo::getUserId,userId);
+                .eq(FollowInfo::getUserId, userId);
         List<FollowInfo> followInfos = followInfoMapper.selectList(followInfoQueryWrapper);
         IncInfo incInfo;
         List<IncInfo> incInfos = new ArrayList<>();
@@ -273,7 +273,7 @@ public class SearchServiceImpl implements SearchService {
                     .orderByDesc(IndustryPlate::getPlateDate);
             List<IndustryPlate> datePlates = industryPlateMapper.selectList(industryPlateQueryWrapper);
             String date = datePlates.size() > 0 ? datePlates.get(0).getPlateDate() : TestCommon.getWeek();
-            Float value = calLastWeekActual(date,followInfo.getPlateId());
+            Float value = calLastWeekActual(date, followInfo.getPlateId());
             incInfo = IncInfo.builder()
                     .industryId(followInfo.getPlateId())
                     .industryValue(GeneralUtils.toFloatByTwo(value))
@@ -330,14 +330,14 @@ public class SearchServiceImpl implements SearchService {
                         industryDetails.add(toIndustryDetail(nextIndustryPlate));
                     }
                 }
-                if (nextIndustryPlates.size() > 0 && detailsFlag.equals(true)){
+                if (nextIndustryPlates.size() > 0 && detailsFlag.equals(true)) {
                     // 创建detail列表
                     log.info("实际:{}", JSON.toJSONString(industryPlates));
                     for (IndustryPlate industryPlate : industryPlates) {
                         industryDetails.add(toIndustryDetail(industryPlate));
                     }
                 }
-                if (detailsFlag.equals(false)){
+                if (detailsFlag.equals(false)) {
                     // 创建detail列表
                     log.info("实际:{}", JSON.toJSONString(industryPlates));
                     for (IndustryPlate industryPlate : industryPlates) {
@@ -352,7 +352,7 @@ public class SearchServiceImpl implements SearchService {
                 .build();
         // todo 需要修改接口。
         List<NewsList> newsLists = newsService.getNewsByPlateId(searchInfo.getSearchParam());
-        List<FollowInfo> followInfos = getFollowed(findDetails.get(0).getUserId(),findDetails.get(0).getPlateId());
+        List<FollowInfo> followInfos = getFollowed(findDetails.get(0).getUserId(), findDetails.get(0).getPlateId());
         Boolean isFollowed = followInfos.size() > 0 ? true : false;
         IndustryDetailsInfo industryInfo = IndustryDetailsInfo.builder()
                 .actuals(industryDetails)
@@ -365,15 +365,16 @@ public class SearchServiceImpl implements SearchService {
 
     /**
      * 判断该用户是否关注过该行业。
+     *
      * @param userId
      * @param plateId
      * @return
      */
-    public List<FollowInfo> getFollowed(String userId,String plateId){
+    public List<FollowInfo> getFollowed(String userId, String plateId) {
         QueryWrapper<FollowInfo> followInfoQueryWrapper = new QueryWrapper<>();
         followInfoQueryWrapper.lambda()
-                .eq(FollowInfo::getUserId,userId)
-                .eq(FollowInfo::getPlateId,plateId);
+                .eq(FollowInfo::getUserId, userId)
+                .eq(FollowInfo::getPlateId, plateId);
         List<FollowInfo> followInfos = followInfoMapper.selectList(followInfoQueryWrapper);
         return followInfos;
     }
@@ -416,23 +417,23 @@ public class SearchServiceImpl implements SearchService {
         log.info("详情查询:{}", id + ",monday:" + monday + ",sunday:" + sunday);
 
         QueryWrapper<IndustryPlate> queryWrapper = new QueryWrapper<>();
-        if (id.equals("")){
-            if (DateUtils.checkDate(monday,sunday).equals(true)){
+        if (id.equals("")) {
+            if (DateUtils.checkDate(monday, sunday).equals(true)) {
                 queryWrapper.lambda()
                         .orderByDesc(IndustryPlate::getPlateDate)
-                        .between(IndustryPlate::getPlateDate, sunday,monday );
-            }else {
+                        .between(IndustryPlate::getPlateDate, sunday, monday);
+            } else {
                 queryWrapper.lambda()
                         .orderByDesc(IndustryPlate::getPlateDate)
                         .between(IndustryPlate::getPlateDate, monday, sunday);
             }
-        }else {
-            if (DateUtils.checkDate(monday,sunday).equals(true)){
+        } else {
+            if (DateUtils.checkDate(monday, sunday).equals(true)) {
                 queryWrapper.lambda()
                         .eq(IndustryPlate::getPlateId, id)
                         .orderByDesc(IndustryPlate::getPlateDate)
-                        .between(IndustryPlate::getPlateDate, sunday,monday );
-            }else {
+                        .between(IndustryPlate::getPlateDate, sunday, monday);
+            } else {
                 queryWrapper.lambda()
                         .eq(IndustryPlate::getPlateId, id)
                         .orderByDesc(IndustryPlate::getPlateDate)
@@ -442,27 +443,28 @@ public class SearchServiceImpl implements SearchService {
         List<IndustryPlate> industryPlates = industryPlateMapper.selectList(queryWrapper);
         return industryPlates;
     }
+
     public List<IndustryPlateRes> toIndustryPlateRes(String id, String monday, String sunday) {
         log.info("详情查询:{}", id + ",monday:" + monday + ",sunday:" + sunday);
 
         QueryWrapper<IndustryPlateRes> queryWrapper = new QueryWrapper<>();
-        if (id.equals("")){
-            if (DateUtils.checkDate(monday,sunday).equals(true)){
+        if (id.equals("")) {
+            if (DateUtils.checkDate(monday, sunday).equals(true)) {
                 queryWrapper.lambda()
                         .orderByDesc(IndustryPlateRes::getPlateDate)
-                        .between(IndustryPlateRes::getPlateDate, sunday,monday );
-            }else {
+                        .between(IndustryPlateRes::getPlateDate, sunday, monday);
+            } else {
                 queryWrapper.lambda()
                         .orderByDesc(IndustryPlateRes::getPlateDate)
                         .between(IndustryPlateRes::getPlateDate, monday, sunday);
             }
-        }else {
-            if (DateUtils.checkDate(monday,sunday).equals(true)){
+        } else {
+            if (DateUtils.checkDate(monday, sunday).equals(true)) {
                 queryWrapper.lambda()
                         .eq(IndustryPlateRes::getPlateId, id)
                         .orderByDesc(IndustryPlateRes::getPlateDate)
-                        .between(IndustryPlateRes::getPlateDate, sunday,monday );
-            }else {
+                        .between(IndustryPlateRes::getPlateDate, sunday, monday);
+            } else {
                 queryWrapper.lambda()
                         .eq(IndustryPlateRes::getPlateId, id)
                         .orderByDesc(IndustryPlateRes::getPlateDate)
@@ -474,14 +476,13 @@ public class SearchServiceImpl implements SearchService {
     }
 
 
-
     public List<IncInfo> toIncInfosPage(Boolean tag, Boolean lastTag, Boolean nextTag, Boolean ifIncDec, SearchInfo searchInfo) {
         IncInfo incInfo;
         List<IncInfo> incInfos = new ArrayList<>();
         // List<IndustryPlate> datePlates = getNewest();
         List<IndustryPlateRes> datePlates = getNewest();
         String date = datePlates.size() > 0 ? datePlates.get(0).getPlateDate() : TestCommon.getWeek();
-        Map<String,Object> actualMap = DateUtils.getFridayOrLastFriday(date);
+        Map<String, Object> actualMap = DateUtils.getFridayOrLastFriday(date);
         String friday = actualMap.get("friday").toString();
         String lastFriday = actualMap.get("lastFriday").toString();
         // 2、去plate查询数据,周五的数据-上周五的数据。根据value倒叙排序,涨幅倒叙 跌幅就是正序。
@@ -489,13 +490,13 @@ public class SearchServiceImpl implements SearchService {
         IPage<IndustryPlate> industryPlateIPage = null;
         if (ifIncDec.equals(true)) {
             // industryPlateIPage = searchIndustryPlate(searchInfo,friday,lastFriday);
-        }else {
+        } else {
             // plates = findIndustryPlate(true, null,friday , lastFriday);
             QueryForm queryForm = new QueryForm();
-            if (DateUtils.checkDate(friday,lastFriday).equals(true)) {
+            if (DateUtils.checkDate(friday, lastFriday).equals(true)) {
                 queryForm.setFriday(lastFriday);
                 queryForm.setLastFriday(friday);
-            }else {
+            } else {
                 queryForm.setFriday(friday);
                 queryForm.setLastFriday(lastFriday);
             }
@@ -506,12 +507,12 @@ public class SearchServiceImpl implements SearchService {
             industryPlateIPage = industryPlateMapper.findIndustryPlate(page, queryForm);
         }
         for (IndustryPlate plate : industryPlateIPage.getRecords()) {
-            Float value = calLastWeekActual(date,plate.getPlateId());
+            Float value = calLastWeekActual(date, plate.getPlateId());
             if (lastTag) {
-                value = calLastWeekPred(date,plate.getPlateId());
+                value = calLastWeekPred(date, plate.getPlateId());
             }
             if (nextTag) {
-                value = calNextWeekPred(date,plate.getPlateId());
+                value = calNextWeekPred(date, plate.getPlateId());
             }
             Boolean industryTag = value > 0.0 ? true : false;
             log.info("plateId:{}", plate.getPlateId());
@@ -574,15 +575,15 @@ public class SearchServiceImpl implements SearchService {
         // List<IndustryPlate> datePlates = getNewest();
         List<IndustryPlateRes> datePlates = getNewest();
         String date = datePlates.size() > 0 ? datePlates.get(0).getPlateDate() : TestCommon.getWeek();
-        Map<String,Object> actualMap = DateUtils.getFridayOrLastFriday(date);
+        Map<String, Object> actualMap = DateUtils.getFridayOrLastFriday(date);
         String friday = actualMap.get("friday").toString();
         String lastFriday = actualMap.get("lastFriday").toString();
         // 2、去plate查询数据,周五的数据-上周五的数据。根据value倒叙排序,涨幅倒叙 跌幅就是正序。
         List<IndustryPlateRes> plates = new ArrayList<>();
         if (ifIncDec.equals(true)) {
-            plates = searchIndustryPlateRes(searchInfo,friday,lastFriday);
-        }else {
-            plates = findIndustryPlateRes(true, null,friday , lastFriday);
+            plates = searchIndustryPlateRes(searchInfo, friday, lastFriday);
+        } else {
+            plates = findIndustryPlateRes(true, null, friday, lastFriday);
         }
 
         // 3、tag涨跌true/false过滤
@@ -604,14 +605,14 @@ public class SearchServiceImpl implements SearchService {
         // 此处去重。
         // List<IndustryPlate> distinctPlatesList = plates.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() ->
         //         new TreeSet<>(Comparator.comparing(t -> t.getPlateId()))), ArrayList::new));
-        log.info("plates:{}",JSON.toJSONString(plates));
+        log.info("plates:{}", JSON.toJSONString(plates));
         for (IndustryPlateRes plate : plates) {
-            Float value = calLastWeekActual(date,plate.getPlateId());
+            Float value = calLastWeekActual(date, plate.getPlateId());
             if (lastTag) {
-                value = calLastWeekPred(date,plate.getPlateId());
+                value = calLastWeekPred(date, plate.getPlateId());
             }
             if (nextTag) {
-                value = calNextWeekPred(date,plate.getPlateId());
+                value = calNextWeekPred(date, plate.getPlateId());
             }
             Boolean industryTag = value > 0.0 ? true : false;
             log.info("plateId:{}", plate.getPlateId());
@@ -664,16 +665,17 @@ public class SearchServiceImpl implements SearchService {
 
     /**
      * 根据行业id或者行业名称进行搜索.
+     *
      * @param searchInfo
      * @param friday
      * @param lastFriday
      * @return
      */
-    public List<IndustryPlate> searchIndustryPlate(SearchInfo searchInfo,String friday,String lastFriday){
+    public List<IndustryPlate> searchIndustryPlate(SearchInfo searchInfo, String friday, String lastFriday) {
         List<IndustryPlate> plates = new ArrayList<>();
         // 涨跌均存在。根据行业id查询进来的。
         QueryWrapper<IndustryPlate> queryWrapper = new QueryWrapper();
-        if (DateUtils.checkDate(friday,lastFriday).equals(true)){
+        if (DateUtils.checkDate(friday, lastFriday).equals(true)) {
             queryWrapper.lambda()
                     .eq(IndustryPlate::getPlateId, searchInfo.getSearchParam())
                     .orderByDesc(IndustryPlate::getPlateDate)
@@ -682,7 +684,7 @@ public class SearchServiceImpl implements SearchService {
                     .last("limit 0,10")
                     .or()
                     .like(IndustryPlate::getPlateName, searchInfo.getSearchParam());
-        }else {
+        } else {
             queryWrapper.lambda()
                     .eq(IndustryPlate::getPlateId, searchInfo.getSearchParam())
                     .orderByDesc(IndustryPlate::getPlateDate)
@@ -693,14 +695,15 @@ public class SearchServiceImpl implements SearchService {
                     .like(IndustryPlate::getPlateName, searchInfo.getSearchParam());
         }
         plates = industryPlateMapper.selectList(queryWrapper);
-        log.info("search plates:{}",JSON.toJSONString(plates));
+        log.info("search plates:{}", JSON.toJSONString(plates));
         return plates;
     }
-    public List<IndustryPlateRes> searchIndustryPlateRes(SearchInfo searchInfo,String friday,String lastFriday){
+
+    public List<IndustryPlateRes> searchIndustryPlateRes(SearchInfo searchInfo, String friday, String lastFriday) {
         List<IndustryPlateRes> plates = new ArrayList<>();
         // 涨跌均存在。根据行业id查询进来的。
         QueryWrapper<IndustryPlateRes> queryWrapper = new QueryWrapper();
-        if (DateUtils.checkDate(friday,lastFriday).equals(true)){
+        if (DateUtils.checkDate(friday, lastFriday).equals(true)) {
             queryWrapper.lambda()
                     .eq(IndustryPlateRes::getPlateId, searchInfo.getSearchParam())
                     .orderByDesc(IndustryPlateRes::getPlateDate)
@@ -709,7 +712,7 @@ public class SearchServiceImpl implements SearchService {
                     .last("limit 0,10")
                     .or()
                     .like(IndustryPlateRes::getPlateName, searchInfo.getSearchParam());
-        }else {
+        } else {
             queryWrapper.lambda()
                     .eq(IndustryPlateRes::getPlateId, searchInfo.getSearchParam())
                     .orderByDesc(IndustryPlateRes::getPlateDate)
@@ -720,7 +723,7 @@ public class SearchServiceImpl implements SearchService {
                     .like(IndustryPlateRes::getPlateName, searchInfo.getSearchParam());
         }
         plates = industryPlateResMapper.selectList(queryWrapper);
-        log.info("search plates:{}",JSON.toJSONString(plates));
+        log.info("search plates:{}", JSON.toJSONString(plates));
         return plates;
     }
 
@@ -735,38 +738,39 @@ public class SearchServiceImpl implements SearchService {
      */
     public List<IndustryPlate> findIndustryPlate(Boolean just, String plateId, String friday, String lastFriday) {
         QueryWrapper<IndustryPlate> industryPlateQueryWrapper = new QueryWrapper<>();
-        if (DateUtils.checkDate(friday,lastFriday).equals(true)){
+        if (DateUtils.checkDate(friday, lastFriday).equals(true)) {
             industryPlateQueryWrapper.between("plate_date", lastFriday, friday);
-        }else {
+        } else {
             industryPlateQueryWrapper.between("plate_date", friday, lastFriday);
         }
         industryPlateQueryWrapper.groupBy("plate_id");
         industryPlateQueryWrapper.isNotNull("plate_id");
         industryPlateQueryWrapper.last("limit 0,10");
         if (just.equals(false)) {
-            if (DateUtils.checkDate(friday,lastFriday).equals(true)){
+            if (DateUtils.checkDate(friday, lastFriday).equals(true)) {
                 industryPlateQueryWrapper.between("plate_date", lastFriday, friday);
-            }else {
+            } else {
                 industryPlateQueryWrapper.between("plate_date", friday, lastFriday);
             }
         }
         List<IndustryPlate> plates = industryPlateMapper.selectList(industryPlateQueryWrapper);
         return plates;
     }
+
     public List<IndustryPlateRes> findIndustryPlateRes(Boolean just, String plateId, String friday, String lastFriday) {
         QueryWrapper<IndustryPlateRes> queryWrapper = new QueryWrapper<>();
-        if (DateUtils.checkDate(friday,lastFriday).equals(true)){
+        if (DateUtils.checkDate(friday, lastFriday).equals(true)) {
             queryWrapper.between("plate_date", lastFriday, friday);
-        }else {
+        } else {
             queryWrapper.between("plate_date", friday, lastFriday);
         }
         queryWrapper.groupBy("plate_id");
         queryWrapper.isNotNull("plate_id");
         queryWrapper.last("limit 0,10");
         if (just.equals(false)) {
-            if (DateUtils.checkDate(friday,lastFriday).equals(true)){
+            if (DateUtils.checkDate(friday, lastFriday).equals(true)) {
                 queryWrapper.between("plate_date", lastFriday, friday);
-            }else {
+            } else {
                 queryWrapper.between("plate_date", friday, lastFriday);
             }
         }
@@ -780,7 +784,7 @@ public class SearchServiceImpl implements SearchService {
      * @param plateId
      * @return
      */
-    public Float calLastWeekActual(String date,String plateId) {
+    public Float calLastWeekActual(String date, String plateId) {
         Map<String, Object> map = DateUtils.getFridayOrLastFriday(date);
         // b本周实际拿的是预测的数据,pred。
         // 上周实际榜:上周周五的close-上上周周五的close
@@ -788,7 +792,7 @@ public class SearchServiceImpl implements SearchService {
         List<IndustryPlate> industryPlates = getClose(plateId, friday);
         String lastFriday = map.get("lastFriday").toString();
         List<IndustryPlate> industryPlatesLast = getClose(plateId, lastFriday);
-        return getCloseValue(industryPlates,industryPlatesLast);
+        return getCloseValue(industryPlates, industryPlatesLast);
     }
 
     /**
@@ -798,32 +802,33 @@ public class SearchServiceImpl implements SearchService {
      * @param plateId
      * @return
      */
-    public Float calLastWeekPred(String date,String plateId) {
+    public Float calLastWeekPred(String date, String plateId) {
         Map<String, Object> map = DateUtils.getFridayOrLastFriday(date);
         String friday = map.get("friday").toString();
         String lastFriday = map.get("lastFriday").toString();
         List<IndustryPlate> industryPlatesLast = getClose(plateId, lastFriday);
         List<IndustryPlate> industryPlates = getClose(plateId, friday);
-        return getPredValue(industryPlates,industryPlatesLast);
+        return getPredValue(industryPlates, industryPlatesLast);
     }
 
     /**
      * 下周预测榜
      * 下周预测:这周周五的pred-上周周五的pred。
-     *  计算方式:下周预测-本周预测啊
+     * 计算方式:下周预测-本周预测啊
+     *
      * @param plateId
      * @return
      */
-    public Float calNextWeekPred(String date,String plateId) {
+    public Float calNextWeekPred(String date, String plateId) {
         Map<String, Object> map = DateUtils.getEverydayOfNexWeek(date);
         String nextFriday = map.get("nextFriday").toString();
         String friday = map.get("friday").toString();
         List<IndustryPlate> industryPlatesNext = getClose(plateId, nextFriday);
         List<IndustryPlate> industryPlates = getClose(plateId, friday);
-        return getPredValue(industryPlatesNext,industryPlates);
+        return getPredValue(industryPlatesNext, industryPlates);
     }
 
-    public Float getCloseValue(List<IndustryPlate> industryPlates,List<IndustryPlate> industryPlatesLast){
+    public Float getCloseValue(List<IndustryPlate> industryPlates, List<IndustryPlate> industryPlatesLast) {
         Float close = industryPlates.size() > 0 ? null != industryPlates.get(0).getPlateClose() ?
                 industryPlates.get(0).getPlateClose() : 0.0F : 0.0F;
         Float lastClose = industryPlatesLast.size() > 0 ? null != industryPlatesLast.get(0).getPlateClose() ?
@@ -832,7 +837,7 @@ public class SearchServiceImpl implements SearchService {
         return GeneralUtils.toFloatByTwo(value);
     }
 
-    public Float getPredValue(List<IndustryPlate> industryPlates,List<IndustryPlate> industryPlatesLast){
+    public Float getPredValue(List<IndustryPlate> industryPlates, List<IndustryPlate> industryPlatesLast) {
         Float pred = industryPlates.size() > 0 ? null != industryPlates.get(0).getPlateClosePred() ?
                 industryPlates.get(0).getPlateClosePred() : 0.0F : 0.0F;
         Float lastPred = industryPlatesLast.size() > 0 ? null != industryPlatesLast.get(0).getPlateClosePred() ?
@@ -873,6 +878,7 @@ public class SearchServiceImpl implements SearchService {
 
     /**
      * 实际榜排序。
+     *
      * @return
      */
     public List<IndustryPlateRes> getNewest() {
@@ -885,6 +891,7 @@ public class SearchServiceImpl implements SearchService {
 
     /**
      * 预测榜排序。
+     *
      * @return
      */
     public List<IndustryPlateRes> getNewestByPred() {
@@ -897,12 +904,13 @@ public class SearchServiceImpl implements SearchService {
 
     /**
      * 涨/跌上周实际榜。
+     *
      * @param incOrDec
      * @return
      */
-    public List<IncInfo> lastWeekActual(Boolean incOrDec){
+    public List<IncInfo> lastWeekActual(Boolean incOrDec) {
         // 1、根据日期倒序拿到数据库中的最新日期
-        Map<String,Object> actualMap = toDate(true);
+        Map<String, Object> actualMap = toDate(true);
         // 1、根据当前日期判断是否是周六,是 本周的和上周的数据。否则上周和上上周的数据。
         // String lastFriday = actualMap.get("friday").toString();
         // String friday = DateUtils.getEverydayByActual(lastFriday).get("MONDAY").toString();
@@ -911,29 +919,29 @@ public class SearchServiceImpl implements SearchService {
         String lastFriday = actualMap.get("lastFriday").toString();
         // 2、查询涨跌幅的实际榜。涨幅 倒叙排序取前十。跌幅 正序排序取前十。根据closeup值。
         List<IndustryPlateRes> plateResList = new ArrayList<>();
-        if (incOrDec.equals(true)){
+        if (incOrDec.equals(true)) {
             // 涨幅。
-            if (DateUtils.checkDate(friday,lastFriday).equals(true)) {
-                plateResList = toActualIncOrDec(incOrDec,lastFriday,friday);
-            }else {
-                plateResList = toActualIncOrDec(incOrDec,friday,lastFriday);
+            if (DateUtils.checkDate(friday, lastFriday).equals(true)) {
+                plateResList = toActualIncOrDec(incOrDec, lastFriday, friday);
+            } else {
+                plateResList = toActualIncOrDec(incOrDec, friday, lastFriday);
             }
 
             // 3、返回数据创建。
             List<IncInfo> incInfos = toBackActualIncInfos(plateResList);
-            List<IncInfo> finalIncInfos = incInfos.stream().filter(s->s.getIndustryValue() > 0.0F)
+            List<IncInfo> finalIncInfos = incInfos.stream().filter(s -> s.getIndustryValue() > 0.0F)
                     .collect(Collectors.toList());
             return finalIncInfos;
-        }else {
-            if (DateUtils.checkDate(friday,lastFriday).equals(true)) {
-                plateResList = toActualIncOrDec(incOrDec,lastFriday,friday);
-            }else {
-                plateResList = toActualIncOrDec(incOrDec,friday,lastFriday);
+        } else {
+            if (DateUtils.checkDate(friday, lastFriday).equals(true)) {
+                plateResList = toActualIncOrDec(incOrDec, lastFriday, friday);
+            } else {
+                plateResList = toActualIncOrDec(incOrDec, friday, lastFriday);
             }
 
             // 3、返回数据创建。
             List<IncInfo> incInfos = toBackActualIncInfos(plateResList);
-            List<IncInfo> finalIncInfos = incInfos.stream().filter(s->s.getIndustryValue() < 0.0F)
+            List<IncInfo> finalIncInfos = incInfos.stream().filter(s -> s.getIndustryValue() < 0.0F)
                     .collect(Collectors.toList());
             return finalIncInfos;
         }
@@ -941,74 +949,136 @@ public class SearchServiceImpl implements SearchService {
 
     /**
      * 取日期。
+     *
      * @return
      */
-    public Map<String,Object> toDate(Boolean actualOrPred){
+    public Map<String, Object> toDate(Boolean actualOrPred) {
         // 1、根据日期倒序拿到数据库中的最新日期
         List<IndustryPlateRes> datePlates = new ArrayList<>();
-        if (actualOrPred.equals(true)){
+        if (actualOrPred.equals(true)) {
             // 实际
             datePlates = getNewest();
-        }else {
+        } else {
             // 预测
             datePlates = getNewestByPred();
         }
         String date = datePlates.size() > 0 ? datePlates.get(0).getPlateDate() : TestCommon.getWeek();
-        log.info("sql 最新日期:{}",date);
+        log.info("sql 最新日期:{}", date);
         // 1.1 根据当前日期判断是否是周六,是 本周的和上周的数据。否则上周和上上周的数据。
-        Map<String,Object> actualMap = DateUtils.getFridayOrLastFriday(date);
+        Map<String, Object> actualMap = DateUtils.getFridayOrLastFriday(date);
         return actualMap;
     }
 
+    /**
+     * 根据行业id进行搜索获取最新日期,上周五的减去上上周五的。
+     *
+     * @param palteId
+     * @return
+     */
+    public Map<String, Object> toDateBySearch(String palteId) {
+        // 1、根据日期倒序拿到数据库中的最新日期
+        List<IndustryPlateRes> datePlates = new ArrayList<>();
+        // 实际
+        QueryWrapper<IndustryPlateRes> industryPlateResQueryWrapper = new QueryWrapper<>();
+        industryPlateResQueryWrapper.lambda()
+                .orderByDesc(IndustryPlateRes::getPlateDate)
+                .isNotNull(IndustryPlateRes::getPlateClose)
+                // .eq(IndustryPlateRes::getPlateDate,friday)
+                .last("limit 0,10")
+                .and(true, wrapper -> wrapper.like(IndustryPlateRes::getPlateId, palteId)
+                        .or()
+                        .like(IndustryPlateRes::getPlateName, palteId));
+        datePlates = industryPlateResMapper.selectList(industryPlateResQueryWrapper);
+        String date = datePlates.size() > 0 ? datePlates.get(0).getPlateDate() : TestCommon.getWeek();
+        log.info("sql 最新日期:{}", date);
+        // 1.1 根据当前日期判断是否是周六,是 本周的和上周的数据。否则上周和上上周的数据。
+        Map<String, Object> actualMap = DateUtils.getFridayOrLastFriday(date);
+        return actualMap;
+    }
+
+
     /**
      * 涨跌实际榜查询函数。
+     *
      * @param incOrDec
      * @param friday
      * @param lastFriday
      * @return
      */
-    public List<IndustryPlateRes> toActualIncOrDec(Boolean incOrDec,String friday,String lastFriday){
+    public List<IndustryPlateRes> toActualIncOrDec(Boolean incOrDec, String friday, String lastFriday) {
         QueryWrapper<IndustryPlateRes> queryWrapper = new QueryWrapper<>();
-        if (incOrDec.equals(true)){
+        if (incOrDec.equals(true)) {
             // 涨幅
             queryWrapper.lambda()
                     .orderByDesc(IndustryPlateRes::getPlateCloseUp)
                     .groupBy(IndustryPlateRes::getPlateId)
-                    .between(IndustryPlateRes::getPlateDate,friday,lastFriday)
+                    // todo 记得修改。
+                    .between(IndustryPlateRes::getPlateDate, friday, lastFriday)
                     .last("limit 0,10");
-        }else {
+        } else {
             queryWrapper.lambda()
                     .orderByAsc(IndustryPlateRes::getPlateCloseUp)
                     .groupBy(IndustryPlateRes::getPlateId)
-                    .between(IndustryPlateRes::getPlateDate,friday,lastFriday)
+                    // todo 记得修改。
+                    .between(IndustryPlateRes::getPlateDate, friday, lastFriday)
                     .last("limit 0,10");
         }
         List<IndustryPlateRes> plates = industryPlateResMapper.selectList(queryWrapper);
-        log.info("toActualIncOrDec plates:{}",JSON.toJSONString(plates));
+        log.info("toActualIncOrDec plates:{}", JSON.toJSONString(plates));
+        return plates;
+    }
+
+    /**
+     * 求实际榜,按照日期倒序排序。
+     *
+     * @param incOrDec
+     * @param friday
+     * @param lastFriday
+     * @return
+     */
+    public List<IndustryPlateRes> toIncOrDecByActual(Boolean incOrDec, String friday, String lastFriday) {
+        QueryWrapper<IndustryPlateRes> queryWrapper = new QueryWrapper<>();
+        if (incOrDec.equals(true)) {
+            // 涨幅
+            queryWrapper.lambda()
+                    .orderByDesc(IndustryPlateRes::getPlateDate)
+                    .orderByDesc(IndustryPlateRes::getPlateCloseUp)
+                    .groupBy(IndustryPlateRes::getPlateId)
+                    .last("limit 0,10");
+        } else {
+            queryWrapper.lambda()
+                    .orderByDesc(IndustryPlateRes::getPlateDate)
+                    .orderByAsc(IndustryPlateRes::getPlateCloseUp)
+                    .groupBy(IndustryPlateRes::getPlateId)
+                    .last("limit 0,10");
+        }
+        List<IndustryPlateRes> plates = industryPlateResMapper.selectList(queryWrapper);
+        log.info("toIncOrDecByActual plates:{}", JSON.toJSONString(plates));
         return plates;
     }
 
     /**
      * 周预测:上周或者下周预测
+     *
      * @param lastOrNext
      * @return
      */
-    public List<IncInfo> weekPred(Boolean incOrDec,Boolean lastOrNext){
+    public List<IncInfo> weekPred(Boolean incOrDec, Boolean lastOrNext) {
         // 1、根据日期倒序拿到数据库中的最新日期
         List<IndustryPlateRes> datePlates = getNewestByPred();
         String date = datePlates.size() > 0 ? datePlates.get(0).getPlateDate() : TestCommon.getWeek();
         // 2、检索出符合要求的数据。
         List<IndustryPlateRes> plates = new ArrayList<>();
-        if(lastOrNext.equals(true)){
+        if (lastOrNext.equals(true)) {
             log.info("上周预测...");
             // 上周预测。
             Map<String, Object> map = DateUtils.getFridayOrLastFriday(date);
             String friday = map.get("friday").toString();
             String lastFriday = map.get("lastFriday").toString();
-            if (DateUtils.checkDate(friday,lastFriday).equals(true)) {
-                plates = toPredLastOrNext(incOrDec,lastFriday,friday);
-            }else {
-                plates = toPredLastOrNext(incOrDec,friday,lastFriday);
+            if (DateUtils.checkDate(friday, lastFriday).equals(true)) {
+                plates = toPredLastOrNext(incOrDec, lastFriday, friday);
+            } else {
+                plates = toPredLastOrNext(incOrDec, friday, lastFriday);
             }
 
             // todo 需要修改。
@@ -1016,15 +1086,15 @@ public class SearchServiceImpl implements SearchService {
             // String friday = DateUtils.getEverydayByActual(lastFriday).get("MONDAY").toString();
             // plates = toPredLastOrNext(incOrDec,friday,lastFriday);
 
-        }else {
+        } else {
             log.info("下周预测...");
             Map<String, Object> map = DateUtils.getEverydayOfNexWeek(date);
             String friday = map.get("friday").toString();
             String nextFriday = map.get("nextFriday").toString();
-            if (DateUtils.checkDate(friday,nextFriday).equals(true)) {
-                plates = toPredLastOrNext(incOrDec,nextFriday,friday);
-            }else {
-                plates = toPredLastOrNext(incOrDec,friday,nextFriday);
+            if (DateUtils.checkDate(friday, nextFriday).equals(true)) {
+                plates = toPredLastOrNext(incOrDec, nextFriday, friday);
+            } else {
+                plates = toPredLastOrNext(incOrDec, friday, nextFriday);
             }
             // todo 需要修改。
             // String lastFriday = map.get("nextFriday").toString();
@@ -1032,15 +1102,15 @@ public class SearchServiceImpl implements SearchService {
             // plates = toPredLastOrNext(incOrDec,friday,lastFriday);
         }
         // 3、创建返回值。
-        if (incOrDec.equals(true)){
+        if (incOrDec.equals(true)) {
             // 3、创建返回值。
             List<IncInfo> incInfos = toBackPredIncInfos(plates);
-            List<IncInfo> finalIncInfos = incInfos.stream().filter(s->s.getIndustryValue() > 0.0F)
+            List<IncInfo> finalIncInfos = incInfos.stream().filter(s -> s.getIndustryValue() > 0.0F)
                     .collect(Collectors.toList());
             return finalIncInfos;
-        }else {
+        } else {
             List<IncInfo> incInfos = toBackPredIncInfos(plates);
-            List<IncInfo> finalIncInfos = incInfos.stream().filter(s->s.getIndustryValue() < 0.0F)
+            List<IncInfo> finalIncInfos = incInfos.stream().filter(s -> s.getIndustryValue() < 0.0F)
                     .collect(Collectors.toList());
             return finalIncInfos;
         }
@@ -1048,11 +1118,12 @@ public class SearchServiceImpl implements SearchService {
 
     /**
      * 返回信息创建实际榜接口。
-     // * @param incOrDec 涨幅跌幅
+     * // * @param incOrDec 涨幅跌幅
+     *
      * @param plates 列表。
      * @return
      */
-    public List<IncInfo> toBackActualIncInfos(List<IndustryPlateRes> plates){
+    public List<IncInfo> toBackActualIncInfos(List<IndustryPlateRes> plates) {
         // 3、返回数据创建。
         IncInfo incInfo;
         List<IncInfo> incInfos = new ArrayList<>();
@@ -1071,12 +1142,14 @@ public class SearchServiceImpl implements SearchService {
         }
         return incInfos;
     }
+
     /**
      * 返回信息创建预测榜接口。
+     *
      * @param plates 列表。
      * @return
      */
-    public List<IncInfo> toBackPredIncInfos(List<IndustryPlateRes> plates){
+    public List<IncInfo> toBackPredIncInfos(List<IndustryPlateRes> plates) {
         // 3、返回数据创建。
         IncInfo incInfo;
         List<IncInfo> incInfos = new ArrayList<>();
@@ -1099,70 +1172,56 @@ public class SearchServiceImpl implements SearchService {
 
     /**
      * 涨跌预测榜:上周or下周。函数。
+     *
      * @param incOrDec
      * @param friday
      * @param lastFriday
      * @return
      */
-    public List<IndustryPlateRes> toPredLastOrNext(Boolean incOrDec,String friday,String lastFriday){
+    public List<IndustryPlateRes> toPredLastOrNext(Boolean incOrDec, String friday, String lastFriday) {
         QueryWrapper<IndustryPlateRes> queryWrapper = new QueryWrapper<>();
-        if (incOrDec.equals(true)){
+        if (incOrDec.equals(true)) {
             // 涨幅
-            if (DateUtils.checkDate(friday,lastFriday).equals(true)) {
-                queryWrapper.lambda()
-                        .between(IndustryPlateRes::getPlateDate,lastFriday,friday)
-                        .orderByDesc(IndustryPlateRes::getPlateClosePredUp)
-                        .groupBy(IndustryPlateRes::getPlateId)
-                        .last("limit 0,10");
-            }else {
-                queryWrapper.lambda()
-                        .between(IndustryPlateRes::getPlateDate,friday,lastFriday)
-                        .orderByDesc(IndustryPlateRes::getPlateClosePredUp)
-                        .groupBy(IndustryPlateRes::getPlateId)
-                        .last("limit 0,10");
-            }
-        }else {
-            if (DateUtils.checkDate(friday,lastFriday).equals(true)) {
-                queryWrapper.lambda()
-                        .between(IndustryPlateRes::getPlateDate,lastFriday,friday)
-                        .orderByAsc(IndustryPlateRes::getPlateClosePredUp)
-                        .groupBy(IndustryPlateRes::getPlateId)
-                        .last("limit 0,10");
-            }else {
-                queryWrapper.lambda()
-                        .between(IndustryPlateRes::getPlateDate,friday,lastFriday)
-                        .orderByAsc(IndustryPlateRes::getPlateClosePredUp)
-                        .groupBy(IndustryPlateRes::getPlateId)
-                        .last("limit 0,10");
-            }
+            queryWrapper.lambda()
+                    .between(IndustryPlateRes::getPlateDate, friday, lastFriday)
+                    .orderByDesc(IndustryPlateRes::getPlateClosePredUp)
+                    .groupBy(IndustryPlateRes::getPlateId)
+                    .last("limit 0,10");
+        } else {
+            queryWrapper.lambda()
+                    .between(IndustryPlateRes::getPlateDate, friday, lastFriday)
+                    .orderByAsc(IndustryPlateRes::getPlateClosePredUp)
+                    .groupBy(IndustryPlateRes::getPlateId)
+                    .last("limit 0,10");
         }
         List<IndustryPlateRes> plates = industryPlateResMapper.selectList(queryWrapper);
-        log.info("toPredLastOrNext plates:{}",JSON.toJSONString(plates));
+        log.info("toPredLastOrNext plates:{}", JSON.toJSONString(plates));
         return plates;
     }
 
     /**
      * 沪深数据获取接口。
+     *
      * @return
      */
-    public IndustryDetailsInfo toHisHushenSum(){
+    public IndustryDetailsInfo toHisHushenSum() {
         QueryWrapper<IndustryPlateSum> industryPlateQueryWrapper = new QueryWrapper<>();
         industryPlateQueryWrapper.lambda()
                 .orderByDesc(IndustryPlateSum::getPlateDate)
                 .last("limit 0,5");
         List<IndustryPlateSum> industryPlateSums = industryPlateSumMapper.selectList(industryPlateQueryWrapper);
         String date = industryPlateSums.size() > 0 ? industryPlateSums.get(0).getPlateDate() : TestCommon.getWeek();
-        Map<String,Object> weekMap = DateUtils.getEverydayByActual(date);
+        Map<String, Object> weekMap = DateUtils.getEverydayByActual(date);
         String monday = weekMap.get("MONDAY").toString();
         String sunday = weekMap.get("SUNDAY").toString();
         List<IndustryPlateSum> plateSums = toPlateSums(monday, sunday);
-        log.info("沪深 实际:{}",JSON.toJSONString(plateSums));
+        log.info("沪深 实际:{}", JSON.toJSONString(plateSums));
 
         Map<String, Object> nextWeekMap = DateUtils.getEverydayOfNexWeek(date);
         String nextMonday = nextWeekMap.get("monday").toString();
         String nextSunday = nextWeekMap.get("sunday").toString();
         List<IndustryPlateSum> nextPlatesNums = toPlateSums(nextMonday, nextSunday);
-        log.info("沪深 预测:{}",JSON.toJSONString(nextPlatesNums));
+        log.info("沪深 预测:{}", JSON.toJSONString(nextPlatesNums));
 
         List<IndustryDetail> industryDetails = new ArrayList<>();
         List<IndustryDetail> nextIndustryDetails = new ArrayList<>();
@@ -1226,23 +1285,25 @@ public class SearchServiceImpl implements SearchService {
 
         // return industryDetails;
     }
+
     /**
      * 沪深接口查询函数。
+     *
      * @param monday
      * @param sunday
      * @return
      */
-    public List<IndustryPlateSum> toPlateSums(String monday,String sunday){
+    public List<IndustryPlateSum> toPlateSums(String monday, String sunday) {
         QueryWrapper<IndustryPlateSum> industryPlateQueryWrapper = new QueryWrapper<>();
-        if (DateUtils.checkDate(monday,sunday).equals(true)) {
+        if (DateUtils.checkDate(monday, sunday).equals(true)) {
             industryPlateQueryWrapper.lambda()
                     .orderByDesc(IndustryPlateSum::getPlateDate)
-                    .between(IndustryPlateSum::getPlateDate,sunday,monday)
+                    .between(IndustryPlateSum::getPlateDate, sunday, monday)
                     .last("limit 0,5");
-        }else {
+        } else {
             industryPlateQueryWrapper.lambda()
                     .orderByDesc(IndustryPlateSum::getPlateDate)
-                    .between(IndustryPlateSum::getPlateDate,monday,sunday)
+                    .between(IndustryPlateSum::getPlateDate, monday, sunday)
                     .last("limit 0,5");
         }
 
@@ -1252,10 +1313,11 @@ public class SearchServiceImpl implements SearchService {
 
     /**
      * 初始化沪深接口函数。
+     *
      * @param nextPlatesNum
      * @return
      */
-    public IndustryDetail initDetail(IndustryPlateSum nextPlatesNum){
+    public IndustryDetail initDetail(IndustryPlateSum nextPlatesNum) {
         IndustryDetail industryDetail = IndustryDetail.builder()
                 .industryId(nextPlatesNum.getId())
                 .industryDate(nextPlatesNum.getPlateDate())
@@ -1267,32 +1329,35 @@ public class SearchServiceImpl implements SearchService {
 
     /**
      * 根据行业id或者行业名称查询接口。
+     *
      * @param searchInfo
      * @return
      */
-    public List<IncInfo> toSearch(SearchInfo searchInfo){
+    public List<IncInfo> toSearch(SearchInfo searchInfo) {
         // 1、根据日期倒序拿到数据库中的最新日期
-        Map<String,Object> actualMap = toDate(true);
-        // 1、根据当前日期判断是否是周六,是 本周的和上周的数据。否则上周和上上周的数据。
-        String friday = actualMap.get("friday").toString();
-        String lastFriday = actualMap.get("lastFriday").toString();
+        // Map<String, Object> actualMap = toDateBySearch(searchInfo.getSearchParam());
+        // // 1、根据当前日期判断是否是周六,是 本周的和上周的数据。否则上周和上上周的数据。
+        // String friday = actualMap.get("friday").toString();
+        // String lastFriday = actualMap.get("lastFriday").toString();
         // 2、查询涨跌幅。取前十。
-        List<IndustryPlateRes> plates = new ArrayList<>();
-        if (DateUtils.checkDate(friday,lastFriday).equals(true)) {
-            plates = toSearchQuery(searchInfo,lastFriday,friday);
-        }else {
-            plates = toSearchQuery(searchInfo,friday,lastFriday);
-        }
-        // 热点搜索数据更新。
-        newsService.searchCount(searchInfo.getSearchParam(),searchInfo.getSearchParam());
+        // List<IndustryPlateRes> plates = new ArrayList<>();
+        // if (DateUtils.checkDate(friday, lastFriday).equals(true)) {
+        //     plates = toSearchQuery(searchInfo, lastFriday, friday);
+        // } else {
+        //     plates = toSearchQuery(searchInfo, friday, lastFriday);
+        // }
+        List<IndustryPlateRes> plates = plates = toSearchQuery(searchInfo, "", "");
+                // 热点搜索数据更新。
+        newsService.searchCount(searchInfo.getSearchParam(), searchInfo.getSearchParam());
 
         // 3、创建返回s数据。
         return toSearchBackIncInfos(plates);
-
     }
 
+
     /**
      * 创建返回函数。
+     *
      * @param plates
      * @return
      */
@@ -1317,56 +1382,37 @@ public class SearchServiceImpl implements SearchService {
 
     /**
      * 根据行业id或者行业名称查询函数
+     *
      * @param searchInfo
      * @param friday
      * @param lastFriday
      * @return
      */
-    public List<IndustryPlateRes> toSearchQuery(SearchInfo searchInfo,String friday,String lastFriday){
+    public List<IndustryPlateRes> toSearchQuery(SearchInfo searchInfo, String friday, String lastFriday) {
         QueryWrapper<IndustryPlateRes> queryWrapper = new QueryWrapper<>();
         // 涨幅
         queryWrapper.lambda()
                 .orderByDesc(IndustryPlateRes::getPlateDate)
                 .groupBy(IndustryPlateRes::getPlateId)
-                .between(IndustryPlateRes::getPlateDate,friday,lastFriday)
+                // .between(IndustryPlateRes::getPlateDate, friday, lastFriday)
                 // .eq(IndustryPlateRes::getPlateDate,friday)
                 .last("limit 0,10")
-                .or()
-                .like(IndustryPlateRes::getPlateId,searchInfo.getSearchParam())
-                .or()
-                .like(IndustryPlateRes::getPlateName,searchInfo.getSearchParam());
+                .and(true, wrapper -> wrapper.like(IndustryPlateRes::getPlateId, searchInfo.getSearchParam())
+                        .or()
+                        .like(IndustryPlateRes::getPlateName, searchInfo.getSearchParam()));
         List<IndustryPlateRes> plates = industryPlateResMapper.selectList(queryWrapper);
-        // List<IndustryPlateRes> plates = industryPlateResMapper.selectList(queryWrapper);
-        // List<IndustryPlateRes> plates = new ArrayList<>();
-        // if (DateUtils.checkDate(friday,lastFriday).equals(true)) {
-        //     QueryForm queryForm = QueryForm.builder()
-        //             .plateId(searchInfo.getSearchParam())
-        //             .plateName(searchInfo.getSearchParam())
-        //             .friday(lastFriday)
-        //             .lastFriday(friday)
-        //             .build();
-        //     plates = industryPlateResMapper.findPlateByIdOrName(queryForm);
-        // }else {
-        //     QueryForm queryForm = QueryForm.builder()
-        //             .plateId(searchInfo.getSearchParam())
-        //             .plateName(searchInfo.getSearchParam())
-        //             .friday(friday)
-        //             .lastFriday(lastFriday)
-        //             .build();
-        //     plates = industryPlateResMapper.findPlateByIdOrName(queryForm);
-        // }
-
-
-        log.info("toSearchQuery plates:{}",JSON.toJSONString(plates));
+        log.info("toSearchQuery plates:{}", JSON.toJSONString(plates));
         return plates;
     }
+
     /**
      * 根据行业id进入详情。
+     *
      * @param ids
      * @param detailsFlag
      * @return
      */
-    public IndustryDetailsInfo toFindDetailsByPlateId(List<String> ids,Boolean detailsFlag){
+    public IndustryDetailsInfo toFindDetailsByPlateId(List<String> ids, Boolean detailsFlag) {
         // todo 根据id进入详情,计算值。包含下周预测。
         List<IndustryDetail> industryDetails = new ArrayList<>();
         for (String id : ids) {
@@ -1402,14 +1448,14 @@ public class SearchServiceImpl implements SearchService {
                         industryDetails.add(toInitIndustryDetail(nextIndustryPlate));
                     }
                 }
-                if (nextIndustryPlates.size() > 0 && detailsFlag.equals(true)){
+                if (nextIndustryPlates.size() > 0 && detailsFlag.equals(true)) {
                     // 创建detail列表
                     log.info("实际:{}", JSON.toJSONString(industryPlates));
                     for (IndustryPlateRes industryPlate : industryPlates) {
                         industryDetails.add(toInitIndustryDetail(industryPlate));
                     }
                 }
-                if (detailsFlag.equals(false)){
+                if (detailsFlag.equals(false)) {
                     // 创建detail列表
                     log.info("实际:{}", JSON.toJSONString(industryPlates));
                     for (IndustryPlateRes industryPlate : industryPlates) {