Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gogirl-miniapp-backend
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
huluobin
gogirl-miniapp-backend
Commits
08f3eb4d
Commit
08f3eb4d
authored
Nov 16, 2020
by
huluobin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
ba07e549
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
24 deletions
+28
-24
IAgentUserService.java
...java/com/gogirl/application/common/IAgentUserService.java
+2
-1
AgentUserServiceImpl.java
.../gogirl/application/common/impl/AgentUserServiceImpl.java
+24
-22
MallOrderPayServiceImpl.java
.../application/order/mall/impl/MallOrderPayServiceImpl.java
+1
-1
AgentUserBalanceLog.java
...in/java/com/gogirl/domain/common/AgentUserBalanceLog.java
+1
-0
No files found.
src/main/java/com/gogirl/application/common/IAgentUserService.java
View file @
08f3eb4d
...
...
@@ -49,10 +49,11 @@ public interface IAgentUserService extends IService<AgentUser> {
* @param amount
* @param agentUserId
*/
void
addBalanceLog
(
Integer
type
,
BigDecimal
amount
,
Integer
agentUserId
);
void
addBalanceLog
(
Integer
type
,
BigDecimal
amount
,
Integer
agentUserId
,
String
orderId
);
/**
* 代理余额充值
*
* @param amount
* @return
*/
...
...
src/main/java/com/gogirl/application/common/impl/AgentUserServiceImpl.java
View file @
08f3eb4d
...
...
@@ -31,7 +31,6 @@ import java.math.RoundingMode;
import
java.net.InetAddress
;
import
java.net.UnknownHostException
;
import
java.text.SimpleDateFormat
;
import
java.time.LocalDate
;
import
java.time.LocalDateTime
;
import
java.util.Date
;
...
...
@@ -121,14 +120,12 @@ public class AgentUserServiceImpl extends ServiceImpl<AgentUserMapper, AgentUser
AgentUserLog
agentUserLog
=
new
AgentUserLog
();
agentUserLog
.
setAgentUserId
(
agentUser
.
getId
());
agentUserLog
.
setItem
(
String
.
format
(
" 首次签约,签约时间 %s, 代理级别 %s , 代理折扣 %s "
,
LocalDate
.
now
(),
agentConfig
.
getTitle
(),
agentConfig
.
getDiscount
()));
agentUserLogMapper
.
insert
(
agentUserLog
);
}
this
.
addBalanceLog
(
1
,
agentConfig
.
getRechargeAmount
(),
agentUser
.
getId
());
this
.
addBalanceLog
(
3
,
agentConfig
.
getBondAmount
(),
agentUser
.
getId
());
this
.
addBalanceLog
(
3
,
agentConfig
.
getBondAmount
(),
agentUser
.
getId
(),
result
.
getOutTradeNo
());
this
.
addBalanceLog
(
1
,
amount
.
subtract
(
agentConfig
.
getBondAmount
()),
agentUser
.
getId
(),
result
.
getOutTradeNo
());
}
...
...
@@ -136,7 +133,7 @@ public class AgentUserServiceImpl extends ServiceImpl<AgentUserMapper, AgentUser
AgentUserBalanceLogMapper
agentUserBalanceLogMapper
;
@Override
public
void
addBalanceLog
(
Integer
type
,
BigDecimal
amount
,
Integer
agentUserId
)
{
public
void
addBalanceLog
(
Integer
type
,
BigDecimal
amount
,
Integer
agentUserId
,
String
orderId
)
{
AgentUser
agentUser
=
agentUserMapper
.
selectById
(
agentUserId
);
Customer
customer
=
customerService
.
selectByPhone
(
agentUser
.
getPhone
());
...
...
@@ -157,7 +154,7 @@ public class AgentUserServiceImpl extends ServiceImpl<AgentUserMapper, AgentUser
agentUserBalanceLog
.
setAmount
(
amount
);
agentUserBalanceLog
.
setCreateUser
(
customer
.
getNickname
());
agentUserBalanceLog
.
setType
(
type
);
agentUserBalanceLog
.
setOrderId
(
orderId
);
agentUserBalanceLogMapper
.
insert
(
agentUserBalanceLog
);
break
;
//商城订单扣余额
...
...
@@ -171,24 +168,27 @@ public class AgentUserServiceImpl extends ServiceImpl<AgentUserMapper, AgentUser
throw
new
RRException
(
"余额不足"
);
}
//商城订单扣余额
this
.
addBalanceLog
(
2
,
agentUser
.
getBalance
(),
agentUserId
);
this
.
addBalanceLog
(
2
,
agentUser
.
getBalance
(),
agentUserId
,
orderId
);
//商城订单扣保证金
this
.
addBalanceLog
(
4
,
amount
.
subtract
(
agentUser
.
getBalance
()),
agentUserId
);
this
.
addBalanceLog
(
4
,
amount
.
subtract
(
agentUser
.
getBalance
()),
agentUserId
,
orderId
);
}
}
else
{
//余额
agentUser
.
setBalance
(
agentUser
.
getBalance
().
subtract
(
amount
));
//累计消费
agentUser
.
setCurrentConsumeAmount
(
agentUser
.
getCurrentConsumeAmount
().
add
(
amount
));
agentUserMapper
.
updateById
(
agentUser
);
//消费
agentUserBalanceLog
=
AgentUserBalanceLog
.
getInstance
(
agentUser
);
agentUserBalanceLog
.
setAmount
(
BigDecimal
.
ZERO
.
subtract
(
amount
));
agentUserBalanceLog
.
setCreateUser
(
customer
.
getNickname
());
agentUserBalanceLog
.
setType
(
type
);
agentUserBalanceLog
.
setOrderId
(
orderId
);
agentUserBalanceLogMapper
.
insert
(
agentUserBalanceLog
);
}
//余额
agentUser
.
setBalance
(
agentUser
.
getBalance
().
subtract
(
amount
));
//累计消费
agentUser
.
setCurrentConsumeAmount
(
agentUser
.
getCurrentConsumeAmount
().
add
(
amount
));
agentUserMapper
.
updateById
(
agentUser
);
//消费
agentUserBalanceLog
=
AgentUserBalanceLog
.
getInstance
(
agentUser
);
agentUserBalanceLog
.
setAmount
(
BigDecimal
.
ZERO
.
subtract
(
amount
));
agentUserBalanceLog
.
setCreateUser
(
customer
.
getNickname
());
agentUserBalanceLog
.
setType
(
type
);
agentUserBalanceLogMapper
.
insert
(
agentUserBalanceLog
);
break
;
//充保证金
case
3
:
...
...
@@ -202,6 +202,7 @@ public class AgentUserServiceImpl extends ServiceImpl<AgentUserMapper, AgentUser
agentUserBalanceLog
.
setAmount
(
amount
);
agentUserBalanceLog
.
setCreateUser
(
customer
.
getNickname
());
agentUserBalanceLog
.
setType
(
type
);
agentUserBalanceLog
.
setOrderId
(
orderId
);
agentUserBalanceLogMapper
.
insert
(
agentUserBalanceLog
);
break
;
...
...
@@ -218,6 +219,7 @@ public class AgentUserServiceImpl extends ServiceImpl<AgentUserMapper, AgentUser
agentUserBalanceLog
.
setAmount
(
amount
);
agentUserBalanceLog
.
setCreateUser
(
customer
.
getNickname
());
agentUserBalanceLog
.
setType
(
type
);
agentUserBalanceLog
.
setOrderId
(
orderId
);
agentUserBalanceLogMapper
.
insert
(
agentUserBalanceLog
);
break
;
...
...
src/main/java/com/gogirl/application/order/mall/impl/MallOrderPayServiceImpl.java
View file @
08f3eb4d
...
...
@@ -114,7 +114,7 @@ public class MallOrderPayServiceImpl implements MallOrderPayService {
if
(
agentUser
==
null
)
{
throw
new
RRException
(
ErrorCode
.
ER_2007
);
}
agentUserService
.
addBalanceLog
(
2
,
BigDecimal
.
ZERO
.
subtract
(
mallOrder
.
getTotalPayAmount
()),
agentUser
.
getId
());
agentUserService
.
addBalanceLog
(
2
,
BigDecimal
.
ZERO
.
subtract
(
mallOrder
.
getTotalPayAmount
()),
agentUser
.
getId
()
,
orderId
.
toString
()
);
mallOrder
.
setStatus
(
MallOrder
.
STATUS_UN_SHIP
);
...
...
src/main/java/com/gogirl/domain/common/AgentUserBalanceLog.java
View file @
08f3eb4d
...
...
@@ -61,6 +61,7 @@ public class AgentUserBalanceLog implements Serializable {
@ApiModelProperty
(
value
=
"备注"
)
private
String
remarks
;
private
String
orderId
;
public
static
AgentUserBalanceLog
getInstance
(
AgentUser
agentUser
){
AgentUserBalanceLog
agentUserBalanceLog
=
new
AgentUserBalanceLog
();
...
...
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