|
|
|
@ -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,18 +179,16 @@ 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);
|
|
|
|
|
@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);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//删除持仓时长预警记录表
|
|
|
|
|
@DeleteMapping("/deleteAlertHoldDurationRecord")
|
|
|
|
@ -227,10 +229,19 @@ public class WarningController {
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|