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
9b9683d9
Commit
9b9683d9
authored
Apr 27, 2024
by
程裕兵
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:bind
parent
97ff19cc
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
9 deletions
+20
-9
app/src/main/java/com/jiejing/fitness/finance/app/controller/TestController.java
+11
-5
service/src/main/java/com/jiejing/fitness/finance/service/event/ListenerService.java
+3
-4
service/src/main/java/com/jiejing/fitness/finance/service/merchant/impl/BrandMerchantServiceImpl.java
+1
-0
service/src/main/java/com/jiejing/fitness/finance/service/merchant/impl/StudioMerchantServiceImpl.java
+5
-0
No files found.
app/src/main/java/com/jiejing/fitness/finance/app/controller/TestController.java
View file @
9b9683d9
...
@@ -9,8 +9,10 @@ import com.jiejing.filecenter.api.common.enums.AccessTypeEnum;
...
@@ -9,8 +9,10 @@ import com.jiejing.filecenter.api.common.enums.AccessTypeEnum;
import
com.jiejing.filecenter.api.common.util.UploadUtil
;
import
com.jiejing.filecenter.api.common.util.UploadUtil
;
import
com.jiejing.filecenter.api.resource.ResourceApi
;
import
com.jiejing.filecenter.api.resource.ResourceApi
;
import
com.jiejing.fitness.finance.repository.service.StudioCashierRecordRpService
;
import
com.jiejing.fitness.finance.repository.service.StudioCashierRecordRpService
;
import
com.jiejing.fitness.finance.service.merchant.StudioMerchantService
;
import
com.jiejing.fitness.finance.service.utils.FileUtils
;
import
com.jiejing.fitness.finance.service.utils.FileUtils
;
import
com.jiejing.paycenter.api.merchant.MerchantQueryApi
;
import
com.jiejing.paycenter.api.merchant.MerchantQueryApi
;
import
com.jiejing.paycenter.common.event.MerchantEvent
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.util.Date
;
import
java.util.Date
;
...
@@ -19,6 +21,7 @@ import java.util.Map;
...
@@ -19,6 +21,7 @@ import java.util.Map;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
...
@@ -60,11 +63,14 @@ public class TestController {
...
@@ -60,11 +63,14 @@ public class TestController {
@Resource
@Resource
private
StudioCashierRecordRpService
studioCashierRecordRpService
;
private
StudioCashierRecordRpService
studioCashierRecordRpService
;
@PostMapping
(
value
=
"/private/test/sumMerchantPaySuccessGroupByStudioId"
)
@Resource
public
JsonResult
<
Map
<
Long
,
BigDecimal
>>
sumMerchantPaySuccessGroupByStudioId
(
@RequestParam
Long
startDate
,
@RequestParam
Long
endDate
,
private
StudioMerchantService
studioMerchantService
;
@RequestParam
Long
merchantId
)
{
return
JsonResult
.
success
(
studioCashierRecordRpService
.
sumMerchantPaySuccessGroupByStudioId
(
merchantId
,
new
Date
(
startDate
),
new
Date
(
endDate
)));
@PostMapping
(
value
=
"/private/test/merchantCallback"
)
public
JsonResult
<
Map
<
Long
,
BigDecimal
>>
merchantCallback
(
@RequestBody
MerchantEvent
event
)
{
studioMerchantService
.
callback
(
event
);
return
JsonResult
.
success
();
}
}
...
...
service/src/main/java/com/jiejing/fitness/finance/service/event/ListenerService.java
View file @
9b9683d9
...
@@ -37,8 +37,7 @@ public class ListenerService {
...
@@ -37,8 +37,7 @@ public class ListenerService {
@EventHandler
(
value
=
MerchantEvent
.
class
,
binder
=
"biz-kafka"
,
maxAttempts
=
MAX_RETRY
)
@EventHandler
(
value
=
MerchantEvent
.
class
,
binder
=
"biz-kafka"
,
maxAttempts
=
MAX_RETRY
)
public
void
handleMerchantEvent
(
MerchantEvent
event
,
@Header
(
DELIVERY_ATTEMPT
)
int
retryNum
)
{
public
void
handleMerchantEvent
(
MerchantEvent
event
,
@Header
(
DELIVERY_ATTEMPT
)
int
retryNum
)
{
try
{
try
{
log
.
info
(
"start process merchant event {}, {}, {}"
,
event
.
getApplyNo
(),
event
.
getMerchantId
(),
log
.
info
(
"start process merchant event {}"
,
JSON
.
toJSONString
(
event
));
event
.
getMerchantNo
());
event
.
setSubChannels
(
Optional
.
ofNullable
(
event
.
getSubChannels
()).
orElse
(
new
ArrayList
<>(
1
)));
event
.
setSubChannels
(
Optional
.
ofNullable
(
event
.
getSubChannels
()).
orElse
(
new
ArrayList
<>(
1
)));
event
.
setSubChannelAuths
(
Optional
.
ofNullable
(
event
.
getSubChannelAuths
()).
orElse
(
new
ArrayList
<>(
1
)));
event
.
setSubChannelAuths
(
Optional
.
ofNullable
(
event
.
getSubChannelAuths
()).
orElse
(
new
ArrayList
<>(
1
)));
...
@@ -59,7 +58,7 @@ public class ListenerService {
...
@@ -59,7 +58,7 @@ public class ListenerService {
@EventHandler
(
value
=
PayEvent
.
class
,
binder
=
"biz-kafka"
,
maxAttempts
=
MAX_RETRY
)
@EventHandler
(
value
=
PayEvent
.
class
,
binder
=
"biz-kafka"
,
maxAttempts
=
MAX_RETRY
)
public
void
payEventCallback
(
PayEvent
event
,
@Header
(
DELIVERY_ATTEMPT
)
int
retryNum
)
{
public
void
payEventCallback
(
PayEvent
event
,
@Header
(
DELIVERY_ATTEMPT
)
int
retryNum
)
{
try
{
try
{
log
.
info
(
"start process pay event {}"
,
event
.
getTransNo
(
));
log
.
info
(
"start process pay event {}"
,
JSON
.
toJSONString
(
event
));
payService
.
payCallback
(
event
);
payService
.
payCallback
(
event
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
info
(
"process pay event fail {}"
,
event
.
getTransNo
(),
e
);
log
.
info
(
"process pay event fail {}"
,
event
.
getTransNo
(),
e
);
...
@@ -69,7 +68,7 @@ public class ListenerService {
...
@@ -69,7 +68,7 @@ public class ListenerService {
@EventHandler
(
value
=
RefundEvent
.
class
,
binder
=
"biz-kafka"
,
maxAttempts
=
MAX_RETRY
)
@EventHandler
(
value
=
RefundEvent
.
class
,
binder
=
"biz-kafka"
,
maxAttempts
=
MAX_RETRY
)
public
void
refundEventCallback
(
RefundEvent
event
,
@Header
(
DELIVERY_ATTEMPT
)
int
retryNum
)
{
public
void
refundEventCallback
(
RefundEvent
event
,
@Header
(
DELIVERY_ATTEMPT
)
int
retryNum
)
{
try
{
try
{
log
.
info
(
"start process refund event {}"
,
event
.
getTransNo
(
));
log
.
info
(
"start process refund event {}"
,
JSON
.
toJSONString
(
event
));
payService
.
refundCallback
(
event
);
payService
.
refundCallback
(
event
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
info
(
"process refund event fail {}"
,
event
.
getTransNo
(),
e
);
log
.
info
(
"process refund event fail {}"
,
event
.
getTransNo
(),
e
);
...
...
service/src/main/java/com/jiejing/fitness/finance/service/merchant/impl/BrandMerchantServiceImpl.java
View file @
9b9683d9
...
@@ -67,6 +67,7 @@ public class BrandMerchantServiceImpl implements BrandMerchantService {
...
@@ -67,6 +67,7 @@ public class BrandMerchantServiceImpl implements BrandMerchantService {
@Override
@Override
public
void
unbind
(
Long
brandId
,
Long
merchantId
)
{
public
void
unbind
(
Long
brandId
,
Long
merchantId
)
{
log
.
info
(
"unbind brand merchant {}, {}"
,
brandId
,
merchantId
);
partyToMerchantRpService
.
deleteByPartyAndMerchantId
(
brandId
,
PartyTypeEnum
.
BRAND
,
merchantId
);
partyToMerchantRpService
.
deleteByPartyAndMerchantId
(
brandId
,
PartyTypeEnum
.
BRAND
,
merchantId
);
}
}
...
...
service/src/main/java/com/jiejing/fitness/finance/service/merchant/impl/StudioMerchantServiceImpl.java
View file @
9b9683d9
...
@@ -160,6 +160,7 @@ public class StudioMerchantServiceImpl implements StudioMerchantService {
...
@@ -160,6 +160,7 @@ public class StudioMerchantServiceImpl implements StudioMerchantService {
@Override
@Override
public
void
unbindAll
(
Long
merchantId
)
{
public
void
unbindAll
(
Long
merchantId
)
{
log
.
info
(
"unbind all studio of merchant {}"
,
merchantId
);
partyToMerchantRpService
.
deleteByMerchantId
(
merchantId
,
PartyTypeEnum
.
STUDIO
);
partyToMerchantRpService
.
deleteByMerchantId
(
merchantId
,
PartyTypeEnum
.
STUDIO
);
}
}
...
@@ -365,8 +366,12 @@ public class StudioMerchantServiceImpl implements StudioMerchantService {
...
@@ -365,8 +366,12 @@ public class StudioMerchantServiceImpl implements StudioMerchantService {
Long
oldMerchantId
=
old
.
getMerchantId
();
Long
oldMerchantId
=
old
.
getMerchantId
();
StudioMerchantApply
exist
=
studioMerchantApplyRpService
.
getLatestOneSuccessByMerchantId
(
oldMerchantId
);
StudioMerchantApply
exist
=
studioMerchantApplyRpService
.
getLatestOneSuccessByMerchantId
(
oldMerchantId
);
log
.
info
(
"current bound merchant of studio : {}, and the merchant is from studio : {}"
,
JSON
.
toJSONString
(
old
),
exist
.
getStudioId
());
if
(!
exist
.
getStudioId
().
equals
(
apply
.
getStudioId
()))
{
if
(!
exist
.
getStudioId
().
equals
(
apply
.
getStudioId
()))
{
// 之前绑定的商户不是自己的商户,不需要解绑
// 之前绑定的商户不是自己的商户,不需要解绑
log
.
info
(
"exist merchant no is not studio self {}, {}, {}"
,
oldMerchantId
,
apply
.
getStudioId
(),
exist
.
getStudioId
());
return
oldMerchantId
;
return
oldMerchantId
;
}
}
...
...
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