From 19e0e646a77de3c8e23717159d0c701f738c70a4 Mon Sep 17 00:00:00 2001 From: xiaoyong931011 <15274802129@163.com> Date: Tue, 04 Aug 2020 17:21:41 +0800 Subject: [PATCH] 20200804 代碼提交 --- src/main/java/com/xcong/excoin/modules/member/entity/MemberEntity.java | 1 src/main/java/com/xcong/excoin/modules/documentary/dto/FollowTraderInfoDto.java | 16 +++++ src/main/resources/templates/febs/views/modules/documentary/traderUpdate.html | 26 ++++++++ src/main/java/com/xcong/excoin/modules/documentary/controller/DocumentaryController.java | 29 +++++++++ src/main/java/com/xcong/excoin/modules/documentary/service/DocumentaryService.java | 8 ++ src/main/java/com/xcong/excoin/modules/documentary/service/impl/DocumentaryServiceImpl.java | 42 ++++++++++++-- src/main/resources/templates/febs/views/modules/documentary/traderDetail.html | 29 +-------- 7 files changed, 116 insertions(+), 35 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 6a407be..621939d 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 @@ -3,9 +3,11 @@ import java.util.Map; import javax.validation.Valid; +import javax.validation.constraints.NotNull; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @@ -14,6 +16,7 @@ import com.xcong.excoin.common.controller.BaseController; import com.xcong.excoin.common.entity.FebsResponse; import com.xcong.excoin.common.entity.QueryRequest; +import com.xcong.excoin.modules.documentary.dto.FollowTraderInfoDto; import com.xcong.excoin.modules.documentary.entity.FollowTraderInfoEntity; import com.xcong.excoin.modules.documentary.service.DocumentaryService; import com.xcong.excoin.modules.member.dto.MemberDetailConfirmDto; @@ -46,8 +49,30 @@ */ @PostMapping("traderConfirm") @ControllerEndpoint(operation = "交易员申请---确认", exceptionMessage = "认证失败") - public FebsResponse traderConfirm(@Valid FollowTraderInfoEntity followTraderInfoEntity) { - return documentaryService.traderConfirm(followTraderInfoEntity); + public FebsResponse traderConfirm(@Valid FollowTraderInfoDto followTraderInfoDto) { + return documentaryService.traderConfirm(followTraderInfoDto); + } + + /** + * 踢出交易员 + * @param id + * @return + */ + @GetMapping("traderGetOut/{id}") + @ControllerEndpoint(operation = "踢出交易员", exceptionMessage = "踢出失败") + public FebsResponse traderGetOut(@NotNull(message = "{required}") @PathVariable Long id) { + return documentaryService.traderGetOut(id); + } + + /** + * 设置成【满员】状态 + * @param id + * @return + */ + @GetMapping("traderGetFull/{id}") + @ControllerEndpoint(operation = "设置成【满员】状态", exceptionMessage = "设置失败") + public FebsResponse traderGetFull(@NotNull(message = "{required}") @PathVariable Long id) { + return documentaryService.traderGetFull(id); } } diff --git a/src/main/java/com/xcong/excoin/modules/documentary/dto/FollowTraderInfoDto.java b/src/main/java/com/xcong/excoin/modules/documentary/dto/FollowTraderInfoDto.java new file mode 100644 index 0000000..47d3eb0 --- /dev/null +++ b/src/main/java/com/xcong/excoin/modules/documentary/dto/FollowTraderInfoDto.java @@ -0,0 +1,16 @@ +package com.xcong.excoin.modules.documentary.dto; + +import javax.validation.constraints.NotNull; + +import lombok.Data; + +@Data +public class FollowTraderInfoDto { + + @NotNull(message = "ID不能为空") + private Long id; + + @NotNull(message = "ID不能为空") + private String isok; + +} 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 b21bfc2..b7bb220 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 @@ -1,11 +1,13 @@ package com.xcong.excoin.modules.documentary.service; import javax.validation.Valid; +import javax.validation.constraints.NotNull; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.service.IService; import com.xcong.excoin.common.entity.FebsResponse; import com.xcong.excoin.common.entity.QueryRequest; +import com.xcong.excoin.modules.documentary.dto.FollowTraderInfoDto; import com.xcong.excoin.modules.documentary.entity.FollowTraderInfoEntity; public interface DocumentaryService extends IService<FollowTraderInfoEntity> { @@ -14,6 +16,10 @@ FollowTraderInfoEntity selectTraderDetailByid(long id); - FebsResponse traderConfirm(@Valid FollowTraderInfoEntity followTraderInfoEntity); + FebsResponse traderConfirm(@Valid FollowTraderInfoDto followTraderInfoDto); + + FebsResponse traderGetOut(@NotNull(message = "{required}") Long id); + + FebsResponse traderGetFull(@NotNull(message = "{required}") Long id); } 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 6b9f140..d25b53d 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 @@ -1,11 +1,13 @@ package com.xcong.excoin.modules.documentary.service.impl; import java.math.BigDecimal; +import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.validation.Valid; +import javax.validation.constraints.NotNull; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -15,6 +17,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.xcong.excoin.common.entity.FebsResponse; import com.xcong.excoin.common.entity.QueryRequest; +import com.xcong.excoin.modules.documentary.dto.FollowTraderInfoDto; import com.xcong.excoin.modules.documentary.entity.FollowTraderInfoEntity; import com.xcong.excoin.modules.documentary.entity.FollowTraderProfitInfoEntity; import com.xcong.excoin.modules.documentary.mapper.FollowTraderInfoMapper; @@ -24,11 +27,9 @@ import com.xcong.excoin.modules.member.entity.MemberEntity; import com.xcong.excoin.modules.member.mapper.MemberAuthenticationMapper; import com.xcong.excoin.modules.member.mapper.MemberMapper; -import com.xcong.excoin.modules.member.vo.MemberAuthenticationVo; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.ObjectUtil; -import cn.hutool.core.util.StrUtil; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -108,13 +109,13 @@ @Override @Transactional - public FebsResponse traderConfirm(@Valid FollowTraderInfoEntity followTraderInfoEntity) { - Long id = followTraderInfoEntity.getId(); + public FebsResponse traderConfirm(@Valid FollowTraderInfoDto followTraderInfoDto) { + Long id = followTraderInfoDto.getId(); FollowTraderInfoEntity selectById = followTraderInfoMapper.selectById(id); if(ObjectUtil.isEmpty(selectById)) { return new FebsResponse().fail().message("交易员信息不存在"); } - String isok = followTraderInfoEntity.getIsok(); + String isok = followTraderInfoDto.getIsok(); if("1".equals(isok)) { //更新【会员信息表】数据 Long memberId = selectById.getMemberId(); @@ -129,6 +130,10 @@ followTraderInfoMapper.updateById(selectById); //新增【交易员收益信息 】数据 FollowTraderProfitInfoEntity followTraderProfitInfoEntity = new FollowTraderProfitInfoEntity(); + followTraderProfitInfoEntity.setCreateBy("system"); + followTraderProfitInfoEntity.setCreateTime(new Date()); + followTraderProfitInfoEntity.setUpdateBy("system"); + followTraderProfitInfoEntity.setUpdateTime(new Date()); followTraderProfitInfoEntity.setMemberId(memberId); followTraderProfitInfoEntity.setTraderId(selectById.getId()); followTraderProfitInfoEntity.setTotalProfitRatio(BigDecimal.ZERO); @@ -137,7 +142,7 @@ followTraderProfitInfoEntity.setWinRate(BigDecimal.ZERO); followTraderProfitInfoEntity.setTotalFollowerCnt(BigDecimal.ZERO); followTraderProfitInfoEntity.setTotalOrderCnt(BigDecimal.ZERO); - followTraderProfitInfoMapper.updateById(followTraderProfitInfoEntity); + followTraderProfitInfoMapper.insert(followTraderProfitInfoEntity); }else { //更新【交易员信息表】数据 selectById.setVerifyStatus(FollowTraderInfoEntity.VERIFYSTATUS_N); @@ -146,4 +151,29 @@ return new FebsResponse().success(); } + @Override + public FebsResponse traderGetOut(@NotNull(message = "{required}") Long id) { + FollowTraderInfoEntity followTraderInfoEntity = followTraderInfoMapper.selectById(id); + if(ObjectUtil.isEmpty(followTraderInfoEntity)) { + return new FebsResponse().fail().message("交易员信息不存在"); + } + Long memberId = followTraderInfoEntity.getMemberId(); + MemberEntity memberEntity = memberMapper.selectById(memberId); + memberEntity.setIsTrader(2); + memberMapper.updateById(memberEntity); + return new FebsResponse().success(); + } + + @Override + @Transactional + public FebsResponse traderGetFull(@NotNull(message = "{required}") Long id) { + FollowTraderInfoEntity followTraderInfoEntity = followTraderInfoMapper.selectById(id); + if(ObjectUtil.isEmpty(followTraderInfoEntity)) { + return new FebsResponse().fail().message("交易员信息不存在"); + } + followTraderInfoEntity.setIsAll(1); + followTraderInfoMapper.updateById(followTraderInfoEntity); + return new FebsResponse().success(); + } + } diff --git a/src/main/java/com/xcong/excoin/modules/member/entity/MemberEntity.java b/src/main/java/com/xcong/excoin/modules/member/entity/MemberEntity.java index e3c9d5f..7614c2e 100644 --- a/src/main/java/com/xcong/excoin/modules/member/entity/MemberEntity.java +++ b/src/main/java/com/xcong/excoin/modules/member/entity/MemberEntity.java @@ -143,7 +143,6 @@ /** * 是否是交易员1是2否 */ - @TableField(exist = false) private Integer isTrader; /** diff --git a/src/main/resources/templates/febs/views/modules/documentary/traderDetail.html b/src/main/resources/templates/febs/views/modules/documentary/traderDetail.html index f1e7ded..a8af392 100644 --- a/src/main/resources/templates/febs/views/modules/documentary/traderDetail.html +++ b/src/main/resources/templates/febs/views/modules/documentary/traderDetail.html @@ -26,49 +26,28 @@ </div> </div> <div class="layui-form-item"> - <label class="layui-form-label febs-form-item-require">真实姓名:</label> - <div class="layui-input-block"> - <input type="text" name="realName" minlength="4" maxlength="10" data-th-id="${member.realName}" - lay-verify="range|realName" autocomplete="off" class="layui-input" readonly> - </div> - </div> - <div class="layui-form-item"> - <label class="layui-form-label febs-form-item-require">电话:</label> - <div class="layui-input-block"> - <input type="text" name=phone minlength="4" maxlength="10" data-th-id="${member.phone}" - lay-verify="range|phone" autocomplete="off" class="layui-input" readonly> - </div> - </div> - <div class="layui-form-item"> - <label class="layui-form-label febs-form-item-require">邮箱:</label> - <div class="layui-input-block"> - <input type="text" name="email" minlength="4" maxlength="10" data-th-id="${member.email}" - lay-verify="range|email" autocomplete="off" class="layui-input" readonly> - </div> - </div> - <div class="layui-form-item"> - <label class="layui-form-label febs-form-item-require">利润率:</label> + <label class="layui-form-label">利润率:</label> <div class="layui-input-block"> <input type="text" name="profitRatio" minlength="4" maxlength="10" data-th-id="${member.profitRatio}" lay-verify="range|profitRatio" autocomplete="off" class="layui-input" readonly> </div> </div> <div class="layui-form-item"> - <label class="layui-form-label febs-form-item-require">币币账户总余额:</label> + <label class="layui-form-label">币币账户总余额:</label> <div class="layui-input-block"> <input type="text" name="walletNum" minlength="4" maxlength="10" data-th-id="${member.walletNum}" lay-verify="range|walletNum" autocomplete="off" class="layui-input" readonly> </div> </div> <div class="layui-form-item"> - <label class="layui-form-label febs-form-item-require">合约账户总余额:</label> + <label class="layui-form-label">合约账户总余额:</label> <div class="layui-input-block"> <input type="text" name="walletCoinNum" minlength="4" maxlength="10" data-th-id="${member.walletCoinNum}" lay-verify="range|walletCoinNum" autocomplete="off" class="layui-input" readonly> </div> </div> <div class="layui-form-item"> - <label class="layui-form-label febs-form-item-require">币币账户总余额:</label> + <label class="layui-form-label">币币账户总余额:</label> <div class="layui-input-block"> <input type="text" name="agentNum" minlength="4" maxlength="10" data-th-id="${member.agentNum}" lay-verify="range|agentNum" autocomplete="off" class="layui-input" readonly> diff --git a/src/main/resources/templates/febs/views/modules/documentary/traderUpdate.html b/src/main/resources/templates/febs/views/modules/documentary/traderUpdate.html index dc5be4b..5ed47b1 100644 --- a/src/main/resources/templates/febs/views/modules/documentary/traderUpdate.html +++ b/src/main/resources/templates/febs/views/modules/documentary/traderUpdate.html @@ -84,7 +84,30 @@ } }); } + if (layEvent === 'getOut') { + febs.modal.confirm('确认', '您是否要踢出该交易员?', function () { + confirmUsers(data.id); + }); + } + if (layEvent === 'getFull') { + febs.modal.confirm('确认', '您是否要设置成【满员】状态?', function () { + cancelUsers(data.id); + }); + } }); + + function confirmUsers(id) { + febs.get(ctx + 'documentary/traderGetOut/' + id, null, function () { + febs.alert.success('踢出成功'); + $query.click(); + }); + } + function cancelUsers(id) { + febs.get(ctx + 'documentary/traderGetFull/' + id, null, function () { + febs.alert.success('设置成功'); + $query.click(); + }); + } // 查询按钮 @@ -137,6 +160,9 @@ templet: function (d) { if (d.verifyStatus === 3) { return '<a lay-event="edit" shiro:hasPermission="user:update">审核</a>' + }else if(d.verifyStatus === 1){ + return '<a lay-event="getOut" shiro:hasPermission="user:update">踢出</a>' + return '<a lay-event="getFull" shiro:hasPermission="user:update">满员</a>' }else { return '' } -- Gitblit v1.9.1