Helius
2021-01-20 a4ea7a8d531f562c898c9fead98d14d6c85581db
src/main/java/com/xcong/excoin/modules/documentary/service/impl/DocumentaryServiceImpl.java
@@ -24,6 +24,7 @@
import com.xcong.excoin.modules.coin.parameter.dto.RecordsPageDto;
import com.xcong.excoin.modules.contract.dao.ContractHoldOrderDao;
import com.xcong.excoin.modules.contract.dao.ContractOrderDao;
import com.xcong.excoin.modules.contract.entity.ContractEntrustOrderEntity;
import com.xcong.excoin.modules.contract.entity.ContractHoldOrderEntity;
import com.xcong.excoin.modules.contract.entity.ContractOrderEntity;
import com.xcong.excoin.modules.documentary.dao.FollowFollowerNoticeDao;
@@ -35,6 +36,7 @@
import com.xcong.excoin.modules.documentary.dao.FollowTraderProfitInfoDao;
import com.xcong.excoin.modules.documentary.dto.CancelDocumentaryOrderSetDto;
import com.xcong.excoin.modules.documentary.dto.DocumentaryOrderSetDto;
import com.xcong.excoin.modules.documentary.dto.FollowFollowerNoticeDto;
import com.xcong.excoin.modules.documentary.dto.FollowRecordsDto;
import com.xcong.excoin.modules.documentary.dto.HistoryOrderRecordsDto;
import com.xcong.excoin.modules.documentary.dto.MyFollowOrderDto;
@@ -455,7 +457,21 @@
      FollowTraderInfoEntity traderInfoEntity = followTraderInfoDao.selectTraderInfoByMemberId(memberId);
      if (traderInfoEntity != null) {
         return Result.fail("交易员不能进行跟单");
         return Result.fail(MessageSourceUtils.getString("documentary_service_0014"));
      }
      //判断当前用户是否是逐仓模式
      MemberEntity selectById2 = memberDao.selectById(memberId);
      Integer contractPositionType = selectById2.getContractPositionType();
      if(ContractEntrustOrderEntity.POSITION_TYPE_ADD != contractPositionType) {
         return Result.fail(MessageSourceUtils.getString("documentary_service_0017"));
      }
      //判断交易员是否开启了跟单
      FollowTraderInfoEntity selectById = followTraderInfoDao.selectById(traderId);
      Integer isOpen = selectById.getIsOpen();
      if(FollowTraderInfoEntity.ISOPEN_Y != isOpen) {
         return Result.fail(MessageSourceUtils.getString("documentary_service_0016"));
      }
      FollowFollowerSettingEntity isExistSetting = followFollowerSettingDao.selectOneBymemberIdAndTradeId(memberId, traderId);
@@ -651,6 +667,14 @@
           return Result.fail(MessageSourceUtils.getString("documentary_service_0015"));
        }
        
        //合约不能持仓
        Map<String, Object> contractHoldColumnMap = new HashMap<>();
        contractHoldColumnMap.put("member_id", memberId);
        List<ContractHoldOrderEntity> contractHoldOrderEntitys = contractHoldOrderDao.selectByMap(contractHoldColumnMap);
        if(CollUtil.isNotEmpty(contractHoldOrderEntitys)) {
           return Result.fail(MessageSourceUtils.getString("documentary_service_0013"));
        }
        Map<String, Object> columnMap = new HashMap<>();
        columnMap.put("member_id", memberId);
      List<FollowTraderInfoEntity> selectByMap = followTraderInfoDao.selectByMap(columnMap);
@@ -710,6 +734,8 @@
        FollowTraderInfoEntity followTraderInfoEntity = followTraderInfoDao.selectTraderInfoByMemberId(memberId);
        
        TradeSetInfoVo tradeSetInfoVo = new TradeSetInfoVo();
        Long id = followTraderInfoEntity.getId();
        tradeSetInfoVo.setTradeId(id);
        String avatar = followTraderInfoEntity.getAvatar();
        tradeSetInfoVo.setAvatar(avatar);
        String nickname = followTraderInfoEntity.getNickname();
