Ver código fonte

1、新闻新增新闻情绪指数。

jessie 5 anos atrás
pai
commit
7a3eda32d6

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

@@ -12,6 +12,11 @@ public class Constants {
     public static final String CONCETPT_NODE = "Concept";
     public static final String KWYWORD_NODE = "KeyWord";
 
+
+    public static final String Z_TAG = "利好";
+    public static final String D_TAG = "利空";
+    public static final String W_TAG = "无情绪";
+
     /**
      * 分页个数。
      */

+ 19 - 10
src/main/java/com/pavis/ai/app/fda/controller/HisController.java

@@ -49,17 +49,8 @@ public class HisController {
         return ResultBody.ok().data(hisService.predictFind(findDetails));
     }
 
-
-    @ApiOperation("沪深接口")
-    @ApiOperationSupport(order = 3)
-    @GetMapping("/his/hushen")
-    public ResultBody closeHushenSum() {
-        // 查询最近的close的sum和pred_close的值。
-        return ResultBody.ok().data(hisService.hisHushenSum());
-    }
-
     @ApiOperation("根据行业id或者行业名称搜索")
-    @ApiOperationSupport(order = 4)
+    @ApiOperationSupport(order = 3)
     @PostMapping("/news/search")
     public ResultBody search(@RequestBody SearchInfo searchInfo){
         // 若板块代码,则直接返回hisInfos;若否,则查找数据库后获取id,得到hisInfos。
@@ -67,4 +58,22 @@ public class HisController {
         // 搜索一次,记录一次,热点的id。这里指行业id或行业名称。
         return ResultBody.ok().data(hisService.search(searchInfo));
     }
+
+    @ApiOperation("上证接口")
+    @ApiOperationSupport(order = 4)
+    @GetMapping("/his/hz")
+    public ResultBody closeShangSum() {
+        // 查询最近的close的sum和pred_close的值。
+        return ResultBody.ok().data(hisService.hisShangSum());
+    }
+
+    @ApiOperation("深证接口")
+    @ApiOperationSupport(order = 5)
+    @GetMapping("/his/sz")
+    public ResultBody closeShenSum() {
+        // 查询最近的close的sum和pred_close的值。
+        return ResultBody.ok().data(hisService.hisShenSum());
+    }
+
+
 }

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

@@ -34,6 +34,7 @@ public class NewsController {
     @ApiOperationSupport(order = 1)
     @GetMapping("/news/list")
     public ResultBody newsList(Long currPage){
+        log.info("新闻列表:" + currPage);
         // return ResultBody.ok().data(newsService.newsList());
         return ResultBody.ok().data(newsService.newsListByPage(currPage));
     }

+ 1 - 0
src/main/java/com/pavis/ai/app/fda/form/news/NewsList.java

@@ -60,4 +60,5 @@ public class NewsList {
      * 新闻情绪指数
      */
     private String newsTag;
+
 }

+ 1 - 0
src/main/java/com/pavis/ai/app/fda/mapper/IndustryPlateResMapper.java

@@ -48,4 +48,5 @@ public interface IndustryPlateResMapper extends BaseMapper<IndustryPlateRes> {
     IPage<IndustryPlateRes> pageByIncPredNextPlate(Page<IndustryPlateRes> page,@Param("params") QueryForm params);
     IPage<IndustryPlateRes> pageByDecPredNextPlate(Page<IndustryPlateRes> page,@Param("params") QueryForm params);
 
+    List<IndustryPlateRes> selActualPlateByPlateId(@Param("params") QueryForm params);
 }

+ 5 - 0
src/main/java/com/pavis/ai/app/fda/model/IndustryInfo.java

@@ -28,6 +28,11 @@ public class IndustryInfo {
      */
     private String plateName;
 
+    /**
+     * 股票类型。
+     */
+    private String type;
+
     /**
      * 股票ID
      */

+ 5 - 0
src/main/java/com/pavis/ai/app/fda/model/IndustryPlate.java

@@ -29,6 +29,11 @@ public class IndustryPlate {
      */
     private String plateName;
 
+    /**
+     * 股票类型。
+     */
+    private String type;
+
     /**
      * 时间
      */

+ 5 - 0
src/main/java/com/pavis/ai/app/fda/model/IndustryPlateSum.java

@@ -33,6 +33,11 @@ public class IndustryPlateSum {
      */
     private Float plateClosePred;
 
+    /**
+     * 股票类型。
+     */
+    private String type;
+
     /**
      * 其他
      */

+ 0 - 1
src/main/java/com/pavis/ai/app/fda/model/NewsInfo.java

@@ -59,7 +59,6 @@ public class NewsInfo {
      * 新闻情绪指数
      */
     private String newsTag;
-
     /**
      * 其他
      */

+ 7 - 2
src/main/java/com/pavis/ai/app/fda/service/HisService.java

@@ -16,10 +16,15 @@ import java.util.List;
 public interface HisService {
 
     /**
-     * 沪深接口。
+     * 上证接口。
      * @return
      */
-    IndustryDetailsInfo hisHushenSum();
+    IndustryDetailsInfo hisShangSum();
+    /**
+     * 深证接口。
+     * @return
+     */
+    IndustryDetailsInfo hisShenSum();
 
     /**
      * 根据行业id进入详情接口

+ 2 - 0
src/main/java/com/pavis/ai/app/fda/service/NewsService.java

@@ -52,4 +52,6 @@ public interface NewsService {
     void searchCount(String plateId, String plateName);
 
     List<NewsList> getNewsByPlateId(String plateId);
+
+    String newsTag(String tag);
 }

+ 23 - 1
src/main/java/com/pavis/ai/app/fda/service/impl/FollowServiceImpl.java

@@ -11,6 +11,7 @@ import com.pavis.ai.app.fda.form.TestCommon;
 import com.pavis.ai.app.fda.form.follow.FollowDetails;
 import com.pavis.ai.app.fda.form.follow.Follower;
 import com.pavis.ai.app.fda.form.inc.IncInfo;
+import com.pavis.ai.app.fda.form.sel.QueryForm;
 import com.pavis.ai.app.fda.mapper.FollowInfoMapper;
 import com.pavis.ai.app.fda.mapper.IndustryPlateMapper;
 import com.pavis.ai.app.fda.mapper.IndustryPlateResMapper;
@@ -162,7 +163,27 @@ public class FollowServiceImpl implements FollowService {
         pageMap.put("size", followIPage.getSize());
         pageMap.put("total", followIPage.getTotal());
         pageMap.put("pages", followIPage.getPages());
-        pageMap.put("incInfos", followInfos);
+        IncInfo incInfo;
+        List<IncInfo> incInfos = new ArrayList<>();
+        for (FollowInfo followInfo : followInfos) {
+            QueryWrapper<IndustryPlateRes> queryWrapper = new QueryWrapper<>();
+            queryWrapper.lambda()
+                    .orderByDesc(IndustryPlateRes::getPlateDate)
+                    .eq(IndustryPlateRes::getPlateId,followInfo.getPlateId());
+            QueryForm queryForm = QueryForm.builder().plateId(followInfo.getPlateId()).build();
+            List<IndustryPlateRes> industryPlateRes = industryPlateResMapper.selActualPlateByPlateId(queryForm);
+            Float value = industryPlateRes.size() > 0 ? industryPlateRes.get(0).getPlateCloseUpPercent() : 0.0F;
+            Boolean tag = value > 0.0 ? true : false;
+            incInfo = IncInfo.builder()
+                    .industryId(followInfo.getPlateId())
+                    .industryName(followInfo.getPlateName())
+                    .industryValue(GeneralUtils.toFloatByTwo(value))
+                    .industryTag(tag)
+                    .build();
+            incInfos.add(incInfo);
+        }
+        System.err.println("我的关注:"+JSON.toJSONString(incInfos));
+        pageMap.put("incInfos", incInfos);
         return pageMap;
     }
 
@@ -182,6 +203,7 @@ public class FollowServiceImpl implements FollowService {
         List<IndustryPlate> industryPlatesLast = getClose(plateId, lastFriday);
         return getCloseValue(industryPlates, industryPlatesLast);
     }
+
     /**
      * 获取N周五的收盘价。
      *

+ 15 - 8
src/main/java/com/pavis/ai/app/fda/service/impl/HisServiceImpl.java

@@ -56,8 +56,13 @@ public class HisServiceImpl implements HisService {
     private IndustryPlateSumMapper industryPlateSumMapper;
 
     @Override
-    public IndustryDetailsInfo hisHushenSum() {
-        return toHisHushenSum();
+    public IndustryDetailsInfo hisShangSum() {
+        return toHisHushenSum("hz");
+    }
+
+    @Override
+    public IndustryDetailsInfo hisShenSum() {
+        return toHisHushenSum("sz");
     }
 
     /**
@@ -340,9 +345,10 @@ public class HisServiceImpl implements HisService {
      * 沪深数据获取接口。
      * @return
      */
-    public IndustryDetailsInfo toHisHushenSum() {
+    public IndustryDetailsInfo toHisHushenSum(String param) {
         QueryWrapper<IndustryPlateSum> industryPlateQueryWrapper = new QueryWrapper<>();
         industryPlateQueryWrapper.lambda()
+                .eq(IndustryPlateSum::getType,param)
                 .orderByDesc(IndustryPlateSum::getPlateDate);
         List<IndustryPlateSum> industryPlateSums = industryPlateSumMapper.selectList(industryPlateQueryWrapper);
         // 1、获取最新的5个行业的日期。
@@ -356,9 +362,9 @@ public class HisServiceImpl implements HisService {
         // 2。1、沪深实际数据。
         List<IndustryPlateSum> plateSums = new ArrayList<>();
         if (DateUtils.checkDate(month, nearlyMonth).equals(true)) {
-            plateSums = toActualPlateSums(nearlyMonth, month);
+            plateSums = toActualPlateSums(param,nearlyMonth, month);
         }else {
-            plateSums = toActualPlateSums(month, nearlyMonth);
+            plateSums = toActualPlateSums(param,month, nearlyMonth);
         }
         log.info("沪深 实际:{}", JSON.toJSONString(plateSums));
         Map<String, Object> nextWeekMap = DateUtils.getEverydayOfNexWeek(date);
@@ -367,9 +373,9 @@ public class HisServiceImpl implements HisService {
         // 2.2、沪深预测数据。
         List<IndustryPlateSum> nextPlatesNums = new ArrayList<>();
         if (DateUtils.checkDate(nextMonday, nextSunday).equals(true)) {
-            nextPlatesNums = toActualPlateSums(nextSunday, nextMonday);
+            nextPlatesNums = toActualPlateSums(param,nextSunday, nextMonday);
         }else {
-            nextPlatesNums = toActualPlateSums(nextMonday, nextSunday);
+            nextPlatesNums = toActualPlateSums(param,nextMonday, nextSunday);
         }
         log.info("沪深 预测:{}", JSON.toJSONString(nextPlatesNums));
         // 3、构造返回数据。
@@ -406,9 +412,10 @@ public class HisServiceImpl implements HisService {
      * @param sunday
      * @return
      */
-    public List<IndustryPlateSum> toActualPlateSums(String monday, String sunday) {
+    public List<IndustryPlateSum> toActualPlateSums(String param,String monday, String sunday) {
         QueryWrapper<IndustryPlateSum> industryPlateQueryWrapper = new QueryWrapper<>();
         industryPlateQueryWrapper.lambda()
+                .eq(IndustryPlateSum::getType,param)
                 .orderByDesc(IndustryPlateSum::getPlateDate)
                 .between(IndustryPlateSum::getPlateDate, monday, sunday);
                 // .last("limit 0,5");

+ 23 - 1
src/main/java/com/pavis/ai/app/fda/service/impl/NewsServiceImpl.java

@@ -93,6 +93,7 @@ public class NewsServiceImpl implements NewsService {
             newsList = new NewsList();
             BeanUtils.copyProperties(newsInfo, newsList);
             newsList.setNewsUrl(dealUrl(newsInfo.getNewsUrl()));
+            newsList.setNewsTag(newsTag(newsInfo.getNewsTag()));
             newsLists.add(newsList);
         }
         List<NewsList> newsSortList = newsLists.stream()
@@ -182,6 +183,24 @@ public class NewsServiceImpl implements NewsService {
     }
 
 
+    /**
+     * 新闻情绪指数。
+     * @param tag
+     * @return
+     */
+    @Override
+    public String newsTag(String tag){
+        if (tag.equals("1")){
+            return Constants.Z_TAG;
+        }else if (tag.equals("0")){
+            return Constants.W_TAG;
+        }else if (tag.equals("-1")){
+            return Constants.D_TAG;
+        }
+        return "-";
+    }
+
+
     /**
      * 解析图片url。
      * @param newsUrl
@@ -218,7 +237,7 @@ public class NewsServiceImpl implements NewsService {
                 .newsMiniContent(newsMiniContent)
                 .newsContent(newsContent)
                 .newsDate(newsDate)
-                .newsTag(newsTag)
+                .newsTag(newsTag(newsTag))
                 .operator("ghj")
                 .operatorId("sid941007")
                 .operateTime(DateUtils.getCurrentTime())
@@ -242,6 +261,7 @@ public class NewsServiceImpl implements NewsService {
             BeanUtils.copyProperties(newsInfo, newsList);
             newsList.setNewsUrl(dealUrl(newsInfo.getNewsUrl()));
             newsList.setNewsContent(newsInfo.getNewsContent());
+            newsList.setNewsTag(newsTag(newsInfo.getNewsTag()));
             newsLists.add(newsList);
         }
         List<NewsList> newsSortList = newsLists.stream()
@@ -249,4 +269,6 @@ public class NewsServiceImpl implements NewsService {
                 .collect(Collectors.toList());
         return newsSortList;
     }
+
+
 }

+ 8 - 3
src/main/resources/application-test.yml

@@ -1,6 +1,6 @@
 spring:
   datasource:
-    url: jdbc:mysql://192.168.1.202:27475/tigerobo-ocr?useUnicode=true&characterEncoding=utf-8&serverTimezone=GMT
+    url: jdbc:mysql://180.76.146.227:27476/fda-test?useUnicode=true&characterEncoding=utf-8&serverTimezone=GMT
     driver-class-name: com.mysql.cj.jdbc.Driver
     username: root
     password: Semi.1001
@@ -12,11 +12,16 @@ spring:
 #    virtual-host: /
 #    publisher-confirms: true
 #    publisher-returns: true
-fad:
+fda:
   common:
     dir:
       # 上传文件存储文件夹
-      upload: /tigerobo/upload/
+      base: /mfda
+      upload: ${fda.common.dir.base}/upload/
+    url:
+      # ip
+      base: http://192.168.1.73:28003
+      path: ${fda.common.url.base}/down/news/
 logging:
   level:
     org.springframework.cloud: debug

+ 1 - 0
src/main/resources/application.yml

@@ -1,5 +1,6 @@
 server:
   #  测试环境
+#    port: 28003
     port: 28002
 #    生产环境
 #  port: 8000

+ 11 - 0
src/main/resources/mapper/IndustryPlateResMapper.xml

@@ -97,4 +97,15 @@
         </where>
         group by ipr.plate_id order by ipr.plate_date desc,ipr.plate_close_pred_up_percent asc
     </select>
+
+    <select id="selActualPlateByPlateId"  resultType="IndustryPlateRes" parameterType="map">
+        select ipr.*
+        from industry_plate_res ipr
+        <where>
+            <if test="params.plateId != null and params.plateId != ''">
+                and ipr.plate_id = #{params.plateId}
+            </if>
+        </where>
+        group by ipr.plate_id order by ipr.plate_date desc
+    </select>
 </mapper>

+ 229 - 229
src/test/java/com/pavis/ai/app/fda/FdaApplicationTests.java

@@ -1,229 +1,229 @@
-package com.pavis.ai.app.fda;
-
-import com.alibaba.fastjson.JSON;
-import com.pavis.ai.app.fda.common.config.constants.Constants;
-import com.pavis.ai.app.fda.common.utils.DateUtils;
-import com.pavis.ai.app.fda.common.utils.GeneralUtils;
-import com.pavis.ai.app.fda.form.TestCommon;
-import com.pavis.ai.app.fda.form.inc.IncInfo;
-import com.pavis.ai.app.fda.mapper.IndustryPlateMapper;
-import com.pavis.ai.app.fda.mapper.IndustryStockMapper;
-import com.pavis.ai.app.fda.mapper.NewsInfoMapper;
-import com.pavis.ai.app.fda.model.NewsInfo;
-import com.pavis.ai.app.fda.service.InternalSendService;
-import lombok.extern.slf4j.Slf4j;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.test.context.junit4.SpringRunner;
-
-import java.io.IOException;
-import java.time.DayOfWeek;
-import java.time.LocalDate;
-import java.time.LocalDateTime;
-import java.time.format.DateTimeFormatter;
-import java.time.temporal.ChronoUnit;
-import java.time.temporal.TemporalAdjusters;
-import java.util.*;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
-
-@RunWith(SpringRunner.class)
-@SpringBootTest
-@Slf4j
-public class FdaApplicationTests {
-
-    @Autowired
-    private InternalSendService internalSendService;
-
-    @Test
-    public void testwx() throws IOException {
-        String codeId = "033xm5ai0ifCRt1Mu8ai0Fb4ai0xm5a8";
-        // String openid = GeneralUtils.getOpenId(codeId);
-        // System.err.println(openid);
-        // https://api.weixin.qq.com/sns/jscode2session?appid=APPID&secret=SECRET&js_code=JSCODE&grant_type=authorization_code
-        // https://api.weixin.qq.com/sns/jscode2session?appid=APPID&secret=SECRET&js_code=JSCODE&grant_type=authorization_code
-
-        // System.err.println(internalSendService.toLogin(Constants.APP_ID,
-        //         Constants.SECRET,codeId));
-        System.err.println(GeneralUtils.toOpenId(codeId));
-
-
-    }
-
-    @Test
-    public void tesFilter(){
-        List<IncInfo> incInfos = new ArrayList<>();
-        IncInfo info1 = IncInfo.builder()
-                .industryId("1")
-                .industryValue(-200.01F)
-                .build();
-        IncInfo info2 = IncInfo.builder()
-                .industryId("2")
-                .industryValue(300.01F)
-                .build();
-        IncInfo info3 = IncInfo.builder()
-                .industryId("3")
-                .industryValue(540.01F)
-                .build();
-        incInfos.add(info1);
-        incInfos.add(info2);
-        incInfos.add(info3);
-
-        // 《 0
-        List<IncInfo> finalIncInfos = incInfos.stream().filter(s->s.getIndustryValue() < 0.0F)
-                .collect(Collectors.toList());
-        // 《 0
-        List<IncInfo> finalIncInfoss = incInfos.stream().filter(s->s.getIndustryValue() > 0.0F)
-                .collect(Collectors.toList());
-        System.err.println(JSON.toJSONString(finalIncInfos));
-        System.err.println(JSON.toJSONString(finalIncInfoss));
-    }
-
-    @Test
-    public void contextLoads() {
-        float min = 1f;
-        float max = 100f;
-        float floatBounded = min + new Random().nextFloat() * (max - min);
-        System.out.println(floatBounded);
-    }
-
-    @Test
-    public void test(){
-        System.err.println(JSON.toJSONString(TestCommon.calWeek("",true)));
-        System.err.println(JSON.toJSONString(TestCommon.calWeek("2020-07-16",false)));
-    }
-
-    @Test
-    public void testLocal(){
-        LocalDate today = LocalDate.now();
-        LocalDate toweekMonday = today.with(DayOfWeek.MONDAY);
-        LocalDate toweekFRIDAY = today.with(DayOfWeek.FRIDAY);
-        System.err.println(toweekMonday.toString());
-        System.err.println(toweekFRIDAY.toString());
-    }
-
-    @Test
-    public void t(){
-
-
-//         return list;
-
-        LocalDateTime now = LocalDateTime.now();
-        System.err.println(now.toLocalDate().toString());
-        String dayAfterTommorrow = "2020-07-14";
-        DateTimeFormatter pattern = DateTimeFormatter.ofPattern("yyyy-MM-dd");
-        LocalDate localDate = LocalDate.parse(dayAfterTommorrow, pattern);
-        LocalDate todayOfLastWeek = localDate.plusDays(7);
-        System.err.println("7>"+todayOfLastWeek.toString());
-        LocalDate monday = todayOfLastWeek.with(TemporalAdjusters.previous(DayOfWeek.SUNDAY)).plusDays(1);
-        LocalDate sunday = todayOfLastWeek.with(TemporalAdjusters.next(DayOfWeek.MONDAY)).minusDays(1);
-        LocalDate friday = todayOfLastWeek.with(TemporalAdjusters.next(DayOfWeek.SATURDAY)).minusDays(1);
-        LocalDate lastFriday = todayOfLastWeek.with(TemporalAdjusters.previous(DayOfWeek.SATURDAY)).minusDays(1);
-        System.out.println("当前日期:" + localDate + " 上一周的周一:" + monday + " " + monday.getDayOfWeek());
-        System.out.println("当前日期:" + localDate + " 上一周的周日:" + sunday + " " + sunday.getDayOfWeek());
-
-        System.out.println("当前日期:" + localDate + " 上一周的周五:" + friday + " " + friday.getDayOfWeek());
-        System.out.println("当前日期:" + localDate + " 上上一周的周五:" + lastFriday + " " + lastFriday.getDayOfWeek());
-
-
-        // System.err.println(now.getDayOfWeek().getValue());
-        // int num= LocalDate.of(2020, 07, 14).getDayOfWeek().getValue();
-        // System.err.println(num);
-    }
-
-    @Test
-    public void tes(){
-        // LocalDateTime now = LocalDateTime.now();
-        // now.toLocalDate();
-        // System.err.println(now.getDayOfWeek().getValue());
-        // int num= LocalDate.of(2020, 07, 14).getDayOfWeek().getValue();
-        // System.err.println(num);
-
-        // 随便虚拟一个日期
-        String dayAfterTommorrow = "2020-07-17";
-        DateTimeFormatter pattern = DateTimeFormatter.ofPattern("yyyy-MM-dd");
-        LocalDate localDate = LocalDate.parse(dayAfterTommorrow, pattern);
-        // 求这个日期上一周的周一、周日
-        LocalDate todayOfLastWeek = localDate.minusDays(7);
-        LocalDate monday = todayOfLastWeek.with(TemporalAdjusters.previous(DayOfWeek.SUNDAY)).plusDays(1);
-        LocalDate sunday = todayOfLastWeek.with(TemporalAdjusters.next(DayOfWeek.MONDAY)).minusDays(1);
-        LocalDate friday = todayOfLastWeek.with(TemporalAdjusters.next(DayOfWeek.SATURDAY)).minusDays(1);
-        LocalDate lastFriday = todayOfLastWeek.with(TemporalAdjusters.previous(DayOfWeek.SATURDAY)).minusDays(1);
-        System.out.println("当前日期:" + localDate + " 上一周的周一:" + monday + " " + monday.getDayOfWeek());
-        System.out.println("当前日期:" + localDate + " 上一周的周日:" + sunday + " " + sunday.getDayOfWeek());
-
-        System.out.println("当前日期:" + localDate + " 上一周的周五:" + friday + " " + friday.getDayOfWeek());
-        System.out.println("当前日期:" + localDate + " 上上一周的周五:" + lastFriday + " " + lastFriday.getDayOfWeek());
-
-        List<String> list = new ArrayList<>();
-        System.err.println(ChronoUnit.DAYS.between(monday, sunday));
-        long distance = ChronoUnit.DAYS.between(monday, sunday);
-        if (distance < 1) {
-            // return list;
-            System.err.println(JSON.toJSONString(list));
-        }
-        Map<String,Object> map = new HashMap<>();
-        Stream.iterate(monday, d -> d.plusDays(1)).limit(distance + 1).forEach(f -> list.add(f.toString()));
-        Stream.iterate(monday, d -> d.plusDays(1)).limit(distance + 1).forEach(f -> map.put(f.getDayOfWeek().toString(),f.toString()));
-        System.err.println(JSON.toJSONString(list));
-        System.err.println();
-        System.err.println(JSON.toJSONString(map));
-    }
-
-    @Autowired
-    private NewsInfoMapper newsInfoMapper;
-
-    @Autowired
-    private IndustryPlateMapper industryPlateMapper;
-
-    @Autowired
-    private IndustryStockMapper industryStockMapper;
-
-    @Test
-    public void testNewsInfo(){
-        List<NewsInfo> newsInfos = new ArrayList<>();
-        newsInfos.add(toInitNewsInfo("941001","83700001","新闻标题","新闻来源",
-                "新闻预览内容","2020-06-23 12:34:23","新闻情绪指数"));
-        newsInfos.add(toInitNewsInfo("941002","83700002","标题","闻来源",
-                "闻预览内容","2020-06-23 12:34:23","闻情绪指数"));
-        for (NewsInfo newsInfo : newsInfos) {
-            newsInfoMapper.insert(newsInfo);
-        }
-    }
-    public NewsInfo toInitNewsInfo(String newsId,String newsToEnterpriseId,String newsTitle,String newsFrom,String newsMiniContent,
-                                   String newsDate,String newsTag){
-        NewsInfo newsInfo = NewsInfo.builder()
-                .id(String.valueOf(System.currentTimeMillis()))
-                .newsId(newsId)
-                .newsToEnterpriseId(newsToEnterpriseId)
-                .newsTitle(newsTitle)
-                .newsFrom(newsFrom)
-                .newsMiniContent(newsMiniContent)
-                .newsDate(newsDate)
-                .newsTag(newsTag)
-                .operator("ghj")
-                .operatorId("sid941007")
-                .operateTime(DateUtils.getCurrentTime())
-                .operateIp("192.168.1.73")
-                .build();
-        return newsInfo;
-    }
-
-    // @Test
-    // public void testWeek(){
-    //     Long syscurr = System.currentTimeMillis();
-    //     (int((r - (3600 * 24 * 3)) / 3600 / 24) % 7)+1)
-    //     System.err.println();
-    //     Long curr = syscurr - (3600 * 24 * 3);
-    //
-    //     int i = (curr / 3600 / 24) % 7;
-    //     System.err.println(Integer.valueOf(String.valueOf(syscurr)));
-    //     Integer mid = Integer.valueOf(String.valueOf(syscurr - (3600 * 24 * 3)));
-    //     Integer weekMid = (mid / 3600 / 24) % 7;
-    //     int weekdays = weekMid+1;
-    //     System.err.println(weekdays);
-    // }
-
-}
+// package com.pavis.ai.app.fda;
+//
+// import com.alibaba.fastjson.JSON;
+// import com.pavis.ai.app.fda.common.config.constants.Constants;
+// import com.pavis.ai.app.fda.common.utils.DateUtils;
+// import com.pavis.ai.app.fda.common.utils.GeneralUtils;
+// import com.pavis.ai.app.fda.form.TestCommon;
+// import com.pavis.ai.app.fda.form.inc.IncInfo;
+// import com.pavis.ai.app.fda.mapper.IndustryPlateMapper;
+// import com.pavis.ai.app.fda.mapper.IndustryStockMapper;
+// import com.pavis.ai.app.fda.mapper.NewsInfoMapper;
+// import com.pavis.ai.app.fda.model.NewsInfo;
+// import com.pavis.ai.app.fda.service.InternalSendService;
+// import lombok.extern.slf4j.Slf4j;
+// import org.junit.Test;
+// import org.junit.runner.RunWith;
+// import org.springframework.beans.factory.annotation.Autowired;
+// import org.springframework.boot.test.context.SpringBootTest;
+// import org.springframework.test.context.junit4.SpringRunner;
+//
+// import java.io.IOException;
+// import java.time.DayOfWeek;
+// import java.time.LocalDate;
+// import java.time.LocalDateTime;
+// import java.time.format.DateTimeFormatter;
+// import java.time.temporal.ChronoUnit;
+// import java.time.temporal.TemporalAdjusters;
+// import java.util.*;
+// import java.util.stream.Collectors;
+// import java.util.stream.Stream;
+//
+// @RunWith(SpringRunner.class)
+// @SpringBootTest
+// @Slf4j
+// public class FdaApplicationTests {
+//
+//     @Autowired
+//     private InternalSendService internalSendService;
+//
+//     @Test
+//     public void testwx() throws IOException {
+//         String codeId = "033xm5ai0ifCRt1Mu8ai0Fb4ai0xm5a8";
+//         // String openid = GeneralUtils.getOpenId(codeId);
+//         // System.err.println(openid);
+//         // https://api.weixin.qq.com/sns/jscode2session?appid=APPID&secret=SECRET&js_code=JSCODE&grant_type=authorization_code
+//         // https://api.weixin.qq.com/sns/jscode2session?appid=APPID&secret=SECRET&js_code=JSCODE&grant_type=authorization_code
+//
+//         // System.err.println(internalSendService.toLogin(Constants.APP_ID,
+//         //         Constants.SECRET,codeId));
+//         System.err.println(GeneralUtils.toOpenId(codeId));
+//
+//
+//     }
+//
+//     @Test
+//     public void tesFilter(){
+//         List<IncInfo> incInfos = new ArrayList<>();
+//         IncInfo info1 = IncInfo.builder()
+//                 .industryId("1")
+//                 .industryValue(-200.01F)
+//                 .build();
+//         IncInfo info2 = IncInfo.builder()
+//                 .industryId("2")
+//                 .industryValue(300.01F)
+//                 .build();
+//         IncInfo info3 = IncInfo.builder()
+//                 .industryId("3")
+//                 .industryValue(540.01F)
+//                 .build();
+//         incInfos.add(info1);
+//         incInfos.add(info2);
+//         incInfos.add(info3);
+//
+//         // 《 0
+//         List<IncInfo> finalIncInfos = incInfos.stream().filter(s->s.getIndustryValue() < 0.0F)
+//                 .collect(Collectors.toList());
+//         // 《 0
+//         List<IncInfo> finalIncInfoss = incInfos.stream().filter(s->s.getIndustryValue() > 0.0F)
+//                 .collect(Collectors.toList());
+//         System.err.println(JSON.toJSONString(finalIncInfos));
+//         System.err.println(JSON.toJSONString(finalIncInfoss));
+//     }
+//
+//     @Test
+//     public void contextLoads() {
+//         float min = 1f;
+//         float max = 100f;
+//         float floatBounded = min + new Random().nextFloat() * (max - min);
+//         System.out.println(floatBounded);
+//     }
+//
+//     @Test
+//     public void test(){
+//         System.err.println(JSON.toJSONString(TestCommon.calWeek("",true)));
+//         System.err.println(JSON.toJSONString(TestCommon.calWeek("2020-07-16",false)));
+//     }
+//
+//     @Test
+//     public void testLocal(){
+//         LocalDate today = LocalDate.now();
+//         LocalDate toweekMonday = today.with(DayOfWeek.MONDAY);
+//         LocalDate toweekFRIDAY = today.with(DayOfWeek.FRIDAY);
+//         System.err.println(toweekMonday.toString());
+//         System.err.println(toweekFRIDAY.toString());
+//     }
+//
+//     @Test
+//     public void t(){
+//
+//
+// //         return list;
+//
+//         LocalDateTime now = LocalDateTime.now();
+//         System.err.println(now.toLocalDate().toString());
+//         String dayAfterTommorrow = "2020-07-14";
+//         DateTimeFormatter pattern = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+//         LocalDate localDate = LocalDate.parse(dayAfterTommorrow, pattern);
+//         LocalDate todayOfLastWeek = localDate.plusDays(7);
+//         System.err.println("7>"+todayOfLastWeek.toString());
+//         LocalDate monday = todayOfLastWeek.with(TemporalAdjusters.previous(DayOfWeek.SUNDAY)).plusDays(1);
+//         LocalDate sunday = todayOfLastWeek.with(TemporalAdjusters.next(DayOfWeek.MONDAY)).minusDays(1);
+//         LocalDate friday = todayOfLastWeek.with(TemporalAdjusters.next(DayOfWeek.SATURDAY)).minusDays(1);
+//         LocalDate lastFriday = todayOfLastWeek.with(TemporalAdjusters.previous(DayOfWeek.SATURDAY)).minusDays(1);
+//         System.out.println("当前日期:" + localDate + " 上一周的周一:" + monday + " " + monday.getDayOfWeek());
+//         System.out.println("当前日期:" + localDate + " 上一周的周日:" + sunday + " " + sunday.getDayOfWeek());
+//
+//         System.out.println("当前日期:" + localDate + " 上一周的周五:" + friday + " " + friday.getDayOfWeek());
+//         System.out.println("当前日期:" + localDate + " 上上一周的周五:" + lastFriday + " " + lastFriday.getDayOfWeek());
+//
+//
+//         // System.err.println(now.getDayOfWeek().getValue());
+//         // int num= LocalDate.of(2020, 07, 14).getDayOfWeek().getValue();
+//         // System.err.println(num);
+//     }
+//
+//     @Test
+//     public void tes(){
+//         // LocalDateTime now = LocalDateTime.now();
+//         // now.toLocalDate();
+//         // System.err.println(now.getDayOfWeek().getValue());
+//         // int num= LocalDate.of(2020, 07, 14).getDayOfWeek().getValue();
+//         // System.err.println(num);
+//
+//         // 随便虚拟一个日期
+//         String dayAfterTommorrow = "2020-07-17";
+//         DateTimeFormatter pattern = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+//         LocalDate localDate = LocalDate.parse(dayAfterTommorrow, pattern);
+//         // 求这个日期上一周的周一、周日
+//         LocalDate todayOfLastWeek = localDate.minusDays(7);
+//         LocalDate monday = todayOfLastWeek.with(TemporalAdjusters.previous(DayOfWeek.SUNDAY)).plusDays(1);
+//         LocalDate sunday = todayOfLastWeek.with(TemporalAdjusters.next(DayOfWeek.MONDAY)).minusDays(1);
+//         LocalDate friday = todayOfLastWeek.with(TemporalAdjusters.next(DayOfWeek.SATURDAY)).minusDays(1);
+//         LocalDate lastFriday = todayOfLastWeek.with(TemporalAdjusters.previous(DayOfWeek.SATURDAY)).minusDays(1);
+//         System.out.println("当前日期:" + localDate + " 上一周的周一:" + monday + " " + monday.getDayOfWeek());
+//         System.out.println("当前日期:" + localDate + " 上一周的周日:" + sunday + " " + sunday.getDayOfWeek());
+//
+//         System.out.println("当前日期:" + localDate + " 上一周的周五:" + friday + " " + friday.getDayOfWeek());
+//         System.out.println("当前日期:" + localDate + " 上上一周的周五:" + lastFriday + " " + lastFriday.getDayOfWeek());
+//
+//         List<String> list = new ArrayList<>();
+//         System.err.println(ChronoUnit.DAYS.between(monday, sunday));
+//         long distance = ChronoUnit.DAYS.between(monday, sunday);
+//         if (distance < 1) {
+//             // return list;
+//             System.err.println(JSON.toJSONString(list));
+//         }
+//         Map<String,Object> map = new HashMap<>();
+//         Stream.iterate(monday, d -> d.plusDays(1)).limit(distance + 1).forEach(f -> list.add(f.toString()));
+//         Stream.iterate(monday, d -> d.plusDays(1)).limit(distance + 1).forEach(f -> map.put(f.getDayOfWeek().toString(),f.toString()));
+//         System.err.println(JSON.toJSONString(list));
+//         System.err.println();
+//         System.err.println(JSON.toJSONString(map));
+//     }
+//
+//     @Autowired
+//     private NewsInfoMapper newsInfoMapper;
+//
+//     @Autowired
+//     private IndustryPlateMapper industryPlateMapper;
+//
+//     @Autowired
+//     private IndustryStockMapper industryStockMapper;
+//
+//     @Test
+//     public void testNewsInfo(){
+//         List<NewsInfo> newsInfos = new ArrayList<>();
+//         newsInfos.add(toInitNewsInfo("941001","83700001","新闻标题","新闻来源",
+//                 "新闻预览内容","2020-06-23 12:34:23","新闻情绪指数"));
+//         newsInfos.add(toInitNewsInfo("941002","83700002","标题","闻来源",
+//                 "闻预览内容","2020-06-23 12:34:23","闻情绪指数"));
+//         for (NewsInfo newsInfo : newsInfos) {
+//             newsInfoMapper.insert(newsInfo);
+//         }
+//     }
+//     public NewsInfo toInitNewsInfo(String newsId,String newsToEnterpriseId,String newsTitle,String newsFrom,String newsMiniContent,
+//                                    String newsDate,String newsTag){
+//         NewsInfo newsInfo = NewsInfo.builder()
+//                 .id(String.valueOf(System.currentTimeMillis()))
+//                 .newsId(newsId)
+//                 .newsToEnterpriseId(newsToEnterpriseId)
+//                 .newsTitle(newsTitle)
+//                 .newsFrom(newsFrom)
+//                 .newsMiniContent(newsMiniContent)
+//                 .newsDate(newsDate)
+//                 .newsTag(newsTag)
+//                 .operator("ghj")
+//                 .operatorId("sid941007")
+//                 .operateTime(DateUtils.getCurrentTime())
+//                 .operateIp("192.168.1.73")
+//                 .build();
+//         return newsInfo;
+//     }
+//
+//     // @Test
+//     // public void testWeek(){
+//     //     Long syscurr = System.currentTimeMillis();
+//     //     (int((r - (3600 * 24 * 3)) / 3600 / 24) % 7)+1)
+//     //     System.err.println();
+//     //     Long curr = syscurr - (3600 * 24 * 3);
+//     //
+//     //     int i = (curr / 3600 / 24) % 7;
+//     //     System.err.println(Integer.valueOf(String.valueOf(syscurr)));
+//     //     Integer mid = Integer.valueOf(String.valueOf(syscurr - (3600 * 24 * 3)));
+//     //     Integer weekMid = (mid / 3600 / 24) % 7;
+//     //     int weekdays = weekMid+1;
+//     //     System.err.println(weekdays);
+//     // }
+//
+// }

+ 479 - 479
src/test/java/com/pavis/ai/app/fda/LocalDateTest.java

@@ -1,479 +1,479 @@
-package com.pavis.ai.app.fda;
-
-import com.alibaba.fastjson.JSON;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.pavis.ai.app.fda.common.utils.DateUtils;
-import com.pavis.ai.app.fda.form.TestCommon;
-import com.pavis.ai.app.fda.form.inc.IncInfo;
-import com.pavis.ai.app.fda.mapper.IndustryInfoMapper;
-import com.pavis.ai.app.fda.mapper.IndustryPlateMapper;
-import com.pavis.ai.app.fda.mapper.IndustryPlateResMapper;
-import com.pavis.ai.app.fda.model.IndustryInfo;
-import com.pavis.ai.app.fda.model.IndustryPlate;
-import com.pavis.ai.app.fda.model.IndustryPlateRes;
-import lombok.extern.slf4j.Slf4j;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.test.context.junit4.SpringRunner;
-
-import java.time.DayOfWeek;
-import java.time.LocalDate;
-import java.time.LocalDateTime;
-import java.time.format.DateTimeFormatter;
-import java.time.temporal.ChronoUnit;
-import java.time.temporal.TemporalAdjusters;
-import java.time.temporal.WeekFields;
-import java.util.*;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
-
-/**
- * @author guanhuijuan
- * @create 2020-07-18 12:17
- * @desc
- **/
-@RunWith(SpringRunner.class)
-@SpringBootTest
-@Slf4j
-public class LocalDateTest {
-
-    @Autowired
-    private IndustryPlateMapper industryPlateMapper;
-
-    @Autowired
-    private IndustryInfoMapper industryInfoMapper;
-
-    @Autowired
-    private IndustryPlateResMapper industryPlateResMapper;
-
-    @Test
-    public void testMonth(){
-        String date = "2020-06-31";
-        System.out.println(DateUtils.getMonthByNearly("2020-06-30"));
-    }
-
-    @Test
-    public void testMon(){
-        String date = "2020-06-30";
-        Map<String,Object> map = DateUtils.getMonthByNearly(date);
-        String month = map.get("month").toString();
-        String nearlyMonth = map.get("nearlyMonth").toString();
-        System.err.println(month+"<>"+nearlyMonth);
-        Boolean tag = DateUtils.checkDate(month, nearlyMonth);
-        if (tag.equals(true)){
-            System.err.println(nearlyMonth+"<>"+month);
-        }else {
-            System.err.println(month+"<>"+nearlyMonth);
-        }
-        System.err.println(tag);
-        String testDate = "2020-05-31";
-        String week = DateUtils.getWeekNameByDate(testDate);
-        if (!week.equals("6") &&
-                !week.equals("7")){
-            System.err.println("add");
-        }else {
-            System.err.println("del");
-        }
-    }
-
-    @Test
-    public void testY(){
-        List<Float> floats = new ArrayList<>();
-        floats.add(70.34F);
-        floats.add(28.954F);
-        floats.add(55.90F);
-        floats.add(55.90F);
-        floats.add(89.123F);
-        // System.err.println(DateUtils.getAxisY(floats));
-        List<Integer> integers = new ArrayList<>();
-        integers.add(70);
-        integers.add(28);
-        integers.add(55);
-        integers.add(55);
-        integers.add(89);
-        Integer lastNum = 20;
-        Integer firstNum = 100;
-        Integer num = (firstNum - lastNum) / 6;
-        System.err.println(num);
-        List<Integer> nums = new ArrayList<>();
-        nums.add(lastNum);
-        for (int i = 0; i < 7; i++) {
-            nums.add(lastNum += num);
-        }
-        System.err.println(JSON.toJSONString(nums));
-    }
-
-    // 1、实际榜:
-    // 2、预测帮:查找close为空的。
-    // 3、date上周 上上周测试。
-    // 4、数据截取。
-    @Test
-    public void testDate(){
-        String date = "2020-07-24";
-        Map<String,Object> actualMap = DateUtils.getFridayOrLastFriday(date);
-        Map<String,Object> nextMap = DateUtils.getEverydayOfNexWeek(date);
-        System.err.println("周五那天的:"+date);
-        System.err.println(JSON.toJSONString(actualMap));
-        System.err.println();
-        System.err.println();
-        System.out.println(JSON.toJSONString(nextMap));
-
-        String date1 = "2020-07-20";
-        Map<String,Object> actualMap1 = DateUtils.getFridayOrLastFriday(date1);
-        Map<String,Object> nextMap1 = DateUtils.getEverydayOfNexWeek(date1);
-        System.err.println("周一的:"+date1);
-        System.err.println(JSON.toJSONString(actualMap1));
-        System.err.println();
-        System.err.println();
-        System.out.println(JSON.toJSONString(nextMap1));
-
-        String date11 = "2020-07-22";
-        Map<String,Object> actualMap11 = DateUtils.getFridayOrLastFriday(date11);
-        Map<String,Object> nextMap11 = DateUtils.getEverydayOfNexWeek(date11);
-        System.err.println("周三的:"+date11);
-        System.err.println(JSON.toJSONString(actualMap11));
-        System.err.println();
-        System.err.println();
-        System.out.println(JSON.toJSONString(nextMap11));
-
-        String date111 = "2020-07-25";
-        Map<String,Object> actualMap111 = DateUtils.getFridayOrLastFriday(date111);
-        Map<String,Object> nextMap111 = DateUtils.getEverydayOfNexWeek(date111);
-        System.err.println("周六的:"+date111);
-        System.err.println(JSON.toJSONString(actualMap111));
-        System.err.println();
-        System.err.println();
-        System.out.println(JSON.toJSONString(nextMap111));
-
-        String date1111 = "2020-07-26";
-        Map<String,Object> actualMap1111 = DateUtils.getFridayOrLastFriday(date1111);
-        Map<String,Object> nextMap1111 = DateUtils.getEverydayOfNexWeek(date1111);
-        System.err.println("周日的:"+date1111);
-        System.err.println(JSON.toJSONString(actualMap1111));
-        System.err.println();
-        System.err.println();
-        System.out.println(JSON.toJSONString(nextMap1111));
-    }
-
-
-    @Test
-    public void testUpdateIPlateName(){
-        // QueryWrapper<IndustryInfo> industryInfoQueryWrapper = new QueryWrapper<>();
-        // industryInfoQueryWrapper.lambda()
-        //         .isNotNull(IndustryInfo::getId)
-        //         .groupBy(IndustryInfo::getPlateId);
-        // List<IndustryInfo> industryInfos = industryInfoMapper.selectList(industryInfoQueryWrapper);
-
-        QueryWrapper<IndustryPlateRes> industryPlateQueryWrapper = new QueryWrapper<>();
-        industryPlateQueryWrapper.lambda()
-                .isNotNull(IndustryPlateRes::getId);
-        List<IndustryPlateRes> industryPlates = industryPlateResMapper.selectList(industryPlateQueryWrapper);
-
-        for (IndustryPlateRes industryPlate : industryPlates) {
-            QueryWrapper<IndustryInfo> infoQueryWrapper = new QueryWrapper<>();
-            infoQueryWrapper.lambda()
-                    .eq(IndustryInfo::getPlateId,industryPlate.getPlateId());
-            List<IndustryInfo> industryInfoList = industryInfoMapper.selectList(infoQueryWrapper);
-            industryPlate.setPlateName(industryInfoList.get(0).getPlateName());
-            industryPlateResMapper.updateById(industryPlate);
-
-        }
-    }
-
-    @Test
-    public void tes(){
-        DateUtils.getEverydayOfNexWeek("2020-07-03");
-        // DateTimeFormatter pattern = DateTimeFormatter.ofPattern("yyyy-MM-dd");
-        // LocalDate localDate = LocalDate.parse(date, pattern);
-        // localDate.with(TemporalAdjusters.next(DayOfWeek.of(2)));
-        DateUtils.getEverydayOfNexWeek("2020-06-29");
-        DateUtils.getEverydayOfNexWeek("2020-07-05");
-        DateUtils.getEverydayOfNexWeek("2020-06-22");
-    }
-
-    @Test
-    public void next(){
-
-        DateUtils.getEverydayOfNexWeek("2020-07-03");
-        // DateTimeFormatter pattern = DateTimeFormatter.ofPattern("yyyy-MM-dd");
-        // LocalDate localDate = LocalDate.parse(date, pattern);
-        // localDate.with(TemporalAdjusters.next(DayOfWeek.of(2)));
-        DateUtils.getEverydayOfNexWeek("2020-06-29");
-        DateUtils.getEverydayOfNexWeek("2020-07-05");
-        DateUtils.getEverydayOfNexWeek("2020-06-22");
-    }
-
-    @Test
-    public void testNext(){
-        Map<String,Object> map = new HashMap<>();
-        String date = "2020-07-04";
-        String week = DateUtils.getWeekNameByDate(date);
-        if (week.equals("6") || week.equals("7")){
-            // 本周:
-            DateTimeFormatter pattern = DateTimeFormatter.ofPattern("yyyy-MM-dd");
-            LocalDate localDate = LocalDate.parse(date, pattern);
-            LocalDate sunday = localDate.with(TemporalAdjusters.next(DayOfWeek.MONDAY)).minusDays(1);
-            LocalDate monday = localDate.with(TemporalAdjusters.previous(DayOfWeek.SUNDAY)).plusDays(1);
-            long distance = ChronoUnit.DAYS.between(monday, sunday);
-            if (distance < 1) {
-                // return map;
-            }
-            Stream.iterate(monday, d -> d.plusDays(1)).limit(distance + 1).forEach(f -> map.put(f.getDayOfWeek().toString(),f.toString()));
-            System.err.println("if:"+JSON.toJSONString(map));
-        }else {
-            // 上周:
-            Map<String,Object> lastMap = DateUtils.getFridayOrLastFriday(date);
-            DateTimeFormatter pattern = DateTimeFormatter.ofPattern("yyyy-MM-dd");
-            LocalDate localDate = LocalDate.parse(lastMap.get("friday").toString(), pattern);
-            LocalDate sunday = localDate.with(TemporalAdjusters.next(DayOfWeek.MONDAY)).minusDays(1);
-            LocalDate monday = localDate.with(TemporalAdjusters.previous(DayOfWeek.SUNDAY)).plusDays(1);
-            long distance = ChronoUnit.DAYS.between(monday, sunday);
-            if (distance < 1) {
-                // return map;
-            }
-            Stream.iterate(monday, d -> d.plusDays(1)).limit(distance + 1).forEach(f -> map.put(f.getDayOfWeek().toString(),f.toString()));
-
-            System.err.println("else:"+JSON.toJSONString(map));
-        }
-    }
-
-    @Test
-    public void test(){
-        Map<String,Object> map = new HashMap<>();
-        String date = "2020-07-04";
-        TestCommon.getEveryday("2020-07-03",false);
-        TestCommon.getEveryday("2020-07-03",true);
-        String week = DateUtils.getWeekNameByDate(date);
-        if (week.equals("6") || week.equals("7")){
-            // 本周:
-            DateTimeFormatter pattern = DateTimeFormatter.ofPattern("yyyy-MM-dd");
-            LocalDate localDate = LocalDate.parse(date, pattern);
-            LocalDate sunday = localDate.with(TemporalAdjusters.next(DayOfWeek.MONDAY)).minusDays(1);
-            LocalDate monday = localDate.with(TemporalAdjusters.previous(DayOfWeek.SUNDAY)).plusDays(1);
-            long distance = ChronoUnit.DAYS.between(monday, sunday);
-            if (distance < 1) {
-                // return map;
-            }
-            Stream.iterate(monday, d -> d.plusDays(1)).limit(distance + 1).forEach(f -> map.put(f.getDayOfWeek().toString(),f.toString()));
-            System.err.println("if:"+JSON.toJSONString(map));
-        }else {
-            // 上周:
-            Map<String,Object> lastMap = DateUtils.getFridayOrLastFriday(date);
-            DateTimeFormatter pattern = DateTimeFormatter.ofPattern("yyyy-MM-dd");
-            LocalDate localDate = LocalDate.parse(lastMap.get("friday").toString(), pattern);
-            LocalDate sunday = localDate.with(TemporalAdjusters.next(DayOfWeek.MONDAY)).minusDays(1);
-            LocalDate monday = localDate.with(TemporalAdjusters.previous(DayOfWeek.SUNDAY)).plusDays(1);
-            long distance = ChronoUnit.DAYS.between(monday, sunday);
-            if (distance < 1) {
-                // return map;
-            }
-            Stream.iterate(monday, d -> d.plusDays(1)).limit(distance + 1).forEach(f -> map.put(f.getDayOfWeek().toString(),f.toString()));
-
-            System.err.println("else:"+JSON.toJSONString(map));
-        }
-    }
-
-    @Test
-    public void test2(){
-        System.err.println(getFridayOrLastFriday("",true));
-        System.err.println(getFridayOrLastFriday("2020-07-06",true));
-        System.err.println(getFridayOrLastFriday("2020-07-17",true));
-        System.err.println(getFridayOrLastFriday("2020-07-14",true));
-        System.err.println();
-        System.err.println();
-        System.err.println();
-        System.err.println(getFridayOrLastFriday("",false));
-        System.err.println(getFridayOrLastFriday("2020-07-06",false));
-        System.err.println(getFridayOrLastFriday("2020-07-17",false));
-        System.err.println(getFridayOrLastFriday("2020-07-14",false));
-
-        String friday = "2020-07-03";
-        String lastFriday = "2020-06-26";
-        QueryWrapper<IndustryPlate> industryPlateQueryWrapper = new QueryWrapper<>();
-        if (DateUtils.checkDate(friday,lastFriday).equals(true)){
-            industryPlateQueryWrapper.between("plate_date", lastFriday, friday);
-        }else {
-            industryPlateQueryWrapper.between("plate_date", friday, lastFriday);
-        }
-        industryPlateQueryWrapper.groupBy("plate_id");
-        industryPlateQueryWrapper.isNotNull("plate_id");
-        List<IndustryPlate> plates = industryPlateMapper.selectList(industryPlateQueryWrapper);
-        System.err.println(plates.size());
-
-    }
-
-    public static Map<String,Object> getFridayOrLastFriday(String date,Boolean lastOrNext){
-        Map<String,Object> map = new HashMap<>();
-        String week = DateUtils.getWeekNameByDate(date);
-        if (week.equals("6") || week.equals("7")){
-            // 本周周五和上周五
-            String currFriday = DateUtils.getFridayOfThisWeek(date);
-            map.put("friday",currFriday);
-            // 上上周五
-            DateTimeFormatter pattern = DateTimeFormatter.ofPattern("yyyy-MM-dd");
-            LocalDate localDate = LocalDate.parse(currFriday, pattern);
-            LocalDate todayOfLastWeek = lastOrNext.equals(true) ? localDate.minusDays(7) : localDate.plusDays(7);
-            LocalDate fridayLocal = todayOfLastWeek.with(TemporalAdjusters.next(DayOfWeek.SATURDAY)).minusDays(1);
-            map.put("lastFriday",fridayLocal.toString());
-            log.info("friday map:{}", JSON.toJSONString(map));
-            return map;
-        }else {
-            // 上周五和上上周五
-            // 指定日期的周。
-            DateTimeFormatter pattern = DateTimeFormatter.ofPattern("yyyy-MM-dd");
-            LocalDate localDate = LocalDate.parse(date, pattern);
-            LocalDate todayOfLastWeek = lastOrNext.equals(true) ? localDate.minusDays(7) : localDate.plusDays(7);
-            LocalDate fridayLocal = todayOfLastWeek.with(TemporalAdjusters.next(DayOfWeek.SATURDAY)).minusDays(1);
-            LocalDate lastFridayLocal = todayOfLastWeek.with(TemporalAdjusters.previous(DayOfWeek.SATURDAY)).minusDays(1);
-            map.put("friday",fridayLocal.toString());
-            map.put("lastFriday",lastFridayLocal.toString());
-            log.info("friday map:{}", JSON.toJSONString(map));
-            return map;
-        }
-    }
-
-    @Test
-    public void test1(){
-        // 获取今天的实际日期。
-        // getActualCurrDate();
-        // 获取本周周五的日期。
-        // getFridayOfThisWeek();
-
-        // getDayOfNextWeek();
-
-        // getEveryday("2020-07-18",true);
-        // TestCommon.calWeek("2020-07-06",false);
-        //
-        // String date = "2020-07-06";
-        // DateTimeFormatter pattern = DateTimeFormatter.ofPattern("yyyy-MM-dd");
-        // LocalDate localDate = LocalDate.parse(date, pattern);
-        // System.err.println(DateUtils.getFridayOfThisWeek(date));
-        // System.err.println(DateUtils.getFridayOfThisWeek(""));
-
-        // System.err.println(DateUtils.getFridayOrLastFriday(""));
-        // System.err.println(DateUtils.getFridayOrLastFriday("2020-07-06"));
-        // System.err.println(DateUtils.getFridayOrLastFriday("2020-07-17"));
-        // System.err.println(DateUtils.getFridayOrLastFriday("2020-07-14"));
-
-        System.err.println(DateUtils.checkDate("2020-06-26","2020-07-03"));
-        System.err.println(DateUtils.checkDate("2020-07-03","2020-06-26"));
-        List<IncInfo> incInfos = new ArrayList<>();
-        incInfos.add(IncInfo.builder().industryValue(1F).build());
-        incInfos.add(IncInfo.builder().industryValue(7F).build());
-        incInfos.add(IncInfo.builder().industryValue(66F).build());
-        incInfos.add(IncInfo.builder().industryValue(15F).build());
-        //年龄升序
-        List<IncInfo> sortLists = incInfos.stream()
-                .sorted(Comparator.comparing(IncInfo::getIndustryValue))
-                .collect(Collectors.toList());
-        System.err.println("升序:"+ JSON.toJSONString(sortLists));
-        //年龄降序
-        // List<IncInfo> sortLists = incInfos.stream()
-        //         .sorted(Comparator.comparing(IncInfo::getIndustryValue).reversed())
-        //         .collect(Collectors.toList());
-        List<IncInfo> sortListss = incInfos.stream()
-                .sorted(Comparator.comparing(IncInfo::getIndustryValue).reversed())
-                .collect(Collectors.toList());
-        System.err.println("降序序:"+ JSON.toJSONString(sortListss));
-    }
-
-    /**
-     * 获取一周内或者下周的每一天的日期。
-     * @param date
-     * @return
-     */
-    public static Map<String,Object> getEveryday(String date, Boolean nextFlag){
-        Map<String,Object> map = new HashMap<>();
-        DateTimeFormatter pattern = DateTimeFormatter.ofPattern("yyyy-MM-dd");
-        LocalDate localDate = LocalDate.parse(date, pattern);
-        // 求这个日期上一周的周一、周日
-        LocalDate todayOfLastWeek = localDate.minusDays(7);
-        if (nextFlag.equals(true)){
-            todayOfLastWeek = todayOfLastWeek.plusDays(7);
-        }
-        LocalDate sunday = todayOfLastWeek.with(TemporalAdjusters.next(DayOfWeek.MONDAY)).minusDays(1);
-        LocalDate monday = todayOfLastWeek.with(TemporalAdjusters.previous(DayOfWeek.SUNDAY)).plusDays(1);
-        long distance = ChronoUnit.DAYS.between(monday, sunday);
-        if (distance < 1) {
-            return map;
-        }
-        Stream.iterate(monday, d -> d.plusDays(1)).limit(distance + 1).forEach(f -> map.put(f.getDayOfWeek().toString(),f.toString()));
-        log.info("getEveryday获取一周内每天的日期:{}", JSON.toJSONString(map));
-        return map;
-    }
-
-
-    /**
-     * 获取下一周的任意一天,默认周一。
-     * @return String
-     */
-    public static String getDayOfNextWeek(){
-        // DateTimeFormatter pattern = DateTimeFormatter.ofPattern("yyyy-MM-dd");
-        // LocalDate localDate = LocalDate.parse("2020-07-18", pattern);
-        LocalDate localDate = currDate().with(DayOfWeek.FRIDAY);
-        LocalDate todayOfLastWeek = localDate.plusDays(7);
-        LocalDate monday = todayOfLastWeek.with(TemporalAdjusters.previous(DayOfWeek.SUNDAY)).plusDays(1);
-        String next = monday.toString();
-        log.info("getNextWeek获取下一周的日期:{}",monday);
-        return next;
-    }
-
-
-    public static LocalDate currDate(){
-        return LocalDate.now();
-    }
-    /**
-     * 获取本周的周五日期。
-     * @return
-     */
-    public static String getFridayOfThisWeek(){
-        LocalDate toweekFriday = currDate().with(DayOfWeek.FRIDAY);
-        String currFriday = toweekFriday.toString();
-        log.info("getFridayOfThisWeek获取本周的周五日期:{}",currFriday);
-        return currFriday;
-    }
-
-    /**
-     * 获取今天的实际日期。
-     * @return
-     */
-    public static String getActualCurrDate(){
-        LocalDateTime now = LocalDateTime.now();
-        String currWeek = now.toLocalDate().toString();
-        log.info("getActualCurrDate获取今天实际日期:{}",currWeek);
-        return currWeek;
-    }
-
-
-    // List<IndustryInfo> industryInfos = new ArrayList<>();
-    // // 根据行业id搜索。
-    //     if (ifIncDec.equals(true)) {
-    //     QueryWrapper<IndustryInfo> queryWrapper = new QueryWrapper();
-    //     queryWrapper.lambda()
-    //             .eq(IndustryInfo::getPlateId, searchInfo.getSearchParam())
-    //             .orderByDesc(IndustryInfo::getOperateTime)
-    //             .or()
-    //             .like(IndustryInfo::getPlateName, searchInfo.getSearchParam())
-    //             .or()
-    //             .eq(IndustryInfo::getStockId, searchInfo.getSearchParam())
-    //             .or()
-    //             .like(IndustryInfo::getStockName, searchInfo.getSearchParam());
-    //     industryInfos = industryInfoMapper.selectList(queryWrapper);
-    //     // 转换为industryPlate
-    //     // List<IndustryPlate> industryPlates = new ArrayList<>();
-    //     // IndustryPlate industryPlate;
-    //     // for (IndustryInfo industryInfo : industryInfos) {
-    //     //     industryPlate = IndustryPlate.builder()
-    //     //             .plateId(in)
-    //     //             .build();
-    //     // }
-    // } else {
-    //     QueryWrapper<IndustryInfo> industryInfoQueryWrapper = new QueryWrapper<>();
-    //     // 涨幅跌幅。上周周五的close-上上上周五的close >0涨 <0跌
-    //     // industryInfoQueryWrapper.eq("tag",tag);
-    //     industryInfoQueryWrapper.isNotNull("id");
-    //     industryInfos = industryInfoMapper.selectList(industryInfoQueryWrapper);
-    // }
-}
+// package com.pavis.ai.app.fda;
+//
+// import com.alibaba.fastjson.JSON;
+// import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+// import com.pavis.ai.app.fda.common.utils.DateUtils;
+// import com.pavis.ai.app.fda.form.TestCommon;
+// import com.pavis.ai.app.fda.form.inc.IncInfo;
+// import com.pavis.ai.app.fda.mapper.IndustryInfoMapper;
+// import com.pavis.ai.app.fda.mapper.IndustryPlateMapper;
+// import com.pavis.ai.app.fda.mapper.IndustryPlateResMapper;
+// import com.pavis.ai.app.fda.model.IndustryInfo;
+// import com.pavis.ai.app.fda.model.IndustryPlate;
+// import com.pavis.ai.app.fda.model.IndustryPlateRes;
+// import lombok.extern.slf4j.Slf4j;
+// import org.junit.Test;
+// import org.junit.runner.RunWith;
+// import org.springframework.beans.factory.annotation.Autowired;
+// import org.springframework.boot.test.context.SpringBootTest;
+// import org.springframework.test.context.junit4.SpringRunner;
+//
+// import java.time.DayOfWeek;
+// import java.time.LocalDate;
+// import java.time.LocalDateTime;
+// import java.time.format.DateTimeFormatter;
+// import java.time.temporal.ChronoUnit;
+// import java.time.temporal.TemporalAdjusters;
+// import java.time.temporal.WeekFields;
+// import java.util.*;
+// import java.util.stream.Collectors;
+// import java.util.stream.Stream;
+//
+// /**
+//  * @author guanhuijuan
+//  * @create 2020-07-18 12:17
+//  * @desc
+//  **/
+// @RunWith(SpringRunner.class)
+// @SpringBootTest
+// @Slf4j
+// public class LocalDateTest {
+//
+//     @Autowired
+//     private IndustryPlateMapper industryPlateMapper;
+//
+//     @Autowired
+//     private IndustryInfoMapper industryInfoMapper;
+//
+//     @Autowired
+//     private IndustryPlateResMapper industryPlateResMapper;
+//
+//     @Test
+//     public void testMonth(){
+//         String date = "2020-06-31";
+//         System.out.println(DateUtils.getMonthByNearly("2020-06-30"));
+//     }
+//
+//     @Test
+//     public void testMon(){
+//         String date = "2020-06-30";
+//         Map<String,Object> map = DateUtils.getMonthByNearly(date);
+//         String month = map.get("month").toString();
+//         String nearlyMonth = map.get("nearlyMonth").toString();
+//         System.err.println(month+"<>"+nearlyMonth);
+//         Boolean tag = DateUtils.checkDate(month, nearlyMonth);
+//         if (tag.equals(true)){
+//             System.err.println(nearlyMonth+"<>"+month);
+//         }else {
+//             System.err.println(month+"<>"+nearlyMonth);
+//         }
+//         System.err.println(tag);
+//         String testDate = "2020-05-31";
+//         String week = DateUtils.getWeekNameByDate(testDate);
+//         if (!week.equals("6") &&
+//                 !week.equals("7")){
+//             System.err.println("add");
+//         }else {
+//             System.err.println("del");
+//         }
+//     }
+//
+//     @Test
+//     public void testY(){
+//         List<Float> floats = new ArrayList<>();
+//         floats.add(70.34F);
+//         floats.add(28.954F);
+//         floats.add(55.90F);
+//         floats.add(55.90F);
+//         floats.add(89.123F);
+//         // System.err.println(DateUtils.getAxisY(floats));
+//         List<Integer> integers = new ArrayList<>();
+//         integers.add(70);
+//         integers.add(28);
+//         integers.add(55);
+//         integers.add(55);
+//         integers.add(89);
+//         Integer lastNum = 20;
+//         Integer firstNum = 100;
+//         Integer num = (firstNum - lastNum) / 6;
+//         System.err.println(num);
+//         List<Integer> nums = new ArrayList<>();
+//         nums.add(lastNum);
+//         for (int i = 0; i < 7; i++) {
+//             nums.add(lastNum += num);
+//         }
+//         System.err.println(JSON.toJSONString(nums));
+//     }
+//
+//     // 1、实际榜:
+//     // 2、预测帮:查找close为空的。
+//     // 3、date上周 上上周测试。
+//     // 4、数据截取。
+//     @Test
+//     public void testDate(){
+//         String date = "2020-07-24";
+//         Map<String,Object> actualMap = DateUtils.getFridayOrLastFriday(date);
+//         Map<String,Object> nextMap = DateUtils.getEverydayOfNexWeek(date);
+//         System.err.println("周五那天的:"+date);
+//         System.err.println(JSON.toJSONString(actualMap));
+//         System.err.println();
+//         System.err.println();
+//         System.out.println(JSON.toJSONString(nextMap));
+//
+//         String date1 = "2020-07-20";
+//         Map<String,Object> actualMap1 = DateUtils.getFridayOrLastFriday(date1);
+//         Map<String,Object> nextMap1 = DateUtils.getEverydayOfNexWeek(date1);
+//         System.err.println("周一的:"+date1);
+//         System.err.println(JSON.toJSONString(actualMap1));
+//         System.err.println();
+//         System.err.println();
+//         System.out.println(JSON.toJSONString(nextMap1));
+//
+//         String date11 = "2020-07-22";
+//         Map<String,Object> actualMap11 = DateUtils.getFridayOrLastFriday(date11);
+//         Map<String,Object> nextMap11 = DateUtils.getEverydayOfNexWeek(date11);
+//         System.err.println("周三的:"+date11);
+//         System.err.println(JSON.toJSONString(actualMap11));
+//         System.err.println();
+//         System.err.println();
+//         System.out.println(JSON.toJSONString(nextMap11));
+//
+//         String date111 = "2020-07-25";
+//         Map<String,Object> actualMap111 = DateUtils.getFridayOrLastFriday(date111);
+//         Map<String,Object> nextMap111 = DateUtils.getEverydayOfNexWeek(date111);
+//         System.err.println("周六的:"+date111);
+//         System.err.println(JSON.toJSONString(actualMap111));
+//         System.err.println();
+//         System.err.println();
+//         System.out.println(JSON.toJSONString(nextMap111));
+//
+//         String date1111 = "2020-07-26";
+//         Map<String,Object> actualMap1111 = DateUtils.getFridayOrLastFriday(date1111);
+//         Map<String,Object> nextMap1111 = DateUtils.getEverydayOfNexWeek(date1111);
+//         System.err.println("周日的:"+date1111);
+//         System.err.println(JSON.toJSONString(actualMap1111));
+//         System.err.println();
+//         System.err.println();
+//         System.out.println(JSON.toJSONString(nextMap1111));
+//     }
+//
+//
+//     @Test
+//     public void testUpdateIPlateName(){
+//         // QueryWrapper<IndustryInfo> industryInfoQueryWrapper = new QueryWrapper<>();
+//         // industryInfoQueryWrapper.lambda()
+//         //         .isNotNull(IndustryInfo::getId)
+//         //         .groupBy(IndustryInfo::getPlateId);
+//         // List<IndustryInfo> industryInfos = industryInfoMapper.selectList(industryInfoQueryWrapper);
+//
+//         QueryWrapper<IndustryPlateRes> industryPlateQueryWrapper = new QueryWrapper<>();
+//         industryPlateQueryWrapper.lambda()
+//                 .isNotNull(IndustryPlateRes::getId);
+//         List<IndustryPlateRes> industryPlates = industryPlateResMapper.selectList(industryPlateQueryWrapper);
+//
+//         for (IndustryPlateRes industryPlate : industryPlates) {
+//             QueryWrapper<IndustryInfo> infoQueryWrapper = new QueryWrapper<>();
+//             infoQueryWrapper.lambda()
+//                     .eq(IndustryInfo::getPlateId,industryPlate.getPlateId());
+//             List<IndustryInfo> industryInfoList = industryInfoMapper.selectList(infoQueryWrapper);
+//             industryPlate.setPlateName(industryInfoList.get(0).getPlateName());
+//             industryPlateResMapper.updateById(industryPlate);
+//
+//         }
+//     }
+//
+//     @Test
+//     public void tes(){
+//         DateUtils.getEverydayOfNexWeek("2020-07-03");
+//         // DateTimeFormatter pattern = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+//         // LocalDate localDate = LocalDate.parse(date, pattern);
+//         // localDate.with(TemporalAdjusters.next(DayOfWeek.of(2)));
+//         DateUtils.getEverydayOfNexWeek("2020-06-29");
+//         DateUtils.getEverydayOfNexWeek("2020-07-05");
+//         DateUtils.getEverydayOfNexWeek("2020-06-22");
+//     }
+//
+//     @Test
+//     public void next(){
+//
+//         DateUtils.getEverydayOfNexWeek("2020-07-03");
+//         // DateTimeFormatter pattern = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+//         // LocalDate localDate = LocalDate.parse(date, pattern);
+//         // localDate.with(TemporalAdjusters.next(DayOfWeek.of(2)));
+//         DateUtils.getEverydayOfNexWeek("2020-06-29");
+//         DateUtils.getEverydayOfNexWeek("2020-07-05");
+//         DateUtils.getEverydayOfNexWeek("2020-06-22");
+//     }
+//
+//     @Test
+//     public void testNext(){
+//         Map<String,Object> map = new HashMap<>();
+//         String date = "2020-07-04";
+//         String week = DateUtils.getWeekNameByDate(date);
+//         if (week.equals("6") || week.equals("7")){
+//             // 本周:
+//             DateTimeFormatter pattern = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+//             LocalDate localDate = LocalDate.parse(date, pattern);
+//             LocalDate sunday = localDate.with(TemporalAdjusters.next(DayOfWeek.MONDAY)).minusDays(1);
+//             LocalDate monday = localDate.with(TemporalAdjusters.previous(DayOfWeek.SUNDAY)).plusDays(1);
+//             long distance = ChronoUnit.DAYS.between(monday, sunday);
+//             if (distance < 1) {
+//                 // return map;
+//             }
+//             Stream.iterate(monday, d -> d.plusDays(1)).limit(distance + 1).forEach(f -> map.put(f.getDayOfWeek().toString(),f.toString()));
+//             System.err.println("if:"+JSON.toJSONString(map));
+//         }else {
+//             // 上周:
+//             Map<String,Object> lastMap = DateUtils.getFridayOrLastFriday(date);
+//             DateTimeFormatter pattern = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+//             LocalDate localDate = LocalDate.parse(lastMap.get("friday").toString(), pattern);
+//             LocalDate sunday = localDate.with(TemporalAdjusters.next(DayOfWeek.MONDAY)).minusDays(1);
+//             LocalDate monday = localDate.with(TemporalAdjusters.previous(DayOfWeek.SUNDAY)).plusDays(1);
+//             long distance = ChronoUnit.DAYS.between(monday, sunday);
+//             if (distance < 1) {
+//                 // return map;
+//             }
+//             Stream.iterate(monday, d -> d.plusDays(1)).limit(distance + 1).forEach(f -> map.put(f.getDayOfWeek().toString(),f.toString()));
+//
+//             System.err.println("else:"+JSON.toJSONString(map));
+//         }
+//     }
+//
+//     @Test
+//     public void test(){
+//         Map<String,Object> map = new HashMap<>();
+//         String date = "2020-07-04";
+//         TestCommon.getEveryday("2020-07-03",false);
+//         TestCommon.getEveryday("2020-07-03",true);
+//         String week = DateUtils.getWeekNameByDate(date);
+//         if (week.equals("6") || week.equals("7")){
+//             // 本周:
+//             DateTimeFormatter pattern = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+//             LocalDate localDate = LocalDate.parse(date, pattern);
+//             LocalDate sunday = localDate.with(TemporalAdjusters.next(DayOfWeek.MONDAY)).minusDays(1);
+//             LocalDate monday = localDate.with(TemporalAdjusters.previous(DayOfWeek.SUNDAY)).plusDays(1);
+//             long distance = ChronoUnit.DAYS.between(monday, sunday);
+//             if (distance < 1) {
+//                 // return map;
+//             }
+//             Stream.iterate(monday, d -> d.plusDays(1)).limit(distance + 1).forEach(f -> map.put(f.getDayOfWeek().toString(),f.toString()));
+//             System.err.println("if:"+JSON.toJSONString(map));
+//         }else {
+//             // 上周:
+//             Map<String,Object> lastMap = DateUtils.getFridayOrLastFriday(date);
+//             DateTimeFormatter pattern = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+//             LocalDate localDate = LocalDate.parse(lastMap.get("friday").toString(), pattern);
+//             LocalDate sunday = localDate.with(TemporalAdjusters.next(DayOfWeek.MONDAY)).minusDays(1);
+//             LocalDate monday = localDate.with(TemporalAdjusters.previous(DayOfWeek.SUNDAY)).plusDays(1);
+//             long distance = ChronoUnit.DAYS.between(monday, sunday);
+//             if (distance < 1) {
+//                 // return map;
+//             }
+//             Stream.iterate(monday, d -> d.plusDays(1)).limit(distance + 1).forEach(f -> map.put(f.getDayOfWeek().toString(),f.toString()));
+//
+//             System.err.println("else:"+JSON.toJSONString(map));
+//         }
+//     }
+//
+//     @Test
+//     public void test2(){
+//         System.err.println(getFridayOrLastFriday("",true));
+//         System.err.println(getFridayOrLastFriday("2020-07-06",true));
+//         System.err.println(getFridayOrLastFriday("2020-07-17",true));
+//         System.err.println(getFridayOrLastFriday("2020-07-14",true));
+//         System.err.println();
+//         System.err.println();
+//         System.err.println();
+//         System.err.println(getFridayOrLastFriday("",false));
+//         System.err.println(getFridayOrLastFriday("2020-07-06",false));
+//         System.err.println(getFridayOrLastFriday("2020-07-17",false));
+//         System.err.println(getFridayOrLastFriday("2020-07-14",false));
+//
+//         String friday = "2020-07-03";
+//         String lastFriday = "2020-06-26";
+//         QueryWrapper<IndustryPlate> industryPlateQueryWrapper = new QueryWrapper<>();
+//         if (DateUtils.checkDate(friday,lastFriday).equals(true)){
+//             industryPlateQueryWrapper.between("plate_date", lastFriday, friday);
+//         }else {
+//             industryPlateQueryWrapper.between("plate_date", friday, lastFriday);
+//         }
+//         industryPlateQueryWrapper.groupBy("plate_id");
+//         industryPlateQueryWrapper.isNotNull("plate_id");
+//         List<IndustryPlate> plates = industryPlateMapper.selectList(industryPlateQueryWrapper);
+//         System.err.println(plates.size());
+//
+//     }
+//
+//     public static Map<String,Object> getFridayOrLastFriday(String date,Boolean lastOrNext){
+//         Map<String,Object> map = new HashMap<>();
+//         String week = DateUtils.getWeekNameByDate(date);
+//         if (week.equals("6") || week.equals("7")){
+//             // 本周周五和上周五
+//             String currFriday = DateUtils.getFridayOfThisWeek(date);
+//             map.put("friday",currFriday);
+//             // 上上周五
+//             DateTimeFormatter pattern = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+//             LocalDate localDate = LocalDate.parse(currFriday, pattern);
+//             LocalDate todayOfLastWeek = lastOrNext.equals(true) ? localDate.minusDays(7) : localDate.plusDays(7);
+//             LocalDate fridayLocal = todayOfLastWeek.with(TemporalAdjusters.next(DayOfWeek.SATURDAY)).minusDays(1);
+//             map.put("lastFriday",fridayLocal.toString());
+//             log.info("friday map:{}", JSON.toJSONString(map));
+//             return map;
+//         }else {
+//             // 上周五和上上周五
+//             // 指定日期的周。
+//             DateTimeFormatter pattern = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+//             LocalDate localDate = LocalDate.parse(date, pattern);
+//             LocalDate todayOfLastWeek = lastOrNext.equals(true) ? localDate.minusDays(7) : localDate.plusDays(7);
+//             LocalDate fridayLocal = todayOfLastWeek.with(TemporalAdjusters.next(DayOfWeek.SATURDAY)).minusDays(1);
+//             LocalDate lastFridayLocal = todayOfLastWeek.with(TemporalAdjusters.previous(DayOfWeek.SATURDAY)).minusDays(1);
+//             map.put("friday",fridayLocal.toString());
+//             map.put("lastFriday",lastFridayLocal.toString());
+//             log.info("friday map:{}", JSON.toJSONString(map));
+//             return map;
+//         }
+//     }
+//
+//     @Test
+//     public void test1(){
+//         // 获取今天的实际日期。
+//         // getActualCurrDate();
+//         // 获取本周周五的日期。
+//         // getFridayOfThisWeek();
+//
+//         // getDayOfNextWeek();
+//
+//         // getEveryday("2020-07-18",true);
+//         // TestCommon.calWeek("2020-07-06",false);
+//         //
+//         // String date = "2020-07-06";
+//         // DateTimeFormatter pattern = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+//         // LocalDate localDate = LocalDate.parse(date, pattern);
+//         // System.err.println(DateUtils.getFridayOfThisWeek(date));
+//         // System.err.println(DateUtils.getFridayOfThisWeek(""));
+//
+//         // System.err.println(DateUtils.getFridayOrLastFriday(""));
+//         // System.err.println(DateUtils.getFridayOrLastFriday("2020-07-06"));
+//         // System.err.println(DateUtils.getFridayOrLastFriday("2020-07-17"));
+//         // System.err.println(DateUtils.getFridayOrLastFriday("2020-07-14"));
+//
+//         System.err.println(DateUtils.checkDate("2020-06-26","2020-07-03"));
+//         System.err.println(DateUtils.checkDate("2020-07-03","2020-06-26"));
+//         List<IncInfo> incInfos = new ArrayList<>();
+//         incInfos.add(IncInfo.builder().industryValue(1F).build());
+//         incInfos.add(IncInfo.builder().industryValue(7F).build());
+//         incInfos.add(IncInfo.builder().industryValue(66F).build());
+//         incInfos.add(IncInfo.builder().industryValue(15F).build());
+//         //年龄升序
+//         List<IncInfo> sortLists = incInfos.stream()
+//                 .sorted(Comparator.comparing(IncInfo::getIndustryValue))
+//                 .collect(Collectors.toList());
+//         System.err.println("升序:"+ JSON.toJSONString(sortLists));
+//         //年龄降序
+//         // List<IncInfo> sortLists = incInfos.stream()
+//         //         .sorted(Comparator.comparing(IncInfo::getIndustryValue).reversed())
+//         //         .collect(Collectors.toList());
+//         List<IncInfo> sortListss = incInfos.stream()
+//                 .sorted(Comparator.comparing(IncInfo::getIndustryValue).reversed())
+//                 .collect(Collectors.toList());
+//         System.err.println("降序序:"+ JSON.toJSONString(sortListss));
+//     }
+//
+//     /**
+//      * 获取一周内或者下周的每一天的日期。
+//      * @param date
+//      * @return
+//      */
+//     public static Map<String,Object> getEveryday(String date, Boolean nextFlag){
+//         Map<String,Object> map = new HashMap<>();
+//         DateTimeFormatter pattern = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+//         LocalDate localDate = LocalDate.parse(date, pattern);
+//         // 求这个日期上一周的周一、周日
+//         LocalDate todayOfLastWeek = localDate.minusDays(7);
+//         if (nextFlag.equals(true)){
+//             todayOfLastWeek = todayOfLastWeek.plusDays(7);
+//         }
+//         LocalDate sunday = todayOfLastWeek.with(TemporalAdjusters.next(DayOfWeek.MONDAY)).minusDays(1);
+//         LocalDate monday = todayOfLastWeek.with(TemporalAdjusters.previous(DayOfWeek.SUNDAY)).plusDays(1);
+//         long distance = ChronoUnit.DAYS.between(monday, sunday);
+//         if (distance < 1) {
+//             return map;
+//         }
+//         Stream.iterate(monday, d -> d.plusDays(1)).limit(distance + 1).forEach(f -> map.put(f.getDayOfWeek().toString(),f.toString()));
+//         log.info("getEveryday获取一周内每天的日期:{}", JSON.toJSONString(map));
+//         return map;
+//     }
+//
+//
+//     /**
+//      * 获取下一周的任意一天,默认周一。
+//      * @return String
+//      */
+//     public static String getDayOfNextWeek(){
+//         // DateTimeFormatter pattern = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+//         // LocalDate localDate = LocalDate.parse("2020-07-18", pattern);
+//         LocalDate localDate = currDate().with(DayOfWeek.FRIDAY);
+//         LocalDate todayOfLastWeek = localDate.plusDays(7);
+//         LocalDate monday = todayOfLastWeek.with(TemporalAdjusters.previous(DayOfWeek.SUNDAY)).plusDays(1);
+//         String next = monday.toString();
+//         log.info("getNextWeek获取下一周的日期:{}",monday);
+//         return next;
+//     }
+//
+//
+//     public static LocalDate currDate(){
+//         return LocalDate.now();
+//     }
+//     /**
+//      * 获取本周的周五日期。
+//      * @return
+//      */
+//     public static String getFridayOfThisWeek(){
+//         LocalDate toweekFriday = currDate().with(DayOfWeek.FRIDAY);
+//         String currFriday = toweekFriday.toString();
+//         log.info("getFridayOfThisWeek获取本周的周五日期:{}",currFriday);
+//         return currFriday;
+//     }
+//
+//     /**
+//      * 获取今天的实际日期。
+//      * @return
+//      */
+//     public static String getActualCurrDate(){
+//         LocalDateTime now = LocalDateTime.now();
+//         String currWeek = now.toLocalDate().toString();
+//         log.info("getActualCurrDate获取今天实际日期:{}",currWeek);
+//         return currWeek;
+//     }
+//
+//
+//     // List<IndustryInfo> industryInfos = new ArrayList<>();
+//     // // 根据行业id搜索。
+//     //     if (ifIncDec.equals(true)) {
+//     //     QueryWrapper<IndustryInfo> queryWrapper = new QueryWrapper();
+//     //     queryWrapper.lambda()
+//     //             .eq(IndustryInfo::getPlateId, searchInfo.getSearchParam())
+//     //             .orderByDesc(IndustryInfo::getOperateTime)
+//     //             .or()
+//     //             .like(IndustryInfo::getPlateName, searchInfo.getSearchParam())
+//     //             .or()
+//     //             .eq(IndustryInfo::getStockId, searchInfo.getSearchParam())
+//     //             .or()
+//     //             .like(IndustryInfo::getStockName, searchInfo.getSearchParam());
+//     //     industryInfos = industryInfoMapper.selectList(queryWrapper);
+//     //     // 转换为industryPlate
+//     //     // List<IndustryPlate> industryPlates = new ArrayList<>();
+//     //     // IndustryPlate industryPlate;
+//     //     // for (IndustryInfo industryInfo : industryInfos) {
+//     //     //     industryPlate = IndustryPlate.builder()
+//     //     //             .plateId(in)
+//     //     //             .build();
+//     //     // }
+//     // } else {
+//     //     QueryWrapper<IndustryInfo> industryInfoQueryWrapper = new QueryWrapper<>();
+//     //     // 涨幅跌幅。上周周五的close-上上上周五的close >0涨 <0跌
+//     //     // industryInfoQueryWrapper.eq("tag",tag);
+//     //     industryInfoQueryWrapper.isNotNull("id");
+//     //     industryInfos = industryInfoMapper.selectList(industryInfoQueryWrapper);
+//     // }
+// }