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;
|
||||
|
||||
|
||||
/**
|
||||
* 生成数据
|
||||
*
|
||||
|
||||
@@ -26,6 +26,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="delFlag" column="del_flag" />
|
||||
<result property="remark" column="remark" />
|
||||
<result property="listingDate" column="listing_date" />
|
||||
<result property="tsCode" column="ts_code" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectFutureBaseInforVo">
|
||||
@@ -48,6 +49,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
a.del_flag,
|
||||
a.remark,
|
||||
a.listing_date,
|
||||
a.ts_code,
|
||||
ie."name" as exchange_name,
|
||||
ifsi."name" as standard_name,
|
||||
ifsi.trading_time
|
||||
@@ -95,6 +97,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="delFlag != null">del_flag,</if>
|
||||
<if test="remark != null">remark,</if>
|
||||
<if test="listingDate != null">listing_date,</if>
|
||||
<if test="tsCode != null">ts_code,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">#{id},</if>
|
||||
@@ -115,6 +118,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="delFlag != null">#{delFlag},</if>
|
||||
<if test="remark != null">#{remark},</if>
|
||||
<if test="listingDate != null">#{listingDate},</if>
|
||||
<if test="tsCode != null">#{tsCode},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
@@ -138,6 +142,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="delFlag != null">del_flag = #{delFlag},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
<if test="listingDate != null">listing_date = #{listingDate},</if>
|
||||
<if test="tsCode != null">ts_code = #{tsCode},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
@@ -0,0 +1,169 @@
|
||||
<?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.intc.invest.mapper.FuturesDailyHistoryMapper">
|
||||
|
||||
<resultMap type="FuturesDailyHistoryVo" id="FuturesDailyHistoryResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="tsCode" column="ts_code" />
|
||||
<result property="tradeDate" column="trade_date" />
|
||||
<result property="preClose" column="pre_close" />
|
||||
<result property="preSettle" column="pre_settle" />
|
||||
<result property="open" column="open" />
|
||||
<result property="high" column="high" />
|
||||
<result property="low" column="low" />
|
||||
<result property="close" column="close" />
|
||||
<result property="settle" column="settle" />
|
||||
<result property="change1" column="change1" />
|
||||
<result property="vol" column="vol" />
|
||||
<result property="amount" column="amount" />
|
||||
<result property="change2" column="change2" />
|
||||
<result property="oi" column="oi" />
|
||||
<result property="oiChg" column="oi_chg" />
|
||||
<result property="delvSettle" column="delv_settle" />
|
||||
<result property="remark" column="remark" />
|
||||
<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="delFlag" column="del_flag" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectFuturesDailyHistoryVo">
|
||||
select a.id, a.ts_code, a.trade_date, a.pre_close, a.pre_settle, a.open, a.high, a.low, a.close, a.settle, a.change1, a.vol, a.amount, a.change2, a.oi, a.oi_chg, a.delv_settle, a.remark, a.create_by, a.create_time, a.update_by, a.update_time, a.del_flag from futures_daily_history a
|
||||
</sql>
|
||||
|
||||
<select id="selectFuturesDailyHistoryList" parameterType="FuturesDailyHistoryDto" resultMap="FuturesDailyHistoryResult">
|
||||
<include refid="selectFuturesDailyHistoryVo"/>
|
||||
<where>
|
||||
a.del_flag='0'
|
||||
<if test="tsCode != null and tsCode != ''"> and a.ts_code = #{tsCode}</if>
|
||||
<if test="tradeDate != null and tradeDate != ''"> and a.trade_date = #{tradeDate}</if>
|
||||
<if test="preClose != null and preClose != ''"> and a.pre_close = #{preClose}</if>
|
||||
<if test="preSettle != null and preSettle != ''"> and a.pre_settle = #{preSettle}</if>
|
||||
<if test="open != null and open != ''"> and a.open = #{open}</if>
|
||||
<if test="high != null and high != ''"> and a.high = #{high}</if>
|
||||
<if test="low != null and low != ''"> and a.low = #{low}</if>
|
||||
<if test="close != null and close != ''"> and a.close = #{close}</if>
|
||||
<if test="settle != null and settle != ''"> and a.settle = #{settle}</if>
|
||||
<if test="change1 != null and change1 != ''"> and a.change1 = #{change1}</if>
|
||||
<if test="vol != null and vol != ''"> and a.vol = #{vol}</if>
|
||||
<if test="amount != null and amount != ''"> and a.amount = #{amount}</if>
|
||||
<if test="change2 != null and change2 != ''"> and a.change2 = #{change2}</if>
|
||||
<if test="oi != null and oi != ''"> and a.oi = #{oi}</if>
|
||||
<if test="oiChg != null and oiChg != ''"> and a.oi_chg = #{oiChg}</if>
|
||||
<if test="delvSettle != null and delvSettle != ''"> and a.delv_settle = #{delvSettle}</if>
|
||||
</where>
|
||||
order by a.create_time desc
|
||||
</select>
|
||||
|
||||
<select id="selectFuturesDailyHistoryById" parameterType="String" resultMap="FuturesDailyHistoryResult">
|
||||
<include refid="selectFuturesDailyHistoryVo"/>
|
||||
where a.id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertFuturesDailyHistory" parameterType="FuturesDailyHistory">
|
||||
insert into futures_daily_history
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">id,</if>
|
||||
<if test="tsCode != null">ts_code,</if>
|
||||
<if test="tradeDate != null">trade_date,</if>
|
||||
<if test="preClose != null">pre_close,</if>
|
||||
<if test="preSettle != null">pre_settle,</if>
|
||||
<if test="open != null">open,</if>
|
||||
<if test="high != null">high,</if>
|
||||
<if test="low != null">low,</if>
|
||||
<if test="close != null">close,</if>
|
||||
<if test="settle != null">settle,</if>
|
||||
<if test="change1 != null">change1,</if>
|
||||
<if test="vol != null">vol,</if>
|
||||
<if test="amount != null">amount,</if>
|
||||
<if test="change2 != null">change2,</if>
|
||||
<if test="oi != null">oi,</if>
|
||||
<if test="oiChg != null">oi_chg,</if>
|
||||
<if test="delvSettle != null">delv_settle,</if>
|
||||
<if test="remark != null">remark,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="delFlag != null">del_flag,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">#{id},</if>
|
||||
<if test="tsCode != null">#{tsCode},</if>
|
||||
<if test="tradeDate != null">#{tradeDate},</if>
|
||||
<if test="preClose != null">#{preClose},</if>
|
||||
<if test="preSettle != null">#{preSettle},</if>
|
||||
<if test="open != null">#{open},</if>
|
||||
<if test="high != null">#{high},</if>
|
||||
<if test="low != null">#{low},</if>
|
||||
<if test="close != null">#{close},</if>
|
||||
<if test="settle != null">#{settle},</if>
|
||||
<if test="change1 != null">#{change1},</if>
|
||||
<if test="vol != null">#{vol},</if>
|
||||
<if test="amount != null">#{amount},</if>
|
||||
<if test="change2 != null">#{change2},</if>
|
||||
<if test="oi != null">#{oi},</if>
|
||||
<if test="oiChg != null">#{oiChg},</if>
|
||||
<if test="delvSettle != null">#{delvSettle},</if>
|
||||
<if test="remark != null">#{remark},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="delFlag != null">#{delFlag},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateFuturesDailyHistory" parameterType="FuturesDailyHistory">
|
||||
update futures_daily_history
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="tsCode != null">ts_code = #{tsCode},</if>
|
||||
<if test="tradeDate != null">trade_date = #{tradeDate},</if>
|
||||
<if test="preClose != null">pre_close = #{preClose},</if>
|
||||
<if test="preSettle != null">pre_settle = #{preSettle},</if>
|
||||
<if test="open != null">open = #{open},</if>
|
||||
<if test="high != null">high = #{high},</if>
|
||||
<if test="low != null">low = #{low},</if>
|
||||
<if test="close != null">close = #{close},</if>
|
||||
<if test="settle != null">settle = #{settle},</if>
|
||||
<if test="change1 != null">change1 = #{change1},</if>
|
||||
<if test="vol != null">vol = #{vol},</if>
|
||||
<if test="amount != null">amount = #{amount},</if>
|
||||
<if test="change2 != null">change2 = #{change2},</if>
|
||||
<if test="oi != null">oi = #{oi},</if>
|
||||
<if test="oiChg != null">oi_chg = #{oiChg},</if>
|
||||
<if test="delvSettle != null">delv_settle = #{delvSettle},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="delFlag != null">del_flag = #{delFlag},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteFuturesDailyHistoryById" parameterType="String">
|
||||
delete from futures_daily_history where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteFuturesDailyHistoryByIds" parameterType="String">
|
||||
delete from futures_daily_history where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
<update id="removeFuturesDailyHistoryById" parameterType="String">
|
||||
update futures_daily_history set del_flag='1' where id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="removeFuturesDailyHistoryByIds" parameterType="String">
|
||||
update futures_daily_history set del_flag='1' where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</update>
|
||||
</mapper>
|
||||
@@ -23,6 +23,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="region" column="region" />
|
||||
<result property="shortName" column="short_name" />
|
||||
<result property="exchangeName" column="exchange_name" />
|
||||
<result property="tsCode" column="ts_code" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectStockBaseInforVo">
|
||||
@@ -44,6 +45,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
a.introduce,
|
||||
a.region,
|
||||
a.short_name,
|
||||
a.ts_code,
|
||||
ie."name" as exchange_name
|
||||
from
|
||||
invest_stock_base_infor a
|
||||
@@ -90,6 +92,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="introduce != null">introduce,</if>
|
||||
<if test="region != null">region,</if>
|
||||
<if test="shortName != null and shortName != ''">short_name,</if>
|
||||
<if test="tsCode != null">ts_code,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">#{id},</if>
|
||||
@@ -109,6 +112,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="introduce != null">#{introduce},</if>
|
||||
<if test="region != null">#{region},</if>
|
||||
<if test="shortName != null and shortName != ''">#{shortName},</if>
|
||||
<if test="tsCode != null">#{tsCode},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
@@ -131,6 +135,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="introduce != null">introduce = #{introduce},</if>
|
||||
<if test="region != null">region = #{region},</if>
|
||||
<if test="shortName != null and shortName != ''">short_name = #{shortName},</if>
|
||||
<if test="tsCode != null">ts_code = #{tsCode},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
@@ -0,0 +1,197 @@
|
||||
<?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.intc.invest.mapper.StocksDailyHistoryMapper">
|
||||
|
||||
<resultMap type="StocksDailyHistoryVo" id="StocksDailyHistoryResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="tsCode" column="ts_code" />
|
||||
<result property="tradeDate" column="trade_date" />
|
||||
<result property="open" column="open" />
|
||||
<result property="high" column="high" />
|
||||
<result property="low" column="low" />
|
||||
<result property="close" column="close" />
|
||||
<result property="preClose" column="pre_close" />
|
||||
<result property="change" column="change" />
|
||||
<result property="pctChg" column="pct_chg" />
|
||||
<result property="vol" column="vol" />
|
||||
<result property="amount" column="amount" />
|
||||
<result property="remark" column="remark" />
|
||||
<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="delFlag" column="del_flag" />
|
||||
<result property="stockId" column="stock_id" />
|
||||
<result property="stockName" column="stock_name" />
|
||||
<result property="exchangeName" column="exchange_name" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectStocksDailyHistoryVo">
|
||||
select
|
||||
a.id,
|
||||
a.ts_code,
|
||||
a.stock_id,
|
||||
a.trade_date,
|
||||
a.open,
|
||||
a.high,
|
||||
a.low,
|
||||
a.close,
|
||||
a.pre_close,
|
||||
a.change,
|
||||
a.pct_chg,
|
||||
a.vol,
|
||||
a.amount,
|
||||
a.remark,
|
||||
a.create_by,
|
||||
a.create_time,
|
||||
a.update_by,
|
||||
a.update_time,
|
||||
a.del_flag,
|
||||
isbi.short_name as stock_name,
|
||||
ie.short_name as exchange_name
|
||||
from
|
||||
stocks_daily_history a
|
||||
left join invest_stock_base_infor isbi on
|
||||
isbi.id = a.stock_id
|
||||
left join invest_exchange ie on
|
||||
ie.id = isbi.exchange_id
|
||||
|
||||
</sql>
|
||||
|
||||
<select id="selectStocksDailyHistoryList" parameterType="StocksDailyHistoryDto" resultMap="StocksDailyHistoryResult">
|
||||
<include refid="selectStocksDailyHistoryVo"/>
|
||||
<where>
|
||||
a.del_flag='0'
|
||||
<if test="tsCode != null and tsCode != ''"> and (a.ts_code like '%'|| #{tsCode}||'%' or isbi.short_name like '%'|| #{tsCode}||'%')</if>
|
||||
<if test="endTime!=null and endTime !=''">
|
||||
and #{endTime}>=to_char(a.trade_date, 'yyyy-MM-dd')
|
||||
</if>
|
||||
<if test="startTime!=null and startTime !=''">
|
||||
and to_char(a.trade_date, 'yyyy-MM-dd')>=#{startTime}
|
||||
</if>
|
||||
</where>
|
||||
order by a.trade_date desc
|
||||
</select>
|
||||
|
||||
<select id="selectStocksDailyHistoryById" parameterType="Long" resultMap="StocksDailyHistoryResult">
|
||||
<include refid="selectStocksDailyHistoryVo"/>
|
||||
where a.id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertStocksDailyHistory" parameterType="StocksDailyHistory">
|
||||
insert into stocks_daily_history
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">id,</if>
|
||||
<if test="tsCode != null">ts_code,</if>
|
||||
<if test="tradeDate != null">trade_date,</if>
|
||||
<if test="open != null">open,</if>
|
||||
<if test="high != null">high,</if>
|
||||
<if test="low != null">low,</if>
|
||||
<if test="close != null">close,</if>
|
||||
<if test="preClose != null">pre_close,</if>
|
||||
<if test="change != null">change,</if>
|
||||
<if test="pctChg != null">pct_chg,</if>
|
||||
<if test="vol != null">vol,</if>
|
||||
<if test="amount != null">amount,</if>
|
||||
<if test="remark != null">remark,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="delFlag != null">del_flag,</if>
|
||||
<if test="stockId != null">stock_id,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">#{id},</if>
|
||||
<if test="tsCode != null">#{tsCode},</if>
|
||||
<if test="tradeDate != null">#{tradeDate},</if>
|
||||
<if test="open != null">#{open},</if>
|
||||
<if test="high != null">#{high},</if>
|
||||
<if test="low != null">#{low},</if>
|
||||
<if test="close != null">#{close},</if>
|
||||
<if test="preClose != null">#{preClose},</if>
|
||||
<if test="change != null">#{change},</if>
|
||||
<if test="pctChg != null">#{pctChg},</if>
|
||||
<if test="vol != null">#{vol},</if>
|
||||
<if test="amount != null">#{amount},</if>
|
||||
<if test="remark != null">#{remark},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="delFlag != null">#{delFlag},</if>
|
||||
<if test="stockId != null">#{stockId},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateStocksDailyHistory" parameterType="StocksDailyHistory">
|
||||
update stocks_daily_history
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="tsCode != null">ts_code = #{tsCode},</if>
|
||||
<if test="tradeDate != null">trade_date = #{tradeDate},</if>
|
||||
<if test="open != null">open = #{open},</if>
|
||||
<if test="high != null">high = #{high},</if>
|
||||
<if test="low != null">low = #{low},</if>
|
||||
<if test="close != null">close = #{close},</if>
|
||||
<if test="preClose != null">pre_close = #{preClose},</if>
|
||||
<if test="change != null">change = #{change},</if>
|
||||
<if test="pctChg != null">pct_chg = #{pctChg},</if>
|
||||
<if test="vol != null">vol = #{vol},</if>
|
||||
<if test="amount != null">amount = #{amount},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="delFlag != null">del_flag = #{delFlag},</if>
|
||||
<if test="stockId != null">stock_id = #{stockId},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteStocksDailyHistoryById" parameterType="Long">
|
||||
delete from stocks_daily_history where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteStocksDailyHistoryByIds" parameterType="String">
|
||||
delete from stocks_daily_history where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
<update id="removeStocksDailyHistoryById" parameterType="Long">
|
||||
update stocks_daily_history set del_flag='1' where id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="removeStocksDailyHistoryByIds" parameterType="String">
|
||||
update stocks_daily_history set del_flag='1' where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</update>
|
||||
<insert id="batchInsertStocksDailyHistory">
|
||||
insert into stocks_daily_history(id, stock_id, ts_code, trade_date, open, high, low, close, pre_close, change, pct_chg, vol, amount, remark, create_by, create_time, update_by, update_time) values
|
||||
<foreach item="item" index="index" collection="list" separator=",">
|
||||
(#{item.id},
|
||||
#{item.stockId},
|
||||
#{item.tsCode},
|
||||
#{item.tradeDate},
|
||||
#{item.open},
|
||||
#{item.high},
|
||||
#{item.low},
|
||||
#{item.close},
|
||||
#{item.preClose},
|
||||
#{item.change},
|
||||
#{item.pctChg},
|
||||
#{item.vol},
|
||||
#{item.amount},
|
||||
#{item.remark},
|
||||
#{item.createBy},
|
||||
#{item.createTime},
|
||||
#{item.updateBy},
|
||||
#{item.updateTime})
|
||||
</foreach>
|
||||
</insert>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user