src/main/java/com/xcong/excoin/modules/documentary/controller/TraderController.java
@@ -20,6 +20,7 @@ import com.xcong.excoin.modules.documentary.vo.TradeOrderInfoVo; import com.xcong.excoin.modules.documentary.vo.TradeProfitInfoVo; import com.xcong.excoin.modules.documentary.vo.TradeSetInfoVo; import com.xcong.excoin.modules.documentary.vo.TradeSetLabelInfoVo; import com.xcong.excoin.modules.documentary.vo.TraderStatusVo; import io.swagger.annotations.Api; @@ -118,6 +119,16 @@ } /** * 交易员设置--进入编辑---获取标签信息 */ @ApiOperation(value="交易员设置--进入编辑---获取标签信息", notes="交易员设置--进入编辑---获取标签信息") @ApiResponses({@ApiResponse( code = 200, message = "success", response = TradeSetLabelInfoVo.class)}) @GetMapping(value = "/getTradeSetLabelInfo") public Result getTradeSetLabelInfo() { return documentaryService.getTradeSetLabelInfo(); } /** * 交易员设置--更新设置 */ @ApiOperation(value="交易员设置--更新设置", notes="交易员设置--更新设置") src/main/java/com/xcong/excoin/modules/documentary/dao/FollowTraderLabelDao.java
New file @@ -0,0 +1,8 @@ package com.xcong.excoin.modules.documentary.dao; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.xcong.excoin.modules.documentary.entity.FollowTraderLabelEntity; public interface FollowTraderLabelDao extends BaseMapper<FollowTraderLabelEntity> { } src/main/java/com/xcong/excoin/modules/documentary/dto/UpdateTradeSetInfoDto.java
@@ -21,5 +21,7 @@ @NotNull(message = "宣言不能为空") @ApiModelProperty("宣言") private String declaration; @ApiModelProperty("标签") private String labels; } src/main/java/com/xcong/excoin/modules/documentary/entity/FollowTraderInfoEntity.java
@@ -38,6 +38,10 @@ */ private String declaration; /** * 标签 */ private String labels; /** * 是否满员 1-是2-否 */ private Integer isAll; src/main/java/com/xcong/excoin/modules/documentary/entity/FollowTraderLabelEntity.java
New file @@ -0,0 +1,24 @@ package com.xcong.excoin.modules.documentary.entity; import com.baomidou.mybatisplus.annotation.TableName; import com.xcong.excoin.common.system.base.BaseEntity; import lombok.Data; import lombok.EqualsAndHashCode; @EqualsAndHashCode(callSuper = true) @Data @TableName("follow_trader_label") public class FollowTraderLabelEntity extends BaseEntity{ /** * */ private static final long serialVersionUID = 1L; /** * 标签 */ private String labels; } src/main/java/com/xcong/excoin/modules/documentary/service/DocumentaryService.java
@@ -69,5 +69,7 @@ public Result getFollowFollowerNoticeList(@Valid FollowFollowerNoticeDto followFollowerNoticeDto); public Result getTradeSetLabelInfo(); } src/main/java/com/xcong/excoin/modules/documentary/service/impl/DocumentaryServiceImpl.java
@@ -16,8 +16,10 @@ import org.springframework.transaction.annotation.Transactional; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.taobao.api.internal.toplink.embedded.websocket.util.StringUtil; import com.xcong.excoin.common.LoginUserUtils; import com.xcong.excoin.common.response.Result; import com.xcong.excoin.modules.coin.dao.OrderCoinsDao; @@ -32,6 +34,7 @@ import com.xcong.excoin.modules.documentary.dao.FollowFollowerProfitDao; import com.xcong.excoin.modules.documentary.dao.FollowFollowerSettingDao; import com.xcong.excoin.modules.documentary.dao.FollowTraderInfoDao; import com.xcong.excoin.modules.documentary.dao.FollowTraderLabelDao; import com.xcong.excoin.modules.documentary.dao.FollowTraderProfitDetailDao; import com.xcong.excoin.modules.documentary.dao.FollowTraderProfitInfoDao; import com.xcong.excoin.modules.documentary.dto.CancelDocumentaryOrderSetDto; @@ -51,6 +54,7 @@ import com.xcong.excoin.modules.documentary.entity.FollowFollowerProfitEntity; import com.xcong.excoin.modules.documentary.entity.FollowFollowerSettingEntity; import com.xcong.excoin.modules.documentary.entity.FollowTraderInfoEntity; import com.xcong.excoin.modules.documentary.entity.FollowTraderLabelEntity; import com.xcong.excoin.modules.documentary.entity.FollowTraderProfitInfoEntity; import com.xcong.excoin.modules.documentary.service.DocumentaryService; import com.xcong.excoin.modules.documentary.vo.DocumentaryOrderInfoVo; @@ -68,6 +72,7 @@ import com.xcong.excoin.modules.documentary.vo.TradeOrderInfoVo; import com.xcong.excoin.modules.documentary.vo.TradeProfitInfoVo; import com.xcong.excoin.modules.documentary.vo.TradeSetInfoVo; import com.xcong.excoin.modules.documentary.vo.TradeSetLabelInfoVo; import com.xcong.excoin.modules.documentary.vo.TraderStatusVo; import com.xcong.excoin.modules.member.dao.MemberDao; import com.xcong.excoin.modules.member.dao.MemberLevelRateDao; @@ -80,6 +85,7 @@ import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; import jnr.ffi.Struct.int16_t; import lombok.extern.slf4j.Slf4j; @Slf4j @@ -116,6 +122,8 @@ private FollowFollowerOrderRelationDao followFollowerOrderRelationDao; @Resource private FollowFollowerNoticeDao followFollowerNoticeDao; @Resource private FollowTraderLabelDao followTraderLabelDao; @Override @@ -165,9 +173,38 @@ FollowTraderProfitInfoVo.setDeclaration(declaration); Integer isAll = followTraderInfoEntity.getIsAll(); FollowTraderProfitInfoVo.setIsAll(isAll); String labels = followTraderInfoEntity.getLabels(); if(StrUtil.isNotEmpty(labels)) { String labelsName = ""; String[] split = labels.split(","); int length = split.length; for(int i = 0;i < length;i++) { String string = split[i]; FollowTraderLabelEntity selectById = followTraderLabelDao.selectById(Long.parseLong(string)); labelsName = selectById.getLabels(); labelsName += (labelsName + ","); } FollowTraderProfitInfoVo.setLabels(labelsName); } } } return Result.ok(followTraderProfitInfoVoList); } public static void main(String[] args) { String labels = ""; if(StrUtil.isNotEmpty(labels)) { String labelsName = ""; String[] split = labels.split(","); int length = split.length; for(int i = 0;i < length;i++) { String string = split[i]; labelsName += (string + ","); } System.out.println(labelsName); } } @Override @@ -744,6 +781,20 @@ tradeSetInfoVo.setDeclaration(declaration); Integer isOpen = followTraderInfoEntity.getIsOpen(); tradeSetInfoVo.setIsOpen(isOpen); String labels = followTraderInfoEntity.getLabels(); if(StrUtil.isNotEmpty(labels)) { String labelsName = ""; String[] split = labels.split(","); int length = split.length; for(int i = 0;i < length;i++) { String string = split[i]; FollowTraderLabelEntity selectById = followTraderLabelDao.selectById(Long.parseLong(string)); labelsName = selectById.getLabels(); labelsName += (labelsName + ","); } tradeSetInfoVo.setLabels(labelsName); } return Result.ok(tradeSetInfoVo); } @@ -760,6 +811,8 @@ String nickname = updateTradeSetInfoDto.getNickname(); String declaration = updateTradeSetInfoDto.getDeclaration(); int isOpen = updateTradeSetInfoDto.getIsOpen(); String labels = updateTradeSetInfoDto.getLabels(); followTraderInfoEntity.setLabels(labels); followTraderInfoEntity.setAvatar(avatar); followTraderInfoEntity.setNickname(nickname); followTraderInfoEntity.setDeclaration(declaration); @@ -1054,6 +1107,27 @@ return Result.ok(arrayList); } @Override public Result getTradeSetLabelInfo() { //获取用户ID Long memberId = LoginUserUtils.getAppLoginUser().getId(); Map<String, Object> columnMap = new HashMap<>(); List<FollowTraderLabelEntity> selectByMap = followTraderLabelDao.selectByMap(columnMap); ArrayList<TradeSetLabelInfoVo> arrayList = new ArrayList<>(); if(CollUtil.isNotEmpty(selectByMap)) { for(FollowTraderLabelEntity followTraderLabelEntity : selectByMap) { TradeSetLabelInfoVo tradeSetLabelInfoVo = new TradeSetLabelInfoVo(); Long id = followTraderLabelEntity.getId(); String labels = followTraderLabelEntity.getLabels(); tradeSetLabelInfoVo.setId(id); tradeSetLabelInfoVo.setLabels(labels); arrayList.add(tradeSetLabelInfoVo); } } return Result.ok(arrayList); } src/main/java/com/xcong/excoin/modules/documentary/vo/FollowTraderProfitInfoVo.java
@@ -72,6 +72,11 @@ */ @ApiModelProperty("宣言") private String declaration; /** * 标签 */ @ApiModelProperty("标签") private String labels; /** * 是否满员 1-是2-否 */ src/main/java/com/xcong/excoin/modules/documentary/vo/TradeSetInfoVo.java
@@ -23,6 +23,9 @@ @ApiModelProperty("宣言") private String declaration; @ApiModelProperty("标签") private String labels; } src/main/java/com/xcong/excoin/modules/documentary/vo/TradeSetLabelInfoVo.java
New file @@ -0,0 +1,17 @@ package com.xcong.excoin.modules.documentary.vo; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @Data @ApiModel(value = "TradeSetLabelInfoVo", description = "返回类") public class TradeSetLabelInfoVo { @ApiModelProperty(value = "ID") private Long Id; @ApiModelProperty("标签") private String labels; } src/main/resources/mapper/documentary/FollowTraderLabelDao.xml
New file @@ -0,0 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.xcong.excoin.modules.documentary.dao.FollowTraderLabelDao"> </mapper> src/test/java/com/xcong/excoin/ReturnMoneyTest.java
@@ -10,8 +10,10 @@ import com.xcong.excoin.modules.contract.service.impl.OrderWebsocketServiceImpl; import com.xcong.excoin.modules.member.dao.AgentReturnDao; import com.xcong.excoin.modules.member.dao.MemberWalletAgentDao; import com.xcong.excoin.modules.member.dao.MemberWalletCoinDao; import com.xcong.excoin.modules.member.entity.AgentReturnEntity; import com.xcong.excoin.modules.member.entity.MemberWalletAgentEntity; import com.xcong.excoin.modules.member.entity.MemberWalletCoinEntity; import com.xcong.excoin.utils.SpringContextHolder; import com.xcong.excoin.utils.ThreadPoolUtils; import lombok.extern.slf4j.Slf4j; @@ -39,6 +41,8 @@ private MemberWalletAgentDao memberWalletAgentDao; @Resource private MemberAccountMoneyChangeDao memberAccountMoneyChangeDao; @Resource private MemberWalletCoinDao memberWalletCoinDao; /*@Test public void returnTest() { @@ -56,14 +60,19 @@ for (AgentReturnEntity agentReturn : list) { BigDecimal needReturn = agentReturn.getReturnAmount(); Long refererId = agentReturn.getRefererId(); MemberWalletAgentEntity walletAgent = memberWalletAgentDao.selectWalletAgentBymIdAndCode(refererId, "USDT"); if (walletAgent == null) { //查询币币钱包 MemberWalletCoinEntity memberWalletCoinEntity = memberWalletCoinDao.selectWalletCoinBymIdAndCode(refererId, "USDT"); // MemberWalletAgentEntity walletAgent = memberWalletAgentDao.selectWalletAgentBymIdAndCode(refererId, "USDT"); // if (walletAgent == null) { // continue; // } if (memberWalletCoinEntity == null) { continue; } log.info("用户ID:{}, 当前余额:{},总金额:{}, 返佣金额:{}", refererId, walletAgent.getAvailableBalance().toPlainString(), walletAgent.getTotalBalance().toPlainString(), needReturn); walletAgent.setAvailableBalance(walletAgent.getAvailableBalance().add(needReturn)); walletAgent.setTotalBalance(walletAgent.getTotalBalance().add(needReturn)); log.info("用户ID:{}, 当前余额:{},总金额:{}, 返佣金额:{}", refererId, memberWalletCoinEntity.getAvailableBalance().toPlainString(), memberWalletCoinEntity.getTotalBalance().toPlainString(), needReturn); memberWalletCoinEntity.setAvailableBalance(memberWalletCoinEntity.getAvailableBalance().add(needReturn)); memberWalletCoinEntity.setTotalBalance(memberWalletCoinEntity.getTotalBalance().add(needReturn)); MemberAccountMoneyChange moneyChange = new MemberAccountMoneyChange(); @@ -75,7 +84,7 @@ moneyChange.setSymbol("USDT"); // // 更新代理钱包金额 memberWalletAgentDao.updateById(walletAgent); memberWalletCoinDao.updateById(memberWalletCoinEntity); // // 更新返佣明细中状态 agentReturnDao.updateAgentReturnStatusByRefererId(AgentReturnEntity.IS_RETURN_Y, refererId); // // 插入财务流水记录