xiaoyong931011
2020-07-31 b34be29401abfe68c05e7e47af2888f0a54ba12f
src/main/java/com/xcong/excoin/modules/documentary/service/impl/DocumentaryServiceImpl.java
@@ -23,6 +23,7 @@
import com.xcong.excoin.modules.contract.dao.ContractHoldOrderDao;
import com.xcong.excoin.modules.contract.entity.ContractHoldOrderEntity;
import com.xcong.excoin.modules.contract.entity.ContractOrderEntity;
import com.xcong.excoin.modules.documentary.dao.FollowFollowerOrderRelationDao;
import com.xcong.excoin.modules.documentary.dao.FollowFollowerProfitDao;
import com.xcong.excoin.modules.documentary.dao.FollowFollowerSettingDao;
import com.xcong.excoin.modules.documentary.dao.FollowTraderInfoDao;
@@ -35,6 +36,7 @@
import com.xcong.excoin.modules.documentary.dto.MyFollowOrderDto;
import com.xcong.excoin.modules.documentary.dto.MyFollowTraderInfoDto;
import com.xcong.excoin.modules.documentary.dto.UpdateDocumentaryOrderSetDto;
import com.xcong.excoin.modules.documentary.entity.FollowFollowerOrderRelationEntity;
import com.xcong.excoin.modules.documentary.entity.FollowFollowerProfitEntity;
import com.xcong.excoin.modules.documentary.entity.FollowFollowerSettingEntity;
import com.xcong.excoin.modules.documentary.entity.FollowTraderInfoEntity;
@@ -94,6 +96,8 @@
    private MemberWalletContractDao memberWalletContractDao;
    @Resource
    private FollowFollowerSettingDao followFollowerSettingDao;
    @Resource
    private FollowFollowerOrderRelationDao followFollowerOrderRelationDao;
    
   
   @Override
@@ -295,6 +299,14 @@
         if(CollUtil.isNotEmpty(records)) {
            for(ContractHoldOrderEntity contractHoldOrderEntity : records) {
               MyFollowOrderVo myFollowOrderVo = new MyFollowOrderVo();
               //获取交易员信息
               Long orderId = contractHoldOrderEntity.getId();
               FollowFollowerOrderRelationEntity FollowFollowerOrderRelation = followFollowerOrderRelationDao.selectOneByorderIdandMemberId(orderId,memberId);
               Long tradeId = FollowFollowerOrderRelation.getTradeId();
               FollowTraderInfoEntity followTraderInfoEntity = followTraderInfoDao.selectById(tradeId);
               String nickname = followTraderInfoEntity.getNickname();
               myFollowOrderVo.setNickname(nickname);
               String symbol = contractHoldOrderEntity.getSymbol();
               myFollowOrderVo.setSymbol(symbol);
               int orderType = contractHoldOrderEntity.getOpeningType();
@@ -314,6 +326,8 @@
               
               // 获取最新价
               BigDecimal newPrice = new BigDecimal(redisUtils.getString(CoinTypeConvert.convertToKey(contractHoldOrderEntity.getSymbol())));
               myFollowOrderVo.setNewPrice(newPrice);
               BigDecimal lotNumber = cacheSettingUtils.getSymbolSku(contractHoldOrderEntity.getSymbol());
               // 盈亏
               BigDecimal rewardRatio = BigDecimal.ZERO;
@@ -528,6 +542,36 @@
      followTraderProfitInfoVo.setIsAll(isAll);
      return Result.ok(followTraderProfitInfoVo);
   }
   @Override
   @Transactional
   public Result beTrader() {
      //获取用户ID
        Long memberId = LoginUserUtils.getAppLoginUser().getId();
        MemberEntity memberEntity = memberDao.selectById(memberId);
        Integer certifyStatus = memberEntity.getCertifyStatus();
        if(MemberEntity.CERTIFY_STATUS_Y != certifyStatus) {
           return Result.ok(MessageSourceUtils.getString("member_controller_0009"));
        }
        //新增【交易员信息表】数据
        FollowTraderInfoEntity followTraderInfoEntity = new FollowTraderInfoEntity();
        followTraderInfoEntity.setMemberId(memberId);
        followTraderInfoEntity.setAvatar(FollowTraderInfoEntity.AVATAR_DEFAULT);
        String phone = memberEntity.getPhone();
        String email = memberEntity.getEmail();
        if(StrUtil.isNotEmpty(phone)) {
           followTraderInfoEntity.setNickname(phone);
        }else {
           followTraderInfoEntity.setNickname(email);
        }
        followTraderInfoEntity.setDeclaration(FollowTraderInfoEntity.DECLARATION_DEFAULT);
        followTraderInfoEntity.setIsAll(FollowTraderInfoEntity.IS_ALL_N);
        followTraderInfoEntity.setProfitRatio(BigDecimal.ZERO);
        followTraderInfoEntity.setVerifyStatus(FollowTraderInfoEntity.VERIFYSTATUS_ING);
        followTraderInfoEntity.setIsOpen(FollowTraderInfoEntity.ISOPEN_Y);
        followTraderInfoDao.insert(followTraderInfoEntity);
      return Result.ok(MessageSourceUtils.getString("member_service_0024"));
   }