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/java/com/xcong/excoin/modules/documentary/service/impl/DocumentaryServiceImpl.java | 32 +++++++++++++++++++++++++++++++-
1 files changed, 31 insertions(+), 1 deletions(-)
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) {
--
Gitblit v1.9.1