Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jiedao-api-boot-master
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
lanbaoming
jiedao-api-boot-master
Commits
3d68dd86
Commit
3d68dd86
authored
Aug 24, 2024
by
chenjiuping
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
自动核销功能
parent
b94caa15
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
213 additions
and
116 deletions
+213
-116
ReceiptService.java
...r/yudao/module/wealth/service/receipt/ReceiptService.java
+16
-0
ReceiptServiceImpl.java
...dao/module/wealth/service/receipt/ReceiptServiceImpl.java
+132
-116
ReceiptAutoWriteOff.java
...dule/wealth/controller/admin/job/ReceiptAutoWriteOff.java
+65
-0
No files found.
yudao-module-wealth/yudao-module-wealth-core/src/main/java/cn/iocoder/yudao/module/wealth/service/receipt/ReceiptService.java
View file @
3d68dd86
...
@@ -139,5 +139,21 @@ public interface ReceiptService extends IService<ReceiptDO> {
...
@@ -139,5 +139,21 @@ public interface ReceiptService extends IService<ReceiptDO> {
ReceiptExportDto
getReceiptExportByOrderId
(
Long
orderId
);
ReceiptExportDto
getReceiptExportByOrderId
(
Long
orderId
);
/**
* 判断当前收款单有没有达到比例
*
* @param receiptDO
* @param proportion
* @return
*/
Boolean
judgingProportion
(
ReceiptDO
receiptDO
,
String
proportion
);
/**
* 自动更新收款单的核销状态
*
* @param receiptDO
*/
void
autoWriteOffReceipt
(
ReceiptDO
receiptDO
,
String
userId
,
String
userName
);
}
}
yudao-module-wealth/yudao-module-wealth-core/src/main/java/cn/iocoder/yudao/module/wealth/service/receipt/ReceiptServiceImpl.java
View file @
3d68dd86
This diff is collapsed.
Click to expand it.
yudao-module-wealth/yudao-module-wealth-rest/src/main/java/cn/iocoder/yudao/module/wealth/controller/admin/job/ReceiptAutoWriteOff.java
0 → 100644
View file @
3d68dd86
package
cn
.
iocoder
.
yudao
.
module
.
wealth
.
controller
.
admin
.
job
;
import
cn.hutool.core.util.StrUtil
;
import
cn.iocoder.yudao.framework.quartz.core.handler.JobHandler
;
import
cn.iocoder.yudao.framework.tenant.core.job.TenantJob
;
import
cn.iocoder.yudao.module.system.api.user.AdminUserApi
;
import
cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO
;
import
cn.iocoder.yudao.module.wealth.dal.dataobject.receipt.ReceiptDO
;
import
cn.iocoder.yudao.module.wealth.enums.ReceiptStatusEnum
;
import
cn.iocoder.yudao.module.wealth.service.receipt.ReceiptService
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.stereotype.Component
;
import
javax.annotation.Resource
;
import
java.util.List
;
/**
* 收款单自动核销任务
*/
@Component
@TenantJob
@Slf4j
public
class
ReceiptAutoWriteOff
implements
JobHandler
{
@Resource
ReceiptService
receiptService
;
@Resource
AdminUserApi
adminUserApi
;
@Override
public
String
execute
(
String
param
)
throws
Exception
{
if
(
StrUtil
.
isBlank
(
param
))
{
log
.
error
(
"自动核销比例未配置,自动退出"
);
return
""
;
}
String
[]
paramArray
=
param
.
split
(
","
);
if
(
paramArray
.
length
!=
2
||
StrUtil
.
isBlank
(
paramArray
[
0
])
||
StrUtil
.
isBlank
(
paramArray
[
1
]))
{
log
.
error
(
"自动核销比例JOB参数错误,自动退出"
);
return
""
;
}
AdminUserRespDTO
adminUserRespDTO
=
adminUserApi
.
getUser
(
Long
.
parseLong
(
paramArray
[
1
]));
if
(
null
==
adminUserRespDTO
)
{
log
.
error
(
"自动核销比例JOB参数错误,核销人配置错误,自动退出"
);
return
""
;
}
//查询所有收款单状态为待核销的
LambdaQueryWrapper
<
ReceiptDO
>
lambdaQueryWrapper
=
new
LambdaQueryWrapper
<>();
lambdaQueryWrapper
.
and
(
i
->
i
.
eq
(
ReceiptDO:
:
getState
,
ReceiptStatusEnum
.
WRITE_OFF_WAITING
.
getValue
()).
or
().
eq
(
ReceiptDO:
:
getState
,
ReceiptStatusEnum
.
WRITE_OFF_PART_ING
.
getValue
()));
List
<
ReceiptDO
>
receiptDOList
=
receiptService
.
selectList
(
lambdaQueryWrapper
);
for
(
ReceiptDO
receiptDO
:
receiptDOList
)
{
try
{
//判断当前收款单下的收款明细是不是全部是已核销并且核销比例要大于配置(params)
Boolean
result
=
receiptService
.
judgingProportion
(
receiptDO
,
paramArray
[
0
]);
if
(
result
)
{
receiptService
.
autoWriteOffReceipt
(
receiptDO
,
paramArray
[
1
],
adminUserRespDTO
.
getNickname
());
}
}
catch
(
Exception
e
)
{
log
.
error
(
"收款单{}自动核销出错原因:{}"
,
receiptDO
.
getReceiptNo
(),
e
.
getMessage
());
}
}
return
""
;
}
}
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