From 3b4fa6022aa517be992026f921945bfc47925c1a Mon Sep 17 00:00:00 2001
From: xiaoyong931011 <15274802129@163.com>
Date: Thu, 04 Mar 2021 18:15:50 +0800
Subject: [PATCH] 20210321  跟单最大人数修改

---
 src/main/resources/templates/febs/views/modules/documentary/modifyProfitRatio.html          |   17 +++++++-
 src/main/resources/templates/febs/views/modules/documentary/traderUpdate.html               |    7 ++-
 src/main/java/com/xcong/excoin/modules/documentary/dto/ModifyProfitRatioDto.java            |    2 +
 src/main/java/com/xcong/excoin/modules/documentary/entity/FollowTraderInfoEntity.java       |    5 ++
 src/main/java/com/xcong/excoin/modules/documentary/service/impl/DocumentaryServiceImpl.java |   32 +++++++++++++++
 5 files changed, 57 insertions(+), 6 deletions(-)

diff --git a/src/main/java/com/xcong/excoin/modules/documentary/dto/ModifyProfitRatioDto.java b/src/main/java/com/xcong/excoin/modules/documentary/dto/ModifyProfitRatioDto.java
index 25047ba..fcb21e6 100644
--- a/src/main/java/com/xcong/excoin/modules/documentary/dto/ModifyProfitRatioDto.java
+++ b/src/main/java/com/xcong/excoin/modules/documentary/dto/ModifyProfitRatioDto.java
@@ -10,5 +10,7 @@
 	private Long id;
 	
 	private String profitRatio;
+	
+	private String followNum;
 
 }
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 2c4fb28..bc8bb17 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
@@ -64,6 +64,11 @@
     private Integer isOpen;
     public static final Integer ISOPEN_Y = 1;
     public static final Integer ISOPEN_N = 2;
+
+    /**
+     * 最大跟随人数
+     */
+    private Integer followNum;
     
     @TableField(exist = false)
     private String account;
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 8767b38..5770061 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
@@ -6,6 +6,8 @@
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 
 import javax.validation.Valid;
 import javax.validation.constraints.NotNull;
@@ -258,12 +260,40 @@
 		if(profitRatio.compareTo(BigDecimal.ZERO) < 0 || profitRatio.compareTo(BigDecimal.ONE) >= 0){
 			return new FebsResponse().fail().message("利润率设置规则:只允许0到1之间的小数");
 		}
+		//最大跟随人数
+		boolean matches = isMatches(modifyProfitRatioDto.getFollowNum());
+		if(!matches) {
+			return new FebsResponse().fail().message("最大跟随人数只能输入正整数");
+		}
+		Integer followNum = Integer.parseInt(modifyProfitRatioDto.getFollowNum());
+		if(ObjectUtil.isEmpty(followNum) || followNum == 0) {
+			return new FebsResponse().fail().message("最大跟随人数不能为0");
+		}
 		//更新【交易员信息表】数据
 		selectById.setProfitRatio(profitRatio);
-		selectById.setVerifyStatus(FollowTraderInfoEntity.VERIFYSTATUS_Y);
+		selectById.setFollowNum(followNum);
 		followTraderInfoMapper.updateById(selectById);
 		return new FebsResponse().success();
 	}
