|
|
|
@ -13,7 +13,8 @@ import io.swagger.annotations.ApiParam;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.sql.Timestamp;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
|
|
|
|
|
@Api(tags = "预警页面")
|
|
|
|
|
@RestController
|
|
|
|
@ -165,8 +166,11 @@ public class WarningController {
|
|
|
|
|
//删除持仓时长预警
|
|
|
|
|
@DeleteMapping("/deleteAlertHoldDuration")
|
|
|
|
|
@ApiOperation("删除持仓时长预警")
|
|
|
|
|
public String deleteAlertHoldDuration(@ApiParam("id") @RequestParam String id) {
|
|
|
|
|
alertHoldDurationMapper.deleteByPrimaryKey(id);
|
|
|
|
|
public String deleteAlertHoldDuration(@ApiParam("交易品种") @RequestParam String symbol,
|
|
|
|
|
@ApiParam("持仓预警时长") @RequestParam String warningHoldDuration) {
|
|
|
|
|
AlertHoldDurationExample alertHoldDurationExample = new AlertHoldDurationExample();
|
|
|
|
|
alertHoldDurationExample.createCriteria().andWariningHoldDurationEqualTo(warningHoldDuration).andSymbolEqualTo(symbol);
|
|
|
|
|
alertHoldDurationMapper.deleteByExample(alertHoldDurationExample);
|
|
|
|
|
return "删除成功";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -175,17 +179,15 @@ public class WarningController {
|
|
|
|
|
@PutMapping("/setAlertHoldDuration")
|
|
|
|
|
@ApiOperation("启用或关闭持仓时长预警")
|
|
|
|
|
public void setAlertHoldDuration(@ApiParam("0 停用 1 启用") @RequestParam Integer status,
|
|
|
|
|
@ApiParam("id") @RequestParam String id) {
|
|
|
|
|
// AlertHoldDurationExample alertHoldDurationExample = new AlertHoldDurationExample();
|
|
|
|
|
// alertHoldDurationExample.createCriteria().andSymbolEqualTo(symbol);
|
|
|
|
|
// List<AlertHoldDuration> alertHoldDurations = alertHoldDurationMapper.selectByExample(alertHoldDurationExample);
|
|
|
|
|
// for (AlertHoldDuration alertHoldDuration : alertHoldDurations) {
|
|
|
|
|
// alertHoldDuration.setStatus(status);
|
|
|
|
|
// alertHoldDurationMapper.updateByPrimaryKeySelective(alertHoldDuration);
|
|
|
|
|
// }
|
|
|
|
|
AlertHoldDuration alertHoldDuration = alertHoldDurationMapper.selectByPrimaryKey(id);
|
|
|
|
|
alertHoldDuration.setStatus(status);
|
|
|
|
|
alertHoldDurationMapper.updateByPrimaryKeySelective(alertHoldDuration);
|
|
|
|
|
@ApiParam("交易品种") @RequestParam String symbol,
|
|
|
|
|
@ApiParam("持仓预警时长") @RequestParam String warningHoldDuration) {
|
|
|
|
|
AlertHoldDurationExample alertHoldDurationExample = new AlertHoldDurationExample();
|
|
|
|
|
alertHoldDurationExample.createCriteria().andWariningHoldDurationEqualTo(warningHoldDuration).andSymbolEqualTo(symbol);
|
|
|
|
|
List<AlertHoldDuration> alertHoldDurations = alertHoldDurationMapper.selectByExample(alertHoldDurationExample);
|
|
|
|
|
for (AlertHoldDuration alertHoldDuration : alertHoldDurations) {
|
|
|
|
|
alertHoldDuration.setStatus(status);
|
|
|
|
|
alertHoldDurationMapper.updateByPrimaryKeySelective(alertHoldDuration);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//删除持仓时长预警记录表
|
|
|
|
@ -203,7 +205,7 @@ public class WarningController {
|
|
|
|
|
@ApiParam("trainingId") @RequestParam String trainingId,
|
|
|
|
|
@ApiParam("首页页码") @RequestParam Integer index,
|
|
|
|
|
@ApiParam("页面条数") @RequestParam Integer size) {
|
|
|
|
|
PageHelper.startPage(index,size);
|
|
|
|
|
PageHelper.startPage(index, size);
|
|
|
|
|
AlertHoldDurationRecordExample alertHoldDurationRecordExample = new AlertHoldDurationRecordExample();
|
|
|
|
|
alertHoldDurationRecordExample.createCriteria().andTrainingidEqualTo(trainingId).andMemberidEqualTo(memberId);
|
|
|
|
|
List<AlertHoldDurationRecord> alertHoldDurationRecords = alertHoldDurationRecordMapper.selectByExample(alertHoldDurationRecordExample);
|
|
|
|
@ -212,7 +214,7 @@ public class WarningController {
|
|
|
|
|
// if (alertHoldDurationRecord.getWariningHoldDuration() != null && alertHoldDurationRecord.getWariningTime() != null)
|
|
|
|
|
// resultAHDR.add(alertHoldDurationRecord);
|
|
|
|
|
// }
|
|
|
|
|
PageInfo<AlertHoldDurationRecord>pageInfo = new PageInfo<>(alertHoldDurationRecords);
|
|
|
|
|
PageInfo<AlertHoldDurationRecord> pageInfo = new PageInfo<>(alertHoldDurationRecords);
|
|
|
|
|
return new ResultEntity<>(pageInfo);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -220,17 +222,26 @@ public class WarningController {
|
|
|
|
|
@GetMapping("/getAlertHoldDuration")
|
|
|
|
|
@ApiOperation("查询持仓时长预警表")
|
|
|
|
|
public ResultEntity<PageInfo<AlertHoldDuration>> getAlertHoldDuration(@ApiParam("memberId") @RequestParam String memberId,
|
|
|
|
|
@ApiParam("trainingId") @RequestParam String trainingId,
|
|
|
|
|
@ApiParam("首页页码") @RequestParam Integer index,
|
|
|
|
|
@ApiParam("页面条数") @RequestParam Integer size) {
|
|
|
|
|
PageHelper.startPage(index,size);
|
|
|
|
|
@ApiParam("trainingId") @RequestParam String trainingId,
|
|
|
|
|
@ApiParam("首页页码") @RequestParam Integer index,
|
|
|
|
|
@ApiParam("页面条数") @RequestParam Integer size) {
|
|
|
|
|
PageHelper.startPage(index, size);
|
|
|
|
|
AlertHoldDurationExample alertHoldDurationExample = new AlertHoldDurationExample();
|
|
|
|
|
alertHoldDurationExample.createCriteria().andTrainingidEqualTo(trainingId).andMemberidEqualTo(memberId);
|
|
|
|
|
List<AlertHoldDuration> alertHoldDurations = alertHoldDurationMapper.selectByExample(alertHoldDurationExample);
|
|
|
|
|
// for (AlertHoldDuration alertHoldDuration : alertHoldDurations) {
|
|
|
|
|
// return new ResultEntity<>(alertHoldDurationMapper.selectBySymbol(alertHoldDuration.getSymbol()));
|
|
|
|
|
// }
|
|
|
|
|
PageInfo<AlertHoldDuration> pageInfo = new PageInfo<>(alertHoldDurations);
|
|
|
|
|
Set<String> uniqueCombinations = new HashSet<>(); // 创建Set集合用于存储唯一的匹配项
|
|
|
|
|
List<AlertHoldDuration> resultAlertHoldDurations = new ArrayList<>(); // 创建List用于存储不重复的数据
|
|
|
|
|
|
|
|
|
|
for (AlertHoldDuration alertHoldDuration : alertHoldDurations) {
|
|
|
|
|
String wariningHoldDuration = alertHoldDuration.getWariningHoldDuration();
|
|
|
|
|
String symbol = alertHoldDuration.getSymbol();
|
|
|
|
|
String uniqueCombination = symbol + wariningHoldDuration;
|
|
|
|
|
|
|
|
|
|
if (uniqueCombinations.add(uniqueCombination)) { // 判断是否是新的组合
|
|
|
|
|
resultAlertHoldDurations.add(alertHoldDuration);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
PageInfo<AlertHoldDuration> pageInfo = new PageInfo<>(resultAlertHoldDurations);
|
|
|
|
|
return new ResultEntity<>(pageInfo);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -253,10 +264,10 @@ public class WarningController {
|
|
|
|
|
@GetMapping("/getTransactionNumberWarning")
|
|
|
|
|
@ApiOperation("交易次数预警查询")
|
|
|
|
|
public ResultEntity<PageInfo<TransactionNumberWarning>> getTransactionNumberWarning(@ApiParam("memberId") @RequestParam String memberId,
|
|
|
|
|
@ApiParam("memberId") @RequestParam String trainingId,
|
|
|
|
|
@ApiParam("首页页码") @RequestParam Integer index,
|
|
|
|
|
@ApiParam("页面条数") @RequestParam Integer size) {
|
|
|
|
|
PageHelper.startPage(index,size);
|
|
|
|
|
@ApiParam("memberId") @RequestParam String trainingId,
|
|
|
|
|
@ApiParam("首页页码") @RequestParam Integer index,
|
|
|
|
|
@ApiParam("页面条数") @RequestParam Integer size) {
|
|
|
|
|
PageHelper.startPage(index, size);
|
|
|
|
|
TransactionNumberWarningExample tnwr = new TransactionNumberWarningExample();
|
|
|
|
|
tnwr.createCriteria().andTrainingIdEqualTo(trainingId).andMemberIdEqualTo(memberId);
|
|
|
|
|
List<TransactionNumberWarning> tnwrs = transactionNumberWarningMapper.selectByExample(tnwr);
|
|
|
|
@ -279,10 +290,10 @@ public class WarningController {
|
|
|
|
|
@GetMapping("/getTransactionNumberWarningRecord")
|
|
|
|
|
@ApiOperation("交易次数预警记录查询")
|
|
|
|
|
public ResultEntity<PageInfo<TransactionNumberWarningRecord>> getTransactionNumberWarningRecord(@ApiParam("memberId") @RequestParam String memberId,
|
|
|
|
|
@ApiParam("memberId") @RequestParam String trainingId,
|
|
|
|
|
@ApiParam("首页页码") @RequestParam Integer index,
|
|
|
|
|
@ApiParam("页面条数") @RequestParam Integer size) {
|
|
|
|
|
PageHelper.startPage(index,size);
|
|
|
|
|
@ApiParam("memberId") @RequestParam String trainingId,
|
|
|
|
|
@ApiParam("首页页码") @RequestParam Integer index,
|
|
|
|
|
@ApiParam("页面条数") @RequestParam Integer size) {
|
|
|
|
|
PageHelper.startPage(index, size);
|
|
|
|
|
TransactionNumberWarningRecordExample tnwre = new TransactionNumberWarningRecordExample();
|
|
|
|
|
tnwre.createCriteria().andTrainingIdEqualTo(trainingId).andMemberIdEqualTo(memberId);
|
|
|
|
|
List<TransactionNumberWarningRecord> tnwrs = transactionNumberWarningRecordMapper.selectByExample(tnwre);
|
|
|
|
|