You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
148 lines
5.2 KiB
148 lines
5.2 KiB
package com.ruoyi.stocksystem.controller;
|
|
|
|
import java.text.ParseException;
|
|
import java.text.SimpleDateFormat;
|
|
import java.util.Date;
|
|
import java.util.List;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
import com.ruoyi.stocksystem.domain.Stocks;
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
import org.springframework.web.bind.annotation.PutMapping;
|
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
|
import org.springframework.web.bind.annotation.PathVariable;
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
import com.ruoyi.common.annotation.Log;
|
|
import com.ruoyi.common.core.controller.BaseController;
|
|
import com.ruoyi.common.core.domain.AjaxResult;
|
|
import com.ruoyi.common.enums.BusinessType;
|
|
import com.ruoyi.stocksystem.domain.StocksLimit;
|
|
import com.ruoyi.stocksystem.service.IStocksLimitService;
|
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
|
import com.ruoyi.common.core.page.TableDataInfo;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
/**
|
|
* 每日涨跌停板Controller
|
|
*
|
|
* @author lxy
|
|
* @date 2022-02-02
|
|
*/
|
|
@RestController
|
|
@RequestMapping("/stocksystem/stockslimit")
|
|
public class StocksLimitController extends BaseController
|
|
{
|
|
@Autowired
|
|
private IStocksLimitService stocksLimitService;
|
|
|
|
/**
|
|
* 查询每日涨跌停板列表
|
|
*/
|
|
@PreAuthorize("@ss.hasPermi('stocksystem:stockslimit:list')")
|
|
@GetMapping("/list")
|
|
public TableDataInfo list(StocksLimit stocksLimit)
|
|
{
|
|
startPage();
|
|
List<StocksLimit> list = stocksLimitService.selectStocksLimitList(stocksLimit);
|
|
return getDataTable(list);
|
|
}
|
|
|
|
/**
|
|
* 查询每日涨跌停板列表
|
|
*/
|
|
@GetMapping("/grouplist")
|
|
public TableDataInfo grouplist(StocksLimit stocksLimit)
|
|
{
|
|
// startPage();
|
|
List<StocksLimit> list = stocksLimitService.selectGroupStocksLimit(stocksLimit);
|
|
return getDataTable(list);
|
|
}
|
|
|
|
/**
|
|
* 导出每日涨跌停板列表
|
|
*/
|
|
@PreAuthorize("@ss.hasPermi('stocksystem:stockslimit:export')")
|
|
@Log(title = "每日涨跌停板", businessType = BusinessType.EXPORT)
|
|
@PostMapping("/export")
|
|
public void export(HttpServletResponse response, StocksLimit stocksLimit)
|
|
{
|
|
List<StocksLimit> list = stocksLimitService.selectStocksLimitList(stocksLimit);
|
|
ExcelUtil<StocksLimit> util = new ExcelUtil<StocksLimit>(StocksLimit.class);
|
|
util.exportExcel(response, list, "每日涨跌停板数据");
|
|
}
|
|
|
|
@Log(title = "涨跌停数据导入", businessType = BusinessType.IMPORT)
|
|
@PreAuthorize("@ss.hasPermi('stocksystem:stockslimit:import')")
|
|
@PostMapping("/importData")
|
|
public AjaxResult importData(MultipartFile file, boolean updateSupport, String s) throws Exception
|
|
{
|
|
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");//注意月份是MM
|
|
System.out.println(" tradeDay :" + s);
|
|
Date tradeDay1 = null;
|
|
try
|
|
{
|
|
tradeDay1 = simpleDateFormat.parse(s);
|
|
}catch (ParseException e) {
|
|
e.printStackTrace();
|
|
}
|
|
if(tradeDay1 == null)
|
|
{
|
|
return AjaxResult.success("failed");
|
|
}
|
|
ExcelUtil<StocksLimit> stockslimit = new ExcelUtil<StocksLimit>(StocksLimit.class);
|
|
List<StocksLimit> stockLimitList = stockslimit.importExcel(file.getInputStream());
|
|
System.out.println("stockLimitList count : " + stockLimitList.size() + " tradeDay :" + s);
|
|
String operName = getUsername();
|
|
String message = stocksLimitService.importStock(stockLimitList, updateSupport, operName, s);
|
|
return AjaxResult.success(message);
|
|
}
|
|
|
|
/**
|
|
* 获取每日涨跌停板详细信息
|
|
*/
|
|
@PreAuthorize("@ss.hasPermi('stocksystem:stockslimit:query')")
|
|
@GetMapping(value = "/{id}")
|
|
public AjaxResult getInfo(@PathVariable("id") Long id)
|
|
{
|
|
return AjaxResult.success(stocksLimitService.selectStocksLimitById(id));
|
|
}
|
|
|
|
/**
|
|
* 新增每日涨跌停板
|
|
*/
|
|
@PreAuthorize("@ss.hasPermi('stocksystem:stockslimit:add')")
|
|
@Log(title = "每日涨跌停板", businessType = BusinessType.INSERT)
|
|
@PostMapping
|
|
public AjaxResult add(@RequestBody StocksLimit stocksLimit)
|
|
{
|
|
return toAjax(stocksLimitService.insertStocksLimit(stocksLimit));
|
|
}
|
|
|
|
/**
|
|
* 修改每日涨跌停板
|
|
*/
|
|
@PreAuthorize("@ss.hasPermi('stocksystem:stockslimit:edit')")
|
|
@Log(title = "每日涨跌停板", businessType = BusinessType.UPDATE)
|
|
@PutMapping
|
|
public AjaxResult edit(@RequestBody StocksLimit stocksLimit)
|
|
{
|
|
return toAjax(stocksLimitService.updateStocksLimit(stocksLimit));
|
|
}
|
|
|
|
/**
|
|
* 删除每日涨跌停板
|
|
*/
|
|
@PreAuthorize("@ss.hasPermi('stocksystem:stockslimit:remove')")
|
|
@Log(title = "每日涨跌停板", businessType = BusinessType.DELETE)
|
|
@DeleteMapping("/{ids}")
|
|
public AjaxResult remove(@PathVariable Long[] ids)
|
|
{
|
|
return toAjax(stocksLimitService.deleteStocksLimitByIds(ids));
|
|
}
|
|
}
|