| | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import com.alibaba.druid.sql.visitor.functions.If; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.xcong.excoin.common.LoginUserUtils; |
| | | import com.xcong.excoin.common.enumerates.CoinTypeEnum; |
| | |
| | | import com.xcong.excoin.modules.contract.entity.ContractHoldOrderEntity; |
| | | import com.xcong.excoin.modules.contract.entity.ContractOrderEntity; |
| | | import com.xcong.excoin.modules.contract.mapper.ContractHoldOrderEntityMapper; |
| | | import com.xcong.excoin.modules.contract.mapper.ContractOrderEntityMapper; |
| | | import com.xcong.excoin.modules.contract.parameter.dto.*; |
| | | import com.xcong.excoin.modules.contract.parameter.vo.ContractMoneyInfoVo; |
| | | import com.xcong.excoin.modules.contract.parameter.vo.HoldOrderDetailVo; |
| | | import com.xcong.excoin.modules.contract.parameter.vo.HoldOrderListVo; |
| | | import com.xcong.excoin.modules.contract.parameter.vo.*; |
| | | import com.xcong.excoin.modules.contract.service.ContractHoldOrderService; |
| | | import com.xcong.excoin.modules.member.dao.MemberLevelRateDao; |
| | | import com.xcong.excoin.modules.member.dao.MemberWalletContractDao; |
| | |
| | | if (stopProfitPrice != null) { |
| | | if (newPrice.compareTo(openPrice) > 0) { |
| | | if (stopProfitPrice.compareTo(openPrice) > 0) { |
| | | return Result.fail("止损价必须低于开仓价"); |
| | | return Result.fail("止盈价必须低于开仓价"); |
| | | } |
| | | } else { |
| | | if (stopProfitPrice.compareTo(newPrice) > 0) { |
| | | return Result.fail("止损价必须低于当前价"); |
| | | return Result.fail("止盈价必须低于当前价"); |
| | | } |
| | | } |
| | | } |
| | |
| | | producer.sendPriceOperate(JSONObject.toJSONString(model)); |
| | | return Result.ok("设置成功"); |
| | | } |
| | | |
| | | return Result.fail("设置失败"); |
| | | } |
| | | |
| | |
| | | HoldOrderDetailVo holdOrderDetailVo = ContractHoldOrderEntityMapper.INSTANCE.holdOrderToOrderDetailVo(holdOrderEntity); |
| | | return Result.ok(holdOrderDetailVo); |
| | | } |
| | | |
| | | @Override |
| | | public Result findOrderList(OrderListDto orderListDto) { |
| | | MemberEntity memberEntity = LoginUserUtils.getAppLoginUser(); |
| | | Page<ContractOrderEntity> page = new Page<>(orderListDto.getPageNum(), orderListDto.getPageSize()); |
| | | IPage<ContractOrderEntity> list = contractOrderDao.selectContractOrderInPage(page, memberEntity.getId()); |
| | | Page<OrderListVo> result = ContractOrderEntityMapper.INSTANCE.pageEntityToPageVo(list); |
| | | return Result.ok(result); |
| | | } |
| | | |
| | | @Override |
| | | public Result findOrderDetailById(Long id) { |
| | | MemberEntity memberEntity = LoginUserUtils.getAppLoginUser(); |
| | | ContractOrderEntity contractOrderEntity = contractOrderDao.selectOrderDetailByIdAndMemberId(id, memberEntity.getId()); |
| | | if (contractOrderEntity == null) { |
| | | return Result.fail("订单不存在"); |
| | | } |
| | | |
| | | OrderDetailVo orderDetailVo = ContractOrderEntityMapper.INSTANCE.entityToDetailVo(contractOrderEntity); |
| | | return Result.ok(orderDetailVo); |
| | | } |
| | | } |