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
21b54e71
Commit
21b54e71
authored
Aug 30, 2022
by
Licx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
其他绩效上传,返回错误内容
parent
f2f5ee46
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
26 deletions
+40
-26
performance/Performance.Api/Controllers/EmployeeController.cs
+3
-1
performance/Performance.Services/EmployeeService.cs
+37
-25
No files found.
performance/Performance.Api/Controllers/EmployeeController.cs
View file @
21b54e71
...
...
@@ -471,7 +471,9 @@ public ApiResponse Import([FromForm] IFormCollection form)
return
new
ApiResponse
(
ResponseType
.
Fail
,
$"
{
file
.
FileName
}
上传失败"
);
}
var
result
=
employeeService
.
ImpoerAprEmployees
(
allotid
,
path
,
claim
.
GetUserId
());
return
result
==
""
?
new
ApiResponse
(
ResponseType
.
OK
)
:
new
ApiResponse
(
ResponseType
.
ParameterError
,
result
);
return
result
!=
null
&&
result
.
Any
()
?
new
ApiResponse
(
ResponseType
.
OK
)
:
new
ApiResponse
(
ResponseType
.
WarningTable
,
result
);
}
/// <summary>
...
...
performance/Performance.Services/EmployeeService.cs
View file @
21b54e71
...
...
@@ -640,11 +640,13 @@ public ApiResponse AprMark(int userid, AprAmountMarkRequest request)
/// <param name="allotid"></param>
/// <param name="path"></param>
/// <param name="userid"></param>
public
string
ImpoerAprEmployees
(
int
allotid
,
string
path
,
int
userid
)
public
List
<
Dictionary
<
string
,
string
>>
ImpoerAprEmployees
(
int
allotid
,
string
path
,
int
userid
)
{
var
userrole
=
userroleRepository
.
GetEntity
(
t
=>
t
.
UserID
==
userid
);
if
(
userrole
==
null
)
throw
new
PerformanceException
(
"用户未绑定角色"
);
List
<
Dictionary
<
string
,
string
>>
errors
=
new
List
<
Dictionary
<
string
,
string
>>();
var
typeIn
=
GetTypeInDepartment
(
userid
);
try
{
...
...
@@ -655,7 +657,7 @@ public string ImpoerAprEmployees(int allotid, string path, int userid)
{
workbook
=
version
==
ExcelVersion
.
xlsx
?
new
XSSFWorkbook
(
fs
)
:
new
HSSFWorkbook
(
fs
);
}
if
(
workbook
==
null
)
return
""
;
if
(
workbook
==
null
)
return
errors
;
var
sheet
=
workbook
.
GetSheetAt
(
0
);
var
firstRow
=
sheet
.
GetRow
(
0
);
...
...
@@ -703,34 +705,44 @@ public string ImpoerAprEmployees(int allotid, string path, int userid)
CreateDate
=
createtime
,
CreateUser
=
userid
,
};
entities
.
Add
(
entity
);
}
//var numbers = entities.Select(t => t.PersonnelNumber).Except(employees.Select(w => w.PersonnelNumber));
//if (numbers?.Count() > 0 && numbers?.Count() <= 5)
// return $@"以下工号在字典中不存在:{JsonHelper.Serialize(numbers.ToArray())}";
//else if (numbers?.Count() > 5)
// return $@"以下工号在字典中不存在:{JsonHelper.Serialize(numbers.Take(5)).Replace("]", ",...]")}";
if
(
string
.
IsNullOrEmpty
(
entity
.
DoctorName
)
||
string
.
IsNullOrEmpty
(
entity
.
PersonnelNumber
))
errors
.
Add
(
new
Dictionary
<
string
,
string
>
{
{
"行号"
,
$"第
{
rowindex
}
行"
},
{
"人员工号"
,
entity
.
PersonnelNumber
},
{
"姓名"
,
entity
.
DoctorName
},
{
"来源"
,
"上传文件"
},
{
"错误原因"
,
"“关键信息缺失”请补全或删除"
},
});
var
employee
=
employees
.
FirstOrDefault
(
w
=>
w
.
PersonnelNumber
==
entity
.
PersonnelNumber
);
if
(
employee
==
null
)
errors
.
Add
(
new
Dictionary
<
string
,
string
>
{
{
"行号"
,
$"第
{
rowindex
}
行"
},
{
"人员工号"
,
entity
.
PersonnelNumber
},
{
"姓名"
,
entity
.
DoctorName
},
{
"来源"
,
"上传文件"
},
{
"错误原因"
,
"“人员工号”错误,请修改或删除"
},
});
else
if
(
employee
.
DoctorName
!=
entity
.
DoctorName
)
errors
.
Add
(
new
Dictionary
<
string
,
string
>
{
{
"行号"
,
$"第
{
rowindex
}
行"
},
{
"人员工号"
,
entity
.
PersonnelNumber
},
{
"姓名"
,
entity
.
DoctorName
},
{
"来源"
,
"上传文件"
},
{
"错误原因"
,
"“姓名”错误,请修改或删除"
},
});
entities
.
Add
(
entity
);
}
// 补充核算单元
if
(
entities
.
Any
())
{
if
(
entities
.
Any
(
w
=>
string
.
IsNullOrEmpty
(
w
.
PersonnelNumber
)
&&
w
.
Amount
!=
0
))
throw
new
PerformanceException
(
"文件中存在“工号”为空的数据"
);
if
(
entities
.
Any
(
w
=>
string
.
IsNullOrEmpty
(
w
.
PerforType
)
&&
w
.
Amount
!=
0
))
throw
new
PerformanceException
(
"文件中存在“绩效类型”为空的数据"
);
//if (entities.Any(w => string.IsNullOrEmpty(w.TypeInDepartment) && w.Amount != 0))
// throw new PerformanceException("文件中存在“录入科室”为空的数据");
//var employees = peremployeeRepository.GetEntities(w => w.AllotId == allotid);
//foreach (var item in entities.Where(w => !string.IsNullOrEmpty(w.PersonnelNumber)))
//{
// item.AccountingUnit = employees?.FirstOrDefault(w => w.PersonnelNumber == item.PersonnelNumber)?.AccountingUnit ?? "";
//}
perapramountRepository
.
AddRange
(
entities
.
ToArray
());
}
return
""
;
return
errors
;
}
catch
(
PerformanceException
ex
)
{
...
...
@@ -739,7 +751,7 @@ public string ImpoerAprEmployees(int allotid, string path, int userid)
catch
(
Exception
ex
)
{
logger
.
LogError
(
ex
.
ToString
());
return
"上传失败"
;
return
errors
;
}
}
...
...
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