Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yd-product
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
xingmin
yd-product
Commits
7f382e6e
Commit
7f382e6e
authored
Dec 12, 2025
by
zhangxingmin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
push
parent
29d6a4cd
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
91 additions
and
1 deletions
+91
-1
yd-product-api/src/main/java/com/yd/product/api/service/impl/ApiAnnouncementCommissionRatioServiceImpl.java
+0
-0
yd-product-api/src/main/java/com/yd/product/api/utils/ProductCommonUtils.java
+87
-0
yd-product-feign/src/main/java/com/yd/product/feign/dto/ApiAnnouncementCommissionRatioBatchSaveDto.java
+4
-1
No files found.
yd-product-api/src/main/java/com/yd/product/api/service/impl/ApiAnnouncementCommissionRatioServiceImpl.java
View file @
7f382e6e
This diff is collapsed.
Click to expand it.
yd-product-api/src/main/java/com/yd/product/api/utils/ProductCommonUtils.java
0 → 100644
View file @
7f382e6e
package
com
.
yd
.
product
.
api
.
utils
;
import
java.util.Arrays
;
import
java.util.HashSet
;
import
java.util.Set
;
import
java.util.stream.Collectors
;
public
class
ProductCommonUtils
{
/**
* 解析年限字符串为整数
* @param yearStr
* @return
*/
public
static
Integer
parseYearToInt
(
String
yearStr
)
{
if
(
yearStr
==
null
||
yearStr
.
trim
().
isEmpty
())
{
return
null
;
}
try
{
// 提取数字部分,支持"1"、"1年"、"第1年"等格式
String
numericPart
=
yearStr
.
replaceAll
(
"[^0-9]"
,
""
).
trim
();
if
(
numericPart
.
isEmpty
())
{
return
null
;
}
return
Integer
.
parseInt
(
numericPart
);
}
catch
(
NumberFormatException
e
)
{
return
null
;
}
}
/**
* 检查年限区间是否重叠
* 根据需求:1-3和3-5算重叠,1-3和4-7不算重叠
* @param start1
* @param end1
* @param start2
* @param end2
* @return
*/
public
static
boolean
isYearRangeOverlap
(
int
start1
,
int
end1
,
int
start2
,
int
end2
)
{
// 两个区间重叠的条件:区间1的结束年份 >= 区间2的开始年份
// 例如:1-3和3-5重叠(3>=3),1-3和4-7不重叠(3<4)
return
Math
.
max
(
start1
,
start2
)
<=
Math
.
min
(
end1
,
end2
);
}
/**
* 将scope字符串解析为集合
* @param scope
* @return
*/
public
static
Set
<
String
>
parseScopeToSet
(
String
scope
)
{
if
(
scope
==
null
||
scope
.
trim
().
isEmpty
())
{
return
new
HashSet
<>();
}
return
Arrays
.
stream
(
scope
.
split
(
";"
))
.
map
(
String:
:
trim
)
.
filter
(
s
->
!
s
.
isEmpty
())
.
collect
(
Collectors
.
toSet
());
}
/**
* 检查两个scope集合是否有交集
*/
public
static
boolean
hasScopeIntersection
(
Set
<
String
>
scopeSet1
,
Set
<
String
>
scopeSet2
)
{
// 特殊情况处理
if
(
scopeSet1
.
isEmpty
()
||
scopeSet2
.
isEmpty
())
{
return
false
;
}
// 如果任一集合包含"全部",则视为有交集
if
(
scopeSet1
.
contains
(
"全部"
)
||
scopeSet2
.
contains
(
"全部"
))
{
return
true
;
}
// 检查是否有共同元素
for
(
String
item
:
scopeSet1
)
{
if
(
scopeSet2
.
contains
(
item
))
{
return
true
;
}
}
return
false
;
}
}
yd-product-feign/src/main/java/com/yd/product/feign/dto/ApiAnnouncementCommissionRatioBatchSaveDto.java
View file @
7f382e6e
package
com
.
yd
.
product
.
feign
.
dto
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
lombok.Data
;
import
javax.validation.constraints.NotBlank
;
...
...
@@ -43,17 +44,19 @@ public class ApiAnnouncementCommissionRatioBatchSaveDto {
/**
* 有效开始时间
*/
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
)
@NotNull
(
message
=
"有效开始时间不能为空"
)
private
LocalDateTime
effectiveStart
;
/**
* 有效结束时间
*/
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
)
@NotNull
(
message
=
"有效结束时间不能为空"
)
private
LocalDateTime
effectiveEnd
;
/**
* 适用范围(经纪人/分销员/加盟商/签单员/转介人/全部,字典)
* 适用范围(经纪人/分销员/加盟商/签单员/转介人/全部,字典
,多选多个用分号分隔
)
*/
@NotBlank
(
message
=
"适用范围不能为空"
)
private
String
scope
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment