Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
R
run-score
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
jackma
run-score
Commits
6d73ad04
提交
6d73ad04
authored
11月 14, 2021
作者:
jacksmith1988
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
//add code
上级
f3e415a8
隐藏空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
390 行增加
和
401 行删除
+390
-401
MerchantOrder.java
...java/me/zohar/runscore/merchant/domain/MerchantOrder.java
+6
-3
MerchantOrderService.java
...zohar/runscore/merchant/service/MerchantOrderService.java
+3
-3
UserAccountService.java
...ohar/runscore/useraccount/service/UserAccountService.java
+370
-374
gathering-code.js
...ore-mobile/src/main/resources/static/js/gathering-code.js
+2
-2
gathering-code.html
...e-mobile/src/main/resources/templates/gathering-code.html
+9
-6
runscore.sql
实施输出/runscore.sql
+0
-0
view.sql
实施输出/view.sql
+0
-13
没有找到文件。
runscore-api/src/main/java/me/zohar/runscore/merchant/domain/MerchantOrder.java
浏览文件 @
6d73ad04
...
...
@@ -141,12 +141,15 @@ public class MerchantOrder {
private
MerchantOrderPayInfo
payInfo
;
@NotFound
(
action
=
NotFoundAction
.
IGNORE
)
@ManyToOne
(
fetch
=
FetchType
.
LAZY
)
@JoinColumn
(
name
=
"gathering_id"
,
updatable
=
false
,
insertable
=
false
,
foreignKey
=
@ForeignKey
(
value
=
ConstraintMode
.
NO_CONSTRAINT
))
private
GatheringCode
gatheringCode
;
// private String gatheringId;
@Column
(
name
=
"gathering_id"
,
length
=
32
)
private
String
gatheringId
;
private
String
remark
;
...
...
@@ -175,12 +178,12 @@ public class MerchantOrder {
setRemark
(
remark
);
}
public
void
updateReceived
(
String
receivedAccountId
,
String
gatheringCodeStorageId
,
String
gatheringId
)
{
public
void
updateReceived
(
String
receivedAccountId
,
String
gatheringCodeStorageId
,
GatheringCode
gatheringCode
)
{
this
.
setReceivedAccountId
(
receivedAccountId
);
this
.
setGatheringCodeStorageId
(
gatheringCodeStorageId
);
this
.
setOrderState
(
Constant
.
商户订单状态
_
已接单
);
this
.
setReceivedTime
(
new
Date
());
this
.
setGatheringId
(
gatheringCode
.
getId
());
}
public
void
customerCancelOrderRefund
()
{
...
...
runscore-api/src/main/java/me/zohar/runscore/merchant/service/MerchantOrderService.java
浏览文件 @
6d73ad04
...
...
@@ -489,9 +489,9 @@ public class MerchantOrderService {
//todo this is temporary code 这里要匹配有资源的用户接单
List
<
UserAccount
>
userAccounts
=
userAccountRepo
.
findAllByAccountTypeAndState
(
Constant
.
账号类型
_
会员
,
Constant
.
账号状态
_
启用
).
orElseThrow
(()
->
new
BizException
(
BizError
.
系统无可用商户
));
Collections
.
shuffle
(
userAccounts
);
this
.
receiveOrder
(
userAccounts
.
get
(
RandomUtil
.
randomInt
(
0
,
userAccounts
.
size
())).
getId
(),
merchantOrder
.
getId
());
this
.
receiveOrder
(
userAccounts
.
get
(
0
).
getId
(),
merchantOrder
.
getId
());
return
MerchantOrderVO
.
convertFor
(
merchantOrder
);
}
...
...
@@ -546,7 +546,7 @@ public class MerchantOrderService {
if
(
setting
!=
null
&&
setting
.
getOrderPayEffectiveDuration
()
!=
null
)
{
orderEffectiveDuration
=
setting
.
getOrderPayEffectiveDuration
();
}
platformOrder
.
updateReceived
(
userAccount
.
getId
(),
gatheringCode
.
getStorageId
(),
gatheringCode
.
getId
()
);
platformOrder
.
updateReceived
(
userAccount
.
getId
(),
gatheringCode
.
getStorageId
(),
gatheringCode
);
platformOrder
.
updateRemark
(
gatheringCode
.
getBankCode
()
+
"_"
+
gatheringCode
.
getBankUsername
()
+
"_"
+
gatheringCode
.
getBankAddress
());
platformOrder
.
updateUsefulTime
(
DateUtil
.
offset
(
platformOrder
.
getReceivedTime
(),
DateField
.
MINUTE
,
orderEffectiveDuration
));
...
...
runscore-api/src/main/java/me/zohar/runscore/useraccount/service/UserAccountService.java
浏览文件 @
6d73ad04
...
...
@@ -3,6 +3,7 @@ package me.zohar.runscore.useraccount.service;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Optional
;
import
javax.persistence.criteria.CriteriaBuilder
;
import
javax.persistence.criteria.CriteriaQuery
;
...
...
@@ -60,379 +61,374 @@ import me.zohar.runscore.useraccount.vo.UserAccountInfoVO;
@Service
public
class
UserAccountService
{
@Autowired
private
UserAccountRepo
userAccountRepo
;
@Autowired
private
AccountChangeLogRepo
accountChangeLogRepo
;
@Autowired
private
InviteCodeRepo
inviteCodeRepo
;
@Autowired
private
RegisterSettingRepo
registerSettingRepo
;
/**
* 更新接单状态
*
* @param userAccountId
* @param receiveOrderState
*/
@Transactional
public
void
updateReceiveOrderState
(
@NotBlank
String
userAccountId
,
@NotBlank
String
receiveOrderState
)
{
UserAccount
userAccount
=
userAccountRepo
.
getOne
(
userAccountId
);
userAccount
.
setReceiveOrderState
(
receiveOrderState
);
userAccountRepo
.
save
(
userAccount
);
}
/**
* 更新最近登录时间
*/
@Transactional
public
void
updateLatelyLoginTime
(
String
userAccountId
)
{
UserAccount
userAccount
=
userAccountRepo
.
getOne
(
userAccountId
);
userAccount
.
setLatelyLoginTime
(
new
Date
());
userAccountRepo
.
save
(
userAccount
);
}
@ParamValid
@Transactional
public
void
updateUserAccount
(
UserAccountEditParam
param
)
{
UserAccount
existUserAccount
=
userAccountRepo
.
findByUserName
(
param
.
getUserName
());
if
(
existUserAccount
!=
null
&&
!
existUserAccount
.
getId
().
equals
(
param
.
getUserAccountId
()))
{
throw
new
BizException
(
BizError
.
用户名已存在
);
}
UserAccount
userAccount
=
userAccountRepo
.
getOne
(
param
.
getUserAccountId
());
if
(
userAccount
.
getInviter
()
!=
null
)
{
// 校验下级账号的返点不能大于上级账号
if
(
param
.
getRebate
()
>
userAccount
.
getInviter
().
getRebate
())
{
throw
new
BizException
(
BizError
.
下级账号的返点不能大于上级账号
);
}
}
BeanUtils
.
copyProperties
(
param
,
userAccount
);
userAccountRepo
.
save
(
userAccount
);
}
@Transactional
(
readOnly
=
true
)
public
UserAccountDetailsInfoVO
findUserAccountDetailsInfoById
(
String
userAccountId
)
{
UserAccount
userAccount
=
userAccountRepo
.
getOne
(
userAccountId
);
return
UserAccountDetailsInfoVO
.
convertFor
(
userAccount
);
}
@Transactional
(
readOnly
=
true
)
public
PageResult
<
UserAccountDetailsInfoVO
>
findUserAccountDetailsInfoByPage
(
UserAccountQueryCondParam
param
)
{
Specification
<
UserAccount
>
spec
=
new
Specification
<
UserAccount
>()
{
/**
*
*/
private
static
final
long
serialVersionUID
=
1L
;
public
Predicate
toPredicate
(
Root
<
UserAccount
>
root
,
CriteriaQuery
<?>
query
,
CriteriaBuilder
builder
)
{
List
<
Predicate
>
predicates
=
new
ArrayList
<
Predicate
>();
if
(
StrUtil
.
isNotEmpty
(
param
.
getUserName
()))
{
predicates
.
add
(
builder
.
like
(
root
.
get
(
"userName"
),
"%"
+
param
.
getUserName
()
+
"%"
));
}
if
(
StrUtil
.
isNotEmpty
(
param
.
getRealName
()))
{
predicates
.
add
(
builder
.
like
(
root
.
get
(
"realName"
),
"%"
+
param
.
getRealName
()
+
"%"
));
}
return
predicates
.
size
()
>
0
?
builder
.
and
(
predicates
.
toArray
(
new
Predicate
[
predicates
.
size
()]))
:
null
;
}
};
Page
<
UserAccount
>
result
=
userAccountRepo
.
findAll
(
spec
,
PageRequest
.
of
(
param
.
getPageNum
()
-
1
,
param
.
getPageSize
(),
Sort
.
by
(
Sort
.
Order
.
desc
(
"registeredTime"
))));
PageResult
<
UserAccountDetailsInfoVO
>
pageResult
=
new
PageResult
<>(
UserAccountDetailsInfoVO
.
convertFor
(
result
.
getContent
()),
param
.
getPageNum
(),
param
.
getPageSize
(),
result
.
getTotalElements
());
return
pageResult
;
}
@ParamValid
@Transactional
public
void
bindBankInfo
(
BindBankInfoParam
param
)
{
UserAccount
userAccount
=
userAccountRepo
.
getOne
(
param
.
getUserAccountId
());
BeanUtils
.
copyProperties
(
param
,
userAccount
);
userAccount
.
setBankInfoLatelyModifyTime
(
new
Date
());
userAccountRepo
.
save
(
userAccount
);
}
@ParamValid
@Transactional
public
void
modifyLoginPwd
(
ModifyLoginPwdParam
param
)
{
UserAccount
userAccount
=
userAccountRepo
.
getOne
(
param
.
getUserAccountId
());
BCryptPasswordEncoder
pwdEncoder
=
new
BCryptPasswordEncoder
();
if
(!
pwdEncoder
.
matches
(
param
.
getOldLoginPwd
(),
userAccount
.
getLoginPwd
()))
{
throw
new
BizException
(
BizError
.
旧的登录密码不正确
);
}
modifyLoginPwd
(
param
.
getUserAccountId
(),
param
.
getNewLoginPwd
());
}
@Transactional
public
void
modifyLoginPwd
(
@NotBlank
String
userAccountId
,
@NotBlank
String
newLoginPwd
)
{
UserAccount
userAccount
=
userAccountRepo
.
getOne
(
userAccountId
);
userAccount
.
setLoginPwd
(
new
BCryptPasswordEncoder
().
encode
(
newLoginPwd
));
userAccountRepo
.
save
(
userAccount
);
}
@ParamValid
@Transactional
public
void
modifyMoneyPwd
(
ModifyMoneyPwdParam
param
)
{
UserAccount
userAccount
=
userAccountRepo
.
getOne
(
param
.
getUserAccountId
());
BCryptPasswordEncoder
pwdEncoder
=
new
BCryptPasswordEncoder
();
if
(!
pwdEncoder
.
matches
(
param
.
getOldMoneyPwd
(),
userAccount
.
getMoneyPwd
()))
{
throw
new
BizException
(
BizError
.
旧的资金密码不正确
);
}
String
newMoneyPwd
=
pwdEncoder
.
encode
(
param
.
getNewMoneyPwd
());
userAccount
.
setMoneyPwd
(
newMoneyPwd
);
userAccountRepo
.
save
(
userAccount
);
}
@ParamValid
@Transactional
public
void
modifyMoneyPwd
(
@NotBlank
String
userAccountId
,
@NotBlank
String
newMoneyPwd
)
{
UserAccount
userAccount
=
userAccountRepo
.
getOne
(
userAccountId
);
userAccount
.
setMoneyPwd
(
new
BCryptPasswordEncoder
().
encode
(
newMoneyPwd
));
userAccountRepo
.
save
(
userAccount
);
}
@Transactional
(
readOnly
=
true
)
public
LoginAccountInfoVO
getLoginAccountInfo
(
String
userName
)
{
return
LoginAccountInfoVO
.
convertFor
(
userAccountRepo
.
findByUserName
(
userName
));
}
@Transactional
(
readOnly
=
true
)
public
UserAccountInfoVO
getUserAccountInfo
(
String
userAccountId
)
{
return
UserAccountInfoVO
.
convertFor
(
userAccountRepo
.
getOne
(
userAccountId
));
}
@Transactional
(
readOnly
=
true
)
public
BankInfoVO
getBankInfo
(
String
userAccountId
)
{
return
BankInfoVO
.
convertFor
(
userAccountRepo
.
getOne
(
userAccountId
));
}
@ParamValid
@Transactional
public
void
addUserAccount
(
AddUserAccountParam
param
)
{
UserAccount
userAccount
=
userAccountRepo
.
findByUserName
(
param
.
getUserName
());
if
(
userAccount
!=
null
)
{
throw
new
BizException
(
BizError
.
用户名已存在
);
}
String
encodePwd
=
new
BCryptPasswordEncoder
().
encode
(
param
.
getLoginPwd
());
param
.
setLoginPwd
(
encodePwd
);
UserAccount
newUserAccount
=
param
.
convertToPo
();
if
(
StrUtil
.
isNotBlank
(
param
.
getInviterUserName
()))
{
UserAccount
inviter
=
userAccountRepo
.
findByUserName
(
param
.
getInviterUserName
());
if
(
inviter
==
null
)
{
throw
new
BizException
(
BizError
.
邀请人不存在
);
}
// 校验下级账号的返点不能大于上级账号
if
(
param
.
getRebate
()
>
inviter
.
getRebate
())
{
throw
new
BizException
(
BizError
.
下级账号的返点不能大于上级账号
);
}
newUserAccount
.
setInviterId
(
inviter
.
getId
());
newUserAccount
.
setAccountLevel
(
inviter
.
getAccountLevel
()
+
1
);
newUserAccount
.
setAccountLevelPath
(
inviter
.
getAccountLevelPath
()
+
"."
+
newUserAccount
.
getId
());
}
userAccountRepo
.
save
(
newUserAccount
);
}
/**
* 账号注册
*
* @param param
*/
@ParamValid
@Transactional
public
void
register
(
UserAccountRegisterParam
param
)
{
UserAccount
userAccount
=
userAccountRepo
.
findByUserName
(
param
.
getUserName
());
if
(
userAccount
!=
null
)
{
throw
new
BizException
(
BizError
.
用户名已存在
);
}
param
.
setLoginPwd
(
new
BCryptPasswordEncoder
().
encode
(
param
.
getLoginPwd
()));
param
.
setMoneyPwd
(
new
BCryptPasswordEncoder
().
encode
(
param
.
getMoneyPwd
()));
UserAccount
newUserAccount
=
param
.
convertToPo
();
RegisterSetting
setting
=
registerSettingRepo
.
findTopByOrderByLatelyUpdateTime
();
if
(!
setting
.
getRegisterEnabled
())
{
throw
new
BizException
(
BizError
.
未开放注册功能
);
}
if
(
setting
.
getInviteRegisterEnabled
())
{
InviteCode
inviteCode
=
inviteCodeRepo
.
findTopByCodeAndPeriodOfValidityGreaterThanEqual
(
param
.
getInviteCode
(),
new
Date
());
if
(
inviteCode
==
null
)
{
throw
new
BizException
(
BizError
.
邀请码不存在或已失效
);
}
newUserAccount
.
updateInviteInfo
(
inviteCode
);
}
else
{
newUserAccount
.
setRebate
(
setting
.
getRegitserDefaultRebate
());
}
userAccountRepo
.
save
(
newUserAccount
);
}
@Transactional
(
readOnly
=
true
)
public
PageResult
<
AccountChangeLogVO
>
findAccountChangeLogByPage
(
AccountChangeLogQueryCondParam
param
)
{
Specification
<
AccountChangeLog
>
spec
=
new
Specification
<
AccountChangeLog
>()
{
/**
*
*/
private
static
final
long
serialVersionUID
=
1L
;
public
Predicate
toPredicate
(
Root
<
AccountChangeLog
>
root
,
CriteriaQuery
<?>
query
,
CriteriaBuilder
builder
)
{
List
<
Predicate
>
predicates
=
new
ArrayList
<
Predicate
>();
if
(
param
.
getStartTime
()
!=
null
)
{
predicates
.
add
(
builder
.
greaterThanOrEqualTo
(
root
.
get
(
"accountChangeTime"
).
as
(
Date
.
class
),
DateUtil
.
beginOfDay
(
param
.
getStartTime
())));
}
if
(
param
.
getEndTime
()
!=
null
)
{
predicates
.
add
(
builder
.
lessThanOrEqualTo
(
root
.
get
(
"accountChangeTime"
).
as
(
Date
.
class
),
DateUtil
.
endOfDay
(
param
.
getEndTime
())));
}
if
(
StrUtil
.
isNotEmpty
(
param
.
getAccountChangeTypeCode
()))
{
predicates
.
add
(
builder
.
equal
(
root
.
get
(
"accountChangeTypeCode"
),
param
.
getAccountChangeTypeCode
()));
}
if
(
StrUtil
.
isNotEmpty
(
param
.
getUserAccountId
()))
{
predicates
.
add
(
builder
.
equal
(
root
.
get
(
"userAccountId"
),
param
.
getUserAccountId
()));
}
if
(
StrUtil
.
isNotEmpty
(
param
.
getUserName
()))
{
Join
<
UserAccount
,
AccountChangeLog
>
join
=
root
.
join
(
"userAccount"
,
JoinType
.
LEFT
);
predicates
.
add
(
builder
.
equal
(
join
.
get
(
"userName"
),
param
.
getUserName
()));
//predicates.add(builder.equal(root.get("userName"), param.getUserName()));
}
return
predicates
.
size
()
>
0
?
builder
.
and
(
predicates
.
toArray
(
new
Predicate
[
predicates
.
size
()]))
:
null
;
}
};
Page
<
AccountChangeLog
>
result
=
accountChangeLogRepo
.
findAll
(
spec
,
PageRequest
.
of
(
param
.
getPageNum
()
-
1
,
param
.
getPageSize
(),
Sort
.
by
(
Sort
.
Order
.
desc
(
"accountChangeTime"
),
Sort
.
Order
.
desc
(
"id"
))));
PageResult
<
AccountChangeLogVO
>
pageResult
=
new
PageResult
<>(
AccountChangeLogVO
.
convertFor
(
result
.
getContent
()),
param
.
getPageNum
(),
param
.
getPageSize
(),
result
.
getTotalElements
());
return
pageResult
;
}
@Transactional
public
void
delUserAccount
(
@NotBlank
String
userAccountId
)
{
userAccountRepo
.
deleteById
(
userAccountId
);
}
@ParamValid
@Transactional
public
void
adjustCashDeposit
(
AdjustCashDepositParam
param
)
{
UserAccount
userAccount
=
userAccountRepo
.
getOne
(
param
.
getUserAccountId
());
if
(
Constant
.
账变日志类型
_
手工增保证金
.
equals
(
param
.
getAccountChangeTypeCode
()))
{
Double
cashDeposit
=
NumberUtil
.
round
(
userAccount
.
getCashDeposit
()
+
param
.
getAccountChangeAmount
(),
4
)
.
doubleValue
();
userAccount
.
setCashDeposit
(
cashDeposit
);
userAccountRepo
.
save
(
userAccount
);
accountChangeLogRepo
.
save
(
AccountChangeLog
.
buildWithHandworkAdjustCashDeposit
(
userAccount
,
param
.
getAccountChangeAmount
()));
}
else
if
(
Constant
.
账变日志类型
_
手工减保证金
.
equals
(
param
.
getAccountChangeTypeCode
()))
{
Double
cashDeposit
=
NumberUtil
.
round
(
userAccount
.
getCashDeposit
()
-
param
.
getAccountChangeAmount
(),
4
)
.
doubleValue
();
if
(
cashDeposit
<
0
)
{
throw
new
BizException
(
BizError
.
保证金不足无法手工减保证金
);
}
userAccount
.
setCashDeposit
(
cashDeposit
);
userAccountRepo
.
save
(
userAccount
);
accountChangeLogRepo
.
save
(
AccountChangeLog
.
buildWithHandworkAdjustCashDeposit
(
userAccount
,
-
param
.
getAccountChangeAmount
()));
}
}
@ParamValid
@Transactional
(
readOnly
=
true
)
public
PageResult
<
UserAccountDetailsInfoVO
>
findLowerLevelAccountDetailsInfoByPage
(
LowerLevelAccountQueryCondParam
param
)
{
UserAccount
currentAccount
=
userAccountRepo
.
getOne
(
param
.
getCurrentAccountId
());
UserAccount
lowerLevelAccount
=
currentAccount
;
if
(
StrUtil
.
isNotBlank
(
param
.
getUserName
()))
{
lowerLevelAccount
=
userAccountRepo
.
findByUserName
(
param
.
getUserName
());
if
(
lowerLevelAccount
==
null
)
{
throw
new
BizException
(
BizError
.
用户名不存在
);
}
// 说明该用户名对应的账号不是当前账号的下级账号
if
(!
lowerLevelAccount
.
getAccountLevelPath
().
startsWith
(
currentAccount
.
getAccountLevelPath
()))
{
throw
new
BizException
(
BizError
.
不是上级账号无权查看该账号及下级的账号信息
);
}
}
String
lowerLevelAccountId
=
lowerLevelAccount
.
getId
();
String
lowerLevelAccountLevelPath
=
lowerLevelAccount
.
getAccountLevelPath
();
Specification
<
UserAccount
>
spec
=
new
Specification
<
UserAccount
>()
{
/**
*
*/
private
static
final
long
serialVersionUID
=
1L
;
public
Predicate
toPredicate
(
Root
<
UserAccount
>
root
,
CriteriaQuery
<?>
query
,
CriteriaBuilder
builder
)
{
List
<
Predicate
>
predicates
=
new
ArrayList
<
Predicate
>();
if
(
Constant
.
下级账号查询范围
_
指定账号及直接下级
.
equals
(
param
.
getQueryScope
()))
{
Predicate
predicate1
=
builder
.
equal
(
root
.
get
(
"id"
),
lowerLevelAccountId
);
Predicate
predicate2
=
builder
.
equal
(
root
.
get
(
"inviterId"
),
lowerLevelAccountId
);
predicates
.
add
(
builder
.
or
(
predicate1
,
predicate2
));
}
else
{
predicates
.
add
(
builder
.
like
(
root
.
get
(
"accountLevelPath"
),
lowerLevelAccountLevelPath
+
"%"
));
}
return
predicates
.
size
()
>
0
?
builder
.
and
(
predicates
.
toArray
(
new
Predicate
[
predicates
.
size
()]))
:
null
;
}
};
Page
<
UserAccount
>
result
=
userAccountRepo
.
findAll
(
spec
,
PageRequest
.
of
(
param
.
getPageNum
()
-
1
,
param
.
getPageSize
(),
Sort
.
by
(
Sort
.
Order
.
asc
(
"registeredTime"
))));
PageResult
<
UserAccountDetailsInfoVO
>
pageResult
=
new
PageResult
<>(
UserAccountDetailsInfoVO
.
convertFor
(
result
.
getContent
()),
param
.
getPageNum
(),
param
.
getPageSize
(),
result
.
getTotalElements
());
return
pageResult
;
}
@Transactional
(
readOnly
=
true
)
public
PageResult
<
AccountChangeLogVO
>
findLowerLevelAccountChangeLogByPage
(
LowerLevelAccountChangeLogQueryCondParam
param
)
{
UserAccount
currentAccount
=
userAccountRepo
.
getOne
(
param
.
getCurrentAccountId
());
UserAccount
lowerLevelAccount
=
currentAccount
;
if
(
StrUtil
.
isNotBlank
(
param
.
getUserName
()))
{
lowerLevelAccount
=
userAccountRepo
.
findByUserName
(
param
.
getUserName
());
if
(
lowerLevelAccount
==
null
)
{
throw
new
BizException
(
BizError
.
用户名不存在
);
}
// 说明该用户名对应的账号不是当前账号的下级账号
if
(!
lowerLevelAccount
.
getAccountLevelPath
().
startsWith
(
currentAccount
.
getAccountLevelPath
()))
{
throw
new
BizException
(
BizError
.
不是上级账号无权查看该账号及下级的帐变日志
);
}
}
String
lowerLevelAccountId
=
lowerLevelAccount
.
getId
();
String
lowerLevelAccountLevelPath
=
lowerLevelAccount
.
getAccountLevelPath
();
Specification
<
AccountChangeLog
>
spec
=
new
Specification
<
AccountChangeLog
>()
{
/**
*
*/
private
static
final
long
serialVersionUID
=
1L
;
public
Predicate
toPredicate
(
Root
<
AccountChangeLog
>
root
,
CriteriaQuery
<?>
query
,
CriteriaBuilder
builder
)
{
List
<
Predicate
>
predicates
=
new
ArrayList
<
Predicate
>();
if
(
StrUtil
.
isNotBlank
(
param
.
getUserName
()))
{
predicates
.
add
(
builder
.
equal
(
root
.
get
(
"userAccountId"
),
lowerLevelAccountId
));
}
else
{
predicates
.
add
(
builder
.
like
(
root
.
join
(
"userAccount"
,
JoinType
.
INNER
).
get
(
"accountLevelPath"
),
lowerLevelAccountLevelPath
+
"%"
));
}
if
(
param
.
getStartTime
()
!=
null
)
{
predicates
.
add
(
builder
.
greaterThanOrEqualTo
(
root
.
get
(
"accountChangeTime"
).
as
(
Date
.
class
),
DateUtil
.
beginOfDay
(
param
.
getStartTime
())));
}
if
(
param
.
getEndTime
()
!=
null
)
{
predicates
.
add
(
builder
.
lessThanOrEqualTo
(
root
.
get
(
"accountChangeTime"
).
as
(
Date
.
class
),
DateUtil
.
endOfDay
(
param
.
getEndTime
())));
}
if
(
StrUtil
.
isNotBlank
(
param
.
getAccountChangeTypeCode
()))
{
predicates
.
add
(
builder
.
equal
(
root
.
get
(
"accountChangeTypeCode"
),
param
.
getAccountChangeTypeCode
()));
}
return
predicates
.
size
()
>
0
?
builder
.
and
(
predicates
.
toArray
(
new
Predicate
[
predicates
.
size
()]))
:
null
;
}
};
Page
<
AccountChangeLog
>
result
=
accountChangeLogRepo
.
findAll
(
spec
,
PageRequest
.
of
(
param
.
getPageNum
()
-
1
,
param
.
getPageSize
(),
Sort
.
by
(
Sort
.
Order
.
desc
(
"accountChangeTime"
))));
PageResult
<
AccountChangeLogVO
>
pageResult
=
new
PageResult
<>(
AccountChangeLogVO
.
convertFor
(
result
.
getContent
()),
param
.
getPageNum
(),
param
.
getPageSize
(),
result
.
getTotalElements
());
return
pageResult
;
}
@Autowired
private
UserAccountRepo
userAccountRepo
;
@Autowired
private
AccountChangeLogRepo
accountChangeLogRepo
;
@Autowired
private
InviteCodeRepo
inviteCodeRepo
;
@Autowired
private
RegisterSettingRepo
registerSettingRepo
;
/**
* 更新接单状态
*/
@Transactional
public
void
updateReceiveOrderState
(
@NotBlank
String
userAccountId
,
@NotBlank
String
receiveOrderState
)
{
UserAccount
userAccount
=
userAccountRepo
.
getOne
(
userAccountId
);
userAccount
.
setReceiveOrderState
(
receiveOrderState
);
userAccountRepo
.
save
(
userAccount
);
}
/**
* 更新最近登录时间
*/
@Transactional
public
void
updateLatelyLoginTime
(
String
userAccountId
)
{
UserAccount
userAccount
=
userAccountRepo
.
getOne
(
userAccountId
);
userAccount
.
setLatelyLoginTime
(
new
Date
());
userAccountRepo
.
save
(
userAccount
);
}
@ParamValid
@Transactional
public
void
updateUserAccount
(
UserAccountEditParam
param
)
{
UserAccount
existUserAccount
=
userAccountRepo
.
findByUserName
(
param
.
getUserName
());
if
(
existUserAccount
!=
null
&&
!
existUserAccount
.
getId
().
equals
(
param
.
getUserAccountId
()))
{
throw
new
BizException
(
BizError
.
用户名已存在
);
}
UserAccount
userAccount
=
userAccountRepo
.
getOne
(
param
.
getUserAccountId
());
if
(
userAccount
.
getInviter
()
!=
null
)
{
// 校验下级账号的返点不能大于上级账号
if
(
param
.
getRebate
()
>
userAccount
.
getInviter
().
getRebate
())
{
throw
new
BizException
(
BizError
.
下级账号的返点不能大于上级账号
);
}
}
BeanUtils
.
copyProperties
(
param
,
userAccount
);
userAccountRepo
.
save
(
userAccount
);
}
@Transactional
(
readOnly
=
true
)
public
UserAccountDetailsInfoVO
findUserAccountDetailsInfoById
(
String
userAccountId
)
{
UserAccount
userAccount
=
userAccountRepo
.
getOne
(
userAccountId
);
return
UserAccountDetailsInfoVO
.
convertFor
(
userAccount
);
}
@Transactional
(
readOnly
=
true
)
public
PageResult
<
UserAccountDetailsInfoVO
>
findUserAccountDetailsInfoByPage
(
UserAccountQueryCondParam
param
)
{
Specification
<
UserAccount
>
spec
=
new
Specification
<
UserAccount
>()
{
/**
*
*/
private
static
final
long
serialVersionUID
=
1L
;
public
Predicate
toPredicate
(
Root
<
UserAccount
>
root
,
CriteriaQuery
<?>
query
,
CriteriaBuilder
builder
)
{
List
<
Predicate
>
predicates
=
new
ArrayList
<
Predicate
>();
if
(
StrUtil
.
isNotEmpty
(
param
.
getUserName
()))
{
predicates
.
add
(
builder
.
like
(
root
.
get
(
"userName"
),
"%"
+
param
.
getUserName
()
+
"%"
));
}
if
(
StrUtil
.
isNotEmpty
(
param
.
getRealName
()))
{
predicates
.
add
(
builder
.
like
(
root
.
get
(
"realName"
),
"%"
+
param
.
getRealName
()
+
"%"
));
}
return
predicates
.
size
()
>
0
?
builder
.
and
(
predicates
.
toArray
(
new
Predicate
[
predicates
.
size
()]))
:
null
;
}
};
Page
<
UserAccount
>
result
=
userAccountRepo
.
findAll
(
spec
,
PageRequest
.
of
(
param
.
getPageNum
()
-
1
,
param
.
getPageSize
(),
Sort
.
by
(
Sort
.
Order
.
desc
(
"registeredTime"
))));
PageResult
<
UserAccountDetailsInfoVO
>
pageResult
=
new
PageResult
<>(
UserAccountDetailsInfoVO
.
convertFor
(
result
.
getContent
()),
param
.
getPageNum
(),
param
.
getPageSize
(),
result
.
getTotalElements
());
return
pageResult
;
}
@ParamValid
@Transactional
public
void
bindBankInfo
(
BindBankInfoParam
param
)
{
UserAccount
userAccount
=
userAccountRepo
.
getOne
(
param
.
getUserAccountId
());
BeanUtils
.
copyProperties
(
param
,
userAccount
);
userAccount
.
setBankInfoLatelyModifyTime
(
new
Date
());
userAccountRepo
.
save
(
userAccount
);
}
@ParamValid
@Transactional
public
void
modifyLoginPwd
(
ModifyLoginPwdParam
param
)
{
UserAccount
userAccount
=
userAccountRepo
.
getOne
(
param
.
getUserAccountId
());
BCryptPasswordEncoder
pwdEncoder
=
new
BCryptPasswordEncoder
();
if
(!
pwdEncoder
.
matches
(
param
.
getOldLoginPwd
(),
userAccount
.
getLoginPwd
()))
{
throw
new
BizException
(
BizError
.
旧的登录密码不正确
);
}
modifyLoginPwd
(
param
.
getUserAccountId
(),
param
.
getNewLoginPwd
());
}
@Transactional
public
void
modifyLoginPwd
(
@NotBlank
String
userAccountId
,
@NotBlank
String
newLoginPwd
)
{
UserAccount
userAccount
=
userAccountRepo
.
getOne
(
userAccountId
);
userAccount
.
setLoginPwd
(
new
BCryptPasswordEncoder
().
encode
(
newLoginPwd
));
userAccountRepo
.
save
(
userAccount
);
}
@ParamValid
@Transactional
public
void
modifyMoneyPwd
(
ModifyMoneyPwdParam
param
)
{
UserAccount
userAccount
=
userAccountRepo
.
getOne
(
param
.
getUserAccountId
());
BCryptPasswordEncoder
pwdEncoder
=
new
BCryptPasswordEncoder
();
if
(!
pwdEncoder
.
matches
(
param
.
getOldMoneyPwd
(),
userAccount
.
getMoneyPwd
()))
{
throw
new
BizException
(
BizError
.
旧的资金密码不正确
);
}
String
newMoneyPwd
=
pwdEncoder
.
encode
(
param
.
getNewMoneyPwd
());
userAccount
.
setMoneyPwd
(
newMoneyPwd
);
userAccountRepo
.
save
(
userAccount
);
}
@ParamValid
@Transactional
public
void
modifyMoneyPwd
(
@NotBlank
String
userAccountId
,
@NotBlank
String
newMoneyPwd
)
{
UserAccount
userAccount
=
userAccountRepo
.
getOne
(
userAccountId
);
userAccount
.
setMoneyPwd
(
new
BCryptPasswordEncoder
().
encode
(
newMoneyPwd
));
userAccountRepo
.
save
(
userAccount
);
}
@Transactional
(
readOnly
=
true
)
public
LoginAccountInfoVO
getLoginAccountInfo
(
String
userName
)
{
return
LoginAccountInfoVO
.
convertFor
(
userAccountRepo
.
findByUserName
(
userName
));
}
@Transactional
(
readOnly
=
true
)
public
UserAccountInfoVO
getUserAccountInfo
(
String
userAccountId
)
{
return
UserAccountInfoVO
.
convertFor
(
userAccountRepo
.
getOne
(
userAccountId
));
}
@Transactional
(
readOnly
=
true
)
public
BankInfoVO
getBankInfo
(
String
userAccountId
)
{
return
BankInfoVO
.
convertFor
(
userAccountRepo
.
getOne
(
userAccountId
));
}
@ParamValid
@Transactional
public
void
addUserAccount
(
AddUserAccountParam
param
)
{
UserAccount
userAccount
=
userAccountRepo
.
findByUserName
(
param
.
getUserName
());
if
(
userAccount
!=
null
)
{
throw
new
BizException
(
BizError
.
用户名已存在
);
}
String
encodePwd
=
new
BCryptPasswordEncoder
().
encode
(
param
.
getLoginPwd
());
param
.
setLoginPwd
(
encodePwd
);
UserAccount
newUserAccount
=
param
.
convertToPo
();
if
(
StrUtil
.
isNotBlank
(
param
.
getInviterUserName
()))
{
UserAccount
inviter
=
userAccountRepo
.
findByUserName
(
param
.
getInviterUserName
());
if
(
inviter
==
null
)
{
throw
new
BizException
(
BizError
.
邀请人不存在
);
}
// 校验下级账号的返点不能大于上级账号
if
(
param
.
getRebate
()
>
inviter
.
getRebate
())
{
throw
new
BizException
(
BizError
.
下级账号的返点不能大于上级账号
);
}
newUserAccount
.
setInviterId
(
inviter
.
getId
());
newUserAccount
.
setAccountLevel
(
Optional
.
ofNullable
(
inviter
.
getAccountLevel
()).
orElse
(
0
)
+
1
);
newUserAccount
.
setAccountLevelPath
(
inviter
.
getAccountLevelPath
()
+
"."
+
newUserAccount
.
getId
());
}
userAccountRepo
.
save
(
newUserAccount
);
}
/**
* 账号注册
*/
@ParamValid
@Transactional
public
void
register
(
UserAccountRegisterParam
param
)
{
UserAccount
userAccount
=
userAccountRepo
.
findByUserName
(
param
.
getUserName
());
if
(
userAccount
!=
null
)
{
throw
new
BizException
(
BizError
.
用户名已存在
);
}
param
.
setLoginPwd
(
new
BCryptPasswordEncoder
().
encode
(
param
.
getLoginPwd
()));
param
.
setMoneyPwd
(
new
BCryptPasswordEncoder
().
encode
(
param
.
getMoneyPwd
()));
UserAccount
newUserAccount
=
param
.
convertToPo
();
RegisterSetting
setting
=
registerSettingRepo
.
findTopByOrderByLatelyUpdateTime
();
if
(!
setting
.
getRegisterEnabled
())
{
throw
new
BizException
(
BizError
.
未开放注册功能
);
}
if
(
setting
.
getInviteRegisterEnabled
())
{
InviteCode
inviteCode
=
inviteCodeRepo
.
findTopByCodeAndPeriodOfValidityGreaterThanEqual
(
param
.
getInviteCode
(),
new
Date
());
if
(
inviteCode
==
null
)
{
throw
new
BizException
(
BizError
.
邀请码不存在或已失效
);
}
newUserAccount
.
updateInviteInfo
(
inviteCode
);
}
else
{
newUserAccount
.
setRebate
(
setting
.
getRegitserDefaultRebate
());
}
userAccountRepo
.
save
(
newUserAccount
);
}
@Transactional
(
readOnly
=
true
)
public
PageResult
<
AccountChangeLogVO
>
findAccountChangeLogByPage
(
AccountChangeLogQueryCondParam
param
)
{
Specification
<
AccountChangeLog
>
spec
=
new
Specification
<
AccountChangeLog
>()
{
/**
*
*/
private
static
final
long
serialVersionUID
=
1L
;
public
Predicate
toPredicate
(
Root
<
AccountChangeLog
>
root
,
CriteriaQuery
<?>
query
,
CriteriaBuilder
builder
)
{
List
<
Predicate
>
predicates
=
new
ArrayList
<
Predicate
>();
if
(
param
.
getStartTime
()
!=
null
)
{
predicates
.
add
(
builder
.
greaterThanOrEqualTo
(
root
.
get
(
"accountChangeTime"
).
as
(
Date
.
class
),
DateUtil
.
beginOfDay
(
param
.
getStartTime
())));
}
if
(
param
.
getEndTime
()
!=
null
)
{
predicates
.
add
(
builder
.
lessThanOrEqualTo
(
root
.
get
(
"accountChangeTime"
).
as
(
Date
.
class
),
DateUtil
.
endOfDay
(
param
.
getEndTime
())));
}
if
(
StrUtil
.
isNotEmpty
(
param
.
getAccountChangeTypeCode
()))
{
predicates
.
add
(
builder
.
equal
(
root
.
get
(
"accountChangeTypeCode"
),
param
.
getAccountChangeTypeCode
()));
}
if
(
StrUtil
.
isNotEmpty
(
param
.
getUserAccountId
()))
{
predicates
.
add
(
builder
.
equal
(
root
.
get
(
"userAccountId"
),
param
.
getUserAccountId
()));
}
if
(
StrUtil
.
isNotEmpty
(
param
.
getUserName
()))
{
Join
<
UserAccount
,
AccountChangeLog
>
join
=
root
.
join
(
"userAccount"
,
JoinType
.
LEFT
);
predicates
.
add
(
builder
.
equal
(
join
.
get
(
"userName"
),
param
.
getUserName
()));
//predicates.add(builder.equal(root.get("userName"), param.getUserName()));
}
return
predicates
.
size
()
>
0
?
builder
.
and
(
predicates
.
toArray
(
new
Predicate
[
predicates
.
size
()]))
:
null
;
}
};
Page
<
AccountChangeLog
>
result
=
accountChangeLogRepo
.
findAll
(
spec
,
PageRequest
.
of
(
param
.
getPageNum
()
-
1
,
param
.
getPageSize
(),
Sort
.
by
(
Sort
.
Order
.
desc
(
"accountChangeTime"
),
Sort
.
Order
.
desc
(
"id"
))));
PageResult
<
AccountChangeLogVO
>
pageResult
=
new
PageResult
<>(
AccountChangeLogVO
.
convertFor
(
result
.
getContent
()),
param
.
getPageNum
(),
param
.
getPageSize
(),
result
.
getTotalElements
());
return
pageResult
;
}
@Transactional
public
void
delUserAccount
(
@NotBlank
String
userAccountId
)
{
userAccountRepo
.
deleteById
(
userAccountId
);
}
@ParamValid
@Transactional
public
void
adjustCashDeposit
(
AdjustCashDepositParam
param
)
{
UserAccount
userAccount
=
userAccountRepo
.
getOne
(
param
.
getUserAccountId
());
if
(
Constant
.
账变日志类型
_
手工增保证金
.
equals
(
param
.
getAccountChangeTypeCode
()))
{
Double
cashDeposit
=
NumberUtil
.
round
(
userAccount
.
getCashDeposit
()
+
param
.
getAccountChangeAmount
(),
4
)
.
doubleValue
();
userAccount
.
setCashDeposit
(
cashDeposit
);
userAccountRepo
.
save
(
userAccount
);
accountChangeLogRepo
.
save
(
AccountChangeLog
.
buildWithHandworkAdjustCashDeposit
(
userAccount
,
param
.
getAccountChangeAmount
()));
}
else
if
(
Constant
.
账变日志类型
_
手工减保证金
.
equals
(
param
.
getAccountChangeTypeCode
()))
{
Double
cashDeposit
=
NumberUtil
.
round
(
userAccount
.
getCashDeposit
()
-
param
.
getAccountChangeAmount
(),
4
)
.
doubleValue
();
if
(
cashDeposit
<
0
)
{
throw
new
BizException
(
BizError
.
保证金不足无法手工减保证金
);
}
userAccount
.
setCashDeposit
(
cashDeposit
);
userAccountRepo
.
save
(
userAccount
);
accountChangeLogRepo
.
save
(
AccountChangeLog
.
buildWithHandworkAdjustCashDeposit
(
userAccount
,
-
param
.
getAccountChangeAmount
()));
}
}
@ParamValid
@Transactional
(
readOnly
=
true
)
public
PageResult
<
UserAccountDetailsInfoVO
>
findLowerLevelAccountDetailsInfoByPage
(
LowerLevelAccountQueryCondParam
param
)
{
UserAccount
currentAccount
=
userAccountRepo
.
getOne
(
param
.
getCurrentAccountId
());
UserAccount
lowerLevelAccount
=
currentAccount
;
if
(
StrUtil
.
isNotBlank
(
param
.
getUserName
()))
{
lowerLevelAccount
=
userAccountRepo
.
findByUserName
(
param
.
getUserName
());
if
(
lowerLevelAccount
==
null
)
{
throw
new
BizException
(
BizError
.
用户名不存在
);
}
// 说明该用户名对应的账号不是当前账号的下级账号
if
(!
lowerLevelAccount
.
getAccountLevelPath
().
startsWith
(
currentAccount
.
getAccountLevelPath
()))
{
throw
new
BizException
(
BizError
.
不是上级账号无权查看该账号及下级的账号信息
);
}
}
String
lowerLevelAccountId
=
lowerLevelAccount
.
getId
();
String
lowerLevelAccountLevelPath
=
lowerLevelAccount
.
getAccountLevelPath
();
Specification
<
UserAccount
>
spec
=
new
Specification
<
UserAccount
>()
{
/**
*
*/
private
static
final
long
serialVersionUID
=
1L
;
public
Predicate
toPredicate
(
Root
<
UserAccount
>
root
,
CriteriaQuery
<?>
query
,
CriteriaBuilder
builder
)
{
List
<
Predicate
>
predicates
=
new
ArrayList
<
Predicate
>();
if
(
Constant
.
下级账号查询范围
_
指定账号及直接下级
.
equals
(
param
.
getQueryScope
()))
{
Predicate
predicate1
=
builder
.
equal
(
root
.
get
(
"id"
),
lowerLevelAccountId
);
Predicate
predicate2
=
builder
.
equal
(
root
.
get
(
"inviterId"
),
lowerLevelAccountId
);
predicates
.
add
(
builder
.
or
(
predicate1
,
predicate2
));
}
else
{
predicates
.
add
(
builder
.
like
(
root
.
get
(
"accountLevelPath"
),
lowerLevelAccountLevelPath
+
"%"
));
}
return
predicates
.
size
()
>
0
?
builder
.
and
(
predicates
.
toArray
(
new
Predicate
[
predicates
.
size
()]))
:
null
;
}
};
Page
<
UserAccount
>
result
=
userAccountRepo
.
findAll
(
spec
,
PageRequest
.
of
(
param
.
getPageNum
()
-
1
,
param
.
getPageSize
(),
Sort
.
by
(
Sort
.
Order
.
asc
(
"registeredTime"
))));
PageResult
<
UserAccountDetailsInfoVO
>
pageResult
=
new
PageResult
<>(
UserAccountDetailsInfoVO
.
convertFor
(
result
.
getContent
()),
param
.
getPageNum
(),
param
.
getPageSize
(),
result
.
getTotalElements
());
return
pageResult
;
}
@Transactional
(
readOnly
=
true
)
public
PageResult
<
AccountChangeLogVO
>
findLowerLevelAccountChangeLogByPage
(
LowerLevelAccountChangeLogQueryCondParam
param
)
{
UserAccount
currentAccount
=
userAccountRepo
.
getOne
(
param
.
getCurrentAccountId
());
UserAccount
lowerLevelAccount
=
currentAccount
;
if
(
StrUtil
.
isNotBlank
(
param
.
getUserName
()))
{
lowerLevelAccount
=
userAccountRepo
.
findByUserName
(
param
.
getUserName
());
if
(
lowerLevelAccount
==
null
)
{
throw
new
BizException
(
BizError
.
用户名不存在
);
}
// 说明该用户名对应的账号不是当前账号的下级账号
if
(!
lowerLevelAccount
.
getAccountLevelPath
().
startsWith
(
currentAccount
.
getAccountLevelPath
()))
{
throw
new
BizException
(
BizError
.
不是上级账号无权查看该账号及下级的帐变日志
);
}
}
String
lowerLevelAccountId
=
lowerLevelAccount
.
getId
();
String
lowerLevelAccountLevelPath
=
lowerLevelAccount
.
getAccountLevelPath
();
Specification
<
AccountChangeLog
>
spec
=
new
Specification
<
AccountChangeLog
>()
{
/**
*
*/
private
static
final
long
serialVersionUID
=
1L
;
public
Predicate
toPredicate
(
Root
<
AccountChangeLog
>
root
,
CriteriaQuery
<?>
query
,
CriteriaBuilder
builder
)
{
List
<
Predicate
>
predicates
=
new
ArrayList
<
Predicate
>();
if
(
StrUtil
.
isNotBlank
(
param
.
getUserName
()))
{
predicates
.
add
(
builder
.
equal
(
root
.
get
(
"userAccountId"
),
lowerLevelAccountId
));
}
else
{
predicates
.
add
(
builder
.
like
(
root
.
join
(
"userAccount"
,
JoinType
.
INNER
).
get
(
"accountLevelPath"
),
lowerLevelAccountLevelPath
+
"%"
));
}
if
(
param
.
getStartTime
()
!=
null
)
{
predicates
.
add
(
builder
.
greaterThanOrEqualTo
(
root
.
get
(
"accountChangeTime"
).
as
(
Date
.
class
),
DateUtil
.
beginOfDay
(
param
.
getStartTime
())));
}
if
(
param
.
getEndTime
()
!=
null
)
{
predicates
.
add
(
builder
.
lessThanOrEqualTo
(
root
.
get
(
"accountChangeTime"
).
as
(
Date
.
class
),
DateUtil
.
endOfDay
(
param
.
getEndTime
())));
}
if
(
StrUtil
.
isNotBlank
(
param
.
getAccountChangeTypeCode
()))
{
predicates
.
add
(
builder
.
equal
(
root
.
get
(
"accountChangeTypeCode"
),
param
.
getAccountChangeTypeCode
()));
}
return
predicates
.
size
()
>
0
?
builder
.
and
(
predicates
.
toArray
(
new
Predicate
[
predicates
.
size
()]))
:
null
;
}
};
Page
<
AccountChangeLog
>
result
=
accountChangeLogRepo
.
findAll
(
spec
,
PageRequest
.
of
(
param
.
getPageNum
()
-
1
,
param
.
getPageSize
(),
Sort
.
by
(
Sort
.
Order
.
desc
(
"accountChangeTime"
))));
PageResult
<
AccountChangeLogVO
>
pageResult
=
new
PageResult
<>(
AccountChangeLogVO
.
convertFor
(
result
.
getContent
()),
param
.
getPageNum
(),
param
.
getPageSize
(),
result
.
getTotalElements
());
return
pageResult
;
}
}
runscore-mobile/src/main/resources/static/js/gathering-code.js
浏览文件 @
6d73ad04
...
...
@@ -208,14 +208,14 @@ var gatheringCodeVM = new Vue({
// return;
// }
// }
if
(
editGatheringCode
.
payee
==
null
||
editGatheringCode
.
payee
==
''
)
{
/*
if (editGatheringCode.payee == null || editGatheringCode.payee == '') {
layer.alert('请选择收款人', {
title : '提示',
icon : 7,
time : 3000
});
return;
}
}
*/
if
(
$
(
'.gathering-code-pic'
).
fileinput
(
'getPreview'
).
content
.
length
!=
0
||
editGatheringCode
.
gatheringChannelCode
==
'bankcard'
)
{
that
.
addOrUpdateGatheringCodeInner
();
...
...
runscore-mobile/src/main/resources/templates/gathering-code.html
浏览文件 @
6d73ad04
...
...
@@ -140,14 +140,17 @@
</option>
</select>
</div>
<
!--<
div class="form-group">
<label> <span> 收款金额:</span>
<div class="custom-control custom-checkbox custom-control-inline" v-on:click="switchGatheringAmountMode">
<div
class=
"form-group"
>
<label>
<span>
单笔最大
收款金额:
</span>
<
!--<
div class="custom-control custom-checkbox custom-control-inline" v-on:click="switchGatheringAmountMode">
<input type="checkbox" id="fixedGatheringAmount" class="custom-control-input" v-model="editGatheringCode.fixedGatheringAmount">
<label for="fixedGatheringAmount" class="custom-control-label">固定收款金额</label>
</div>
</label> <input type="number" class="form-control" v-model="editGatheringCode.gatheringAmount" :disabled="!editGatheringCode.fixedGatheringAmount">
</div>-->
</div>-->
</label>
<!--<input type="number" class="form-control" v-model="editGatheringCode.gatheringAmount" :disabled="!editGatheringCode.fixedGatheringAmount">-->
<input
type=
"number"
class=
"form-control"
v-model=
"editGatheringCode.gatheringAmount"
>
</div>
<div
class=
"form-group"
>
<label>
收款人:
</label>
<input
type=
"text"
class=
"form-control"
v-model=
"editGatheringCode.payee"
>
...
...
实施输出/runscore.sql
浏览文件 @
6d73ad04
This source diff could not be displayed because it is too large. You can
view the blob
instead.
实施输出/view.sql
deleted
100644 → 0
浏览文件 @
f3e415a8
/*
MySQL Backup
Database: runscore
Backup Time: 2021-11-13 10:39:45
*/
SET
FOREIGN_KEY_CHECKS
=
0
;
DROP
VIEW
IF
EXISTS
`runscore`
.
`v_merchant_month_statistical`
;
DROP
VIEW
IF
EXISTS
`runscore`
.
`v_merchant_today_statistical`
;
DROP
VIEW
IF
EXISTS
`runscore`
.
`v_merchant_total_statistical`
;
CREATE
ALGORITHM
=
UNDEFINED
DEFINER
=
`root`
@
`%`
SQL
SECURITY
DEFINER
VIEW
`v_merchant_month_statistical`
AS
select
`po`
.
`merchant_id`
AS
`merchant_id`
,
round
(
sum
(
`po`
.
`gathering_amount`
),
4
)
AS
`gathering_amount`
,
count
(
1
)
AS
`order_num`
,
round
(
sum
((
case
when
(
`po`
.
`order_state`
=
'4'
)
then
`po`
.
`gathering_amount`
else
0
end
)),
4
)
AS
`trade_amount`
,
sum
((
case
when
(
`po`
.
`order_state`
=
'4'
)
then
1
else
0
end
))
AS
`paid_order_num`
from
(
`merchant_order`
`po`
left
join
`merchant`
`ua`
on
((
`po`
.
`merchant_id`
=
`ua`
.
`id`
)))
where
((
`po`
.
`received_account_id`
is
not
null
)
and
(
`po`
.
`submit_time`
>=
str_to_date
(
date_format
(
curdate
(),
'%Y-%m-01 00:00:00'
),
'%Y-%m-%d %H:%i:%s'
))
and
(
`po`
.
`submit_time`
<
(
str_to_date
(
date_format
(
curdate
(),
'%Y-%m-01 00:00:00'
),
'%Y-%m-%d %H:%i:%s'
)
+
interval
1
month
)))
group
by
`po`
.
`merchant_id`
;
CREATE
ALGORITHM
=
UNDEFINED
DEFINER
=
`root`
@
`%`
SQL
SECURITY
DEFINER
VIEW
`v_merchant_today_statistical`
AS
select
`po`
.
`merchant_id`
AS
`merchant_id`
,
round
(
sum
(
`po`
.
`gathering_amount`
),
4
)
AS
`gathering_amount`
,
count
(
1
)
AS
`order_num`
,
round
(
sum
((
case
when
(
`po`
.
`order_state`
=
'4'
)
then
`po`
.
`gathering_amount`
else
0
end
)),
4
)
AS
`trade_amount`
,
sum
((
case
when
(
`po`
.
`order_state`
=
'4'
)
then
1
else
0
end
))
AS
`paid_order_num`
from
(
`merchant_order`
`po`
left
join
`merchant`
`ua`
on
((
`po`
.
`merchant_id`
=
`ua`
.
`id`
)))
where
((
`po`
.
`received_account_id`
is
not
null
)
and
(
`po`
.
`received_time`
>=
str_to_date
(
date_format
(
now
(),
'%Y-%m-%d'
),
'%Y-%m-%d %H:%i:%s'
))
and
(
`po`
.
`received_time`
<
(
str_to_date
(
date_format
(
now
(),
'%Y-%m-%d'
),
'%Y-%m-%d %H:%i:%s'
)
+
interval
1
day
)))
group
by
`po`
.
`merchant_id`
;
CREATE
ALGORITHM
=
UNDEFINED
DEFINER
=
`root`
@
`%`
SQL
SECURITY
DEFINER
VIEW
`v_merchant_total_statistical`
AS
select
`po`
.
`merchant_id`
AS
`merchant_id`
,
round
(
sum
(
`po`
.
`gathering_amount`
),
4
)
AS
`gathering_amount`
,
count
(
1
)
AS
`order_num`
,
round
(
sum
((
case
when
(
`po`
.
`order_state`
=
'4'
)
then
`po`
.
`gathering_amount`
else
0
end
)),
4
)
AS
`trade_amount`
,
sum
((
case
when
(
`po`
.
`order_state`
=
'4'
)
then
1
else
0
end
))
AS
`paid_order_num`
from
(
`merchant_order`
`po`
left
join
`merchant`
`ua`
on
((
`po`
.
`merchant_id`
=
`ua`
.
`id`
)))
where
(
`po`
.
`received_account_id`
is
not
null
)
group
by
`po`
.
`merchant_id`
;
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论