|
|
|
@ -190,6 +190,7 @@ public class TakeStashController {
|
|
|
|
|
ForexMarketData forexData = tradingController.getMarketQuotationByCode(tradingCode).getBody().getData();
|
|
|
|
|
TakeStash takeStash = new TakeStash();
|
|
|
|
|
takeStash.setStashId(stashId);
|
|
|
|
|
boolean flag=false;
|
|
|
|
|
if (null != stopLoss || null != stopWin) { //判断止损止赢是否合理 如果stopLoss stopWin都为null则跳过
|
|
|
|
|
boolean winOrLossStopBoolean = tradingController.getWinOrLossStop(stopLoss, stopWin, buySellType, forexData);
|
|
|
|
|
if (winOrLossStopBoolean == false) {
|
|
|
|
@ -197,11 +198,39 @@ public class TakeStashController {
|
|
|
|
|
}
|
|
|
|
|
if (null != stopLoss) {
|
|
|
|
|
takeStash.setStopLoss(stopLoss);
|
|
|
|
|
flag=true;
|
|
|
|
|
}
|
|
|
|
|
if (null != stopWin) {
|
|
|
|
|
takeStash.setStopWin(stopWin);
|
|
|
|
|
flag=true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
TakeStash takeStashGet = takeStashService.selectByPrimaryKey(stashId);
|
|
|
|
|
if(flag==true){ //代表需要新增到redis中
|
|
|
|
|
redisUtil.del("*stashId_" + stashId + "*");
|
|
|
|
|
Set<String> keys = redisUtil.keys("*stashId_" + stashId + "*");
|
|
|
|
|
Map map=new HashMap();
|
|
|
|
|
if(stopLoss==null){
|
|
|
|
|
map.put("stopLoss",-1.0);
|
|
|
|
|
}else {
|
|
|
|
|
map.put("stopLoss",stopLoss);
|
|
|
|
|
}
|
|
|
|
|
if(stopWin==null){
|
|
|
|
|
map.put("stopWin",-1.0);
|
|
|
|
|
}else {
|
|
|
|
|
map.put("stopWin",stopWin);
|
|
|
|
|
}
|
|
|
|
|
map.put("stashId",stashId);
|
|
|
|
|
map.put("buySellType",buySellType);
|
|
|
|
|
map.put("tradingCode",tradingCode);
|
|
|
|
|
map.put("transactionVolume",takeStashGet.getVolumeTransaction());
|
|
|
|
|
map.put("priceTransaction",takeStashGet.getPriceTransaction());
|
|
|
|
|
map.put("memberId",takeStashGet.getMemberId());
|
|
|
|
|
map.put("trainingId",takeStashGet.getTrainingId());
|
|
|
|
|
redisUtil.hmset("trainingId_"+takeStashGet.getTrainingId()+"_stashId_"+stashId,map);
|
|
|
|
|
}else {
|
|
|
|
|
redisUtil.del("trainingId_"+takeStashGet.getTrainingId()+"_stashId_"+stashId);
|
|
|
|
|
}
|
|
|
|
|
takeStashService.updateWinLossByPrimaryKey(takeStash);
|
|
|
|
|
return new ResultEntity(HttpStatus.OK, "修改持仓成功");
|
|
|
|
|
}
|
|
|
|
|