Compare commits

...

37 Commits

Author SHA1 Message Date
Lxy 524b63159b fix: 修复各种导入数据为空出错问题
4 months ago
Lxy 0f88a02f5a fix: 增加批量转换脚本
4 months ago
Lxy a0a0c3a839 fix: 批量导入、批量分析完成
4 months ago
Lxy c25a262dc1 fix: 增加批量导入按钮
4 months ago
Lxy cb477bcd76 fix: 使用前16%的数据进行计算
4 months ago
Lxy 2ce533d145 fix: 增加机构持仓字段;分析基本吻合正确
4 months ago
Lxy 79e5fe9417 fix: 动量前后端页面调整完毕
4 months ago
Lxy df64d3e0c3 fix: 后端数据修改格式
4 months ago
Lxy 870e7a04a7 fix: 后端数据组织完成;待继续优化或调整前端显示
4 months ago
Lxy e2b609bf52 fix: 修改获取动量数据为计算获取,而不是sql语句
4 months ago
Lxy 789584e62a fix: 增加了趋势页面逻辑,后端的查询目前为sql,暂时不通,需要修改调通及提升效率
4 months ago
Lxy c662a567bd fix:动量数据查询基本正常
4 months ago
Lxy 1faa74db11 fix: 增加分析前端api等细节
4 months ago
Lxy 9f39fb2695 fix: 增加分析接口和界面,但是目前未调试
4 months ago
Lxy 62bc478c04 fix: 获取最后交易日再查询数据调通
4 months ago
Lxy eb0e6ca6b3 fix: 增加获取最后交易日接口
4 months ago
Lxy 726ca58325 fix: 修复新高新低查询异常
4 months ago
Lxy 88c3e487b0 fix: 导入转换数据过程中的各种修改
4 months ago
Lxy a1623c3c3e fix: 增加动量数据表等表结构
4 months ago
Lxy ef0bc92c61 fix: 导入数据接口及界面全部调通
4 months ago
Lxy e66777aa00 fix: 增加表结构备份(截至2026年1月24日11点,可使用)
4 months ago
Lxy 7d0730246f fix: 行业导入、个股每日交易均完成可用
4 months ago
Lxy 895796b48c fix:初步修复完善行业数据导入
4 months ago
Lxy df537dbac9 fix: 修复前端涨跌幅显示异常;修复导入数据10日等涨跌幅异常
4 months ago
Lxy d6ad9c4838 fix: 1、增加行业基础数据表;2、调整所有行业指数数据关联的外键;3、导入每日个股交易数据时,检查个股基础数据和行业数据,并进行导入和更新
4 months ago
Lxy 7bf874398a fix: 前后端代码已经调通
4 months ago
Lxy 26dc129099 fix: qoder增加新的数据结构及相关类;新增三个接口;新增前端页面;尚存问题:数据导入失败;原接口无法使用
4 months ago
Lxy 698887cba5 fix: 增加重构的数据表等文件
4 months ago
Lxy 53e075276a fix: 优化日期校验
4 months ago
Lxy b3ed90aa42 fix: 增加查询的时间过滤(暂时未生效)
4 months ago
Lxy aef00b9b6e fix: 新行情数据调整到新的模块中,与老接口隔离开
4 months ago
Lxy f2e36a3ecb fix: 增加新行情数据工程文件;调整导入基础数据逻辑已通
4 months ago
Lxy 8977d0ff84 fix: 增加新行情数据工程文件;调整导入基础数据逻辑已通
4 months ago
Lxy 5c6dd7427b fix: 增加该版本描述
4 months ago
laixingyu 27cf8f5964 fix: 修改交易记录相关界面
2 years ago
laixingyu 97d8f7ecee fix: 增加记账系统
2 years ago
laixingyu b747888f23 fix: 增加记账系统
2 years ago

3
.gitignore vendored

@ -34,6 +34,9 @@ nbdist/
.nb-gradle/ .nb-gradle/
node_modules/* node_modules/*
# 忽略.vscode文件夹核心规则
.vscode/
###################################################################### ######################################################################
# Others # Others
*.log *.log

@ -1,3 +1,11 @@
## 项目介绍
本分支为基于原项目进行优化分支尝试新建表、算法等重构开始时间2026年1月18日 2030
计划:
1、优化数据表新建表结构导入部分数据
2、优化导入
3、优化动量计算方法
4、优化查询提升效率
其他待定
## 平台简介 ## 平台简介
若依是一套全部开源的快速开发平台,毫无保留给个人及企业免费使用。 若依是一套全部开源的快速开发平台,毫无保留给个人及企业免费使用。

@ -0,0 +1,109 @@
-- 为新的行情数据页面添加菜单配置
-- 1. 首先查询股票系统的父菜单ID
SELECT menu_id, menu_name, parent_id FROM sys_menu WHERE menu_name = '股票系统';
-- 2. 假设股票系统的父菜单ID为某个值添加新的行情数据菜单项
-- 请根据实际查询结果修改parent_id的值
-- 插入新的行情数据菜单项
INSERT INTO sys_menu (
menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by
) VALUES (
'新行情数据',
(SELECT menu_id FROM sys_menu WHERE menu_name = '股票系统'),
'10',
'newstocks',
'stocksystem/newstocks',
'1',
'0',
'C',
'0',
'0',
'stocksystem:newstocks:list',
'chart',
'admin'
);
-- 3. 为新的行情数据页面添加按钮权限
-- 获取新插入的菜单ID
SET @menu_id = LAST_INSERT_ID();
-- 插入新增按钮权限
INSERT INTO sys_menu (
menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by
) VALUES (
'新增',
@menu_id,
'1',
'#',
NULL,
'1',
'0',
'F',
'0',
'0',
'stocksystem:newstocks:add',
'#',
'admin'
);
-- 插入修改按钮权限
INSERT INTO sys_menu (
menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by
) VALUES (
'修改',
@menu_id,
'2',
'#',
NULL,
'1',
'0',
'F',
'0',
'0',
'stocksystem:newstocks:edit',
'#',
'admin'
);
-- 插入删除按钮权限
INSERT INTO sys_menu (
menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by
) VALUES (
'删除',
@menu_id,
'3',
'#',
NULL,
'1',
'0',
'F',
'0',
'0',
'stocksystem:newstocks:remove',
'#',
'admin'
);
-- 插入导出按钮权限
INSERT INTO sys_menu (
menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by
) VALUES (
'导出',
@menu_id,
'4',
'#',
NULL,
'1',
'0',
'F',
'0',
'0',
'stocksystem:newstocks:export',
'#',
'admin'
);
-- 4. 查询结果
SELECT * FROM sys_menu WHERE menu_name LIKE '%新行情数据%' OR parent_id = @menu_id;

@ -0,0 +1,74 @@
import pandas as pd
import os
import sys
def process_single_file(reference_file_path, file_path, output_folder):
"""
处理单个 Excel 文件
:param reference_file_path: 参考文件路径用于获取表头
:param file_path: 待处理文件路径
:param output_folder: 输出文件夹路径
"""
# 读取参考文件获取表头
df1 = pd.read_excel(reference_file_path, parse_dates=False)
header = df1.columns
# 读取第二个文件,设置日期格式保持不变
df2 = pd.read_excel(file_path, parse_dates=False)
# 设置待处理文件的表头与参考文件一致
df2.columns = header
# 删除包含空白值的行
# df2 = df2.dropna(how='any')
# 检查最后一行第一列数据是否为'数据来源东方财富Choice数据',如果是则删除该行
if not df2.empty and df2.iloc[-1, 0] == '数据来源东方财富Choice数据':
df2 = df2[:-1]
# 处理指定日期列(首发上市日),只保留日期部分
if '首发上市日' in df2.columns:
df2['首发上市日'] = pd.to_datetime(df2['首发上市日'].dt.date)
# 构建保存文件的路径
file_name = os.path.basename(file_path)
output_file_path = os.path.join(output_folder, file_name)
# 保存处理后的文件
df2.to_excel(output_file_path, index=False)
def batch_process_files(reference_file_path, input_folder, output_folder):
"""
批量处理文件夹中的 Excel 文件
:param reference_file_path: 参考文件路径用于获取表头
:param input_folder: 输入文件夹路径包含待处理的文件
:param output_folder: 输出文件夹路径保存处理后的文件
"""
# 确保输出文件夹存在
os.makedirs(output_folder, exist_ok=True)
# 遍历输入文件夹中的所有文件
for file_name in os.listdir(input_folder):
file_path = os.path.join(input_folder, file_name)
# 检查文件是否为 Excel 文件且符合命名规则
if os.path.isfile(file_path) and file_path.endswith(('.xlsx', '.xls')) and '动量原始股全部A股' in file_name:
process_single_file(reference_file_path, file_path, output_folder)
print(f"Processed file: {file_name} successfully.")
# C:\Users\winds\Desktop\batch_process_xls\model.xlsx C:\Users\winds\Desktop\batch_process_xls\inputfile C:\Users\winds\Desktop\batch_process_xls\outputfile
if __name__ == "__main__":
if len(sys.argv)!= 4:
print("Usage: python batch_process_excel.py reference_file_path input_folder output_folder")
sys.exit(1)
reference_file_path = sys.argv[1]
input_folder = sys.argv[2]
output_folder = sys.argv[3]
batch_process_files(reference_file_path, input_folder, output_folder)
print(f"Batch processing completed successfully.")

@ -0,0 +1,104 @@
package com.ruoyi.booksystem.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.booksystem.domain.Account;
import com.ruoyi.booksystem.service.IAccountService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* Controller
*
* @author ruoyi
* @date 2023-12-18
*/
@RestController
@RequestMapping("/booksystem/account")
public class AccountController extends BaseController
{
@Autowired
private IAccountService accountService;
/**
*
*/
@PreAuthorize("@ss.hasPermi('booksystem:account:list')")
@GetMapping("/list")
public TableDataInfo list(Account account)
{
startPage();
List<Account> list = accountService.selectAccountList(account);
return getDataTable(list);
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('booksystem:account:export')")
@Log(title = "交易账户", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, Account account)
{
List<Account> list = accountService.selectAccountList(account);
ExcelUtil<Account> util = new ExcelUtil<Account>(Account.class);
util.exportExcel(response, list, "交易账户数据");
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('booksystem:account:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return AjaxResult.success(accountService.selectAccountById(id));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('booksystem:account:add')")
@Log(title = "交易账户", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody Account account)
{
return toAjax(accountService.insertAccount(account));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('booksystem:account:edit')")
@Log(title = "交易账户", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody Account account)
{
return toAjax(accountService.updateAccount(account));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('booksystem:account:remove')")
@Log(title = "交易账户", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(accountService.deleteAccountByIds(ids));
}
}

@ -0,0 +1,111 @@
package com.ruoyi.booksystem.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.utils.SecurityUtils;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.booksystem.domain.Operations;
import com.ruoyi.booksystem.service.IOperationsService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* Controller
*
* @author ruoyi
* @date 2023-12-18
*/
@RestController
@RequestMapping("/booksystem/operations")
public class OperationsController extends BaseController
{
@Autowired
private IOperationsService operationsService;
/**
*
*/
@PreAuthorize("@ss.hasPermi('booksystem:operations:list')")
@GetMapping("/list")
public TableDataInfo list(Operations operations)
{
startPage();
List<Operations> list = operationsService.selectOperationsList(operations);
return getDataTable(list);
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('booksystem:operations:export')")
@Log(title = "当日操作", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, Operations operations)
{
List<Operations> list = operationsService.selectOperationsList(operations);
ExcelUtil<Operations> util = new ExcelUtil<Operations>(Operations.class);
util.exportExcel(response, list, "当日操作数据");
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('booksystem:operations:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return AjaxResult.success(operationsService.selectOperationsById(id));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('booksystem:operations:add')")
@Log(title = "当日操作", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody Operations operations)
{
LoginUser loginUser = SecurityUtils.getLoginUser();
System.out.println("[AccountBookController] userName: " + loginUser.getUsername() + " userId: " + loginUser.getUserId());
operations.setUserId(loginUser.getUserId());
//插入一条后,要更新持仓表
return toAjax(operationsService.insertOperations(operations));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('booksystem:operations:edit')")
@Log(title = "当日操作", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody Operations operations)
{
return toAjax(operationsService.updateOperations(operations));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('booksystem:operations:remove')")
@Log(title = "当日操作", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(operationsService.deleteOperationsByIds(ids));
}
}

@ -0,0 +1,104 @@
package com.ruoyi.booksystem.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.booksystem.domain.Statistics;
import com.ruoyi.booksystem.service.IStatisticsService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* Controller
*
* @author ruoyi
* @date 2023-12-18
*/
@RestController
@RequestMapping("/booksystem/statistics")
public class StatisticsController extends BaseController
{
@Autowired
private IStatisticsService statisticsService;
/**
*
*/
@PreAuthorize("@ss.hasPermi('booksystem:statistics:list')")
@GetMapping("/list")
public TableDataInfo list(Statistics statistics)
{
startPage();
List<Statistics> list = statisticsService.selectStatisticsList(statistics);
return getDataTable(list);
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('booksystem:statistics:export')")
@Log(title = "单笔操作统计", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, Statistics statistics)
{
List<Statistics> list = statisticsService.selectStatisticsList(statistics);
ExcelUtil<Statistics> util = new ExcelUtil<Statistics>(Statistics.class);
util.exportExcel(response, list, "单笔操作统计数据");
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('booksystem:statistics:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return AjaxResult.success(statisticsService.selectStatisticsById(id));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('booksystem:statistics:add')")
@Log(title = "单笔操作统计", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody Statistics statistics)
{
return toAjax(statisticsService.insertStatistics(statistics));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('booksystem:statistics:edit')")
@Log(title = "单笔操作统计", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody Statistics statistics)
{
return toAjax(statisticsService.updateStatistics(statistics));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('booksystem:statistics:remove')")
@Log(title = "单笔操作统计", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(statisticsService.deleteStatisticsByIds(ids));
}
}

@ -0,0 +1,104 @@
package com.ruoyi.booksystem.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.booksystem.domain.StatisticsRemain;
import com.ruoyi.booksystem.service.IStatisticsRemainService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* Controller
*
* @author ruoyi
* @date 2023-12-18
*/
@RestController
@RequestMapping("/booksystem/statisticremain")
public class StatisticsRemainController extends BaseController
{
@Autowired
private IStatisticsRemainService statisticsRemainService;
/**
*
*/
@PreAuthorize("@ss.hasPermi('booksystem:statisticremain:list')")
@GetMapping("/list")
public TableDataInfo list(StatisticsRemain statisticsRemain)
{
startPage();
List<StatisticsRemain> list = statisticsRemainService.selectStatisticsRemainList(statisticsRemain);
return getDataTable(list);
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('booksystem:statisticremain:export')")
@Log(title = "当日持仓统计", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, StatisticsRemain statisticsRemain)
{
List<StatisticsRemain> list = statisticsRemainService.selectStatisticsRemainList(statisticsRemain);
ExcelUtil<StatisticsRemain> util = new ExcelUtil<StatisticsRemain>(StatisticsRemain.class);
util.exportExcel(response, list, "当日持仓统计数据");
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('booksystem:statisticremain:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return AjaxResult.success(statisticsRemainService.selectStatisticsRemainById(id));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('booksystem:statisticremain:add')")
@Log(title = "当日持仓统计", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody StatisticsRemain statisticsRemain)
{
return toAjax(statisticsRemainService.insertStatisticsRemain(statisticsRemain));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('booksystem:statisticremain:edit')")
@Log(title = "当日持仓统计", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody StatisticsRemain statisticsRemain)
{
return toAjax(statisticsRemainService.updateStatisticsRemain(statisticsRemain));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('booksystem:statisticremain:remove')")
@Log(title = "当日持仓统计", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(statisticsRemainService.deleteStatisticsRemainByIds(ids));
}
}

@ -0,0 +1,104 @@
package com.ruoyi.booksystem.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.booksystem.domain.StatisticsTotal;
import com.ruoyi.booksystem.service.IStatisticsTotalService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* Controller
*
* @author ruoyi
* @date 2023-12-18
*/
@RestController
@RequestMapping("/booksystem/statistictotal")
public class StatisticsTotalController extends BaseController
{
@Autowired
private IStatisticsTotalService statisticsTotalService;
/**
*
*/
@PreAuthorize("@ss.hasPermi('booksystem:statistictotal:list')")
@GetMapping("/list")
public TableDataInfo list(StatisticsTotal statisticsTotal)
{
startPage();
List<StatisticsTotal> list = statisticsTotalService.selectStatisticsTotalList(statisticsTotal);
return getDataTable(list);
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('booksystem:statistictotal:export')")
@Log(title = "统计当日持仓", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, StatisticsTotal statisticsTotal)
{
List<StatisticsTotal> list = statisticsTotalService.selectStatisticsTotalList(statisticsTotal);
ExcelUtil<StatisticsTotal> util = new ExcelUtil<StatisticsTotal>(StatisticsTotal.class);
util.exportExcel(response, list, "统计当日持仓数据");
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('booksystem:statistictotal:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return AjaxResult.success(statisticsTotalService.selectStatisticsTotalById(id));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('booksystem:statistictotal:add')")
@Log(title = "统计当日持仓", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody StatisticsTotal statisticsTotal)
{
return toAjax(statisticsTotalService.insertStatisticsTotal(statisticsTotal));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('booksystem:statistictotal:edit')")
@Log(title = "统计当日持仓", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody StatisticsTotal statisticsTotal)
{
return toAjax(statisticsTotalService.updateStatisticsTotal(statisticsTotal));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('booksystem:statistictotal:remove')")
@Log(title = "统计当日持仓", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(statisticsTotalService.deleteStatisticsTotalByIds(ids));
}
}

@ -0,0 +1,153 @@
package com.ruoyi.booksystem.domain;
import java.math.BigDecimal;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* account
*
* @author ruoyi
* @date 2023-12-18
*/
public class Account extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** $column.columnComment */
private Long id;
/** 交易日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "交易日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date tradeDay;
/** 交易日星期 */
@Excel(name = "交易日星期")
private String weekDay;
/** 净资产 */
@Excel(name = "净资产")
private BigDecimal assets;
/** 总资产 */
@Excel(name = "总资产")
private BigDecimal totalAssets;
/** 当日盈亏 */
@Excel(name = "当日盈亏")
private BigDecimal profit;
/** 当日净资产盈亏比例 */
@Excel(name = "当日净资产盈亏比例")
private BigDecimal assetsDiff;
/** 当日总资产盈亏比例 */
@Excel(name = "当日总资产盈亏比例")
private BigDecimal totalDiff;
/** 用户id */
@Excel(name = "用户id")
private Long userId;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setTradeDay(Date tradeDay)
{
this.tradeDay = tradeDay;
}
public Date getTradeDay()
{
return tradeDay;
}
public void setWeekDay(String weekDay)
{
this.weekDay = weekDay;
}
public String getWeekDay()
{
return weekDay;
}
public void setAssets(BigDecimal assets)
{
this.assets = assets;
}
public BigDecimal getAssets()
{
return assets;
}
public void setTotalAssets(BigDecimal totalAssets)
{
this.totalAssets = totalAssets;
}
public BigDecimal getTotalAssets()
{
return totalAssets;
}
public void setProfit(BigDecimal profit)
{
this.profit = profit;
}
public BigDecimal getProfit()
{
return profit;
}
public void setAssetsDiff(BigDecimal assetsDiff)
{
this.assetsDiff = assetsDiff;
}
public BigDecimal getAssetsDiff()
{
return assetsDiff;
}
public void setTotalDiff(BigDecimal totalDiff)
{
this.totalDiff = totalDiff;
}
public BigDecimal getTotalDiff()
{
return totalDiff;
}
public void setUserId(Long userId)
{
this.userId = userId;
}
public Long getUserId()
{
return userId;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("tradeDay", getTradeDay())
.append("weekDay", getWeekDay())
.append("assets", getAssets())
.append("totalAssets", getTotalAssets())
.append("profit", getProfit())
.append("assetsDiff", getAssetsDiff())
.append("totalDiff", getTotalDiff())
.append("userId", getUserId())
.toString();
}
}

@ -0,0 +1,265 @@
package com.ruoyi.booksystem.domain;
import java.math.BigDecimal;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* operations
*
* @author ruoyi
* @date 2023-12-18
*/
public class Operations extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** $column.columnComment */
private Long id;
/** 股票代码 */
@Excel(name = "股票代码")
private String code;
/** 股票名称 */
@Excel(name = "股票名称")
private String name;
/** 交易日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "交易日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date tradeDay;
/** 交易日星期 */
@Excel(name = "交易日星期")
private String weekDay;
/** 操作(含账户转入转出) */
@Excel(name = "操作", readConverterExp = "含=账户转入转出")
private String operate;
/** 交易价格 */
@Excel(name = "交易价格")
private BigDecimal dealPrice;
/** 成交量 */
@Excel(name = "成交量")
private Long volumn;
/** 成交额 */
@Excel(name = "成交额")
private BigDecimal amount;
/** 印花税 */
@Excel(name = "印花税")
private BigDecimal tax;
/** 手续费 */
@Excel(name = "手续费")
private BigDecimal fee;
/** 其他费用 */
@Excel(name = "其他费用")
private BigDecimal other;
/** 操作时涨跌 */
@Excel(name = "操作时涨跌")
private BigDecimal operateDiff;
/** 关联操作id */
@Excel(name = "关联操作id")
private Long preId;
/** 用户id */
@Excel(name = "用户id")
private Long userId;
/** 操作逻辑 */
@Excel(name = "操作逻辑")
private String dealLogic;
/** 备注 */
@Excel(name = "备注")
private String bz;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setCode(String code)
{
this.code = code;
}
public String getCode()
{
return code;
}
public void setName(String name)
{
this.name = name;
}
public String getName()
{
return name;
}
public void setTradeDay(Date tradeDay)
{
this.tradeDay = tradeDay;
}
public Date getTradeDay()
{
return tradeDay;
}
public void setWeekDay(String weekDay)
{
this.weekDay = weekDay;
}
public String getWeekDay()
{
return weekDay;
}
public void setOperate(String operate)
{
this.operate = operate;
}
public String getOperate()
{
return operate;
}
public void setDealPrice(BigDecimal dealPrice)
{
this.dealPrice = dealPrice;
}
public BigDecimal getDealPrice()
{
return dealPrice;
}
public void setVolumn(Long volumn)
{
this.volumn = volumn;
}
public Long getVolumn()
{
return volumn;
}
public void setAmount(BigDecimal amount)
{
this.amount = amount;
}
public BigDecimal getAmount()
{
return amount;
}
public void setTax(BigDecimal tax)
{
this.tax = tax;
}
public BigDecimal getTax()
{
return tax;
}
public void setFee(BigDecimal fee)
{
this.fee = fee;
}
public BigDecimal getFee()
{
return fee;
}
public void setOther(BigDecimal other)
{
this.other = other;
}
public BigDecimal getOther()
{
return other;
}
public void setOperateDiff(BigDecimal operateDiff)
{
this.operateDiff = operateDiff;
}
public BigDecimal getOperateDiff()
{
return operateDiff;
}
public void setPreId(Long preId)
{
this.preId = preId;
}
public Long getPreId()
{
return preId;
}
public void setUserId(Long userId)
{
this.userId = userId;
}
public Long getUserId()
{
return userId;
}
public void setDealLogic(String dealLogic)
{
this.dealLogic = dealLogic;
}
public String getDealLogic()
{
return dealLogic;
}
public void setBz(String bz)
{
this.bz = bz;
}
public String getBz()
{
return bz;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("code", getCode())
.append("name", getName())
.append("tradeDay", getTradeDay())
.append("weekDay", getWeekDay())
.append("operate", getOperate())
.append("dealPrice", getDealPrice())
.append("volumn", getVolumn())
.append("amount", getAmount())
.append("tax", getTax())
.append("fee", getFee())
.append("other", getOther())
.append("operateDiff", getOperateDiff())
.append("preId", getPreId())
.append("userId", getUserId())
.append("dealLogic", getDealLogic())
.append("bz", getBz())
.toString();
}
}

@ -0,0 +1,181 @@
package com.ruoyi.booksystem.domain;
import java.math.BigDecimal;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* statistics
*
* @author ruoyi
* @date 2023-12-18
*/
public class Statistics extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** $column.columnComment */
private Long id;
/** 股票代码 */
@Excel(name = "股票代码")
private String code;
/** 股票名称 */
@Excel(name = "股票名称")
private String name;
/** 交易日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "交易日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date tradeDay;
/** 交易日星期 */
@Excel(name = "交易日星期")
private String weekDay;
/** 操作id */
@Excel(name = "操作id")
private String operationsId;
/** 当笔当日盈亏 */
@Excel(name = "当笔当日盈亏")
private BigDecimal profit;
/** 当笔当日盈亏盈亏比例 */
@Excel(name = "当笔当日盈亏盈亏比例")
private Long diff;
/** 操作id */
@Excel(name = "操作id")
private Long operateionId;
/** 用户id */
@Excel(name = "用户id")
private Long userId;
/** 备注 */
@Excel(name = "备注")
private String bz;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setCode(String code)
{
this.code = code;
}
public String getCode()
{
return code;
}
public void setName(String name)
{
this.name = name;
}
public String getName()
{
return name;
}
public void setTradeDay(Date tradeDay)
{
this.tradeDay = tradeDay;
}
public Date getTradeDay()
{
return tradeDay;
}
public void setWeekDay(String weekDay)
{
this.weekDay = weekDay;
}
public String getWeekDay()
{
return weekDay;
}
public void setOperationsId(String operationsId)
{
this.operationsId = operationsId;
}
public String getOperationsId()
{
return operationsId;
}
public void setProfit(BigDecimal profit)
{
this.profit = profit;
}
public BigDecimal getProfit()
{
return profit;
}
public void setDiff(Long diff)
{
this.diff = diff;
}
public Long getDiff()
{
return diff;
}
public void setOperateionId(Long operateionId)
{
this.operateionId = operateionId;
}
public Long getOperateionId()
{
return operateionId;
}
public void setUserId(Long userId)
{
this.userId = userId;
}
public Long getUserId()
{
return userId;
}
public void setBz(String bz)
{
this.bz = bz;
}
public String getBz()
{
return bz;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("code", getCode())
.append("name", getName())
.append("tradeDay", getTradeDay())
.append("weekDay", getWeekDay())
.append("operationsId", getOperationsId())
.append("profit", getProfit())
.append("diff", getDiff())
.append("operateionId", getOperateionId())
.append("userId", getUserId())
.append("bz", getBz())
.toString();
}
}

@ -0,0 +1,181 @@
package com.ruoyi.booksystem.domain;
import java.math.BigDecimal;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* statistics_remain
*
* @author ruoyi
* @date 2023-12-18
*/
public class StatisticsRemain extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** $column.columnComment */
private Long id;
/** 股票代码 */
@Excel(name = "股票代码")
private String code;
/** 股票名称 */
@Excel(name = "股票名称")
private String name;
/** 交易日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "交易日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date tradeDay;
/** 交易日星期 */
@Excel(name = "交易日星期")
private String weekDay;
/** 总盈亏 */
@Excel(name = "总盈亏")
private BigDecimal totalProfit;
/** 总盈亏比例 */
@Excel(name = "总盈亏比例")
private BigDecimal totalDiff;
/** 总盈亏占整体盈亏比例 */
@Excel(name = "总盈亏占整体盈亏比例")
private BigDecimal totalDiffOverall;
/** 剩余数量 */
@Excel(name = "剩余数量")
private BigDecimal remaining;
/** 用户id */
@Excel(name = "用户id")
private Long userId;
/** 备注 */
@Excel(name = "备注")
private String bz;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setCode(String code)
{
this.code = code;
}
public String getCode()
{
return code;
}
public void setName(String name)
{
this.name = name;
}
public String getName()
{
return name;
}
public void setTradeDay(Date tradeDay)
{
this.tradeDay = tradeDay;
}
public Date getTradeDay()
{
return tradeDay;
}
public void setWeekDay(String weekDay)
{
this.weekDay = weekDay;
}
public String getWeekDay()
{
return weekDay;
}
public void setTotalProfit(BigDecimal totalProfit)
{
this.totalProfit = totalProfit;
}
public BigDecimal getTotalProfit()
{
return totalProfit;
}
public void setTotalDiff(BigDecimal totalDiff)
{
this.totalDiff = totalDiff;
}
public BigDecimal getTotalDiff()
{
return totalDiff;
}
public void setTotalDiffOverall(BigDecimal totalDiffOverall)
{
this.totalDiffOverall = totalDiffOverall;
}
public BigDecimal getTotalDiffOverall()
{
return totalDiffOverall;
}
public void setRemaining(BigDecimal remaining)
{
this.remaining = remaining;
}
public BigDecimal getRemaining()
{
return remaining;
}
public void setUserId(Long userId)
{
this.userId = userId;
}
public Long getUserId()
{
return userId;
}
public void setBz(String bz)
{
this.bz = bz;
}
public String getBz()
{
return bz;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("code", getCode())
.append("name", getName())
.append("tradeDay", getTradeDay())
.append("weekDay", getWeekDay())
.append("totalProfit", getTotalProfit())
.append("totalDiff", getTotalDiff())
.append("totalDiffOverall", getTotalDiffOverall())
.append("remaining", getRemaining())
.append("userId", getUserId())
.append("bz", getBz())
.toString();
}
}

@ -0,0 +1,266 @@
package com.ruoyi.booksystem.domain;
import java.math.BigDecimal;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* statistics_total
*
* @author ruoyi
* @date 2023-12-18
*/
public class StatisticsTotal extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** $column.columnComment */
private Long id;
/** 股票代码 */
@Excel(name = "股票代码")
private String code;
/** 股票名称 */
@Excel(name = "股票名称")
private String name;
/** 建仓交易日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "建仓交易日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date startTradeDay;
/** 清仓交易日星期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "清仓交易日星期", width = 30, dateFormat = "yyyy-MM-dd")
private Date endTradeDay;
/** 总盈亏 */
@Excel(name = "总盈亏")
private BigDecimal totalProfit;
/** 总盈亏比例 */
@Excel(name = "总盈亏比例")
private BigDecimal totalDiff;
/** 建仓交易价格 */
@Excel(name = "建仓交易价格")
private BigDecimal startPrice;
/** 建仓交易价格 */
@Excel(name = "建仓交易价格")
private BigDecimal endPrice;
/** 总成交量 */
@Excel(name = "总成交量")
private Long volumnTotal;
/** 总成交额 */
@Excel(name = "总成交额")
private BigDecimal amountTotal;
/** 交易次数 */
@Excel(name = "交易次数")
private BigDecimal operateTimes;
/** 总手续费 */
@Excel(name = "总手续费")
private BigDecimal fee;
/** 总印花税 */
@Excel(name = "总印花税")
private BigDecimal tax;
/** 总其他费用 */
@Excel(name = "总其他费用")
private BigDecimal other;
/** 用户id */
@Excel(name = "用户id")
private Long userId;
/** 备注 */
@Excel(name = "备注")
private String bz;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setCode(String code)
{
this.code = code;
}
public String getCode()
{
return code;
}
public void setName(String name)
{
this.name = name;
}
public String getName()
{
return name;
}
public void setStartTradeDay(Date startTradeDay)
{
this.startTradeDay = startTradeDay;
}
public Date getStartTradeDay()
{
return startTradeDay;
}
public void setEndTradeDay(Date endTradeDay)
{
this.endTradeDay = endTradeDay;
}
public Date getEndTradeDay()
{
return endTradeDay;
}
public void setTotalProfit(BigDecimal totalProfit)
{
this.totalProfit = totalProfit;
}
public BigDecimal getTotalProfit()
{
return totalProfit;
}
public void setTotalDiff(BigDecimal totalDiff)
{
this.totalDiff = totalDiff;
}
public BigDecimal getTotalDiff()
{
return totalDiff;
}
public void setStartPrice(BigDecimal startPrice)
{
this.startPrice = startPrice;
}
public BigDecimal getStartPrice()
{
return startPrice;
}
public void setEndPrice(BigDecimal endPrice)
{
this.endPrice = endPrice;
}
public BigDecimal getEndPrice()
{
return endPrice;
}
public void setVolumnTotal(Long volumnTotal)
{
this.volumnTotal = volumnTotal;
}
public Long getVolumnTotal()
{
return volumnTotal;
}
public void setAmountTotal(BigDecimal amountTotal)
{
this.amountTotal = amountTotal;
}
public BigDecimal getAmountTotal()
{
return amountTotal;
}
public void setOperateTimes(BigDecimal operateTimes)
{
this.operateTimes = operateTimes;
}
public BigDecimal getOperateTimes()
{
return operateTimes;
}
public void setFee(BigDecimal fee)
{
this.fee = fee;
}
public BigDecimal getFee()
{
return fee;
}
public void setTax(BigDecimal tax)
{
this.tax = tax;
}
public BigDecimal getTax()
{
return tax;
}
public void setOther(BigDecimal other)
{
this.other = other;
}
public BigDecimal getOther()
{
return other;
}
public void setUserId(Long userId)
{
this.userId = userId;
}
public Long getUserId()
{
return userId;
}
public void setBz(String bz)
{
this.bz = bz;
}
public String getBz()
{
return bz;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("code", getCode())
.append("name", getName())
.append("startTradeDay", getStartTradeDay())
.append("endTradeDay", getEndTradeDay())
.append("totalProfit", getTotalProfit())
.append("totalDiff", getTotalDiff())
.append("startPrice", getStartPrice())
.append("endPrice", getEndPrice())
.append("volumnTotal", getVolumnTotal())
.append("amountTotal", getAmountTotal())
.append("operateTimes", getOperateTimes())
.append("fee", getFee())
.append("tax", getTax())
.append("other", getOther())
.append("userId", getUserId())
.append("bz", getBz())
.toString();
}
}

@ -0,0 +1,61 @@
package com.ruoyi.booksystem.mapper;
import java.util.List;
import com.ruoyi.booksystem.domain.Account;
/**
* Mapper
*
* @author ruoyi
* @date 2023-12-18
*/
public interface AccountMapper
{
/**
*
*
* @param id
* @return
*/
public Account selectAccountById(Long id);
/**
*
*
* @param account
* @return
*/
public List<Account> selectAccountList(Account account);
/**
*
*
* @param account
* @return
*/
public int insertAccount(Account account);
/**
*
*
* @param account
* @return
*/
public int updateAccount(Account account);
/**
*
*
* @param id
* @return
*/
public int deleteAccountById(Long id);
/**
*
*
* @param ids
* @return
*/
public int deleteAccountByIds(Long[] ids);
}

@ -0,0 +1,61 @@
package com.ruoyi.booksystem.mapper;
import java.util.List;
import com.ruoyi.booksystem.domain.Operations;
/**
* Mapper
*
* @author ruoyi
* @date 2023-12-18
*/
public interface OperationsMapper
{
/**
*
*
* @param id
* @return
*/
public Operations selectOperationsById(Long id);
/**
*
*
* @param operations
* @return
*/
public List<Operations> selectOperationsList(Operations operations);
/**
*
*
* @param operations
* @return
*/
public int insertOperations(Operations operations);
/**
*
*
* @param operations
* @return
*/
public int updateOperations(Operations operations);
/**
*
*
* @param id
* @return
*/
public int deleteOperationsById(Long id);
/**
*
*
* @param ids
* @return
*/
public int deleteOperationsByIds(Long[] ids);
}

@ -0,0 +1,61 @@
package com.ruoyi.booksystem.mapper;
import java.util.List;
import com.ruoyi.booksystem.domain.Statistics;
/**
* Mapper
*
* @author ruoyi
* @date 2023-12-18
*/
public interface StatisticsMapper
{
/**
*
*
* @param id
* @return
*/
public Statistics selectStatisticsById(Long id);
/**
*
*
* @param statistics
* @return
*/
public List<Statistics> selectStatisticsList(Statistics statistics);
/**
*
*
* @param statistics
* @return
*/
public int insertStatistics(Statistics statistics);
/**
*
*
* @param statistics
* @return
*/
public int updateStatistics(Statistics statistics);
/**
*
*
* @param id
* @return
*/
public int deleteStatisticsById(Long id);
/**
*
*
* @param ids
* @return
*/
public int deleteStatisticsByIds(Long[] ids);
}

@ -0,0 +1,61 @@
package com.ruoyi.booksystem.mapper;
import java.util.List;
import com.ruoyi.booksystem.domain.StatisticsRemain;
/**
* Mapper
*
* @author ruoyi
* @date 2023-12-18
*/
public interface StatisticsRemainMapper
{
/**
*
*
* @param id
* @return
*/
public StatisticsRemain selectStatisticsRemainById(Long id);
/**
*
*
* @param statisticsRemain
* @return
*/
public List<StatisticsRemain> selectStatisticsRemainList(StatisticsRemain statisticsRemain);
/**
*
*
* @param statisticsRemain
* @return
*/
public int insertStatisticsRemain(StatisticsRemain statisticsRemain);
/**
*
*
* @param statisticsRemain
* @return
*/
public int updateStatisticsRemain(StatisticsRemain statisticsRemain);
/**
*
*
* @param id
* @return
*/
public int deleteStatisticsRemainById(Long id);
/**
*
*
* @param ids
* @return
*/
public int deleteStatisticsRemainByIds(Long[] ids);
}

@ -0,0 +1,61 @@
package com.ruoyi.booksystem.mapper;
import java.util.List;
import com.ruoyi.booksystem.domain.StatisticsTotal;
/**
* Mapper
*
* @author ruoyi
* @date 2023-12-18
*/
public interface StatisticsTotalMapper
{
/**
*
*
* @param id
* @return
*/
public StatisticsTotal selectStatisticsTotalById(Long id);
/**
*
*
* @param statisticsTotal
* @return
*/
public List<StatisticsTotal> selectStatisticsTotalList(StatisticsTotal statisticsTotal);
/**
*
*
* @param statisticsTotal
* @return
*/
public int insertStatisticsTotal(StatisticsTotal statisticsTotal);
/**
*
*
* @param statisticsTotal
* @return
*/
public int updateStatisticsTotal(StatisticsTotal statisticsTotal);
/**
*
*
* @param id
* @return
*/
public int deleteStatisticsTotalById(Long id);
/**
*
*
* @param ids
* @return
*/
public int deleteStatisticsTotalByIds(Long[] ids);
}

@ -0,0 +1,61 @@
package com.ruoyi.booksystem.service;
import java.util.List;
import com.ruoyi.booksystem.domain.Account;
/**
* Service
*
* @author ruoyi
* @date 2023-12-18
*/
public interface IAccountService
{
/**
*
*
* @param id
* @return
*/
public Account selectAccountById(Long id);
/**
*
*
* @param account
* @return
*/
public List<Account> selectAccountList(Account account);
/**
*
*
* @param account
* @return
*/
public int insertAccount(Account account);
/**
*
*
* @param account
* @return
*/
public int updateAccount(Account account);
/**
*
*
* @param ids
* @return
*/
public int deleteAccountByIds(Long[] ids);
/**
*
*
* @param id
* @return
*/
public int deleteAccountById(Long id);
}

@ -0,0 +1,61 @@
package com.ruoyi.booksystem.service;
import java.util.List;
import com.ruoyi.booksystem.domain.Operations;
/**
* Service
*
* @author ruoyi
* @date 2023-12-18
*/
public interface IOperationsService
{
/**
*
*
* @param id
* @return
*/
public Operations selectOperationsById(Long id);
/**
*
*
* @param operations
* @return
*/
public List<Operations> selectOperationsList(Operations operations);
/**
*
*
* @param operations
* @return
*/
public int insertOperations(Operations operations);
/**
*
*
* @param operations
* @return
*/
public int updateOperations(Operations operations);
/**
*
*
* @param ids
* @return
*/
public int deleteOperationsByIds(Long[] ids);
/**
*
*
* @param id
* @return
*/
public int deleteOperationsById(Long id);
}

@ -0,0 +1,61 @@
package com.ruoyi.booksystem.service;
import java.util.List;
import com.ruoyi.booksystem.domain.StatisticsRemain;
/**
* Service
*
* @author ruoyi
* @date 2023-12-18
*/
public interface IStatisticsRemainService
{
/**
*
*
* @param id
* @return
*/
public StatisticsRemain selectStatisticsRemainById(Long id);
/**
*
*
* @param statisticsRemain
* @return
*/
public List<StatisticsRemain> selectStatisticsRemainList(StatisticsRemain statisticsRemain);
/**
*
*
* @param statisticsRemain
* @return
*/
public int insertStatisticsRemain(StatisticsRemain statisticsRemain);
/**
*
*
* @param statisticsRemain
* @return
*/
public int updateStatisticsRemain(StatisticsRemain statisticsRemain);
/**
*
*
* @param ids
* @return
*/
public int deleteStatisticsRemainByIds(Long[] ids);
/**
*
*
* @param id
* @return
*/
public int deleteStatisticsRemainById(Long id);
}

@ -0,0 +1,61 @@
package com.ruoyi.booksystem.service;
import java.util.List;
import com.ruoyi.booksystem.domain.Statistics;
/**
* Service
*
* @author ruoyi
* @date 2023-12-18
*/
public interface IStatisticsService
{
/**
*
*
* @param id
* @return
*/
public Statistics selectStatisticsById(Long id);
/**
*
*
* @param statistics
* @return
*/
public List<Statistics> selectStatisticsList(Statistics statistics);
/**
*
*
* @param statistics
* @return
*/
public int insertStatistics(Statistics statistics);
/**
*
*
* @param statistics
* @return
*/
public int updateStatistics(Statistics statistics);
/**
*
*
* @param ids
* @return
*/
public int deleteStatisticsByIds(Long[] ids);
/**
*
*
* @param id
* @return
*/
public int deleteStatisticsById(Long id);
}

@ -0,0 +1,61 @@
package com.ruoyi.booksystem.service;
import java.util.List;
import com.ruoyi.booksystem.domain.StatisticsTotal;
/**
* Service
*
* @author ruoyi
* @date 2023-12-18
*/
public interface IStatisticsTotalService
{
/**
*
*
* @param id
* @return
*/
public StatisticsTotal selectStatisticsTotalById(Long id);
/**
*
*
* @param statisticsTotal
* @return
*/
public List<StatisticsTotal> selectStatisticsTotalList(StatisticsTotal statisticsTotal);
/**
*
*
* @param statisticsTotal
* @return
*/
public int insertStatisticsTotal(StatisticsTotal statisticsTotal);
/**
*
*
* @param statisticsTotal
* @return
*/
public int updateStatisticsTotal(StatisticsTotal statisticsTotal);
/**
*
*
* @param ids
* @return
*/
public int deleteStatisticsTotalByIds(Long[] ids);
/**
*
*
* @param id
* @return
*/
public int deleteStatisticsTotalById(Long id);
}

@ -0,0 +1,93 @@
package com.ruoyi.booksystem.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.booksystem.mapper.AccountMapper;
import com.ruoyi.booksystem.domain.Account;
import com.ruoyi.booksystem.service.IAccountService;
/**
* Service
*
* @author ruoyi
* @date 2023-12-18
*/
@Service
public class AccountServiceImpl implements IAccountService
{
@Autowired
private AccountMapper accountMapper;
/**
*
*
* @param id
* @return
*/
@Override
public Account selectAccountById(Long id)
{
return accountMapper.selectAccountById(id);
}
/**
*
*
* @param account
* @return
*/
@Override
public List<Account> selectAccountList(Account account)
{
return accountMapper.selectAccountList(account);
}
/**
*
*
* @param account
* @return
*/
@Override
public int insertAccount(Account account)
{
return accountMapper.insertAccount(account);
}
/**
*
*
* @param account
* @return
*/
@Override
public int updateAccount(Account account)
{
return accountMapper.updateAccount(account);
}
/**
*
*
* @param ids
* @return
*/
@Override
public int deleteAccountByIds(Long[] ids)
{
return accountMapper.deleteAccountByIds(ids);
}
/**
*
*
* @param id
* @return
*/
@Override
public int deleteAccountById(Long id)
{
return accountMapper.deleteAccountById(id);
}
}

@ -0,0 +1,93 @@
package com.ruoyi.booksystem.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.booksystem.mapper.OperationsMapper;
import com.ruoyi.booksystem.domain.Operations;
import com.ruoyi.booksystem.service.IOperationsService;
/**
* Service
*
* @author ruoyi
* @date 2023-12-18
*/
@Service
public class OperationsServiceImpl implements IOperationsService
{
@Autowired
private OperationsMapper operationsMapper;
/**
*
*
* @param id
* @return
*/
@Override
public Operations selectOperationsById(Long id)
{
return operationsMapper.selectOperationsById(id);
}
/**
*
*
* @param operations
* @return
*/
@Override
public List<Operations> selectOperationsList(Operations operations)
{
return operationsMapper.selectOperationsList(operations);
}
/**
*
*
* @param operations
* @return
*/
@Override
public int insertOperations(Operations operations)
{
return operationsMapper.insertOperations(operations);
}
/**
*
*
* @param operations
* @return
*/
@Override
public int updateOperations(Operations operations)
{
return operationsMapper.updateOperations(operations);
}
/**
*
*
* @param ids
* @return
*/
@Override
public int deleteOperationsByIds(Long[] ids)
{
return operationsMapper.deleteOperationsByIds(ids);
}
/**
*
*
* @param id
* @return
*/
@Override
public int deleteOperationsById(Long id)
{
return operationsMapper.deleteOperationsById(id);
}
}

@ -0,0 +1,93 @@
package com.ruoyi.booksystem.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.booksystem.mapper.StatisticsRemainMapper;
import com.ruoyi.booksystem.domain.StatisticsRemain;
import com.ruoyi.booksystem.service.IStatisticsRemainService;
/**
* Service
*
* @author ruoyi
* @date 2023-12-18
*/
@Service
public class StatisticsRemainServiceImpl implements IStatisticsRemainService
{
@Autowired
private StatisticsRemainMapper statisticsRemainMapper;
/**
*
*
* @param id
* @return
*/
@Override
public StatisticsRemain selectStatisticsRemainById(Long id)
{
return statisticsRemainMapper.selectStatisticsRemainById(id);
}
/**
*
*
* @param statisticsRemain
* @return
*/
@Override
public List<StatisticsRemain> selectStatisticsRemainList(StatisticsRemain statisticsRemain)
{
return statisticsRemainMapper.selectStatisticsRemainList(statisticsRemain);
}
/**
*
*
* @param statisticsRemain
* @return
*/
@Override
public int insertStatisticsRemain(StatisticsRemain statisticsRemain)
{
return statisticsRemainMapper.insertStatisticsRemain(statisticsRemain);
}
/**
*
*
* @param statisticsRemain
* @return
*/
@Override
public int updateStatisticsRemain(StatisticsRemain statisticsRemain)
{
return statisticsRemainMapper.updateStatisticsRemain(statisticsRemain);
}
/**
*
*
* @param ids
* @return
*/
@Override
public int deleteStatisticsRemainByIds(Long[] ids)
{
return statisticsRemainMapper.deleteStatisticsRemainByIds(ids);
}
/**
*
*
* @param id
* @return
*/
@Override
public int deleteStatisticsRemainById(Long id)
{
return statisticsRemainMapper.deleteStatisticsRemainById(id);
}
}

@ -0,0 +1,93 @@
package com.ruoyi.booksystem.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.booksystem.mapper.StatisticsMapper;
import com.ruoyi.booksystem.domain.Statistics;
import com.ruoyi.booksystem.service.IStatisticsService;
/**
* Service
*
* @author ruoyi
* @date 2023-12-18
*/
@Service
public class StatisticsServiceImpl implements IStatisticsService
{
@Autowired
private StatisticsMapper statisticsMapper;
/**
*
*
* @param id
* @return
*/
@Override
public Statistics selectStatisticsById(Long id)
{
return statisticsMapper.selectStatisticsById(id);
}
/**
*
*
* @param statistics
* @return
*/
@Override
public List<Statistics> selectStatisticsList(Statistics statistics)
{
return statisticsMapper.selectStatisticsList(statistics);
}
/**
*
*
* @param statistics
* @return
*/
@Override
public int insertStatistics(Statistics statistics)
{
return statisticsMapper.insertStatistics(statistics);
}
/**
*
*
* @param statistics
* @return
*/
@Override
public int updateStatistics(Statistics statistics)
{
return statisticsMapper.updateStatistics(statistics);
}
/**
*
*
* @param ids
* @return
*/
@Override
public int deleteStatisticsByIds(Long[] ids)
{
return statisticsMapper.deleteStatisticsByIds(ids);
}
/**
*
*
* @param id
* @return
*/
@Override
public int deleteStatisticsById(Long id)
{
return statisticsMapper.deleteStatisticsById(id);
}
}

@ -0,0 +1,93 @@
package com.ruoyi.booksystem.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.booksystem.mapper.StatisticsTotalMapper;
import com.ruoyi.booksystem.domain.StatisticsTotal;
import com.ruoyi.booksystem.service.IStatisticsTotalService;
/**
* Service
*
* @author ruoyi
* @date 2023-12-18
*/
@Service
public class StatisticsTotalServiceImpl implements IStatisticsTotalService
{
@Autowired
private StatisticsTotalMapper statisticsTotalMapper;
/**
*
*
* @param id
* @return
*/
@Override
public StatisticsTotal selectStatisticsTotalById(Long id)
{
return statisticsTotalMapper.selectStatisticsTotalById(id);
}
/**
*
*
* @param statisticsTotal
* @return
*/
@Override
public List<StatisticsTotal> selectStatisticsTotalList(StatisticsTotal statisticsTotal)
{
return statisticsTotalMapper.selectStatisticsTotalList(statisticsTotal);
}
/**
*
*
* @param statisticsTotal
* @return
*/
@Override
public int insertStatisticsTotal(StatisticsTotal statisticsTotal)
{
return statisticsTotalMapper.insertStatisticsTotal(statisticsTotal);
}
/**
*
*
* @param statisticsTotal
* @return
*/
@Override
public int updateStatisticsTotal(StatisticsTotal statisticsTotal)
{
return statisticsTotalMapper.updateStatisticsTotal(statisticsTotal);
}
/**
*
*
* @param ids
* @return
*/
@Override
public int deleteStatisticsTotalByIds(Long[] ids)
{
return statisticsTotalMapper.deleteStatisticsTotalByIds(ids);
}
/**
*
*
* @param id
* @return
*/
@Override
public int deleteStatisticsTotalById(Long id)
{
return statisticsTotalMapper.deleteStatisticsTotalById(id);
}
}

@ -0,0 +1,91 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.booksystem.mapper.AccountMapper">
<resultMap type="Account" id="AccountResult">
<result property="id" column="id" />
<result property="tradeDay" column="trade_day" />
<result property="weekDay" column="week_day" />
<result property="assets" column="assets" />
<result property="totalAssets" column="total_assets" />
<result property="profit" column="profit" />
<result property="assetsDiff" column="assets_diff" />
<result property="totalDiff" column="total_diff" />
<result property="userId" column="user_id" />
</resultMap>
<sql id="selectAccountVo">
select id, trade_day, week_day, assets, total_assets, profit, assets_diff, total_diff, user_id from account
</sql>
<select id="selectAccountList" parameterType="Account" resultMap="AccountResult">
<include refid="selectAccountVo"/>
<where>
<if test="tradeDay != null "> and trade_day = #{tradeDay}</if>
<if test="weekDay != null "> and week_day = #{weekDay}</if>
<if test="assets != null "> and assets = #{assets}</if>
<if test="totalAssets != null "> and total_assets = #{totalAssets}</if>
<if test="profit != null "> and profit = #{profit}</if>
<if test="assetsDiff != null "> and assets_diff = #{assetsDiff}</if>
<if test="totalDiff != null "> and total_diff = #{totalDiff}</if>
<if test="userId != null "> and user_id = #{userId}</if>
</where>
</select>
<select id="selectAccountById" parameterType="Long" resultMap="AccountResult">
<include refid="selectAccountVo"/>
where id = #{id}
</select>
<insert id="insertAccount" parameterType="Account" useGeneratedKeys="true" keyProperty="id">
insert into account
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="tradeDay != null">trade_day,</if>
<if test="weekDay != null">week_day,</if>
<if test="assets != null">assets,</if>
<if test="totalAssets != null">total_assets,</if>
<if test="profit != null">profit,</if>
<if test="assetsDiff != null">assets_diff,</if>
<if test="totalDiff != null">total_diff,</if>
<if test="userId != null">user_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="tradeDay != null">#{tradeDay},</if>
<if test="weekDay != null">#{weekDay},</if>
<if test="assets != null">#{assets},</if>
<if test="totalAssets != null">#{totalAssets},</if>
<if test="profit != null">#{profit},</if>
<if test="assetsDiff != null">#{assetsDiff},</if>
<if test="totalDiff != null">#{totalDiff},</if>
<if test="userId != null">#{userId},</if>
</trim>
</insert>
<update id="updateAccount" parameterType="Account">
update account
<trim prefix="SET" suffixOverrides=",">
<if test="tradeDay != null">trade_day = #{tradeDay},</if>
<if test="weekDay != null">week_day = #{weekDay},</if>
<if test="assets != null">assets = #{assets},</if>
<if test="totalAssets != null">total_assets = #{totalAssets},</if>
<if test="profit != null">profit = #{profit},</if>
<if test="assetsDiff != null">assets_diff = #{assetsDiff},</if>
<if test="totalDiff != null">total_diff = #{totalDiff},</if>
<if test="userId != null">user_id = #{userId},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteAccountById" parameterType="Long">
delete from account where id = #{id}
</delete>
<delete id="deleteAccountByIds" parameterType="String">
delete from account where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

@ -0,0 +1,131 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.booksystem.mapper.OperationsMapper">
<resultMap type="Operations" id="OperationsResult">
<result property="id" column="id" />
<result property="code" column="code" />
<result property="name" column="name" />
<result property="tradeDay" column="trade_day" />
<result property="weekDay" column="week_day" />
<result property="operate" column="operate" />
<result property="dealPrice" column="deal_price" />
<result property="volumn" column="volumn" />
<result property="amount" column="amount" />
<result property="tax" column="tax" />
<result property="fee" column="fee" />
<result property="other" column="other" />
<result property="operateDiff" column="operate_diff" />
<result property="preId" column="pre_id" />
<result property="userId" column="user_id" />
<result property="dealLogic" column="deal_logic" />
<result property="bz" column="bz" />
</resultMap>
<sql id="selectOperationsVo">
select id, code, name, trade_day, week_day, operate, deal_price, volumn, amount, tax, fee, other, operate_diff, pre_id, user_id, deal_logic, bz from operations
</sql>
<select id="selectOperationsList" parameterType="Operations" resultMap="OperationsResult">
<include refid="selectOperationsVo"/>
<where>
<if test="code != null and code != ''"> and code = #{code}</if>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="tradeDay != null "> and trade_day = #{tradeDay}</if>
<if test="weekDay != null "> and week_day = #{weekDay}</if>
<if test="operate != null and operate != ''"> and operate = #{operate}</if>
<if test="dealPrice != null "> and deal_price = #{dealPrice}</if>
<if test="volumn != null "> and volumn = #{volumn}</if>
<if test="amount != null "> and amount = #{amount}</if>
<if test="tax != null "> and tax = #{tax}</if>
<if test="fee != null "> and fee = #{fee}</if>
<if test="other != null "> and other = #{other}</if>
<if test="operateDiff != null "> and operate_diff = #{operateDiff}</if>
<if test="preId != null "> and pre_id = #{preId}</if>
<if test="userId != null "> and user_id = #{userId}</if>
<if test="dealLogic != null and dealLogic != ''"> and deal_logic = #{dealLogic}</if>
<if test="bz != null and bz != ''"> and bz = #{bz}</if>
</where>
</select>
<select id="selectOperationsById" parameterType="Long" resultMap="OperationsResult">
<include refid="selectOperationsVo"/>
where id = #{id}
</select>
<insert id="insertOperations" parameterType="Operations" useGeneratedKeys="true" keyProperty="id">
insert into operations
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="code != null and code != ''">code,</if>
<if test="name != null">name,</if>
<if test="tradeDay != null">trade_day,</if>
<if test="weekDay != null">week_day,</if>
<if test="operate != null and operate != ''">operate,</if>
<if test="dealPrice != null">deal_price,</if>
<if test="volumn != null">volumn,</if>
<if test="amount != null">amount,</if>
<if test="tax != null">tax,</if>
<if test="fee != null">fee,</if>
<if test="other != null">other,</if>
<if test="operateDiff != null">operate_diff,</if>
<if test="preId != null">pre_id,</if>
<if test="userId != null">user_id,</if>
<if test="dealLogic != null">deal_logic,</if>
<if test="bz != null">bz,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="code != null and code != ''">#{code},</if>
<if test="name != null">#{name},</if>
<if test="tradeDay != null">#{tradeDay},</if>
<if test="weekDay != null">#{weekDay},</if>
<if test="operate != null and operate != ''">#{operate},</if>
<if test="dealPrice != null">#{dealPrice},</if>
<if test="volumn != null">#{volumn},</if>
<if test="amount != null">#{amount},</if>
<if test="tax != null">#{tax},</if>
<if test="fee != null">#{fee},</if>
<if test="other != null">#{other},</if>
<if test="operateDiff != null">#{operateDiff},</if>
<if test="preId != null">#{preId},</if>
<if test="userId != null">#{userId},</if>
<if test="dealLogic != null">#{dealLogic},</if>
<if test="bz != null">#{bz},</if>
</trim>
</insert>
<update id="updateOperations" parameterType="Operations">
update operations
<trim prefix="SET" suffixOverrides=",">
<if test="code != null and code != ''">code = #{code},</if>
<if test="name != null">name = #{name},</if>
<if test="tradeDay != null">trade_day = #{tradeDay},</if>
<if test="weekDay != null">week_day = #{weekDay},</if>
<if test="operate != null and operate != ''">operate = #{operate},</if>
<if test="dealPrice != null">deal_price = #{dealPrice},</if>
<if test="volumn != null">volumn = #{volumn},</if>
<if test="amount != null">amount = #{amount},</if>
<if test="tax != null">tax = #{tax},</if>
<if test="fee != null">fee = #{fee},</if>
<if test="other != null">other = #{other},</if>
<if test="operateDiff != null">operate_diff = #{operateDiff},</if>
<if test="preId != null">pre_id = #{preId},</if>
<if test="userId != null">user_id = #{userId},</if>
<if test="dealLogic != null">deal_logic = #{dealLogic},</if>
<if test="bz != null">bz = #{bz},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteOperationsById" parameterType="Long">
delete from operations where id = #{id}
</delete>
<delete id="deleteOperationsByIds" parameterType="String">
delete from operations where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

@ -0,0 +1,101 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.booksystem.mapper.StatisticsMapper">
<resultMap type="Statistics" id="StatisticsResult">
<result property="id" column="id" />
<result property="code" column="code" />
<result property="name" column="name" />
<result property="tradeDay" column="trade_day" />
<result property="weekDay" column="week_day" />
<result property="operationsId" column="operations_id" />
<result property="profit" column="profit" />
<result property="diff" column="diff" />
<result property="operateionId" column="operateion_id" />
<result property="userId" column="user_id" />
<result property="bz" column="bz" />
</resultMap>
<sql id="selectStatisticsVo">
select id, code, name, trade_day, week_day, operations_id, profit, diff, operateion_id, user_id, bz from statistics
</sql>
<select id="selectStatisticsList" parameterType="Statistics" resultMap="StatisticsResult">
<include refid="selectStatisticsVo"/>
<where>
<if test="code != null and code != ''"> and code = #{code}</if>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="tradeDay != null "> and trade_day = #{tradeDay}</if>
<if test="weekDay != null "> and week_day = #{weekDay}</if>
<if test="operationsId != null and operationsId != ''"> and operations_id = #{operationsId}</if>
<if test="profit != null "> and profit = #{profit}</if>
<if test="diff != null "> and diff = #{diff}</if>
<if test="operateionId != null "> and operateion_id = #{operateionId}</if>
<if test="userId != null "> and user_id = #{userId}</if>
<if test="bz != null and bz != ''"> and bz = #{bz}</if>
</where>
</select>
<select id="selectStatisticsById" parameterType="Long" resultMap="StatisticsResult">
<include refid="selectStatisticsVo"/>
where id = #{id}
</select>
<insert id="insertStatistics" parameterType="Statistics" useGeneratedKeys="true" keyProperty="id">
insert into statistics
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="code != null and code != ''">code,</if>
<if test="name != null">name,</if>
<if test="tradeDay != null">trade_day,</if>
<if test="weekDay != null">week_day,</if>
<if test="operationsId != null and operationsId != ''">operations_id,</if>
<if test="profit != null">profit,</if>
<if test="diff != null">diff,</if>
<if test="operateionId != null">operateion_id,</if>
<if test="userId != null">user_id,</if>
<if test="bz != null">bz,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="code != null and code != ''">#{code},</if>
<if test="name != null">#{name},</if>
<if test="tradeDay != null">#{tradeDay},</if>
<if test="weekDay != null">#{weekDay},</if>
<if test="operationsId != null and operationsId != ''">#{operationsId},</if>
<if test="profit != null">#{profit},</if>
<if test="diff != null">#{diff},</if>
<if test="operateionId != null">#{operateionId},</if>
<if test="userId != null">#{userId},</if>
<if test="bz != null">#{bz},</if>
</trim>
</insert>
<update id="updateStatistics" parameterType="Statistics">
update statistics
<trim prefix="SET" suffixOverrides=",">
<if test="code != null and code != ''">code = #{code},</if>
<if test="name != null">name = #{name},</if>
<if test="tradeDay != null">trade_day = #{tradeDay},</if>
<if test="weekDay != null">week_day = #{weekDay},</if>
<if test="operationsId != null and operationsId != ''">operations_id = #{operationsId},</if>
<if test="profit != null">profit = #{profit},</if>
<if test="diff != null">diff = #{diff},</if>
<if test="operateionId != null">operateion_id = #{operateionId},</if>
<if test="userId != null">user_id = #{userId},</if>
<if test="bz != null">bz = #{bz},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteStatisticsById" parameterType="Long">
delete from statistics where id = #{id}
</delete>
<delete id="deleteStatisticsByIds" parameterType="String">
delete from statistics where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

@ -0,0 +1,101 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.booksystem.mapper.StatisticsRemainMapper">
<resultMap type="StatisticsRemain" id="StatisticsRemainResult">
<result property="id" column="id" />
<result property="code" column="code" />
<result property="name" column="name" />
<result property="tradeDay" column="trade_day" />
<result property="weekDay" column="week_day" />
<result property="totalProfit" column="total_profit" />
<result property="totalDiff" column="total_diff" />
<result property="totalDiffOverall" column="total_diff_overall" />
<result property="remaining" column="remaining" />
<result property="userId" column="user_id" />
<result property="bz" column="bz" />
</resultMap>
<sql id="selectStatisticsRemainVo">
select id, code, name, trade_day, week_day, total_profit, total_diff, total_diff_overall, remaining, user_id, bz from statistics_remain
</sql>
<select id="selectStatisticsRemainList" parameterType="StatisticsRemain" resultMap="StatisticsRemainResult">
<include refid="selectStatisticsRemainVo"/>
<where>
<if test="code != null and code != ''"> and code = #{code}</if>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="tradeDay != null "> and trade_day = #{tradeDay}</if>
<if test="weekDay != null "> and week_day = #{weekDay}</if>
<if test="totalProfit != null "> and total_profit = #{totalProfit}</if>
<if test="totalDiff != null "> and total_diff = #{totalDiff}</if>
<if test="totalDiffOverall != null "> and total_diff_overall = #{totalDiffOverall}</if>
<if test="remaining != null "> and remaining = #{remaining}</if>
<if test="userId != null "> and user_id = #{userId}</if>
<if test="bz != null and bz != ''"> and bz = #{bz}</if>
</where>
</select>
<select id="selectStatisticsRemainById" parameterType="Long" resultMap="StatisticsRemainResult">
<include refid="selectStatisticsRemainVo"/>
where id = #{id}
</select>
<insert id="insertStatisticsRemain" parameterType="StatisticsRemain" useGeneratedKeys="true" keyProperty="id">
insert into statistics_remain
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="code != null and code != ''">code,</if>
<if test="name != null">name,</if>
<if test="tradeDay != null">trade_day,</if>
<if test="weekDay != null">week_day,</if>
<if test="totalProfit != null">total_profit,</if>
<if test="totalDiff != null">total_diff,</if>
<if test="totalDiffOverall != null">total_diff_overall,</if>
<if test="remaining != null">remaining,</if>
<if test="userId != null">user_id,</if>
<if test="bz != null">bz,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="code != null and code != ''">#{code},</if>
<if test="name != null">#{name},</if>
<if test="tradeDay != null">#{tradeDay},</if>
<if test="weekDay != null">#{weekDay},</if>
<if test="totalProfit != null">#{totalProfit},</if>
<if test="totalDiff != null">#{totalDiff},</if>
<if test="totalDiffOverall != null">#{totalDiffOverall},</if>
<if test="remaining != null">#{remaining},</if>
<if test="userId != null">#{userId},</if>
<if test="bz != null">#{bz},</if>
</trim>
</insert>
<update id="updateStatisticsRemain" parameterType="StatisticsRemain">
update statistics_remain
<trim prefix="SET" suffixOverrides=",">
<if test="code != null and code != ''">code = #{code},</if>
<if test="name != null">name = #{name},</if>
<if test="tradeDay != null">trade_day = #{tradeDay},</if>
<if test="weekDay != null">week_day = #{weekDay},</if>
<if test="totalProfit != null">total_profit = #{totalProfit},</if>
<if test="totalDiff != null">total_diff = #{totalDiff},</if>
<if test="totalDiffOverall != null">total_diff_overall = #{totalDiffOverall},</if>
<if test="remaining != null">remaining = #{remaining},</if>
<if test="userId != null">user_id = #{userId},</if>
<if test="bz != null">bz = #{bz},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteStatisticsRemainById" parameterType="Long">
delete from statistics_remain where id = #{id}
</delete>
<delete id="deleteStatisticsRemainByIds" parameterType="String">
delete from statistics_remain where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

@ -0,0 +1,131 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.booksystem.mapper.StatisticsTotalMapper">
<resultMap type="StatisticsTotal" id="StatisticsTotalResult">
<result property="id" column="id" />
<result property="code" column="code" />
<result property="name" column="name" />
<result property="startTradeDay" column="start_trade_day" />
<result property="endTradeDay" column="end_trade_day" />
<result property="totalProfit" column="total_profit" />
<result property="totalDiff" column="total_diff" />
<result property="startPrice" column="start_price" />
<result property="endPrice" column="end_price" />
<result property="volumnTotal" column="volumn_total" />
<result property="amountTotal" column="amount_total" />
<result property="operateTimes" column="operate_times" />
<result property="fee" column="fee" />
<result property="tax" column="tax" />
<result property="other" column="other" />
<result property="userId" column="user_id" />
<result property="bz" column="bz" />
</resultMap>
<sql id="selectStatisticsTotalVo">
select id, code, name, start_trade_day, end_trade_day, total_profit, total_diff, start_price, end_price, volumn_total, amount_total, operate_times, fee, tax, other, user_id, bz from statistics_total
</sql>
<select id="selectStatisticsTotalList" parameterType="StatisticsTotal" resultMap="StatisticsTotalResult">
<include refid="selectStatisticsTotalVo"/>
<where>
<if test="code != null and code != ''"> and code = #{code}</if>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="startTradeDay != null "> and start_trade_day = #{startTradeDay}</if>
<if test="endTradeDay != null "> and end_trade_day = #{endTradeDay}</if>
<if test="totalProfit != null "> and total_profit = #{totalProfit}</if>
<if test="totalDiff != null "> and total_diff = #{totalDiff}</if>
<if test="startPrice != null "> and start_price = #{startPrice}</if>
<if test="endPrice != null "> and end_price = #{endPrice}</if>
<if test="volumnTotal != null "> and volumn_total = #{volumnTotal}</if>
<if test="amountTotal != null "> and amount_total = #{amountTotal}</if>
<if test="operateTimes != null "> and operate_times = #{operateTimes}</if>
<if test="fee != null "> and fee = #{fee}</if>
<if test="tax != null "> and tax = #{tax}</if>
<if test="other != null "> and other = #{other}</if>
<if test="userId != null "> and user_id = #{userId}</if>
<if test="bz != null and bz != ''"> and bz = #{bz}</if>
</where>
</select>
<select id="selectStatisticsTotalById" parameterType="Long" resultMap="StatisticsTotalResult">
<include refid="selectStatisticsTotalVo"/>
where id = #{id}
</select>
<insert id="insertStatisticsTotal" parameterType="StatisticsTotal" useGeneratedKeys="true" keyProperty="id">
insert into statistics_total
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="code != null and code != ''">code,</if>
<if test="name != null">name,</if>
<if test="startTradeDay != null">start_trade_day,</if>
<if test="endTradeDay != null">end_trade_day,</if>
<if test="totalProfit != null">total_profit,</if>
<if test="totalDiff != null">total_diff,</if>
<if test="startPrice != null">start_price,</if>
<if test="endPrice != null">end_price,</if>
<if test="volumnTotal != null">volumn_total,</if>
<if test="amountTotal != null">amount_total,</if>
<if test="operateTimes != null">operate_times,</if>
<if test="fee != null">fee,</if>
<if test="tax != null">tax,</if>
<if test="other != null">other,</if>
<if test="userId != null">user_id,</if>
<if test="bz != null">bz,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="code != null and code != ''">#{code},</if>
<if test="name != null">#{name},</if>
<if test="startTradeDay != null">#{startTradeDay},</if>
<if test="endTradeDay != null">#{endTradeDay},</if>
<if test="totalProfit != null">#{totalProfit},</if>
<if test="totalDiff != null">#{totalDiff},</if>
<if test="startPrice != null">#{startPrice},</if>
<if test="endPrice != null">#{endPrice},</if>
<if test="volumnTotal != null">#{volumnTotal},</if>
<if test="amountTotal != null">#{amountTotal},</if>
<if test="operateTimes != null">#{operateTimes},</if>
<if test="fee != null">#{fee},</if>
<if test="tax != null">#{tax},</if>
<if test="other != null">#{other},</if>
<if test="userId != null">#{userId},</if>
<if test="bz != null">#{bz},</if>
</trim>
</insert>
<update id="updateStatisticsTotal" parameterType="StatisticsTotal">
update statistics_total
<trim prefix="SET" suffixOverrides=",">
<if test="code != null and code != ''">code = #{code},</if>
<if test="name != null">name = #{name},</if>
<if test="startTradeDay != null">start_trade_day = #{startTradeDay},</if>
<if test="endTradeDay != null">end_trade_day = #{endTradeDay},</if>
<if test="totalProfit != null">total_profit = #{totalProfit},</if>
<if test="totalDiff != null">total_diff = #{totalDiff},</if>
<if test="startPrice != null">start_price = #{startPrice},</if>
<if test="endPrice != null">end_price = #{endPrice},</if>
<if test="volumnTotal != null">volumn_total = #{volumnTotal},</if>
<if test="amountTotal != null">amount_total = #{amountTotal},</if>
<if test="operateTimes != null">operate_times = #{operateTimes},</if>
<if test="fee != null">fee = #{fee},</if>
<if test="tax != null">tax = #{tax},</if>
<if test="other != null">other = #{other},</if>
<if test="userId != null">user_id = #{userId},</if>
<if test="bz != null">bz = #{bz},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteStatisticsTotalById" parameterType="Long">
delete from statistics_total where id = #{id}
</delete>
<delete id="deleteStatisticsTotalByIds" parameterType="String">
delete from statistics_total where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

@ -0,0 +1,147 @@
erDiagram
stock_industry {
INT industry_id PK
TINYINT industry_level
VARCHAR(20) industry_code UK
VARCHAR(50) industry_name
VARCHAR(20) parent_code
}
stock_basic {
INT id PK
VARCHAR(10) code UK
VARCHAR(20) name
INT industry_id FK
DATE list_date
VARCHAR(10) market_type
TINYINT status
}
stock_financial {
INT id PK
VARCHAR(10) code FK
DATE period
DECIMAL net_profit_yoy
DECIMAL net_profit_qoq
DECIMAL roe
DECIMAL eps
DECIMAL net_profit
DECIMAL basic_eps
DECIMAL bps
DECIMAL total_assets
DECIMAL total_liabilities
DECIMAL operating_income
DATETIME create_time
}
stock_index {
INT id PK
VARCHAR(10) code
VARCHAR(20) name
DATE trade_date
DECIMAL open
DECIMAL close
DECIMAL high
DECIMAL low
DECIMAL change_rate
BIGINT volume
DECIMAL amount
DATETIME create_time
}
stocks {
INT id PK
VARCHAR(10) code FK
DATE trade_date
DECIMAL open
DECIMAL close
DECIMAL change_rate
INT trade_days
BIGINT volume
DECIMAL amount
DECIMAL change_rate_10
DECIMAL change_rate_20
DECIMAL change_rate_60
DECIMAL avg_volume_20
DECIMAL free_float_market_value
DECIMAL total_market_value
DECIMAL agencies_hold
DATETIME create_time
}
stock_trend {
INT id PK
VARCHAR(10) code FK
DATE trade_date
DECIMAL ma5
DECIMAL ma10
DECIMAL ma20
DECIMAL ma60
DECIMAL macd
DECIMAL kdj_k
DECIMAL kdj_d
DECIMAL kdj_j
DECIMAL rsi
DECIMAL volume_ratio
DECIMAL turnover_rate
DATETIME create_time
}
stock_limit {
INT id PK
VARCHAR(10) code FK
DATE trade_date
TINYINT limit_type
DECIMAL limit_price
DECIMAL open_price
DECIMAL close_price
BIGINT volume
DECIMAL amount
DATETIME create_time
}
stock_new_record {
INT id PK
VARCHAR(10) code FK
DATE trade_date
TINYINT record_type
DECIMAL price
INT days
DATETIME create_time
}
trade_dates {
INT id PK
DATE trade_date UK
TINYINT is_trading
SMALLINT year
TINYINT month
TINYINT day
TINYINT weekday
TINYINT is_weekend
TINYINT is_holiday
DATETIME create_time
}
industry_trend {
INT id PK
INT industry_id FK
DATE trade_date
DECIMAL avg_change_rate
INT up_stocks_count
INT down_stocks_count
INT flat_stocks_count
INT limit_up_count
INT limit_down_count
DECIMAL total_market_value
DECIMAL avg_turnover_rate
DATETIME create_time
}
stock_basic ||--o{ stock_industry : belongs_to
stock_financial ||--o{ stock_basic : belongs_to
stocks ||--o{ stock_basic : belongs_to
stock_trend ||--o{ stock_basic : belongs_to
stock_limit ||--o{ stock_basic : belongs_to
stock_new_record ||--o{ stock_basic : belongs_to
industry_trend ||--o{ stock_industry : belongs_to

@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>ruoyi</artifactId>
<groupId>com.ruoyi</groupId>
<version>3.8.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>newstock-system</artifactId>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<!-- 通用工具-->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-system</artifactId>
</dependency>
<!-- 通用工具-->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common</artifactId>
</dependency>
</dependencies>
</project>

@ -0,0 +1,221 @@
package com.ruoyi.newstocksystem.controller;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.newstocksystem.domain.NewStockBasic;
import com.ruoyi.newstocksystem.domain.NewStocks;
import com.ruoyi.newstocksystem.service.INewStockBasicService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.newstocksystem.service.INewStocksService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
import org.springframework.web.multipart.MultipartFile;
/**
* Controller
*
* @author lxy
* @date 2026-01-18
*/
@RestController
@RequestMapping("/newstocksystem/newstocks")
public class NewStocksController extends BaseController
{
@Autowired
private INewStocksService newStocksService;
@Autowired
private INewStockBasicService newStockBasicService;
/**
*
*/
@GetMapping("/list")
public TableDataInfo list(NewStocks newStocks)
{
startPage();
List<NewStocks> list = newStocksService.selectNewStocksList(newStocks);
return getDataTable(list);
}
/**
*
*/
@GetMapping("/listB")
public TableDataInfo listB(NewStocks newStocks)
{
startPage();
List<NewStocks> list = newStocksService.selectNewStocksListB(newStocks);
return getDataTable(list);
}
/**
*
*/
@GetMapping("/listStrongStocks")
public TableDataInfo listStrongStocks(NewStocks newStocks)
{
startPage();
List<NewStocks> list = newStocksService.selectNewStrongStocksList(newStocks);
return getDataTable(list);
}
/**
*
*/
@GetMapping("/listLimitStocks")
public TableDataInfo listLimitStocks(NewStocks newStocks)
{
startPage();
List<NewStocks> list = newStocksService.selectNewLimitStocksList(newStocks);
return getDataTable(list);
}
/**
*
*/
@PostMapping("/export")
public void export(HttpServletResponse response, NewStocks newStocks)
{
List<NewStocks> list = newStocksService.selectNewStocksList(newStocks);
ExcelUtil<NewStocks> util = new ExcelUtil<NewStocks>(NewStocks.class);
util.exportExcel(response, list, "行情数据数据");
}
/**
*
*/
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Integer id)
{
return AjaxResult.success(newStocksService.selectNewStocksById(id));
}
/**
*
*/
@PostMapping
public AjaxResult add(@RequestBody NewStocks newStocks)
{
return toAjax(newStocksService.insertNewStocks(newStocks));
}
/**
*
*/
@PutMapping
public AjaxResult edit(@RequestBody NewStocks newStocks)
{
return toAjax(newStocksService.updateNewStocks(newStocks));
}
/**
*
*/
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Integer[] ids)
{
return toAjax(newStocksService.deleteNewStocksByIds(ids));
}
/**
*
*/
@PostMapping("/importData")
public AjaxResult importData(MultipartFile file, boolean updateSupport, String tradeDate)
{
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");//注意月份是MM
System.out.println(" tradeDay :" + tradeDate);
Date tradeDay1 = null;
try
{
tradeDay1 = simpleDateFormat.parse(tradeDate);
}catch (ParseException e) {
e.printStackTrace();
}
if(tradeDay1 == null)
{
return AjaxResult.success("tradeday error, import data failed");
}
ExcelUtil<NewStocks> util = new ExcelUtil<NewStocks>(NewStocks.class);
try
{
List<NewStocks> newStocksList = util.importExcel(file.getInputStream());
int successNum = newStocksService.importNewStocks(newStocksList, tradeDate);
return AjaxResult.success("导入成功 " + successNum + " 条数据");
}
catch (Exception e)
{
return AjaxResult.error("导入失败:" + e.getMessage());
}
}
/**
*
*/
@PostMapping("/analyze")
public AjaxResult analyze(@RequestBody NewStocks newStocks)
{
Object result = newStocksService.analyzeNewStocks(newStocks);
return AjaxResult.success(result);
}
/**
* ()
*/
@GetMapping("/stockQueryData")
public AjaxResult stockQueryData(String query)
{
NewStockBasic newStockBasic = new NewStockBasic();
if (StringUtils.isNotEmpty(query))
{
newStockBasic.setCode(query);
}
List<NewStockBasic> list = newStockBasicService.selectNewStockBasicList(newStockBasic);
return AjaxResult.success(list);
}
/**
* ()
*/
@GetMapping("/stockNameQueryData")
public AjaxResult stockNameQueryData(String query)
{
NewStockBasic newStockBasic = new NewStockBasic();
if (StringUtils.isNotEmpty(query))
{
newStockBasic.setName(query);
}
List<NewStockBasic> list = newStockBasicService.selectNewStockBasicList(newStockBasic);
return AjaxResult.success(list);
}
/**
*
*/
@GetMapping("/tradeDates")
public AjaxResult getTradeDates()
{
List<String> tradeDates = newStocksService.selectTradeDates();
return AjaxResult.success(tradeDates);
}
}

@ -0,0 +1,460 @@
package com.ruoyi.newstocksystem.controller;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.ruoyi.newstocksystem.domain.TIndustryIndex;
import com.ruoyi.newstocksystem.domain.TStockBasic;
import com.ruoyi.newstocksystem.domain.TStockDailyTrade;
import com.ruoyi.newstocksystem.domain.TStockHighLowStatus;
import com.ruoyi.newstocksystem.service.IIndustryIndexService;
import com.ruoyi.newstocksystem.service.IStockBasicService;
import com.ruoyi.newstocksystem.service.IStockDailyTradeService;
import com.ruoyi.newstocksystem.service.IStockHighLowStatusService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
import org.springframework.web.multipart.MultipartFile;
/**
* Controller
*
* @author lxy
* @date 2026-01-21
*/
@RestController
@RequestMapping("/newstocksystem/stockdata")
public class StockDataController extends BaseController
{
@Autowired
private IIndustryIndexService industryIndexService;
@Autowired
private IStockBasicService stockBasicService;
@Autowired
private IStockDailyTradeService stockDailyTradeService;
@Autowired
private IStockHighLowStatusService stockHighLowStatusService;
// ========================= 行业指数相关接口 =========================
/**
*
*/
@GetMapping("/industryIndex/list")
public TableDataInfo listIndustryIndex(TIndustryIndex industryIndex)
{
startPage();
List<TIndustryIndex> list = industryIndexService.selectIndustryIndexList(industryIndex);
return getDataTable(list);
}
/**
*
*/
@GetMapping("/industryIndex/distinctList")
public AjaxResult distinctIndustryIndexList()
{
List<TIndustryIndex> list = industryIndexService.selectDistinctIndustryIndexList();
return AjaxResult.success(list);
}
/**
*
*/
@PostMapping("/industryIndex/export")
public void exportIndustryIndex(HttpServletResponse response, TIndustryIndex industryIndex)
{
List<TIndustryIndex> list = industryIndexService.selectIndustryIndexList(industryIndex);
ExcelUtil<TIndustryIndex> util = new ExcelUtil<TIndustryIndex>(TIndustryIndex.class);
util.exportExcel(response, list, "行业指数数据");
}
/**
* xlsx1
*
* @param file Excel
* @param updateSupport
* @param tradeDate yyyy-MM-dd
*/
@Log(title = "行业指数数据导入", businessType = BusinessType.IMPORT)
@PostMapping("/industryIndex/importData")
public AjaxResult importIndustryIndex(MultipartFile file, boolean updateSupport, String tradeDate)
{
Date tradeDateValue = parseTradeDate(tradeDate);
if (tradeDateValue == null)
{
return AjaxResult.error("交易日期格式错误请使用yyyy-MM-dd格式");
}
ExcelUtil<TIndustryIndex> util = new ExcelUtil<TIndustryIndex>(TIndustryIndex.class);
try
{
List<TIndustryIndex> industryIndexList = util.importExcel(file.getInputStream());
int successNum = industryIndexService.importIndustryIndex(industryIndexList, tradeDateValue);
return AjaxResult.success("成功导入 " + successNum + " 条行业指数数据");
}
catch (Exception e)
{
return AjaxResult.error("导入失败:" + e.getMessage());
}
}
/**
*
*/
@GetMapping("/industryIndex/tradeDates")
public AjaxResult getIndustryIndexTradeDates()
{
List<String> tradeDates = industryIndexService.selectTradeDates();
return AjaxResult.success(tradeDates);
}
// ========================= 个股基础信息相关接口 =========================
/**
*
*/
@GetMapping("/stockBasic/list")
public TableDataInfo listStockBasic(TStockBasic stockBasic)
{
startPage();
List<TStockBasic> list = stockBasicService.selectStockBasicList(stockBasic);
return getDataTable(list);
}
/**
*
*/
@GetMapping("/stockBasic/{stockCode}")
public AjaxResult getStockBasicInfo(@PathVariable("stockCode") String stockCode)
{
return AjaxResult.success(stockBasicService.selectStockBasicByCode(stockCode));
}
/**
*
*/
@PostMapping("/stockBasic/export")
public void exportStockBasic(HttpServletResponse response, TStockBasic stockBasic)
{
List<TStockBasic> list = stockBasicService.selectStockBasicList(stockBasic);
ExcelUtil<TStockBasic> util = new ExcelUtil<TStockBasic>(TStockBasic.class);
util.exportExcel(response, list, "个股基础信息数据");
}
/**
* xlsx2
*
* @param file Excel
* @param updateSupport
*/
@Log(title = "个股基础信息导入", businessType = BusinessType.IMPORT)
@PostMapping("/stockBasic/importData")
public AjaxResult importStockBasic(MultipartFile file, boolean updateSupport)
{
ExcelUtil<TStockBasic> util = new ExcelUtil<TStockBasic>(TStockBasic.class);
try
{
List<TStockBasic> stockBasicList = util.importExcel(file.getInputStream());
int successNum = stockBasicService.importStockBasic(stockBasicList);
return AjaxResult.success("成功导入 " + successNum + " 条个股基础信息数据");
}
catch (Exception e)
{
return AjaxResult.error("导入失败:" + e.getMessage());
}
}
/**
*
*/
@Log(title = "个股基础信息", businessType = BusinessType.INSERT)
@PostMapping("/stockBasic")
public AjaxResult addStockBasic(@RequestBody TStockBasic stockBasic)
{
return toAjax(stockBasicService.insertStockBasic(stockBasic));
}
/**
*
*/
@Log(title = "个股基础信息", businessType = BusinessType.UPDATE)
@PutMapping("/stockBasic")
public AjaxResult editStockBasic(@RequestBody TStockBasic stockBasic)
{
return toAjax(stockBasicService.updateStockBasic(stockBasic));
}
/**
*
*/
@Log(title = "个股基础信息", businessType = BusinessType.DELETE)
@DeleteMapping("/stockBasic/{stockCodes}")
public AjaxResult removeStockBasic(@PathVariable String[] stockCodes)
{
return toAjax(stockBasicService.deleteStockBasicByCodes(stockCodes));
}
// ========================= 个股每日交易数据相关接口 =========================
/**
*
*/
@GetMapping("/stockDailyTrade/list")
public TableDataInfo listStockDailyTrade(TStockDailyTrade stockDailyTrade)
{
startPage();
List<TStockDailyTrade> list = stockDailyTradeService.selectStockDailyTradeList(stockDailyTrade);
return getDataTable(list);
}
/**
*
*/
@GetMapping("/stockDailyTrade/listWithBasic")
public TableDataInfo listStockDailyTradeWithBasic(TStockDailyTrade stockDailyTrade)
{
startPage();
List<TStockDailyTrade> list = stockDailyTradeService.selectStockDailyTradeListWithBasic(stockDailyTrade);
return getDataTable(list);
}
/**
*
*/
@PostMapping("/stockDailyTrade/export")
public void exportStockDailyTrade(HttpServletResponse response, TStockDailyTrade stockDailyTrade)
{
List<TStockDailyTrade> list = stockDailyTradeService.selectStockDailyTradeList(stockDailyTrade);
ExcelUtil<TStockDailyTrade> util = new ExcelUtil<TStockDailyTrade>(TStockDailyTrade.class);
util.exportExcel(response, list, "个股每日交易数据");
}
/**
* xlsx3
*
* @param file Excel
* @param updateSupport
* @param tradeDate yyyy-MM-dd
*/
@Log(title = "个股每日交易数据导入", businessType = BusinessType.IMPORT)
@PostMapping("/stockDailyTrade/importData")
public AjaxResult importStockDailyTrade(MultipartFile file, boolean updateSupport, String tradeDate)
{
Date tradeDateValue = parseTradeDate(tradeDate);
if (tradeDateValue == null)
{
return AjaxResult.error("交易日期格式错误请使用yyyy-MM-dd格式");
}
ExcelUtil<TStockDailyTrade> util = new ExcelUtil<TStockDailyTrade>(TStockDailyTrade.class);
try
{
List<TStockDailyTrade> stockDailyTradeList = util.importExcel(file.getInputStream());
int successNum = stockDailyTradeService.importStockDailyTrade(stockDailyTradeList, tradeDateValue);
return AjaxResult.success("成功导入 " + successNum + " 条个股每日交易数据");
}
catch (Exception e)
{
return AjaxResult.error("导入失败:" + e.getMessage());
}
}
/**
*
*/
@GetMapping("/stockDailyTrade/tradeDates")
public AjaxResult getStockDailyTradeDates()
{
List<String> tradeDates = stockDailyTradeService.selectTradeDates();
return AjaxResult.success(tradeDates);
}
/**
*
*/
@GetMapping("/stockDailyTrade/limitUpList")
public TableDataInfo listLimitUpStocks(TStockDailyTrade stockDailyTrade)
{
startPage();
List<TStockDailyTrade> list = stockDailyTradeService.selectLimitUpStockList(stockDailyTrade);
return getDataTable(list);
}
/**
*
*/
@GetMapping("/stockDailyTrade/strongList")
public TableDataInfo listStrongStocks(TStockDailyTrade stockDailyTrade)
{
startPage();
List<TStockDailyTrade> list = stockDailyTradeService.selectStrongStockList(stockDailyTrade);
return getDataTable(list);
}
/**
*
*/
@GetMapping("/stockDailyTrade/lastTradeDate2")
public AjaxResult getLastTradeDate()
{
String lastTradeDate = stockDailyTradeService.selectLastTradeDate();
return AjaxResult.success(lastTradeDate);
}
/**
*
*/
@GetMapping("/checkAnalysisStatus")
public AjaxResult checkAnalysisStatus(@RequestParam String tradeDate)
{
try {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Date tradeDateObj = sdf.parse(tradeDate);
boolean exists = stockDailyTradeService.checkTrendsExists(tradeDateObj);
return AjaxResult.success(exists);
} catch (ParseException e) {
return AjaxResult.error("日期格式错误请使用yyyy-MM-dd格式");
} catch (Exception e) {
return AjaxResult.error("检查失败:" + e.getMessage());
}
}
/**
*
*/
@Log(title = "股票数据分析", businessType = BusinessType.OTHER)
@PostMapping("/analysis")
public AjaxResult analysis(@RequestBody TStockDailyTrade stockDailyTrade)
{
String result = stockDailyTradeService.analysisStockData(stockDailyTrade);
return AjaxResult.success(result);
}
/**
*
*/
@GetMapping("/unanalyzedDates")
public AjaxResult getUnanalyzedDates()
{
List<String> unanalyzedDates = stockDailyTradeService.selectUnanalyzedDates();
return AjaxResult.success(unanalyzedDates);
}
// ========================= 个股新高新低状态相关接口 =========================
/**
*
*/
@GetMapping("/stockHighLow/list")
public TableDataInfo listStockHighLowStatus(TStockHighLowStatus stockHighLowStatus)
{
startPage();
List<TStockHighLowStatus> list = stockHighLowStatusService.selectStockHighLowStatusList(stockHighLowStatus);
return getDataTable(list);
}
/**
*
*/
@GetMapping("/stockHighLow/listWithBasic")
public TableDataInfo listStockHighLowStatusWithBasic(TStockHighLowStatus stockHighLowStatus)
{
startPage();
List<TStockHighLowStatus> list = stockHighLowStatusService.selectStockHighLowStatusListWithBasic(stockHighLowStatus);
return getDataTable(list);
}
/**
*
*/
@GetMapping("/stockHighLow/newHighList")
public TableDataInfo listNewHighStocks(TStockHighLowStatus stockHighLowStatus)
{
startPage();
List<TStockHighLowStatus> list = stockHighLowStatusService.selectNewHighStockList(stockHighLowStatus);
return getDataTable(list);
}
/**
*
*/
@GetMapping("/stockHighLow/newLowList")
public TableDataInfo listNewLowStocks(TStockHighLowStatus stockHighLowStatus)
{
startPage();
List<TStockHighLowStatus> list = stockHighLowStatusService.selectNewLowStockList(stockHighLowStatus);
return getDataTable(list);
}
/**
*
*
* @param file Excel
* @param updateSupport
* @param tradeDate yyyy-MM-dd
*/
@Log(title = "个股新高新低状态数据导入", businessType = BusinessType.IMPORT)
@PostMapping("/stockHighLow/importData")
public AjaxResult importStockHighLowStatus(MultipartFile file, boolean updateSupport, String tradeDate)
{
Date tradeDateValue = parseTradeDate(tradeDate);
if (tradeDateValue == null)
{
return AjaxResult.error("交易日期格式错误请使用yyyy-MM-dd格式");
}
ExcelUtil<TStockHighLowStatus> util = new ExcelUtil<TStockHighLowStatus>(TStockHighLowStatus.class);
try
{
List<TStockHighLowStatus> stockHighLowStatusList = util.importExcel(file.getInputStream());
int successNum = stockHighLowStatusService.importStockHighLowStatus(stockHighLowStatusList, tradeDateValue);
return AjaxResult.success("成功导入 " + successNum + " 条个股新高新低状态数据");
}
catch (Exception e)
{
return AjaxResult.error("导入失败:" + e.getMessage());
}
}
// ========================= 工具方法 =========================
/**
*
*/
private Date parseTradeDate(String tradeDate)
{
if (tradeDate == null || tradeDate.isEmpty())
{
return null;
}
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
try
{
return sdf.parse(tradeDate);
}
catch (ParseException e)
{
return null;
}
}
}

@ -0,0 +1,104 @@
package com.ruoyi.newstocksystem.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.newstocksystem.domain.TStockFinancial;
import com.ruoyi.newstocksystem.service.TStockFinancialService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* Controller
*
* @author lxy
* @date 2026-01-21
*/
@RestController
@RequestMapping("/newstocksystem/stockfinancial")
public class TStockFinancialController extends BaseController
{
@Autowired
private TStockFinancialService tStockFinancialService;
/**
*
*/
@PreAuthorize("@ss.hasPermi('newstocksystem:stockfinancial:list')")
@GetMapping("/list")
public TableDataInfo list(TStockFinancial tStockFinancial)
{
startPage();
List<TStockFinancial> list = tStockFinancialService.selectTStockFinancialList(tStockFinancial);
return getDataTable(list);
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('newstocksystem:stockfinancial:export')")
@Log(title = "股票财务数据", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, TStockFinancial tStockFinancial)
{
List<TStockFinancial> list = tStockFinancialService.selectTStockFinancialList(tStockFinancial);
ExcelUtil<TStockFinancial> util = new ExcelUtil<TStockFinancial>(TStockFinancial.class);
util.exportExcel(response, list, "股票财务数据数据");
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('newstocksystem:stockfinancial:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return AjaxResult.success(tStockFinancialService.selectTStockFinancialById(id));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('newstocksystem:stockfinancial:add')")
@Log(title = "股票财务数据", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TStockFinancial tStockFinancial)
{
return toAjax(tStockFinancialService.insertTStockFinancial(tStockFinancial));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('newstocksystem:stockfinancial:edit')")
@Log(title = "股票财务数据", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TStockFinancial tStockFinancial)
{
return toAjax(tStockFinancialService.updateTStockFinancial(tStockFinancial));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('newstocksystem:stockfinancial:remove')")
@Log(title = "股票财务数据", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(tStockFinancialService.deleteTStockFinancialByIds(ids));
}
}

@ -0,0 +1,104 @@
package com.ruoyi.newstocksystem.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.newstocksystem.domain.TStocksInTrend;
import com.ruoyi.newstocksystem.service.TStocksInTrendService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* Controller
*
* @author lxy
* @date 2026-01-21
*/
@RestController
@RequestMapping("/newstocksystem/stocksintrnd")
public class TStocksInTrendController extends BaseController
{
@Autowired
private TStocksInTrendService tStocksInTrendService;
/**
*
*/
@PreAuthorize("@ss.hasPermi('newstocksystem:stocksintrnd:list')")
@GetMapping("/list")
public TableDataInfo list(TStocksInTrend tStocksInTrend)
{
startPage();
List<TStocksInTrend> list = tStocksInTrendService.selectTStocksInTrendList(tStocksInTrend);
return getDataTable(list);
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('newstocksystem:stocksintrnd:export')")
@Log(title = "趋势中的股票", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, TStocksInTrend tStocksInTrend)
{
List<TStocksInTrend> list = tStocksInTrendService.selectTStocksInTrendList(tStocksInTrend);
ExcelUtil<TStocksInTrend> util = new ExcelUtil<TStocksInTrend>(TStocksInTrend.class);
util.exportExcel(response, list, "趋势中的股票数据");
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('newstocksystem:stocksintrnd:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return AjaxResult.success(tStocksInTrendService.selectTStocksInTrendById(id));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('newstocksystem:stocksintrnd:add')")
@Log(title = "趋势中的股票", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TStocksInTrend tStocksInTrend)
{
return toAjax(tStocksInTrendService.insertTStocksInTrend(tStocksInTrend));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('newstocksystem:stocksintrnd:edit')")
@Log(title = "趋势中的股票", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TStocksInTrend tStocksInTrend)
{
return toAjax(tStocksInTrendService.updateTStocksInTrend(tStocksInTrend));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('newstocksystem:stocksintrnd:remove')")
@Log(title = "趋势中的股票", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(tStocksInTrendService.deleteTStocksInTrendByIds(ids));
}
}

@ -0,0 +1,115 @@
package com.ruoyi.newstocksystem.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.newstocksystem.domain.TTrends;
import com.ruoyi.newstocksystem.service.TTrendsService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* Controller
*
* @author lxy
* @date 2026-01-21
*/
@RestController
@RequestMapping("/newstocksystem/trends")
public class TTrendsController extends BaseController
{
@Autowired
private TTrendsService tTrendsService;
/**
*
*/
@PreAuthorize("@ss.hasPermi('newstocksystem:trends:list')")
@GetMapping("/list")
public TableDataInfo list(TTrends tTrends)
{
startPage();
List<TTrends> list = tTrendsService.selectTTrendsList(tTrends);
return getDataTable(list);
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('newstocksystem:trends:export')")
@Log(title = "趋势", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, TTrends tTrends)
{
List<TTrends> list = tTrendsService.selectTTrendsList(tTrends);
ExcelUtil<TTrends> util = new ExcelUtil<TTrends>(TTrends.class);
util.exportExcel(response, list, "趋势数据");
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('newstocksystem:trends:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return AjaxResult.success(tTrendsService.selectTTrendsById(id));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('newstocksystem:trends:add')")
@Log(title = "趋势", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TTrends tTrends)
{
return toAjax(tTrendsService.insertTTrends(tTrends));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('newstocksystem:trends:edit')")
@Log(title = "趋势", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TTrends tTrends)
{
return toAjax(tTrendsService.updateTTrends(tTrends));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('newstocksystem:trends:remove')")
@Log(title = "趋势", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(tTrendsService.deleteTTrendsByIds(ids));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('newstocksystem:trends:list')")
@GetMapping("/listSection")
public TableDataInfo listSection(TTrends tTrends)
{
List<?> list = tTrendsService.listTrendsSection(tTrends);
return getDataTable(list);
}
}

@ -0,0 +1,109 @@
package com.ruoyi.newstocksystem.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.core.domain.BaseEntity;
import java.util.Date;
/**
*
*
* @author lxy
* @date 2026-01-18
*/
public class NewStockBasic extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键ID */
private Integer id;
/** 股票代码 */
private String code;
/** 股票名称 */
private String name;
/** 所属行业ID */
private Integer industryId;
/** 首发上市日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
private Date listDate;
/** 市场类型SZ/SH */
private String marketType;
/** 状态1-正常0-暂停上市) */
private Integer status;
public void setId(Integer id)
{
this.id = id;
}
public Integer getId()
{
return id;
}
public void setCode(String code)
{
this.code = code;
}
public String getCode()
{
return code;
}
public void setName(String name)
{
this.name = name;
}
public String getName()
{
return name;
}
public void setIndustryId(Integer industryId)
{
this.industryId = industryId;
}
public Integer getIndustryId()
{
return industryId;
}
public void setListDate(Date listDate)
{
this.listDate = listDate;
}
public Date getListDate()
{
return listDate;
}
public void setMarketType(String marketType)
{
this.marketType = marketType;
}
public String getMarketType()
{
return marketType;
}
public void setStatus(Integer status)
{
this.status = status;
}
public Integer getStatus()
{
return status;
}
}

@ -0,0 +1,79 @@
package com.ruoyi.newstocksystem.domain;
import com.ruoyi.common.core.domain.BaseEntity;
/**
*
*
* @author lxy
* @date 2026-01-18
*/
public class NewStockIndustry extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 行业ID */
private Integer industryId;
/** 行业级别1-3 */
private Integer industryLevel;
/** 行业代码 */
private String industryCode;
/** 行业名称 */
private String industryName;
/** 父行业代码 */
private String parentCode;
public void setIndustryId(Integer industryId)
{
this.industryId = industryId;
}
public Integer getIndustryId()
{
return industryId;
}
public void setIndustryLevel(Integer industryLevel)
{
this.industryLevel = industryLevel;
}
public Integer getIndustryLevel()
{
return industryLevel;
}
public void setIndustryCode(String industryCode)
{
this.industryCode = industryCode;
}
public String getIndustryCode()
{
return industryCode;
}
public void setIndustryName(String industryName)
{
this.industryName = industryName;
}
public String getIndustryName()
{
return industryName;
}
public void setParentCode(String parentCode)
{
this.parentCode = parentCode;
}
public String getParentCode()
{
return parentCode;
}
}

@ -0,0 +1,378 @@
package com.ruoyi.newstocksystem.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import java.util.Date;
import java.math.BigDecimal;
/**
*
*
* @author lxy
* @date 2026-01-18
*/
public class NewStocks extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键ID */
private Integer id;
/** 股票代码 */
@Excel(name = "证券代码", sort = 1, type = Excel.Type.ALL)
private String code;
/** 交易日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "交易日期", sort = 2, type = Excel.Type.ALL, dateFormat = "yyyy-MM-dd")
private Date tradeDate;
/** 开盘价 */
@Excel(name = "开盘价", sort = 3, type = Excel.Type.ALL)
private BigDecimal open;
/** 收盘价 */
@Excel(name = "收盘价", sort = 4, type = Excel.Type.ALL)
private BigDecimal close;
/** 当日涨跌幅 */
@Excel(name = "当日涨跌幅", sort = 5, type = Excel.Type.ALL)
private BigDecimal changeRate;
/** 可交易日数 */
@Excel(name = "可交易日数", sort = 6, type = Excel.Type.ALL)
private Integer tradeDays;
/** 成交量 */
@Excel(name = "成交量", sort = 7, type = Excel.Type.ALL)
private Long volume;
/** 成交额 */
@Excel(name = "成交额", sort = 8, type = Excel.Type.ALL)
private BigDecimal amount;
/** 10日区间涨跌幅 */
@Excel(name = "10日区间涨跌幅", sort = 9, type = Excel.Type.ALL)
private BigDecimal changeRate10;
/** 20日区间涨跌幅 */
@Excel(name = "20日区间涨跌幅", sort = 10, type = Excel.Type.ALL)
private BigDecimal changeRate20;
/** 60日区间涨跌幅 */
@Excel(name = "60日区间涨跌幅", sort = 11, type = Excel.Type.ALL)
private BigDecimal changeRate60;
/** 20日区间平均成交量 */
@Excel(name = "20日区间平均成交量", sort = 12, type = Excel.Type.ALL)
private BigDecimal avgVolume20;
/** 自由流通市值 */
@Excel(name = "自由流通市值", sort = 13, type = Excel.Type.ALL)
private BigDecimal freeFloatMarketValue;
/** 总市值 */
@Excel(name = "总市值", sort = 14, type = Excel.Type.ALL)
private BigDecimal totalMarketValue;
/** 机构持仓合计 */
@Excel(name = "机构持仓合计", sort = 15, type = Excel.Type.ALL)
private BigDecimal agenciesHold;
// 关联字段,非数据库字段
@Excel(name = "证券名称", sort = 16, type = Excel.Type.ALL)
private String name;
@Excel(name = "行业ID", sort = 17, type = Excel.Type.ALL)
private Integer industryId;
@Excel(name = "所属东财行业指数2级", sort = 18, type = Excel.Type.ALL)
private String industryName;
@Excel(name = "行业级别", sort = 19, type = Excel.Type.ALL)
private Integer industryLevel;
@Excel(name = "所属东财行业指数代码2级", sort = 20, type = Excel.Type.ALL)
private String industryCode;
@Excel(name = "父行业代码", sort = 21, type = Excel.Type.ALL)
private String parentCode;
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "上市日期", sort = 22, type = Excel.Type.ALL, dateFormat = "yyyy-MM-dd")
private Date listDate;
@Excel(name = "市场类型", sort = 23, type = Excel.Type.ALL)
private String marketType;
@Excel(name = "状态", sort = 24, type = Excel.Type.ALL)
private Integer status;
@Excel(name = "涨跌停类型", sort = 25, type = Excel.Type.ALL)
private Integer limitType;
@Excel(name = "涨跌停价格", sort = 26, type = Excel.Type.ALL)
private BigDecimal limitPrice;
public void setId(Integer id)
{
this.id = id;
}
public Integer getId()
{
return id;
}
public void setCode(String code)
{
this.code = code;
}
public String getCode()
{
return code;
}
public void setTradeDate(Date tradeDate)
{
this.tradeDate = tradeDate;
}
public Date getTradeDate()
{
return tradeDate;
}
public void setOpen(BigDecimal open)
{
this.open = open;
}
public BigDecimal getOpen()
{
return open;
}
public void setClose(BigDecimal close)
{
this.close = close;
}
public BigDecimal getClose()
{
return close;
}
public void setChangeRate(BigDecimal changeRate)
{
this.changeRate = changeRate;
}
public BigDecimal getChangeRate()
{
return changeRate;
}
public void setTradeDays(Integer tradeDays)
{
this.tradeDays = tradeDays;
}
public Integer getTradeDays()
{
return tradeDays;
}
public void setVolume(Long volume)
{
this.volume = volume;
}
public Long getVolume()
{
return volume;
}
public void setAmount(BigDecimal amount)
{
this.amount = amount;
}
public BigDecimal getAmount()
{
return amount;
}
public void setChangeRate10(BigDecimal changeRate10)
{
this.changeRate10 = changeRate10;
}
public BigDecimal getChangeRate10()
{
return changeRate10;
}
public void setChangeRate20(BigDecimal changeRate20)
{
this.changeRate20 = changeRate20;
}
public BigDecimal getChangeRate20()
{
return changeRate20;
}
public void setChangeRate60(BigDecimal changeRate60)
{
this.changeRate60 = changeRate60;
}
public BigDecimal getChangeRate60()
{
return changeRate60;
}
public void setAvgVolume20(BigDecimal avgVolume20)
{
this.avgVolume20 = avgVolume20;
}
public BigDecimal getAvgVolume20()
{
return avgVolume20;
}
public void setFreeFloatMarketValue(BigDecimal freeFloatMarketValue)
{
this.freeFloatMarketValue = freeFloatMarketValue;
}
public BigDecimal getFreeFloatMarketValue()
{
return freeFloatMarketValue;
}
public void setTotalMarketValue(BigDecimal totalMarketValue)
{
this.totalMarketValue = totalMarketValue;
}
public BigDecimal getTotalMarketValue()
{
return totalMarketValue;
}
public void setAgenciesHold(BigDecimal agenciesHold)
{
this.agenciesHold = agenciesHold;
}
public BigDecimal getAgenciesHold()
{
return agenciesHold;
}
public String getName()
{
return name;
}
public void setName(String name)
{
this.name = name;
}
public Integer getIndustryId()
{
return industryId;
}
public void setIndustryId(Integer industryId)
{
this.industryId = industryId;
}
public String getIndustryName()
{
return industryName;
}
public void setIndustryName(String industryName)
{
this.industryName = industryName;
}
public Integer getIndustryLevel()
{
return industryLevel;
}
public void setIndustryLevel(Integer industryLevel)
{
this.industryLevel = industryLevel;
}
public String getIndustryCode()
{
return industryCode;
}
public void setIndustryCode(String industryCode)
{
this.industryCode = industryCode;
}
public String getParentCode()
{
return parentCode;
}
public void setParentCode(String parentCode)
{
this.parentCode = parentCode;
}
public Date getListDate()
{
return listDate;
}
public void setListDate(Date listDate)
{
this.listDate = listDate;
}
public String getMarketType()
{
return marketType;
}
public void setMarketType(String marketType)
{
this.marketType = marketType;
}
public Integer getStatus()
{
return status;
}
public void setStatus(Integer status)
{
this.status = status;
}
public Integer getLimitType()
{
return limitType;
}
public void setLimitType(Integer limitType)
{
this.limitType = limitType;
}
public BigDecimal getLimitPrice()
{
return limitPrice;
}
public void setLimitPrice(BigDecimal limitPrice)
{
this.limitPrice = limitPrice;
}
}

@ -0,0 +1,104 @@
package com.ruoyi.newstocksystem.domain;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import java.util.Date;
/**
*
* t_industry_basic
*
* @author lxy
* @date 2026-01-23
*/
public class TIndustryBasic extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 行业代码如802089.EI */
@Excel(name = "行业代码")
private String industryCode;
/** 行业名称(如"银行" */
@Excel(name = "行业名称")
private String industryName;
/** 行业级别1=一级行业2=二级行业3=三级行业等) */
@Excel(name = "行业级别")
private Integer industryLevel;
/** 状态1=正常0=禁用) */
@Excel(name = "状态", readConverterExp = "1=正常,0=禁用")
private Integer status;
/** 排序 */
@Excel(name = "排序")
private Integer sortOrder;
public String getIndustryCode()
{
return industryCode;
}
public void setIndustryCode(String industryCode)
{
this.industryCode = industryCode;
}
public String getIndustryName()
{
return industryName;
}
public void setIndustryName(String industryName)
{
this.industryName = industryName;
}
public Integer getIndustryLevel()
{
return industryLevel;
}
public void setIndustryLevel(Integer industryLevel)
{
this.industryLevel = industryLevel;
}
public Integer getStatus()
{
return status;
}
public void setStatus(Integer status)
{
this.status = status;
}
public Integer getSortOrder()
{
return sortOrder;
}
public void setSortOrder(Integer sortOrder)
{
this.sortOrder = sortOrder;
}
@Override
public String toString()
{
return "TIndustryBasic{" +
"industryCode='" + industryCode + '\'' +
", industryName='" + industryName + '\'' +
", industryLevel=" + industryLevel +
", status=" + status +
", sortOrder=" + sortOrder +
'}';
}
}

@ -0,0 +1,367 @@
package com.ruoyi.newstocksystem.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import java.math.BigDecimal;
import java.util.Date;
/**
*
* t_industry_index
*
* @author lxy
* @date 2026-01-21
*/
public class TIndustryIndex extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 行业指数代码如802089.EI */
@Excel(name = "证券代码")
private String industryIndexCode;
/** 行业指数名称(如"银行" */
@Excel(name = "证券名称")
private String industryIndexName;
/** 成份个数(行业包含个股数量) */
@Excel(name = "成份个数")
private Integer componentCount;
/** 交易日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "交易日期", dateFormat = "yyyy-MM-dd")
private Date tradeDate;
/** 开盘价(指数点位) */
@Excel(name = "开盘价")
private BigDecimal openPrice;
/** 收盘价(指数点位) */
@Excel(name = "收盘价")
private BigDecimal closePrice;
/** 成交量(指数成交总量) */
@Excel(name = "成交量")
private Long volume;
/** 成交额(单位:万元) */
@Excel(name = "成交额")
private BigDecimal turnover;
/** 总市值(单位:万元) */
@Excel(name = "总市值")
private BigDecimal totalMarketCap;
/** 自由流通市值(单位:万元) */
@Excel(name = "自由流通市值")
private BigDecimal freeCirculationCap;
/** 涨跌幅百分比如1.2937=1.2937% */
@Excel(name = "涨跌幅")
private BigDecimal priceChangeRate;
/** 市盈率PE(TTM) */
@Excel(name = "市盈率PE(TTM)")
private BigDecimal peTtm;
/** 市盈率PE(TTM)中位值 */
@Excel(name = "市盈率PE(TTM)中位值")
private BigDecimal peTtmMedian;
/** 最高价(指数点位) */
@Excel(name = "最高价")
private BigDecimal highPrice;
/** 最低价(指数点位) */
@Excel(name = "最低价")
private BigDecimal lowPrice;
/** 成份股上涨家数 */
@Excel(name = "上涨家数")
private Integer upCount;
/** 成份股下跌家数 */
@Excel(name = "下跌家数")
private Integer downCount;
/** 成份股涨停家数 */
@Excel(name = "涨停家数")
private Integer limitUpCount;
/** 成份股跌停家数 */
@Excel(name = "跌停家数")
private Integer limitDownCount;
/** 成份股平盘家数 */
@Excel(name = "平盘家数")
private Integer noChangeCount;
/** 成份股停牌家数 */
@Excel(name = "停牌家数")
private Integer suspendCount;
/** 近期创历史新高 */
@Excel(name = "近期创历史新高", readConverterExp = "1=是,0=否")
private Integer newHighFlag;
/** 近期创历史新低 */
@Excel(name = "近期创历史新低", readConverterExp = "1=是,0=否")
private Integer newLowFlag;
public String getIndustryIndexCode()
{
return industryIndexCode;
}
public void setIndustryIndexCode(String industryIndexCode)
{
this.industryIndexCode = industryIndexCode;
}
public String getIndustryIndexName()
{
return industryIndexName;
}
public void setIndustryIndexName(String industryIndexName)
{
this.industryIndexName = industryIndexName;
}
public Integer getComponentCount()
{
return componentCount;
}
public void setComponentCount(Integer componentCount)
{
this.componentCount = componentCount;
}
public Date getTradeDate()
{
return tradeDate;
}
public void setTradeDate(Date tradeDate)
{
this.tradeDate = tradeDate;
}
public BigDecimal getOpenPrice()
{
return openPrice;
}
public void setOpenPrice(BigDecimal openPrice)
{
this.openPrice = openPrice;
}
public BigDecimal getClosePrice()
{
return closePrice;
}
public void setClosePrice(BigDecimal closePrice)
{
this.closePrice = closePrice;
}
public Long getVolume()
{
return volume;
}
public void setVolume(Long volume)
{
this.volume = volume;
}
public BigDecimal getTurnover()
{
return turnover;
}
public void setTurnover(BigDecimal turnover)
{
this.turnover = turnover;
}
public BigDecimal getTotalMarketCap()
{
return totalMarketCap;
}
public void setTotalMarketCap(BigDecimal totalMarketCap)
{
this.totalMarketCap = totalMarketCap;
}
public BigDecimal getFreeCirculationCap()
{
return freeCirculationCap;
}
public void setFreeCirculationCap(BigDecimal freeCirculationCap)
{
this.freeCirculationCap = freeCirculationCap;
}
public BigDecimal getPriceChangeRate()
{
return priceChangeRate;
}
public void setPriceChangeRate(BigDecimal priceChangeRate)
{
this.priceChangeRate = priceChangeRate;
}
public BigDecimal getPeTtm()
{
return peTtm;
}
public void setPeTtm(BigDecimal peTtm)
{
this.peTtm = peTtm;
}
public BigDecimal getPeTtmMedian()
{
return peTtmMedian;
}
public void setPeTtmMedian(BigDecimal peTtmMedian)
{
this.peTtmMedian = peTtmMedian;
}
public BigDecimal getHighPrice()
{
return highPrice;
}
public void setHighPrice(BigDecimal highPrice)
{
this.highPrice = highPrice;
}
public BigDecimal getLowPrice()
{
return lowPrice;
}
public void setLowPrice(BigDecimal lowPrice)
{
this.lowPrice = lowPrice;
}
public Integer getUpCount()
{
return upCount;
}
public void setUpCount(Integer upCount)
{
this.upCount = upCount;
}
public Integer getDownCount()
{
return downCount;
}
public void setDownCount(Integer downCount)
{
this.downCount = downCount;
}
public Integer getLimitUpCount()
{
return limitUpCount;
}
public void setLimitUpCount(Integer limitUpCount)
{
this.limitUpCount = limitUpCount;
}
public Integer getLimitDownCount()
{
return limitDownCount;
}
public void setLimitDownCount(Integer limitDownCount)
{
this.limitDownCount = limitDownCount;
}
public Integer getNoChangeCount()
{
return noChangeCount;
}
public void setNoChangeCount(Integer noChangeCount)
{
this.noChangeCount = noChangeCount;
}
public Integer getSuspendCount()
{
return suspendCount;
}
public void setSuspendCount(Integer suspendCount)
{
this.suspendCount = suspendCount;
}
public Integer getNewHighFlag()
{
return newHighFlag;
}
public void setNewHighFlag(Integer newHighFlag)
{
this.newHighFlag = newHighFlag;
}
public Integer getNewLowFlag()
{
return newLowFlag;
}
public void setNewLowFlag(Integer newLowFlag)
{
this.newLowFlag = newLowFlag;
}
@Override
public String toString()
{
return "TIndustryIndex{" +
"industryIndexCode='" + industryIndexCode + '\'' +
", industryIndexName='" + industryIndexName + '\'' +
", componentCount=" + componentCount +
", tradeDate=" + tradeDate +
", openPrice=" + openPrice +
", closePrice=" + closePrice +
", volume=" + volume +
", turnover=" + turnover +
", totalMarketCap=" + totalMarketCap +
", freeCirculationCap=" + freeCirculationCap +
", priceChangeRate=" + priceChangeRate +
", peTtm=" + peTtm +
", peTtmMedian=" + peTtmMedian +
", newHighFlag=" + newHighFlag +
", newLowFlag=" + newLowFlag +
'}';
}
}

@ -0,0 +1,147 @@
package com.ruoyi.newstocksystem.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import java.util.Date;
/**
*
* t_stock_basic
*
* @author lxy
* @date 2026-01-21
*/
public class TStockBasic extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 证券代码如000061.SZ、600000.SH */
@Excel(name = "证券代码")
private String stockCode;
/** 证券名称(如"农 产 品" */
@Excel(name = "证券名称")
private String stockName;
/** 首发上市日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "首发上市日期", dateFormat = "yyyy-MM-dd")
private Date listingDate;
/** 上市天数(冗余存储,提升查询效率) */
@Excel(name = "上市天数")
private Integer listingDays;
/** 是否为ST股票1=是0=否) */
@Excel(name = "是否ST", readConverterExp = "1=是,0=否")
private Integer isSt;
/** 是否为*ST股票1=是0=否) */
@Excel(name = "是否*ST", readConverterExp = "1=是,0=否")
private Integer isStarSt;
/** 所属行业指数代码关联t_industry_index */
@Excel(name = "行业指数代码")
private String industryIndexCode;
/** 所属行业指数名称(冗余存储,减少关联查询) */
@Excel(name = "行业指数名称")
private String industryIndexName;
public String getStockCode()
{
return stockCode;
}
public void setStockCode(String stockCode)
{
this.stockCode = stockCode;
}
public String getStockName()
{
return stockName;
}
public void setStockName(String stockName)
{
this.stockName = stockName;
}
public Date getListingDate()
{
return listingDate;
}
public void setListingDate(Date listingDate)
{
this.listingDate = listingDate;
}
public Integer getListingDays()
{
return listingDays;
}
public void setListingDays(Integer listingDays)
{
this.listingDays = listingDays;
}
public Integer getIsSt()
{
return isSt;
}
public void setIsSt(Integer isSt)
{
this.isSt = isSt;
}
public Integer getIsStarSt()
{
return isStarSt;
}
public void setIsStarSt(Integer isStarSt)
{
this.isStarSt = isStarSt;
}
public String getIndustryIndexCode()
{
return industryIndexCode;
}
public void setIndustryIndexCode(String industryIndexCode)
{
this.industryIndexCode = industryIndexCode;
}
public String getIndustryIndexName()
{
return industryIndexName;
}
public void setIndustryIndexName(String industryIndexName)
{
this.industryIndexName = industryIndexName;
}
@Override
public String toString()
{
return "TStockBasic{" +
"stockCode='" + stockCode + '\'' +
", stockName='" + stockName + '\'' +
", listingDate=" + listingDate +
", listingDays=" + listingDays +
", isSt=" + isSt +
", isStarSt=" + isStarSt +
", industryIndexCode='" + industryIndexCode + '\'' +
", industryIndexName='" + industryIndexName + '\'' +
'}';
}
}

@ -0,0 +1,389 @@
package com.ruoyi.newstocksystem.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import java.math.BigDecimal;
import java.util.Date;
/**
*
* t_stock_daily_trade
*
* @author lxy
* @date 2026-01-21
*/
public class TStockDailyTrade extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 证券代码关联t_stock_basic */
@Excel(name = "证券代码")
private String stockCode;
/** 交易日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "交易日期", dateFormat = "yyyy-MM-dd")
private Date tradeDate;
/** 开盘价(单位:元) */
@Excel(name = "开盘价")
private BigDecimal openPrice;
/** 收盘价(单位:元) */
@Excel(name = "收盘价")
private BigDecimal closePrice;
/** 最高价(单位:元) */
@Excel(name = "最高价")
private BigDecimal highPrice;
/** 最低价(单位:元) */
@Excel(name = "最低价")
private BigDecimal lowPrice;
/** 当日涨跌幅(百分比) */
@Excel(name = "涨跌幅")
private BigDecimal priceChangeRate;
/** 成交量(单位:股) */
@Excel(name = "成交量")
private Long volume;
/** 成交额(单位:万元) */
@Excel(name = "成交额")
private BigDecimal turnover;
/** 自由流通市值(单位:万元) */
@Excel(name = "自由流通市值")
private BigDecimal freeCirculationCap;
/** 机构持仓(百分比) */
@Excel(name = "机构持仓")
private BigDecimal agenciesHold;
/** 20日区间平均成交量单位 */
@Excel(name = "20日区间平均成交量")
private Long avgVolume20;
/** 是否涨停1=是0=否) */
@Excel(name = "是否涨停", readConverterExp = "1=是,0=否")
private Integer isLimitUp;
/** 是否跌停1=是0=否) */
@Excel(name = "是否跌停", readConverterExp = "1=是,0=否")
private Integer isLimitDown;
/** 10日动量涨跌幅 */
@Excel(name = "10日区间涨跌幅")
private BigDecimal momentum10d;
/** 20日动量涨跌幅 */
@Excel(name = "20日区间涨跌幅")
private BigDecimal momentum20d;
/** 60日动量涨跌幅 */
@Excel(name = "60日区间涨跌幅")
private BigDecimal momentum60d;
/** 证券名称(查询时关联获取) */
@Excel(name = "证券名称")
private String stockName;
/** 行业指数代码(查询时关联获取) */
@Excel(name = "所属东财行业指数代码\n[行业类别]2级")
private String industryIndexCode;
/** 行业指数名称(查询时关联获取) */
@Excel(name = "所属东财行业指数2级")
private String industryIndexName;
/** 首发上市日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "首发上市日期", dateFormat = "yyyy-MM-dd")
private Date listingDate;
/** 上市天数(冗余存储,提升查询效率) */
@Excel(name = "可交易日数")
private Integer listingDays;
/** 是否为ST股票1=是0=否) */
@Excel(name = "是否ST", readConverterExp = "1=是,0=否")
private Integer isSt;
/** 是否为*ST股票1=是0=否) */
@Excel(name = "是否*ST", readConverterExp = "1=是,0=否")
private Integer isStarSt;
public String getStockCode()
{
return stockCode;
}
public void setStockCode(String stockCode)
{
this.stockCode = stockCode;
}
public Date getTradeDate()
{
return tradeDate;
}
public void setTradeDate(Date tradeDate)
{
this.tradeDate = tradeDate;
}
public BigDecimal getOpenPrice()
{
return openPrice;
}
public void setOpenPrice(BigDecimal openPrice)
{
this.openPrice = openPrice;
}
public BigDecimal getClosePrice()
{
return closePrice;
}
public void setClosePrice(BigDecimal closePrice)
{
this.closePrice = closePrice;
}
public BigDecimal getHighPrice()
{
return highPrice;
}
public void setHighPrice(BigDecimal highPrice)
{
this.highPrice = highPrice;
}
public BigDecimal getLowPrice()
{
return lowPrice;
}
public void setLowPrice(BigDecimal lowPrice)
{
this.lowPrice = lowPrice;
}
public BigDecimal getPriceChangeRate()
{
return priceChangeRate;
}
public void setPriceChangeRate(BigDecimal priceChangeRate)
{
this.priceChangeRate = priceChangeRate;
}
public Long getVolume()
{
return volume;
}
public void setVolume(Long volume)
{
this.volume = volume;
}
public BigDecimal getTurnover()
{
return turnover;
}
public void setTurnover(BigDecimal turnover)
{
this.turnover = turnover;
}
public BigDecimal getFreeCirculationCap()
{
return freeCirculationCap;
}
public void setFreeCirculationCap(BigDecimal freeCirculationCap)
{
this.freeCirculationCap = freeCirculationCap;
}
public BigDecimal getAgenciesHold()
{
return agenciesHold;
}
public void setAgenciesHold(BigDecimal agenciesHold)
{
this.agenciesHold = agenciesHold;
}
public Long getAvgVolume20()
{
return avgVolume20;
}
public void setAvgVolume20(Long avgVolume20)
{
this.avgVolume20 = avgVolume20;
}
public Integer getIsLimitUp()
{
return isLimitUp;
}
public void setIsLimitUp(Integer isLimitUp)
{
this.isLimitUp = isLimitUp;
}
public Integer getIsLimitDown()
{
return isLimitDown;
}
public void setIsLimitDown(Integer isLimitDown)
{
this.isLimitDown = isLimitDown;
}
public BigDecimal getMomentum10d()
{
return momentum10d;
}
public void setMomentum10d(BigDecimal momentum10d)
{
this.momentum10d = momentum10d;
}
public BigDecimal getMomentum20d()
{
return momentum20d;
}
public void setMomentum20d(BigDecimal momentum20d)
{
this.momentum20d = momentum20d;
}
public BigDecimal getMomentum60d()
{
return momentum60d;
}
public void setMomentum60d(BigDecimal momentum60d)
{
this.momentum60d = momentum60d;
}
public String getStockName()
{
return stockName;
}
public void setStockName(String stockName)
{
this.stockName = stockName;
}
public String getIndustryIndexCode()
{
return industryIndexCode;
}
public void setIndustryIndexCode(String industryIndexCode)
{
this.industryIndexCode = industryIndexCode;
}
public String getIndustryIndexName()
{
return industryIndexName;
}
public void setIndustryIndexName(String industryIndexName)
{
this.industryIndexName = industryIndexName;
}
public Date getListingDate()
{
return listingDate;
}
public void setListingDate(Date listingDate)
{
this.listingDate = listingDate;
}
public Integer getListingDays()
{
return listingDays;
}
public void setListingDays(Integer listingDays)
{
this.listingDays = listingDays;
}
public Integer getIsSt()
{
return isSt;
}
public void setIsSt(Integer isSt)
{
this.isSt = isSt;
}
public Integer getIsStarSt()
{
return isStarSt;
}
public void setIsStarSt(Integer isStarSt)
{
this.isStarSt = isStarSt;
}
@Override
public String toString()
{
return "TStockDailyTrade{" +
"stockCode='" + stockCode + '\'' +
", tradeDate=" + tradeDate +
", openPrice=" + openPrice +
", closePrice=" + closePrice +
", highPrice=" + highPrice +
", lowPrice=" + lowPrice +
", priceChangeRate=" + priceChangeRate +
", volume=" + volume +
", turnover=" + turnover +
", freeCirculationCap=" + freeCirculationCap +
", agenciesHold=" + agenciesHold +
", avgVolume20=" + avgVolume20 +
", isLimitUp=" + isLimitUp +
", isLimitDown=" + isLimitDown +
", momentum10d=" + momentum10d +
", momentum20d=" + momentum20d +
", momentum60d=" + momentum60d +
", stockName='" + stockName + '\'' +
", industryIndexCode='" + industryIndexCode + '\'' +
", industryIndexName='" + industryIndexName + '\'' +
", listingDate=" + listingDate +
", listingDays=" + listingDays +
", isSt=" + isSt +
", isStarSt=" + isStarSt +
'}';
}
}

@ -0,0 +1,204 @@
package com.ruoyi.newstocksystem.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import java.util.Date;
/**
* t_stock_financial
* stock_codet_stock_basic
*
* @author lxy
* @date 2026-01-21
*/
public class TStockFinancial extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键ID */
private Long id;
/** 股票代码 */
@Excel(name = "股票代码")
private String stockCode;
/** 报告期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "报告期", dateFormat = "yyyy-MM-dd")
private Date reportPeriod;
/** 净利润同比增长率 */
@Excel(name = "净利润同比增长率")
private Double netProfitGrowthRateYoy;
/** 净利润环比增长率 */
@Excel(name = "净利润环比增长率")
private Double netProfitGrowthRateQoq;
/** 净资产收益率ROE */
@Excel(name = "净资产收益率ROE")
private Double roe;
/** 每股收益EPS */
@Excel(name = "每股收益EPS")
private Double epsBasic;
/** 净利润 */
@Excel(name = "净利润")
private Double netProfit;
/** 基本每股收益 */
@Excel(name = "基本每股收益")
private Double basicEps;
/** 每股净资产BPS */
@Excel(name = "每股净资产BPS")
private Double bps;
/** 创建时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
/** 更新时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateTime;
public Long getId()
{
return id;
}
public void setId(Long id)
{
this.id = id;
}
public String getStockCode()
{
return stockCode;
}
public void setStockCode(String stockCode)
{
this.stockCode = stockCode;
}
public Date getReportPeriod()
{
return reportPeriod;
}
public void setReportPeriod(Date reportPeriod)
{
this.reportPeriod = reportPeriod;
}
public Double getNetProfitGrowthRateYoy()
{
return netProfitGrowthRateYoy;
}
public void setNetProfitGrowthRateYoy(Double netProfitGrowthRateYoy)
{
this.netProfitGrowthRateYoy = netProfitGrowthRateYoy;
}
public Double getNetProfitGrowthRateQoq()
{
return netProfitGrowthRateQoq;
}
public void setNetProfitGrowthRateQoq(Double netProfitGrowthRateQoq)
{
this.netProfitGrowthRateQoq = netProfitGrowthRateQoq;
}
public Double getRoe()
{
return roe;
}
public void setRoe(Double roe)
{
this.roe = roe;
}
public Double getEpsBasic()
{
return epsBasic;
}
public void setEpsBasic(Double epsBasic)
{
this.epsBasic = epsBasic;
}
public Double getNetProfit()
{
return netProfit;
}
public void setNetProfit(Double netProfit)
{
this.netProfit = netProfit;
}
public Double getBasicEps()
{
return basicEps;
}
public void setBasicEps(Double basicEps)
{
this.basicEps = basicEps;
}
public Double getBps()
{
return bps;
}
public void setBps(Double bps)
{
this.bps = bps;
}
public Date getCreateTime()
{
return createTime;
}
public void setCreateTime(Date createTime)
{
this.createTime = createTime;
}
public Date getUpdateTime()
{
return updateTime;
}
public void setUpdateTime(Date updateTime)
{
this.updateTime = updateTime;
}
@Override
public String toString() {
return "TStockFinancial{" +
"id=" + id +
", stockCode='" + stockCode + '\'' +
", reportPeriod=" + reportPeriod +
", netProfitGrowthRateYoy=" + netProfitGrowthRateYoy +
", netProfitGrowthRateQoq=" + netProfitGrowthRateQoq +
", roe=" + roe +
", epsBasic=" + epsBasic +
", netProfit=" + netProfit +
", basicEps=" + basicEps +
", bps=" + bps +
", createTime=" + createTime +
", updateTime=" + updateTime +
'}';
}
}

@ -0,0 +1,126 @@
package com.ruoyi.newstocksystem.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import java.util.Date;
/**
*
* t_stock_high_low_status
*
* @author lxy
* @date 2026-01-21
*/
public class TStockHighLowStatus extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 证券代码关联t_stock_basic */
@Excel(name = "证券代码")
private String stockCode;
/** 交易日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "交易日期", dateFormat = "yyyy-MM-dd")
private Date tradeDate;
/** 是否创阶段新高1=是0=否) */
@Excel(name = "近期创阶段新高", readConverterExp = "1=是,0=否")
private Integer isNewHigh;
/** 是否创阶段新低1=是0=否) */
@Excel(name = "近期创阶段新低", readConverterExp = "1=是,0=否")
private Integer isNewLow;
/** 证券名称(查询时关联获取) */
private String stockName;
/** 行业指数代码(查询时关联获取) */
private String industryIndexCode;
/** 行业指数名称(查询时关联获取) */
private String industryIndexName;
public String getStockCode()
{
return stockCode;
}
public void setStockCode(String stockCode)
{
this.stockCode = stockCode;
}
public Date getTradeDate()
{
return tradeDate;
}
public void setTradeDate(Date tradeDate)
{
this.tradeDate = tradeDate;
}
public Integer getIsNewHigh()
{
return isNewHigh;
}
public void setIsNewHigh(Integer isNewHigh)
{
this.isNewHigh = isNewHigh;
}
public Integer getIsNewLow()
{
return isNewLow;
}
public void setIsNewLow(Integer isNewLow)
{
this.isNewLow = isNewLow;
}
public String getStockName()
{
return stockName;
}
public void setStockName(String stockName)
{
this.stockName = stockName;
}
public String getIndustryIndexCode()
{
return industryIndexCode;
}
public void setIndustryIndexCode(String industryIndexCode)
{
this.industryIndexCode = industryIndexCode;
}
public String getIndustryIndexName()
{
return industryIndexName;
}
public void setIndustryIndexName(String industryIndexName)
{
this.industryIndexName = industryIndexName;
}
@Override
public String toString()
{
return "TStockHighLowStatus{" +
"stockCode='" + stockCode + '\'' +
", tradeDate=" + tradeDate +
", isNewHigh=" + isNewHigh +
", isNewLow=" + isNewLow +
'}';
}
}

@ -0,0 +1,129 @@
package com.ruoyi.newstocksystem.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import java.util.Date;
/**
* t_stocks_in_trend
* stock_codet_stock_basic
*
* @author lxy
* @date 2026-01-21
*/
public class TStocksInTrend extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键ID */
private Long id;
/** 股票代码 */
@Excel(name = "股票代码")
private String stockCode;
/** 交易日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "交易日期", dateFormat = "yyyy-MM-dd")
private Date tradeDate;
/** 排名 */
@Excel(name = "排名")
private Integer rank;
/** 动量数据类型10日、20日 */
@Excel(name = "动量数据类型")
private String momentumType;
/** 创建时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
/** 更新时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateTime;
public Long getId()
{
return id;
}
public void setId(Long id)
{
this.id = id;
}
public String getStockCode()
{
return stockCode;
}
public void setStockCode(String stockCode)
{
this.stockCode = stockCode;
}
public Date getTradeDate()
{
return tradeDate;
}
public void setTradeDate(Date tradeDate)
{
this.tradeDate = tradeDate;
}
public Integer getRank()
{
return rank;
}
public void setRank(Integer rank)
{
this.rank = rank;
}
public String getMomentumType()
{
return momentumType;
}
public void setMomentumType(String momentumType)
{
this.momentumType = momentumType;
}
public Date getCreateTime()
{
return createTime;
}
public void setCreateTime(Date createTime)
{
this.createTime = createTime;
}
public Date getUpdateTime()
{
return updateTime;
}
public void setUpdateTime(Date updateTime)
{
this.updateTime = updateTime;
}
@Override
public String toString() {
return "TStocksInTrend{" +
"id=" + id +
", stockCode='" + stockCode + '\'' +
", tradeDate=" + tradeDate +
", rank=" + rank +
", momentumType='" + momentumType + '\'' +
", createTime=" + createTime +
", updateTime=" + updateTime +
'}';
}
}

@ -0,0 +1,188 @@
package com.ruoyi.newstocksystem.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import java.util.Date;
/**
* t_trends
*
* @author lxy
* @date 2026-01-21
*/
public class TTrends extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键ID */
private Long id;
/** 交易日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "交易日期", dateFormat = "yyyy-MM-dd")
private Date tradeDate;
/** 行业名称关联t_industry_basic表 */
@Excel(name = "行业名称")
private String industryName;
/** 动量个股数量 */
@Excel(name = "动量个股数量")
private Double stocksCount;
/** 动量值 */
@Excel(name = "动量值")
private Double trendValue;
/** 动量值变化 */
@Excel(name = "动量值变化")
private Double trendValueChange;
/** 板块排名 */
@Excel(name = "板块排名")
private Integer rank;
/** 板块排名变化 */
@Excel(name = "板块排名变化")
private Integer rankChange;
/** 动量数据类型10日、20日 */
@Excel(name = "动量数据类型")
private String momentumType;
/** 创建时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
/** 更新时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateTime;
public Long getId()
{
return id;
}
public void setId(Long id)
{
this.id = id;
}
public Date getTradeDate()
{
return tradeDate;
}
public void setTradeDate(Date tradeDate)
{
this.tradeDate = tradeDate;
}
public String getIndustryName()
{
return industryName;
}
public void setIndustryName(String industryName)
{
this.industryName = industryName;
}
public Double getStocksCount()
{
return stocksCount;
}
public void setStocksCount(Double stocksCount)
{
this.stocksCount = stocksCount;
}
public Double getTrendValue()
{
return trendValue;
}
public void setTrendValue(Double trendValue)
{
this.trendValue = trendValue;
}
public Double getTrendValueChange()
{
return trendValueChange;
}
public void setTrendValueChange(Double trendValueChange)
{
this.trendValueChange = trendValueChange;
}
public Integer getRank()
{
return rank;
}
public void setRank(Integer rank)
{
this.rank = rank;
}
public Integer getRankChange()
{
return rankChange;
}
public void setRankChange(Integer rankChange)
{
this.rankChange = rankChange;
}
public String getMomentumType()
{
return momentumType;
}
public void setMomentumType(String momentumType)
{
this.momentumType = momentumType;
}
public Date getCreateTime()
{
return createTime;
}
public void setCreateTime(Date createTime)
{
this.createTime = createTime;
}
public Date getUpdateTime()
{
return updateTime;
}
public void setUpdateTime(Date updateTime)
{
this.updateTime = updateTime;
}
@Override
public String toString() {
return "TTrends{" +
"id=" + id +
", tradeDate=" + tradeDate +
", industryName='" + industryName + '\'' +
", stocksCount=" + stocksCount +
", trendValue=" + trendValue +
", trendValueChange=" + trendValueChange +
", rank=" + rank +
", rankChange=" + rankChange +
", momentumType='" + momentumType + '\'' +
", createTime=" + createTime +
", updateTime=" + updateTime +
'}';
}
}

@ -0,0 +1,78 @@
package com.ruoyi.newstocksystem.mapper;
import com.ruoyi.newstocksystem.domain.NewStockBasic;
import java.util.List;
/**
* Mapper
*
* @author lxy
* @date 2026-01-18
*/
public interface NewStockBasicMapper
{
/**
*
*
* @param id
* @return
*/
public NewStockBasic selectNewStockBasicById(Integer id);
/**
*
*
* @param code
* @return
*/
public NewStockBasic selectNewStockBasicByCode(String code);
/**
*
*
* @param newStockBasic
* @return
*/
public List<NewStockBasic> selectNewStockBasicList(NewStockBasic newStockBasic);
/**
*
*
* @param newStockBasic
* @return
*/
public int insertNewStockBasic(NewStockBasic newStockBasic);
/**
*
*
* @param newStockBasic
* @return
*/
public int updateNewStockBasic(NewStockBasic newStockBasic);
/**
*
*
* @param id
* @return
*/
public int deleteNewStockBasicById(Integer id);
/**
*
*
* @param ids
* @return
*/
public int deleteNewStockBasicByIds(Integer[] ids);
/**
*
*
* @param newStockBasicList
* @return
*/
public int batchInsertNewStockBasic(List<NewStockBasic> newStockBasicList);
}

@ -0,0 +1,78 @@
package com.ruoyi.newstocksystem.mapper;
import com.ruoyi.newstocksystem.domain.NewStockIndustry;
import java.util.List;
/**
* Mapper
*
* @author lxy
* @date 2026-01-18
*/
public interface NewStockIndustryMapper
{
/**
*
*
* @param industryId
* @return
*/
public NewStockIndustry selectNewStockIndustryById(Integer industryId);
/**
*
*
* @param industryCode
* @return
*/
public NewStockIndustry selectNewStockIndustryByCode(String industryCode);
/**
*
*
* @param newStockIndustry
* @return
*/
public List<NewStockIndustry> selectNewStockIndustryList(NewStockIndustry newStockIndustry);
/**
*
*
* @param newStockIndustry
* @return
*/
public int insertNewStockIndustry(NewStockIndustry newStockIndustry);
/**
*
*
* @param newStockIndustry
* @return
*/
public int updateNewStockIndustry(NewStockIndustry newStockIndustry);
/**
*
*
* @param industryId
* @return
*/
public int deleteNewStockIndustryById(Integer industryId);
/**
*
*
* @param industryIds
* @return
*/
public int deleteNewStockIndustryByIds(Integer[] industryIds);
/**
*
*
* @param newStockIndustryList
* @return
*/
public int batchInsertNewStockIndustry(List<NewStockIndustry> newStockIndustryList);
}

@ -0,0 +1,110 @@
package com.ruoyi.newstocksystem.mapper;
import com.ruoyi.newstocksystem.domain.NewStocks;
import java.util.List;
/**
* Mapper
*
* @author lxy
* @date 2026-01-18
*/
public interface NewStocksMapper
{
/**
*
*
* @param id
* @return
*/
public NewStocks selectNewStocksById(Integer id);
/**
*
*
* @param newStocks
* @return
*/
public List<NewStocks> selectNewStocksList(NewStocks newStocks);
/**
*
*
* @param newStocks
* @return
*/
public List<NewStocks> selectNewStocksListB(NewStocks newStocks);
/**
*
*
* @param newStocks
* @return
*/
public List<NewStocks> selectNewStrongStocksList(NewStocks newStocks);
/**
*
*
* @param newStocks
* @return
*/
public List<NewStocks> selectNewLimitStocksList(NewStocks newStocks);
/**
*
*
* @param newStocks
* @return
*/
public int insertNewStocks(NewStocks newStocks);
/**
*
*
* @param newStocksList
* @return
*/
public int batchInsertNewStocks(List<NewStocks> newStocksList);
/**
*
*
* @param newStocks
* @return
*/
public int updateNewStocks(NewStocks newStocks);
/**
*
*
* @param id
* @return
*/
public int deleteNewStocksById(Integer id);
/**
*
*
* @param ids
* @return
*/
public int deleteNewStocksByIds(Integer[] ids);
/**
*
*
* @param code
* @param tradeDate
* @return
*/
public NewStocks selectNewStocksByCodeAndDate(String code, String tradeDate);
/**
*
*
* @return
*/
public List<String> selectTradeDates();
}

@ -0,0 +1,77 @@
package com.ruoyi.newstocksystem.mapper;
import java.util.List;
import com.ruoyi.newstocksystem.domain.TIndustryBasic;
/**
* Mapper
*
* @author lxy
* @date 2026-01-23
*/
public interface TIndustryBasicMapper
{
/**
*
*
* @param industryCode
* @return
*/
public TIndustryBasic selectTIndustryBasicByCode(String industryCode);
/**
*
*
* @param industryBasic
* @return
*/
public List<TIndustryBasic> selectTIndustryBasicList(TIndustryBasic industryBasic);
/**
*
*
* @param industryBasic
* @return
*/
public int insertTIndustryBasic(TIndustryBasic industryBasic);
/**
*
*
* @param industryBasic
* @return
*/
public int updateTIndustryBasic(TIndustryBasic industryBasic);
/**
*
*
* @param industryCode
* @return
*/
public int deleteTIndustryBasicByCode(String industryCode);
/**
*
*
* @param industryCodes
* @return
*/
public int deleteTIndustryBasicByCodes(String[] industryCodes);
/**
* Upsert
*
* @param industryBasicList
* @return
*/
public int batchUpsertIndustryBasic(List<TIndustryBasic> industryBasicList);
/**
*
*
* @param industryName
* @return
*/
public TIndustryBasic selectTIndustryBasicByName(String industryName);
}

@ -0,0 +1,87 @@
package com.ruoyi.newstocksystem.mapper;
import com.ruoyi.newstocksystem.domain.TIndustryIndex;
import java.util.Date;
import java.util.List;
/**
* Mapper
*
* @author lxy
* @date 2026-01-21
*/
public interface TIndustryIndexMapper
{
/**
*
*
* @param industryIndexCode
* @param tradeDate
* @return
*/
public TIndustryIndex selectIndustryIndexByCodeAndDate(String industryIndexCode, Date tradeDate);
/**
*
*
* @param industryIndex
* @return
*/
public List<TIndustryIndex> selectIndustryIndexList(TIndustryIndex industryIndex);
/**
*
*
* @return
*/
public List<TIndustryIndex> selectDistinctIndustryIndexList();
/**
*
*
* @param industryIndex
* @return
*/
public int insertIndustryIndex(TIndustryIndex industryIndex);
/**
*
*
* @param industryIndex
* @return
*/
public int updateIndustryIndex(TIndustryIndex industryIndex);
/**
*
*
* @param industryIndexCode
* @param tradeDate
* @return
*/
public int deleteIndustryIndexByCodeAndDate(String industryIndexCode, Date tradeDate);
/**
*
*
* @param industryIndexList
* @return
*/
public int batchInsertIndustryIndex(List<TIndustryIndex> industryIndexList);
/**
* ON DUPLICATE KEY UPDATE
*
* @param industryIndexList
* @return
*/
public int batchUpsertIndustryIndex(List<TIndustryIndex> industryIndexList);
/**
*
*
* @return
*/
public List<String> selectTradeDates();
}

@ -0,0 +1,86 @@
package com.ruoyi.newstocksystem.mapper;
import com.ruoyi.newstocksystem.domain.TStockBasic;
import java.util.List;
/**
* Mapper
*
* @author lxy
* @date 2026-01-21
*/
public interface TStockBasicMapper
{
/**
*
*
* @param stockCode
* @return
*/
public TStockBasic selectStockBasicByCode(String stockCode);
/**
*
*
* @param stockBasic
* @return
*/
public List<TStockBasic> selectStockBasicList(TStockBasic stockBasic);
/**
*
*
* @param stockBasic
* @return
*/
public int insertStockBasic(TStockBasic stockBasic);
/**
*
*
* @param stockBasic
* @return
*/
public int updateStockBasic(TStockBasic stockBasic);
/**
*
*
* @param stockCode
* @return
*/
public int deleteStockBasicByCode(String stockCode);
/**
*
*
* @param stockCodes
* @return
*/
public int deleteStockBasicByCodes(String[] stockCodes);
/**
*
*
* @param stockBasicList
* @return
*/
public int batchInsertStockBasic(List<TStockBasic> stockBasicList);
/**
* ON DUPLICATE KEY UPDATE
*
* @param stockBasicList
* @return
*/
public int batchUpsertStockBasic(List<TStockBasic> stockBasicList);
/**
*
*
* @param industryIndexCode
* @return
*/
public List<TStockBasic> selectStockBasicByIndustryCode(String industryIndexCode);
}

@ -0,0 +1,128 @@
package com.ruoyi.newstocksystem.mapper;
import com.ruoyi.newstocksystem.domain.TStockDailyTrade;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List;
/**
* Mapper
*
* @author lxy
* @date 2026-01-21
*/
public interface TStockDailyTradeMapper
{
/**
*
*
* @param stockCode
* @param tradeDate
* @return
*/
public TStockDailyTrade selectStockDailyTradeByCodeAndDate(@Param("stockCode") String stockCode, @Param("tradeDate") Date tradeDate);
/**
*
*
* @param stockDailyTrade
* @return
*/
public List<TStockDailyTrade> selectStockDailyTradeList(TStockDailyTrade stockDailyTrade);
/**
*
*
* @param stockDailyTrade
* @return
*/
public List<TStockDailyTrade> selectStockDailyTradeListWithBasic(TStockDailyTrade stockDailyTrade);
/**
*
*
* @param stockDailyTrade
* @return
*/
public int insertStockDailyTrade(TStockDailyTrade stockDailyTrade);
/**
*
*
* @param stockDailyTrade
* @return
*/
public int updateStockDailyTrade(TStockDailyTrade stockDailyTrade);
/**
*
*
* @param stockCode
* @param tradeDate
* @return
*/
public int deleteStockDailyTradeByCodeAndDate(@Param("stockCode") String stockCode, @Param("tradeDate") Date tradeDate);
/**
*
*
* @param stockDailyTradeList
* @return
*/
public int batchInsertStockDailyTrade(List<TStockDailyTrade> stockDailyTradeList);
/**
* ON DUPLICATE KEY UPDATE
*
* @param stockDailyTradeList
* @return
*/
public int batchUpsertStockDailyTrade(List<TStockDailyTrade> stockDailyTradeList);
/**
*
*
* @return
*/
public List<String> selectTradeDates();
/**
*
*
* @param stockDailyTrade
* @return
*/
public List<TStockDailyTrade> selectLimitUpStockList(TStockDailyTrade stockDailyTrade);
/**
*
*
* @param stockDailyTrade
* @return
*/
public List<TStockDailyTrade> selectStrongStockList(TStockDailyTrade stockDailyTrade);
/**
*
*
* @return yyyy-MM-dd
*/
public String selectLastTradeDate();
/**
*
*
* @param tradeDate
* @return 10
*/
public int checkTradeDataExistsByDate(Date tradeDate);
/**
*
*
* @param currentDate
* @return
*/
public Date selectPreviousTradeDate(Date currentDate);
}

@ -0,0 +1,77 @@
package com.ruoyi.newstocksystem.mapper;
import java.util.List;
import com.ruoyi.newstocksystem.domain.TStockFinancial;
/**
* Mapper
*
* @author lxy
* @date 2026-01-21
*/
public interface TStockFinancialMapper
{
/**
*
*
* @param id
* @return
*/
public TStockFinancial selectTStockFinancialById(Long id);
/**
*
*
* @param tStockFinancial
* @return
*/
public List<TStockFinancial> selectTStockFinancialList(TStockFinancial tStockFinancial);
/**
*
*
* @param tStockFinancial
* @return
*/
public int insertTStockFinancial(TStockFinancial tStockFinancial);
/**
*
*
* @param tStockFinancial
* @return
*/
public int updateTStockFinancial(TStockFinancial tStockFinancial);
/**
*
*
* @param id
* @return
*/
public int deleteTStockFinancialById(Long id);
/**
*
*
* @param ids
* @return
*/
public int deleteTStockFinancialByIds(Long[] ids);
/**
*
*
* @param tStockFinancials
* @return
*/
public int batchInsertTStockFinancial(List<TStockFinancial> tStockFinancials);
/**
*
*
* @param tStockFinancialList
* @return
*/
public int batchUpsert(List<TStockFinancial> tStockFinancialList);
}

@ -0,0 +1,98 @@
package com.ruoyi.newstocksystem.mapper;
import com.ruoyi.newstocksystem.domain.TStockHighLowStatus;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List;
/**
* Mapper
*
* @author lxy
* @date 2026-01-21
*/
public interface TStockHighLowStatusMapper
{
/**
*
*
* @param stockCode
* @param tradeDate
* @return
*/
public TStockHighLowStatus selectStockHighLowStatusByCodeAndDate(@Param("stockCode") String stockCode, @Param("tradeDate") Date tradeDate);
/**
*
*
* @param stockHighLowStatus
* @return
*/
public List<TStockHighLowStatus> selectStockHighLowStatusList(TStockHighLowStatus stockHighLowStatus);
/**
*
*
* @param stockHighLowStatus
* @return
*/
public List<TStockHighLowStatus> selectStockHighLowStatusListWithBasic(TStockHighLowStatus stockHighLowStatus);
/**
*
*
* @param stockHighLowStatus
* @return
*/
public int insertStockHighLowStatus(TStockHighLowStatus stockHighLowStatus);
/**
*
*
* @param stockHighLowStatus
* @return
*/
public int updateStockHighLowStatus(TStockHighLowStatus stockHighLowStatus);
/**
*
*
* @param stockCode
* @param tradeDate
* @return
*/
public int deleteStockHighLowStatusByCodeAndDate(@Param("stockCode") String stockCode, @Param("tradeDate") Date tradeDate);
/**
*
*
* @param stockHighLowStatusList
* @return
*/
public int batchInsertStockHighLowStatus(List<TStockHighLowStatus> stockHighLowStatusList);
/**
* ON DUPLICATE KEY UPDATE
*
* @param stockHighLowStatusList
* @return
*/
public int batchUpsertStockHighLowStatus(List<TStockHighLowStatus> stockHighLowStatusList);
/**
*
*
* @param stockHighLowStatus
* @return
*/
public List<TStockHighLowStatus> selectNewHighStockList(TStockHighLowStatus stockHighLowStatus);
/**
*
*
* @param stockHighLowStatus
* @return
*/
public List<TStockHighLowStatus> selectNewLowStockList(TStockHighLowStatus stockHighLowStatus);
}

@ -0,0 +1,77 @@
package com.ruoyi.newstocksystem.mapper;
import java.util.List;
import com.ruoyi.newstocksystem.domain.TStocksInTrend;
/**
* Mapper
*
* @author lxy
* @date 2026-01-21
*/
public interface TStocksInTrendMapper
{
/**
*
*
* @param id
* @return
*/
public TStocksInTrend selectTStocksInTrendById(Long id);
/**
*
*
* @param tStocksInTrend
* @return
*/
public List<TStocksInTrend> selectTStocksInTrendList(TStocksInTrend tStocksInTrend);
/**
*
*
* @param tStocksInTrend
* @return
*/
public int insertTStocksInTrend(TStocksInTrend tStocksInTrend);
/**
*
*
* @param tStocksInTrend
* @return
*/
public int updateTStocksInTrend(TStocksInTrend tStocksInTrend);
/**
*
*
* @param id
* @return
*/
public int deleteTStocksInTrendById(Long id);
/**
*
*
* @param ids
* @return
*/
public int deleteTStocksInTrendByIds(Long[] ids);
/**
*
*
* @param tStocksInTrends
* @return
*/
public int batchInsertTStocksInTrend(List<TStocksInTrend> tStocksInTrends);
/**
*
*
* @param tStocksInTrendList
* @return
*/
public int batchUpsert(List<TStocksInTrend> tStocksInTrendList);
}

@ -0,0 +1,145 @@
package com.ruoyi.newstocksystem.mapper;
import java.util.Date;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository;
import com.ruoyi.newstocksystem.domain.TTrends;
/**
* Mapper
*
* @author lxy
* @date 2026-01-21
*/
@Repository
@Mapper
public interface TTrendsMapper
{
/**
*
*
* @param id
* @return
*/
public TTrends selectTTrendsById(Long id);
/**
*
*
* @param tTrends
* @return
*/
public List<TTrends> selectTTrendsList(TTrends tTrends);
/**
*
*
* @param tTrends
* @return
*/
public List<?> listTrendsSection(TTrends tTrends);
/**
*
*
* @param tTrends
* @return
*/
public int insertTTrends(TTrends tTrends);
/**
*
*
* @param tTrends
* @return
*/
public int updateTTrends(TTrends tTrends);
/**
*
*
* @param id
* @return
*/
public int deleteTTrendsById(Long id);
/**
*
*
* @param ids
* @return
*/
public int deleteTTrendsByIds(Long[] ids);
/**
*
*
* @param tTrendsList
* @return
*/
public int batchUpsert(List<TTrends> tTrendsList);
/**
*
*
* @param tradeDate
* @return 10
*/
public int checkTrendsExistsByDate(Date tradeDate);
/**
* 10
*
* @param momentumType
* @return 10
*/
public List<Date> getRecentTradeDates(String momentumType);
/**
*
*
* @param momentumType
* @return
*/
public List<String> getAllIndustryNames(String momentumType);
/**
*
*
* @param params mapmomentumTypeindustryNametradeDate
* @return
*/
public Integer getIndustryRankByDate(java.util.Map<String, Object> params);
/**
*
*
* @param params mapmomentumTypeindustryNamestartDateendDate
* @return
*/
public List<TTrends> getTrendsByIndustryAndDateRange(java.util.Map<String, Object> params);
/**
* 10
*
* @param params mapmomentumTypecurrentDate
* @return
*/
public List<Date> getPreviousTradeDates(java.util.Map<String, Object> params);
/**
*
*
* @param tTrends tradeDatemomentumType
* @return
*/
public List<TTrends> getTrendsByDateAndType(TTrends tTrends);
/**
*
*
* @return yyyy-MM-dd
*/
public String selectLastAnalyzedDate();
}

@ -0,0 +1,97 @@
package com.ruoyi.newstocksystem.service;
import com.ruoyi.newstocksystem.domain.TIndustryIndex;
import java.util.Date;
import java.util.List;
/**
* Service
*
* @author lxy
* @date 2026-01-21
*/
public interface IIndustryIndexService
{
/**
*
*
* @param industryIndexCode
* @param tradeDate
* @return
*/
public TIndustryIndex selectIndustryIndexByCodeAndDate(String industryIndexCode, Date tradeDate);
/**
*
*
* @param industryIndex
* @return
*/
public List<TIndustryIndex> selectIndustryIndexList(TIndustryIndex industryIndex);
/**
*
*
* @return
*/
public List<TIndustryIndex> selectDistinctIndustryIndexList();
/**
*
*
* @param industryIndex
* @return
*/
public int insertIndustryIndex(TIndustryIndex industryIndex);
/**
*
*
* @param industryIndex
* @return
*/
public int updateIndustryIndex(TIndustryIndex industryIndex);
/**
*
*
* @param industryIndexCode
* @param tradeDate
* @return
*/
public int deleteIndustryIndexByCodeAndDate(String industryIndexCode, Date tradeDate);
/**
*
*
* @param industryIndexList
* @param tradeDate
* @return
*/
public int importIndustryIndex(List<TIndustryIndex> industryIndexList, Date tradeDate);
/**
*
*
* @return
*/
public List<String> selectTradeDates();
/**
*
*
* @param industryCode
* @return truefalse
*/
public boolean checkIndustryBasicExists(String industryCode);
/**
*
*
* @param industryCode
* @param industryName
* @return
*/
public int createIndustryBasic(String industryCode, String industryName);
}

@ -0,0 +1,78 @@
package com.ruoyi.newstocksystem.service;
import java.util.List;
import com.ruoyi.newstocksystem.domain.NewStockBasic;
/**
* Service
*
* @author lxy
* @date 2026-01-18
*/
public interface INewStockBasicService
{
/**
*
*
* @param id
* @return
*/
public NewStockBasic selectNewStockBasicById(Integer id);
/**
*
*
* @param code
* @return
*/
public NewStockBasic selectNewStockBasicByCode(String code);
/**
*
*
* @param newStockBasic
* @return
*/
public List<NewStockBasic> selectNewStockBasicList(NewStockBasic newStockBasic);
/**
*
*
* @param newStockBasic
* @return
*/
public int insertNewStockBasic(NewStockBasic newStockBasic);
/**
*
*
* @param newStockBasic
* @return
*/
public int updateNewStockBasic(NewStockBasic newStockBasic);
/**
*
*
* @param id
* @return
*/
public int deleteNewStockBasicById(Integer id);
/**
*
*
* @param ids
* @return
*/
public int deleteNewStockBasicByIds(Integer[] ids);
/**
*
*
* @param newStockBasicList
* @return
*/
public int batchInsertNewStockBasic(List<NewStockBasic> newStockBasicList);
}

@ -0,0 +1,78 @@
package com.ruoyi.newstocksystem.service;
import java.util.List;
import com.ruoyi.newstocksystem.domain.NewStockIndustry;
/**
* Service
*
* @author lxy
* @date 2026-01-18
*/
public interface INewStockIndustryService
{
/**
*
*
* @param industryId
* @return
*/
public NewStockIndustry selectNewStockIndustryById(Integer industryId);
/**
*
*
* @param industryCode
* @return
*/
public NewStockIndustry selectNewStockIndustryByCode(String industryCode);
/**
*
*
* @param newStockIndustry
* @return
*/
public List<NewStockIndustry> selectNewStockIndustryList(NewStockIndustry newStockIndustry);
/**
*
*
* @param newStockIndustry
* @return
*/
public int insertNewStockIndustry(NewStockIndustry newStockIndustry);
/**
*
*
* @param newStockIndustry
* @return
*/
public int updateNewStockIndustry(NewStockIndustry newStockIndustry);
/**
*
*
* @param industryId
* @return
*/
public int deleteNewStockIndustryById(Integer industryId);
/**
*
*
* @param industryIds
* @return
*/
public int deleteNewStockIndustryByIds(Integer[] industryIds);
/**
*
*
* @param newStockIndustryList
* @return
*/
public int batchInsertNewStockIndustry(List<NewStockIndustry> newStockIndustryList);
}

@ -0,0 +1,118 @@
package com.ruoyi.newstocksystem.service;
import java.util.List;
import com.ruoyi.newstocksystem.domain.NewStocks;
/**
* Service
*
* @author lxy
* @date 2026-01-18
*/
public interface INewStocksService
{
/**
*
*
* @param id
* @return
*/
public NewStocks selectNewStocksById(Integer id);
/**
*
*
* @param newStocks
* @return
*/
public List<NewStocks> selectNewStocksList(NewStocks newStocks);
/**
*
*
* @param newStocks
* @return
*/
public List<NewStocks> selectNewStocksListB(NewStocks newStocks);
/**
*
*
* @param newStocks
* @return
*/
public List<NewStocks> selectNewStrongStocksList(NewStocks newStocks);
/**
*
*
* @param newStocks
* @return
*/
public List<NewStocks> selectNewLimitStocksList(NewStocks newStocks);
/**
*
*
* @param newStocks
* @return
*/
public int insertNewStocks(NewStocks newStocks);
/**
*
*
* @param newStocksList
* @return
*/
public int batchInsertNewStocks(List<NewStocks> newStocksList);
/**
*
*
* @param newStocks
* @return
*/
public int updateNewStocks(NewStocks newStocks);
/**
*
*
* @param id
* @return
*/
public int deleteNewStocksById(Integer id);
/**
*
*
* @param ids
* @return
*/
public int deleteNewStocksByIds(Integer[] ids);
/**
*
*
* @param newStocksList
* @param tradeDate
* @return
*/
public int importNewStocks(List<NewStocks> newStocksList, String tradeDate);
/**
*
*
* @param newStocks
* @return
*/
public Object analyzeNewStocks(NewStocks newStocks);
/**
*
*
* @return
*/
public List<String> selectTradeDates();
}

@ -0,0 +1,78 @@
package com.ruoyi.newstocksystem.service;
import com.ruoyi.newstocksystem.domain.TStockBasic;
import java.util.List;
/**
* Service
*
* @author lxy
* @date 2026-01-21
*/
public interface IStockBasicService
{
/**
*
*
* @param stockCode
* @return
*/
public TStockBasic selectStockBasicByCode(String stockCode);
/**
*
*
* @param stockBasic
* @return
*/
public List<TStockBasic> selectStockBasicList(TStockBasic stockBasic);
/**
*
*
* @param stockBasic
* @return
*/
public int insertStockBasic(TStockBasic stockBasic);
/**
*
*
* @param stockBasic
* @return
*/
public int updateStockBasic(TStockBasic stockBasic);
/**
*
*
* @param stockCode
* @return
*/
public int deleteStockBasicByCode(String stockCode);
/**
*
*
* @param stockCodes
* @return
*/
public int deleteStockBasicByCodes(String[] stockCodes);
/**
*
*
* @param stockBasicList
* @return
*/
public int importStockBasic(List<TStockBasic> stockBasicList);
/**
*
*
* @param industryIndexCode
* @return
*/
public List<TStockBasic> selectStockBasicByIndustryCode(String industryIndexCode);
}

@ -0,0 +1,127 @@
package com.ruoyi.newstocksystem.service;
import com.ruoyi.newstocksystem.domain.TStockDailyTrade;
import java.util.Date;
import java.util.List;
/**
* Service
*
* @author lxy
* @date 2026-01-21
*/
public interface IStockDailyTradeService
{
/**
*
*
* @param stockCode
* @param tradeDate
* @return
*/
public TStockDailyTrade selectStockDailyTradeByCodeAndDate(String stockCode, Date tradeDate);
/**
*
*
* @param stockDailyTrade
* @return
*/
public List<TStockDailyTrade> selectStockDailyTradeList(TStockDailyTrade stockDailyTrade);
/**
*
*
* @param stockDailyTrade
* @return
*/
public List<TStockDailyTrade> selectStockDailyTradeListWithBasic(TStockDailyTrade stockDailyTrade);
/**
*
*
* @param stockDailyTrade
* @return
*/
public int insertStockDailyTrade(TStockDailyTrade stockDailyTrade);
/**
*
*
* @param stockDailyTrade
* @return
*/
public int updateStockDailyTrade(TStockDailyTrade stockDailyTrade);
/**
*
*
* @param stockCode
* @param tradeDate
* @return
*/
public int deleteStockDailyTradeByCodeAndDate(String stockCode, Date tradeDate);
/**
*
*
* @param stockDailyTradeList
* @param tradeDate
* @return
*/
public int importStockDailyTrade(List<TStockDailyTrade> stockDailyTradeList, Date tradeDate);
/**
*
*
* @return
*/
public List<String> selectTradeDates();
/**
*
*
* @param stockDailyTrade
* @return
*/
public List<TStockDailyTrade> selectLimitUpStockList(TStockDailyTrade stockDailyTrade);
/**
*
*
* @param stockDailyTrade
* @return
*/
public List<TStockDailyTrade> selectStrongStockList(TStockDailyTrade stockDailyTrade);
/**
*
*
* @return yyyy-MM-dd
*/
public String selectLastTradeDate();
/**
*
*
* @param stockDailyTrade
* @return
*/
public String analysisStockData(TStockDailyTrade stockDailyTrade);
/**
*
*
* @param tradeDate
* @return
*/
public boolean checkTrendsExists(Date tradeDate);
/**
*
*
* @return yyyy-MM-dd
*/
public List<String> selectUnanalyzedDates();
}

@ -0,0 +1,90 @@
package com.ruoyi.newstocksystem.service;
import com.ruoyi.newstocksystem.domain.TStockHighLowStatus;
import java.util.Date;
import java.util.List;
/**
* Service
*
* @author lxy
* @date 2026-01-21
*/
public interface IStockHighLowStatusService
{
/**
*
*
* @param stockCode
* @param tradeDate
* @return
*/
public TStockHighLowStatus selectStockHighLowStatusByCodeAndDate(String stockCode, Date tradeDate);
/**
*
*
* @param stockHighLowStatus
* @return
*/
public List<TStockHighLowStatus> selectStockHighLowStatusList(TStockHighLowStatus stockHighLowStatus);
/**
*
*
* @param stockHighLowStatus
* @return
*/
public List<TStockHighLowStatus> selectStockHighLowStatusListWithBasic(TStockHighLowStatus stockHighLowStatus);
/**
*
*
* @param stockHighLowStatus
* @return
*/
public int insertStockHighLowStatus(TStockHighLowStatus stockHighLowStatus);
/**
*
*
* @param stockHighLowStatus
* @return
*/
public int updateStockHighLowStatus(TStockHighLowStatus stockHighLowStatus);
/**
*
*
* @param stockCode
* @param tradeDate
* @return
*/
public int deleteStockHighLowStatusByCodeAndDate(String stockCode, Date tradeDate);
/**
*
*
* @param stockHighLowStatusList
* @param tradeDate
* @return
*/
public int importStockHighLowStatus(List<TStockHighLowStatus> stockHighLowStatusList, Date tradeDate);
/**
*
*
* @param stockHighLowStatus
* @return
*/
public List<TStockHighLowStatus> selectNewHighStockList(TStockHighLowStatus stockHighLowStatus);
/**
*
*
* @param stockHighLowStatus
* @return
*/
public List<TStockHighLowStatus> selectNewLowStockList(TStockHighLowStatus stockHighLowStatus);
}

@ -0,0 +1,61 @@
package com.ruoyi.newstocksystem.service;
import java.util.List;
import com.ruoyi.newstocksystem.domain.TIndustryBasic;
/**
* Service
*
* @author lxy
* @date 2026-01-23
*/
public interface ITIndustryBasicService
{
/**
*
*
* @param industryCode
* @return
*/
public TIndustryBasic selectTIndustryBasicByCode(String industryCode);
/**
*
*
* @param industryBasic
* @return
*/
public List<TIndustryBasic> selectTIndustryBasicList(TIndustryBasic industryBasic);
/**
*
*
* @param industryBasic
* @return
*/
public int insertTIndustryBasic(TIndustryBasic industryBasic);
/**
*
*
* @param industryBasic
* @return
*/
public int updateTIndustryBasic(TIndustryBasic industryBasic);
/**
*
*
* @param industryCodes
* @return
*/
public int deleteTIndustryBasicByCodes(String[] industryCodes);
/**
*
*
* @param industryBasicList
* @return
*/
public int importIndustryBasic(List<TIndustryBasic> industryBasicList);
}

@ -0,0 +1,77 @@
package com.ruoyi.newstocksystem.service;
import java.util.List;
import com.ruoyi.newstocksystem.domain.TStockFinancial;
/**
* Service
*
* @author lxy
* @date 2026-01-21
*/
public interface TStockFinancialService
{
/**
*
*
* @param id
* @return
*/
public TStockFinancial selectTStockFinancialById(Long id);
/**
*
*
* @param tStockFinancial
* @return
*/
public List<TStockFinancial> selectTStockFinancialList(TStockFinancial tStockFinancial);
/**
*
*
* @param tStockFinancial
* @return
*/
public int insertTStockFinancial(TStockFinancial tStockFinancial);
/**
*
*
* @param tStockFinancial
* @return
*/
public int updateTStockFinancial(TStockFinancial tStockFinancial);
/**
*
*
* @param ids
* @return
*/
public int deleteTStockFinancialByIds(Long[] ids);
/**
*
*
* @param id
* @return
*/
public int deleteTStockFinancialById(Long id);
/**
*
*
* @param tStockFinancialList
* @return
*/
public int batchUpsert(List<TStockFinancial> tStockFinancialList);
/**
*
*
* @param stockCode
* @return
*/
public boolean validateStockCodeExists(String stockCode);
}

@ -0,0 +1,77 @@
package com.ruoyi.newstocksystem.service;
import java.util.List;
import com.ruoyi.newstocksystem.domain.TStocksInTrend;
/**
* Service
*
* @author lxy
* @date 2026-01-21
*/
public interface TStocksInTrendService
{
/**
*
*
* @param id
* @return
*/
public TStocksInTrend selectTStocksInTrendById(Long id);
/**
*
*
* @param tStocksInTrend
* @return
*/
public List<TStocksInTrend> selectTStocksInTrendList(TStocksInTrend tStocksInTrend);
/**
*
*
* @param tStocksInTrend
* @return
*/
public int insertTStocksInTrend(TStocksInTrend tStocksInTrend);
/**
*
*
* @param tStocksInTrend
* @return
*/
public int updateTStocksInTrend(TStocksInTrend tStocksInTrend);
/**
*
*
* @param ids
* @return
*/
public int deleteTStocksInTrendByIds(Long[] ids);
/**
*
*
* @param id
* @return
*/
public int deleteTStocksInTrendById(Long id);
/**
*
*
* @param tStocksInTrendList
* @return
*/
public int batchUpsert(List<TStocksInTrend> tStocksInTrendList);
/**
*
*
* @param stockCode
* @return
*/
public boolean validateStockCodeExists(String stockCode);
}

@ -0,0 +1,93 @@
package com.ruoyi.newstocksystem.service;
import java.util.List;
import com.ruoyi.newstocksystem.domain.TTrends;
/**
* Service
*
* @author lxy
* @date 2026-01-21
*/
public interface TTrendsService
{
/**
*
*
* @param id
* @return
*/
public TTrends selectTTrendsById(Long id);
/**
*
*
* @param tTrends
* @return
*/
public List<TTrends> selectTTrendsList(TTrends tTrends);
/**
*
*
* @param tTrends
* @return
*/
public List<?> listTrendsSection(TTrends tTrends);
/**
*
*
* @param tTrends
* @return
*/
public int insertTTrends(TTrends tTrends);
/**
*
*
* @param tTrends
* @return
*/
public int updateTTrends(TTrends tTrends);
/**
*
*
* @param ids
* @return
*/
public int deleteTTrendsByIds(Long[] ids);
/**
*
*
* @param id
* @return
*/
public int deleteTTrendsById(Long id);
/**
*
*
* @param tTrendsList
* @return
*/
public int batchUpsert(List<TTrends> tTrendsList);
/**
*
*
* @param industryName
* @return
*/
public boolean validateIndustryNameExists(String industryName);
/**
* t_industry_basic
*
* @param industryName
* @return
*/
public boolean validateIndustryBasicNameExists(String industryName);
}

@ -0,0 +1,134 @@
package com.ruoyi.newstocksystem.service.impl;
import java.util.Date;
import java.util.List;
import com.ruoyi.newstocksystem.mapper.TIndustryIndexMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.newstocksystem.domain.TIndustryIndex;
import com.ruoyi.newstocksystem.service.IIndustryIndexService;
import com.ruoyi.newstocksystem.service.ITIndustryBasicService;
/**
* Service
*
* @author lxy
* @date 2026-01-21
*/
@Service
public class IndustryIndexServiceImpl implements IIndustryIndexService
{
@Autowired
private TIndustryIndexMapper industryIndexMapper;
@Autowired
private ITIndustryBasicService industryBasicService;
@Override
public TIndustryIndex selectIndustryIndexByCodeAndDate(String industryIndexCode, Date tradeDate)
{
return industryIndexMapper.selectIndustryIndexByCodeAndDate(industryIndexCode, tradeDate);
}
@Override
public List<TIndustryIndex> selectIndustryIndexList(TIndustryIndex industryIndex)
{
return industryIndexMapper.selectIndustryIndexList(industryIndex);
}
@Override
public List<TIndustryIndex> selectDistinctIndustryIndexList()
{
return industryIndexMapper.selectDistinctIndustryIndexList();
}
@Override
public int insertIndustryIndex(TIndustryIndex industryIndex)
{
return industryIndexMapper.insertIndustryIndex(industryIndex);
}
@Override
public int updateIndustryIndex(TIndustryIndex industryIndex)
{
return industryIndexMapper.updateIndustryIndex(industryIndex);
}
@Override
public int deleteIndustryIndexByCodeAndDate(String industryIndexCode, Date tradeDate)
{
return industryIndexMapper.deleteIndustryIndexByCodeAndDate(industryIndexCode, tradeDate);
}
@Override
public int importIndustryIndex(List<TIndustryIndex> industryIndexList, Date tradeDate)
{
// 为每个行业指数数据设置交易日期
for (TIndustryIndex industryIndex : industryIndexList)
{
industryIndex.setTradeDate(tradeDate);
// 检查并创建或更新行业基础数据
String industryCode = industryIndex.getIndustryIndexCode();
String industryName = industryIndex.getIndustryIndexName();
// 查询行业基础数据是否存在
com.ruoyi.newstocksystem.domain.TIndustryBasic existingIndustryBasic =
industryBasicService.selectTIndustryBasicByCode(industryCode);
if (existingIndustryBasic == null)
{
// 如果行业基础数据不存在,则创建
com.ruoyi.newstocksystem.domain.TIndustryBasic industryBasic = new com.ruoyi.newstocksystem.domain.TIndustryBasic();
industryBasic.setIndustryCode(industryCode);
industryBasic.setIndustryName(industryName);
industryBasic.setIndustryLevel(2); // 默认为二级行业
industryBasic.setStatus(1); // 默认启用
industryBasic.setSortOrder(0); // 默认排序
industryBasicService.insertTIndustryBasic(industryBasic);
}
else
{
// 如果行业基础数据存在,检查名称是否发生变化
if (!existingIndustryBasic.getIndustryName().equals(industryName))
{
// 名称发生变化,更新行业基础数据
existingIndustryBasic.setIndustryName(industryName);
industryBasicService.updateTIndustryBasic(existingIndustryBasic);
}
}
}
// 批量插入或更新行业指数数据
return industryIndexMapper.batchUpsertIndustryIndex(industryIndexList);
}
@Override
public List<String> selectTradeDates()
{
return industryIndexMapper.selectTradeDates();
}
@Override
public boolean checkIndustryBasicExists(String industryCode)
{
// 检查行业基础数据是否存在
return industryBasicService.selectTIndustryBasicByCode(industryCode) != null;
}
@Override
public int createIndustryBasic(String industryCode, String industryName)
{
// 创建行业基础数据
com.ruoyi.newstocksystem.domain.TIndustryBasic industryBasic = new com.ruoyi.newstocksystem.domain.TIndustryBasic();
industryBasic.setIndustryCode(industryCode);
industryBasic.setIndustryName(industryName);
industryBasic.setIndustryLevel(2); // 默认为二级行业
industryBasic.setStatus(1); // 默认启用
industryBasic.setSortOrder(0); // 默认排序
return industryBasicService.insertTIndustryBasic(industryBasic);
}
}

@ -0,0 +1,124 @@
package com.ruoyi.newstocksystem.service.impl;
import java.util.ArrayList;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.ruoyi.newstocksystem.domain.NewStockBasic;
import com.ruoyi.newstocksystem.service.INewStockBasicService;
import com.ruoyi.newstocksystem.mapper.NewStockBasicMapper;
/**
* Service
*
* @author lxy
* @date 2026-01-18
*/
@Service
public class NewStockBasicServiceImpl implements INewStockBasicService
{
@Autowired
private NewStockBasicMapper newStockBasicMapper;
@Override
public NewStockBasic selectNewStockBasicById(Integer id)
{
return newStockBasicMapper.selectNewStockBasicById(id);
}
@Override
public NewStockBasic selectNewStockBasicByCode(String code)
{
return newStockBasicMapper.selectNewStockBasicByCode(code);
}
@Override
public List<NewStockBasic> selectNewStockBasicList(NewStockBasic newStockBasic)
{
return newStockBasicMapper.selectNewStockBasicList(newStockBasic);
}
@Override
public int insertNewStockBasic(NewStockBasic newStockBasic)
{
return newStockBasicMapper.insertNewStockBasic(newStockBasic);
}
@Override
public int updateNewStockBasic(NewStockBasic newStockBasic)
{
return newStockBasicMapper.updateNewStockBasic(newStockBasic);
}
@Override
public int deleteNewStockBasicById(Integer id)
{
return newStockBasicMapper.deleteNewStockBasicById(id);
}
@Override
public int deleteNewStockBasicByIds(Integer[] ids)
{
return newStockBasicMapper.deleteNewStockBasicByIds(ids);
}
@Override
@Transactional
public int batchInsertNewStockBasic(List<NewStockBasic> newStockBasicList)
{
// 分离新增和更新的数据
List<NewStockBasic> insertList = new ArrayList<>();
List<NewStockBasic> updateList = new ArrayList<>();
for (NewStockBasic newStockBasic : newStockBasicList)
{
// 先查询是否已存在
NewStockBasic existing = newStockBasicMapper.selectNewStockBasicByCode(newStockBasic.getCode());
if (existing == null)
{
// 新增数据
insertList.add(newStockBasic);
}
else
{
// 更新数据
newStockBasic.setId(existing.getId());
updateList.add(newStockBasic);
}
}
int count = 0;
// 批量新增每1000条一批
if (!insertList.isEmpty())
{
int batchSize = 1000;
for (int i = 0; i < insertList.size(); i += batchSize)
{
int end = Math.min(i + batchSize, insertList.size());
List<NewStockBasic> batchList = insertList.subList(i, end);
count += newStockBasicMapper.batchInsertNewStockBasic(batchList);
}
}
// 批量更新每1000条一批
if (!updateList.isEmpty())
{
int batchSize = 1000;
for (int i = 0; i < updateList.size(); i += batchSize)
{
int end = Math.min(i + batchSize, updateList.size());
List<NewStockBasic> batchList = updateList.subList(i, end);
for (NewStockBasic newStockBasic : batchList)
{
count += newStockBasicMapper.updateNewStockBasic(newStockBasic);
}
}
}
return count;
}
}

@ -0,0 +1,124 @@
package com.ruoyi.newstocksystem.service.impl;
import java.util.ArrayList;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.ruoyi.newstocksystem.domain.NewStockIndustry;
import com.ruoyi.newstocksystem.service.INewStockIndustryService;
import com.ruoyi.newstocksystem.mapper.NewStockIndustryMapper;
/**
* Service
*
* @author lxy
* @date 2026-01-18
*/
@Service
public class NewStockIndustryServiceImpl implements INewStockIndustryService
{
@Autowired
private NewStockIndustryMapper newStockIndustryMapper;
@Override
public NewStockIndustry selectNewStockIndustryById(Integer industryId)
{
return newStockIndustryMapper.selectNewStockIndustryById(industryId);
}
@Override
public NewStockIndustry selectNewStockIndustryByCode(String industryCode)
{
return newStockIndustryMapper.selectNewStockIndustryByCode(industryCode);
}
@Override
public List<NewStockIndustry> selectNewStockIndustryList(NewStockIndustry newStockIndustry)
{
return newStockIndustryMapper.selectNewStockIndustryList(newStockIndustry);
}
@Override
public int insertNewStockIndustry(NewStockIndustry newStockIndustry)
{
return newStockIndustryMapper.insertNewStockIndustry(newStockIndustry);
}
@Override
public int updateNewStockIndustry(NewStockIndustry newStockIndustry)
{
return newStockIndustryMapper.updateNewStockIndustry(newStockIndustry);
}
@Override
public int deleteNewStockIndustryById(Integer industryId)
{
return newStockIndustryMapper.deleteNewStockIndustryById(industryId);
}
@Override
public int deleteNewStockIndustryByIds(Integer[] industryIds)
{
return newStockIndustryMapper.deleteNewStockIndustryByIds(industryIds);
}
@Override
@Transactional
public int batchInsertNewStockIndustry(List<NewStockIndustry> newStockIndustryList)
{
// 分离新增和更新的数据
List<NewStockIndustry> insertList = new ArrayList<>();
List<NewStockIndustry> updateList = new ArrayList<>();
for (NewStockIndustry newStockIndustry : newStockIndustryList)
{
// 先查询是否已存在
NewStockIndustry existing = newStockIndustryMapper.selectNewStockIndustryByCode(newStockIndustry.getIndustryCode());
if (existing == null)
{
// 新增数据
insertList.add(newStockIndustry);
}
else
{
// 更新数据
newStockIndustry.setIndustryId(existing.getIndustryId());
updateList.add(newStockIndustry);
}
}
int count = 0;
// 批量新增每1000条一批
if (!insertList.isEmpty())
{
int batchSize = 1000;
for (int i = 0; i < insertList.size(); i += batchSize)
{
int end = Math.min(i + batchSize, insertList.size());
List<NewStockIndustry> batchList = insertList.subList(i, end);
count += newStockIndustryMapper.batchInsertNewStockIndustry(batchList);
}
}
// 批量更新每1000条一批
if (!updateList.isEmpty())
{
int batchSize = 1000;
for (int i = 0; i < updateList.size(); i += batchSize)
{
int end = Math.min(i + batchSize, updateList.size());
List<NewStockIndustry> batchList = updateList.subList(i, end);
for (NewStockIndustry industry : batchList)
{
count += newStockIndustryMapper.updateNewStockIndustry(industry);
}
}
}
return count;
}
}

@ -0,0 +1,332 @@
package com.ruoyi.newstocksystem.service.impl;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.newstocksystem.domain.NewStockBasic;
import com.ruoyi.newstocksystem.domain.NewStockIndustry;
import com.ruoyi.newstocksystem.domain.NewStocks;
import com.ruoyi.newstocksystem.service.INewStockBasicService;
import com.ruoyi.newstocksystem.service.INewStockIndustryService;
import com.ruoyi.newstocksystem.service.INewStocksService;
import com.ruoyi.newstocksystem.mapper.NewStocksMapper;
/**
* Service
*
* @author lxy
* @date 2026-01-18
*/
@Service
public class NewStocksServiceImpl implements INewStocksService
{
@Autowired
private NewStocksMapper newStocksMapper;
@Autowired
private INewStockBasicService newStockBasicService;
@Autowired
private INewStockIndustryService newStockIndustryService;
@Override
public NewStocks selectNewStocksById(Integer id)
{
return newStocksMapper.selectNewStocksById(id);
}
@Override
public List<NewStocks> selectNewStocksList(NewStocks newStocks)
{
return newStocksMapper.selectNewStocksList(newStocks);
}
@Override
public List<NewStocks> selectNewStocksListB(NewStocks newStocks)
{
return newStocksMapper.selectNewStocksListB(newStocks);
}
@Override
public List<NewStocks> selectNewStrongStocksList(NewStocks newStocks)
{
return newStocksMapper.selectNewStrongStocksList(newStocks);
}
@Override
public List<NewStocks> selectNewLimitStocksList(NewStocks newStocks)
{
return newStocksMapper.selectNewLimitStocksList(newStocks);
}
@Override
public int insertNewStocks(NewStocks newStocks)
{
return newStocksMapper.insertNewStocks(newStocks);
}
@Override
public int batchInsertNewStocks(List<NewStocks> newStocksList)
{
// 数据验证确保没有tradeDate为null的记录
List<NewStocks> validList = new ArrayList<>();
for (NewStocks stock : newStocksList)
{
if (stock.getTradeDate() != null && !StringUtils.isEmpty(stock.getCode()))
{
validList.add(stock);
}
}
if (validList.isEmpty())
{
return 0;
}
return newStocksMapper.batchInsertNewStocks(validList);
}
@Override
public int updateNewStocks(NewStocks newStocks)
{
return newStocksMapper.updateNewStocks(newStocks);
}
@Override
public int deleteNewStocksById(Integer id)
{
return newStocksMapper.deleteNewStocksById(id);
}
@Override
public int deleteNewStocksByIds(Integer[] ids)
{
return newStocksMapper.deleteNewStocksByIds(ids);
}
@Override
@Transactional
public int importNewStocks(List<NewStocks> newStocksList, String tradeDate)
{
int count = 0;
List<NewStockBasic> newStockBasicList = new ArrayList<>();
List<NewStockIndustry> newStockIndustryList = new ArrayList<>();
List<NewStockBasic> updateBasicList = new ArrayList<>();
List<NewStocks> validStocksList = new ArrayList<>();
// 一次性读取所有行业数据到内存中
List<NewStockIndustry> allIndustries = newStockIndustryService.selectNewStockIndustryList(new NewStockIndustry());
Map<Integer, NewStockIndustry> industryMap = new HashMap<>();
for (NewStockIndustry industry : allIndustries)
{
industryMap.put(industry.getIndustryId(), industry);
}
// 一次性读取所有基础数据到内存中
List<NewStockBasic> allBasics = newStockBasicService.selectNewStockBasicList(new NewStockBasic());
Map<String, NewStockBasic> basicMap = new HashMap<>();
for (NewStockBasic basic : allBasics)
{
basicMap.put(basic.getCode(), basic);
}
// 数据验证和处理
for (NewStocks newStocks : newStocksList)
{
// 如果传入了tradeDate参数则使用传入的日期
if (StringUtils.isNotEmpty(tradeDate))
{
newStocks.setTradeDate(DateUtils.parseDate(tradeDate));
}
// 验证tradeDate不为null
if (newStocks.getTradeDate() == null)
{
continue; // 跳过tradeDate为null的记录
}
// 验证code不为null或空
if (StringUtils.isEmpty(newStocks.getCode()))
{
continue; // 跳过code为空的记录
}
validStocksList.add(newStocks);
}
// 先处理行业数据
for (NewStocks newStocks : validStocksList)
{
// 检查行业数据是否存在(在内存中检查)
if (newStocks.getIndustryId() != null)
{
if (!industryMap.containsKey(newStocks.getIndustryId()))
{
// 不存在,创建新的行业数据
NewStockIndustry newStockIndustry = new NewStockIndustry();
newStockIndustry.setIndustryId(newStocks.getIndustryId());
newStockIndustry.setIndustryName(newStocks.getIndustryName());
newStockIndustry.setIndustryCode(newStocks.getIndustryCode());
newStockIndustry.setIndustryLevel(newStocks.getIndustryLevel());
newStockIndustry.setParentCode(newStocks.getParentCode());
newStockIndustryList.add(newStockIndustry);
// 更新内存中的行业数据映射
industryMap.put(newStocks.getIndustryId(), newStockIndustry);
}
}
}
// 批量新增行业数据每1000条一批
if (!newStockIndustryList.isEmpty())
{
int batchSize = 1000;
for (int i = 0; i < newStockIndustryList.size(); i += batchSize)
{
int end = Math.min(i + batchSize, newStockIndustryList.size());
List<NewStockIndustry> batchList = newStockIndustryList.subList(i, end);
newStockIndustryService.batchInsertNewStockIndustry(batchList);
}
}
// 处理基础数据
for (NewStocks newStocks : validStocksList)
{
// 检查基础数据是否存在(在内存中检查)
NewStockBasic existing = basicMap.get(newStocks.getCode());
if (existing == null)
{
// 不存在,创建新的基础数据
NewStockBasic newStockBasic = new NewStockBasic();
newStockBasic.setCode(newStocks.getCode());
newStockBasic.setName(newStocks.getName());
newStockBasic.setIndustryId(newStocks.getIndustryId());
newStockBasic.setMarketType(newStocks.getMarketType());
newStockBasic.setListDate(newStocks.getListDate());
newStockBasic.setStatus(newStocks.getStatus() != null ? newStocks.getStatus() : 1); // 默认为正常状态
newStockBasicList.add(newStockBasic);
// 更新内存中的基础数据映射
basicMap.put(newStocks.getCode(), newStockBasic);
}
else
{
// 存在并且只有name更改时才需要进行更新更新基础数据
if(!newStocks.getName().equals(existing.getName())) {
existing.setName(newStocks.getName());
existing.setIndustryId(newStocks.getIndustryId());
existing.setMarketType(newStocks.getMarketType());
existing.setListDate(newStocks.getListDate());
existing.setStatus(newStocks.getStatus() != null ? newStocks.getStatus() : 1);
updateBasicList.add(existing);
}
}
}
// 批量新增基础数据每1000条一批
if (!newStockBasicList.isEmpty())
{
int batchSize = 1000;
for (int i = 0; i < newStockBasicList.size(); i += batchSize)
{
int end = Math.min(i + batchSize, newStockBasicList.size());
List<NewStockBasic> batchList = newStockBasicList.subList(i, end);
newStockBasicService.batchInsertNewStockBasic(batchList);
}
}
// 批量更新基础数据每1000条一批
if (!updateBasicList.isEmpty())
{
int batchSize = 1000;
for (int i = 0; i < updateBasicList.size(); i += batchSize)
{
int end = Math.min(i + batchSize, updateBasicList.size());
List<NewStockBasic> batchList = updateBasicList.subList(i, end);
for (NewStockBasic basic : batchList)
{
newStockBasicService.updateNewStockBasic(basic);
}
}
}
// 批量新增行情数据每1000条一批
int batchSize = 1000;
for (int i = 0; i < validStocksList.size(); i += batchSize)
{
int end = Math.min(i + batchSize, validStocksList.size());
List<NewStocks> batchList = validStocksList.subList(i, end);
// 再次验证batchList中的记录
List<NewStocks> filteredBatchList = new ArrayList<>();
for (NewStocks stock : batchList)
{
if (stock.getTradeDate() != null && !StringUtils.isEmpty(stock.getCode()))
{
filteredBatchList.add(stock);
}
}
if (!filteredBatchList.isEmpty())
{
count += newStocksMapper.batchInsertNewStocks(filteredBatchList);
}
}
return count;
}
@Override
public Object analyzeNewStocks(NewStocks newStocks)
{
Map<String, Object> result = new HashMap<>();
// 查询行情数据列表
List<NewStocks> stocksList = newStocksMapper.selectNewStocksList(newStocks);
// 计算基本统计数据
if (!stocksList.isEmpty())
{
double avgChangeRate = 0;
double totalChangeRate = 0;
int upCount = 0;
int downCount = 0;
for (NewStocks stock : stocksList)
{
double changeRate = stock.getChangeRate() != null ? stock.getChangeRate().doubleValue() : 0;
totalChangeRate += changeRate;
if (changeRate > 0)
{
upCount++;
}
else if (changeRate < 0)
{
downCount++;
}
}
avgChangeRate = totalChangeRate / stocksList.size();
result.put("totalStocks", stocksList.size());
result.put("avgChangeRate", avgChangeRate);
result.put("upCount", upCount);
result.put("downCount", downCount);
result.put("flatCount", stocksList.size() - upCount - downCount);
result.put("upRatio", upCount * 100.0 / stocksList.size());
result.put("downRatio", downCount * 100.0 / stocksList.size());
}
result.put("stocksList", stocksList);
return result;
}
@Override
public List<String> selectTradeDates()
{
return newStocksMapper.selectTradeDates();
}
}

@ -0,0 +1,89 @@
package com.ruoyi.newstocksystem.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.ruoyi.newstocksystem.domain.TStockBasic;
import com.ruoyi.newstocksystem.mapper.TStockBasicMapper;
import com.ruoyi.newstocksystem.service.IStockBasicService;
/**
* Service
*
* @author lxy
* @date 2026-01-21
*/
@Service("newStockBasicService")
public class StockBasicServiceImpl implements IStockBasicService
{
@Autowired
private TStockBasicMapper stockBasicMapper;
@Override
public TStockBasic selectStockBasicByCode(String stockCode)
{
return stockBasicMapper.selectStockBasicByCode(stockCode);
}
@Override
public List<TStockBasic> selectStockBasicList(TStockBasic stockBasic)
{
return stockBasicMapper.selectStockBasicList(stockBasic);
}
@Override
public int insertStockBasic(TStockBasic stockBasic)
{
return stockBasicMapper.insertStockBasic(stockBasic);
}
@Override
public int updateStockBasic(TStockBasic stockBasic)
{
return stockBasicMapper.updateStockBasic(stockBasic);
}
@Override
public int deleteStockBasicByCode(String stockCode)
{
return stockBasicMapper.deleteStockBasicByCode(stockCode);
}
@Override
public int deleteStockBasicByCodes(String[] stockCodes)
{
return stockBasicMapper.deleteStockBasicByCodes(stockCodes);
}
@Override
@Transactional
public int importStockBasic(List<TStockBasic> stockBasicList)
{
if (stockBasicList == null || stockBasicList.isEmpty())
{
return 0;
}
int count = 0;
int batchSize = 500;
// 分批导入数据(使用 upsert 方式,自动处理新增和更新)
for (int i = 0; i < stockBasicList.size(); i += batchSize)
{
int end = Math.min(i + batchSize, stockBasicList.size());
List<TStockBasic> batchList = stockBasicList.subList(i, end);
count += stockBasicMapper.batchUpsertStockBasic(batchList);
}
return count;
}
@Override
public List<TStockBasic> selectStockBasicByIndustryCode(String industryIndexCode)
{
return stockBasicMapper.selectStockBasicByIndustryCode(industryIndexCode);
}
}

@ -0,0 +1,794 @@
package com.ruoyi.newstocksystem.service.impl;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Set;
import java.util.HashMap;
import java.util.Map;
import java.util.Arrays;
import java.util.Calendar;
import java.util.stream.Collectors;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import com.ruoyi.newstocksystem.domain.*;
import com.ruoyi.newstocksystem.mapper.TStocksInTrendMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.ruoyi.newstocksystem.mapper.TStockDailyTradeMapper;
import com.ruoyi.newstocksystem.mapper.TTrendsMapper;
import com.ruoyi.newstocksystem.service.IIndustryIndexService;
import com.ruoyi.newstocksystem.service.IStockBasicService;
import com.ruoyi.newstocksystem.service.IStockDailyTradeService;
import com.ruoyi.newstocksystem.service.ITIndustryBasicService;
/**
* Service
*
* @author lxy
* @date 2026-01-21
*/
@Service
public class StockDailyTradeServiceImpl implements IStockDailyTradeService
{
private static final Logger logger = LoggerFactory.getLogger(StockDailyTradeServiceImpl.class);
@Autowired
private TStockDailyTradeMapper stockDailyTradeMapper;
@Autowired
private TTrendsMapper trendsMapper;
@Autowired
private IStockBasicService stockBasicService;
@Autowired
private IIndustryIndexService industryIndexService;
@Autowired
private ITIndustryBasicService industryBasicService;
@Autowired
private TStocksInTrendMapper tStocksInTrendMapper;
@Override
public TStockDailyTrade selectStockDailyTradeByCodeAndDate(String stockCode, Date tradeDate)
{
return stockDailyTradeMapper.selectStockDailyTradeByCodeAndDate(stockCode, tradeDate);
}
@Override
public List<TStockDailyTrade> selectStockDailyTradeList(TStockDailyTrade stockDailyTrade)
{
return stockDailyTradeMapper.selectStockDailyTradeList(stockDailyTrade);
}
@Override
public List<TStockDailyTrade> selectStockDailyTradeListWithBasic(TStockDailyTrade stockDailyTrade)
{
return stockDailyTradeMapper.selectStockDailyTradeListWithBasic(stockDailyTrade);
}
@Override
public int insertStockDailyTrade(TStockDailyTrade stockDailyTrade)
{
return stockDailyTradeMapper.insertStockDailyTrade(stockDailyTrade);
}
@Override
public int updateStockDailyTrade(TStockDailyTrade stockDailyTrade)
{
return stockDailyTradeMapper.updateStockDailyTrade(stockDailyTrade);
}
@Override
public int deleteStockDailyTradeByCodeAndDate(String stockCode, Date tradeDate)
{
return stockDailyTradeMapper.deleteStockDailyTradeByCodeAndDate(stockCode, tradeDate);
}
@Override
@Transactional
public int importStockDailyTrade(List<TStockDailyTrade> stockDailyTradeList1, Date tradeDate)
{
if (stockDailyTradeList1 == null || stockDailyTradeList1.isEmpty())
{
return 0;
}
List<TStockDailyTrade> stockDailyTradeList = new ArrayList<>();
// 设置交易日期
for (TStockDailyTrade stockDailyTrade : stockDailyTradeList1)
{
if(stockDailyTrade.getStockCode() == null || stockDailyTrade.getStockCode().trim().isEmpty())
continue;
if(stockDailyTrade.getStockName() == null || stockDailyTrade.getStockName().trim().isEmpty())
continue;
if(stockDailyTrade.getIndustryIndexName() == null || stockDailyTrade.getIndustryIndexName().trim().isEmpty())
continue;
if(stockDailyTrade.getClosePrice() == null)
continue;
if (stockDailyTrade.getTradeDate() == null)
{
stockDailyTrade.setTradeDate(tradeDate);
}
// 设置默认值
if (stockDailyTrade.getIsLimitUp() == null)
{
stockDailyTrade.setIsLimitUp(0);
}
if (stockDailyTrade.getIsLimitDown() == null)
{
stockDailyTrade.setIsLimitDown(0);
}
stockDailyTradeList.add(stockDailyTrade);
}
long startTime = System.currentTimeMillis();
logger.info("开始处理股票基础数据,待处理记录数: {}", stockDailyTradeList.size());
// 收集所有需要检查的行业代码
Set<String> industryCodes = new HashSet<>();
for (TStockDailyTrade stockDailyTrade : stockDailyTradeList)
{
if (stockDailyTrade.getIndustryIndexCode() != null && !stockDailyTrade.getIndustryIndexCode().trim().isEmpty())
{
industryCodes.add(stockDailyTrade.getIndustryIndexCode());
}
}
// 检查并确保行业基础数据存在
logger.info("开始检查行业基础数据,需要检查的行业代码数量: {}", industryCodes.size());
if (!industryCodes.isEmpty())
{
// 检查每个行业代码是否存在,如果不存在则创建
for (String industryCode : industryCodes)
{
if (!industryIndexService.checkIndustryBasicExists(industryCode))
{
// 如果行业基础数据不存在,创建一个基础记录
String industryName = industryCode; // 使用代码作为默认名称
if (stockDailyTradeList != null) {
// 尝试从数据中获取行业名称
for (TStockDailyTrade trade : stockDailyTradeList) {
if (trade.getIndustryIndexCode() != null && trade.getIndustryIndexCode().equals(industryCode)) {
if (trade.getIndustryIndexName() != null) {
industryName = trade.getIndustryIndexName();
break;
}
}
}
}
industryIndexService.createIndustryBasic(industryCode, industryName);
}
}
}
// 收集所有需要检查的股票代码
Set<String> stockCodes = new HashSet<>();
for (TStockDailyTrade stockDailyTrade : stockDailyTradeList)
{
stockCodes.add(stockDailyTrade.getStockCode());
}
// 一次性读取所有存在的股票基础数据
logger.info("开始批量读取股票基础数据,股票代码数量: {}", stockCodes.size());
long loadStart = System.currentTimeMillis();
List<TStockBasic> existingBasics = stockBasicService.selectStockBasicList(new TStockBasic());
// 将现有基础数据转换为Map以便快速查找
Map<String, TStockBasic> existingBasicsMap = new HashMap<>();
for (TStockBasic basic : existingBasics)
{
if (stockCodes.contains(basic.getStockCode()))
{
existingBasicsMap.put(basic.getStockCode(), basic);
}
}
long loadEnd = System.currentTimeMillis();
logger.info("股票基础数据读取完成,耗时: {} ms", (loadEnd - loadStart));
// 准备需要插入和更新的数据
List<TStockBasic> newBasicsToInsert = new ArrayList<>();
List<TStockBasic> basicsToUpdate = new ArrayList<>();
logger.info("开始比较和分类股票基础数据");
long compareStart = System.currentTimeMillis();
for (TStockDailyTrade stockDailyTrade : stockDailyTradeList)
{
TStockBasic existingBasic = existingBasicsMap.get(stockDailyTrade.getStockCode());
if (existingBasic == null)
{
// 如果不存在,创建新的股票基础数据记录
// 只有当必要字段不为空时才插入
if (stockDailyTrade.getStockCode() != null && !stockDailyTrade.getStockCode().trim().isEmpty() && stockDailyTrade.getStockName() != null && !stockDailyTrade.getStockName().trim().isEmpty())
{
TStockBasic newBasic = new TStockBasic();
newBasic.setStockCode(stockDailyTrade.getStockCode());
newBasic.setStockName(stockDailyTrade.getStockName());
// 设置从TStockDailyTrade传入的其他基础信息
if (stockDailyTrade.getIndustryIndexCode() != null && !stockDailyTrade.getIndustryIndexCode().trim().isEmpty()) {
newBasic.setIndustryIndexCode(stockDailyTrade.getIndustryIndexCode());
} else {
newBasic.setIndustryIndexCode(""); // 设置默认值
}
if (stockDailyTrade.getIndustryIndexName() != null && !stockDailyTrade.getIndustryIndexName().trim().isEmpty()) {
newBasic.setIndustryIndexName(stockDailyTrade.getIndustryIndexName());
} else {
newBasic.setIndustryIndexName("");
}
if (stockDailyTrade.getListingDate() != null) {
newBasic.setListingDate(stockDailyTrade.getListingDate());
}
if (stockDailyTrade.getListingDays() != null) {
newBasic.setListingDays(stockDailyTrade.getListingDays());
}
// 确保ST相关字段有默认值
if (stockDailyTrade.getIsSt() != null) {
newBasic.setIsSt(stockDailyTrade.getIsSt());
} else {
newBasic.setIsSt(0); // 默认不是ST股票
}
if (stockDailyTrade.getIsStarSt() != null) {
newBasic.setIsStarSt(stockDailyTrade.getIsStarSt());
} else {
newBasic.setIsStarSt(0); // 默认不是*ST股票
}
newBasicsToInsert.add(newBasic);
}
}
else
{
// 如果存在,检查各字段是否发生变化,如有变化则更新
boolean needUpdate = false;
// 只有当新值不为null时才更新
if (stockDailyTrade.getStockName() != null &&
(existingBasic.getStockName() == null || !existingBasic.getStockName().equals(stockDailyTrade.getStockName())))
{
existingBasic.setStockName(stockDailyTrade.getStockName());
needUpdate = true;
}
if (stockDailyTrade.getIndustryIndexCode() != null &&
(existingBasic.getIndustryIndexCode() == null || !existingBasic.getIndustryIndexCode().equals(stockDailyTrade.getIndustryIndexCode())))
{
existingBasic.setIndustryIndexCode(stockDailyTrade.getIndustryIndexCode());
needUpdate = true;
}
if (stockDailyTrade.getIndustryIndexName() != null &&
(existingBasic.getIndustryIndexName() == null || !existingBasic.getIndustryIndexName().equals(stockDailyTrade.getIndustryIndexName())))
{
existingBasic.setIndustryIndexName(stockDailyTrade.getIndustryIndexName());
needUpdate = true;
}
if (stockDailyTrade.getListingDate() != null &&
(existingBasic.getListingDate() == null || !existingBasic.getListingDate().equals(stockDailyTrade.getListingDate())))
{
existingBasic.setListingDate(stockDailyTrade.getListingDate());
needUpdate = true;
}
if (stockDailyTrade.getListingDays() != null &&
(existingBasic.getListingDays() == null || !existingBasic.getListingDays().equals(stockDailyTrade.getListingDays())))
{
existingBasic.setListingDays(stockDailyTrade.getListingDays());
needUpdate = true;
}
if (stockDailyTrade.getIsSt() != null &&
(existingBasic.getIsSt() == null || !existingBasic.getIsSt().equals(stockDailyTrade.getIsSt())))
{
existingBasic.setIsSt(stockDailyTrade.getIsSt());
needUpdate = true;
}
if (stockDailyTrade.getIsStarSt() != null &&
(existingBasic.getIsStarSt() == null || !existingBasic.getIsStarSt().equals(stockDailyTrade.getIsStarSt())))
{
existingBasic.setIsStarSt(stockDailyTrade.getIsStarSt());
needUpdate = true;
}
if (needUpdate)
{
// 确保ST相关字段始终有值避免数据库约束错误
if (existingBasic.getIsSt() == null) {
existingBasic.setIsSt(0);
}
if (existingBasic.getIsStarSt() == null) {
existingBasic.setIsStarSt(0);
}
basicsToUpdate.add(existingBasic);
}
}
}
long compareEnd = System.currentTimeMillis();
logger.info("股票基础数据比较完成,耗时: {} ms", (compareEnd - compareStart));
// 批量插入新的股票基础数据
if (!newBasicsToInsert.isEmpty())
{
logger.info("准备批量插入 {} 条新的股票基础数据", newBasicsToInsert.size());
long insertStart = System.currentTimeMillis();
stockBasicService.importStockBasic(newBasicsToInsert); // 使用importStockBasic方法进行批量插入
long insertEnd = System.currentTimeMillis();
logger.info("股票基础数据插入完成,耗时: {} ms", (insertEnd - insertStart));
}
else
{
logger.info("无需插入新的股票基础数据");
}
// 批量更新股票基础数据
if (!basicsToUpdate.isEmpty())
{
logger.info("准备批量更新 {} 条股票基础数据", basicsToUpdate.size());
long updateStart = System.currentTimeMillis();
for (TStockBasic basic : basicsToUpdate)
{
// 确保ST相关字段始终有值避免数据库约束错误
if (basic.getIsSt() == null) {
basic.setIsSt(0);
}
if (basic.getIsStarSt() == null) {
basic.setIsStarSt(0);
}
stockBasicService.updateStockBasic(basic);
}
long updateEnd = System.currentTimeMillis();
logger.info("股票基础数据更新完成,耗时: {} ms", (updateEnd - updateStart));
}
else
{
logger.info("无需更新股票基础数据");
}
long checkTime = System.currentTimeMillis();
logger.info("股票基础数据处理完成,耗时: {} ms", (checkTime - startTime));
// 批量插入每日交易数据
int count = 0;
int batchSize = 500;
logger.info("开始批量插入每日交易数据,总记录数: {}", stockDailyTradeList.size());
long tradeDataStartTime = System.currentTimeMillis();
for (int i = 0; i < stockDailyTradeList.size(); i += batchSize)
{
int end = Math.min(i + batchSize, stockDailyTradeList.size());
List<TStockDailyTrade> batchList = stockDailyTradeList.subList(i, end);
int batchCount = stockDailyTradeMapper.batchUpsertStockDailyTrade(batchList);
count += batchCount;
logger.info("批次 [{}-{}] 交易数据插入完成,本次插入: {} 条", i, end, batchCount);
}
long tradeDataEndTime = System.currentTimeMillis();
logger.info("每日交易数据批量插入完成,总插入: {} 条,耗时: {} ms", count, (tradeDataEndTime - tradeDataStartTime));
long totalTime = System.currentTimeMillis() - startTime;
logger.info("导入任务完成,总耗时: {} ms", totalTime);
return count;
}
@Override
public List<String> selectTradeDates()
{
return stockDailyTradeMapper.selectTradeDates();
}
@Override
public List<TStockDailyTrade> selectLimitUpStockList(TStockDailyTrade stockDailyTrade)
{
return stockDailyTradeMapper.selectLimitUpStockList(stockDailyTrade);
}
@Override
public List<TStockDailyTrade> selectStrongStockList(TStockDailyTrade stockDailyTrade)
{
return stockDailyTradeMapper.selectStrongStockList(stockDailyTrade);
}
@Override
public String selectLastTradeDate()
{
return stockDailyTradeMapper.selectLastTradeDate();
}
@Override
public boolean checkTrendsExists(Date tradeDate)
{
logger.info("检查指定日期是否存在趋势数据,交易日期: {}", tradeDate);
try {
int count = trendsMapper.checkTrendsExistsByDate(tradeDate);
return count > 0;
} catch (Exception e) {
logger.error("检查趋势数据存在性失败,交易日期: {}", tradeDate, e);
throw new RuntimeException("检查失败: " + e.getMessage());
}
}
@Override
public List<String> selectUnanalyzedDates()
{
logger.info("开始获取未分析的交易日期");
try {
// 1. 从t_trends获取最后一个交易日已分析的最后日期
String lastAnalyzedDateStr = trendsMapper.selectLastAnalyzedDate();
Date lastAnalyzedDate = null;
if (lastAnalyzedDateStr != null) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
lastAnalyzedDate = sdf.parse(lastAnalyzedDateStr);
logger.info("最后一个已分析的交易日: {}", lastAnalyzedDateStr);
} else {
logger.info("没有已分析的交易日,将获取所有交易日期");
}
// 2. 在t_stock_daily_trade中获取该日之后所有有数据的交易日
List<String> allTradeDates = stockDailyTradeMapper.selectTradeDates();
logger.info("所有交易日期数量: {}", allTradeDates.size());
// 3. 过滤掉已经分析过的日期,返回未分析的日期列表
List<String> unanalyzedDates = new ArrayList<>();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
for (String dateStr : allTradeDates) {
Date tradeDate = sdf.parse(dateStr);
// 如果没有已分析的日期,或者当前日期在最后分析日期之后
if (lastAnalyzedDate == null || tradeDate.after(lastAnalyzedDate)) {
// 检查该日期是否已分析
if (!checkTrendsExists(tradeDate)) {
unanalyzedDates.add(dateStr);
}
}
}
// 4. 对未分析日期列表按照日期升序排列(时间更早的在前面)
unanalyzedDates.sort((date1, date2) -> {
try {
Date d1 = sdf.parse(date1);
Date d2 = sdf.parse(date2);
return d1.compareTo(d2);
} catch (ParseException e) {
logger.error("日期排序失败", e);
throw new RuntimeException("日期排序失败: " + e.getMessage());
}
});
logger.info("未分析的交易日期数量: {}", unanalyzedDates.size());
if (!unanalyzedDates.isEmpty()) {
logger.info("最早的未分析交易日: {}", unanalyzedDates.get(0));
logger.info("最晚的未分析交易日: {}", unanalyzedDates.get(unanalyzedDates.size() - 1));
}
return unanalyzedDates;
} catch (Exception e) {
logger.error("获取未分析的交易日期失败", e);
throw new RuntimeException("获取未分析的交易日期失败: " + e.getMessage());
}
}
/**
*
*
* @param tradeDate
* @return
*/
private boolean checkTradeDataExists(Date tradeDate)
{
logger.info("检查指定日期是否存在交易数据,交易日期: {}", tradeDate);
try {
int count = stockDailyTradeMapper.checkTradeDataExistsByDate(tradeDate);
return count > 0;
} catch (Exception e) {
logger.error("检查交易数据存在性失败,交易日期: {}", tradeDate, e);
throw new RuntimeException("检查失败: " + e.getMessage());
}
}
@Override
public String analysisStockData(TStockDailyTrade stockDailyTrade)
{
logger.info("开始分析股票数据,交易日期: {}", stockDailyTrade.getTradeDate());
try {
// 1. 先检查指定日期是否存在交易数据
if (!checkTradeDataExists(stockDailyTrade.getTradeDate())) {
logger.info("指定日期不存在交易数据,无法进行分析,交易日期: {}", stockDailyTrade.getTradeDate());
return "该日期不存在交易数据,无法进行分析";
}
// 2. 再检查指定日期是否已存在分析数据
if (checkTrendsExists(stockDailyTrade.getTradeDate())) {
logger.info("指定日期已存在分析数据,跳过分析,交易日期: {}", stockDailyTrade.getTradeDate());
return "该日期已存在分析数据,无需重复分析";
}
// 3. 实现具体的分析逻辑
// 分析周期为10日、20日、60日
List<String> momentumTypes = Arrays.asList("10", "20", "60");
for (String momentumType : momentumTypes) {
logger.info("开始分析动量类型: {}", momentumType);
// 4. 获取当天交易日内按照分析周期的涨跌幅倒序获取涨幅前16%的股票
List<TStockDailyTrade> topStocks = getTop16PercentStocks(stockDailyTrade.getTradeDate(), momentumType);
logger.info("动量类型 {} 的前16%股票数量: {}", momentumType, topStocks.size());
if (topStocks.isEmpty()) {
logger.info("动量类型 {} 没有足够的股票数据,跳过分析", momentumType);
continue;
}
// 4. 过滤出有机构持仓的股票
topStocks = topStocks.stream()
.filter(stock -> stock.getAgenciesHold() != null && stock.getAgenciesHold().compareTo(new BigDecimal(2)) == 1)
.collect(Collectors.toList());
logger.info("动量类型 {} 的前16%股票数量: {}", momentumType, topStocks.size());
if (topStocks.isEmpty()) {
logger.info("动量类型 {} 没有足够的股票数据,跳过分析", momentumType);
continue;
}
// 5. 根据2中的所有股票按照行业统计统计这16%股票所在行业分布及数量
Map<String, Integer> industryDistribution = new HashMap<>();
for (TStockDailyTrade stock : topStocks) {
String industry = stock.getIndustryIndexName();
if (industry != null && !industry.isEmpty()) {
industryDistribution.put(industry, industryDistribution.getOrDefault(industry, 0) + 1);
}
}
logger.info("动量类型 {} 的行业分布: {}", momentumType, industryDistribution);
// 6. 获取3中所有涉及行业的个股数
Map<String, Integer> industryStockCounts = getIndustryStockCounts(stockDailyTrade.getTradeDate(), new ArrayList<>(industryDistribution.keySet()));
logger.info("动量类型 {} 的行业个股数: {}", momentumType, industryStockCounts);
// 7. 计算趋势值,方法是行业个股数乘以行业个股数除以行业趋势个股数,结果四舍五入
List<TTrends> trendsList = new ArrayList<>();
for (Map.Entry<String, Integer> entry : industryDistribution.entrySet()) {
String industry = entry.getKey();
int trendStockCount = entry.getValue();
int totalStockCount = industryStockCounts.getOrDefault(industry, 0);
if (totalStockCount > 0 && trendStockCount > 0) {
// double trendValue = Math.round((double) totalStockCount * totalStockCount / trendStockCount);
BigDecimal c = new BigDecimal(trendStockCount);
BigDecimal allStocks = new BigDecimal(industryStockCounts.get(industry));
double trendValue = c.multiply(c).divide(allStocks, 2, BigDecimal.ROUND_HALF_UP).doubleValue();
TTrends trend = new TTrends();
trend.setTradeDate(stockDailyTrade.getTradeDate());
trend.setIndustryName(industry);
trend.setStocksCount((double) trendStockCount);
trend.setTrendValue(trendValue);
trend.setMomentumType(momentumType);
trend.setCreateTime(new Date());
trend.setUpdateTime(new Date());
trendsList.add(trend);
}
}
// 8. 将5中的行业趋势值按照大小进行排序并设置排名值
trendsList.sort((t1, t2) -> Double.compare(t2.getTrendValue(), t1.getTrendValue()));
for (int i = 0; i < trendsList.size(); i++) {
TTrends trend = trendsList.get(i);
trend.setRank(i + 1);
}
// 9. 根据当前的趋势板块,分别获取前一个交易日的趋势值,计算排名变化和趋势值变化
// 先获取前一个交易日
Date previousTradeDate = getPreviousTradeDate(stockDailyTrade.getTradeDate());
if (previousTradeDate != null) {
// 获取前一个交易日的趋势数据
TTrends queryTrend = new TTrends();
queryTrend.setTradeDate(previousTradeDate);
queryTrend.setMomentumType(momentumType);
List<TTrends> previousTrends = trendsMapper.selectTTrendsList(queryTrend);
// 构建行业到趋势数据的映射
Map<String, TTrends> previousTrendsMap = new HashMap<>();
for (TTrends t : previousTrends) {
previousTrendsMap.put(t.getIndustryName(), t);
}
// 计算排名变化和趋势值变化
for (TTrends currentTrend : trendsList) {
TTrends previousTrend = previousTrendsMap.get(currentTrend.getIndustryName());
if (previousTrend != null) {
// 排名变化 = 前一个交易日排名 - 当前排名
int rankChange = previousTrend.getRank() - currentTrend.getRank();
currentTrend.setRankChange(rankChange);
// 趋势值变化 = 当前趋势值 - 前一个交易日趋势值
double trendValueChange = currentTrend.getTrendValue() - previousTrend.getTrendValue();
currentTrend.setTrendValueChange(trendValueChange);
} else {
// 新出现的行业排名变化105-当前排名105为目前行业所有行业的排名上限
currentTrend.setRankChange(105-currentTrend.getRank());
currentTrend.setTrendValueChange(currentTrend.getTrendValue());
}
}
}
// 10. 将3中的数据存入t_stock_in_trend表中
List<TStocksInTrend> stocksInTrendList = new ArrayList<>();
for (int i = 0; i < topStocks.size(); i++) {
TStockDailyTrade stock = topStocks.get(i);
TStocksInTrend stocksInTrend = new TStocksInTrend();
stocksInTrend.setStockCode(stock.getStockCode());
stocksInTrend.setTradeDate(stockDailyTrade.getTradeDate());
stocksInTrend.setRank(i + 1);
stocksInTrend.setMomentumType(momentumType);
stocksInTrend.setCreateTime(new Date());
stocksInTrend.setUpdateTime(new Date());
stocksInTrendList.add(stocksInTrend);
}
// 批量插入趋势中的股票数据
if (!stocksInTrendList.isEmpty()) {
tStocksInTrendMapper.batchInsertTStocksInTrend(stocksInTrendList);
logger.info("动量类型 {} 批量插入趋势中的股票数据完成,数量: {}", momentumType, stocksInTrendList.size());
}
// 11. 将趋势值等数据存入t_trends中
if (!trendsList.isEmpty()) {
for (TTrends trend : trendsList) {
trendsMapper.insertTTrends(trend);
}
logger.info("动量类型 {} 批量插入趋势数据完成,数量: {}", momentumType, trendsList.size());
}
}
logger.info("股票数据分析完成,交易日期: {}", stockDailyTrade.getTradeDate());
return "分析完成";
} catch (Exception e) {
logger.error("股票数据分析失败,交易日期: {}", stockDailyTrade.getTradeDate(), e);
throw new RuntimeException("分析失败: " + e.getMessage());
}
}
/**
* 16%
*
* @param tradeDate
* @param momentumType
* @return 16%
*/
private List<TStockDailyTrade> getTop16PercentStocks(Date tradeDate, String momentumType)
{
try {
// 1. 查询tradeDate交易日的所有股票数据
TStockDailyTrade query = new TStockDailyTrade();
query.setTradeDate(tradeDate);
List<TStockDailyTrade> allStocks = stockDailyTradeMapper.selectStockDailyTradeListWithBasic(query);
int totalCount = allStocks.size();
logger.info("交易日 {} 的股票数量: {}", tradeDate, totalCount);
if (allStocks.isEmpty()) {
logger.warn("交易日 {} 没有股票数据,返回空列表", tradeDate);
return new ArrayList<>();
}
// 2. 根据momentumType周期进行排序
allStocks.sort((s1, s2) -> {
BigDecimal momentum1 = getMomentumValue(s1, momentumType);
BigDecimal momentum2 = getMomentumValue(s2, momentumType);
// 倒序排序,涨幅大的在前
return momentum2.compareTo(momentum1);
});
// 3. 计算股票总数的16%,取整
int topCount = (int) (totalCount * 0.16);
// int topCount = 600;//暂时为了验证计算使用600固定数
// 确保至少返回1只股票
topCount = Math.max(1, topCount);
logger.info("股票总数: {}, 前16%数量: {}", totalCount, topCount);
// 4. 获取前16%的股票列表
if (topCount > 0) {
return allStocks.subList(0, Math.min(topCount, totalCount));
} else {
return new ArrayList<>();
}
} catch (Exception e) {
logger.error("获取前16%股票失败,交易日: {}, 动量类型: {}", tradeDate, momentumType, e);
throw new RuntimeException("获取前16%股票失败: " + e.getMessage());
}
}
/**
*
*
* @param stock
* @param momentumType
* @return
*/
private BigDecimal getMomentumValue(TStockDailyTrade stock, String momentumType)
{
// 根据不同的动量类型返回对应的动量值
switch (momentumType) {
case "10":
return stock.getMomentum10d() != null ? stock.getMomentum10d() : BigDecimal.ZERO;
case "20":
return stock.getMomentum20d() != null ? stock.getMomentum20d() : BigDecimal.ZERO;
case "60":
return stock.getMomentum60d() != null ? stock.getMomentum60d() : BigDecimal.ZERO;
default:
// 默认返回当日涨跌幅
return stock.getPriceChangeRate() != null ? stock.getPriceChangeRate() : BigDecimal.ZERO;
}
}
/**
*
*
* @param tradeDate
* @param industries
* @return
*/
private Map<String, Integer> getIndustryStockCounts(Date tradeDate, List<String> industries)
{
try {
Map<String, Integer> industryStockCounts = new HashMap<>();
if (industries.isEmpty()) {
return industryStockCounts;
}
// 查询tradeDate交易日的所有股票数据
TStockDailyTrade query = new TStockDailyTrade();
query.setTradeDate(tradeDate);
List<TStockDailyTrade> allStocks = stockDailyTradeMapper.selectStockDailyTradeListWithBasic(query);
// 按行业统计个股数量
for (TStockDailyTrade stock : allStocks) {
String industry = stock.getIndustryIndexName();
if (industry != null && !industry.isEmpty() && industries.contains(industry)) {
industryStockCounts.put(industry, industryStockCounts.getOrDefault(industry, 0) + 1);
}
}
logger.info("交易日 {} 的行业个股数统计完成,行业数量: {}", tradeDate, industryStockCounts.size());
return industryStockCounts;
} catch (Exception e) {
logger.error("获取行业个股数失败,交易日: {}", tradeDate, e);
throw new RuntimeException("获取行业个股数失败: " + e.getMessage());
}
}
/**
*
*
* @param currentDate
* @return
*/
private Date getPreviousTradeDate(Date currentDate)
{
try {
// 查询交易日期表,获取当前日期之前的最近一个交易日
Date previousTradeDate = stockDailyTradeMapper.selectPreviousTradeDate(currentDate);
logger.info("当前日期 {} 的前一个交易日: {}", currentDate, previousTradeDate);
return previousTradeDate;
} catch (Exception e) {
logger.error("获取前一个交易日失败,当前日期: {}", currentDate, e);
throw new RuntimeException("获取前一个交易日失败: " + e.getMessage());
}
}
}

@ -0,0 +1,278 @@
package com.ruoyi.newstocksystem.service.impl;
import java.util.Date;
import java.util.List;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Set;
import java.util.HashMap;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.ruoyi.newstocksystem.domain.TIndustryBasic;
import com.ruoyi.newstocksystem.domain.TStockBasic;
import com.ruoyi.newstocksystem.domain.TStockHighLowStatus;
import com.ruoyi.newstocksystem.mapper.TStockHighLowStatusMapper;
import com.ruoyi.newstocksystem.service.IIndustryIndexService;
import com.ruoyi.newstocksystem.service.IStockBasicService;
import com.ruoyi.newstocksystem.service.IStockHighLowStatusService;
import com.ruoyi.newstocksystem.service.ITIndustryBasicService;
/**
* Service
*
* @author lxy
* @date 2026-01-21
*/
@Service
public class StockHighLowStatusServiceImpl implements IStockHighLowStatusService
{
private static final Logger logger = LoggerFactory.getLogger(StockHighLowStatusServiceImpl.class);
@Autowired
private TStockHighLowStatusMapper stockHighLowStatusMapper;
@Autowired
private IStockBasicService stockBasicService;
@Autowired
private IIndustryIndexService industryIndexService;
@Autowired
private ITIndustryBasicService industryBasicService;
@Override
public TStockHighLowStatus selectStockHighLowStatusByCodeAndDate(String stockCode, Date tradeDate)
{
return stockHighLowStatusMapper.selectStockHighLowStatusByCodeAndDate(stockCode, tradeDate);
}
@Override
public List<TStockHighLowStatus> selectStockHighLowStatusList(TStockHighLowStatus stockHighLowStatus)
{
return stockHighLowStatusMapper.selectStockHighLowStatusList(stockHighLowStatus);
}
@Override
public List<TStockHighLowStatus> selectStockHighLowStatusListWithBasic(TStockHighLowStatus stockHighLowStatus)
{
return stockHighLowStatusMapper.selectStockHighLowStatusListWithBasic(stockHighLowStatus);
}
@Override
public int insertStockHighLowStatus(TStockHighLowStatus stockHighLowStatus)
{
return stockHighLowStatusMapper.insertStockHighLowStatus(stockHighLowStatus);
}
@Override
public int updateStockHighLowStatus(TStockHighLowStatus stockHighLowStatus)
{
return stockHighLowStatusMapper.updateStockHighLowStatus(stockHighLowStatus);
}
@Override
public int deleteStockHighLowStatusByCodeAndDate(String stockCode, Date tradeDate)
{
return stockHighLowStatusMapper.deleteStockHighLowStatusByCodeAndDate(stockCode, tradeDate);
}
@Override
@Transactional
public int importStockHighLowStatus(List<TStockHighLowStatus> stockHighLowStatusList, Date tradeDate)
{
if (stockHighLowStatusList == null || stockHighLowStatusList.isEmpty())
{
return 0;
}
// 设置交易日期
for (TStockHighLowStatus stockHighLowStatus : stockHighLowStatusList)
{
if (stockHighLowStatus.getTradeDate() == null)
{
stockHighLowStatus.setTradeDate(tradeDate);
}
// 设置默认值
if (stockHighLowStatus.getIsNewHigh() == null)
{
stockHighLowStatus.setIsNewHigh(0);
}
if (stockHighLowStatus.getIsNewLow() == null)
{
stockHighLowStatus.setIsNewLow(0);
}
}
long startTime = System.currentTimeMillis();
logger.info("开始处理股票基础数据,待处理记录数: {}", stockHighLowStatusList.size());
// 收集所有需要检查的行业代码
Set<String> industryCodes = new HashSet<>();
for (TStockHighLowStatus stockHighLowStatus : stockHighLowStatusList)
{
if (stockHighLowStatus.getIndustryIndexCode() != null && !stockHighLowStatus.getIndustryIndexCode().trim().isEmpty())
{
industryCodes.add(stockHighLowStatus.getIndustryIndexCode());
}
}
// 检查并确保行业基础数据存在
logger.info("开始检查行业基础数据,需要检查的行业代码数量: {}", industryCodes.size());
if (!industryCodes.isEmpty())
{
// 检查每个行业代码是否存在,如果不存在则创建
for (String industryCode : industryCodes)
{
if (!industryIndexService.checkIndustryBasicExists(industryCode))
{
// 如果行业基础数据不存在,创建一个基础记录
String industryName = industryCode; // 使用代码作为默认名称
if (stockHighLowStatusList != null) {
// 尝试从数据中获取行业名称
for (TStockHighLowStatus status : stockHighLowStatusList) {
if (status.getIndustryIndexCode() != null && status.getIndustryIndexCode().equals(industryCode)) {
if (status.getIndustryIndexName() != null) {
industryName = status.getIndustryIndexName();
break;
}
}
}
}
industryIndexService.createIndustryBasic(industryCode, industryName);
}
}
}
// 收集所有需要检查的股票代码
Set<String> stockCodes = new HashSet<>();
for (TStockHighLowStatus stockHighLowStatus : stockHighLowStatusList)
{
stockCodes.add(stockHighLowStatus.getStockCode());
}
// 一次性读取所有存在的股票基础数据
logger.info("开始批量读取股票基础数据,股票代码数量: {}", stockCodes.size());
long loadStart = System.currentTimeMillis();
List<TStockBasic> existingBasics = stockBasicService.selectStockBasicList(new TStockBasic());
// 将现有基础数据转换为Map以便快速查找
Map<String, TStockBasic> existingBasicsMap = new HashMap<>();
for (TStockBasic basic : existingBasics)
{
if (stockCodes.contains(basic.getStockCode()))
{
existingBasicsMap.put(basic.getStockCode(), basic);
}
}
long loadEnd = System.currentTimeMillis();
logger.info("股票基础数据读取完成,耗时: {} ms", (loadEnd - loadStart));
// 准备需要插入的数据
List<TStockBasic> newBasicsToInsert = new ArrayList<>();
logger.info("开始比较和分类股票基础数据");
long compareStart = System.currentTimeMillis();
for (TStockHighLowStatus stockHighLowStatus : stockHighLowStatusList)
{
TStockBasic existingBasic = existingBasicsMap.get(stockHighLowStatus.getStockCode());
if (existingBasic == null)
{
// 如果不存在,创建新的股票基础数据记录
// 对于新高新低状态,我们可能没有足够的信息来填充完整的股票基础数据
// 因此我们创建一个只有股票代码的最小记录
TStockBasic newBasic = new TStockBasic();
newBasic.setStockCode(stockHighLowStatus.getStockCode());
// 设置一些默认值以避免数据库约束错误
newBasic.setStockName(stockHighLowStatus.getStockCode()); // 使用股票代码作为名称
if (stockHighLowStatus.getIndustryIndexCode() != null && !stockHighLowStatus.getIndustryIndexCode().trim().isEmpty()) {
newBasic.setIndustryIndexCode(stockHighLowStatus.getIndustryIndexCode());
} else {
newBasic.setIndustryIndexCode("");
}
if (stockHighLowStatus.getIndustryIndexName() != null) {
newBasic.setIndustryIndexName(stockHighLowStatus.getIndustryIndexName());
} else {
newBasic.setIndustryIndexName("");
}
newBasic.setIsSt(0); // 默认不是ST股票
newBasic.setIsStarSt(0); // 默认不是*ST股票
// 注意:这里没有股票名称,所以我们使用股票代码作为名称或跳过插入
// 根据业务需求,我们可以选择不插入,或者使用股票代码作为名称
// 这里我们暂时只插入股票代码
if (stockHighLowStatus.getStockCode() != null)
{
newBasicsToInsert.add(newBasic);
}
}
// 不需要更新已有基础数据,因为新高新低状态没有提供相关信息
}
long compareEnd = System.currentTimeMillis();
logger.info("股票基础数据比较完成,耗时: {} ms", (compareEnd - compareStart));
// 批量插入新的股票基础数据
if (!newBasicsToInsert.isEmpty())
{
logger.info("准备批量插入 {} 条新的股票基础数据", newBasicsToInsert.size());
long insertStart = System.currentTimeMillis();
stockBasicService.importStockBasic(newBasicsToInsert); // 使用importStockBasic方法进行批量插入
long insertEnd = System.currentTimeMillis();
logger.info("股票基础数据插入完成,耗时: {} ms", (insertEnd - insertStart));
}
else
{
logger.info("无需插入新的股票基础数据");
}
long checkTime = System.currentTimeMillis();
logger.info("股票基础数据处理完成,耗时: {} ms", (checkTime - startTime));
// 批量插入新高新低状态数据
int count = 0;
int batchSize = 500;
logger.info("开始批量插入新高新低状态数据,总记录数: {}", stockHighLowStatusList.size());
long statusDataStartTime = System.currentTimeMillis();
for (int i = 0; i < stockHighLowStatusList.size(); i += batchSize)
{
int end = Math.min(i + batchSize, stockHighLowStatusList.size());
List<TStockHighLowStatus> batchList = stockHighLowStatusList.subList(i, end);
int batchCount = stockHighLowStatusMapper.batchUpsertStockHighLowStatus(batchList);
count += batchCount;
logger.info("批次 [{}-{}] 新高新低状态数据插入完成,本次插入: {} 条", i, end, batchCount);
}
long statusDataEndTime = System.currentTimeMillis();
logger.info("新高新低状态数据批量插入完成,总插入: {} 条,耗时: {} ms", count, (statusDataEndTime - statusDataStartTime));
long totalTime = System.currentTimeMillis() - startTime;
logger.info("导入任务完成,总耗时: {} ms", totalTime);
return count;
}
@Override
public List<TStockHighLowStatus> selectNewHighStockList(TStockHighLowStatus stockHighLowStatus)
{
return stockHighLowStatusMapper.selectNewHighStockList(stockHighLowStatus);
}
@Override
public List<TStockHighLowStatus> selectNewLowStockList(TStockHighLowStatus stockHighLowStatus)
{
return stockHighLowStatusMapper.selectNewLowStockList(stockHighLowStatus);
}
}

@ -0,0 +1,95 @@
package com.ruoyi.newstocksystem.service.impl;
import java.util.List;
import com.ruoyi.newstocksystem.mapper.TIndustryIndexMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.newstocksystem.mapper.TIndustryBasicMapper;
import com.ruoyi.newstocksystem.domain.TIndustryBasic;
import com.ruoyi.newstocksystem.service.ITIndustryBasicService;
/**
* Service
*
* @author lxy
* @date 2026-01-23
*/
@Service
public class TIndustryBasicServiceImpl implements ITIndustryBasicService
{
@Autowired
private TIndustryBasicMapper tIndustryBasicMapper;
/**
*
*
* @param industryCode
* @return
*/
@Override
public TIndustryBasic selectTIndustryBasicByCode(String industryCode)
{
return tIndustryBasicMapper.selectTIndustryBasicByCode(industryCode);
}
/**
*
*
* @param industryBasic
* @return
*/
@Override
public List<TIndustryBasic> selectTIndustryBasicList(TIndustryBasic industryBasic)
{
return tIndustryBasicMapper.selectTIndustryBasicList(industryBasic);
}
/**
*
*
* @param industryBasic
* @return
*/
@Override
public int insertTIndustryBasic(TIndustryBasic industryBasic)
{
return tIndustryBasicMapper.insertTIndustryBasic(industryBasic);
}
/**
*
*
* @param industryBasic
* @return
*/
@Override
public int updateTIndustryBasic(TIndustryBasic industryBasic)
{
return tIndustryBasicMapper.updateTIndustryBasic(industryBasic);
}
/**
*
*
* @param industryCodes
* @return
*/
@Override
public int deleteTIndustryBasicByCodes(String[] industryCodes)
{
return tIndustryBasicMapper.deleteTIndustryBasicByCodes(industryCodes);
}
/**
*
*
* @param industryBasicList
* @return
*/
@Override
public int importIndustryBasic(List<TIndustryBasic> industryBasicList)
{
return tIndustryBasicMapper.batchUpsertIndustryBasic(industryBasicList);
}
}

@ -0,0 +1,115 @@
package com.ruoyi.newstocksystem.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.newstocksystem.mapper.TStockFinancialMapper;
import com.ruoyi.newstocksystem.domain.TStockFinancial;
import com.ruoyi.newstocksystem.service.TStockFinancialService;
import com.ruoyi.newstocksystem.mapper.TStockBasicMapper;
/**
* Service
*
* @author lxy
* @date 2026-01-21
*/
@Service
public class TStockFinancialServiceImpl implements TStockFinancialService
{
@Autowired
private TStockFinancialMapper tStockFinancialMapper;
@Autowired
private TStockBasicMapper tStockBasicMapper;
/**
*
*
* @param id
* @return
*/
@Override
public TStockFinancial selectTStockFinancialById(Long id)
{
return tStockFinancialMapper.selectTStockFinancialById(id);
}
/**
*
*
* @param tStockFinancial
* @return
*/
@Override
public List<TStockFinancial> selectTStockFinancialList(TStockFinancial tStockFinancial)
{
return tStockFinancialMapper.selectTStockFinancialList(tStockFinancial);
}
/**
*
*
* @param tStockFinancial
* @return
*/
@Override
public int insertTStockFinancial(TStockFinancial tStockFinancial)
{
return tStockFinancialMapper.insertTStockFinancial(tStockFinancial);
}
/**
*
*
* @param tStockFinancial
* @return
*/
@Override
public int updateTStockFinancial(TStockFinancial tStockFinancial)
{
return tStockFinancialMapper.updateTStockFinancial(tStockFinancial);
}
/**
*
*
* @param ids
* @return
*/
@Override
public int deleteTStockFinancialByIds(Long[] ids)
{
return tStockFinancialMapper.deleteTStockFinancialByIds(ids);
}
/**
*
*
* @param id
* @return
*/
@Override
public int deleteTStockFinancialById(Long id)
{
return tStockFinancialMapper.deleteTStockFinancialById(id);
}
/**
*
*
* @param tStockFinancialList
* @return
*/
@Override
public int batchUpsert(List<TStockFinancial> tStockFinancialList)
{
return tStockFinancialMapper.batchUpsert(tStockFinancialList);
}
@Override
public boolean validateStockCodeExists(String stockCode)
{
return tStockBasicMapper.selectStockBasicByCode(stockCode) != null;
}
}

@ -0,0 +1,115 @@
package com.ruoyi.newstocksystem.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.newstocksystem.mapper.TStocksInTrendMapper;
import com.ruoyi.newstocksystem.domain.TStocksInTrend;
import com.ruoyi.newstocksystem.service.TStocksInTrendService;
import com.ruoyi.newstocksystem.mapper.TStockBasicMapper;
/**
* Service
*
* @author lxy
* @date 2026-01-21
*/
@Service
public class TStocksInTrendServiceImpl implements TStocksInTrendService
{
@Autowired
private TStocksInTrendMapper tStocksInTrendMapper;
@Autowired
private TStockBasicMapper tStockBasicMapper;
/**
*
*
* @param id
* @return
*/
@Override
public TStocksInTrend selectTStocksInTrendById(Long id)
{
return tStocksInTrendMapper.selectTStocksInTrendById(id);
}
/**
*
*
* @param tStocksInTrend
* @return
*/
@Override
public List<TStocksInTrend> selectTStocksInTrendList(TStocksInTrend tStocksInTrend)
{
return tStocksInTrendMapper.selectTStocksInTrendList(tStocksInTrend);
}
/**
*
*
* @param tStocksInTrend
* @return
*/
@Override
public int insertTStocksInTrend(TStocksInTrend tStocksInTrend)
{
return tStocksInTrendMapper.insertTStocksInTrend(tStocksInTrend);
}
/**
*
*
* @param tStocksInTrend
* @return
*/
@Override
public int updateTStocksInTrend(TStocksInTrend tStocksInTrend)
{
return tStocksInTrendMapper.updateTStocksInTrend(tStocksInTrend);
}
/**
*
*
* @param ids
* @return
*/
@Override
public int deleteTStocksInTrendByIds(Long[] ids)
{
return tStocksInTrendMapper.deleteTStocksInTrendByIds(ids);
}
/**
*
*
* @param id
* @return
*/
@Override
public int deleteTStocksInTrendById(Long id)
{
return tStocksInTrendMapper.deleteTStocksInTrendById(id);
}
/**
*
*
* @param tStocksInTrendList
* @return
*/
@Override
public int batchUpsert(List<TStocksInTrend> tStocksInTrendList)
{
return tStocksInTrendMapper.batchUpsert(tStocksInTrendList);
}
@Override
public boolean validateStockCodeExists(String stockCode)
{
return tStockBasicMapper.selectStockBasicByCode(stockCode) != null;
}
}

@ -0,0 +1,194 @@
package com.ruoyi.newstocksystem.service.impl;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.newstocksystem.mapper.TTrendsMapper;
import com.ruoyi.newstocksystem.domain.TTrends;
import com.ruoyi.newstocksystem.service.TTrendsService;
import com.ruoyi.newstocksystem.mapper.TIndustryBasicMapper;
/**
* Service
*
* @author lxy
* @date 2026-01-21
*/
@Service
public class TTrendsServiceImpl implements TTrendsService
{
@Autowired
private TTrendsMapper tTrendsMapper;
@Autowired
private TIndustryBasicMapper tIndustryBasicMapper;
/**
*
*
* @param id
* @return
*/
@Override
public TTrends selectTTrendsById(Long id)
{
return tTrendsMapper.selectTTrendsById(id);
}
/**
*
*
* @param tTrends
* @return
*/
@Override
public List<TTrends> selectTTrendsList(TTrends tTrends)
{
return tTrendsMapper.selectTTrendsList(tTrends);
}
/**
*
*
* @param tTrends
* @return
*/
@Override
public int insertTTrends(TTrends tTrends)
{
return tTrendsMapper.insertTTrends(tTrends);
}
/**
*
*
* @param tTrends
* @return
*/
@Override
public int updateTTrends(TTrends tTrends)
{
return tTrendsMapper.updateTTrends(tTrends);
}
/**
*
*
* @param ids
* @return
*/
@Override
public int deleteTTrendsByIds(Long[] ids)
{
return tTrendsMapper.deleteTTrendsByIds(ids);
}
/**
*
*
* @param id
* @return
*/
@Override
public int deleteTTrendsById(Long id)
{
return tTrendsMapper.deleteTTrendsById(id);
}
/**
*
*
* @param tTrendsList
* @return
*/
@Override
public int batchUpsert(List<TTrends> tTrendsList)
{
return tTrendsMapper.batchUpsert(tTrendsList);
}
@Override
public boolean validateIndustryNameExists(String industryName)
{
// 由于t_trends表现在使用industry_name作为主键的一部分这里应该验证行业名称
return tIndustryBasicMapper.selectTIndustryBasicByName(industryName) != null;
}
@Override
public boolean validateIndustryBasicNameExists(String industryName)
{
return tIndustryBasicMapper.selectTIndustryBasicByName(industryName) != null;
}
/**
*
*
* @param tTrends
* @return
*/
@Override
public List<?> listTrendsSection(TTrends tTrends)
{
// 创建日期格式化对象用于将Date转换为字符串
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
// 1. 获取当前传入参数的所有趋势排名数据list
List<TTrends> currentDayTrends = tTrendsMapper.getTrendsByDateAndType(tTrends);
if (currentDayTrends == null || currentDayTrends.isEmpty()) {
return new ArrayList<>();
}
// 2. 获取当前日期往前10个交易日的所有日期
Map<String, Object> dateParams = new HashMap<>();
dateParams.put("momentumType", tTrends.getMomentumType());
dateParams.put("currentDate", tTrends.getTradeDate());
List<Date> previousDays = tTrendsMapper.getPreviousTradeDates(dateParams);
if (previousDays == null || previousDays.isEmpty()) {
return new ArrayList<>();
}
// 3. 准备返回结果列表
List<Map<String, Object>> resultList = new ArrayList<>();
// 4. 遍历当前日期的每个行业获取其在这10个交易日的排名
for (TTrends currentTrend : currentDayTrends) {
String industryName = currentTrend.getIndustryName();
Map<String, Object> industryData = new HashMap<>();
industryData.put("industryName", industryName);
// 5. 获取该行业在这10个交易日的所有趋势数据
Map<String, Object> trendParams = new HashMap<>();
trendParams.put("momentumType", tTrends.getMomentumType());
trendParams.put("industryName", industryName);
trendParams.put("startDate", previousDays.get(previousDays.size() - 1)); // 最早的日期
trendParams.put("endDate", previousDays.get(0)); // 最近的日期
List<TTrends> industryTrends = tTrendsMapper.getTrendsByIndustryAndDateRange(trendParams);
// 6. 将行业趋势数据转换为日期到排名的映射
Map<Date, Integer> dateRankMap = new HashMap<>();
if (industryTrends != null && !industryTrends.isEmpty()) {
for (TTrends trend : industryTrends) {
dateRankMap.put(trend.getTradeDate(), trend.getRank());
}
}
// 7. 遍历10个交易日填充排名数据缺少的数据用-1表示
for (int i = 0; i < previousDays.size(); i++) {
Date tradeDate = previousDays.get(i);
Integer rank = dateRankMap.get(tradeDate);
// 使用交易日期字符串作为key值
industryData.put(sdf.format(tradeDate), rank != null ? rank : -1);
}
resultList.add(industryData);
}
return resultList;
}
}

@ -0,0 +1,229 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.newstocksystem.mapper.TIndustryIndexMapper">
<resultMap type="com.ruoyi.newstocksystem.domain.TIndustryIndex" id="IndustryIndexResult">
<result property="industryIndexCode" column="industry_index_code" />
<result property="industryIndexName" column="industry_index_name" />
<result property="componentCount" column="component_count" />
<result property="tradeDate" column="trade_date" />
<result property="openPrice" column="open_price" />
<result property="closePrice" column="close_price" />
<result property="highPrice" column="high_price" />
<result property="lowPrice" column="low_price" />
<result property="volume" column="volume" />
<result property="turnover" column="turnover" />
<result property="totalMarketCap" column="total_market_cap" />
<result property="freeCirculationCap" column="free_circulation_cap" />
<result property="priceChangeRate" column="price_change_rate" />
<result property="peTtm" column="pe_ttm" />
<result property="peTtmMedian" column="pe_ttm_median" />
<result property="upCount" column="up_count" />
<result property="downCount" column="down_count" />
<result property="limitUpCount" column="limit_up_count" />
<result property="limitDownCount" column="limit_down_count" />
<result property="noChangeCount" column="no_change_count" />
<result property="suspendCount" column="suspend_count" />
<result property="newHighFlag" column="new_high_flag" />
<result property="newLowFlag" column="new_low_flag" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectIndustryIndexVo">
select industry_index_code, industry_index_name, component_count, trade_date,
open_price, close_price, high_price, low_price, volume, turnover,
total_market_cap, free_circulation_cap, price_change_rate, pe_ttm, pe_ttm_median,
up_count, down_count, limit_up_count, limit_down_count, no_change_count,
suspend_count, new_high_flag, new_low_flag, create_time, update_time
from t_industry_index
</sql>
<select id="selectIndustryIndexByCodeAndDate" resultMap="IndustryIndexResult">
<include refid="selectIndustryIndexVo" />
where industry_index_code = #{param1} and trade_date = #{param2}
</select>
<select id="selectIndustryIndexList" parameterType="com.ruoyi.newstocksystem.domain.TIndustryIndex" resultMap="IndustryIndexResult">
<include refid="selectIndustryIndexVo" />
<where>
<if test="industryIndexCode != null and industryIndexCode != ''">
and industry_index_code = #{industryIndexCode}
</if>
<if test="industryIndexName != null and industryIndexName != ''">
and industry_index_name like concat('%', #{industryIndexName}, '%')
</if>
<if test="tradeDate != null">
and trade_date = #{tradeDate}
</if>
<if test="params.beginTradeDate != null and params.beginTradeDate != ''">
and trade_date &gt;= #{params.beginTradeDate}
</if>
<if test="params.endTradeDate != null and params.endTradeDate != ''">
and trade_date &lt;= #{params.endTradeDate}
</if>
</where>
order by trade_date desc, industry_index_code asc
</select>
<select id="selectDistinctIndustryIndexList" resultMap="IndustryIndexResult">
select distinct industry_index_code, industry_index_name
from t_industry_index
order by industry_index_code
</select>
<select id="selectTradeDates" resultType="String">
select distinct DATE_FORMAT(trade_date, '%Y-%m-%d') as trade_date
from t_industry_index
order by trade_date desc
</select>
<insert id="insertIndustryIndex" parameterType="com.ruoyi.newstocksystem.domain.TIndustryIndex">
insert into t_industry_index
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="industryIndexCode != null and industryIndexCode != ''">industry_index_code,</if>
<if test="industryIndexName != null and industryIndexName != ''">industry_index_name,</if>
<if test="componentCount != null">component_count,</if>
<if test="tradeDate != null">trade_date,</if>
<if test="openPrice != null">open_price,</if>
<if test="closePrice != null">close_price,</if>
<if test="highPrice != null">high_price,</if>
<if test="lowPrice != null">low_price,</if>
<if test="volume != null">volume,</if>
<if test="turnover != null">turnover,</if>
<if test="totalMarketCap != null">total_market_cap,</if>
<if test="freeCirculationCap != null">free_circulation_cap,</if>
<if test="priceChangeRate != null">price_change_rate,</if>
<if test="peTtm != null">pe_ttm,</if>
<if test="peTtmMedian != null">pe_ttm_median,</if>
<if test="upCount != null">up_count,</if>
<if test="downCount != null">down_count,</if>
<if test="limitUpCount != null">limit_up_count,</if>
<if test="limitDownCount != null">limit_down_count,</if>
<if test="noChangeCount != null">no_change_count,</if>
<if test="suspendCount != null">suspend_count,</if>
<if test="newHighFlag != null">new_high_flag,</if>
<if test="newLowFlag != null">new_low_flag,</if>
create_time,
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="industryIndexCode != null and industryIndexCode != ''">#{industryIndexCode},</if>
<if test="industryIndexName != null and industryIndexName != ''">#{industryIndexName},</if>
<if test="componentCount != null">#{componentCount},</if>
<if test="tradeDate != null">#{tradeDate},</if>
<if test="openPrice != null">#{openPrice},</if>
<if test="closePrice != null">#{closePrice},</if>
<if test="highPrice != null">#{highPrice},</if>
<if test="lowPrice != null">#{lowPrice},</if>
<if test="volume != null">#{volume},</if>
<if test="turnover != null">#{turnover},</if>
<if test="totalMarketCap != null">#{totalMarketCap},</if>
<if test="freeCirculationCap != null">#{freeCirculationCap},</if>
<if test="priceChangeRate != null">#{priceChangeRate},</if>
<if test="peTtm != null">#{peTtm},</if>
<if test="peTtmMedian != null">#{peTtmMedian},</if>
<if test="upCount != null">#{upCount},</if>
<if test="downCount != null">#{downCount},</if>
<if test="limitUpCount != null">#{limitUpCount},</if>
<if test="limitDownCount != null">#{limitDownCount},</if>
<if test="noChangeCount != null">#{noChangeCount},</if>
<if test="suspendCount != null">#{suspendCount},</if>
<if test="newHighFlag != null">#{newHighFlag},</if>
<if test="newLowFlag != null">#{newLowFlag},</if>
NOW(),
</trim>
</insert>
<update id="updateIndustryIndex" parameterType="com.ruoyi.newstocksystem.domain.TIndustryIndex">
update t_industry_index
<trim prefix="set" suffixOverrides=",">
<if test="industryIndexName != null and industryIndexName != ''">industry_index_name = #{industryIndexName},</if>
<if test="componentCount != null">component_count = #{componentCount},</if>
<if test="openPrice != null">open_price = #{openPrice},</if>
<if test="closePrice != null">close_price = #{closePrice},</if>
<if test="highPrice != null">high_price = #{highPrice},</if>
<if test="lowPrice != null">low_price = #{lowPrice},</if>
<if test="volume != null">volume = #{volume},</if>
<if test="turnover != null">turnover = #{turnover},</if>
<if test="totalMarketCap != null">total_market_cap = #{totalMarketCap},</if>
<if test="freeCirculationCap != null">free_circulation_cap = #{freeCirculationCap},</if>
<if test="priceChangeRate != null">price_change_rate = #{priceChangeRate},</if>
<if test="peTtm != null">pe_ttm = #{peTtm},</if>
<if test="peTtmMedian != null">pe_ttm_median = #{peTtmMedian},</if>
<if test="upCount != null">up_count = #{upCount},</if>
<if test="downCount != null">down_count = #{downCount},</if>
<if test="limitUpCount != null">limit_up_count = #{limitUpCount},</if>
<if test="limitDownCount != null">limit_down_count = #{limitDownCount},</if>
<if test="noChangeCount != null">no_change_count = #{noChangeCount},</if>
<if test="suspendCount != null">suspend_count = #{suspendCount},</if>
<if test="newHighFlag != null">new_high_flag = #{newHighFlag},</if>
<if test="newLowFlag != null">new_low_flag = #{newLowFlag},</if>
update_time = NOW(),
</trim>
where industry_index_code = #{industryIndexCode} and trade_date = #{tradeDate}
</update>
<delete id="deleteIndustryIndexByCodeAndDate">
delete from t_industry_index where industry_index_code = #{param1} and trade_date = #{param2}
</delete>
<insert id="batchInsertIndustryIndex" parameterType="java.util.List">
insert into t_industry_index(industry_index_code, industry_index_name, component_count, trade_date,
open_price, close_price, high_price, low_price, volume, turnover,
total_market_cap, free_circulation_cap, price_change_rate, pe_ttm, pe_ttm_median,
up_count, down_count, limit_up_count, limit_down_count, no_change_count,
suspend_count, new_high_flag, new_low_flag, create_time)
values
<foreach collection="list" item="item" separator=",">
(#{item.industryIndexCode}, #{item.industryIndexName}, #{item.componentCount}, #{item.tradeDate},
#{item.openPrice}, #{item.closePrice}, #{item.highPrice}, #{item.lowPrice}, #{item.volume}, #{item.turnover},
#{item.totalMarketCap}, #{item.freeCirculationCap}, #{item.priceChangeRate}, #{item.peTtm}, #{item.peTtmMedian},
#{item.upCount}, #{item.downCount}, #{item.limitUpCount}, #{item.limitDownCount}, #{item.noChangeCount},
#{item.suspendCount}, #{item.newHighFlag}, #{item.newLowFlag}, NOW())
</foreach>
</insert>
<insert id="batchUpsertIndustryIndex" parameterType="java.util.List">
insert into t_industry_index(industry_index_code, industry_index_name, component_count, trade_date,
open_price, close_price, high_price, low_price, volume, turnover,
total_market_cap, free_circulation_cap, price_change_rate, pe_ttm, pe_ttm_median,
up_count, down_count, limit_up_count, limit_down_count, no_change_count,
suspend_count, new_high_flag, new_low_flag, create_time)
values
<foreach collection="list" item="item" separator=",">
(#{item.industryIndexCode}, #{item.industryIndexName}, #{item.componentCount}, #{item.tradeDate},
#{item.openPrice}, #{item.closePrice}, #{item.highPrice}, #{item.lowPrice}, #{item.volume}, #{item.turnover},
#{item.totalMarketCap}, #{item.freeCirculationCap}, #{item.priceChangeRate}, #{item.peTtm}, #{item.peTtmMedian},
#{item.upCount}, #{item.downCount}, #{item.limitUpCount}, #{item.limitDownCount}, #{item.noChangeCount},
#{item.suspendCount}, #{item.newHighFlag}, #{item.newLowFlag}, NOW())
</foreach>
ON DUPLICATE KEY UPDATE
industry_index_name = VALUES(industry_index_name),
component_count = VALUES(component_count),
open_price = VALUES(open_price),
close_price = VALUES(close_price),
high_price = VALUES(high_price),
low_price = VALUES(low_price),
volume = VALUES(volume),
turnover = VALUES(turnover),
total_market_cap = VALUES(total_market_cap),
free_circulation_cap = VALUES(free_circulation_cap),
price_change_rate = VALUES(price_change_rate),
pe_ttm = VALUES(pe_ttm),
pe_ttm_median = VALUES(pe_ttm_median),
up_count = VALUES(up_count),
down_count = VALUES(down_count),
limit_up_count = VALUES(limit_up_count),
limit_down_count = VALUES(limit_down_count),
no_change_count = VALUES(no_change_count),
suspend_count = VALUES(suspend_count),
new_high_flag = VALUES(new_high_flag),
new_low_flag = VALUES(new_low_flag),
update_time = NOW()
</insert>
</mapper>

@ -0,0 +1,132 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.newstocksystem.mapper.NewStockBasicMapper">
<resultMap type="com.ruoyi.newstocksystem.domain.NewStockBasic" id="NewStockBasicResult">
<id property="id" column="id" />
<result property="code" column="code" />
<result property="name" column="name" />
<result property="industryId" column="industry_id" />
<result property="industryName" column="industry_name" />
<result property="market" column="market" />
<result property="listDate" column="list_date" />
<result property="status" column="status" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectNewStockBasicVo">
select id, code, name, industry_id, industry_name, market, list_date, status, create_by, create_time, update_by, update_time, remark from new_stock_basic
</sql>
<select id="selectNewStockBasicById" parameterType="Integer" resultMap="NewStockBasicResult">
<include refid="selectNewStockBasicVo" />
where id = #{id}
</select>
<select id="selectNewStockBasicByCode" parameterType="String" resultMap="NewStockBasicResult">
<include refid="selectNewStockBasicVo" />
where code = #{code}
</select>
<select id="selectNewStockBasicList" parameterType="com.ruoyi.newstocksystem.domain.NewStockBasic" resultMap="NewStockBasicResult">
<include refid="selectNewStockBasicVo" />
<where>
<if test="code != null and code != ''">
and code = #{code}
</if>
<if test="name != null and name != ''">
and name like concat('%', #{name}, '%')
</if>
<if test="industryId != null">
and industry_id = #{industryId}
</if>
<if test="industryName != null and industryName != ''">
and industry_name like concat('%', #{industryName}, '%')
</if>
<if test="market != null and market != ''">
and market = #{market}
</if>
<if test="listDate != null and listDate != ''">
and list_date = #{listDate}
</if>
<if test="status != null">
and status = #{status}
</if>
</where>
</select>
<insert id="insertNewStockBasic" parameterType="com.ruoyi.newstocksystem.domain.NewStockBasic" useGeneratedKeys="true" keyProperty="id">
insert into new_stock_basic
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="code != null and code != ''">code,</if>
<if test="name != null and name != ''">name,</if>
<if test="industryId != null">industry_id,</if>
<if test="industryName != null and industryName != ''">industry_name,</if>
<if test="market != null and market != ''">market,</if>
<if test="listDate != null and listDate != ''">list_date,</if>
<if test="status != null">status,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null and updateBy != ''">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null and remark != ''">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="code != null and code != ''">#{code},</if>
<if test="name != null and name != ''">#{name},</if>
<if test="industryId != null">#{industryId},</if>
<if test="industryName != null and industryName != ''">#{industryName},</if>
<if test="market != null and market != ''">#{market},</if>
<if test="listDate != null and listDate != ''">#{listDate},</if>
<if test="status != null">#{status},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null and updateBy != ''">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null and remark != ''">#{remark},</if>
</trim>
</insert>
<update id="updateNewStockBasic" parameterType="com.ruoyi.newstocksystem.domain.NewStockBasic">
update new_stock_basic
<trim prefix="set" suffixOverrides=",">
<if test="code != null and code != ''">code = #{code},</if>
<if test="name != null and name != ''">name = #{name},</if>
<if test="industryId != null">industry_id = #{industryId},</if>
<if test="industryName != null and industryName != ''">industry_name = #{industryName},</if>
<if test="market != null and market != ''">market = #{market},</if>
<if test="listDate != null and listDate != ''">list_date = #{listDate},</if>
<if test="status != null">status = #{status},</if>
<if test="createBy != null and createBy != ''">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null and remark != ''">remark = #{remark},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteNewStockBasicById" parameterType="Integer">
delete from new_stock_basic where id = #{id}
</delete>
<delete id="deleteNewStockBasicByIds" parameterType="String">
delete from new_stock_basic where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<insert id="batchInsertNewStockBasic" parameterType="java.util.List">
insert into new_stock_basic(code, name, industry_id, industry_name, market, list_date, status, create_by, create_time, update_by, update_time, remark)
values
<foreach collection="list" item="item" separator=",">
(#{item.code}, #{item.name}, #{item.industryId}, #{item.industryName}, #{item.market}, #{item.listDate}, #{item.status}, #{item.createBy}, #{item.createTime}, #{item.updateBy}, #{item.updateTime}, #{item.remark})
</foreach>
</insert>
</mapper>

@ -0,0 +1,111 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.newstocksystem.mapper.NewStockIndustryMapper">
<resultMap type="com.ruoyi.newstocksystem.domain.NewStockIndustry" id="NewStockIndustryResult">
<id property="industryId" column="industry_id" />
<result property="industryCode" column="industry_code" />
<result property="industryName" column="industry_name" />
<result property="level" column="level" />
<result property="parentId" column="parent_id" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectNewStockIndustryVo">
select industry_id, industry_code, industry_name, level, parent_id, create_by, create_time, update_by, update_time, remark from new_stock_industry
</sql>
<select id="selectNewStockIndustryById" parameterType="Integer" resultMap="NewStockIndustryResult">
<include refid="selectNewStockIndustryVo" />
where industry_id = #{industryId}
</select>
<select id="selectNewStockIndustryByCode" parameterType="String" resultMap="NewStockIndustryResult">
<include refid="selectNewStockIndustryVo" />
where industry_code = #{industryCode}
</select>
<select id="selectNewStockIndustryList" parameterType="com.ruoyi.newstocksystem.domain.NewStockIndustry" resultMap="NewStockIndustryResult">
<include refid="selectNewStockIndustryVo" />
<where>
<if test="industryCode != null and industryCode != ''">
and industry_code = #{industryCode}
</if>
<if test="industryName != null and industryName != ''">
and industry_name like concat('%', #{industryName}, '%')
</if>
<if test="level != null">
and level = #{level}
</if>
<if test="parentId != null">
and parent_id = #{parentId}
</if>
</where>
</select>
<insert id="insertNewStockIndustry" parameterType="com.ruoyi.newstocksystem.domain.NewStockIndustry" useGeneratedKeys="true" keyProperty="industryId">
insert into new_stock_industry
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="industryCode != null and industryCode != ''">industry_code,</if>
<if test="industryName != null and industryName != ''">industry_name,</if>
<if test="level != null">level,</if>
<if test="parentId != null">parent_id,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null and updateBy != ''">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null and remark != ''">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="industryCode != null and industryCode != ''">#{industryCode},</if>
<if test="industryName != null and industryName != ''">#{industryName},</if>
<if test="level != null">#{level},</if>
<if test="parentId != null">#{parentId},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null and updateBy != ''">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null and remark != ''">#{remark},</if>
</trim>
</insert>
<update id="updateNewStockIndustry" parameterType="com.ruoyi.newstocksystem.domain.NewStockIndustry">
update new_stock_industry
<trim prefix="set" suffixOverrides=",">
<if test="industryCode != null and industryCode != ''">industry_code = #{industryCode},</if>
<if test="industryName != null and industryName != ''">industry_name = #{industryName},</if>
<if test="level != null">level = #{level},</if>
<if test="parentId != null">parent_id = #{parentId},</if>
<if test="createBy != null and createBy != ''">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null and remark != ''">remark = #{remark},</if>
</trim>
where industry_id = #{industryId}
</update>
<delete id="deleteNewStockIndustryById" parameterType="Integer">
delete from new_stock_industry where industry_id = #{industryId}
</delete>
<delete id="deleteNewStockIndustryByIds" parameterType="String">
delete from new_stock_industry where industry_id in
<foreach item="industryId" collection="array" open="(" separator="," close=")">
#{industryId}
</foreach>
</delete>
<insert id="batchInsertNewStockIndustry" parameterType="java.util.List">
insert into new_stock_industry(industry_code, industry_name, level, parent_id, create_by, create_time, update_by, update_time, remark)
values
<foreach collection="list" item="item" separator=",">
(#{item.industryCode}, #{item.industryName}, #{item.level}, #{item.parentId}, #{item.createBy}, #{item.createTime}, #{item.updateBy}, #{item.updateTime}, #{item.remark})
</foreach>
</insert>
</mapper>

@ -0,0 +1,202 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.newstocksystem.mapper.NewStocksMapper">
<resultMap type="com.ruoyi.newstocksystem.domain.NewStocks" id="NewStocksResult">
<id property="id" column="id" />
<result property="code" column="code" />
<result property="tradeDate" column="trade_date" />
<result property="open" column="open" />
<result property="close" column="close" />
<result property="changeRate" column="change_rate" />
<result property="tradeDays" column="trade_days" />
<result property="volume" column="volume" />
<result property="amount" column="amount" />
<result property="changeRate10" column="change_rate_10" />
<result property="changeRate20" column="change_rate_20" />
<result property="changeRate60" column="change_rate_60" />
<result property="avgVolume20" column="avg_volume_20" />
<result property="freeFloatMarketValue" column="free_float_market_value" />
<result property="totalMarketValue" column="total_market_value" />
<result property="agenciesHold" column="agencies_hold" />
<result property="name" column="name" />
<result property="industryId" column="industry_id" />
<result property="industryName" column="industry_name" />
</resultMap>
<sql id="selectNewStocksVo">
select id, code, trade_date, open, close, change_rate, trade_days, volume, amount, change_rate_10, change_rate_20, change_rate_60, avg_volume_20, free_float_market_value, total_market_value, agencies_hold from new_stocks
</sql>
<select id="selectNewStocksById" parameterType="Integer" resultMap="NewStocksResult">
<include refid="selectNewStocksVo" />
where id = #{id}
</select>
<select id="selectNewStocksList" parameterType="com.ruoyi.newstocksystem.domain.NewStocks" resultMap="NewStocksResult">
<include refid="selectNewStocksVo" />
<where>
<if test="code != null and code != ''">
and code = #{code}
</if>
<if test="tradeDate != null">
and trade_date = #{tradeDate}
</if>
<if test="changeRate != null">
and change_rate = #{changeRate}
</if>
</where>
order by trade_date desc, code
</select>
<select id="selectNewStocksListB" parameterType="com.ruoyi.newstocksystem.domain.NewStocks" resultMap="NewStocksResult">
select s.id, s.code, s.trade_date, s.open, s.close, s.change_rate, s.trade_days, s.volume, s.amount, s.change_rate_10, s.change_rate_20, s.change_rate_60, s.avg_volume_20, s.free_float_market_value, s.total_market_value, s.agencies_hold, b.name, b.industry_id, i.industry_name
from new_stocks s
left join new_stock_basic b on s.code = b.code
left join new_stock_industry i on b.industry_id = i.industry_id
<where>
<if test="code != null and code != ''">
and s.code = #{code}
</if>
<if test="tradeDate != null and tradeDate != ''">
and s.trade_date = #{tradeDate}
</if>
<if test="changeRate != null">
and s.change_rate = #{changeRate}
</if>
<if test="name != null and name != ''">
and b.name like concat('%', #{name}, '%')
</if>
<if test="industryName != null and industryName != ''">
and i.industry_name like concat('%', #{industryName}, '%')
</if>
</where>
order by s.trade_date desc, s.code
</select>
<select id="selectNewStrongStocksList" parameterType="com.ruoyi.newstocksystem.domain.NewStocks" resultMap="NewStocksResult">
select s.id, s.code, s.trade_date, s.open, s.close, s.change_rate, s.trade_days, s.volume, s.amount, s.change_rate_10, s.change_rate_20, s.change_rate_60, s.avg_volume_20, s.free_float_market_value, s.total_market_value, s.agencies_hold, b.name, b.industry_id, i.industry_name
from new_stocks s
left join new_stock_basic b on s.code = b.code
left join new_stock_industry i on b.industry_id = i.industry_id
<where>
<if test="tradeDate != null and tradeDate != ''">
and s.trade_date = #{tradeDate}
</if>
<if test="industryName != null and industryName != ''">
and i.industry_name like concat('%', #{industryName}, '%')
</if>
</where>
order by s.change_rate_20 desc, s.change_rate_10 desc
limit 100
</select>
<select id="selectNewLimitStocksList" parameterType="com.ruoyi.newstocksystem.domain.NewStocks" resultMap="NewStocksResult">
select s.id, s.code, s.trade_date, s.open, s.close, s.change_rate, s.trade_days, s.volume, s.amount, s.change_rate_10, s.change_rate_20, s.change_rate_60, s.avg_volume_20, s.free_float_market_value, s.total_market_value, s.agencies_hold, b.name, b.industry_id, i.industry_name
from new_stocks s
left join new_stock_basic b on s.code = b.code
left join new_stock_industry i on b.industry_id = i.industry_id
<where>
<if test="tradeDate != null and tradeDate != ''">
and s.trade_date = #{tradeDate}
</if>
<if test="industryName != null and industryName != ''">
and i.industry_name like concat('%', #{industryName}, '%')
</if>
and s.change_rate &gt;= 9.8
</where>
order by s.change_rate desc
</select>
<insert id="insertNewStocks" parameterType="com.ruoyi.newstocksystem.domain.NewStocks" useGeneratedKeys="true" keyProperty="id">
insert into new_stocks
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="code != null and code != ''">code,</if>
<if test="tradeDate != null and tradeDate != ''">trade_date,</if>
<if test="open != null">open,</if>
<if test="close != null">close,</if>
<if test="changeRate != null">change_rate,</if>
<if test="tradeDays != null">trade_days,</if>
<if test="volume != null">volume,</if>
<if test="amount != null">amount,</if>
<if test="changeRate10 != null">change_rate_10,</if>
<if test="changeRate20 != null">change_rate_20,</if>
<if test="changeRate60 != null">change_rate_60,</if>
<if test="avgVolume20 != null">avg_volume_20,</if>
<if test="freeFloatMarketValue != null">free_float_market_value,</if>
<if test="totalMarketValue != null">total_market_value,</if>
<if test="agenciesHold != null">agencies_hold,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="code != null and code != ''">#{code},</if>
<if test="tradeDate != null and tradeDate != ''">#{tradeDate},</if>
<if test="open != null">#{open},</if>
<if test="close != null">#{close},</if>
<if test="changeRate != null">#{changeRate},</if>
<if test="tradeDays != null">#{tradeDays},</if>
<if test="volume != null">#{volume},</if>
<if test="amount != null">#{amount},</if>
<if test="changeRate10 != null">#{changeRate10},</if>
<if test="changeRate20 != null">#{changeRate20},</if>
<if test="changeRate60 != null">#{changeRate60},</if>
<if test="avgVolume20 != null">#{avgVolume20},</if>
<if test="freeFloatMarketValue != null">#{freeFloatMarketValue},</if>
<if test="totalMarketValue != null">#{totalMarketValue},</if>
<if test="agenciesHold != null">#{agenciesHold},</if>
</trim>
</insert>
<insert id="batchInsertNewStocks" parameterType="java.util.List">
insert into new_stocks(
code, trade_date, open, close, change_rate, trade_days, volume, amount, change_rate_10, change_rate_20, change_rate_60, avg_volume_20, free_float_market_value, total_market_value, agencies_hold
) values
<foreach collection="list" item="item" separator=",">
(
#{item.code}, #{item.tradeDate}, #{item.open}, #{item.close}, #{item.changeRate}, #{item.tradeDays}, #{item.volume}, #{item.amount}, #{item.changeRate10}, #{item.changeRate20}, #{item.changeRate60}, #{item.avgVolume20}, #{item.freeFloatMarketValue}, #{item.totalMarketValue}, #{item.agenciesHold}
)
</foreach>
</insert>
<update id="updateNewStocks" parameterType="com.ruoyi.newstocksystem.domain.NewStocks">
update new_stocks
<trim prefix="set" suffixOverrides=",">
<if test="code != null and code != ''">code = #{code},</if>
<if test="tradeDate != null and tradeDate != ''">trade_date = #{tradeDate},</if>
<if test="open != null">open = #{open},</if>
<if test="close != null">close = #{close},</if>
<if test="changeRate != null">change_rate = #{changeRate},</if>
<if test="tradeDays != null">trade_days = #{tradeDays},</if>
<if test="volume != null">volume = #{volume},</if>
<if test="amount != null">amount = #{amount},</if>
<if test="changeRate10 != null">change_rate_10 = #{changeRate10},</if>
<if test="changeRate20 != null">change_rate_20 = #{changeRate20},</if>
<if test="changeRate60 != null">change_rate_60 = #{changeRate60},</if>
<if test="avgVolume20 != null">avg_volume_20 = #{avgVolume20},</if>
<if test="freeFloatMarketValue != null">free_float_market_value = #{freeFloatMarketValue},</if>
<if test="totalMarketValue != null">total_market_value = #{totalMarketValue},</if>
<if test="agenciesHold != null">agencies_hold = #{agenciesHold},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteNewStocksById" parameterType="Integer">
delete from new_stocks where id = #{id}
</delete>
<delete id="deleteNewStocksByIds" parameterType="String">
delete from new_stocks where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="selectNewStocksByCodeAndDate" resultMap="NewStocksResult">
<include refid="selectNewStocksVo" />
where code = #{code} and trade_date = #{tradeDate}
</select>
<select id="selectTradeDates" resultType="String">
select distinct trade_date from new_stocks order by trade_date desc
</select>
</mapper>

@ -0,0 +1,141 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.newstocksystem.mapper.TStockBasicMapper">
<resultMap type="com.ruoyi.newstocksystem.domain.TStockBasic" id="StockBasicResult">
<id property="stockCode" column="stock_code" />
<result property="stockName" column="stock_name" />
<result property="listingDate" column="listing_date" />
<result property="listingDays" column="listing_days" />
<result property="isSt" column="is_st" />
<result property="isStarSt" column="is_star_st" />
<result property="industryIndexCode" column="industry_index_code" />
<result property="industryIndexName" column="industry_index_name" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectStockBasicVo">
select stock_code, stock_name, listing_date, listing_days, is_st, is_star_st,
industry_index_code, industry_index_name, create_time, update_time
from t_stock_basic
</sql>
<select id="selectStockBasicByCode" parameterType="String" resultMap="StockBasicResult">
<include refid="selectStockBasicVo" />
where stock_code = #{stockCode}
</select>
<select id="selectStockBasicList" parameterType="com.ruoyi.newstocksystem.domain.TStockBasic" resultMap="StockBasicResult">
<include refid="selectStockBasicVo" />
<where>
<if test="stockCode != null and stockCode != ''">
and stock_code like concat('%', #{stockCode}, '%')
</if>
<if test="stockName != null and stockName != ''">
and stock_name like concat('%', #{stockName}, '%')
</if>
<if test="isSt != null">
and is_st = #{isSt}
</if>
<if test="isStarSt != null">
and is_star_st = #{isStarSt}
</if>
<if test="industryIndexCode != null and industryIndexCode != ''">
and industry_index_code = #{industryIndexCode}
</if>
<if test="industryIndexName != null and industryIndexName != ''">
and industry_index_name like concat('%', #{industryIndexName}, '%')
</if>
</where>
order by stock_code asc
</select>
<select id="selectStockBasicByIndustryCode" parameterType="String" resultMap="StockBasicResult">
<include refid="selectStockBasicVo" />
where industry_index_code = #{industryIndexCode}
order by stock_code asc
</select>
<insert id="insertStockBasic" parameterType="com.ruoyi.newstocksystem.domain.TStockBasic">
insert into t_stock_basic
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="stockCode != null and stockCode != ''">stock_code,</if>
<if test="stockName != null and stockName != ''">stock_name,</if>
<if test="listingDate != null">listing_date,</if>
<if test="listingDays != null">listing_days,</if>
<if test="isSt != null">is_st,</if>
<if test="isStarSt != null">is_star_st,</if>
<if test="industryIndexCode != null and industryIndexCode != ''">industry_index_code,</if>
<if test="industryIndexName != null and industryIndexName != ''">industry_index_name,</if>
create_time,
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="stockCode != null and stockCode != ''">#{stockCode},</if>
<if test="stockName != null and stockName != ''">#{stockName},</if>
<if test="listingDate != null">#{listingDate},</if>
<if test="listingDays != null">#{listingDays},</if>
<if test="isSt != null">#{isSt},</if>
<if test="isStarSt != null">#{isStarSt},</if>
<if test="industryIndexCode != null and industryIndexCode != ''">#{industryIndexCode},</if>
<if test="industryIndexName != null and industryIndexName != ''">#{industryIndexName},</if>
NOW(),
</trim>
</insert>
<update id="updateStockBasic" parameterType="com.ruoyi.newstocksystem.domain.TStockBasic">
update t_stock_basic
<trim prefix="set" suffixOverrides=",">
<if test="stockName != null and stockName != ''">stock_name = #{stockName},</if>
<if test="listingDate != null">listing_date = #{listingDate},</if>
<if test="listingDays != null">listing_days = #{listingDays},</if>
<if test="isSt != null">is_st = #{isSt},</if>
<if test="isStarSt != null">is_star_st = #{isStarSt},</if>
<if test="industryIndexCode != null and industryIndexCode != ''">industry_index_code = #{industryIndexCode},</if>
<if test="industryIndexName != null and industryIndexName != ''">industry_index_name = #{industryIndexName},</if>
update_time = NOW(),
</trim>
where stock_code = #{stockCode}
</update>
<delete id="deleteStockBasicByCode" parameterType="String">
delete from t_stock_basic where stock_code = #{stockCode}
</delete>
<delete id="deleteStockBasicByCodes" parameterType="String">
delete from t_stock_basic where stock_code in
<foreach item="stockCode" collection="array" open="(" separator="," close=")">
#{stockCode}
</foreach>
</delete>
<insert id="batchInsertStockBasic" parameterType="java.util.List">
insert into t_stock_basic(stock_code, stock_name, listing_date, listing_days,
is_st, is_star_st, industry_index_code, industry_index_name, create_time)
values
<foreach collection="list" item="item" separator=",">
(#{item.stockCode}, #{item.stockName}, #{item.listingDate}, #{item.listingDays},
#{item.isSt}, #{item.isStarSt}, #{item.industryIndexCode}, #{item.industryIndexName}, NOW())
</foreach>
</insert>
<insert id="batchUpsertStockBasic" parameterType="java.util.List">
insert into t_stock_basic(stock_code, stock_name, listing_date, listing_days,
is_st, is_star_st, industry_index_code, industry_index_name, create_time)
values
<foreach collection="list" item="item" separator=",">
(#{item.stockCode}, #{item.stockName}, #{item.listingDate}, #{item.listingDays},
#{item.isSt}, #{item.isStarSt}, #{item.industryIndexCode}, #{item.industryIndexName}, NOW())
</foreach>
ON DUPLICATE KEY UPDATE
stock_name = VALUES(stock_name),
listing_date = VALUES(listing_date),
listing_days = VALUES(listing_days),
is_st = VALUES(is_st),
is_star_st = VALUES(is_star_st),
industry_index_code = VALUES(industry_index_code),
industry_index_name = VALUES(industry_index_name),
update_time = NOW()
</insert>
</mapper>

@ -0,0 +1,269 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.newstocksystem.mapper.TStockDailyTradeMapper">
<resultMap type="com.ruoyi.newstocksystem.domain.TStockDailyTrade" id="StockDailyTradeResult">
<result property="stockCode" column="stock_code" />
<result property="tradeDate" column="trade_date" />
<result property="openPrice" column="open_price" />
<result property="closePrice" column="close_price" />
<result property="highPrice" column="high_price" />
<result property="lowPrice" column="low_price" />
<result property="priceChangeRate" column="price_change_rate" />
<result property="volume" column="volume" />
<result property="turnover" column="turnover" />
<result property="freeCirculationCap" column="free_circulation_cap" />
<result property="agenciesHold" column="agencies_hold" />
<result property="avgVolume20" column="avg_volume20" />
<result property="isLimitUp" column="is_limit_up" />
<result property="isLimitDown" column="is_limit_down" />
<result property="momentum10d" column="momentum_10d" />
<result property="momentum20d" column="momentum_20d" />
<result property="momentum60d" column="momentum_60d" />
<result property="createTime" column="create_time" />
</resultMap>
<resultMap type="com.ruoyi.newstocksystem.domain.TStockDailyTrade" id="StockDailyTradeWithBasicResult" extends="StockDailyTradeResult">
<result property="stockName" column="stock_name" />
<result property="industryIndexCode" column="industry_index_code" />
<result property="industryIndexName" column="industry_index_name" />
</resultMap>
<sql id="selectStockDailyTradeVo">
select stock_code, trade_date, open_price, close_price, high_price, low_price,
price_change_rate, volume, turnover, free_circulation_cap,
agencies_hold, avg_volume20,
is_limit_up, is_limit_down, momentum_10d, momentum_20d, momentum_60d, create_time
from t_stock_daily_trade
</sql>
<sql id="selectStockDailyTradeWithBasicVo">
select t.stock_code, t.trade_date, t.open_price, t.close_price, t.high_price, t.low_price,
t.price_change_rate, t.volume, t.turnover, t.free_circulation_cap,
t.agencies_hold, t.avg_volume20,
t.is_limit_up, t.is_limit_down, t.momentum_10d, t.momentum_20d, t.momentum_60d, t.create_time,
b.stock_name, b.industry_index_code, b.industry_index_name
from t_stock_daily_trade t
left join t_stock_basic b on t.stock_code = b.stock_code
</sql>
<select id="selectStockDailyTradeByCodeAndDate" resultMap="StockDailyTradeResult">
<include refid="selectStockDailyTradeVo" />
where stock_code = #{stockCode} and trade_date = #{tradeDate}
</select>
<select id="selectStockDailyTradeList" parameterType="com.ruoyi.newstocksystem.domain.TStockDailyTrade" resultMap="StockDailyTradeResult">
<include refid="selectStockDailyTradeVo" />
<where>
<if test="stockCode != null and stockCode != ''">
and stock_code = #{stockCode}
</if>
<if test="tradeDate != null">
and trade_date = #{tradeDate}
</if>
<if test="isLimitUp != null">
and is_limit_up = #{isLimitUp}
</if>
<if test="isLimitDown != null">
and is_limit_down = #{isLimitDown}
</if>
<if test="params.beginTradeDate != null and params.beginTradeDate != ''">
and trade_date &gt;= #{params.beginTradeDate}
</if>
<if test="params.endTradeDate != null and params.endTradeDate != ''">
and trade_date &lt;= #{params.endTradeDate}
</if>
</where>
order by trade_date desc, stock_code asc
</select>
<select id="selectStockDailyTradeListWithBasic" parameterType="com.ruoyi.newstocksystem.domain.TStockDailyTrade" resultMap="StockDailyTradeWithBasicResult">
<include refid="selectStockDailyTradeWithBasicVo" />
<where>
<if test="stockCode != null and stockCode != ''">
and t.stock_code like concat('%', #{stockCode}, '%')
</if>
<if test="stockName != null and stockName != ''">
and b.stock_name like concat('%', #{stockName}, '%')
</if>
<if test="tradeDate != null">
and t.trade_date = #{tradeDate}
</if>
<if test="industryIndexCode != null and industryIndexCode != ''">
and b.industry_index_code = #{industryIndexCode}
</if>
<if test="isLimitUp != null">
and t.is_limit_up = #{isLimitUp}
</if>
<if test="isLimitDown != null">
and t.is_limit_down = #{isLimitDown}
</if>
<if test="params.beginTradeDate != null and params.beginTradeDate != ''">
and t.trade_date &gt;= #{params.beginTradeDate}
</if>
<if test="params.endTradeDate != null and params.endTradeDate != ''">
and t.trade_date &lt;= #{params.endTradeDate}
</if>
</where>
order by t.trade_date desc, t.stock_code asc
</select>
<select id="selectTradeDates" resultType="String">
select distinct DATE_FORMAT(trade_date, '%Y-%m-%d') as trade_date
from t_stock_daily_trade
order by trade_date desc
</select>
<select id="selectLastTradeDate" resultType="String">
select DATE_FORMAT(max(trade_date), '%Y-%m-%d') as trade_date
from t_stock_daily_trade
</select>
<select id="selectLimitUpStockList" parameterType="com.ruoyi.newstocksystem.domain.TStockDailyTrade" resultMap="StockDailyTradeWithBasicResult">
<include refid="selectStockDailyTradeWithBasicVo" />
<where>
t.is_limit_up = 1
<if test="tradeDate != null">
and t.trade_date = #{tradeDate}
</if>
<if test="industryIndexCode != null and industryIndexCode != ''">
and b.industry_index_code = #{industryIndexCode}
</if>
</where>
order by t.price_change_rate desc
</select>
<select id="selectStrongStockList" parameterType="com.ruoyi.newstocksystem.domain.TStockDailyTrade" resultMap="StockDailyTradeWithBasicResult">
<include refid="selectStockDailyTradeWithBasicVo" />
<where>
<if test="tradeDate != null">
and t.trade_date = #{tradeDate}
</if>
<if test="industryIndexCode != null and industryIndexCode != ''">
and b.industry_index_code = #{industryIndexCode}
</if>
</where>
order by t.momentum_20d desc, t.momentum_10d desc
</select>
<insert id="insertStockDailyTrade" parameterType="com.ruoyi.newstocksystem.domain.TStockDailyTrade">
insert into t_stock_daily_trade
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="stockCode != null and stockCode != ''">stock_code,</if>
<if test="tradeDate != null">trade_date,</if>
<if test="openPrice != null">open_price,</if>
<if test="closePrice != null">close_price,</if>
<if test="highPrice != null">high_price,</if>
<if test="lowPrice != null">low_price,</if>
<if test="priceChangeRate != null">price_change_rate,</if>
<if test="volume != null">volume,</if>
<if test="turnover != null">turnover,</if>
<if test="freeCirculationCap != null">free_circulation_cap,</if>
<if test="agenciesHold != null">agencies_hold,</if>
<if test="avgVolume20 != null">avg_volume20,</if>
<if test="isLimitUp != null">is_limit_up,</if>
<if test="isLimitDown != null">is_limit_down,</if>
<if test="momentum10d != null">momentum_10d,</if>
<if test="momentum20d != null">momentum_20d,</if>
<if test="momentum60d != null">momentum_60d,</if>
create_time,
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="stockCode != null and stockCode != ''">#{stockCode},</if>
<if test="tradeDate != null">#{tradeDate},</if>
<if test="openPrice != null">#{openPrice},</if>
<if test="closePrice != null">#{closePrice},</if>
<if test="highPrice != null">#{highPrice},</if>
<if test="lowPrice != null">#{lowPrice},</if>
<if test="priceChangeRate != null">#{priceChangeRate},</if>
<if test="volume != null">#{volume},</if>
<if test="turnover != null">#{turnover},</if>
<if test="freeCirculationCap != null">#{freeCirculationCap},</if>
<if test="agenciesHold != null">#{agenciesHold},</if>
<if test="avgVolume20 != null">#{avgVolume20},</if>
<if test="isLimitUp != null">#{isLimitUp},</if>
<if test="isLimitDown != null">#{isLimitDown},</if>
<if test="momentum10d != null">#{momentum10d},</if>
<if test="momentum20d != null">#{momentum20d},</if>
<if test="momentum60d != null">#{momentum60d},</if>
NOW(),
</trim>
</insert>
<update id="updateStockDailyTrade" parameterType="com.ruoyi.newstocksystem.domain.TStockDailyTrade">
update t_stock_daily_trade
<trim prefix="set" suffixOverrides=",">
<if test="openPrice != null">open_price = #{openPrice},</if>
<if test="closePrice != null">close_price = #{closePrice},</if>
<if test="highPrice != null">high_price = #{highPrice},</if>
<if test="lowPrice != null">low_price = #{lowPrice},</if>
<if test="priceChangeRate != null">price_change_rate = #{priceChangeRate},</if>
<if test="volume != null">volume = #{volume},</if>
<if test="turnover != null">turnover = #{turnover},</if>
<if test="freeCirculationCap != null">free_circulation_cap = #{freeCirculationCap},</if>
<if test="agenciesHold != null">agencies_hold = #{agenciesHold},</if>
<if test="avgVolume20 != null">avg_volume20 = #{avgVolume20},</if>
<if test="isLimitUp != null">is_limit_up = #{isLimitUp},</if>
<if test="isLimitDown != null">is_limit_down = #{isLimitDown},</if>
<if test="momentum10d != null">momentum_10d = #{momentum10d},</if>
<if test="momentum20d != null">momentum_20d = #{momentum20d},</if>
<if test="momentum60d != null">momentum_60d = #{momentum60d},</if>
</trim>
where stock_code = #{stockCode} and trade_date = #{tradeDate}
</update>
<delete id="deleteStockDailyTradeByCodeAndDate">
delete from t_stock_daily_trade where stock_code = #{stockCode} and trade_date = #{tradeDate}
</delete>
<insert id="batchInsertStockDailyTrade" parameterType="java.util.List">
insert into t_stock_daily_trade(stock_code, trade_date, open_price, close_price, high_price, low_price,
price_change_rate, volume, turnover, free_circulation_cap, agencies_hold, avg_volume20,
is_limit_up, is_limit_down, momentum_10d, momentum_20d, momentum_60d, create_time)
values
<foreach collection="list" item="item" separator=",">
(#{item.stockCode}, #{item.tradeDate}, #{item.openPrice}, #{item.closePrice}, #{item.highPrice}, #{item.lowPrice},
#{item.priceChangeRate}, #{item.volume}, #{item.turnover}, #{item.freeCirculationCap}, #{item.agenciesHold}, #{item.avgVolume20},
#{item.isLimitUp}, #{item.isLimitDown}, #{item.momentum10d}, #{item.momentum20d}, #{item.momentum60d}, NOW())
</foreach>
</insert>
<insert id="batchUpsertStockDailyTrade" parameterType="java.util.List">
insert into t_stock_daily_trade(stock_code, trade_date, open_price, close_price, high_price, low_price,
price_change_rate, volume, turnover, free_circulation_cap, agencies_hold, avg_volume20,
is_limit_up, is_limit_down, momentum_10d, momentum_20d, momentum_60d, create_time)
values
<foreach collection="list" item="item" separator=",">
(#{item.stockCode}, #{item.tradeDate}, #{item.openPrice}, #{item.closePrice}, #{item.highPrice}, #{item.lowPrice},
#{item.priceChangeRate}, #{item.volume}, #{item.turnover}, #{item.freeCirculationCap}, #{item.agenciesHold}, #{item.avgVolume20},
#{item.isLimitUp}, #{item.isLimitDown}, #{item.momentum10d}, #{item.momentum20d}, #{item.momentum60d}, NOW())
</foreach>
ON DUPLICATE KEY UPDATE
open_price = VALUES(open_price),
close_price = VALUES(close_price),
high_price = VALUES(high_price),
low_price = VALUES(low_price),
price_change_rate = VALUES(price_change_rate),
volume = VALUES(volume),
turnover = VALUES(turnover),
free_circulation_cap = VALUES(free_circulation_cap),
agencies_hold = VALUES(agencies_hold),
avg_volume20 = VALUES(avg_volume20),
is_limit_up = VALUES(is_limit_up),
is_limit_down = VALUES(is_limit_down),
momentum_10d = VALUES(momentum_10d),
momentum_20d = VALUES(momentum_20d),
momentum_60d = VALUES(momentum_60d)
</insert>
<select id="checkTradeDataExistsByDate" parameterType="Date" resultType="int">
select count(1) from t_stock_daily_trade where trade_date = #{tradeDate}
</select>
<select id="selectPreviousTradeDate" parameterType="Date" resultType="Date">
select max(trade_date) as trade_date
from t_stock_daily_trade
where trade_date &lt; #{currentDate}
</select>
</mapper>

@ -0,0 +1,177 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.newstocksystem.mapper.TStockHighLowStatusMapper">
<resultMap type="com.ruoyi.newstocksystem.domain.TStockHighLowStatus" id="StockHighLowStatusResult">
<result property="stockCode" column="stock_code" />
<result property="tradeDate" column="trade_date" />
<result property="isNewHigh" column="is_new_high" />
<result property="isNewLow" column="is_new_low" />
<result property="createTime" column="create_time" />
</resultMap>
<resultMap type="com.ruoyi.newstocksystem.domain.TStockHighLowStatus" id="StockHighLowStatusWithBasicResult" extends="StockHighLowStatusResult">
<result property="stockName" column="stock_name" />
<result property="industryIndexCode" column="industry_index_code" />
<result property="industryIndexName" column="industry_index_name" />
</resultMap>
<sql id="selectStockHighLowStatusVo">
select stock_code, trade_date, is_new_high, is_new_low, create_time
from t_stock_high_low_status
</sql>
<sql id="selectStockHighLowStatusWithBasicVo">
select
h.stock_code,
h.trade_date,
h.is_new_high,
h.is_new_low,
h.create_time,
b.stock_name,
b.industry_index_code,
b.industry_index_name
from t_stock_high_low_status h
left join t_stock_basic b on h.stock_code = b.stock_code
</sql>
<select id="selectStockHighLowStatusByCodeAndDate" resultMap="StockHighLowStatusResult">
<include refid="selectStockHighLowStatusVo" />
where stock_code = #{stockCode} and trade_date = #{tradeDate}
</select>
<select id="selectStockHighLowStatusList" parameterType="com.ruoyi.newstocksystem.domain.TStockHighLowStatus" resultMap="StockHighLowStatusResult">
<include refid="selectStockHighLowStatusVo" />
<where>
<if test="stockCode != null and stockCode != ''">
and stock_code = #{stockCode}
</if>
<if test="tradeDate != null">
and trade_date = #{tradeDate}
</if>
<if test="isNewHigh != null">
and is_new_high = #{isNewHigh}
</if>
<if test="isNewLow != null">
and is_new_low = #{isNewLow}
</if>
<if test="params.beginTradeDate != null and params.beginTradeDate != ''">
and trade_date &gt;= #{params.beginTradeDate}
</if>
<if test="params.endTradeDate != null and params.endTradeDate != ''">
and trade_date &lt;= #{params.endTradeDate}
</if>
</where>
order by trade_date desc, stock_code asc
</select>
<select id="selectStockHighLowStatusListWithBasic" parameterType="com.ruoyi.newstocksystem.domain.TStockHighLowStatus" resultMap="StockHighLowStatusWithBasicResult">
<include refid="selectStockHighLowStatusWithBasicVo" />
<where>
<if test="stockCode != null and stockCode != ''">
and h.stock_code like concat('%', #{stockCode}, '%')
</if>
<if test="stockName != null and stockName != ''">
and b.stock_name like concat('%', #{stockName}, '%')
</if>
<if test="tradeDate != null">
and h.trade_date = #{tradeDate}
</if>
<if test="industryIndexCode != null and industryIndexCode != ''">
and b.industry_index_code = #{industryIndexCode}
</if>
<if test="isNewHigh != null">
and h.is_new_high = #{isNewHigh}
</if>
<if test="isNewLow != null">
and h.is_new_low = #{isNewLow}
</if>
<if test="params.beginTradeDate != null and params.beginTradeDate != ''">
and h.trade_date &gt;= #{params.beginTradeDate}
</if>
<if test="params.endTradeDate != null and params.endTradeDate != ''">
and h.trade_date &lt;= #{params.endTradeDate}
</if>
</where>
order by h.trade_date desc, h.stock_code asc
</select>
<select id="selectNewHighStockList" parameterType="com.ruoyi.newstocksystem.domain.TStockHighLowStatus" resultMap="StockHighLowStatusWithBasicResult">
<include refid="selectStockHighLowStatusWithBasicVo" />
<where>
h.is_new_high = 1
<if test="tradeDate != null">
and h.trade_date = #{tradeDate}
</if>
<if test="industryIndexCode != null and industryIndexCode != ''">
and b.industry_index_code = #{industryIndexCode}
</if>
</where>
order by h.trade_date desc, h.stock_code asc
</select>
<select id="selectNewLowStockList" parameterType="com.ruoyi.newstocksystem.domain.TStockHighLowStatus" resultMap="StockHighLowStatusWithBasicResult">
<include refid="selectStockHighLowStatusWithBasicVo" />
<where>
h.is_new_low = 1
<if test="tradeDate != null">
and h.trade_date = #{tradeDate}
</if>
<if test="industryIndexCode != null and industryIndexCode != ''">
and b.industry_index_code = #{industryIndexCode}
</if>
</where>
order by h.trade_date desc, h.stock_code asc
</select>
<insert id="insertStockHighLowStatus" parameterType="com.ruoyi.newstocksystem.domain.TStockHighLowStatus">
insert into t_stock_high_low_status
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="stockCode != null and stockCode != ''">stock_code,</if>
<if test="tradeDate != null">trade_date,</if>
<if test="isNewHigh != null">is_new_high,</if>
<if test="isNewLow != null">is_new_low,</if>
create_time,
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="stockCode != null and stockCode != ''">#{stockCode},</if>
<if test="tradeDate != null">#{tradeDate},</if>
<if test="isNewHigh != null">#{isNewHigh},</if>
<if test="isNewLow != null">#{isNewLow},</if>
NOW(),
</trim>
</insert>
<update id="updateStockHighLowStatus" parameterType="com.ruoyi.newstocksystem.domain.TStockHighLowStatus">
update t_stock_high_low_status
<trim prefix="set" suffixOverrides=",">
<if test="isNewHigh != null">is_new_high = #{isNewHigh},</if>
<if test="isNewLow != null">is_new_low = #{isNewLow},</if>
</trim>
where stock_code = #{stockCode} and trade_date = #{tradeDate}
</update>
<delete id="deleteStockHighLowStatusByCodeAndDate">
delete from t_stock_high_low_status where stock_code = #{stockCode} and trade_date = #{tradeDate}
</delete>
<insert id="batchInsertStockHighLowStatus" parameterType="java.util.List">
insert into t_stock_high_low_status(stock_code, trade_date, is_new_high, is_new_low, create_time)
values
<foreach collection="list" item="item" separator=",">
(#{item.stockCode}, #{item.tradeDate}, #{item.isNewHigh}, #{item.isNewLow}, NOW())
</foreach>
</insert>
<insert id="batchUpsertStockHighLowStatus" parameterType="java.util.List">
insert into t_stock_high_low_status(stock_code, trade_date, is_new_high, is_new_low, create_time)
values
<foreach collection="list" item="item" separator=",">
(#{item.stockCode}, #{item.tradeDate}, #{item.isNewHigh}, #{item.isNewLow}, NOW())
</foreach>
ON DUPLICATE KEY UPDATE
is_new_high = VALUES(is_new_high),
is_new_low = VALUES(is_new_low)
</insert>
</mapper>

@ -0,0 +1,141 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.newstocksystem.mapper.TIndustryBasicMapper">
<resultMap type="com.ruoyi.newstocksystem.domain.TIndustryBasic" id="TIndustryBasicResult">
<result property="industryCode" column="industry_code" />
<result property="industryName" column="industry_name" />
<result property="industryLevel" column="industry_level" />
<result property="status" column="status" />
<result property="sortOrder" column="sort_order" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectTIndustryBasicVo">
select industry_code, industry_name, industry_level, status, sort_order, create_time, update_time
from t_industry_basic
</sql>
<select id="selectTIndustryBasicByCode" parameterType="String" resultMap="TIndustryBasicResult">
<include refid="selectTIndustryBasicVo"/>
where industry_code = #{industryCode}
</select>
<select id="selectTIndustryBasicList" parameterType="com.ruoyi.newstocksystem.domain.TIndustryBasic" resultMap="TIndustryBasicResult">
<include refid="selectTIndustryBasicVo"/>
<where>
<if test="industryCode != null and industryCode != ''">
AND industry_code = #{industryCode}
</if>
<if test="industryName != null and industryName != ''">
AND industry_name like concat('%', #{industryName}, '%')
</if>
<if test="industryLevel != null ">
AND industry_level = #{industryLevel}
</if>
<if test="status != null ">
AND status = #{status}
</if>
</where>
order by sort_order asc
</select>
<select id="selectTIndustryBasicByName" parameterType="String" resultMap="TIndustryBasicResult">
<include refid="selectTIndustryBasicVo"/>
where industry_name = #{industryName}
</select>
<insert id="insertTIndustryBasic" parameterType="com.ruoyi.newstocksystem.domain.TIndustryBasic" useGeneratedKeys="false">
insert into t_industry_basic
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="industryCode != null and industryCode != ''">
industry_code,
</if>
<if test="industryName != null and industryName != ''">
industry_name,
</if>
<if test="industryLevel != null">
industry_level,
</if>
<if test="status != null">
status,
</if>
<if test="sortOrder != null">
sort_order,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="industryCode != null and industryCode != ''">
#{industryCode},
</if>
<if test="industryName != null and industryName != ''">
#{industryName},
</if>
<if test="industryLevel != null">
#{industryLevel},
</if>
<if test="status != null">
#{status},
</if>
<if test="sortOrder != null">
#{sortOrder},
</if>
</trim>
</insert>
<update id="updateTIndustryBasic" parameterType="com.ruoyi.newstocksystem.domain.TIndustryBasic">
update t_industry_basic
<trim prefix="SET" suffixOverrides=",">
<if test="industryName != null and industryName != ''">
industry_name = #{industryName},
</if>
<if test="industryLevel != null">
industry_level = #{industryLevel},
</if>
<if test="status != null">
status = #{status},
</if>
<if test="sortOrder != null">
sort_order = #{sortOrder},
</if>
<if test="updateTime != null">
update_time = #{updateTime},
</if>
</trim>
where industry_code = #{industryCode}
</update>
<delete id="deleteTIndustryBasicByCode" parameterType="String">
delete from t_industry_basic where industry_code = #{industryCode}
</delete>
<delete id="deleteTIndustryBasicByCodes" parameterType="String">
delete from t_industry_basic where industry_code in
<foreach item="industryCode" collection="array" open="(" separator="," close=")">
#{industryCode}
</foreach>
</delete>
<insert id="batchUpsertIndustryBasic" parameterType="com.ruoyi.newstocksystem.domain.TIndustryBasic">
INSERT INTO t_industry_basic(
industry_code, industry_name, industry_level,
status, sort_order, create_time, update_time
) VALUES
<foreach collection="list" item="item" separator=",">
(
#{item.industryCode}, #{item.industryName}, #{item.industryLevel},
#{item.status}, #{item.sortOrder}, now(), now()
)
</foreach>
ON DUPLICATE KEY UPDATE
industry_name = VALUES(industry_name),
industry_level = VALUES(industry_level),
status = VALUES(status),
sort_order = VALUES(sort_order),
update_time = now()
</insert>
</mapper>

@ -0,0 +1,143 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.newstocksystem.mapper.TStockFinancialMapper">
<resultMap type="TStockFinancial" id="TStockFinancialResult">
<id property="id" column="id" />
<result property="stockCode" column="stock_code" />
<result property="reportPeriod" column="report_period" />
<result property="netProfitGrowthRateYoy" column="net_profit_growth_rate_yoy" />
<result property="netProfitGrowthRateQoq" column="net_profit_growth_rate_qoq" />
<result property="roe" column="roe" />
<result property="epsBasic" column="eps_basic" />
<result property="netProfit" column="net_profit" />
<result property="basicEps" column="basic_eps" />
<result property="bps" column="bps" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectTStockFinancialVo">
select id, stock_code, report_period, net_profit_growth_rate_yoy, net_profit_growth_rate_qoq, roe, eps_basic, net_profit, basic_eps, bps, create_time, update_time from t_stock_financial
</sql>
<select id="selectTStockFinancialById" parameterType="Long" resultMap="TStockFinancialResult">
<include refid="selectTStockFinancialVo"/>
where id = #{id}
</select>
<select id="selectTStockFinancialList" parameterType="TStockFinancial" resultMap="TStockFinancialResult">
<include refid="selectTStockFinancialVo"/>
<where>
<if test="stockCode != null and stockCode != ''">and stock_code = #{stockCode}</if>
<if test="reportPeriod != null ">and report_period = #{reportPeriod}</if>
<if test="netProfitGrowthRateYoy != null ">and net_profit_growth_rate_yoy = #{netProfitGrowthRateYoy}</if>
<if test="netProfitGrowthRateQoq != null ">and net_profit_growth_rate_qoq = #{netProfitGrowthRateQoq}</if>
<if test="roe != null ">and roe = #{roe}</if>
<if test="epsBasic != null ">and eps_basic = #{epsBasic}</if>
<if test="netProfit != null ">and net_profit = #{netProfit}</if>
<if test="basicEps != null ">and basic_eps = #{basicEps}</if>
<if test="bps != null ">and bps = #{bps}</if>
</where>
</select>
<insert id="insertTStockFinancial" parameterType="TStockFinancial" useGeneratedKeys="true" keyProperty="id">
insert into t_stock_financial
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="stockCode != null and stockCode != ''">stock_code,</if>
<if test="reportPeriod != null">report_period,</if>
<if test="netProfitGrowthRateYoy != null">net_profit_growth_rate_yoy,</if>
<if test="netProfitGrowthRateQoq != null">net_profit_growth_rate_qoq,</if>
<if test="roe != null">roe,</if>
<if test="epsBasic != null">eps_basic,</if>
<if test="netProfit != null">net_profit,</if>
<if test="basicEps != null">basic_eps,</if>
<if test="bps != null">bps,</if>
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="stockCode != null and stockCode != ''">#{stockCode},</if>
<if test="reportPeriod != null">#{reportPeriod},</if>
<if test="netProfitGrowthRateYoy != null">#{netProfitGrowthRateYoy},</if>
<if test="netProfitGrowthRateQoq != null">#{netProfitGrowthRateQoq},</if>
<if test="roe != null">#{roe},</if>
<if test="epsBasic != null">#{epsBasic},</if>
<if test="netProfit != null">#{netProfit},</if>
<if test="basicEps != null">#{basicEps},</if>
<if test="bps != null">#{bps},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateTStockFinancial" parameterType="TStockFinancial">
update t_stock_financial
<trim prefix="SET" suffixOverrides=",">
<if test="stockCode != null and stockCode != ''">stock_code = #{stockCode},</if>
<if test="reportPeriod != null">report_period = #{reportPeriod},</if>
<if test="netProfitGrowthRateYoy != null">net_profit_growth_rate_yoy = #{netProfitGrowthRateYoy},</if>
<if test="netProfitGrowthRateQoq != null">net_profit_growth_rate_qoq = #{netProfitGrowthRateQoq},</if>
<if test="roe != null">roe = #{roe},</if>
<if test="epsBasic != null">eps_basic = #{epsBasic},</if>
<if test="netProfit != null">net_profit = #{netProfit},</if>
<if test="basicEps != null">basic_eps = #{basicEps},</if>
<if test="bps != null">bps = #{bps},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteTStockFinancialById" parameterType="Long">
delete from t_stock_financial where id = #{id}
</delete>
<delete id="deleteTStockFinancialByIds" parameterType="String">
delete from t_stock_financial where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<insert id="batchUpsert" parameterType="java.util.List">
INSERT INTO t_stock_financial (
stock_code,
report_period,
net_profit_growth_rate_yoy,
net_profit_growth_rate_qoq,
roe,
eps_basic,
net_profit,
basic_eps,
bps,
create_time,
update_time
) VALUES
<foreach collection="list" item="item" separator=",">
(
#{item.stockCode},
#{item.reportPeriod},
#{item.netProfitGrowthRateYoy},
#{item.netProfitGrowthRateQoq},
#{item.roe},
#{item.epsBasic},
#{item.netProfit},
#{item.basicEps},
#{item.bps},
#{item.createTime},
#{item.updateTime}
)
</foreach>
ON DUPLICATE KEY UPDATE
net_profit_growth_rate_yoy = VALUES(net_profit_growth_rate_yoy),
net_profit_growth_rate_qoq = VALUES(net_profit_growth_rate_qoq),
roe = VALUES(roe),
eps_basic = VALUES(eps_basic),
net_profit = VALUES(net_profit),
basic_eps = VALUES(basic_eps),
bps = VALUES(bps),
update_time = VALUES(update_time)
</insert>
</mapper>

@ -0,0 +1,110 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.newstocksystem.mapper.TStocksInTrendMapper">
<resultMap type="TStocksInTrend" id="TStocksInTrendResult">
<id property="id" column="id" />
<result property="stockCode" column="stock_code" />
<result property="tradeDate" column="trade_date" />
<result property="rank" column="rank" />
<result property="momentumType" column="momentum_type" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectTStocksInTrendVo">
select id, stock_code, trade_date, `rank`, momentum_type, create_time, update_time from t_stocks_in_trend
</sql>
<select id="selectTStocksInTrendById" parameterType="Long" resultMap="TStocksInTrendResult">
<include refid="selectTStocksInTrendVo"/>
where id = #{id}
</select>
<select id="selectTStocksInTrendList" parameterType="TStocksInTrend" resultMap="TStocksInTrendResult">
<include refid="selectTStocksInTrendVo"/>
<where>
<if test="stockCode != null and stockCode != ''">and stock_code = #{stockCode}</if>
<if test="tradeDate != null ">and trade_date = #{tradeDate}</if>
<if test="rank != null ">and `rank` = #{rank}</if>
<if test="momentumType != null and momentumType != ''">and momentum_type = #{momentumType}</if>
</where>
</select>
<insert id="insertTStocksInTrend" parameterType="TStocksInTrend" useGeneratedKeys="true" keyProperty="id">
insert into t_stocks_in_trend
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="stockCode != null and stockCode != ''">stock_code,</if>
<if test="tradeDate != null">trade_date,</if>
<if test="rank != null">`rank`,</if>
<if test="momentumType != null and momentumType != ''">momentum_type,</if>
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="stockCode != null and stockCode != ''">#{stockCode},</if>
<if test="tradeDate != null">#{tradeDate},</if>
<if test="rank != null">#{rank},</if>
<if test="momentumType != null and momentumType != ''">#{momentumType},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateTStocksInTrend" parameterType="TStocksInTrend">
update t_stocks_in_trend
<trim prefix="SET" suffixOverrides=",">
<if test="stockCode != null and stockCode != ''">stock_code = #{stockCode},</if>
<if test="tradeDate != null">trade_date = #{tradeDate},</if>
<if test="rank != null">`rank` = #{rank},</if>
<if test="momentumType != null and momentumType != ''">momentum_type = #{momentumType},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteTStocksInTrendById" parameterType="Long">
delete from t_stocks_in_trend where id = #{id}
</delete>
<delete id="deleteTStocksInTrendByIds" parameterType="String">
delete from t_stocks_in_trend where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<insert id="batchInsertTStocksInTrend" parameterType="java.util.List">
insert into t_stocks_in_trend (stock_code, trade_date, `rank`, momentum_type, create_time, update_time)
values
<foreach collection="list" item="item" separator=",">
(#{item.stockCode}, #{item.tradeDate}, #{item.rank}, #{item.momentumType}, #{item.createTime}, #{item.updateTime})
</foreach>
</insert>
<insert id="batchUpsert" parameterType="java.util.List">
INSERT INTO t_stocks_in_trend (
stock_code,
trade_date,
`rank`,
momentum_type,
create_time,
update_time
) VALUES
<foreach collection="list" item="item" separator=",">
(
#{item.stockCode},
#{item.tradeDate},
#{item.rank},
#{item.momentumType},
#{item.createTime},
#{item.updateTime}
)
</foreach>
ON DUPLICATE KEY UPDATE
`rank` = VALUES(`rank`),
update_time = VALUES(update_time)
</insert>
</mapper>

@ -0,0 +1,198 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.newstocksystem.mapper.TTrendsMapper">
<resultMap type="TTrends" id="TTrendsResult">
<id property="id" column="id" />
<result property="tradeDate" column="trade_date" />
<result property="industryName" column="industry_name" />
<result property="stocksCount" column="stocks_count" />
<result property="trendValue" column="trend_value" />
<result property="trendValueChange" column="trend_value_change" />
<result property="rank" column="rank" />
<result property="rankChange" column="rank_change" />
<result property="momentumType" column="momentum_type" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectTTrendsVo">
select id, trade_date, industry_name, stocks_count, trend_value, trend_value_change, `rank`, `rank_change`, momentum_type, create_time, update_time from t_trends
</sql>
<select id="selectTTrendsById" parameterType="Long" resultMap="TTrendsResult">
<include refid="selectTTrendsVo"/>
where id = #{id}
</select>
<select id="selectTTrendsList" parameterType="TTrends" resultMap="TTrendsResult">
<include refid="selectTTrendsVo"/>
<where>
<if test="tradeDate != null ">and trade_date = #{tradeDate}</if>
<if test="industryName != null and industryName != ''">and industry_name = #{industryName}</if>
<if test="stocksCount != null ">and stocks_count = #{stocksCount}</if>
<if test="trendValue != null ">and trend_value = #{trendValue}</if>
<if test="trendValueChange != null ">and trend_value_change = #{trendValueChange}</if>
<if test="rank != null ">and rank = #{rank}</if>
<if test="rankChange != null ">and rank_change = #{rankChange}</if>
<if test="momentumType != null and momentumType != ''">and momentum_type = #{momentumType}</if>
</where>
</select>
<insert id="insertTTrends" parameterType="TTrends" useGeneratedKeys="true" keyProperty="id">
insert into t_trends
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="tradeDate != null">trade_date,</if>
<if test="industryName != null and industryName != ''">industry_name,</if>
<if test="stocksCount != null">stocks_count,</if>
<if test="trendValue != null">trend_value,</if>
<if test="trendValueChange != null">trend_value_change,</if>
<if test="rank != null">`rank`,</if>
<if test="rankChange != null">`rank_change`,</if>
<if test="momentumType != null and momentumType != ''">momentum_type,</if>
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="tradeDate != null">#{tradeDate},</if>
<if test="industryName != null and industryName != ''">#{industryName},</if>
<if test="stocksCount != null">#{stocksCount},</if>
<if test="trendValue != null">#{trendValue},</if>
<if test="trendValueChange != null">#{trendValueChange},</if>
<if test="rank != null">#{rank},</if>
<if test="rankChange != null">#{rankChange},</if>
<if test="momentumType != null and momentumType != ''">#{momentumType},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateTTrends" parameterType="TTrends">
update t_trends
<trim prefix="SET" suffixOverrides=",">
<if test="tradeDate != null">trade_date = #{tradeDate},</if>
<if test="industryName != null and industryName != ''">industry_name = #{industryName},</if>
<if test="stocksCount != null">stocks_count = #{stocksCount},</if>
<if test="trendValue != null">trend_value = #{trendValue},</if>
<if test="trendValueChange != null">trend_value_change = #{trendValueChange},</if>
<if test="rank != null">`rank` = #{rank},</if>
<if test="rankChange != null">`rank_change` = #{rankChange},</if>
<if test="momentumType != null and momentumType != ''">momentum_type = #{momentumType},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteTTrendsById" parameterType="Long">
delete from t_trends where id = #{id}
</delete>
<delete id="deleteTTrendsByIds" parameterType="String">
delete from t_trends where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<insert id="batchUpsert" parameterType="java.util.List">
INSERT INTO t_trends (
trade_date,
industry_name,
stocks_count,
trend_value,
trend_value_change,
`rank`,
`rank_change`,
momentum_type,
create_time,
update_time
) VALUES
<foreach collection="list" item="item" separator=",">
(
#{item.tradeDate},
#{item.industryName},
#{item.stocksCount},
#{item.trendValue},
#{item.trendValueChange},
#{item.rank},
#{item.rankChange},
#{item.momentumType},
#{item.createTime},
#{item.updateTime}
)
</foreach>
ON DUPLICATE KEY UPDATE
stocks_count = VALUES(stocks_count),
trend_value = VALUES(trend_value),
trend_value_change = VALUES(trend_value_change),
`rank` = VALUES(`rank`),
`rank_change` = VALUES(`rank_change`),
update_time = VALUES(update_time)
</insert>
<select id="checkTrendsExistsByDate" parameterType="Date" resultType="int">
select count(1) from t_trends where trade_date = #{tradeDate}
</select>
<!-- 获取最近10个交易日 -->
<select id="getRecentTradeDates" parameterType="String" resultType="Date">
SELECT DISTINCT trade_date
FROM t_trends
WHERE momentum_type = #{momentumType}
ORDER BY trade_date DESC
LIMIT 10
</select>
<!-- 获取所有行业名称 -->
<select id="getAllIndustryNames" parameterType="String" resultType="String">
SELECT DISTINCT industry_name
FROM t_trends
WHERE momentum_type = #{momentumType}
</select>
<!-- 获取指定行业在指定日期的排名 -->
<select id="getIndustryRankByDate" parameterType="map" resultType="Integer">
SELECT `rank`
FROM t_trends
WHERE momentum_type = #{momentumType}
AND industry_name = #{industryName}
AND trade_date = #{tradeDate}
</select>
<!-- 获取指定行业在指定日期范围内的趋势数据 -->
<select id="getTrendsByIndustryAndDateRange" parameterType="map" resultMap="TTrendsResult">
SELECT *
FROM t_trends
WHERE momentum_type = #{momentumType}
AND industry_name = #{industryName}
AND trade_date BETWEEN #{startDate} AND #{endDate}
ORDER BY trade_date DESC
</select>
<!-- 获取指定日期往前10个交易日的所有日期 -->
<select id="getPreviousTradeDates" parameterType="map" resultType="Date">
SELECT DISTINCT trade_date
FROM t_trends
WHERE momentum_type = #{momentumType}
AND trade_date &lt;= #{currentDate}
ORDER BY trade_date DESC
LIMIT 10
</select>
<!-- 获取指定日期和动量类型的所有趋势数据 -->
<select id="getTrendsByDateAndType" parameterType="TTrends" resultMap="TTrendsResult">
SELECT *
FROM t_trends
WHERE trade_date = #{tradeDate}
AND momentum_type = #{momentumType}
ORDER BY `rank`
</select>
<!-- 获取最后一个已分析的交易日 -->
<select id="selectLastAnalyzedDate" resultType="String">
SELECT DATE_FORMAT(MAX(trade_date), '%Y-%m-%d') AS last_date
FROM t_trends
</select>
</mapper>

@ -0,0 +1,6 @@
股票代码,股票名称,行业ID,行业名称,行业级别,行业代码,父行业代码,首发上市日期,市场类型,状态,交易日期,开盘价,收盘价,涨跌停类型,涨跌停价格,当日涨跌幅,可交易日数,成交量,成交额,10日区间涨跌幅,20日区间涨跌幅,60日区间涨跌幅,20日区间平均成交量,自由流通市值,总市值,机构持仓合计
600000,浦发银行,1,银行,1,BK0475,0,1999-11-10,SH,1,2026-01-18,8.50,8.65,0,0,1.76,240,12500000,108125000,5.20,8.75,15.30,11000000,280000000000,320000000000,25.50
600519,贵州茅台,2,白酒,1,BK0477,0,2001-08-27,SH,1,2026-01-18,1850.00,1880.50,1,1880.50,1.65,240,25000,47012500,4.80,7.20,12.50,22000,2400000000000,2600000000000,45.80
000001,平安银行,1,银行,1,BK0475,0,1991-04-03,SZ,1,2026-01-18,12.80,13.05,0,0,1.92,240,8500000,110925000,6.10,9.30,18.70,7800000,350000000000,380000000000,30.20
000858,五粮液,2,白酒,1,BK0477,0,1998-04-27,SZ,1,2026-01-18,168.50,172.20,1,172.20,2.20,240,1500000,258300000,5.50,8.10,14.20,1350000,850000000000,920000000000,38.50
601318,中国平安,3,保险,1,BK0474,0,2007-03-01,SH,1,2026-01-18,48.20,49.50,-1,49.50,2.71,240,3200000,158400000,7.30,10.50,20.10,2900000,420000000000,480000000000,32.80

Binary file not shown.

@ -218,6 +218,12 @@
<version>${ruoyi.version}</version> <version>${ruoyi.version}</version>
</dependency> </dependency>
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>newstock-system</artifactId>
<version>${ruoyi.version}</version>
</dependency>
</dependencies> </dependencies>
</dependencyManagement> </dependencyManagement>
@ -229,6 +235,7 @@
<module>ruoyi-generator</module> <module>ruoyi-generator</module>
<module>ruoyi-common</module> <module>ruoyi-common</module>
<module>stock-system</module> <module>stock-system</module>
<module>newstock-system</module>
<module>book-system</module> <module>book-system</module>
</modules> </modules>
<packaging>pom</packaging> <packaging>pom</packaging>

@ -67,6 +67,11 @@
<artifactId>stock-system</artifactId> <artifactId>stock-system</artifactId>
</dependency> </dependency>
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>newstock-system</artifactId>
</dependency>
<dependency> <dependency>
<groupId>com.ruoyi</groupId> <groupId>com.ruoyi</groupId>
<artifactId>book-system</artifactId> <artifactId>book-system</artifactId>

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save