Toggle navigation
Toggle navigation
This project
Loading...
Sign in
jiujian
/
client-customer-order-api
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
chen.yinxiang
2026-02-04 14:59:06 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
7372d4633d0dfa3ec434d2cfdea71532b5a6f638
7372d463
1 parent
2701bf8b
fix:就餐人必传
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
23 deletions
src/main/java/com/infoloop/tianting/model/dto/OrderSubscriptionMessageDTO.java
src/main/java/com/infoloop/tianting/service/impl/MealOrderServiceImpl.java
src/main/java/com/infoloop/tianting/model/dto/OrderSubscriptionMessageDTO.java
View file @
7372d46
...
...
@@ -15,7 +15,8 @@ public class OrderSubscriptionMessageDTO {
@ApiModel
(
description
=
"创建订阅消息记录"
)
public
static
class
CreateOrderSubscriptionMessageDTO
{
@ApiModelProperty
(
value
=
"就餐人ID,可为空,后端根据实际情况处理"
,
required
=
false
)
@NotNull
(
message
=
"dinerId 不能为空"
)
@ApiModelProperty
(
value
=
"就餐人ID,必填"
,
required
=
true
)
private
Integer
dinerId
;
@ApiModelProperty
(
value
=
"订阅消息模板ID,可为空,为空时使用配置的默认值"
,
required
=
false
)
...
...
src/main/java/com/infoloop/tianting/service/impl/MealOrderServiceImpl.java
View file @
7372d46
...
...
@@ -310,12 +310,12 @@ public class MealOrderServiceImpl implements MealOrderService {
if
(
openId
==
null
||
openId
.
isBlank
())
{
throw
new
IllegalStateException
(
"当前登录用户 openId 为空,无法创建订阅提醒"
);
}
if
(
dto
.
getJumpPath
()
==
null
||
dto
.
getJumpPath
().
isBlank
())
{
throw
new
IllegalArgumentException
(
"jumpPath 不能为空"
);
}
// 1. 处理就餐人 ID:如果为空,从关联关系推断
int
dinerId
=
dto
.
getDinerId
()
!=
null
?
dto
.
getDinerId
()
:
getDefaultDinerId
(
enterpriseId
,
openId
);
// 1. dinerId 必传(避免默认推断导致业务歧义)
if
(
dto
.
getDinerId
()
==
null
)
{
throw
new
IllegalArgumentException
(
"dinerId 不能为空"
);
}
int
dinerId
=
dto
.
getDinerId
();
// 2. 处理模板 ID:如果为空,使用配置的默认值
String
finalTemplateId
=
(
dto
.
getTemplateId
()
!=
null
&&
!
dto
.
getTemplateId
().
isBlank
())
...
...
@@ -349,23 +349,6 @@ public class MealOrderServiceImpl implements MealOrderService {
);
}
/**
* 如果前端未传就餐人 ID,从当前用户的关联关系中推断默认值
* 如果只有一个关联的就餐人,返回该就餐人 ID;如果有多个或没有,返回 0
*/
private
int
getDefaultDinerId
(
int
enterpriseId
,
String
openId
)
{
final
var
loginInfo
=
LoginContextHolder
.
getLoginInfo
();
final
var
mpAccountDinerRefs
=
mealOrderServiceRpcClient
.
queryMpAccountDinerRefsByCondition
(
enterpriseId
,
Collections
.
singletonList
(
loginInfo
.
getId
()),
Collections
.
emptyList
()
);
if
(
mpAccountDinerRefs
.
size
()
==
1
)
{
return
mpAccountDinerRefs
.
get
(
0
).
getDinerId
();
}
return
0
;
}
private
static
final
class
Period
{
final
long
startAt
;
final
Long
endAt
;
...
...
Please
register
or
login
to post a comment