| | |
| | | import com.xcong.excoin.modules.documentary.entity.FollowTraderLabelEntity;
|
| | | import com.xcong.excoin.modules.documentary.entity.FollowTraderProfitInfoEntity;
|
| | | import com.xcong.excoin.modules.documentary.service.DocumentaryService;
|
| | | import com.xcong.excoin.modules.documentary.vo.BeTraderConditionVo;
|
| | | import com.xcong.excoin.modules.documentary.vo.DocumentaryOrderInfoVo;
|
| | | import com.xcong.excoin.modules.documentary.vo.DocumentaryOrderSetInfoVo;
|
| | | import com.xcong.excoin.modules.documentary.vo.FollowFollowerNoticeVo;
|
| | |
| | | }else {
|
| | | followInfoVo.setNickname(phone);
|
| | | }
|
| | | |
| | |
|
| | | List<ContractHoldOrderEntity> myFollowOrder = followFollowerProfitDao.getFollowOrderNowRecords(memberId);
|
| | |
|
| | | BigDecimal totalBondAmount = BigDecimal.ZERO;
|
| | | BigDecimal profitOrLess = BigDecimal.ZERO;
|
| | | if (CollUtil.isNotEmpty(myFollowOrder)) {
|
| | | for(ContractHoldOrderEntity contractHoldOrderEntity : myFollowOrder) {
|
| | | BigDecimal newPrice = new BigDecimal(redisUtils.getString(CoinTypeConvert.convertToKey(contractHoldOrderEntity.getSymbol())));
|
| | | BigDecimal lotNumber = cacheSettingUtils.getSymbolSku(contractHoldOrderEntity.getSymbol());
|
| | |
|
| | | // 盈亏
|
| | | BigDecimal rewardRatio = BigDecimal.ZERO;
|
| | | // 开多
|
| | | if (contractHoldOrderEntity.OPENING_TYPE_MORE == contractHoldOrderEntity.getOpeningType()) {
|
| | | // (最新价-开仓价)*规格*张数
|
| | | rewardRatio = newPrice.subtract(contractHoldOrderEntity.getOpeningPrice()).multiply(lotNumber).multiply(new BigDecimal(contractHoldOrderEntity.getSymbolCnt()));
|
| | | // 开空
|
| | | } else {
|
| | | // (开仓价-最新价)*规格*张数
|
| | | rewardRatio = contractHoldOrderEntity.getOpeningPrice().subtract(newPrice).multiply(lotNumber).multiply(new BigDecimal(contractHoldOrderEntity.getSymbolCnt()));
|
| | | }
|
| | |
|
| | | if (member.getIsProfit() == MemberEntity.IS_PROFIT_Y) {
|
| | | PlatformTradeSettingEntity tradeSettingEntity = cacheSettingUtils.getTradeSetting();
|
| | | if (rewardRatio.compareTo(BigDecimal.ZERO) > -1) {
|
| | | rewardRatio = rewardRatio.multiply(BigDecimal.ONE.subtract(tradeSettingEntity.getProfitParam()));
|
| | | }
|
| | | }
|
| | |
|
| | | profitOrLess = profitOrLess.add(rewardRatio).setScale(2, BigDecimal.ROUND_DOWN);
|
| | | totalBondAmount = totalBondAmount.add(contractHoldOrderEntity.getBondAmount());
|
| | | }
|
| | | }
|
| | |
|
| | | followInfoVo.setTotalAmount(totalBondAmount);
|
| | | followInfoVo.setTotalProfitOrLess(profitOrLess);
|
| | |
|
| | | BigDecimal totalPrincipals = BigDecimal.ZERO;
|
| | | BigDecimal totalProfits = BigDecimal.ZERO;
|
| | | Map<String, Object> columnMap = new HashMap<>();
|
| | |
| | | documentaryOrderSetInfoVo.setFollowCnt(followCnt);
|
| | |
|
| | | Integer maxFollowCnt = followFollowerSettingEntity.getMaxFollowCnt();
|
| | | documentaryOrderSetInfoVo.setMaxFollowCnt(maxFollowCnt);
|
| | | |
| | | if(maxFollowCnt > 0){
|
| | | documentaryOrderSetInfoVo.setMaxFollowCnt(maxFollowCnt.toString());
|
| | | }
|
| | | documentaryOrderSetInfoVo.setMaxFollowCnt(null);
|
| | | log.info(memberId + "-最大持仓张数-"+maxFollowCnt.toString());
|
| | | return Result.ok(documentaryOrderSetInfoVo);
|
| | | }
|
| | |
|
| | |
| | | long id = outFollowInfoDto.getId();
|
| | | //获取【跟随者收益】
|
| | | FollowFollowerProfitEntity followFollowerProfitEntity = followFollowerProfitDao.selectById(id);
|
| | | |
| | | //当前有跟单合约不允许移除
|
| | | //获取【跟随者-订单关联表】
|
| | | Map<String, Object> selectColumnMap = new HashMap<>();
|
| | | selectColumnMap.put("member_id", followFollowerProfitEntity.getMemberId());
|
| | | selectColumnMap.put("trade_member_id", memberId);
|
| | | selectColumnMap.put("order_type", FollowFollowerOrderRelationEntity.ORDER_TYPE_HOLD);
|
| | | List<FollowFollowerOrderRelationEntity> followFollowerOrderRelationEntitys = followFollowerOrderRelationDao.selectByMap(selectColumnMap);
|
| | | if(CollUtil.isNotEmpty(followFollowerOrderRelationEntitys)) {
|
| | | return Result.fail(MessageSourceUtils.getString("documentary_service_0019"));
|
| | | }
|
| | | |
| | | followFollowerProfitEntity.setIsFollow(FollowFollowerProfitEntity.IS_FOLLOW_N);
|
| | | followFollowerProfitDao.updateById(followFollowerProfitEntity);
|
| | |
|
| | |
| | | }
|
| | | MemberSettingEntity memberSettingEntity = memberSettingDao.selectMemberSettingByMemberId(memberId);
|
| | | if(ObjectUtil.isNotEmpty(memberSettingEntity)) {
|
| | | log.info(memberId + "的消息提醒状态变更");
|
| | | memberSettingEntity.setMessageReminder(0);
|
| | | memberSettingDao.updateById(memberSettingEntity);
|
| | | }
|
| | |
| | | }
|
| | | return Result.ok(arrayList);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public Result beTraderCondition() {
|
| | | String type = "apply_trader_rule";
|
| | | List<BeTraderConditionVo> beTraderConditionVos = followTraderInfoDao.selectBeTraderCondition(type);
|
| | | return Result.ok(beTraderConditionVos);
|
| | | }
|
| | |
|
| | |
|
| | |
|