feat: 智聪记账管理,新增股票日行情、期货日行情功能。
This commit is contained in:
@@ -0,0 +1,116 @@
|
||||
package com.intc.invest.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.annotation.Resource;
|
||||
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.intc.common.log.annotation.Log;
|
||||
import com.intc.common.log.enums.BusinessType;
|
||||
import com.intc.common.security.annotation.RequiresPermissions;
|
||||
import com.intc.invest.domain.FuturesDailyHistory;
|
||||
import com.intc.invest.domain.vo.FuturesDailyHistoryVo;
|
||||
import com.intc.invest.domain.dto.FuturesDailyHistoryDto;
|
||||
import com.intc.invest.service.IFuturesDailyHistoryService;
|
||||
import com.intc.common.core.web.controller.BaseController;
|
||||
import com.intc.common.core.web.domain.AjaxResult;
|
||||
import com.intc.common.core.utils.poi.ExcelUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import com.intc.common.core.web.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 期货日行情历史Controller
|
||||
*
|
||||
* @author tianyongbao
|
||||
* @date 2025-04-01
|
||||
*/
|
||||
@Api(tags=" 期货日行情历史")
|
||||
@RestController
|
||||
@RequestMapping("/futuresDailyHistory")
|
||||
public class FuturesDailyHistoryController extends BaseController
|
||||
{
|
||||
@Resource
|
||||
private IFuturesDailyHistoryService futuresDailyHistoryService;
|
||||
|
||||
/**
|
||||
* 查询期货日行情历史列表
|
||||
*/
|
||||
@ApiOperation(value="查询期货日行情历史列表",response = FuturesDailyHistoryVo.class)
|
||||
@RequiresPermissions("invest:futuresDailyHistory:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(FuturesDailyHistoryDto futuresDailyHistoryDto)
|
||||
{
|
||||
startPage();
|
||||
List<FuturesDailyHistoryVo> list = futuresDailyHistoryService.selectFuturesDailyHistoryList(futuresDailyHistoryDto);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出期货日行情历史列表
|
||||
*/
|
||||
@ApiOperation(value="导出期货日行情历史列表")
|
||||
@RequiresPermissions("invest:futuresDailyHistory:export")
|
||||
@Log(title = "期货日行情历史", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, FuturesDailyHistoryDto futuresDailyHistoryDto)
|
||||
{
|
||||
List<FuturesDailyHistoryVo> list = futuresDailyHistoryService.selectFuturesDailyHistoryList(futuresDailyHistoryDto);
|
||||
ExcelUtil<FuturesDailyHistoryVo> util = new ExcelUtil<FuturesDailyHistoryVo>(FuturesDailyHistoryVo.class);
|
||||
util.exportExcel(response, list, "期货日行情历史数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取期货日行情历史详细信息
|
||||
*/
|
||||
@ApiOperation(value="获取期货日行情历史详细信息")
|
||||
@RequiresPermissions("invest:futuresDailyHistory:query")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") String id)
|
||||
{
|
||||
return success(futuresDailyHistoryService.selectFuturesDailyHistoryById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增期货日行情历史
|
||||
*/
|
||||
@ApiOperation(value="新增期货日行情历史")
|
||||
@RequiresPermissions("invest:futuresDailyHistory:add")
|
||||
@Log(title = "期货日行情历史", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody FuturesDailyHistory futuresDailyHistory)
|
||||
{
|
||||
return toAjax(futuresDailyHistoryService.insertFuturesDailyHistory(futuresDailyHistory));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改期货日行情历史
|
||||
*/
|
||||
@ApiOperation(value="修改期货日行情历史")
|
||||
@RequiresPermissions("invest:futuresDailyHistory:edit")
|
||||
@Log(title = "期货日行情历史", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody FuturesDailyHistory futuresDailyHistory)
|
||||
{
|
||||
return toAjax(futuresDailyHistoryService.updateFuturesDailyHistory(futuresDailyHistory));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除期货日行情历史
|
||||
*/
|
||||
@ApiOperation(value="删除期货日行情历史")
|
||||
@RequiresPermissions("invest:futuresDailyHistory:remove")
|
||||
@Log(title = "期货日行情历史", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable String[] ids)
|
||||
{
|
||||
return toAjax(futuresDailyHistoryService.deleteFuturesDailyHistoryByIds(ids));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,129 @@
|
||||
package com.intc.invest.controller;
|
||||
|
||||
import com.intc.common.core.utils.poi.ExcelUtil;
|
||||
import com.intc.common.core.web.controller.BaseController;
|
||||
import com.intc.common.core.web.domain.AjaxResult;
|
||||
import com.intc.common.core.web.page.TableDataInfo;
|
||||
import com.intc.common.log.annotation.Log;
|
||||
import com.intc.common.log.enums.BusinessType;
|
||||
import com.intc.common.security.annotation.RequiresPermissions;
|
||||
import com.intc.invest.domain.StocksDailyHistory;
|
||||
import com.intc.invest.domain.TuShare;
|
||||
import com.intc.invest.domain.TuShareParams;
|
||||
import com.intc.invest.domain.dto.StocksDailyHistoryDto;
|
||||
import com.intc.invest.domain.vo.StocksDailyHistoryVo;
|
||||
import com.intc.invest.service.IStocksDailyHistoryService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 股票日行情历史Controller
|
||||
*
|
||||
* @author tianyongbao
|
||||
* @date 2025-04-01
|
||||
*/
|
||||
@Api(tags=" 股票日行情历史")
|
||||
@RestController
|
||||
@RequestMapping("/stocksDailyHistory")
|
||||
public class StocksDailyHistoryController extends BaseController
|
||||
{
|
||||
@Resource
|
||||
private IStocksDailyHistoryService stocksDailyHistoryService;
|
||||
|
||||
/**
|
||||
* 查询股票日行情历史列表
|
||||
*/
|
||||
@ApiOperation(value="查询股票日行情历史列表",response = StocksDailyHistoryVo.class)
|
||||
@RequiresPermissions("invest:stocksDailyHistory:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(StocksDailyHistoryDto stocksDailyHistoryDto)
|
||||
{
|
||||
startPage();
|
||||
List<StocksDailyHistoryVo> list = stocksDailyHistoryService.selectStocksDailyHistoryList(stocksDailyHistoryDto);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出股票日行情历史列表
|
||||
*/
|
||||
@ApiOperation(value="导出股票日行情历史列表")
|
||||
@RequiresPermissions("invest:stocksDailyHistory:export")
|
||||
@Log(title = "股票日行情历史", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, StocksDailyHistoryDto stocksDailyHistoryDto)
|
||||
{
|
||||
List<StocksDailyHistoryVo> list = stocksDailyHistoryService.selectStocksDailyHistoryList(stocksDailyHistoryDto);
|
||||
ExcelUtil<StocksDailyHistoryVo> util = new ExcelUtil<StocksDailyHistoryVo>(StocksDailyHistoryVo.class);
|
||||
util.exportExcel(response, list, "股票日行情历史数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取股票日行情历史详细信息
|
||||
*/
|
||||
@ApiOperation(value="获取股票日行情历史详细信息")
|
||||
@RequiresPermissions("invest:stocksDailyHistory:query")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(stocksDailyHistoryService.selectStocksDailyHistoryById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增股票日行情历史
|
||||
*/
|
||||
@ApiOperation(value="新增股票日行情历史")
|
||||
@RequiresPermissions("invest:stocksDailyHistory:add")
|
||||
@Log(title = "股票日行情历史", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody StocksDailyHistory stocksDailyHistory)
|
||||
{
|
||||
return toAjax(stocksDailyHistoryService.insertStocksDailyHistory(stocksDailyHistory));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改股票日行情历史
|
||||
*/
|
||||
@ApiOperation(value="修改股票日行情历史")
|
||||
@RequiresPermissions("invest:stocksDailyHistory:edit")
|
||||
@Log(title = "股票日行情历史", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody StocksDailyHistory stocksDailyHistory)
|
||||
{
|
||||
return toAjax(stocksDailyHistoryService.updateStocksDailyHistory(stocksDailyHistory));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除股票日行情历史
|
||||
*/
|
||||
@ApiOperation(value="删除股票日行情历史")
|
||||
@RequiresPermissions("invest:stocksDailyHistory:remove")
|
||||
@Log(title = "股票日行情历史", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(stocksDailyHistoryService.deleteStocksDailyHistoryByIds(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 同步股票日行情历史数据
|
||||
*/
|
||||
@ApiOperation(value="同步股票日行情历史数据",response = TuShareParams.class)
|
||||
// @RequiresPermissions("invest:stocksDailyHistory:list")
|
||||
@GetMapping("/synStocksDailyHistory")
|
||||
public AjaxResult list(TuShareParams tuShareParams)
|
||||
{
|
||||
TuShare tuShare = new TuShare();
|
||||
tuShareParams.setEnd_date(tuShareParams.getEnd_date().replaceAll("-",""));
|
||||
tuShareParams.setStart_date(tuShareParams.getStart_date().replaceAll("-",""));
|
||||
tuShare.setParams(tuShareParams);
|
||||
stocksDailyHistoryService.synStocksDailyHistory(tuShare);
|
||||
return success("同步成功!");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -86,6 +86,11 @@ public class FutureBaseInfor extends BaseEntity
|
||||
/** 删除标志(0代表存在 1代表删除) */
|
||||
private String delFlag;
|
||||
|
||||
/** TS合约代码 */
|
||||
@ApiModelProperty(value="TS合约代码")
|
||||
@Excel(name = "TS合约代码")
|
||||
private String tsCode;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
@@ -107,6 +112,7 @@ public class FutureBaseInfor extends BaseEntity
|
||||
.append("delFlag", getDelFlag())
|
||||
.append("remark", getRemark())
|
||||
.append("listingDate", getListingDate())
|
||||
.append("tsCode", getTsCode())
|
||||
|
||||
.toString();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,136 @@
|
||||
package com.intc.invest.domain;
|
||||
|
||||
import com.intc.common.core.annotation.Excel;
|
||||
import com.intc.common.core.web.domain.BaseEntity;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
/**
|
||||
* 期货日行情历史对象 futures_daily_history
|
||||
*
|
||||
* @author tianyongbao
|
||||
* @date 2025-04-01
|
||||
*/
|
||||
@ApiModel("期货日行情历史对象")
|
||||
@Data
|
||||
public class FuturesDailyHistory extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键 */
|
||||
private Long id;
|
||||
|
||||
/** TS合约代码 */
|
||||
@ApiModelProperty(value="TS合约代码")
|
||||
@Excel(name = "TS合约代码")
|
||||
private String tsCode;
|
||||
|
||||
/** 交易日期 */
|
||||
@ApiModelProperty(value="交易日期")
|
||||
@Excel(name = "交易日期")
|
||||
private String tradeDate;
|
||||
|
||||
/** 昨收盘价 */
|
||||
@ApiModelProperty(value="昨收盘价")
|
||||
@Excel(name = "昨收盘价")
|
||||
private String preClose;
|
||||
|
||||
/** 昨结算价 */
|
||||
@ApiModelProperty(value="昨结算价")
|
||||
@Excel(name = "昨结算价")
|
||||
private String preSettle;
|
||||
|
||||
/** 开盘价 */
|
||||
@ApiModelProperty(value="开盘价")
|
||||
@Excel(name = "开盘价")
|
||||
private String open;
|
||||
|
||||
/** 最高价 */
|
||||
@ApiModelProperty(value="最高价")
|
||||
@Excel(name = "最高价")
|
||||
private String high;
|
||||
|
||||
/** 最低价 */
|
||||
@ApiModelProperty(value="最低价")
|
||||
@Excel(name = "最低价")
|
||||
private String low;
|
||||
|
||||
/** 收盘价 */
|
||||
@ApiModelProperty(value="收盘价")
|
||||
@Excel(name = "收盘价")
|
||||
private String close;
|
||||
|
||||
/** 结算价 */
|
||||
@ApiModelProperty(value="结算价")
|
||||
@Excel(name = "结算价")
|
||||
private String settle;
|
||||
|
||||
/** 收盘价涨跌 */
|
||||
@ApiModelProperty(value="收盘价涨跌")
|
||||
@Excel(name = "收盘价涨跌")
|
||||
private String change1;
|
||||
|
||||
/** 成交量(手) */
|
||||
@ApiModelProperty(value="成交量(手)")
|
||||
@Excel(name = "成交量(手)")
|
||||
private String vol;
|
||||
|
||||
/** 成交金额(万元) */
|
||||
@ApiModelProperty(value="成交金额(万元)")
|
||||
@Excel(name = "成交金额(万元)")
|
||||
private String amount;
|
||||
|
||||
/** 结算价涨跌 */
|
||||
@ApiModelProperty(value="结算价涨跌")
|
||||
@Excel(name = "结算价涨跌")
|
||||
private String change2;
|
||||
|
||||
/** 持仓量(手) */
|
||||
@ApiModelProperty(value="持仓量(手)")
|
||||
@Excel(name = "持仓量(手)")
|
||||
private String oi;
|
||||
|
||||
/** 持仓量变化 */
|
||||
@ApiModelProperty(value="持仓量变化")
|
||||
@Excel(name = "持仓量变化")
|
||||
private String oiChg;
|
||||
|
||||
/** 交割结算价 */
|
||||
@ApiModelProperty(value="交割结算价")
|
||||
@Excel(name = "交割结算价")
|
||||
private String delvSettle;
|
||||
|
||||
/** 删除标志(0代表存在 1代表删除) */
|
||||
private String delFlag;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("tsCode", getTsCode())
|
||||
.append("tradeDate", getTradeDate())
|
||||
.append("preClose", getPreClose())
|
||||
.append("preSettle", getPreSettle())
|
||||
.append("open", getOpen())
|
||||
.append("high", getHigh())
|
||||
.append("low", getLow())
|
||||
.append("close", getClose())
|
||||
.append("settle", getSettle())
|
||||
.append("change1", getChange1())
|
||||
.append("vol", getVol())
|
||||
.append("amount", getAmount())
|
||||
.append("change2", getChange2())
|
||||
.append("oi", getOi())
|
||||
.append("oiChg", getOiChg())
|
||||
.append("delvSettle", getDelvSettle())
|
||||
.append("remark", getRemark())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.append("delFlag", getDelFlag())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
@@ -81,6 +81,11 @@ public class StockBaseInfor extends BaseEntity
|
||||
@Excel(name = "简称")
|
||||
private String shortName;
|
||||
|
||||
/** TS合约代码 */
|
||||
@ApiModelProperty(value="TS合约代码")
|
||||
@Excel(name = "TS合约代码")
|
||||
private String tsCode;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
@@ -101,6 +106,7 @@ public class StockBaseInfor extends BaseEntity
|
||||
.append("introduce", getIntroduce())
|
||||
.append("region", getRegion())
|
||||
.append("shortName", getShortName())
|
||||
.append("tsCode", getTsCode())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,115 @@
|
||||
package com.intc.invest.domain;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.intc.common.core.annotation.Excel;
|
||||
import com.intc.common.core.web.domain.BaseEntity;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 股票日行情历史对象 stocks_daily_history
|
||||
*
|
||||
* @author tianyongbao
|
||||
* @date 2025-04-01
|
||||
*/
|
||||
@ApiModel("股票日行情历史对象")
|
||||
@Data
|
||||
public class StocksDailyHistory extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键 */
|
||||
private Long id;
|
||||
|
||||
/** TS合约代码 */
|
||||
@ApiModelProperty(value="TS合约代码")
|
||||
@Excel(name = "TS合约代码")
|
||||
private String tsCode;
|
||||
|
||||
/** 股票 */
|
||||
private Long stockId;
|
||||
|
||||
/** 交易日期 */
|
||||
@ApiModelProperty(value="交易日期")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "交易日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date tradeDate;
|
||||
|
||||
/** 开盘价 */
|
||||
@ApiModelProperty(value="开盘价")
|
||||
@Excel(name = "开盘价")
|
||||
private Double open;
|
||||
|
||||
/** 最高价 */
|
||||
@ApiModelProperty(value="最高价")
|
||||
@Excel(name = "最高价")
|
||||
private Double high;
|
||||
|
||||
/** 最低价 */
|
||||
@ApiModelProperty(value="最低价")
|
||||
@Excel(name = "最低价")
|
||||
private Double low;
|
||||
|
||||
/** 收盘价 */
|
||||
@ApiModelProperty(value="收盘价")
|
||||
@Excel(name = "收盘价")
|
||||
private Double close;
|
||||
|
||||
/** 昨收价 */
|
||||
@ApiModelProperty(value="昨收价")
|
||||
@Excel(name = "昨收价")
|
||||
private Double preClose;
|
||||
|
||||
/** 涨跌额 */
|
||||
@ApiModelProperty(value="涨跌额")
|
||||
@Excel(name = "涨跌额")
|
||||
private Double change;
|
||||
|
||||
/** 涨跌幅 */
|
||||
@ApiModelProperty(value="涨跌幅")
|
||||
@Excel(name = "涨跌幅")
|
||||
private Double pctChg;
|
||||
|
||||
/** 成交量 (手) */
|
||||
@ApiModelProperty(value="成交量 ")
|
||||
@Excel(name = "成交量 ")
|
||||
private Double vol;
|
||||
|
||||
/** 成交额 (千元) */
|
||||
@ApiModelProperty(value="成交额 ")
|
||||
@Excel(name = "成交额 ")
|
||||
private Double amount;
|
||||
|
||||
/** 删除标志(0代表存在 1代表删除) */
|
||||
private Double delFlag;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("tsCode", getTsCode())
|
||||
.append("tradeDate", getTradeDate())
|
||||
.append("open", getOpen())
|
||||
.append("high", getHigh())
|
||||
.append("low", getLow())
|
||||
.append("close", getClose())
|
||||
.append("preClose", getPreClose())
|
||||
.append("change", getChange())
|
||||
.append("pctChg", getPctChg())
|
||||
.append("vol", getVol())
|
||||
.append("amount", getAmount())
|
||||
.append("remark", getRemark())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.append("delFlag", getDelFlag())
|
||||
.append("stockId", getStockId())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.intc.invest.domain;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 股票日行情历史Dto对象 stocks_daily_history
|
||||
*
|
||||
* @author tianyongbao
|
||||
* @date 2025-04-01
|
||||
*/
|
||||
@ApiModel("股票日行情历史Dto对象")
|
||||
@Data
|
||||
public class TuShare implements Serializable
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** api_name */
|
||||
@ApiModelProperty(value="api_name")
|
||||
private String api_name;
|
||||
|
||||
/** token */
|
||||
@ApiModelProperty(value="token")
|
||||
private String token;
|
||||
|
||||
/** params */
|
||||
@ApiModelProperty(value="params")
|
||||
private TuShareParams params;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.intc.invest.domain;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 业务模块
|
||||
*
|
||||
* @author tianyongbao
|
||||
* @date 2025/4/1
|
||||
*/
|
||||
public class TuShareData {
|
||||
private List<String> fields;
|
||||
private List<List<String>> items;
|
||||
private boolean has_more;
|
||||
private int count;
|
||||
public void setFields(List<String> fields) {
|
||||
this.fields = fields;
|
||||
}
|
||||
public List<String> getFields() {
|
||||
return fields;
|
||||
}
|
||||
|
||||
public void setItems(List<List<String>> items) {
|
||||
this.items = items;
|
||||
}
|
||||
public List<List<String>> getItems() {
|
||||
return items;
|
||||
}
|
||||
|
||||
public void setHas_more(boolean has_more) {
|
||||
this.has_more = has_more;
|
||||
}
|
||||
public boolean getHas_more() {
|
||||
return has_more;
|
||||
}
|
||||
|
||||
public void setCount(int count) {
|
||||
this.count = count;
|
||||
}
|
||||
public int getCount() {
|
||||
return count;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.intc.invest.domain;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 股票日行情历史Dto对象 stocks_daily_history
|
||||
*
|
||||
* @author tianyongbao
|
||||
* @date 2025-04-01
|
||||
*/
|
||||
@ApiModel("股票日行情历史Dto对象")
|
||||
@Data
|
||||
public class TuShareParams implements Serializable
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** ts_code */
|
||||
@ApiModelProperty(value="ts_code")
|
||||
private String ts_code;
|
||||
|
||||
/** trade_date */
|
||||
@ApiModelProperty(value="trade_date")
|
||||
private String trade_date;
|
||||
|
||||
/** params */
|
||||
@ApiModelProperty(value="start_date")
|
||||
private String start_date;
|
||||
|
||||
/** params */
|
||||
@ApiModelProperty(value="end_date")
|
||||
private String end_date;
|
||||
|
||||
/** exchange */
|
||||
@ApiModelProperty(value="exchange")
|
||||
private String exchange;
|
||||
|
||||
/** ts_id */
|
||||
@ApiModelProperty(value="ts_id")
|
||||
private Long ts_id;
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
package com.intc.invest.domain.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import java.io.Serializable;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
/**
|
||||
* 期货日行情历史Dto对象 futures_daily_history
|
||||
*
|
||||
* @author tianyongbao
|
||||
* @date 2025-04-01
|
||||
*/
|
||||
@ApiModel("期货日行情历史Dto对象")
|
||||
@Data
|
||||
public class FuturesDailyHistoryDto implements Serializable
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** TS合约代码 */
|
||||
@ApiModelProperty(value="TS合约代码")
|
||||
private String tsCode;
|
||||
|
||||
/** 交易日期 */
|
||||
@ApiModelProperty(value="交易日期")
|
||||
private String tradeDate;
|
||||
|
||||
/** 昨收盘价 */
|
||||
@ApiModelProperty(value="昨收盘价")
|
||||
private String preClose;
|
||||
|
||||
/** 昨结算价 */
|
||||
@ApiModelProperty(value="昨结算价")
|
||||
private String preSettle;
|
||||
|
||||
/** 开盘价 */
|
||||
@ApiModelProperty(value="开盘价")
|
||||
private String open;
|
||||
|
||||
/** 最高价 */
|
||||
@ApiModelProperty(value="最高价")
|
||||
private String high;
|
||||
|
||||
/** 最低价 */
|
||||
@ApiModelProperty(value="最低价")
|
||||
private String low;
|
||||
|
||||
/** 收盘价 */
|
||||
@ApiModelProperty(value="收盘价")
|
||||
private String close;
|
||||
|
||||
/** 结算价 */
|
||||
@ApiModelProperty(value="结算价")
|
||||
private String settle;
|
||||
|
||||
/** 收盘价涨跌 */
|
||||
@ApiModelProperty(value="收盘价涨跌")
|
||||
private String change1;
|
||||
|
||||
/** 成交量(手) */
|
||||
@ApiModelProperty(value="成交量(手)")
|
||||
private String vol;
|
||||
|
||||
/** 成交金额(万元) */
|
||||
@ApiModelProperty(value="成交金额(万元)")
|
||||
private String amount;
|
||||
|
||||
/** 结算价涨跌 */
|
||||
@ApiModelProperty(value="结算价涨跌")
|
||||
private String change2;
|
||||
|
||||
/** 持仓量(手) */
|
||||
@ApiModelProperty(value="持仓量(手)")
|
||||
private String oi;
|
||||
|
||||
/** 持仓量变化 */
|
||||
@ApiModelProperty(value="持仓量变化")
|
||||
private String oiChg;
|
||||
|
||||
/** 交割结算价 */
|
||||
@ApiModelProperty(value="交割结算价")
|
||||
private String delvSettle;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.intc.invest.domain.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
/**
|
||||
* 股票日行情历史Dto对象 stocks_daily_history
|
||||
*
|
||||
* @author tianyongbao
|
||||
* @date 2025-04-01
|
||||
*/
|
||||
@ApiModel("股票日行情历史Dto对象")
|
||||
@Data
|
||||
public class StocksDailyHistoryDto implements Serializable
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** TS合约代码 */
|
||||
@ApiModelProperty(value="TS合约代码")
|
||||
private String tsCode;
|
||||
|
||||
/** 交易日期 */
|
||||
@ApiModelProperty(value="交易日期")
|
||||
private String tradeDate;
|
||||
|
||||
/** 交易类别 */
|
||||
@ApiModelProperty(value="开始日期")
|
||||
private String startTime;
|
||||
|
||||
/** 交易类别 */
|
||||
@ApiModelProperty(value="结束日期")
|
||||
private String endTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.intc.invest.domain.vo;
|
||||
|
||||
import com.intc.invest.domain.FuturesDailyHistory;
|
||||
import lombok.Data;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
/**
|
||||
* 期货日行情历史Vo对象 futures_daily_history
|
||||
*
|
||||
* @author tianyongbao
|
||||
* @date 2025-04-01
|
||||
*/
|
||||
@ApiModel("期货日行情历史Vo对象")
|
||||
@Data
|
||||
public class FuturesDailyHistoryVo extends FuturesDailyHistory
|
||||
{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.intc.invest.domain.vo;
|
||||
|
||||
import com.intc.invest.domain.StocksDailyHistory;
|
||||
import lombok.Data;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
/**
|
||||
* 股票日行情历史Vo对象 stocks_daily_history
|
||||
*
|
||||
* @author tianyongbao
|
||||
* @date 2025-04-01
|
||||
*/
|
||||
@ApiModel("股票日行情历史Vo对象")
|
||||
@Data
|
||||
public class StocksDailyHistoryVo extends StocksDailyHistory
|
||||
{
|
||||
private String amountName;
|
||||
|
||||
private String pctChgName;
|
||||
|
||||
private String stockName;
|
||||
|
||||
private String exchangeName;
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
package com.intc.invest.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.intc.invest.domain.FuturesDailyHistory;
|
||||
import com.intc.invest.domain.dto.FuturesDailyHistoryDto;
|
||||
import com.intc.invest.domain.vo.FuturesDailyHistoryVo;
|
||||
|
||||
/**
|
||||
* 期货日行情历史Mapper接口
|
||||
*
|
||||
* @author tianyongbao
|
||||
* @date 2025-04-01
|
||||
*/
|
||||
public interface FuturesDailyHistoryMapper
|
||||
{
|
||||
/**
|
||||
* 查询期货日行情历史
|
||||
*
|
||||
* @param id 期货日行情历史主键
|
||||
* @return 期货日行情历史
|
||||
*/
|
||||
public FuturesDailyHistoryVo selectFuturesDailyHistoryById(String id);
|
||||
|
||||
/**
|
||||
* 查询期货日行情历史列表
|
||||
*
|
||||
* @param futuresDailyHistoryDto 期货日行情历史
|
||||
* @return 期货日行情历史集合
|
||||
*/
|
||||
public List<FuturesDailyHistoryVo> selectFuturesDailyHistoryList(FuturesDailyHistoryDto futuresDailyHistoryDto);
|
||||
|
||||
/**
|
||||
* 新增期货日行情历史
|
||||
*
|
||||
* @param futuresDailyHistory 期货日行情历史
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertFuturesDailyHistory(FuturesDailyHistory futuresDailyHistory);
|
||||
|
||||
/**
|
||||
* 修改期货日行情历史
|
||||
*
|
||||
* @param futuresDailyHistory 期货日行情历史
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateFuturesDailyHistory(FuturesDailyHistory futuresDailyHistory);
|
||||
|
||||
/**
|
||||
* 删除期货日行情历史
|
||||
*
|
||||
* @param id 期货日行情历史主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteFuturesDailyHistoryById(String id);
|
||||
|
||||
/**
|
||||
* 批量删除期货日行情历史
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteFuturesDailyHistoryByIds(String[] ids);
|
||||
|
||||
/**
|
||||
* 逻辑删除期货日行情历史
|
||||
*
|
||||
* @param id 期货日行情历史主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int removeFuturesDailyHistoryById(String id);
|
||||
|
||||
/**
|
||||
* 批量逻辑删除期货日行情历史
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int removeFuturesDailyHistoryByIds(String[] ids);
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
package com.intc.invest.mapper;
|
||||
|
||||
import com.intc.invest.domain.StocksDailyHistory;
|
||||
import com.intc.invest.domain.dto.StocksDailyHistoryDto;
|
||||
import com.intc.invest.domain.vo.StocksDailyHistoryVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 股票日行情历史Mapper接口
|
||||
*
|
||||
* @author tianyongbao
|
||||
* @date 2025-04-01
|
||||
*/
|
||||
public interface StocksDailyHistoryMapper
|
||||
{
|
||||
/**
|
||||
* 查询股票日行情历史
|
||||
*
|
||||
* @param id 股票日行情历史主键
|
||||
* @return 股票日行情历史
|
||||
*/
|
||||
public StocksDailyHistoryVo selectStocksDailyHistoryById(Long id);
|
||||
|
||||
/**
|
||||
* 查询股票日行情历史列表
|
||||
*
|
||||
* @param stocksDailyHistoryDto 股票日行情历史
|
||||
* @return 股票日行情历史集合
|
||||
*/
|
||||
public List<StocksDailyHistoryVo> selectStocksDailyHistoryList(StocksDailyHistoryDto stocksDailyHistoryDto);
|
||||
|
||||
/**
|
||||
* 新增股票日行情历史
|
||||
*
|
||||
* @param stocksDailyHistory 股票日行情历史
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertStocksDailyHistory(StocksDailyHistory stocksDailyHistory);
|
||||
|
||||
/**
|
||||
* 修改股票日行情历史
|
||||
*
|
||||
* @param stocksDailyHistory 股票日行情历史
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateStocksDailyHistory(StocksDailyHistory stocksDailyHistory);
|
||||
|
||||
/**
|
||||
* 删除股票日行情历史
|
||||
*
|
||||
* @param id 股票日行情历史主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteStocksDailyHistoryById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除股票日行情历史
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteStocksDailyHistoryByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 逻辑删除股票日行情历史
|
||||
*
|
||||
* @param id 股票日行情历史主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int removeStocksDailyHistoryById(Long id);
|
||||
|
||||
/**
|
||||
* 批量逻辑删除股票日行情历史
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int removeStocksDailyHistoryByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 批量插入信息
|
||||
*
|
||||
* @param stocksDailyHistory 角色菜单列表
|
||||
* @return 结果
|
||||
*/
|
||||
public int batchInsertStocksDailyHistory(List<StocksDailyHistory> stocksDailyHistory);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package com.intc.invest.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.intc.invest.domain.FuturesDailyHistory;
|
||||
import com.intc.invest.domain.dto.FuturesDailyHistoryDto;
|
||||
import com.intc.invest.domain.vo.FuturesDailyHistoryVo;
|
||||
|
||||
/**
|
||||
* 期货日行情历史Service接口
|
||||
*
|
||||
* @author tianyongbao
|
||||
* @date 2025-04-01
|
||||
*/
|
||||
public interface IFuturesDailyHistoryService
|
||||
{
|
||||
/**
|
||||
* 查询期货日行情历史
|
||||
*
|
||||
* @param id 期货日行情历史主键
|
||||
* @return 期货日行情历史
|
||||
*/
|
||||
public FuturesDailyHistoryVo selectFuturesDailyHistoryById(String id);
|
||||
|
||||
/**
|
||||
* 查询期货日行情历史列表
|
||||
*
|
||||
* @param futuresDailyHistoryDto 期货日行情历史
|
||||
* @return 期货日行情历史集合
|
||||
*/
|
||||
public List<FuturesDailyHistoryVo> selectFuturesDailyHistoryList(FuturesDailyHistoryDto futuresDailyHistoryDto);
|
||||
|
||||
/**
|
||||
* 新增期货日行情历史
|
||||
*
|
||||
* @param futuresDailyHistory 期货日行情历史
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertFuturesDailyHistory(FuturesDailyHistory futuresDailyHistory);
|
||||
|
||||
/**
|
||||
* 修改期货日行情历史
|
||||
*
|
||||
* @param futuresDailyHistory 期货日行情历史
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateFuturesDailyHistory(FuturesDailyHistory futuresDailyHistory);
|
||||
|
||||
/**
|
||||
* 批量删除期货日行情历史
|
||||
*
|
||||
* @param ids 需要删除的期货日行情历史主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteFuturesDailyHistoryByIds(String[] ids);
|
||||
|
||||
/**
|
||||
* 删除期货日行情历史信息
|
||||
*
|
||||
* @param id 期货日行情历史主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteFuturesDailyHistoryById(String id);
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
package com.intc.invest.service;
|
||||
|
||||
import com.intc.invest.domain.StocksDailyHistory;
|
||||
import com.intc.invest.domain.TuShare;
|
||||
import com.intc.invest.domain.dto.StocksDailyHistoryDto;
|
||||
import com.intc.invest.domain.vo.StocksDailyHistoryVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 股票日行情历史Service接口
|
||||
*
|
||||
* @author tianyongbao
|
||||
* @date 2025-04-01
|
||||
*/
|
||||
public interface IStocksDailyHistoryService
|
||||
{
|
||||
/**
|
||||
* 查询股票日行情历史
|
||||
*
|
||||
* @param id 股票日行情历史主键
|
||||
* @return 股票日行情历史
|
||||
*/
|
||||
public StocksDailyHistoryVo selectStocksDailyHistoryById(Long id);
|
||||
|
||||
/**
|
||||
* 查询股票日行情历史列表
|
||||
*
|
||||
* @param stocksDailyHistoryDto 股票日行情历史
|
||||
* @return 股票日行情历史集合
|
||||
*/
|
||||
public List<StocksDailyHistoryVo> selectStocksDailyHistoryList(StocksDailyHistoryDto stocksDailyHistoryDto);
|
||||
|
||||
/**
|
||||
* 新增股票日行情历史
|
||||
*
|
||||
* @param stocksDailyHistory 股票日行情历史
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertStocksDailyHistory(StocksDailyHistory stocksDailyHistory);
|
||||
|
||||
/**
|
||||
* 修改股票日行情历史
|
||||
*
|
||||
* @param stocksDailyHistory 股票日行情历史
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateStocksDailyHistory(StocksDailyHistory stocksDailyHistory);
|
||||
|
||||
/**
|
||||
* 批量删除股票日行情历史
|
||||
*
|
||||
* @param ids 需要删除的股票日行情历史主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteStocksDailyHistoryByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除股票日行情历史信息
|
||||
*
|
||||
* @param id 股票日行情历史主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteStocksDailyHistoryById(Long id);
|
||||
|
||||
|
||||
/**
|
||||
* 同步股票日行情历史信息
|
||||
*
|
||||
* @param tuShare 股票日行情历史
|
||||
* @return 结果
|
||||
*/
|
||||
public void synStocksDailyHistory(TuShare tuShare);
|
||||
|
||||
/**
|
||||
* 同步当日股票日行情历史信息
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public void synTodayStocksDailyHistory();
|
||||
}
|
||||
@@ -7,7 +7,11 @@ import com.intc.common.security.utils.SecurityUtils;
|
||||
import com.intc.invest.domain.FutureBaseInfor;
|
||||
import com.intc.invest.domain.dto.FutureBaseInforDto;
|
||||
import com.intc.invest.domain.vo.FutureBaseInforVo;
|
||||
import com.intc.invest.domain.vo.FutureStandardInforVo;
|
||||
import com.intc.invest.domain.vo.InvestExchangeVo;
|
||||
import com.intc.invest.mapper.FutureBaseInforMapper;
|
||||
import com.intc.invest.mapper.FutureStandardInforMapper;
|
||||
import com.intc.invest.mapper.InvestExchangeMapper;
|
||||
import com.intc.invest.service.IFutureBaseInforService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -26,6 +30,12 @@ public class FutureBaseInforServiceImpl implements IFutureBaseInforService
|
||||
@Resource
|
||||
private FutureBaseInforMapper futureBaseInforMapper;
|
||||
|
||||
@Resource
|
||||
private InvestExchangeMapper investExchangeMapper;
|
||||
|
||||
@Resource
|
||||
private FutureStandardInforMapper futureStandardInforMapper;
|
||||
|
||||
/**
|
||||
* 查询期货基本合约
|
||||
*
|
||||
@@ -76,6 +86,9 @@ public class FutureBaseInforServiceImpl implements IFutureBaseInforService
|
||||
futureBaseInfor.setCreateBy(SecurityUtils.getUsername());
|
||||
futureBaseInfor.setCreateTime(DateUtils.getNowDate());
|
||||
futureBaseInfor.setId(IdWorker.getId());
|
||||
FutureStandardInforVo futureStandardInforVo = futureStandardInforMapper.selectFutureStandardInforById(futureBaseInfor.getStandardId());
|
||||
InvestExchangeVo investExchangeVo = investExchangeMapper.selectInvestExchangeById(futureStandardInforVo.getExchangeId());
|
||||
futureBaseInfor.setTsCode(futureBaseInfor.getCode()+investExchangeVo.getRemark());
|
||||
return futureBaseInforMapper.insertFutureBaseInfor(futureBaseInfor);
|
||||
}
|
||||
|
||||
@@ -90,6 +103,9 @@ public class FutureBaseInforServiceImpl implements IFutureBaseInforService
|
||||
{
|
||||
futureBaseInfor.setUpdateBy(SecurityUtils.getUsername());
|
||||
futureBaseInfor.setUpdateTime(DateUtils.getNowDate());
|
||||
FutureStandardInforVo futureStandardInforVo = futureStandardInforMapper.selectFutureStandardInforById(futureBaseInfor.getStandardId());
|
||||
InvestExchangeVo investExchangeVo = investExchangeMapper.selectInvestExchangeById(futureStandardInforVo.getExchangeId());
|
||||
futureBaseInfor.setTsCode(futureBaseInfor.getCode()+investExchangeVo.getRemark());
|
||||
return futureBaseInforMapper.updateFutureBaseInfor(futureBaseInfor);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,104 @@
|
||||
package com.intc.invest.service.impl;
|
||||
|
||||
import com.intc.common.core.utils.DateUtils;
|
||||
import com.intc.common.core.utils.IdWorker;
|
||||
import com.intc.common.security.utils.SecurityUtils;
|
||||
import com.intc.invest.domain.FuturesDailyHistory;
|
||||
import com.intc.invest.domain.dto.FuturesDailyHistoryDto;
|
||||
import com.intc.invest.domain.vo.FuturesDailyHistoryVo;
|
||||
import com.intc.invest.mapper.FuturesDailyHistoryMapper;
|
||||
import com.intc.invest.service.IFuturesDailyHistoryService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 期货日行情历史Service业务层处理
|
||||
*
|
||||
* @author tianyongbao
|
||||
* @date 2025-04-01
|
||||
*/
|
||||
@Service
|
||||
public class FuturesDailyHistoryServiceImpl implements IFuturesDailyHistoryService
|
||||
{
|
||||
@Resource
|
||||
private FuturesDailyHistoryMapper futuresDailyHistoryMapper;
|
||||
|
||||
/**
|
||||
* 查询期货日行情历史
|
||||
*
|
||||
* @param id 期货日行情历史主键
|
||||
* @return 期货日行情历史
|
||||
*/
|
||||
@Override
|
||||
public FuturesDailyHistoryVo selectFuturesDailyHistoryById(String id)
|
||||
{
|
||||
return futuresDailyHistoryMapper.selectFuturesDailyHistoryById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询期货日行情历史列表
|
||||
*
|
||||
* @param futuresDailyHistoryDto 期货日行情历史
|
||||
* @return 期货日行情历史
|
||||
*/
|
||||
@Override
|
||||
public List<FuturesDailyHistoryVo> selectFuturesDailyHistoryList(FuturesDailyHistoryDto futuresDailyHistoryDto)
|
||||
{
|
||||
return futuresDailyHistoryMapper.selectFuturesDailyHistoryList(futuresDailyHistoryDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增期货日行情历史
|
||||
*
|
||||
* @param futuresDailyHistory 期货日行情历史
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertFuturesDailyHistory(FuturesDailyHistory futuresDailyHistory)
|
||||
{
|
||||
futuresDailyHistory.setCreateBy(SecurityUtils.getUsername());
|
||||
futuresDailyHistory.setCreateTime(DateUtils.getNowDate());
|
||||
futuresDailyHistory.setId(IdWorker.getId());
|
||||
return futuresDailyHistoryMapper.insertFuturesDailyHistory(futuresDailyHistory);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改期货日行情历史
|
||||
*
|
||||
* @param futuresDailyHistory 期货日行情历史
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateFuturesDailyHistory(FuturesDailyHistory futuresDailyHistory)
|
||||
{
|
||||
futuresDailyHistory.setUpdateBy(SecurityUtils.getUsername());
|
||||
futuresDailyHistory.setUpdateTime(DateUtils.getNowDate());
|
||||
return futuresDailyHistoryMapper.updateFuturesDailyHistory(futuresDailyHistory);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除期货日行情历史
|
||||
*
|
||||
* @param ids 需要删除的期货日行情历史主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteFuturesDailyHistoryByIds(String[] ids)
|
||||
{
|
||||
return futuresDailyHistoryMapper.removeFuturesDailyHistoryByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除期货日行情历史信息
|
||||
*
|
||||
* @param id 期货日行情历史主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteFuturesDailyHistoryById(String id)
|
||||
{
|
||||
return futuresDailyHistoryMapper.removeFuturesDailyHistoryById(id);
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,9 @@ import com.intc.common.core.utils.IdWorker;
|
||||
import com.intc.common.security.utils.SecurityUtils;
|
||||
import com.intc.invest.domain.StockBaseInfor;
|
||||
import com.intc.invest.domain.dto.StockBaseInforDto;
|
||||
import com.intc.invest.domain.vo.InvestExchangeVo;
|
||||
import com.intc.invest.domain.vo.StockBaseInforVo;
|
||||
import com.intc.invest.mapper.InvestExchangeMapper;
|
||||
import com.intc.invest.mapper.StockBaseInforMapper;
|
||||
import com.intc.invest.service.IStockBaseInforService;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -25,6 +27,8 @@ public class StockBaseInforServiceImpl implements IStockBaseInforService
|
||||
@Resource
|
||||
private StockBaseInforMapper stockBaseInforMapper;
|
||||
|
||||
@Resource
|
||||
private InvestExchangeMapper investExchangeMapper;
|
||||
/**
|
||||
* 查询股票基础信息
|
||||
*
|
||||
@@ -61,6 +65,8 @@ public class StockBaseInforServiceImpl implements IStockBaseInforService
|
||||
stockBaseInfor.setCreateBy(SecurityUtils.getUsername());
|
||||
stockBaseInfor.setCreateTime(DateUtils.getNowDate());
|
||||
stockBaseInfor.setId(IdWorker.getId());
|
||||
InvestExchangeVo investExchangeVo = investExchangeMapper.selectInvestExchangeById(stockBaseInfor.getExchangeId());
|
||||
stockBaseInfor.setTsCode(stockBaseInfor.getCode()+investExchangeVo.getRemark());
|
||||
return stockBaseInforMapper.insertStockBaseInfor(stockBaseInfor);
|
||||
}
|
||||
|
||||
@@ -75,6 +81,8 @@ public class StockBaseInforServiceImpl implements IStockBaseInforService
|
||||
{
|
||||
stockBaseInfor.setUpdateBy(SecurityUtils.getUsername());
|
||||
stockBaseInfor.setUpdateTime(DateUtils.getNowDate());
|
||||
InvestExchangeVo investExchangeVo = investExchangeMapper.selectInvestExchangeById(stockBaseInfor.getExchangeId());
|
||||
stockBaseInfor.setTsCode(stockBaseInfor.getCode()+investExchangeVo.getRemark());
|
||||
return stockBaseInforMapper.updateStockBaseInfor(stockBaseInfor);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,226 @@
|
||||
package com.intc.invest.service.impl;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.alibaba.nacos.shaded.com.google.gson.Gson;
|
||||
import com.alibaba.nacos.shaded.com.google.gson.JsonObject;
|
||||
import com.intc.common.core.utils.DateUtils;
|
||||
import com.intc.common.core.utils.IdWorker;
|
||||
import com.intc.common.core.utils.http.HttpUtils;
|
||||
import com.intc.common.security.utils.SecurityUtils;
|
||||
import com.intc.invest.domain.StocksDailyHistory;
|
||||
import com.intc.invest.domain.TuShare;
|
||||
import com.intc.invest.domain.TuShareData;
|
||||
import com.intc.invest.domain.TuShareParams;
|
||||
import com.intc.invest.domain.dto.StockBaseInforDto;
|
||||
import com.intc.invest.domain.dto.StocksDailyHistoryDto;
|
||||
import com.intc.invest.domain.vo.StockBaseInforVo;
|
||||
import com.intc.invest.domain.vo.StocksDailyHistoryVo;
|
||||
import com.intc.invest.mapper.StockBaseInforMapper;
|
||||
import com.intc.invest.mapper.StocksDailyHistoryMapper;
|
||||
import com.intc.invest.service.IStocksDailyHistoryService;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 股票日行情历史Service业务层处理
|
||||
*
|
||||
* @author tianyongbao
|
||||
* @date 2025-04-01
|
||||
*/
|
||||
@Service
|
||||
public class StocksDailyHistoryServiceImpl implements IStocksDailyHistoryService {
|
||||
@Resource
|
||||
private StocksDailyHistoryMapper stocksDailyHistoryMapper;
|
||||
|
||||
@Resource
|
||||
private StockBaseInforMapper stockBaseInforMapper;
|
||||
|
||||
@Value("${config.tushareUrl}")
|
||||
private String tushareUrl;
|
||||
|
||||
@Value("${config.tushareToken}")
|
||||
private String tushareToken;
|
||||
|
||||
/**
|
||||
* 查询股票日行情历史
|
||||
*
|
||||
* @param id 股票日行情历史主键
|
||||
* @return 股票日行情历史
|
||||
*/
|
||||
@Override
|
||||
public StocksDailyHistoryVo selectStocksDailyHistoryById(Long id) {
|
||||
return stocksDailyHistoryMapper.selectStocksDailyHistoryById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询股票日行情历史列表
|
||||
*
|
||||
* @param stocksDailyHistoryDto 股票日行情历史
|
||||
* @return 股票日行情历史
|
||||
*/
|
||||
@Override
|
||||
public List<StocksDailyHistoryVo> selectStocksDailyHistoryList(StocksDailyHistoryDto stocksDailyHistoryDto) {
|
||||
List<StocksDailyHistoryVo> stocksDailyHistoryVoList = stocksDailyHistoryMapper.selectStocksDailyHistoryList(stocksDailyHistoryDto);
|
||||
DecimalFormat decimalFormat = new DecimalFormat("#.##");
|
||||
for (StocksDailyHistoryVo stocksDailyHistoryVo : stocksDailyHistoryVoList) {
|
||||
String amountName=decimalFormat.format(stocksDailyHistoryVo.getAmount()/100000);
|
||||
stocksDailyHistoryVo.setAmountName(amountName+"亿");
|
||||
String pctChgName=decimalFormat.format(stocksDailyHistoryVo.getPctChg());
|
||||
stocksDailyHistoryVo.setPctChgName(pctChgName+"%");
|
||||
}
|
||||
return stocksDailyHistoryVoList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增股票日行情历史
|
||||
*
|
||||
* @param stocksDailyHistory 股票日行情历史
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertStocksDailyHistory(StocksDailyHistory stocksDailyHistory) {
|
||||
stocksDailyHistory.setCreateBy(SecurityUtils.getUsername());
|
||||
stocksDailyHistory.setCreateTime(DateUtils.getNowDate());
|
||||
stocksDailyHistory.setId(IdWorker.getId());
|
||||
return stocksDailyHistoryMapper.insertStocksDailyHistory(stocksDailyHistory);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改股票日行情历史
|
||||
*
|
||||
* @param stocksDailyHistory 股票日行情历史
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateStocksDailyHistory(StocksDailyHistory stocksDailyHistory) {
|
||||
return stocksDailyHistoryMapper.updateStocksDailyHistory(stocksDailyHistory);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除股票日行情历史
|
||||
*
|
||||
* @param ids 需要删除的股票日行情历史主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteStocksDailyHistoryByIds(Long[] ids) {
|
||||
return stocksDailyHistoryMapper.removeStocksDailyHistoryByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除股票日行情历史信息
|
||||
*
|
||||
* @param id 股票日行情历史主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteStocksDailyHistoryById(Long id) {
|
||||
return stocksDailyHistoryMapper.removeStocksDailyHistoryById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 同步股票日行情历史
|
||||
*
|
||||
* @param tuShare 需要删除的股票日行情历史主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public void synStocksDailyHistory(TuShare tuShare) {
|
||||
|
||||
tuShare.setToken(tushareToken);
|
||||
tuShare.setApi_name("daily");
|
||||
Gson gson = new Gson();
|
||||
JsonObject json = gson.toJsonTree(tuShare).getAsJsonObject();
|
||||
Map<String, String> headers = new HashMap<String, String>();
|
||||
headers.put("X-Ca-Signature-Headers", "x-ca-key,x-ca-timestamp");
|
||||
String returnString = HttpUtils.sendSSLPost(tushareUrl, null, JSONObject.parseObject(json.toString()), headers);
|
||||
com.alibaba.fastjson.JSONObject jsonObject = com.alibaba.fastjson.JSONObject.parseObject(returnString);
|
||||
TuShareData data = JSON.parseObject(jsonObject.getString("data"), TuShareData.class);
|
||||
List<List<String>> itemList = data.getItems();
|
||||
List<StocksDailyHistory> stocksDailyHistoryList = new ArrayList<>();
|
||||
for (List<String> item : itemList) {
|
||||
StocksDailyHistory stocksDailyHistory = getStocksDailyHistory(item,tuShare.getParams());
|
||||
stocksDailyHistoryList.add(stocksDailyHistory);
|
||||
}
|
||||
//批量插入数据
|
||||
if(stocksDailyHistoryList.size()>0){
|
||||
stocksDailyHistoryMapper.batchInsertStocksDailyHistory(stocksDailyHistoryList);
|
||||
}
|
||||
}
|
||||
|
||||
private static StocksDailyHistory getStocksDailyHistory(List<String> item,TuShareParams tuShareParams) {
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
|
||||
StocksDailyHistory stocksDailyHistory = new StocksDailyHistory();
|
||||
stocksDailyHistory.setId(IdWorker.getId());
|
||||
stocksDailyHistory.setStockId(tuShareParams.getTs_id());
|
||||
stocksDailyHistory.setCreateBy(SecurityUtils.getUsername());
|
||||
stocksDailyHistory.setCreateTime(DateUtils.getNowDate());
|
||||
stocksDailyHistory.setTsCode(item.get(0));
|
||||
try {
|
||||
stocksDailyHistory.setTradeDate(dateFormat.parse(item.get(1)));
|
||||
} catch (ParseException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
stocksDailyHistory.setOpen(Double.parseDouble(item.get(2)));
|
||||
stocksDailyHistory.setHigh(Double.parseDouble(item.get(3)));
|
||||
stocksDailyHistory.setLow(Double.parseDouble(item.get(4)));
|
||||
stocksDailyHistory.setClose(Double.parseDouble(item.get(5)));
|
||||
stocksDailyHistory.setPreClose(Double.parseDouble(item.get(6)));
|
||||
stocksDailyHistory.setChange(Double.parseDouble(item.get(7)));
|
||||
stocksDailyHistory.setPctChg(Double.parseDouble(item.get(8)));
|
||||
stocksDailyHistory.setVol(Double.parseDouble(item.get(9)));
|
||||
stocksDailyHistory.setAmount(Double.parseDouble(item.get(10)));
|
||||
return stocksDailyHistory;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 同步当天股票日行情历史
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public void synTodayStocksDailyHistory() {
|
||||
List<StockBaseInforVo> stockBaseInforVos=stockBaseInforMapper.selectStockBaseInforList(new StockBaseInforDto());
|
||||
//
|
||||
for (StockBaseInforVo base : stockBaseInforVos) {
|
||||
TuShare tuShare = new TuShare();
|
||||
tuShare.setToken(tushareToken);
|
||||
tuShare.setApi_name("daily");
|
||||
TuShareParams tuShareParams = new TuShareParams();
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
|
||||
tuShareParams.setTs_code(base.getTsCode());
|
||||
tuShareParams.setTs_id(base.getId());
|
||||
tuShareParams.setEnd_date(dateFormat.format(new Date()));
|
||||
tuShareParams.setEnd_date(dateFormat.format(new Date()));
|
||||
tuShare.setParams(tuShareParams);
|
||||
Gson gson = new Gson();
|
||||
JsonObject json = gson.toJsonTree(tuShare).getAsJsonObject();
|
||||
Map<String, String> headers = new HashMap<String, String>();
|
||||
headers.put("X-Ca-Signature-Headers", "x-ca-key,x-ca-timestamp");
|
||||
String returnString = HttpUtils.sendSSLPost(tushareUrl, null, JSONObject.parseObject(json.toString()), headers);
|
||||
com.alibaba.fastjson.JSONObject jsonObject = com.alibaba.fastjson.JSONObject.parseObject(returnString);
|
||||
TuShareData data = JSON.parseObject(jsonObject.getString("data"), TuShareData.class);
|
||||
List<List<String>> itemList = data.getItems();
|
||||
List<StocksDailyHistory> stocksDailyHistoryList = new ArrayList<>();
|
||||
for (List<String> item : itemList) {
|
||||
StocksDailyHistory stocksDailyHistory = getStocksDailyHistory(item,tuShareParams);
|
||||
stocksDailyHistoryList.add(stocksDailyHistory);
|
||||
}
|
||||
//批量插入数据
|
||||
if(stocksDailyHistoryList.size()>0){
|
||||
stocksDailyHistoryMapper.batchInsertStocksDailyHistory(stocksDailyHistoryList);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package com.intc.job.controller;
|
||||
import com.intc.common.core.utils.DateUtils;
|
||||
import com.intc.common.core.web.domain.AjaxResult;
|
||||
import com.intc.invest.service.IMTService;
|
||||
import com.intc.invest.service.IStocksDailyHistoryService;
|
||||
import com.intc.invest.service.IUserService;
|
||||
import com.intc.job.service.IInvestJobService;
|
||||
import io.swagger.annotations.Api;
|
||||
@@ -30,6 +31,9 @@ public class InvestJob
|
||||
@Resource
|
||||
private IUserService iUserService;
|
||||
|
||||
@Resource
|
||||
private IStocksDailyHistoryService stocksDailyHistoryService;
|
||||
|
||||
@PostMapping("/generateUnpaidCreditBill")
|
||||
public AjaxResult generateUnpaidCreditBill()
|
||||
{
|
||||
@@ -118,6 +122,18 @@ public class InvestJob
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 同步当日股票日数据
|
||||
*/
|
||||
@PostMapping("/synStocksDailyHistory")
|
||||
public AjaxResult synTodayStocksDailyHistory()
|
||||
{
|
||||
System.out.println("================================开始同步当天股票日行情数据("+ DateUtils.getTime() +")=================================");
|
||||
stocksDailyHistoryService.synTodayStocksDailyHistory();
|
||||
System.out.println("================================结束同步当天股票日行情数据("+ DateUtils.getTime() +")=================================");
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -50,6 +50,10 @@ public class InvestJobImpl implements IInvestJobService
|
||||
@Resource
|
||||
private FutureStocksMapper futureStocksMapper;
|
||||
|
||||
@Resource
|
||||
private StocksDailyHistoryMapper stocksDailyHistoryMapper;
|
||||
|
||||
|
||||
/**
|
||||
* 生成数据
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user