|
@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import org.apache.commons.lang.math.NumberUtils;
|
|
|
import org.springblade.business.dto.StandardInfoJoinDTO;
|
|
|
import org.springblade.business.dto.StandardInfoPrivateJoinDTO;
|
|
|
import org.springblade.business.dto.StandardInfoDTO;
|
|
@@ -81,6 +82,20 @@ public class UStandardInfoServiceImpl extends ServiceImpl<StandardInfoMapper, St
|
|
|
item.setParentId(uStandardInfo.getId());
|
|
|
item.setStandardId(uStandardInfo.getStandardId());
|
|
|
item.setCreateUser(user.getUserId());
|
|
|
+
|
|
|
+ //判断符号之后的数据是否为数字
|
|
|
+ if (StringUtils.isNotEmpty(item.getSymbol())) {
|
|
|
+ if (!NumberUtils.isNumber(item.getName())) {
|
|
|
+ throw new ServiceException("数据错误,未知字符");
|
|
|
+ }
|
|
|
+ //如果是范围符号 则单独处理数据
|
|
|
+ if(StringUtils.equals(item.getSymbol(),"~")){
|
|
|
+ if (!NumberUtils.isNumber(item.getNameEnd())) {
|
|
|
+ throw new ServiceException("数据错误,未知字符");
|
|
|
+ }
|
|
|
+ item.setName(item.getName() + "~" + item.getNameEnd());
|
|
|
+ }
|
|
|
+ }
|
|
|
});
|
|
|
|
|
|
//把父级对象转出来单独保存
|
|
@@ -92,7 +107,7 @@ public class UStandardInfoServiceImpl extends ServiceImpl<StandardInfoMapper, St
|
|
|
return true;
|
|
|
} catch (BeansException e) {
|
|
|
e.printStackTrace();
|
|
|
- throw new ServiceException("添加失败");
|
|
|
+ throw new ServiceException(e.getMessage());
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -206,7 +221,7 @@ public class UStandardInfoServiceImpl extends ServiceImpl<StandardInfoMapper, St
|
|
|
Collections.sort(newRightIds);
|
|
|
|
|
|
String newRightIdsStr = String.join(",", newRightIds.stream().map(String::valueOf).collect(Collectors.toList()));
|
|
|
- if(CollectionUtil.isNotEmpty(newRightIds)){
|
|
|
+ if (CollectionUtil.isNotEmpty(newRightIds)) {
|
|
|
//把左Id加进来 确保只有在左id相同的情况下才进行判断
|
|
|
newRightIdsStr = newRightIdsStr + "," + leftId;
|
|
|
}
|
|
@@ -356,7 +371,7 @@ public class UStandardInfoServiceImpl extends ServiceImpl<StandardInfoMapper, St
|
|
|
@Override
|
|
|
public List<StandardInfoPrivateJoinVO> effectPreview(String ids) {
|
|
|
List<Long> collect = Arrays.stream(ids.split(",")).map(Long::parseLong).collect(Collectors.toList());
|
|
|
- return baseMapper.effectPreview(collect,collect.size());
|
|
|
+ return baseMapper.effectPreview(collect, collect.size());
|
|
|
}
|
|
|
}
|
|
|
|