From 7c8869bb01261a5321a6ac624e575fe83bc869a6 Mon Sep 17 00:00:00 2001 From: Helius <wangdoubleone@gmail.com> Date: Fri, 05 Mar 2021 10:28:00 +0800 Subject: [PATCH] Merge branch 'whole_new' of http://120.27.238.55:7000/r/exchange into whole_new --- src/main/java/com/xcong/excoin/modules/documentary/controller/DocumentaryController.java | 14 +++++++ src/main/java/com/xcong/excoin/modules/documentary/entity/FollowTraderInfoEntity.java | 2 + src/main/java/com/xcong/excoin/modules/documentary/vo/DocumentaryOrderSetStateVo.java | 14 +++++++ src/main/java/com/xcong/excoin/modules/documentary/service/DocumentaryService.java | 2 + src/main/java/com/xcong/excoin/modules/documentary/service/impl/DocumentaryServiceImpl.java | 70 +++++++++++++++++++++++++++++------ src/main/java/com/xcong/excoin/modules/documentary/vo/FollowTraderProfitInfoVo.java | 12 ++++++ 6 files changed, 102 insertions(+), 12 deletions(-) diff --git a/src/main/java/com/xcong/excoin/modules/documentary/controller/DocumentaryController.java b/src/main/java/com/xcong/excoin/modules/documentary/controller/DocumentaryController.java index d8c3fe1..0530fea 100644 --- a/src/main/java/com/xcong/excoin/modules/documentary/controller/DocumentaryController.java +++ b/src/main/java/com/xcong/excoin/modules/documentary/controller/DocumentaryController.java @@ -24,6 +24,7 @@ import com.xcong.excoin.modules.documentary.service.DocumentaryService; import com.xcong.excoin.modules.documentary.vo.DocumentaryOrderInfoVo; import com.xcong.excoin.modules.documentary.vo.DocumentaryOrderSetInfoVo; +import com.xcong.excoin.modules.documentary.vo.DocumentaryOrderSetStateVo; import com.xcong.excoin.modules.documentary.vo.FollowFollowerNoticeVo; import com.xcong.excoin.modules.documentary.vo.FollowInfoVo; import com.xcong.excoin.modules.documentary.vo.FollowRecordsVo; @@ -166,6 +167,19 @@ } /** + * 跟单---跟单设置--是否已跟单 + */ + @ApiOperation(value="跟单---跟单设置--是否已跟单", notes="跟单---跟单设置--是否已跟单") + @ApiResponses({@ApiResponse( code = 200, message = "success", response = DocumentaryOrderSetStateVo.class)}) + @ApiImplicitParams({ + @ApiImplicitParam(name = "tradeId", value = "交易员ID", required = true, dataType = "String", paramType="query") + }) + @GetMapping(value = "/getDocumentaryOrderSetState") + public Result getDocumentaryOrderSetState(String tradeId) { + return documentaryService.getDocumentaryOrderSetState(tradeId); + } + + /** * 跟单---跟单设置--新增跟单 */ @ApiOperation(value="跟单---跟单设置--新增跟单", notes="跟单---跟单设置--新增跟单") diff --git a/src/main/java/com/xcong/excoin/modules/documentary/entity/FollowTraderInfoEntity.java b/src/main/java/com/xcong/excoin/modules/documentary/entity/FollowTraderInfoEntity.java index 696b321..6db2e7a 100644 --- a/src/main/java/com/xcong/excoin/modules/documentary/entity/FollowTraderInfoEntity.java +++ b/src/main/java/com/xcong/excoin/modules/documentary/entity/FollowTraderInfoEntity.java @@ -21,6 +21,8 @@ private static final long serialVersionUID = 1L; public static final String DECLARATION_DEFAULT = "正忙着赚钱,什么也没写"; + + public static final Integer FOLLOWNUM_DEFAULT = 500; /** * 会员ID */ diff --git a/src/main/java/com/xcong/excoin/modules/documentary/service/DocumentaryService.java b/src/main/java/com/xcong/excoin/modules/documentary/service/DocumentaryService.java index 94af144..86015d8 100644 --- a/src/main/java/com/xcong/excoin/modules/documentary/service/DocumentaryService.java +++ b/src/main/java/com/xcong/excoin/modules/documentary/service/DocumentaryService.java @@ -77,5 +77,7 @@ public Result beTraderCondition(); + public Result getDocumentaryOrderSetState(String tradeId); + } diff --git a/src/main/java/com/xcong/excoin/modules/documentary/service/impl/DocumentaryServiceImpl.java b/src/main/java/com/xcong/excoin/modules/documentary/service/impl/DocumentaryServiceImpl.java index d2d651a..9a30625 100644 --- a/src/main/java/com/xcong/excoin/modules/documentary/service/impl/DocumentaryServiceImpl.java +++ b/src/main/java/com/xcong/excoin/modules/documentary/service/impl/DocumentaryServiceImpl.java @@ -65,6 +65,7 @@ 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.DocumentaryOrderSetStateVo; import com.xcong.excoin.modules.documentary.vo.FollowFollowerNoticeVo; import com.xcong.excoin.modules.documentary.vo.FollowInfoVo; import com.xcong.excoin.modules.documentary.vo.FollowRecordsVo; @@ -637,17 +638,17 @@ long parseLong = Long.parseLong(tradeId); //只能跟随一个人 - Map<String, Object> columnMaps = new HashMap<>(); - columnMaps.put("member_id", memberId); - List<FollowFollowerSettingEntity> followFollowerSettingEntityAllows = followFollowerSettingDao.selectByMap(columnMaps); - if(CollUtil.isNotEmpty(followFollowerSettingEntityAllows)) { - for(FollowFollowerSettingEntity followFollowerSettingEntityAllow : followFollowerSettingEntityAllows) { - Long tradeIdAllow = followFollowerSettingEntityAllow.getTraderId(); - if(parseLong != tradeIdAllow) { - return Result.fail(MessageSourceUtils.getString("documentary_service_0015")); - } - } - } +// Map<String, Object> columnMaps = new HashMap<>(); +// columnMaps.put("member_id", memberId); +// List<FollowFollowerSettingEntity> followFollowerSettingEntityAllows = followFollowerSettingDao.selectByMap(columnMaps); +// if(CollUtil.isNotEmpty(followFollowerSettingEntityAllows)) { +// for(FollowFollowerSettingEntity followFollowerSettingEntityAllow : followFollowerSettingEntityAllows) { +// Long tradeIdAllow = followFollowerSettingEntityAllow.getTraderId(); +// if(parseLong != tradeIdAllow) { +// return Result.fail(MessageSourceUtils.getString("documentary_service_0015")); +// } +// } +// } //获取【跟随者设置】数据 FollowFollowerSettingEntity followFollowerSettingEntity = followFollowerSettingDao.selectOneBymemberIdAndTradeId(memberId,parseLong); @@ -677,8 +678,9 @@ Integer maxFollowCnt = followFollowerSettingEntity.getMaxFollowCnt(); if(maxFollowCnt > 0){ documentaryOrderSetInfoVo.setMaxFollowCnt(maxFollowCnt.toString()); + }else { + documentaryOrderSetInfoVo.setMaxFollowCnt(""); } - documentaryOrderSetInfoVo.setMaxFollowCnt(""); log.info(memberId + "-最大持仓张数-"+maxFollowCnt.toString()); return Result.ok(documentaryOrderSetInfoVo); } @@ -747,6 +749,18 @@ String nickname = followTraderInfoEntity.getNickname(); String declaration = followTraderInfoEntity.getDeclaration(); Integer isAll = followTraderInfoEntity.getIsAll(); + Integer followNum = followTraderInfoEntity.getFollowNum(); + //获取当前跟单人数 + Map<String, Object> columnMap = new HashMap<>(); + columnMap.put("trade_id", traderId); + columnMap.put("is_follow", FollowFollowerProfitEntity.IS_FOLLOW_Y); + List<FollowFollowerProfitEntity> selectByMap = followFollowerProfitDao.selectByMap(columnMap); + if(CollUtil.isNotEmpty(selectByMap)) { + followTraderProfitInfoVo.setFollowNumNow(selectByMap.size()); + }else { + followTraderProfitInfoVo.setFollowNumNow(0); + } + followTraderProfitInfoVo.setFollowNum(followNum); followTraderProfitInfoVo.setAvatar(avatar); followTraderProfitInfoVo.setNickname(nickname); followTraderProfitInfoVo.setDeclaration(declaration); @@ -820,6 +834,7 @@ followTraderInfoEntity.setDeclaration(declaration); } followTraderInfoEntity.setLabels(labels); + followTraderInfoEntity.setFollowNum(FollowTraderInfoEntity.FOLLOWNUM_DEFAULT); followTraderInfoEntity.setIsAll(FollowTraderInfoEntity.IS_ALL_N); followTraderInfoEntity.setProfitRatio(BigDecimal.ZERO); followTraderInfoEntity.setVerifyStatus(FollowTraderInfoEntity.VERIFYSTATUS_ING); @@ -1251,6 +1266,37 @@ List<BeTraderConditionVo> beTraderConditionVos = followTraderInfoDao.selectBeTraderCondition(type); return Result.ok(beTraderConditionVos); } + + @Override + public Result getDocumentaryOrderSetState(String tradeId) { + //获取用户ID + Long memberId = LoginUserUtils.getAppLoginUser().getId(); + boolean OrderSetState = false; + long parseLong = Long.parseLong(tradeId); + //只能跟随一个人 + Map<String, Object> columnMaps = new HashMap<>(); + columnMaps.put("member_id", memberId); + List<FollowFollowerSettingEntity> followFollowerSettingEntityAllows = followFollowerSettingDao.selectByMap(columnMaps); + if(CollUtil.isEmpty(followFollowerSettingEntityAllows)) { + OrderSetState = Boolean.TRUE; + }else { + if(followFollowerSettingEntityAllows.size() == 1) { + Long tradeIdAllow = followFollowerSettingEntityAllows.get(0).getTraderId(); + if(parseLong == tradeIdAllow) { + OrderSetState = Boolean.TRUE; + } + } + } + + DocumentaryOrderSetStateVo documentaryOrderSetStateVo = new DocumentaryOrderSetStateVo(); + if(OrderSetState) { + documentaryOrderSetStateVo.setState(Boolean.TRUE); + }else { + documentaryOrderSetStateVo.setState(Boolean.FALSE); + } + return Result.ok(documentaryOrderSetStateVo); + + } diff --git a/src/main/java/com/xcong/excoin/modules/documentary/vo/DocumentaryOrderSetStateVo.java b/src/main/java/com/xcong/excoin/modules/documentary/vo/DocumentaryOrderSetStateVo.java new file mode 100644 index 0000000..ab7215f --- /dev/null +++ b/src/main/java/com/xcong/excoin/modules/documentary/vo/DocumentaryOrderSetStateVo.java @@ -0,0 +1,14 @@ +package com.xcong.excoin.modules.documentary.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +@ApiModel(value = "DocumentaryOrderSetStateVo", description = "参数返回类") +public class DocumentaryOrderSetStateVo { + + @ApiModelProperty("是否允许跟单的状态") + private Boolean state; + +} diff --git a/src/main/java/com/xcong/excoin/modules/documentary/vo/FollowTraderProfitInfoVo.java b/src/main/java/com/xcong/excoin/modules/documentary/vo/FollowTraderProfitInfoVo.java index 2dacc51..155c8fe 100644 --- a/src/main/java/com/xcong/excoin/modules/documentary/vo/FollowTraderProfitInfoVo.java +++ b/src/main/java/com/xcong/excoin/modules/documentary/vo/FollowTraderProfitInfoVo.java @@ -89,5 +89,17 @@ */ @ApiModelProperty("跟单状态 1:已跟单2:未跟单") private Integer documentaryType; + + /** + * 最大跟单人数 + */ + @ApiModelProperty("最大跟单人数") + private Integer followNum; + + /** + * 当前跟单人数 + */ + @ApiModelProperty("当前跟单人数") + private Integer followNumNow; } -- Gitblit v1.9.1