xiaoyong931011
2021-05-15 1089e7795ac98fc0486694e5116f44ee28807f7c
20210515 云顶
3 files added
5 files modified
150 ■■■■■ changed files
src/main/java/com/xcong/excoin/modules/yunding/controller/YunDingController.java 20 ●●●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/modules/yunding/dao/YdOrderDao.java 6 ●●●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/modules/yunding/dto/TeamInfoDto.java 21 ●●●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/modules/yunding/service/Impl/YunDingServiceImpl.java 44 ●●●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/modules/yunding/service/YunDingService.java 2 ●●●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/modules/yunding/vo/TeamInfoVo.java 17 ●●●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/modules/yunding/vo/TeamVo.java 23 ●●●●● patch | view | raw | blame | history
src/main/resources/mapper/yunding/YdOrderDao.xml 17 ●●●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/modules/yunding/controller/YunDingController.java
@@ -160,6 +160,26 @@
        return yunDingService.bugAgentLevel(bugAgentLeveldto);
    }
    /**
     * 我的团队信息
     */
    @ApiOperation(value = "我的团队信息")
    @ApiResponses({
            @ApiResponse(code = 0, message = "success", response = TeamVo.class)
    })
    @PostMapping(value = "/getAgentList")
    public Result getTeamList(@RequestBody @Validated TeamInfoDto teamInfoDto) {
        return yunDingService.getTeamList(teamInfoDto);
    }
src/main/java/com/xcong/excoin/modules/yunding/dao/YdOrderDao.java
@@ -3,10 +3,12 @@
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.xcong.excoin.modules.member.entity.MemberEntity;
import com.xcong.excoin.modules.yunding.dto.YdOrderListDto;
import com.xcong.excoin.modules.yunding.entity.YdBasicLevelSettingEntity;
import com.xcong.excoin.modules.yunding.entity.YdOrderEntity;
import com.xcong.excoin.modules.yunding.vo.AgentVo;
import com.xcong.excoin.modules.yunding.vo.TeamInfoVo;
import com.xcong.excoin.modules.yunding.vo.YdOrderVo;
import org.apache.ibatis.annotations.Param;
@@ -32,4 +34,8 @@
    List<YdOrderEntity> selectTeamAllPower(@Param("inviteId") String inviteId);
    int updateOrderProfit(@Param("profit") BigDecimal profit, @Param("id") Long id);
    int selectAllPowerByMemberIdAndElse(@Param("inviteId")String inviteId);
    IPage<TeamInfoVo> getTeamInfoList(Page<TeamInfoVo> page, @Param("record")MemberEntity memberEntity);
}
src/main/java/com/xcong/excoin/modules/yunding/dto/TeamInfoDto.java
New file
@@ -0,0 +1,21 @@
package com.xcong.excoin.modules.yunding.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
@Data
@ApiModel(value = "TeamInfoDto", description = "团队入参类")
public class TeamInfoDto {
    @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/yunding/service/Impl/YunDingServiceImpl.java
@@ -1,7 +1,6 @@
package com.xcong.excoin.modules.yunding.service.Impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
@@ -42,7 +41,6 @@
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
@Slf4j
@@ -599,6 +597,48 @@
        return Result.ok(xchNewPrices);
    }
    @Override
    public Result getTeamList(TeamInfoDto teamInfoDto) {
        log.info("获取团队信息");
        MemberEntity memberEntity = LoginUserUtils.getAppLoginUser();
        Long memberId = memberEntity.getId();
        /**
         * 获取团队总人数,总购买数
         *      详细列表
         *
         */
        TeamVo teamVo = new TeamVo();
        //团队总人数
        int memberNum = 0;
        //直接下级
        QueryWrapper<MemberEntity> objectQueryWrapper = new QueryWrapper<>();
        objectQueryWrapper.eq("referer_id",memberEntity.getInviteId());
        List<MemberEntity> memberEntities = memberDao.selectList(objectQueryWrapper);
        if(CollUtil.isNotEmpty(memberEntities)){
            memberNum = memberEntities.size();
        }
        teamVo.setMemberNum(memberNum);
        //总购买数
        int allPower = ydOrderDao.selectAllPowerByMemberIdAndElse(memberEntity.getInviteId());
        teamVo.setAllPower(allPower);
        //详细列表
        Page<TeamInfoVo> page = new Page<>(teamInfoDto.getPageNum(), teamInfoDto.getPageSize());
        IPage<TeamInfoVo> teamInfoVos = ydOrderDao.getTeamInfoList(page, memberEntity);
        List<TeamInfoVo> records = teamInfoVos.getRecords();
        if(CollUtil.isNotEmpty(records)){
            for(TeamInfoVo teamInfoVo : records){
                String phone = teamInfoVo.getPhone();
                if(StrUtil.isNotEmpty(phone)){
                    teamInfoVo.setPhone(StrUtil.subSufByLength(phone,4));
                }
            }
        }
        teamVo.setTeamInfoVos(records);
        return Result.ok(teamVo);
    }
    /**
     * 去加减币币账户余额,减少产品的剩余数目
src/main/java/com/xcong/excoin/modules/yunding/service/YunDingService.java
@@ -32,4 +32,6 @@
    Result bugAgentLevel(BugAgentLeveldto bugAgentLeveldto);
    Result getXchPrice();
    Result getTeamList(TeamInfoDto teamInfoDto);
}
src/main/java/com/xcong/excoin/modules/yunding/vo/TeamInfoVo.java
New file
@@ -0,0 +1,17 @@
package com.xcong.excoin.modules.yunding.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import lombok.Data;
@Data
@ApiModel(value = "TeamInfoVo", description = "团队详情")
public class TeamInfoVo {
    @ApiModelProperty("账号")
    private String phone;
    @ApiModelProperty("购买算力")
    private Integer powerNum;
}
src/main/java/com/xcong/excoin/modules/yunding/vo/TeamVo.java
New file
@@ -0,0 +1,23 @@
package com.xcong.excoin.modules.yunding.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
@Data
@ApiModel(value = "TeamVo", description = "团队")
public class TeamVo {
    @ApiModelProperty("团队人数")
    private Integer memberNum;
    @ApiModelProperty("购买总算力")
    private Integer allPower;
    @ApiModelProperty("团队详情")
    private List<TeamInfoVo> teamInfoVos;
}
src/main/resources/mapper/yunding/YdOrderDao.xml
@@ -103,4 +103,21 @@
                today_profit=#{profit}
        where id=#{id}
    </update>
    <select id="selectAllPowerByMemberIdAndElse" resultType="java.lang.Integer">
        select ifnull(sum(quantity),0) from yd_order where type = 1 and member_id in (
            select member_id from member where referer_id = #{inviteId}
            )
    </select>
    <select id="getTeamInfoList" resultType="com.xcong.excoin.modules.yunding.vo.TeamInfoVo">
        select a.phone phone,
               sum(quantity) powerNum
        from member a
        left join yd_order b where b.member_id = a.id
        where a.referer_id = #{record.inviteId}
            and b.type = 1
        group by a.member_id
        order by a.create_time desc
    </select>
</mapper>