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
38ea3157
Commit
38ea3157
authored
Oct 30, 2020
by
huluobin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
4729fa00
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
539 additions
and
89 deletions
+539
-89
UserController.java
.../com/blt/other/module/auth/controller/UserController.java
+1
-1
CostReviewerMapper.java
...ava/com/blt/other/module/auth/dao/CostReviewerMapper.java
+5
-2
OaUserMapper.java
...main/java/com/blt/other/module/auth/dao/OaUserMapper.java
+4
-2
CostCheckController.java
...ther/module/cost/controller/cost/CostCheckController.java
+0
-0
CostCheckLendController.java
.../module/cost/controller/cost/CostCheckLendController.java
+0
-0
CostController.java
...blt/other/module/cost/controller/cost/CostController.java
+0
-0
CostDomain.java
...main/java/com/blt/other/module/cost/model/CostDomain.java
+5
-5
CostTemplate.java
...in/java/com/blt/other/module/cost/model/CostTemplate.java
+17
-1
CostService.java
...n/java/com/blt/other/module/cost/service/CostService.java
+17
-1
AbstractCostService.java
...er/module/cost/service/impl/cost/AbstractCostService.java
+95
-32
CostSubscribe.java
...lt/other/module/cost/service/impl/cost/CostSubscribe.java
+3
-22
CostContext.java
...other/module/cost/service/impl/costcheck/CostContext.java
+49
-0
CostState.java
...t/other/module/cost/service/impl/costcheck/CostState.java
+84
-0
DepartmentCheckState.java
...ule/cost/service/impl/costcheck/DepartmentCheckState.java
+72
-0
FinalCheckState.java
...r/module/cost/service/impl/costcheck/FinalCheckState.java
+24
-0
FinancialCheckState.java
...dule/cost/service/impl/costcheck/FinancialCheckState.java
+25
-0
PayedState.java
.../other/module/cost/service/impl/costcheck/PayedState.java
+24
-0
RefuseState.java
...other/module/cost/service/impl/costcheck/RefuseState.java
+24
-0
UnPayState.java
.../other/module/cost/service/impl/costcheck/UnPayState.java
+24
-0
UnSubmitState.java
...her/module/cost/service/impl/costcheck/UnSubmitState.java
+51
-0
ApplyCallbackUrlVo.java
...java/com/blt/other/module/cost/vo/ApplyCallbackUrlVo.java
+3
-23
ApplyCallbackVo.java
...in/java/com/blt/other/module/cost/vo/ApplyCallbackVo.java
+3
-0
CostReviewerMapper.xml
...ore/src/main/resources/mapper/auth/CostReviewerMapper.xml
+9
-0
No files found.
bailuntec-cost-core/src/main/java/com/blt/other/module/auth/controller/UserController.java
View file @
38ea3157
package
com
.
blt
.
other
.
module
.
auth
.
controller
;
package
com
.
blt
.
other
.
module
.
auth
.
controller
;
import
com.bailuntec.cost.api.response.CostResult
;
import
com.bailuntec.cost.api.response.CostResult
;
import
com.blt.other.common.util.AxiosUtil
;
import
com.blt.other.module.auth.service.UserService
;
import
com.blt.other.module.auth.service.UserService
;
import
com.blt.other.module.auth.service.UserSyncService
;
import
com.blt.other.module.auth.service.UserSyncService
;
import
com.blt.other.module.auth.vo.GetByBLUserAcct
;
import
com.blt.other.module.auth.vo.GetByBLUserAcct
;
import
com.blt.other.module.auth.vo.UserGetByBLUserAcct
;
import
com.blt.other.module.auth.vo.UserGetByBLUserAcct
;
import
com.blt.other.common.util.AxiosUtil
;
import
com.blt.other.module.database.model.BuyUserDomain
;
import
com.blt.other.module.database.model.BuyUserDomain
;
import
com.blt.other.module.database.model.UserDomain
;
import
com.blt.other.module.database.model.UserDomain
;
import
com.blt.other.module.supplier.service.BuyUserService
;
import
com.blt.other.module.supplier.service.BuyUserService
;
...
...
bailuntec-cost-core/src/main/java/com/blt/other/module/auth/dao/CostReviewerMapper.java
View file @
38ea3157
package
com
.
blt
.
other
.
module
.
auth
.
dao
;
package
com
.
blt
.
other
.
module
.
auth
.
dao
;
import
com.blt.other.module.auth.model.CostReviewer
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.blt.other.module.auth.model.CostReviewer
;
import
org.apache.ibatis.annotations.Param
;
/**
/**
* <p>
* <p>
*
Mapper 接口
* Mapper 接口
* </p>
* </p>
*
*
* @author robbendev
* @author robbendev
...
@@ -13,4 +14,6 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
...
@@ -13,4 +14,6 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
*/
*/
public
interface
CostReviewerMapper
extends
BaseMapper
<
CostReviewer
>
{
public
interface
CostReviewerMapper
extends
BaseMapper
<
CostReviewer
>
{
CostReviewer
queryOne
(
@Param
(
"referId"
)
Integer
referId
,
@Param
(
"type"
)
Integer
type
,
@Param
(
"reviewerUserId"
)
Integer
reviewerUserId
);
}
}
bailuntec-cost-core/src/main/java/com/blt/other/module/auth/dao/OaUserMapper.java
View file @
38ea3157
package
com
.
blt
.
other
.
module
.
auth
.
dao
;
package
com
.
blt
.
other
.
module
.
auth
.
dao
;
import
com.blt.other.module.auth.model.OaUser
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.blt.other.module.auth.model.OaUser
;
import
org.apache.ibatis.annotations.Mapper
;
/**
/**
* <p>
* <p>
*
Mapper 接口
* Mapper 接口
* </p>
* </p>
*
*
* @author robbendev
* @author robbendev
* @since 2020-10-12
* @since 2020-10-12
*/
*/
@Mapper
public
interface
OaUserMapper
extends
BaseMapper
<
OaUser
>
{
public
interface
OaUserMapper
extends
BaseMapper
<
OaUser
>
{
OaUser
selectByOaUserId
(
Integer
oaUserId
);
OaUser
selectByOaUserId
(
Integer
oaUserId
);
...
...
bailuntec-cost-core/src/main/java/com/blt/other/module/cost/controller/cost/CostCheckController.java
View file @
38ea3157
This diff is collapsed.
Click to expand it.
bailuntec-cost-core/src/main/java/com/blt/other/module/cost/controller/cost/CostCheckLendController.java
View file @
38ea3157
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 @
38ea3157
This diff is collapsed.
Click to expand it.
bailuntec-cost-core/src/main/java/com/blt/other/module/cost/model/CostDomain.java
View file @
38ea3157
...
@@ -31,12 +31,12 @@ public class CostDomain {
...
@@ -31,12 +31,12 @@ public class CostDomain {
//借支/借还
//借支/借还
public
final
static
Integer
COST_FROM_3
=
2
;
public
final
static
Integer
COST_FROM_3
=
2
;
//
@ApiModelProperty("费用单状态 0 未提交 1待审核 2待出纳付款 3已支付 4-待部门审核 5-待财务审核 6-待最终审核人审核")
//
0 待提交 1- 待财务审核 2待出纳付款 3被驳回 4已支付 5已作废 6-待部门审核 7-待财务审核 8-待最终审核人审核
public
final
static
int
STATUS_UN_SUBMIT
=
0
;
public
final
static
int
STATUS_UN_SUBMIT
=
0
;
public
final
static
int
STATUS_DEPARTMENT_CHECK
=
4
;
public
final
static
int
STATUS_DEPARTMENT_CHECK
=
6
;
public
final
static
int
STATUS_FINANCIAL_CHECK
=
5
;
public
final
static
int
STATUS_FINANCIAL_CHECK
=
7
;
public
final
static
int
STATUS_FINAL_CHECK
=
6
;
public
final
static
int
STATUS_FINAL_CHECK
=
8
;
public
final
static
int
STATUS_UN_PAY
=
2
;
public
final
static
int
STATUS_UN_PAY
=
2
;
public
final
static
int
STATUS_PAYED
=
3
;
public
final
static
int
STATUS_PAYED
=
3
;
...
@@ -95,7 +95,7 @@ public class CostDomain {
...
@@ -95,7 +95,7 @@ public class CostDomain {
@ApiModelProperty
(
"关联父单"
)
@ApiModelProperty
(
"关联父单"
)
private
String
supCostNo
;
private
String
supCostNo
;
@ApiModelProperty
(
"费用单状态 0
未提交 1待审核 2待出纳付款 3已支付 4-待部门审核 5-待财务审核 6
-待最终审核人审核"
)
@ApiModelProperty
(
"费用单状态 0
待提交 1- 待财务审核 2待出纳付款 3被驳回 4已支付 5已作废 6-待部门审核 7-待财务审核 8
-待最终审核人审核"
)
private
Integer
costStatus
;
private
Integer
costStatus
;
@ApiModelProperty
(
"文件地址"
)
@ApiModelProperty
(
"文件地址"
)
...
...
bailuntec-cost-core/src/main/java/com/blt/other/module/cost/model/CostTemplate.java
View file @
38ea3157
...
@@ -52,7 +52,7 @@ public class CostTemplate implements Serializable {
...
@@ -52,7 +52,7 @@ public class CostTemplate implements Serializable {
@ApiModelProperty
(
"自动审核金额 冗余从表金额字段"
)
@ApiModelProperty
(
"自动审核金额 冗余从表金额字段"
)
private
BigDecimal
autoCheckAmount
;
private
BigDecimal
autoCheckAmount
;
// @TableField(exist = false)
// @TableField(exist = false)
@ApiModelProperty
(
"是否设置了自动审核规则"
)
@ApiModelProperty
(
"是否设置了自动审核规则"
)
private
Boolean
setAutoCheck
;
private
Boolean
setAutoCheck
;
...
@@ -79,4 +79,20 @@ public class CostTemplate implements Serializable {
...
@@ -79,4 +79,20 @@ public class CostTemplate implements Serializable {
private
List
<
CostTemplateCol
>
costTemplateColList
;
private
List
<
CostTemplateCol
>
costTemplateColList
;
public
boolean
shouldDepartmentAutoCheck
()
{
return
enableAutoReview
&&
enableDepartmentReview
;
}
public
boolean
shouldFinanciaAutoCheck
()
{
return
enableAutoReview
&&
enableFinancialAutoReview
;
}
public
boolean
shouldFinalAutoCheck
()
{
return
enableAutoReview
&&
enableFinalReview
;
}
public
boolean
shouldFinalCheck
(
BigDecimal
amount
)
{
return
amount
.
compareTo
(
finalMinimumReviewAmount
)
>
0
;
}
}
}
bailuntec-cost-core/src/main/java/com/blt/other/module/cost/service/CostService.java
View file @
38ea3157
...
@@ -2,6 +2,7 @@ package com.blt.other.module.cost.service;
...
@@ -2,6 +2,7 @@ package com.blt.other.module.cost.service;
import
com.bailuntec.cost.api.dto.CostDto
;
import
com.bailuntec.cost.api.dto.CostDto
;
import
com.bailuntec.cost.api.dto.CostListPrintDto
;
import
com.bailuntec.cost.api.dto.CostListPrintDto
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.blt.other.module.cost.dto.CostApiDto
;
import
com.blt.other.module.cost.dto.CostApiDto
;
import
com.blt.other.module.cost.dto.CostPageResult
;
import
com.blt.other.module.cost.dto.CostPageResult
;
import
com.blt.other.module.cost.model.CostDomain
;
import
com.blt.other.module.cost.model.CostDomain
;
...
@@ -16,7 +17,7 @@ public interface CostService {
...
@@ -16,7 +17,7 @@ public interface CostService {
* @param costDomain cost
* @param costDomain cost
* @return res
* @return res
*/
*/
@Deprecated
//
@Deprecated
Integer
saveNewCost
(
CostDomain
costDomain
);
Integer
saveNewCost
(
CostDomain
costDomain
);
/**
/**
...
@@ -104,6 +105,7 @@ public interface CostService {
...
@@ -104,6 +105,7 @@ public interface CostService {
*/
*/
void
departmentCheck
(
String
costNo
,
Integer
currentUserId
);
void
departmentCheck
(
String
costNo
,
Integer
currentUserId
);
/**
/**
* 财务审核
* 财务审核
*
*
...
@@ -112,6 +114,7 @@ public interface CostService {
...
@@ -112,6 +114,7 @@ public interface CostService {
*/
*/
void
financialCheck
(
String
costNo
,
Integer
currentUserId
);
void
financialCheck
(
String
costNo
,
Integer
currentUserId
);
/**
/**
* 最终审核
* 最终审核
*
*
...
@@ -119,4 +122,17 @@ public interface CostService {
...
@@ -119,4 +122,17 @@ public interface CostService {
* @param currentUserId 当前用户id
* @param currentUserId 当前用户id
*/
*/
void
finalCheck
(
String
costNo
,
Integer
currentUserId
);
void
finalCheck
(
String
costNo
,
Integer
currentUserId
);
/**
* 审核费用单列表
*
* @param pageSize page
* @param pageNum page
* @param userid 当前用户id
* @param type 1-财务+最终审核 2-部门审核
* @return 费用单列表
*/
IPage
<
CostDto
>
checkCostList
(
Integer
userid
,
Integer
pageNum
,
Integer
pageSize
,
Integer
type
);
}
}
bailuntec-cost-core/src/main/java/com/blt/other/module/cost/service/impl/cost/AbstractCostService.java
View file @
38ea3157
...
@@ -3,6 +3,8 @@ package com.blt.other.module.cost.service.impl.cost;
...
@@ -3,6 +3,8 @@ package com.blt.other.module.cost.service.impl.cost;
import
com.bailuntec.cost.api.dto.CostDto
;
import
com.bailuntec.cost.api.dto.CostDto
;
import
com.bailuntec.cost.api.dto.CostListPrintDto
;
import
com.bailuntec.cost.api.dto.CostListPrintDto
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.blt.other.common.exception.BizRuntimeException
;
import
com.blt.other.common.exception.BizRuntimeException
;
import
com.blt.other.common.util.MoneyUtil
;
import
com.blt.other.common.util.MoneyUtil
;
import
com.blt.other.module.auth.dao.CostReviewerMapper
;
import
com.blt.other.module.auth.dao.CostReviewerMapper
;
...
@@ -18,9 +20,11 @@ import com.blt.other.module.cost.dto.CostApiDto;
...
@@ -18,9 +20,11 @@ import com.blt.other.module.cost.dto.CostApiDto;
import
com.blt.other.module.cost.dto.CostPageResult
;
import
com.blt.other.module.cost.dto.CostPageResult
;
import
com.blt.other.module.cost.model.CostDetailDomain
;
import
com.blt.other.module.cost.model.CostDetailDomain
;
import
com.blt.other.module.cost.model.CostDomain
;
import
com.blt.other.module.cost.model.CostDomain
;
import
com.blt.other.module.cost.model.CostTemplate
;
import
com.blt.other.module.cost.service.CostLogService
;
import
com.blt.other.module.cost.service.CostLogService
;
import
com.blt.other.module.cost.service.CostService
;
import
com.blt.other.module.cost.service.CostService
;
import
com.blt.other.module.cost.service.ICostTemplateService
;
import
com.blt.other.module.cost.service.ICostTemplateService
;
import
com.blt.other.module.database.model.CostCompanyDomain
;
import
com.blt.other.module.database.model.CostLogDomain
;
import
com.blt.other.module.database.model.CostLogDomain
;
import
com.blt.other.module.database.model.CostTypeKindDomain
;
import
com.blt.other.module.database.model.CostTypeKindDomain
;
import
com.blt.other.module.database.model.UserDomain
;
import
com.blt.other.module.database.model.UserDomain
;
...
@@ -107,7 +111,6 @@ public abstract class AbstractCostService implements CostService {
...
@@ -107,7 +111,6 @@ public abstract class AbstractCostService implements CostService {
setCostDomain
(
costDomain
);
setCostDomain
(
costDomain
);
Integer
update
=
costDao
.
update
(
costDomain
);
Integer
update
=
costDao
.
update
(
costDomain
);
String
costNo
=
costDomain
.
getCostNo
();
resp
.
setMsg
(
"success"
);
resp
.
setMsg
(
"success"
);
...
@@ -180,52 +183,112 @@ public abstract class AbstractCostService implements CostService {
...
@@ -180,52 +183,112 @@ public abstract class AbstractCostService implements CostService {
return
printNos
.
stream
().
map
(
this
::
printDto
).
collect
(
Collectors
.
toList
());
return
printNos
.
stream
().
map
(
this
::
printDto
).
collect
(
Collectors
.
toList
());
}
}
@Override
public
void
departmentCheck
(
String
costNo
,
Integer
currentUserId
)
{
CostDomain
costDomain
=
costDao
.
selectByCostNo
(
costNo
);
OaUser
costUser
=
oaUserMapper
.
selectByOaUserId
(
costDomain
.
getCreateUserid
());
//人工审核流程
CostReviewer
costReviewer
=
costReviewerMapper
.
selectOne
(
new
LambdaQueryWrapper
<
CostReviewer
>()
.
eq
(
CostReviewer:
:
getReferId
,
costUser
.
getPrimaryDepartmentId
())
.
eq
(
CostReviewer:
:
getReviewerUserId
,
currentUserId
)
.
eq
(
CostReviewer:
:
getType
,
CostReviewer
.
departmentReviewer
));
if
(
costReviewer
==
null
)
{
@Transactional
throw
new
BizRuntimeException
(
"on authority"
);
@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
);
}
}
costDomain
.
setCostStatus
(
CostDomain
.
STATUS_FINANCIAL_CHECK
);
}
costDao
.
updateById
(
costDomain
);
//流转状态
costSubscribe
.
subscribe
(
costDomain
);
costLogService
.
save
(
costNo
,
currentUserId
,
"审核费用单"
,
CostLogDomain
.
MANUAL_CHECK
);
}
@Transactional
@Override
@Override
public
void
financialCheck
(
String
costNo
,
Integer
currentUserId
)
{
public
void
financialCheck
(
String
costNo
,
Integer
currentUserId
)
{
CostDomain
costDomain
=
costDao
.
selectByCostNo
(
costNo
);
CostDomain
costDomain
=
costDao
.
selectByCostNo
(
costNo
);
OaUser
costUser
=
oaUserMapper
.
selectByOaUserId
(
costDomain
.
getCreateUserid
());
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
)
{
CostReviewer
costReviewer
=
costReviewerMapper
.
selectOne
(
new
LambdaQueryWrapper
<
CostReviewer
>()
.
eq
(
CostReviewer:
:
getReferId
,
costUser
.
getPrimaryDepartmentId
())
.
eq
(
CostReviewer:
:
getReviewerUserId
,
currentUserId
)
.
eq
(
CostReviewer:
:
getType
,
CostReviewer
.
financialReviewer
));
if
(
costReviewer
==
null
)
{
CostDomain
costDomain
=
costDao
.
selectByCostNo
(
costNo
);
throw
new
BizRuntimeException
(
"on authority"
);
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
);
}
}
costDomain
.
setCostStatus
(
CostDomain
.
STATUS_FINAL_CHECK
);
//人工审核没权限
costDao
.
updateById
(
costDomain
);
else
{
//流转状态
throw
new
BizRuntimeException
(
"current user no authority"
);
costSubscribe
.
subscribe
(
costDomain
);
}
costLogService
.
save
(
costNo
,
currentUserId
,
"审核费用单"
,
CostLogDomain
.
MANUAL_CHECK
);
}
@Transactional
@Override
public
IPage
<
CostDto
>
checkCostList
(
Integer
userid
,
Integer
pageNum
,
Integer
pageSize
,
Integer
type
)
{
IPage
<
CostDomain
>
page
=
new
Page
<>(
pageNum
,
pageSize
);
LambdaQueryWrapper
<
CostDomain
>
wrapper
=
new
LambdaQueryWrapper
<>();
UserDomain
userDomain
=
userService
.
findByUserid
(
userid
);
//财务或者管理员
if
(
userDomain
.
getIsadmin
()
!=
0
||
userDomain
.
getIsfinansys
()
!=
0
)
{
wrapper
.
in
(
CostDomain:
:
getCompanyValue
,
Lists
.
newArrayList
(
userDomain
.
getAuthority
().
split
(
","
)));
}
else
{
wrapper
.
eq
(
CostDomain:
:
getCreateUserid
,
userid
);
}
//财务 最终审核
if
(
type
==
1
)
{
wrapper
.
in
(
CostDomain:
:
getCostStatus
,
CostDomain
.
STATUS_FINAL_CHECK
,
CostDomain
.
STATUS_DEPARTMENT_CHECK
);
}
//部门审核
else
if
(
type
==
2
)
{
wrapper
.
in
(
CostDomain:
:
getCostStatus
,
CostDomain
.
STATUS_DEPARTMENT_CHECK
);
}
else
{
log
.
warn
(
"invalid type"
);
}
return
costDao
.
selectPage
(
page
,
wrapper
).
convert
(
CostDomain:
:
castToDto
);
}
}
...
...
bailuntec-cost-core/src/main/java/com/blt/other/module/cost/service/impl/cost/CostSubscribe.java
View file @
38ea3157
package
com
.
blt
.
other
.
module
.
cost
.
service
.
impl
.
cost
;
package
com
.
blt
.
other
.
module
.
cost
.
service
.
impl
.
cost
;
import
com.blt.other.module.cost.model.CostDomain
;
import
com.blt.other.module.cost.service.impl.costcheck.CostContext
;
import
com.blt.other.module.cost.service.CostService
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.context.annotation.ComponentScan
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.scheduling.annotation.EnableAsync
;
import
org.springframework.scheduling.annotation.EnableAsync
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
...
@@ -24,24 +22,7 @@ public class CostSubscribe {
...
@@ -24,24 +22,7 @@ public class CostSubscribe {
@Async
@Async
public
void
subscribe
(
CostDomain
costDomain
)
{
public
void
subscribe
(
CostContext
costContext
)
{
costContext
.
nexState
();
CostService
costService
=
CostServiceFactory
.
getCostService
(
costDomain
);
switch
(
costDomain
.
getCostStatus
())
{
//如果是待部门审核 就提交部门审核
case
CostDomain
.
STATUS_DEPARTMENT_CHECK
:
costService
.
departmentCheck
(
costDomain
.
getCostNo
(),
-
1
);
break
;
//如果是待财务审核 就提交部门审核
case
CostDomain
.
STATUS_FINANCIAL_CHECK
:
costService
.
financialCheck
(
costDomain
.
getCostNo
(),
-
1
);
break
;
//如果是待最终审核 就提交部门审核
case
CostDomain
.
STATUS_FINAL_CHECK
:
costService
.
finalCheck
(
costDomain
.
getCostNo
(),
-
1
);
break
;
default
:
log
.
error
(
"invalid cost status"
);
}
}
}
}
}
bailuntec-cost-core/src/main/java/com/blt/other/module/cost/service/impl/costcheck/CostContext.java
0 → 100644
View file @
38ea3157
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
* @since 2020/10/30 2:52 下午
*/
public
class
CostContext
{
public
void
setCostState
(
CostState
costState
)
{
this
.
costState
=
costState
;
this
.
costState
.
setCostContext
(
this
);
}
protected
CostState
costState
;
protected
CostService
costService
;
protected
CostDomain
costDomain
;
protected
Integer
currentUserId
;
public
CostContext
(
String
costNo
,
Integer
currentUserId
)
{
this
.
costService
=
CostServiceFactory
.
getCostService
(
costNo
);
this
.
currentUserId
=
currentUserId
;
this
.
costDomain
=
SpringContextUtil
.
getBean
(
CostDao
.
class
).
selectByCostNo
(
costNo
);
}
public
void
nexState
()
{
costState
.
handle
();
}
public
void
refuse
()
{
costState
.
refuse
();
}
}
bailuntec-cost-core/src/main/java/com/blt/other/module/cost/service/impl/costcheck/CostState.java
0 → 100644
View file @
38ea3157
package
com
.
blt
.
other
.
module
.
cost
.
service
.
impl
.
costcheck
;
import
com.blt.other.module.auth.dao.CostReviewerMapper
;
import
com.blt.other.module.auth.dao.OaUserMapper
;
import
com.blt.other.module.cost.dao.CostDao
;
import
com.blt.other.module.cost.model.CostDomain
;
import
com.blt.other.module.cost.model.CostTemplate
;
import
com.blt.other.module.cost.service.CostLogService
;
import
com.blt.other.module.cost.service.ICostTemplateService
;
import
com.blt.other.module.cost.service.impl.cost.CostSubscribe
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
java.util.List
;
import
java.util.stream.Collectors
;
/**
* <p>
*
* </p>
*
* @author robbendev
* @since 2020/10/30 2:18 下午
*/
public
abstract
class
CostState
{
@Autowired
CostDao
costDao
;
@Autowired
CostLogService
costLogService
;
@Autowired
ICostTemplateService
costTemplateService
;
@Autowired
OaUserMapper
oaUserMapper
;
@Autowired
CostReviewerMapper
costReviewerMapper
;
@Autowired
CostSubscribe
costSubscribe
;
//0 待提交 1- 待财务审核 2待出纳付款 3被驳回 4已支付 5已作废 6-待部门审核 7-待财务审核 8-待最终审核人审核
protected
CostContext
costContext
;
/**
* 是否通过所有模版自动校验
*
* @param costDomain ost
* @return res
*/
boolean
autoCheck
(
CostDomain
costDomain
)
{
CostTemplate
costTemplate
=
costTemplateService
.
queryDetail
(
costDomain
.
getCostTemplateId
());
//是否通过所有模版自动校验
List
<
Boolean
>
ruleChecks
=
costTemplate
.
getCostTemplateColList
()
.
stream
()
.
map
(
costTemplateCol
->
costTemplateCol
.
ruleCheck
(
costDomain
))
.
collect
(
Collectors
.
toList
());
return
!
ruleChecks
.
contains
(
false
);
}
public
CostContext
getCostContext
()
{
return
costContext
;
}
public
void
setCostContext
(
CostContext
costContext
)
{
this
.
costContext
=
costContext
;
}
void
nextState
(
CostState
costState
)
{
//清空审核上下文的审核人
costContext
.
currentUserId
=
null
;
//并且流转到下一个状态
costContext
.
setCostState
(
costState
);
}
public
abstract
void
handle
();
public
abstract
void
refuse
();
}
bailuntec-cost-core/src/main/java/com/blt/other/module/cost/service/impl/costcheck/DepartmentCheckState.java
0 → 100644
View file @
38ea3157
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.auth.model.OaUser
;
import
com.blt.other.module.cost.model.CostDomain
;
import
com.blt.other.module.cost.model.CostTemplate
;
import
com.blt.other.module.database.model.CostLogDomain
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
/**
* <p>
*
* </p>
*
* @author robbendev
* @since 2020/10/30 2:57 下午
*/
@Component
public
class
DepartmentCheckState
extends
CostState
{
@Autowired
FinancialCheckState
financialCheckState
;
@Override
public
void
handle
()
{
CostDomain
costDomain
=
costContext
.
costDomain
;
Integer
currentUserId
=
costContext
.
currentUserId
;
CostTemplate
costTemplate
=
costTemplateService
.
queryDetail
(
costDomain
.
getCostTemplateId
());
//需要自动审核
if
(
costTemplate
.
shouldDepartmentAutoCheck
())
{
//自动审核通过
if
(
autoCheck
(
costDomain
))
{
costDomain
.
setCostStatus
(
CostDomain
.
STATUS_FINANCIAL_CHECK
);
costDao
.
updateById
(
costDomain
);
costLogService
.
save
(
costDomain
.
getCostNo
(),
currentUserId
,
"部门自动审核通过"
,
CostLogDomain
.
AUTO_CHECK
);
//流转状态
nextState
(
financialCheckState
);
costSubscribe
.
subscribe
(
costContext
);
return
;
}
}
//人工审核
OaUser
costUser
=
oaUserMapper
.
selectByOaUserId
(
costDomain
.
getCreateUserid
());
//人工审核通过
if
(
costReviewerMapper
.
queryOne
(
costUser
.
getPrimaryDepartmentId
(),
CostReviewer
.
departmentReviewer
,
currentUserId
)
!=
null
)
{
costDomain
.
setCostStatus
(
CostDomain
.
STATUS_FINANCIAL_CHECK
);
costDao
.
updateById
(
costDomain
);
costLogService
.
save
(
costDomain
.
getCostNo
(),
currentUserId
,
"部门审核通过"
,
CostLogDomain
.
MANUAL_CHECK
);
nextState
(
financialCheckState
);
//发布到总线尝试审核
costSubscribe
.
subscribe
(
costContext
);
}
//人工审核没权限
else
{
throw
new
BizRuntimeException
(
"current user no authority"
);
}
}
@Override
public
void
refuse
()
{
}
}
bailuntec-cost-core/src/main/java/com/blt/other/module/cost/service/impl/costcheck/FinalCheckState.java
0 → 100644
View file @
38ea3157
package
com
.
blt
.
other
.
module
.
cost
.
service
.
impl
.
costcheck
;
import
org.springframework.stereotype.Component
;
/**
* <p>
*
* </p>
*
* @author robbendev
* @since 2020/10/30 2:57 下午
*/
public
class
FinalCheckState
extends
CostState
{
@Override
public
void
handle
()
{
}
@Override
public
void
refuse
()
{
}
}
bailuntec-cost-core/src/main/java/com/blt/other/module/cost/service/impl/costcheck/FinancialCheckState.java
0 → 100644
View file @
38ea3157
package
com
.
blt
.
other
.
module
.
cost
.
service
.
impl
.
costcheck
;
import
org.springframework.stereotype.Component
;
/**
* <p>
*
* </p>
*
* @author robbendev
* @since 2020/10/30 2:57 下午
*/
@Component
public
class
FinancialCheckState
extends
CostState
{
@Override
public
void
handle
()
{
}
@Override
public
void
refuse
()
{
}
}
bailuntec-cost-core/src/main/java/com/blt/other/module/cost/service/impl/costcheck/PayedState.java
0 → 100644
View file @
38ea3157
package
com
.
blt
.
other
.
module
.
cost
.
service
.
impl
.
costcheck
;
import
org.springframework.stereotype.Component
;
/**
* <p>
*
* </p>
*
* @author robbendev
* @since 2020/10/30 2:57 下午
*/
public
class
PayedState
extends
CostState
{
@Override
public
void
handle
()
{
}
@Override
public
void
refuse
()
{
}
}
bailuntec-cost-core/src/main/java/com/blt/other/module/cost/service/impl/costcheck/RefuseState.java
0 → 100644
View file @
38ea3157
package
com
.
blt
.
other
.
module
.
cost
.
service
.
impl
.
costcheck
;
import
org.springframework.stereotype.Component
;
/**
* <p>
*
* </p>
*
* @author robbendev
* @since 2020/10/30 2:57 下午
*/
public
class
RefuseState
extends
CostState
{
@Override
public
void
handle
()
{
}
@Override
public
void
refuse
()
{
}
}
bailuntec-cost-core/src/main/java/com/blt/other/module/cost/service/impl/costcheck/UnPayState.java
0 → 100644
View file @
38ea3157
package
com
.
blt
.
other
.
module
.
cost
.
service
.
impl
.
costcheck
;
import
org.springframework.stereotype.Component
;
/**
* <p>
*
* </p>
*
* @author robbendev
* @since 2020/10/30 2:57 下午
*/
public
class
UnPayState
extends
CostState
{
@Override
public
void
handle
()
{
}
@Override
public
void
refuse
()
{
}
}
bailuntec-cost-core/src/main/java/com/blt/other/module/cost/service/impl/costcheck/UnSubmitState.java
0 → 100644
View file @
38ea3157
package
com
.
blt
.
other
.
module
.
cost
.
service
.
impl
.
costcheck
;
import
com.blt.other.common.exception.BizRuntimeException
;
import
com.blt.other.module.cost.model.CostDomain
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
org.springframework.transaction.annotation.Transactional
;
/**
* <p>
*
* </p>
*
* @author robbendev
* @since 2020/10/30 2:57 下午
*/
@Component
public
class
UnSubmitState
extends
CostState
{
@Autowired
DepartmentCheckState
departmentCheckState
;
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Override
public
void
handle
()
{
CostDomain
costDomain
=
costContext
.
costDomain
;
//校验费用单状态 和 当前处理用户
if
(
costDomain
.
getCostStatus
()
!=
CostDomain
.
STATUS_UN_SUBMIT
||
!
costDomain
.
getCreateUserid
().
equals
(
costContext
.
currentUserId
))
{
throw
new
BizRuntimeException
(
"invalid status"
);
}
//更新费用单
costDomain
.
setCostStatus
(
1
);
costDao
.
updateById
(
costDomain
);
costLogService
.
save
(
costDomain
.
getCostNo
(),
costContext
.
currentUserId
,
"提交费用单"
);
//清空审核上下文的审核人
costContext
.
currentUserId
=
null
;
//并且流转到下一个状态
costContext
.
setCostState
(
departmentCheckState
);
//尝试审核(由于清空了审核人,这里只会走自动审核)
costContext
.
nexState
();
}
@Override
public
void
refuse
()
{
}
}
bailuntec-cost-core/src/main/java/com/blt/other/module/cost/vo/ApplyCallbackUrlVo.java
View file @
38ea3157
package
com
.
blt
.
other
.
module
.
cost
.
vo
;
package
com
.
blt
.
other
.
module
.
cost
.
vo
;
import
lombok.Data
;
@Data
public
class
ApplyCallbackUrlVo
{
public
class
ApplyCallbackUrlVo
{
private
ApplyCallbackUrlDataVo
data
;
private
ApplyCallbackUrlDataVo
data
;
private
String
id
;
private
String
id
;
public
ApplyCallbackUrlDataVo
getData
()
{
return
data
;
}
public
void
setData
(
ApplyCallbackUrlDataVo
data
)
{
this
.
data
=
data
;
}
public
String
getId
()
{
return
id
;
}
public
void
setId
(
String
id
)
{
this
.
id
=
id
;
}
@Override
public
String
toString
()
{
return
"ApplyCallbackUrlVo{"
+
"data="
+
data
+
", id='"
+
id
+
'\''
+
'}'
;
}
}
}
bailuntec-cost-core/src/main/java/com/blt/other/module/cost/vo/ApplyCallbackVo.java
View file @
38ea3157
package
com
.
blt
.
other
.
module
.
cost
.
vo
;
package
com
.
blt
.
other
.
module
.
cost
.
vo
;
import
lombok.Data
;
@Data
public
class
ApplyCallbackVo
{
public
class
ApplyCallbackVo
{
private
boolean
success
;
private
boolean
success
;
...
...
bailuntec-cost-core/src/main/resources/mapper/auth/CostReviewerMapper.xml
View file @
38ea3157
...
@@ -2,4 +2,13 @@
...
@@ -2,4 +2,13 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.blt.other.module.auth.dao.CostReviewerMapper"
>
<mapper
namespace=
"com.blt.other.module.auth.dao.CostReviewerMapper"
>
<select
id=
"queryOne"
resultType=
"com.blt.other.module.auth.model.CostReviewer"
>
select *
from cost_reviewer
where refer_id = #{referId}
and type = #{type}
and reviewer_user_id = #{reviewerUserId}
limit 1
</select>
</mapper>
</mapper>
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