|
@@ -2,9 +2,13 @@ package com.pavis.ai.app.fda.service.impl;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.pavis.ai.app.fda.common.utils.GeneralUtils;
|
|
|
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.IndustryPlateResMapper;
|
|
|
+import com.pavis.ai.app.fda.model.IndustryPlate;
|
|
|
import com.pavis.ai.app.fda.model.IndustryPlateRes;
|
|
|
import com.pavis.ai.app.fda.service.ListService;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
@@ -12,7 +16,9 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
@@ -89,6 +95,52 @@ public class ListServiceImpl implements ListService {
|
|
|
return toNextPred(false);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public Map<String, Object> incLastWeekActualByPage(Long currPage) {
|
|
|
+ Boolean incOrDec = true;
|
|
|
+ // 1、获取实际榜数据。
|
|
|
+ List<IndustryPlateRes> plates = new ArrayList<>();
|
|
|
+ IPage<IndustryPlateRes> plateIPage = null;
|
|
|
+ Page<IndustryPlateRes> page = new Page<>();
|
|
|
+ page.setCurrent(0L);
|
|
|
+ page.setSize(currPage);
|
|
|
+ QueryForm queryForm = QueryForm.builder()
|
|
|
+ // .plateId("0.0")
|
|
|
+ .plateName("0.0")
|
|
|
+ .build();
|
|
|
+ plateIPage = industryPlateResMapper.selectActualPlateByPage(page,queryForm);
|
|
|
+ if (incOrDec.equals(true)){
|
|
|
+ // 涨幅
|
|
|
+ // plates = toActualByLastWeek(incOrDec,"plate_close_up_percent");
|
|
|
+ // 2、封装返回数据。
|
|
|
+ List<IncInfo> incInfos = toBackActualInfos(plateIPage.getRecords());
|
|
|
+ List<IncInfo> finalIncInfos = incInfos.stream().filter(s -> s.getIndustryValue() > 0.0F)
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ System.err.println(finalIncInfos.size());
|
|
|
+ IPage<IncInfo> incInfoIPage = new Page<>();
|
|
|
+ System.err.println(JSON.toJSONString(plateIPage));
|
|
|
+ incInfoIPage.setCurrent(plateIPage.getCurrent());
|
|
|
+ incInfoIPage.setSize(plateIPage.getSize());
|
|
|
+ incInfoIPage.setPages(plateIPage.getPages());
|
|
|
+ incInfoIPage.setTotal(plateIPage.getTotal());
|
|
|
+ incInfoIPage.setRecords(finalIncInfos);
|
|
|
+ Map<String,Object> pageMap = new HashMap<>();
|
|
|
+ pageMap.put("current",plateIPage.getCurrent());
|
|
|
+ pageMap.put("size",plateIPage.getSize());
|
|
|
+ pageMap.put("pages",plateIPage.getPages());
|
|
|
+ pageMap.put("total",plateIPage.getTotal());
|
|
|
+ pageMap.put("incInfos",finalIncInfos);
|
|
|
+ return pageMap;
|
|
|
+ }else {
|
|
|
+ plates = toActualByLastWeek(incOrDec,"plate_close_up_percent");
|
|
|
+ // 2、封装返回数据。
|
|
|
+ List<IncInfo> incInfos = toBackActualInfos(plates);
|
|
|
+ List<IncInfo> finalIncInfos = incInfos.stream().filter(s -> s.getIndustryValue() < 0.0F)
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 上周实际榜。
|
|
@@ -152,13 +204,19 @@ public class ListServiceImpl implements ListService {
|
|
|
* @return
|
|
|
*/
|
|
|
public List<IncInfo> toBackActualInfos(List<IndustryPlateRes> plates) {
|
|
|
+ System.err.println("siz>"+plates.size());
|
|
|
// 3、返回数据创建。
|
|
|
IncInfo incInfo;
|
|
|
List<IncInfo> incInfos = new ArrayList<>();
|
|
|
for (IndustryPlateRes industryPlateRes : plates) {
|
|
|
- Float actualVal = null != industryPlateRes.getPlateCloseUpPercent() ?
|
|
|
- industryPlateRes.getPlateCloseUpPercent() : 0.0F;
|
|
|
+ Float percent = industryPlateRes.getPlateCloseUpPercent();
|
|
|
+ System.err.println(percent);
|
|
|
+ System.err.println(null != percent);
|
|
|
+ Float actualVal = null != percent ?
|
|
|
+ percent : 0.0F;
|
|
|
Boolean industryTag = actualVal > 0.0F ? true : false;
|
|
|
+ System.err.println(actualVal);
|
|
|
+ System.out.println(GeneralUtils.toFloatByTwo(actualVal));
|
|
|
incInfo = IncInfo.builder()
|
|
|
.industryId(industryPlateRes.getPlateId())
|
|
|
.industryName(industryPlateRes.getPlateName())
|