@@ -726,6 +752,10 @@
      //获取用户ID
        Long memberId = LoginUserUtils.getAppLoginUser().getId();
        FollowTraderInfoEntity followTraderInfoEntity = followTraderInfoDao.selectTraderInfoByMemberId(memberId);
        /**
         * todo
         * 当前交易员有合约多单,是否可以直接调整【是否带单】,是否需要在调整前【判断是否已经有带单的合约单】
         */
        String avatar = updateTradeSetInfoDto.getAvatar();
        String nickname = updateTradeSetInfoDto.getNickname();
        String declaration = updateTradeSetInfoDto.getDeclaration();
@@ -865,8 +895,9 @@
                 BigDecimal allRewardRatio = BigDecimal.ZERO;
                 
                 Long orderId = contractOrderEntity.getId();
                 String orderNo = contractOrderEntity.getOrderNo();
                 Map<String, Object> columnMapRelation = new HashMap<>();
                 columnMapRelation.put("trade_order_no", orderId);
                 columnMapRelation.put("trade_order_no", orderNo);
                 columnMapRelation.put("trade_member_id", memberId);
                 columnMapRelation.put("order_type", 2);
                 columnMapRelation.put("is_show", 1);
@@ -918,7 +949,7 @@
                 myFollowOrderVo.setOpeningTime(openingTime);
                 Date closingTime = contractOrderEntity.getClosingTime();
                 myFollowOrderVo.setClosingTime(closingTime);
                 String orderNo = contractOrderEntity.getOrderNo();
                 myFollowOrderVo.setOrderNo(orderNo);
                 myFollowOrderVos.add(myFollowOrderVo);
              }
@@ -991,27 +1022,31 @@
      FollowTraderInfoEntity traderInfoEntity = followTraderInfoDao.selectTraderInfoByMemberId(memberId);
      if (traderInfoEntity != null) {
         LogRecordUtils.insertFollowerNotice(memberId, NoticeConstant.STOP_FOLLOW_TITLE, StrUtil.format(NoticeConstant.STOP_FOLLOW_CONTENT, traderInfoEntity.getNickname()));
         LogRecordUtils.insertFollowerNotice(followMemberId, NoticeConstant.STOP_FOLLOW_TITLE, StrUtil.format(NoticeConstant.STOP_FOLLOW_CONTENT, traderInfoEntity.getNickname()));
      }
      return Result.ok(MessageSourceUtils.getString("member_service_0026"));
   }
   @Override
   public Result getFollowFollowerNoticeList() {
   public Result getFollowFollowerNoticeList(FollowFollowerNoticeDto followFollowerNoticeDto) {
      //获取用户ID
        Long memberId = LoginUserUtils.getAppLoginUser().getId();
        List<FollowFollowerNoticeVo> arrayList = new ArrayList<>();
        
        Map<String, Object> columnMap = new HashMap<>();
        columnMap.put("member_id", memberId);
      List<FollowFollowerNoticeEntity> selectByMap = followFollowerNoticeDao.selectByMap(columnMap );
      if(CollUtil.isNotEmpty(selectByMap)) {
         for(FollowFollowerNoticeEntity followFollowerNoticeEntity : selectByMap) {
        Page<FollowFollowerNoticeEntity> page = new Page<>(followFollowerNoticeDto.getPageNum(), followFollowerNoticeDto.getPageSize());
        FollowFollowerNoticeEntity followFollowerNoticeEntity = new FollowFollowerNoticeEntity();
        followFollowerNoticeEntity.setMemberId(memberId);
        IPage<FollowFollowerNoticeEntity> followFollowerNoticelist = followFollowerNoticeDao.selectFollowFollowerNoticePage(page, followFollowerNoticeEntity);
        List<FollowFollowerNoticeEntity> records = followFollowerNoticelist.getRecords();
      if(CollUtil.isNotEmpty(records)) {
         for(FollowFollowerNoticeEntity followFollowerNotice : records) {
            FollowFollowerNoticeVo followFollowerNoticeVo = new FollowFollowerNoticeVo();
            String title = followFollowerNoticeEntity.getTitle();
            String title = followFollowerNotice.getTitle();
            followFollowerNoticeVo.setTitle(title);
            String content = followFollowerNoticeEntity.getContent();
            String content = followFollowerNotice.getContent();
            followFollowerNoticeVo.setContent(content);
            Date createTime = followFollowerNotice.getCreateTime();
            followFollowerNoticeVo.setCreateTime(createTime);
            arrayList.add(followFollowerNoticeVo);
         }
      }