Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
P
precision-effect
Project
Project
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
耿迪迪
precision-effect
Commits
50f60a9f
Commit
50f60a9f
authored
Jun 18, 2023
by
lizhichao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增外部采购-可用金额验证
parent
f80e1e0e
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
30 additions
and
0 deletions
+30
-0
TPurchaseController.java
...ehong/web/controller/transaction/TPurchaseController.java
+9
-0
TAccountMapper.java
...rc/main/java/com/zehong/system/mapper/TAccountMapper.java
+1
-0
ITAccountService.java
...main/java/com/zehong/system/service/ITAccountService.java
+3
-0
TAccountServiceImpl.java
...a/com/zehong/system/service/impl/TAccountServiceImpl.java
+17
-0
No files found.
precision-effect-admin/src/main/java/com/zehong/web/controller/transaction/TPurchaseController.java
View file @
50f60a9f
...
...
@@ -3,9 +3,11 @@ package com.zehong.web.controller.transaction;
import
java.util.List
;
import
com.zehong.common.core.domain.entity.SysUser
;
import
com.zehong.common.utils.SecurityUtils
;
import
com.zehong.common.utils.ServletUtils
;
import
com.zehong.common.utils.StringUtils
;
import
com.zehong.framework.web.service.TokenService
;
import
com.zehong.system.service.ITAccountService
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
...
...
@@ -39,6 +41,8 @@ public class TPurchaseController extends BaseController
private
ITPurchaseService
tPurchaseService
;
@Autowired
private
TokenService
tokenService
;
@Autowired
private
ITAccountService
itAccountService
;
/**
* 查询外部采购(报销)申请列表
*/
...
...
@@ -87,6 +91,11 @@ public class TPurchaseController extends BaseController
@PostMapping
public
AjaxResult
add
(
@RequestBody
TPurchase
tPurchase
)
{
SysUser
user
=
SecurityUtils
.
getLoginUser
().
getUser
();
if
(!
itAccountService
.
checkAccountCanTrade
(
user
.
getDeptId
(),
tPurchase
.
getTotal
())){
return
AjaxResult
.
error
(
"账户可用金额不足!"
);
}
return
toAjax
(
tPurchaseService
.
insertTPurchase
(
tPurchase
));
}
...
...
precision-effect-system/src/main/java/com/zehong/system/mapper/TAccountMapper.java
View file @
50f60a9f
...
...
@@ -58,4 +58,5 @@ public interface TAccountMapper
* @return 结果
*/
public
int
deleteTAccountByIds
(
Long
[]
accountIds
);
}
precision-effect-system/src/main/java/com/zehong/system/service/ITAccountService.java
View file @
50f60a9f
package
com
.
zehong
.
system
.
service
;
import
java.math.BigDecimal
;
import
java.util.List
;
import
com.zehong.system.domain.TAccount
;
...
...
@@ -58,4 +59,6 @@ public interface ITAccountService
* @return 结果
*/
public
int
deleteTAccountById
(
Long
accountId
);
public
boolean
checkAccountCanTrade
(
Long
deptId
,
BigDecimal
amount
);
}
precision-effect-system/src/main/java/com/zehong/system/service/impl/TAccountServiceImpl.java
View file @
50f60a9f
package
com
.
zehong
.
system
.
service
.
impl
;
import
java.math.BigDecimal
;
import
java.util.List
;
import
com.zehong.common.utils.DateUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -93,4 +94,20 @@ public class TAccountServiceImpl implements ITAccountService
{
return
tAccountMapper
.
deleteTAccountById
(
accountId
);
}
@Override
public
boolean
checkAccountCanTrade
(
Long
deptId
,
BigDecimal
amount
)
{
TAccount
tAccount
=
new
TAccount
();
tAccount
.
setDeptId
(
deptId
);
List
<
TAccount
>
rst
=
tAccountMapper
.
selectTAccountList
(
tAccount
);
if
(
rst
!=
null
&&
rst
.
size
()>
0
){
if
(
rst
.
get
(
0
).
getAbleAmount
().
compareTo
(
amount
)>=
0
)
{
return
true
;
}
else
{
return
false
;
}
}
else
{
return
false
;
}
}
}
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