xiaoyong931011
2021-07-05 cf200a1f92c01ba22c326c49391f748ffb006910
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;
@@ -70,6 +72,11 @@
      List<FollowTraderInfoEntity> records = followTraderInfoEntitys.getRecords();
      if(CollUtil.isNotEmpty(records)) {
         for(FollowTraderInfoEntity followTraderInfo : records) {
            //获取当前跟单人数
            Long traderId = followTraderInfo.getId();
            String followNowNumString = followTraderInfoMapper.selectFollowNowBytraderId(traderId);
            followTraderInfo.setFollowNumNow(followNowNumString);
            Long memberId = followTraderInfo.getMemberId();
            Map<String, Object> columnMap = new HashMap<>();
            columnMap.put("member_id", memberId);
@@ -151,6 +158,7 @@
         memberMapper.updateById(memberEntity);
         //更新【交易员信息表】数据
         selectById.setProfitRatio(profitRatio);
         selectById.setEntryTime(new Date());
         selectById.setVerifyStatus(FollowTraderInfoEntity.VERIFYSTATUS_Y);
         followTraderInfoMapper.updateById(selectById);
         //新增【交易员收益信息 】数据
@@ -173,6 +181,7 @@
         redisUtils.set("app_" + token, JSONObject.toJSONString(memberEntity), 36000);
      }else {
         //更新【交易员信息表】数据
         selectById.setEntryTime(new Date());
         selectById.setVerifyStatus(FollowTraderInfoEntity.VERIFYSTATUS_N);
         followTraderInfoMapper.updateById(selectById);
      }
@@ -258,12 +267,46 @@
      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");
      }
      String followNumNow = followTraderInfoMapper.selectFollowNowBytraderId(id);
      int parseInt = Integer.parseInt(followNumNow);
      if(parseInt > followNum){
         return new FebsResponse().fail().message("请填写大于当前跟随人数"+parseInt+"的整数");
      }
      //更新【交易员信息表】数据
      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) {