Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
fit-finance
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
fitness-server
fit-finance
Commits
a158089f
Commit
a158089f
authored
Aug 14, 2024
by
程裕兵
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:listBoundEmbeddedXcx
parent
c6c26678
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
53 deletions
+18
-53
repository/src/main/java/com/jiejing/fitness/finance/repository/service/StudioEmbeddedXcxApplyRpService.java
+9
-0
service/src/main/java/com/jiejing/fitness/finance/service/merchant/impl/StudioMerchantServiceImpl.java
+9
-53
No files found.
repository/src/main/java/com/jiejing/fitness/finance/repository/service/StudioEmbeddedXcxApplyRpService.java
View file @
a158089f
...
@@ -15,6 +15,7 @@
...
@@ -15,6 +15,7 @@
package
com
.
jiejing
.
fitness
.
finance
.
repository
.
service
;
package
com
.
jiejing
.
fitness
.
finance
.
repository
.
service
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.jiejing.fitness.enums.finance.EmbededXcxEnum
;
import
com.jiejing.fitness.finance.repository.entity.StudioEmbeddedXcxApply
;
import
com.jiejing.fitness.finance.repository.entity.StudioEmbeddedXcxApply
;
import
com.jiejing.fitness.finance.repository.mapper.StudioEmbeddedXcxApplyMapper
;
import
com.jiejing.fitness.finance.repository.mapper.StudioEmbeddedXcxApplyMapper
;
import
com.jiejing.mbp.MapperRepoService
;
import
com.jiejing.mbp.MapperRepoService
;
...
@@ -69,4 +70,12 @@ public class StudioEmbeddedXcxApplyRpService extends
...
@@ -69,4 +70,12 @@ public class StudioEmbeddedXcxApplyRpService extends
wrapper
.
in
(
StudioEmbeddedXcxApply
.
AUTHORIZER_APP_ID
,
appIds
);
wrapper
.
in
(
StudioEmbeddedXcxApply
.
AUTHORIZER_APP_ID
,
appIds
);
return
Optional
.
ofNullable
(
this
.
baseMapper
.
selectList
(
wrapper
)).
orElse
(
new
ArrayList
<>(
1
));
return
Optional
.
ofNullable
(
this
.
baseMapper
.
selectList
(
wrapper
)).
orElse
(
new
ArrayList
<>(
1
));
}
}
public
List
<
StudioEmbeddedXcxApply
>
listAllInit
(
String
componentAppId
,
String
embeddedAppId
)
{
QueryWrapper
<
StudioEmbeddedXcxApply
>
wrapper
=
new
QueryWrapper
<>();
wrapper
.
eq
(
StudioEmbeddedXcxApply
.
COMPONENT_APP_ID
,
componentAppId
);
wrapper
.
eq
(
StudioEmbeddedXcxApply
.
EMBEDDED_APP_ID
,
embeddedAppId
);
wrapper
.
eq
(
StudioEmbeddedXcxApply
.
STATE
,
EmbededXcxEnum
.
INIT
.
getCode
());
return
Optional
.
ofNullable
(
this
.
baseMapper
.
selectList
(
wrapper
)).
orElse
(
new
ArrayList
<>(
1
));
}
}
}
service/src/main/java/com/jiejing/fitness/finance/service/merchant/impl/StudioMerchantServiceImpl.java
View file @
a158089f
...
@@ -347,67 +347,23 @@ public class StudioMerchantServiceImpl implements StudioMerchantService {
...
@@ -347,67 +347,23 @@ public class StudioMerchantServiceImpl implements StudioMerchantService {
@Override
@Override
public
void
syncEmbeddedXcx
()
{
public
void
syncEmbeddedXcx
()
{
List
<
AuthXcxInfo
>
list
=
this
.
listBoundAppIds
();
List
<
StudioEmbeddedXcxApply
>
applies
=
studioEmbeddedXcxApplyRpService
.
listAllInit
(
wxComponentAppId
,
if
(
CollectionUtil
.
isEmpty
(
list
))
{
embeddedAppId
);
return
;
}
List
<
StudioEmbeddedXcxApply
>
applies
=
studioEmbeddedXcxApplyRpService
.
listByAppIds
(
wxComponentAppId
,
embeddedAppId
,
list
.
stream
().
map
(
AuthXcxInfo:
:
getAppId
).
collect
(
Collectors
.
toList
()));
if
(
CollectionUtil
.
isEmpty
(
applies
))
{
if
(
CollectionUtil
.
isEmpty
(
applies
))
{
return
;
return
;
}
}
Map
<
EmbededXcxEnum
,
List
<
AuthXcxInfo
>>
map
=
list
.
stream
()
applies
.
forEach
(
apply
->
{
.
collect
(
Collectors
.
groupingBy
(
e
->
EmbededXcxEnum
.
getByWxCode
(
Integer
.
parseInt
(
e
.
getStatus
()))));
log
.
info
(
"start sync embedded xcx {}, {}"
,
apply
.
getId
(),
apply
.
getAuthorizerAppId
());
try
{
map
.
keySet
().
forEach
(
status
->
{
this
.
doComplete
(
apply
.
getId
(),
apply
.
getAuthorizerAppId
());
List
<
AuthXcxInfo
>
authXcxInfos
=
map
.
getOrDefault
(
status
,
Lists
.
newArrayList
());
}
catch
(
Exception
e
)
{
if
(
CollectionUtil
.
isEmpty
(
authXcxInfos
))
{
log
.
info
(
"fail sync embedded xcx {}, {}"
,
apply
.
getId
(),
apply
.
getAuthorizerAppId
(),
e
);
return
;
}
List
<
String
>
appIds
=
authXcxInfos
.
stream
().
map
(
AuthXcxInfo:
:
getAppId
)
.
collect
(
Collectors
.
toList
());
switch
(
status
)
{
case
SUCCESS:
List
<
Long
>
toSuccessList
=
StudioEmbeddedXcxConvert
.
filterAppIds
(
applies
,
appIds
);
if
(
CollectionUtil
.
isEmpty
(
toSuccessList
))
{
break
;
}
studioEmbeddedXcxApplyRpService
.
updateByIds
(
StudioEmbeddedXcxConvert
.
toSuccess
(
null
),
toSuccessList
);
break
;
case
CANCEL:
case
REFUSE:
case
TIMEOUT:
case
REVOKE:
List
<
StudioEmbeddedXcxApply
>
toFailList
=
StudioEmbeddedXcxConvert
.
toFailList
(
status
,
applies
,
authXcxInfos
);
if
(
CollectionUtil
.
isEmpty
(
toFailList
))
{
break
;
}
studioEmbeddedXcxApplyRpService
.
updateBatchById
(
toFailList
);
default
:
break
;
}
}
log
.
info
(
"complete sync embedded xcx {}, {}"
,
apply
.
getId
(),
apply
.
getAuthorizerAppId
());
});
});
}
}
private
List
<
AuthXcxInfo
>
listBoundAppIds
()
{
List
<
AuthXcxInfo
>
result
=
new
ArrayList
<>();
int
num
=
100
;
for
(
int
start
=
0
;
start
<
10
;
start
++)
{
HalfScreenXcxAuthVO
vo
=
weXcxService
.
listEmbeddedXcx
(
wxComponentAppId
,
embeddedAppId
,
start
,
num
);
if
(
CollectionUtil
.
isEmpty
(
vo
.
getWxaEmbeddedList
()))
{
break
;
}
result
.
addAll
(
vo
.
getWxaEmbeddedList
());
}
return
result
;
}
@Override
@Override
public
StudioMerchantApplyVO
getApply
(
Long
id
)
{
public
StudioMerchantApplyVO
getApply
(
Long
id
)
{
StudioMerchantApply
apply
=
studioMerchantApplyRpService
.
getById
(
id
)
StudioMerchantApply
apply
=
studioMerchantApplyRpService
.
getById
(
id
)
...
...
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