Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
bailuntec-cost
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
bailuntec-cost
Commits
556d3d98
Commit
556d3d98
authored
Oct 30, 2020
by
huluobin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
38ea3157
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
161 additions
and
79 deletions
+161
-79
CostCheckController.java
...ther/module/cost/controller/cost/CostCheckController.java
+0
-0
CostController.java
...blt/other/module/cost/controller/cost/CostController.java
+1
-1
CostService.java
...n/java/com/blt/other/module/cost/service/CostService.java
+9
-1
AbstractCostService.java
...er/module/cost/service/impl/cost/AbstractCostService.java
+9
-63
CostSubscribe.java
...lt/other/module/cost/service/impl/cost/CostSubscribe.java
+1
-1
PayCostServiceImpl.java
...her/module/cost/service/impl/cost/PayCostServiceImpl.java
+6
-0
CostContext.java
...other/module/cost/service/impl/costcheck/CostContext.java
+3
-6
DepartmentCheckState.java
...ule/cost/service/impl/costcheck/DepartmentCheckState.java
+7
-3
FinalCheckState.java
...r/module/cost/service/impl/costcheck/FinalCheckState.java
+67
-1
FinancialCheckState.java
...dule/cost/service/impl/costcheck/FinancialCheckState.java
+57
-0
PayedState.java
.../other/module/cost/service/impl/costcheck/PayedState.java
+0
-2
UnSubmitState.java
...her/module/cost/service/impl/costcheck/UnSubmitState.java
+1
-1
No files found.
bailuntec-cost-core/src/main/java/com/blt/other/module/cost/controller/cost/CostCheckController.java
View file @
556d3d98
This diff is collapsed.
Click to expand it.
bailuntec-cost-core/src/main/java/com/blt/other/module/cost/controller/cost/CostController.java
View file @
556d3d98
...
...
@@ -176,7 +176,7 @@ public class CostController {
CostContext
costContext
=
new
CostContext
(
costNo
,
costDomain
.
getCreateUserid
());
costContext
.
setCostState
(
unSubmitState
);
costContext
.
nexStat
e
();
costContext
.
handl
e
();
CostApiDto
.
UpdateCostResp
resp
=
new
CostApiDto
.
UpdateCostResp
();
...
...
bailuntec-cost-core/src/main/java/com/blt/other/module/cost/service/CostService.java
View file @
556d3d98
...
...
@@ -124,7 +124,6 @@ public interface CostService {
void
finalCheck
(
String
costNo
,
Integer
currentUserId
);
/**
* 审核费用单列表
*
...
...
@@ -135,4 +134,13 @@ public interface CostService {
* @return 费用单列表
*/
IPage
<
CostDto
>
checkCostList
(
Integer
userid
,
Integer
pageNum
,
Integer
pageSize
,
Integer
type
);
/**
* <p>
* 审核成功通知财务系统付款
* </p>
*
* @param costDomain cost
*/
void
toFinancial
(
CostDomain
costDomain
);
}
bailuntec-cost-core/src/main/java/com/blt/other/module/cost/service/impl/cost/AbstractCostService.java
View file @
556d3d98
...
...
@@ -10,7 +10,6 @@ import com.blt.other.common.util.MoneyUtil;
import
com.blt.other.module.auth.dao.CostReviewerMapper
;
import
com.blt.other.module.auth.dao.OaUserMapper
;
import
com.blt.other.module.auth.model.CostReviewer
;
import
com.blt.other.module.auth.model.OaUser
;
import
com.blt.other.module.auth.service.UserService
;
import
com.blt.other.module.cost.dao.CostCompanyDao
;
import
com.blt.other.module.cost.dao.CostDao
;
...
...
@@ -24,6 +23,8 @@ import com.blt.other.module.cost.model.CostTemplate;
import
com.blt.other.module.cost.service.CostLogService
;
import
com.blt.other.module.cost.service.CostService
;
import
com.blt.other.module.cost.service.ICostTemplateService
;
import
com.blt.other.module.cost.service.impl.costcheck.CostContext
;
import
com.blt.other.module.cost.service.impl.costcheck.DepartmentCheckState
;
import
com.blt.other.module.database.model.CostCompanyDomain
;
import
com.blt.other.module.database.model.CostLogDomain
;
import
com.blt.other.module.database.model.CostTypeKindDomain
;
...
...
@@ -184,37 +185,17 @@ public abstract class AbstractCostService implements CostService {
}
@Resource
DepartmentCheckState
departmentCheckState
;
@Transactional
@Override
public
void
departmentCheck
(
String
costNo
,
Integer
currentUserId
)
{
CostDomain
costDomain
=
costDao
.
selectByCostNo
(
costNo
);
CostTemplate
costTemplate
=
costTemplateService
.
queryDetail
(
costDomain
.
getCostTemplateId
());
//需要自动审核
if
(
costTemplate
.
shouldDepartmentAutoCheck
())
{
//自动审核通过
if
(
this
.
autoCheck
(
costDomain
))
{
costDomain
.
setCostStatus
(
CostDomain
.
STATUS_FINANCIAL_CHECK
);
costDao
.
updateById
(
costDomain
);
//流转状态
costSubscribe
.
subscribe
(
costDomain
);
costLogService
.
save
(
costNo
,
currentUserId
,
"部门自动审核通过"
,
CostLogDomain
.
AUTO_CHECK
);
}
//自动审核失败
else
{
//人工审核
this
.
departmentManualCheck
(
costNo
,
currentUserId
);
}
}
//人工审核
else
{
//人工审核
this
.
departmentManualCheck
(
costNo
,
currentUserId
);
}
}
CostContext
costContext
=
new
CostContext
(
costNo
,
currentUserId
);
costContext
.
setCostState
(
departmentCheckState
);
costContext
.
handle
();
}
@Transactional
...
...
@@ -223,46 +204,11 @@ public abstract class AbstractCostService implements CostService {
CostDomain
costDomain
=
costDao
.
selectByCostNo
(
costNo
);
CostTemplate
costTemplate
=
costTemplateService
.
queryDetail
(
costDomain
.
getCostTemplateId
());
//需要自动审核
if
(
costTemplate
.
shouldFinalAutoCheck
())
{
//自动审核通过
if
(
this
.
autoCheck
(
costDomain
))
{
costDomain
.
setCostStatus
(
CostDomain
.
STATUS_FINAL_CHECK
);
costDao
.
updateById
(
costDomain
);
//流转状态
costSubscribe
.
subscribe
(
costDomain
);
costLogService
.
save
(
costNo
,
currentUserId
,
"财务自动审核通过"
,
CostLogDomain
.
AUTO_CHECK
);
}
//自动审核失败
else
{
//人工审核
this
.
financialManualCheck
(
costNo
,
currentUserId
);
}
}
//人工审核
else
{
//人工审核
this
.
financialManualCheck
(
costNo
,
currentUserId
);
}
}
protected
void
financialManualCheck
(
String
costNo
,
Integer
currentUserId
)
{
CostDomain
costDomain
=
costDao
.
selectByCostNo
(
costNo
);
CostCompanyDomain
costCompany
=
costCompanyDao
.
selectByNo
(
costDomain
.
getCompanyNo
());
//人工审核通过
if
(
costReviewerMapper
.
queryOne
(
costCompany
.
getId
(),
CostReviewer
.
financialReviewer
,
currentUserId
)
!=
null
)
{
costDomain
.
setCostStatus
(
CostDomain
.
STATUS_FINAL_CHECK
);
costDao
.
updateById
(
costDomain
);
//流转状态
costSubscribe
.
subscribe
(
costDomain
);
costLogService
.
save
(
costNo
,
currentUserId
,
"财务审核通过"
,
CostLogDomain
.
MANUAL_CHECK
);
}
//人工审核没权限
else
{
throw
new
BizRuntimeException
(
"current user no authority"
);
}
}
...
...
bailuntec-cost-core/src/main/java/com/blt/other/module/cost/service/impl/cost/CostSubscribe.java
View file @
556d3d98
...
...
@@ -23,6 +23,6 @@ public class CostSubscribe {
@Async
public
void
subscribe
(
CostContext
costContext
)
{
costContext
.
nexStat
e
();
costContext
.
handl
e
();
}
}
bailuntec-cost-core/src/main/java/com/blt/other/module/cost/service/impl/cost/PayCostServiceImpl.java
View file @
556d3d98
package
com
.
blt
.
other
.
module
.
cost
.
service
.
impl
.
cost
;
import
com.blt.other.module.cost.model.CostDomain
;
import
com.blt.other.module.cost.service.CostService
;
import
org.springframework.stereotype.Service
;
...
...
@@ -17,4 +18,9 @@ public class PayCostServiceImpl extends AbstractCostService implements CostServi
public
void
finalCheck
(
String
costNo
,
Integer
currentUserId
)
{
}
@Override
public
void
toFinancial
(
CostDomain
costDomain
)
{
}
}
bailuntec-cost-core/src/main/java/com/blt/other/module/cost/service/impl/costcheck/CostContext.java
View file @
556d3d98
package
com
.
blt
.
other
.
module
.
cost
.
service
.
impl
.
costcheck
;
import
com.bailuntec.common.SpringContextUtil
;
import
com.blt.other.module.cost.dao.CostDao
;
import
com.blt.other.module.cost.model.CostDomain
;
import
com.blt.other.module.cost.service.CostService
;
import
com.blt.other.module.cost.service.impl.cost.CostServiceFactory
;
/**
* <p>
*
*
费用单上下文
* </p>
*
* @author robbendev
...
...
@@ -33,11 +31,11 @@ public class CostContext {
public
CostContext
(
String
costNo
,
Integer
currentUserId
)
{
this
.
costService
=
CostServiceFactory
.
getCostService
(
costNo
);
this
.
currentUserId
=
currentUserId
;
this
.
costDomain
=
SpringContextUtil
.
getBean
(
CostDao
.
class
).
selec
tByCostNo
(
costNo
);
this
.
costDomain
=
costService
.
getCos
tByCostNo
(
costNo
);
}
public
void
nexStat
e
()
{
public
void
handl
e
()
{
costState
.
handle
();
}
...
...
@@ -45,5 +43,4 @@ public class CostContext {
costState
.
refuse
();
}
}
bailuntec-cost-core/src/main/java/com/blt/other/module/cost/service/impl/costcheck/DepartmentCheckState.java
View file @
556d3d98
...
...
@@ -27,8 +27,13 @@ public class DepartmentCheckState extends CostState {
public
void
handle
()
{
CostDomain
costDomain
=
costContext
.
costDomain
;
Integer
currentUserId
=
costContext
.
currentUserId
;
CostTemplate
costTemplate
=
costTemplateService
.
queryDetail
(
costDomain
.
getCostTemplateId
());
//check status
if
(!
costDomain
.
getCostStatus
().
equals
(
CostDomain
.
STATUS_DEPARTMENT_CHECK
))
{
throw
new
BizRuntimeException
(
"invalid status"
);
}
//需要自动审核
if
(
costTemplate
.
shouldDepartmentAutoCheck
())
{
//自动审核通过
...
...
@@ -54,8 +59,7 @@ public class DepartmentCheckState extends CostState {
costLogService
.
save
(
costDomain
.
getCostNo
(),
currentUserId
,
"部门审核通过"
,
CostLogDomain
.
MANUAL_CHECK
);
nextState
(
financialCheckState
);
//发布到总线尝试审核
//发布到总线尝试下个环节的自动审核
costSubscribe
.
subscribe
(
costContext
);
}
//人工审核没权限
...
...
bailuntec-cost-core/src/main/java/com/blt/other/module/cost/service/impl/costcheck/FinalCheckState.java
View file @
556d3d98
package
com
.
blt
.
other
.
module
.
cost
.
service
.
impl
.
costcheck
;
import
org.springframework.stereotype.Component
;
import
com.blt.other.common.exception.BizRuntimeException
;
import
com.blt.other.module.auth.model.CostReviewer
;
import
com.blt.other.module.cost.dao.CostCompanyDao
;
import
com.blt.other.module.cost.model.CostDomain
;
import
com.blt.other.module.cost.model.CostTemplate
;
import
com.blt.other.module.database.model.CostCompanyDomain
;
import
com.blt.other.module.database.model.CostLogDomain
;
import
javax.annotation.Resource
;
/**
* <p>
...
...
@@ -12,9 +20,67 @@ import org.springframework.stereotype.Component;
*/
public
class
FinalCheckState
extends
CostState
{
@Resource
UnPayState
unPayState
;
@Resource
CostCompanyDao
costCompanyDao
;
@Override
public
void
handle
()
{
CostDomain
costDomain
=
costContext
.
costDomain
;
Integer
currentUserId
=
costContext
.
currentUserId
;
CostTemplate
costTemplate
=
costTemplateService
.
queryDetail
(
costDomain
.
getCostTemplateId
());
//check status
if
(!
costDomain
.
getCostStatus
().
equals
(
CostDomain
.
STATUS_FINAL_CHECK
))
{
throw
new
BizRuntimeException
(
"invalid status"
);
}
//如果不需要审核 直接通过
if
(!
costTemplate
.
shouldFinalCheck
(
costDomain
.
getAmount
()))
{
costDomain
.
setCostStatus
(
CostDomain
.
STATUS_UN_PAY
);
costDao
.
updateById
(
costDomain
);
costLogService
.
save
(
costDomain
.
getCostNo
(),
currentUserId
,
"金额不够最终审核标准,无需最终审核"
,
null
);
//通知财务系统
costContext
.
costService
.
toFinancial
(
costDomain
);
}
//需要自动审核
if
(
costTemplate
.
shouldFinalAutoCheck
())
{
//自动审核通过
if
(
this
.
autoCheck
(
costDomain
))
{
costDomain
.
setCostStatus
(
CostDomain
.
STATUS_UN_PAY
);
costDao
.
updateById
(
costDomain
);
costLogService
.
save
(
costDomain
.
getCostNo
(),
currentUserId
,
"最终审核自动通过"
,
CostLogDomain
.
AUTO_CHECK
);
//流转状态
nextState
(
unPayState
);
//通知财务系统
costContext
.
costService
.
toFinancial
(
costDomain
);
return
;
}
}
CostCompanyDomain
costCompany
=
costCompanyDao
.
selectByNo
(
costDomain
.
getCompanyNo
());
//人工审核通过
if
(
costReviewerMapper
.
queryOne
(
costCompany
.
getId
(),
CostReviewer
.
financialReviewer
,
currentUserId
)
!=
null
)
{
costDomain
.
setCostStatus
(
CostDomain
.
STATUS_UN_PAY
);
costDao
.
updateById
(
costDomain
);
costLogService
.
save
(
costDomain
.
getCostNo
(),
currentUserId
,
"最终审核通过"
,
CostLogDomain
.
MANUAL_CHECK
);
//流转状态
nextState
(
unPayState
);
//通知财务系统
costContext
.
costService
.
toFinancial
(
costDomain
);
}
//人工审核没权限
else
{
throw
new
BizRuntimeException
(
"current user no authority"
);
}
}
@Override
...
...
bailuntec-cost-core/src/main/java/com/blt/other/module/cost/service/impl/costcheck/FinancialCheckState.java
View file @
556d3d98
package
com
.
blt
.
other
.
module
.
cost
.
service
.
impl
.
costcheck
;
import
com.blt.other.common.exception.BizRuntimeException
;
import
com.blt.other.module.auth.model.CostReviewer
;
import
com.blt.other.module.cost.dao.CostCompanyDao
;
import
com.blt.other.module.cost.model.CostDomain
;
import
com.blt.other.module.cost.model.CostTemplate
;
import
com.blt.other.module.database.model.CostCompanyDomain
;
import
com.blt.other.module.database.model.CostLogDomain
;
import
org.springframework.stereotype.Component
;
import
javax.annotation.Resource
;
/**
* <p>
*
...
...
@@ -13,9 +22,57 @@ import org.springframework.stereotype.Component;
@Component
public
class
FinancialCheckState
extends
CostState
{
@Resource
FinalCheckState
finalCheckState
;
@Resource
CostCompanyDao
costCompanyDao
;
@Override
public
void
handle
()
{
CostDomain
costDomain
=
costContext
.
costDomain
;
Integer
currentUserId
=
costContext
.
currentUserId
;
CostTemplate
costTemplate
=
costTemplateService
.
queryDetail
(
costDomain
.
getCostTemplateId
());
//check status
if
(!
costDomain
.
getCostStatus
().
equals
(
CostDomain
.
STATUS_FINANCIAL_CHECK
))
{
throw
new
BizRuntimeException
(
"invalid status"
);
}
//需要自动审核
if
(
costTemplate
.
shouldFinalAutoCheck
())
{
//自动审核通过
if
(
this
.
autoCheck
(
costDomain
))
{
costDomain
.
setCostStatus
(
CostDomain
.
STATUS_FINAL_CHECK
);
costDao
.
updateById
(
costDomain
);
costLogService
.
save
(
costDomain
.
getCostNo
(),
currentUserId
,
"财务自动审核通过"
,
CostLogDomain
.
AUTO_CHECK
);
//流转状态
nextState
(
finalCheckState
);
//发布到总线尝试下个环节的自动审核
costSubscribe
.
subscribe
(
costContext
);
return
;
}
}
CostCompanyDomain
costCompany
=
costCompanyDao
.
selectByNo
(
costDomain
.
getCompanyNo
());
//人工审核通过
if
(
costReviewerMapper
.
queryOne
(
costCompany
.
getId
(),
CostReviewer
.
financialReviewer
,
currentUserId
)
!=
null
)
{
costDomain
.
setCostStatus
(
CostDomain
.
STATUS_FINAL_CHECK
);
costDao
.
updateById
(
costDomain
);
costLogService
.
save
(
costDomain
.
getCostNo
(),
currentUserId
,
"财务审核通过"
,
CostLogDomain
.
MANUAL_CHECK
);
//流转状态
nextState
(
finalCheckState
);
//发布到总线尝试下个环节的自动审核
costSubscribe
.
subscribe
(
costContext
);
}
//人工审核没权限
else
{
throw
new
BizRuntimeException
(
"current user no authority"
);
}
}
@Override
...
...
bailuntec-cost-core/src/main/java/com/blt/other/module/cost/service/impl/costcheck/PayedState.java
View file @
556d3d98
package
com
.
blt
.
other
.
module
.
cost
.
service
.
impl
.
costcheck
;
import
org.springframework.stereotype.Component
;
/**
* <p>
*
...
...
bailuntec-cost-core/src/main/java/com/blt/other/module/cost/service/impl/costcheck/UnSubmitState.java
View file @
556d3d98
...
...
@@ -41,7 +41,7 @@ public class UnSubmitState extends CostState {
//并且流转到下一个状态
costContext
.
setCostState
(
departmentCheckState
);
//尝试审核(由于清空了审核人,这里只会走自动审核)
costContext
.
nexStat
e
();
costContext
.
handl
e
();
}
@Override
...
...
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