| | |
| | | } |
| | | |
| | | log.info("--->{},{}", holdOrderEntity.getSymbolCntSale(), wholeCloseOrderDto.getCount()); |
| | | int sub = holdOrderEntity.getSymbolCntSale() - wholeCloseOrderDto.getCount(); |
| | | log.info("剩余张数:{}", sub); |
| | | // 判断当前持仓张数是否等于平仓张数,若等于则直接更新该订单为不可平状态,否则更新可平张数 |
| | | if (wholeCloseOrderDto.getCount() == holdOrderEntity.getSymbolCntSale()) { |
| | | contractHoldOrderDao.updateHoldOrderIsCanClosingById(ContractHoldOrderEntity.ORDER_CAN_CLOSING_N, wholeCloseOrderDto.getId()); |
| | | } else { |
| | | int sub = holdOrderEntity.getSymbolCntSale() - wholeCloseOrderDto.getCount(); |
| | | log.info("剩余张数:{}", sub); |
| | | // 更新可平张数 |
| | | holdOrderEntity.setSymbolCntSale(sub); |
| | | contractHoldOrderDao.updateById(holdOrderEntity); |
| | | if (sub == 0) { |
| | | holdOrderEntity.setIsCanClosing(ContractHoldOrderEntity.ORDER_CAN_CLOSING_N); |
| | | } |
| | | |
| | | // 更新可平张数 |
| | | holdOrderEntity.setSymbolCntSale(sub); |
| | | holdOrderEntity.setSymbolCnt(sub); |
| | | contractHoldOrderDao.updateById(holdOrderEntity); |
| | | |
| | | // 将待平张数放入缓存 |
| | | redisUtils.set(AppContants.CLOSING_ORDER_PREFIX + holdOrderEntity.getId(), wholeCloseOrderDto.getCount()); |
| | | |