Merge remote-tracking branch 'gitea/master'

This commit is contained in:
Zhujx
2025-08-29 17:13:20 +08:00
5 changed files with 16 additions and 2 deletions

View File

@@ -22,6 +22,7 @@ public interface XBFundMapper {
int batchSave(List<FundInfo> list); int batchSave(List<FundInfo> list);
List<XbFundList> queryFundList(@Param("type") Integer type); List<XbFundList> queryFundList(@Param("type") Integer type);
List<XbFundList> queryAllFundList();
int addCounts(List<XbFundCount> list); int addCounts(List<XbFundCount> list);

View File

@@ -13,6 +13,8 @@ import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode; import java.math.RoundingMode;
@@ -33,6 +35,7 @@ import java.util.stream.Collectors;
@Component @Component
@RequiredArgsConstructor @RequiredArgsConstructor
@Slf4j @Slf4j
@RestController
public class FundCountJob { public class FundCountJob {
private final FundService fundService; private final FundService fundService;
@@ -45,7 +48,7 @@ public class FundCountJob {
return; return;
} }
log.info("==========================[基金统计] 基金统计定时任务启动!=========================="); log.info("==========================[基金统计] 基金统计定时任务启动!==========================");
List<XbFundList> lists = fundService.queryFundList(null); List<XbFundList> lists = fundService.queryFundList();
if (CollectionUtils.isEmpty(lists)) { if (CollectionUtils.isEmpty(lists)) {
return; return;
} }
@@ -71,6 +74,7 @@ public class FundCountJob {
} }
@Scheduled(cron = "0 40 14 * * ? ") @Scheduled(cron = "0 40 14 * * ? ")
@PostMapping("/ddddd")
public void countFundInWeek() throws Exception { public void countFundInWeek() throws Exception {
log.info("==========================[基金统计] 基金本周涨跌幅消息发送定时任务启动!=========================="); log.info("==========================[基金统计] 基金本周涨跌幅消息发送定时任务启动!==========================");
List<XbFundCount> xbFundCounts = fundService.queryFundCountInWeek(); List<XbFundCount> xbFundCounts = fundService.queryFundCountInWeek();
@@ -81,7 +85,7 @@ public class FundCountJob {
Map<String, List<XbFundCount>> map = xbFundCounts.stream().collect(Collectors.groupingBy(XbFundCount::getCode)); Map<String, List<XbFundCount>> map = xbFundCounts.stream().collect(Collectors.groupingBy(XbFundCount::getCode));
map.forEach((k, v) -> { map.forEach((k, v) -> {
List<XbFundCount> fundCounts = map.get(k); List<XbFundCount> fundCounts = map.get(k);
if (CollectionUtils.isNotEmpty(fundCounts)) { if (CollectionUtils.isEmpty(fundCounts)) {
return; return;
} }
List<BigDecimal> decimals = fundCounts.stream().map(XbFundCount::getChange).collect(Collectors.toList()); List<BigDecimal> decimals = fundCounts.stream().map(XbFundCount::getChange).collect(Collectors.toList());

View File

@@ -31,6 +31,7 @@ public interface FundService {
* @return * @return
*/ */
List<XbFundList> queryFundList(Integer type); List<XbFundList> queryFundList(Integer type);
List<XbFundList> queryFundList();
int addCounts(List<XbFundCount> list); int addCounts(List<XbFundCount> list);

View File

@@ -99,6 +99,11 @@ public class FundServiceImpl implements FundService{
return xbFundMapper.queryFundList(type); return xbFundMapper.queryFundList(type);
} }
@Override
public List<XbFundList> queryFundList() {
return xbFundMapper.queryAllFundList();
}
@Override @Override
public int addCounts(List<XbFundCount> list) { public int addCounts(List<XbFundCount> list) {
return xbFundMapper.addCounts(list); return xbFundMapper.addCounts(list);

View File

@@ -54,6 +54,9 @@
select * from xb_fund_count select * from xb_fund_count
where update_time between NOW() - INTERVAL 7 DAY and NOW() where update_time between NOW() - INTERVAL 7 DAY and NOW()
</select> </select>
<select id="queryAllFundList" resultMap="XbFundListMap" parameterType="Integer">
select * from xb_fund_list where 1=1
</select>
</mapper> </mapper>