Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
performance
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zry
performance
Commits
e119d335
Commit
e119d335
authored
Jun 09, 2021
by
lcx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
申请划拨、申请划拨信息修改
parent
1482949b
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
293 additions
and
3 deletions
+293
-3
performance/Performance.DtoModels/Request/CostTransferItemRequest.cs
+1
-1
performance/Performance.DtoModels/Request/CostTransferRequest.cs
+11
-1
performance/Performance.EntityModels/Entity/cost_transfer.cs
+1
-1
performance/Performance.EntityModels/Entity/cost_transfer_item.cs
+5
-0
performance/Performance.Repository/Repository/PerforCosttransferRepository.cs
+19
-0
performance/Performance.Repository/Repository/PerforCosttransferitemRepository.cs
+19
-0
performance/Performance.Services/CostTransfer/CostTransferService.cs
+237
-0
No files found.
performance/Performance.DtoModels/Request/CostTransferItemRequest.cs
View file @
e119d335
...
...
@@ -16,7 +16,7 @@ public class CostTransferItemRequest
public
decimal
?
CalculationAmount
{
get
;
set
;
}
public
bool
IsUseRatio
{
get
;
set
;
}
public
int
IsUseRatio
{
get
;
set
;
}
public
string
Remark
{
get
;
set
;
}
}
...
...
performance/Performance.DtoModels/Request/CostTransferRequest.cs
View file @
e119d335
using
System
;
using
Performance.EntityModels
;
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
...
...
@@ -6,6 +7,8 @@ namespace Performance.DtoModels
{
public
class
CostTransferRequest
{
public
int
AllotId
{
get
;
set
;
}
public
Department
Applicant
{
get
;
set
;
}
public
Department
Adopted
{
get
;
set
;
}
...
...
@@ -19,4 +22,11 @@ public class Department
public
string
AccountingUnit
{
get
;
set
;
}
}
public
class
CostTransferUpdateRequest
:
CostTransferRequest
{
public
int
TransferId
{
get
;
set
;
}
public
new
List
<
cost_transfer_item
>
Items
{
get
;
set
;
}
}
}
performance/Performance.EntityModels/Entity/cost_transfer.cs
View file @
e119d335
...
...
@@ -46,7 +46,7 @@ public class cost_transfer
public
string
AdoptedAccountingUnit
{
get
;
set
;
}
/// <summary>
/// 0 未审核 1 部分审核 2 全部审核
/// 0 未审核 1 部分审核 2 全部审核
3 未含有划拨明细
/// </summary>
public
int
Status
{
get
;
set
;
}
}
...
...
performance/Performance.EntityModels/Entity/cost_transfer_item.cs
View file @
e119d335
...
...
@@ -60,5 +60,10 @@ public class cost_transfer_item
/// 备注
/// </summary>
public
string
Remark
{
get
;
set
;
}
/// <summary>
/// 0 默认 1 通过 2 驳回 3 下发驳回
/// </summary>
public
int
Status
{
get
;
set
;
}
}
}
performance/Performance.Repository/Repository/PerforCosttransferRepository.cs
0 → 100644
View file @
e119d335
//-----------------------------------------------------------------------
// <copyright file=" cost_transfer.cs">
// * FileName: cost_transfer.cs
// </copyright>
//-----------------------------------------------------------------------
using
Performance.EntityModels
;
namespace
Performance.Repository
{
/// <summary>
/// cost_transfer Repository
/// </summary>
public
partial
class
PerforCosttransferRepository
:
PerforRepository
<
cost_transfer
>
{
public
PerforCosttransferRepository
(
PerformanceDbContext
context
)
:
base
(
context
)
{
}
}
}
performance/Performance.Repository/Repository/PerforCosttransferitemRepository.cs
0 → 100644
View file @
e119d335
//-----------------------------------------------------------------------
// <copyright file=" cost_transfer_item.cs">
// * FileName: cost_transfer_item.cs
// </copyright>
//-----------------------------------------------------------------------
using
Performance.EntityModels
;
namespace
Performance.Repository
{
/// <summary>
/// cost_transfer_item Repository
/// </summary>
public
partial
class
PerforCosttransferitemRepository
:
PerforRepository
<
cost_transfer_item
>
{
public
PerforCosttransferitemRepository
(
PerformanceDbContext
context
)
:
base
(
context
)
{
}
}
}
performance/Performance.Services/CostTransfer/CostTransferService.cs
0 → 100644
View file @
e119d335
using
Microsoft.EntityFrameworkCore.Internal
;
using
Microsoft.Extensions.Logging
;
using
Performance.DtoModels
;
using
Performance.EntityModels
;
using
Performance.Repository
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
namespace
Performance.Services
{
public
class
CostTransferService
:
IAutoInjection
{
private
readonly
ILogger
<
CostTransferService
>
logger
;
private
readonly
PerforCosttransferRepository
costtransferRepository
;
private
readonly
PerforCosttransferitemRepository
costtransferitemRepository
;
public
CostTransferService
(
ILogger
<
CostTransferService
>
logger
,
PerforCosttransferRepository
costtransferRepository
,
PerforCosttransferitemRepository
costtransferitemRepository
)
{
this
.
logger
=
logger
;
this
.
costtransferRepository
=
costtransferRepository
;
this
.
costtransferitemRepository
=
costtransferitemRepository
;
}
/// <summary>
/// 申请划拨
/// </summary>
public
bool
Applicat
(
CostTransferRequest
request
)
{
if
(
request
.
AllotId
==
0
)
throw
new
PerformanceException
(
"参数错误,绩效记录不存在"
);
if
(
request
.
Applicant
==
null
||
request
.
Adopted
==
null
)
throw
new
PerformanceException
(
"参数错误,申请/被划拨科室信息缺失"
);
if
(
string
.
IsNullOrEmpty
(
request
.
Applicant
.
UnitType
)
||
string
.
IsNullOrEmpty
(
request
.
Applicant
.
AccountingUnit
))
throw
new
PerformanceException
(
"参数错误,申请科室信息缺失"
);
if
(
string
.
IsNullOrEmpty
(
request
.
Adopted
.
UnitType
)
||
string
.
IsNullOrEmpty
(
request
.
Adopted
.
AccountingUnit
))
throw
new
PerformanceException
(
"参数错误,被划拨科室信息缺失"
);
var
transfer
=
new
cost_transfer
{
AllotId
=
request
.
AllotId
,
ApplicantAccountingUnit
=
request
.
Applicant
.
AccountingUnit
,
ApplicantUnitType
=
request
.
Applicant
.
UnitType
,
AdoptedAccountingUnit
=
request
.
Adopted
.
AccountingUnit
,
AdoptedUnitType
=
request
.
Adopted
.
UnitType
,
Status
=
(
request
.
Items
!=
null
&&
request
.
Items
.
Any
())
?
0
:
3
};
var
result
=
costtransferRepository
.
Add
(
transfer
);
if
(!
result
)
throw
new
PerformanceException
(
"提交申请失败,请重试"
);
if
(
request
.
Items
==
null
||
!
request
.
Items
.
Any
())
return
result
;
var
items
=
request
.
Items
.
Select
(
t
=>
new
cost_transfer_item
{
TransferId
=
transfer
.
Id
,
Source
=
t
.
Source
,
Category
=
t
.
Source
,
Amount
=
t
.
Amount
,
Ratio
=
t
.
Ratio
,
CalculationAmount
=
t
.
CalculationAmount
,
IsUseRatio
=
t
.
IsUseRatio
,
Remark
=
t
.
Remark
,
Status
=
0
}).
ToArray
();
result
=
costtransferitemRepository
.
AddRange
(
items
);
if
(!
result
)
costtransferRepository
.
Remove
(
transfer
);
return
result
;
}
/// <summary>
/// 申请划拨信息修改
/// </summary>
public
void
UpdateApplicat
(
CostTransferUpdateRequest
request
)
{
var
transfer
=
costtransferRepository
.
GetEntity
(
t
=>
t
.
Id
==
request
.
TransferId
);
if
(
transfer
==
null
)
throw
new
PerformanceException
(
"划拨申请记录不存在"
);
transfer
.
AllotId
=
request
.
AllotId
;
transfer
.
ApplicantAccountingUnit
=
request
.
Applicant
.
AccountingUnit
;
transfer
.
ApplicantUnitType
=
request
.
Applicant
.
UnitType
;
transfer
.
AdoptedAccountingUnit
=
request
.
Adopted
.
AccountingUnit
;
transfer
.
AdoptedUnitType
=
request
.
Adopted
.
UnitType
;
var
result
=
costtransferRepository
.
Update
(
transfer
);
if
(!
result
)
throw
new
PerformanceException
(
"修改划拨申请记录失败"
);
var
items
=
costtransferitemRepository
.
GetEntities
(
t
=>
t
.
TransferId
==
request
.
TransferId
);
if
(
items
==
null
)
{
if
(
request
.
Items
!=
null
&&
request
.
Items
.
Any
())
{
request
.
Items
.
ForEach
(
t
=>
{
t
.
Id
=
0
;
t
.
TransferId
=
request
.
TransferId
;
t
.
Status
=
0
;
});
costtransferitemRepository
.
AddRange
(
request
.
Items
.
ToArray
());
}
}
else
{
if
(
request
.
Items
==
null
||
!
request
.
Items
.
Any
())
costtransferitemRepository
.
RemoveRange
(
items
.
ToArray
());
else
{
if
(
request
.
Items
.
Any
(
t
=>
t
.
Id
>
0
))
{
var
hasPrimaryValueItmes
=
request
.
Items
.
Where
(
t
=>
t
.
Id
>
0
).
ToList
();
// 删除
var
notExistItems
=
items
.
Where
(
item
=>
!
hasPrimaryValueItmes
.
Select
(
t
=>
t
.
Id
).
Contains
(
item
.
Id
));
if
(
notExistItems
!=
null
&&
notExistItems
.
Any
())
costtransferitemRepository
.
RemoveRange
(
notExistItems
.
ToArray
());
// 更新
var
updateItems
=
items
.
Where
(
item
=>
hasPrimaryValueItmes
.
Select
(
t
=>
t
.
Id
).
Contains
(
item
.
Id
));
foreach
(
var
update
in
updateItems
)
{
var
item
=
hasPrimaryValueItmes
.
FirstOrDefault
(
t
=>
t
.
Id
==
update
.
Id
);
update
.
Source
=
item
.
Source
;
update
.
Category
=
item
.
Source
;
update
.
Amount
=
item
.
Amount
;
update
.
Ratio
=
item
.
Ratio
;
update
.
CalculationAmount
=
item
.
CalculationAmount
;
update
.
IsUseRatio
=
item
.
IsUseRatio
;
update
.
Remark
=
item
.
Remark
;
hasPrimaryValueItmes
.
Remove
(
item
);
}
costtransferitemRepository
.
UpdateRange
(
updateItems
.
ToArray
());
// 添加
if
(
hasPrimaryValueItmes
!=
null
&&
hasPrimaryValueItmes
.
Any
())
{
hasPrimaryValueItmes
.
ForEach
(
t
=>
{
t
.
Id
=
0
;
t
.
TransferId
=
request
.
TransferId
;
t
.
Status
=
0
;
});
costtransferitemRepository
.
AddRange
(
hasPrimaryValueItmes
.
ToArray
());
}
}
if
(
request
.
Items
.
Any
(
t
=>
t
.
Id
==
0
))
// 添加
{
costtransferitemRepository
.
AddRange
(
request
.
Items
.
Where
(
t
=>
t
.
Id
==
0
).
ToArray
());
}
}
}
UpdateCostTransferStatus
(
request
.
TransferId
);
}
/// <summary>
/// 删除划拨申请记录
/// </summary>
public
void
DeleteApplicat
()
{
}
/// <summary>
/// 划拨审核
/// </summary>
public
void
CostTransferAudit
()
{
}
/// <summary>
/// 下发驳回
/// </summary>
public
bool
RejectedApplicat
()
{
return
false
;
}
/// <summary>
/// 修改申请记录的状态
/// </summary>
/// <param name="transferId"></param>
public
void
UpdateCostTransferStatus
(
int
transferId
)
{
try
{
var
transfer
=
costtransferRepository
.
GetEntity
(
t
=>
t
.
Id
==
transferId
);
if
(
transfer
==
null
)
return
;
var
items
=
costtransferitemRepository
.
GetEntities
(
t
=>
t
.
TransferId
==
transferId
);
switch
(
items
)
{
case
var
data
when
data
==
null
||
!
data
.
Any
():
transfer
.
Status
=
3
;
break
;
case
var
data
when
!
data
.
Any
(
t
=>
t
.
Status
==
0
):
transfer
.
Status
=
2
;
break
;
case
var
data
when
data
.
Any
(
t
=>
t
.
Status
==
0
)
&&
data
.
Any
(
t
=>
t
.
Status
!=
0
):
transfer
.
Status
=
1
;
break
;
case
var
data
when
!
data
.
Any
(
t
=>
t
.
Status
!=
0
):
transfer
.
Status
=
0
;
break
;
default
:
break
;
}
costtransferRepository
.
Update
(
transfer
);
}
catch
(
Exception
ex
)
{
logger
.
LogError
(
$"修改申请记录的状态异常:
{
ex
}
"
);
}
}
}
}
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