+	
+	public boolean isMatches(String bot){
+		 boolean flag=false;
+		 try{
+		  String regex="^[1-9]+[0-9]*$";
+		  //^[1-9]+\\d*$
+		  Pattern p=Pattern.compile(regex);
+		  Matcher m=p.matcher(bot);
+		  if(m.find()){
+		   System.out.println("successss");
+		  return true;
+		  }else{
+		  System.out.println("falsss");
+		  }
+		 }catch(Exception e){
+		  e.printStackTrace();
+		 }
+		 return flag;
+		}
 
 	@Override
 	public FebsResponse traderGetOn(@NotNull(message = "{required}") Long id) {
diff --git a/src/main/resources/templates/febs/views/modules/documentary/modifyProfitRatio.html b/src/main/resources/templates/febs/views/modules/documentary/modifyProfitRatio.html
index 9011d25..0f99626 100644
--- a/src/main/resources/templates/febs/views/modules/documentary/modifyProfitRatio.html
+++ b/src/main/resources/templates/febs/views/modules/documentary/modifyProfitRatio.html
@@ -38,6 +38,18 @@
             </div>
         </div>
         <div class="layui-form-item">
+            <div style="text-align: center;color:red">
+                最大跟随人数规则:请填写大于0的整数
+            </div>
+        </div>
+        <div class="layui-form-item">
+            <label class="layui-form-label">跟随人数:</label>
+            <div class="layui-input-block">
+                <input type="text" name="followNum" data-th-id="${member.followNum}"
+                       lay-verify="range|followNum" autocomplete="off" class="layui-input">
+            </div>
+        </div>
+        <div class="layui-form-item">
             <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}"
@@ -93,14 +105,15 @@
                 "email": member.email,
                 "agentNum": member.agentNum,
                 "walletCoinNum": member.walletCoinNum,
-                "walletNum": member.walletNum
+                "walletNum": member.walletNum,
+                "followNum": member.followNum
             });
         }
 
         form.on('submit(user-update-form-submit)', function (data) {
             febs.post(ctx + 'documentary/modifyProfitRatio', data.field, function () {
                 layer.closeAll();
-                febs.alert.success('认证成功');
+                febs.alert.success('修改成功');
                 $('#febs-user').find('#query').click();
             });
             return false;
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 656c9d2..5535ffe 100644
--- a/src/main/resources/templates/febs/views/modules/documentary/traderUpdate.html
+++ b/src/main/resources/templates/febs/views/modules/documentary/traderUpdate.html
@@ -86,7 +86,7 @@
                 });
             }
             if (layEvent === 'modifyProfitRatio') {
-                febs.modal.open('收益率修改', 'modules/documentary/modifyProfitRatio/' + data.id, {
+                febs.modal.open('修改', 'modules/documentary/modifyProfitRatio/' + data.id, {
                     btn: ['确认', '取消'],
                     yes: function (index, layero) {
                         $('#user-update').find('#submit').trigger('click');
@@ -167,6 +167,7 @@
                     {field: 'realName', title: '姓名', minWidth: 100,align:'left'},
                     {field: 'inviteId', title: '邀请码UID', minWidth: 80,align:'center'},
                     {field: 'profitRatio', title: '利润率', minWidth: 80,align:'center'},
+                    {field: 'followNum', title: '跟随人数', minWidth: 120,align:'center'},
                     {field: 'accountType', title: '账号类型',
                     	templet: function (d) {
                             if (d.accountType === 2) {
@@ -195,12 +196,12 @@
                             if (d.verifyStatus === 3) {
                             	return '<button lay-event="edit" shiro:hasPermission="user:update">审核</button>'
                             }else if(d.verifyStatus === 1 && d.isSetFrist ===1){
-                                return '<button lay-event="modifyProfitRatio" shiro:hasPermission="user:update">收益率修改</button>'
+                                return '<button lay-event="modifyProfitRatio" shiro:hasPermission="user:update">修改</button>'
                             	+ '<button lay-event="getOut" shiro:hasPermission="user:update">踢出</button>'
                             	+ '<button lay-event="getFull" shiro:hasPermission="user:update">满员</button>'
                                 + '<button lay-event="getOutFrist" shiro:hasPermission="user:update">取消推荐</button>'
                             }else if(d.verifyStatus === 1 && d.isSetFrist !=1){
-                                return '<button lay-event="modifyProfitRatio" shiro:hasPermission="user:update">收益率修改</button>'
+                                return '<button lay-event="modifyProfitRatio" shiro:hasPermission="user:update">修改</button>'
                                     + '<button lay-event="getOut" shiro:hasPermission="user:update">踢出</button>'
                                     + '<button lay-event="getFull" shiro:hasPermission="user:update">满员</button>'
                                     + '<button lay-event="getOn" shiro:hasPermission="user:update">推荐首页</button>'

--
Gitblit v1.9.1