Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
O
operate-customer-service
概览
概览
详情
活动
周期分析
版本库
存储库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
沈振路
operate-customer-service
Commits
0c706923
提交
0c706923
authored
9月 24, 2022
作者:
沈振路
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
人群包配置、接口
上级
81c4d132
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
26 行增加
和
3 行删除
+26
-3
CrowdPackageCommonConstant.java
...oyaozw/customer/constants/CrowdPackageCommonConstant.java
+5
-0
CrowdPackageServiceImpl.java
...oyaozw/customer/service/impl/CrowdPackageServiceImpl.java
+21
-3
没有找到文件。
src/main/java/com/yaoyaozw/customer/constants/CrowdPackageCommonConstant.java
浏览文件 @
0c706923
package
com
.
yaoyaozw
.
customer
.
constants
;
import
java.util.regex.Pattern
;
/**
* @author darker
* @date 2022/9/20 14:54
...
...
@@ -26,4 +29,6 @@ public class CrowdPackageCommonConstant {
public
static
final
Integer
NUN_STATIC_CONDITION
=
0
;
public
static
final
Pattern
NUMBER_COMPILE
=
Pattern
.
compile
(
"[\\d]"
);
}
src/main/java/com/yaoyaozw/customer/service/impl/CrowdPackageServiceImpl.java
浏览文件 @
0c706923
...
...
@@ -63,6 +63,15 @@ public class CrowdPackageServiceImpl extends ServiceImpl<MaterialCrowdPackageMap
Long
userId
=
tokenManager
.
getUserIdFromToken
();
CrowdPackage
crowdPackage
=
new
CrowdPackage
(
id
,
name
);
crowdPackage
.
handleInfo
(
new
Date
(),
userId
,
isCreate
);
if
(
ObjectUtil
.
isNotNull
(
name
))
{
// 判断是否有重名
QueryWrapper
<
CrowdPackage
>
nameRepeatWrapper
=
new
QueryWrapper
<
CrowdPackage
>().
eq
(
"name"
,
name
).
ne
(
"id"
,
id
);
int
count
=
super
.
count
(
nameRepeatWrapper
);
if
(
count
!=
0
)
{
LOCAL_LOG
.
info
(
"人群包名: {} 有重复"
,
name
);
return
new
GenericsResult
<>(
false
,
"人群包名已存在!"
);
}
}
// 执行保存
boolean
result
=
super
.
saveOrUpdate
(
crowdPackage
);
return
result
?
new
GenericsResult
<>(
new
CrowdPackageCommonIdVO
(
crowdPackage
.
getId
(),
null
))
:
new
GenericsResult
<>(
false
,
"新增人群包失败!"
);
...
...
@@ -99,6 +108,7 @@ public class CrowdPackageServiceImpl extends ServiceImpl<MaterialCrowdPackageMap
@Override
public
GenericsResult
<
CrowdPackageDetailVO
>
getPackageInfo
(
Long
id
)
{
LOCAL_LOG
.
info
(
"获取详情"
);
CrowdPackage
byId
=
super
.
getById
(
id
);
if
(
ObjectUtil
.
isNull
(
byId
))
{
return
new
GenericsResult
<>(
false
,
"无法获取主体数据"
);
...
...
@@ -123,7 +133,7 @@ public class CrowdPackageServiceImpl extends ServiceImpl<MaterialCrowdPackageMap
@Override
public
BaseResult
removeCrowdPackage
(
Long
id
)
{
return
super
.
removeById
(
id
)
?
new
BaseResult
().
error
(
"删除异常!"
)
:
new
BaseResult
().
success
(
);
return
super
.
removeById
(
id
)
?
new
BaseResult
().
success
()
:
new
BaseResult
().
error
(
"删除异常!"
);
}
@Override
...
...
@@ -217,6 +227,7 @@ public class CrowdPackageServiceImpl extends ServiceImpl<MaterialCrowdPackageMap
String
compareOperator
=
conditionDto
.
getCompareOperator
();
String
conditionValue
=
conditionDto
.
getConditionValue
();
LOCAL_LOG
.
info
(
"比较符: {}; 条件值: {}"
,
compareOperator
,
conditionValue
);
match
.
setConditionOperator
(
compareOperator
);
match
.
setOperatorValue
(
conditionValue
);
...
...
@@ -224,12 +235,19 @@ public class CrowdPackageServiceImpl extends ServiceImpl<MaterialCrowdPackageMap
if
(
ObjectUtil
.
isNull
(
operatorInfo
))
{
throw
new
RuntimeException
(
"无法获取比较类型"
);
}
String
expression
=
conditionInfo
.
getConditionKey
()
+
" "
+
operatorInfo
.
getMeaning
()
+
" "
+
conditionValue
;
LOCAL_LOG
.
info
(
"表达式拼接结果: {}"
,
expression
);
String
description
=
conditionInfo
.
getConditionName
()
+
operatorInfo
.
getDescription
()
+
conditionValue
;
LOCAL_LOG
.
info
(
"条件描述: {}"
,
description
);
// 判断是不是数字
if
(!
CrowdPackageCommonConstant
.
NUMBER_COMPILE
.
matcher
(
conditionValue
).
matches
())
{
// 不是数字,添加引号,否则sql报错
conditionValue
=
"'"
+
conditionValue
+
"'"
;
}
String
expression
=
conditionInfo
.
getConditionKey
()
+
" "
+
operatorInfo
.
getMeaning
()
+
" "
+
conditionValue
;
LOCAL_LOG
.
info
(
"表达式拼接结果: {}"
,
expression
);
match
.
setOperatorExpression
(
expression
);
match
.
setOperatorDescription
(
description
);
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论