src/main/java/com/xcong/excoin/modules/documentary/controller/TraderController.java | ●●●●● patch | view | raw | blame | history | |
src/main/java/com/xcong/excoin/modules/documentary/dao/FollowFollowerProfitDao.java | ●●●●● patch | view | raw | blame | history | |
src/main/java/com/xcong/excoin/modules/documentary/dto/TradeFollowInfoDto.java | ●●●●● patch | view | raw | blame | history | |
src/main/java/com/xcong/excoin/modules/documentary/service/DocumentaryService.java | ●●●●● patch | view | raw | blame | history | |
src/main/java/com/xcong/excoin/modules/documentary/service/impl/DocumentaryServiceImpl.java | ●●●●● patch | view | raw | blame | history | |
src/main/java/com/xcong/excoin/modules/documentary/vo/TradeFollowInfoVo.java | ●●●●● patch | view | raw | blame | history | |
src/main/resources/mapper/documentary/FollowFollowerProfitDao.xml | ●●●●● patch | view | raw | blame | history |
src/main/java/com/xcong/excoin/modules/documentary/controller/TraderController.java
@@ -10,9 +10,11 @@ import org.springframework.web.bind.annotation.RestController; import com.xcong.excoin.common.response.Result; import com.xcong.excoin.modules.documentary.dto.TradeFollowInfoDto; import com.xcong.excoin.modules.documentary.dto.TradeOrderInfoDto; import com.xcong.excoin.modules.documentary.dto.UpdateTradeSetInfoDto; import com.xcong.excoin.modules.documentary.service.DocumentaryService; import com.xcong.excoin.modules.documentary.vo.TradeFollowInfoVo; import com.xcong.excoin.modules.documentary.vo.TradeHistoryOrderInfoVo; import com.xcong.excoin.modules.documentary.vo.TradeOrderInfoVo; import com.xcong.excoin.modules.documentary.vo.TradeProfitInfoVo; @@ -75,6 +77,16 @@ } /** * 交易员设置--我的跟随者 */ @ApiOperation(value="交易员设置--我的跟随者", notes="交易员设置--我的跟随者") @ApiResponses({@ApiResponse( code = 200, message = "success", response = TradeFollowInfoVo.class)}) @GetMapping(value = "/getTradeFollowInfo") public Result getTradeFollowInfo(@RequestBody @Valid TradeFollowInfoDto tradeFollowInfoDto) { return documentaryService.getTradeFollowInfo(tradeFollowInfoDto); } /** * 成为交易员---立即入驻 */ @ApiOperation(value="成为交易员---立即入驻", notes="成为交易员---立即入驻") src/main/java/com/xcong/excoin/modules/documentary/dao/FollowFollowerProfitDao.java
@@ -32,5 +32,8 @@ @Param("memberId")Long memberId); FollowFollowerProfitEntity selectDocumentaryOrderSetInfoBymemberIdAndTradeId(@Param("memberId")Long memberId, @Param("traderId")Long traderId); IPage<FollowFollowerProfitEntity> selectTradeFollowerProfitEntitys(Page<FollowFollowerProfitEntity> page, @Param("memberId")Long memberId); } src/main/java/com/xcong/excoin/modules/documentary/dto/TradeFollowInfoDto.java
New file @@ -0,0 +1,20 @@ package com.xcong.excoin.modules.documentary.dto; import javax.validation.constraints.Min; import javax.validation.constraints.NotNull; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @Data @ApiModel(value = "TradeFollowInfoDto", description = "参数接受类") public class TradeFollowInfoDto { @NotNull @Min(1) @ApiModelProperty(value = "第几页", example = "1") private int pageNum; @NotNull @ApiModelProperty(value = "每页数量", example = "10") private int pageSize; } src/main/java/com/xcong/excoin/modules/documentary/service/DocumentaryService.java
@@ -11,6 +11,7 @@ import com.xcong.excoin.modules.documentary.dto.HistoryOrderRecordsDto; import com.xcong.excoin.modules.documentary.dto.MyFollowOrderDto; import com.xcong.excoin.modules.documentary.dto.MyFollowTraderInfoDto; import com.xcong.excoin.modules.documentary.dto.TradeFollowInfoDto; import com.xcong.excoin.modules.documentary.dto.TradeOrderInfoDto; import com.xcong.excoin.modules.documentary.dto.UpdateDocumentaryOrderSetDto; import com.xcong.excoin.modules.documentary.dto.UpdateTradeSetInfoDto; @@ -60,4 +61,6 @@ public Result getTradeHistoryOrderInfo(@Valid TradeOrderInfoDto tradeOrderInfoDto); public Result getTradeFollowInfo(@Valid TradeFollowInfoDto tradeFollowInfoDto); } src/main/java/com/xcong/excoin/modules/documentary/service/impl/DocumentaryServiceImpl.java
@@ -35,6 +35,7 @@ import com.xcong.excoin.modules.documentary.dto.HistoryOrderRecordsDto; import com.xcong.excoin.modules.documentary.dto.MyFollowOrderDto; import com.xcong.excoin.modules.documentary.dto.MyFollowTraderInfoDto; import com.xcong.excoin.modules.documentary.dto.TradeFollowInfoDto; import com.xcong.excoin.modules.documentary.dto.TradeOrderInfoDto; import com.xcong.excoin.modules.documentary.dto.UpdateDocumentaryOrderSetDto; import com.xcong.excoin.modules.documentary.dto.UpdateTradeSetInfoDto; @@ -53,6 +54,7 @@ import com.xcong.excoin.modules.documentary.vo.MemberIsTradeVo; import com.xcong.excoin.modules.documentary.vo.MyFollowOrderVo; import com.xcong.excoin.modules.documentary.vo.MyFollowTraderInfoVo; import com.xcong.excoin.modules.documentary.vo.TradeFollowInfoVo; import com.xcong.excoin.modules.documentary.vo.TradeHistoryOrderInfoVo; import com.xcong.excoin.modules.documentary.vo.TradeOrderInfoVo; import com.xcong.excoin.modules.documentary.vo.TradeProfitInfoVo; @@ -852,6 +854,44 @@ } return Result.ok(myFollowOrderVos); } @Override public Result getTradeFollowInfo(@Valid TradeFollowInfoDto tradeFollowInfoDto) { //获取用户ID Long memberId = LoginUserUtils.getAppLoginUser().getId(); List<TradeFollowInfoVo> myFollowOrderVos = new ArrayList<>(); Page<FollowFollowerProfitEntity> page = new Page<>(tradeFollowInfoDto.getPageNum(), tradeFollowInfoDto.getPageSize()); IPage<FollowFollowerProfitEntity> followFollowerProfitEntitys = followFollowerProfitDao.selectTradeFollowerProfitEntitys(page, memberId); List<FollowFollowerProfitEntity> records = followFollowerProfitEntitys.getRecords(); if(CollUtil.isNotEmpty(records)) { for(FollowFollowerProfitEntity followFollowerProfitEntity : records) { TradeFollowInfoVo myFollowTraderInfoVo = new TradeFollowInfoVo(); Long followMemberId = followFollowerProfitEntity.getMemberId(); MemberEntity memberEntity = memberDao.selectById(followMemberId); if(ObjectUtil.isNotEmpty(memberEntity)) { String phone = memberEntity.getPhone(); String email = memberEntity.getEmail(); if(StrUtil.isNotEmpty(phone)) { myFollowTraderInfoVo.setAccount(phone); }else { myFollowTraderInfoVo.setAccount(email); } } Long id = followFollowerProfitEntity.getId(); myFollowTraderInfoVo.setId(id); BigDecimal totalPrincipal = followFollowerProfitEntity.getTotalPrincipal(); myFollowTraderInfoVo.setTotalPrincipal(totalPrincipal); BigDecimal totalProfit = followFollowerProfitEntity.getTotalProfit(); myFollowTraderInfoVo.setTotalProfit(totalProfit.setScale(2, BigDecimal.ROUND_DOWN)); myFollowOrderVos.add(myFollowTraderInfoVo); } } return Result.ok(myFollowOrderVos); } src/main/java/com/xcong/excoin/modules/documentary/vo/TradeFollowInfoVo.java
New file @@ -0,0 +1,25 @@ package com.xcong.excoin.modules.documentary.vo; import java.math.BigDecimal; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @Data @ApiModel(value = "TradeFollowInfoVo", description = "返回类") public class TradeFollowInfoVo { @ApiModelProperty(value = "ID") private Long id; @ApiModelProperty("名称") private String account; @ApiModelProperty(value = "累计跟随本金") private BigDecimal totalPrincipal; @ApiModelProperty(value = "累计收益") private BigDecimal totalProfit; } src/main/resources/mapper/documentary/FollowFollowerProfitDao.xml
@@ -29,6 +29,16 @@ and is_follow = 1 order by create_time desc </select> <select id="selectTradeFollowerProfitEntitys" resultType="com.xcong.excoin.modules.documentary.entity.FollowFollowerProfitEntity"> SELECT * FROM follow_follower_profit WHERE trade_member_id = #{memberId} and is_follow = 1 order by create_time desc </select> <select id="getMyFollowOrderHistoryRecords" resultType="com.xcong.excoin.modules.contract.entity.ContractOrderEntity"> SELECT