Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
Education
Project
Project
Details
Activity
Releases
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
黄奎
Education
Commits
4635d02f
Commit
4635d02f
authored
Jun 28, 2021
by
黄奎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
页面修改
parent
0f929c1e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
340 additions
and
1 deletion
+340
-1
DutyPlanModule.cs
Edu.Module.Duty/DutyPlanModule.cs
+301
-0
DutyPlanController.cs
Edu.WebApi/Controllers/Duty/DutyPlanController.cs
+39
-1
No files found.
Edu.Module.Duty/DutyPlanModule.cs
View file @
4635d02f
...
...
@@ -752,6 +752,307 @@ namespace Edu.Module.Duty
return
result
;
}
/// <summary>
/// 用户值班
/// </summary>
/// <param name="Id">值班编号</param>
/// <param name="Shift">值班班次</param>
/// <param name="userId">用户信息</param>
/// <param name="isQueryWork">是否查询工作内容-TRUE(查询)</param>
/// <returns></returns>
public
Dictionary
<
string
,
object
>
OnDutyModule_V2
(
int
Id
,
int
Shift
,
int
userId
,
bool
isQueryWork
=
false
)
{
Dictionary
<
string
,
object
>
result
=
new
Dictionary
<
string
,
object
>();
var
model
=
GetMyDutyPlanPageModule
(
1
,
1
,
out
_
,
new
RB_Duty_Plan_ViewModel
()
{
Id
=
Id
,
QDutyMan
=
userId
.
ToString
(),
QShift
=
Shift
})?.
FirstOrDefault
();
if
(
model
==
null
)
{
return
result
;
}
//当前班次
var
currentModel
=
new
RB_Duty_PlanDetails_ViewModel
();
if
(
model
.
PlanDetails
!=
null
&&
model
.
PlanDetails
.
Count
>
0
)
{
//查找当前人员索引
int
currentIndex
=
CalcCurrentDutyManIndexModule_V2
(
model
);
//当前班次
currentModel
=
model
.
PlanDetails
[
currentIndex
];
}
if
(!
isQueryWork
)
{
result
.
Add
(
"Id"
,
model
?.
Id
);
result
.
Add
(
"PlanDate"
,
Common
.
ConvertHelper
.
FormatDate
(
model
?.
Date
));
result
.
Add
(
"WeekDay"
,
Common
.
ConvertHelper
.
GetWeekDay
(
model
?.
Date
));
result
.
Add
(
"CheckTime"
,
currentModel
?.
CheckTimeStr
);
result
.
Add
(
"CheckLateTime"
,
currentModel
?.
CheckLateTime
);
if
(
currentModel
?.
CheckTimeStr
!=
"未打卡"
)
{
result
.
Add
(
"CheckLateTimeStr"
,
(
currentModel
?.
CheckLateTime
>
0
?
string
.
Format
(
"[迟到{0}分钟]"
,
currentModel
.
CheckLateTime
)
:
"[正常]"
));
}
else
{
result
.
Add
(
"CheckLateTimeStr"
,
""
);
}
result
.
Add
(
"FinishTime"
,
currentModel
?.
FinishTimeStr
);
result
.
Add
(
"FinishLateTime"
,
currentModel
?.
FinishLateTime
);
if
(
currentModel
?.
FinishTimeStr
!=
"未打卡"
)
{
result
.
Add
(
"FinishLateTimeStr"
,
(
currentModel
?.
FinishLateTime
>
0
?
string
.
Format
(
"[早退{0}分钟]"
,
currentModel
.
FinishLateTime
)
:
"[正常]"
));
}
else
{
result
.
Add
(
"FinishLateTimeStr"
,
""
);
}
result
.
Add
(
"SchoolName"
,
model
?.
SchoolName
);
result
.
Add
(
"ShiftName"
,
currentModel
?.
ShiftName
);
result
.
Add
(
"StartTime"
,
currentModel
?.
StartTime
);
result
.
Add
(
"EndTime"
,
currentModel
?.
EndTime
);
result
.
Add
(
"DutyManName"
,
currentModel
?.
DutyManName
);
result
.
Add
(
"DutyManIcon"
,
currentModel
?.
DutyManIcon
);
result
.
Add
(
"Status"
,
currentModel
?.
Status
);
result
.
Add
(
"StatusStr"
,
currentModel
?.
StatusStr
);
result
.
Add
(
"DutyMan"
,
currentModel
?.
DutyMan
);
}
else
{
var
dutyItemList
=
duty_ItemRepository
.
GetDutyItemListRepository
(
new
RB_Duty_Item_ViewModel
()
{
ItemSchools
=
model
.
School_Id
.
ToString
(),
Shifts
=
currentModel
.
Shift
.
ToString
(),
});
var
PlanList
=
dutyItemList
??
new
List
<
RB_Duty_Item_ViewModel
>();
//获取所有的值班内容
var
contentList
=
duty_ContentRepository
.
GetDutyContentListRepository
(
new
RB_Duty_Content_ViewModel
()
{
PlanId
=
model
.
Id
});
List
<
Employee_ViewModel
>
empList
=
new
List
<
Employee_ViewModel
>();
if
(
contentList
!=
null
)
{
string
accountIdStr
=
string
.
Join
(
","
,
contentList
.
Select
(
qitem
=>
qitem
.
CreateBy
));
if
(!
string
.
IsNullOrEmpty
(
accountIdStr
))
{
empList
=
accountRepository
.
GetEmployeeListRepository
(
new
Model
.
ViewModel
.
User
.
Employee_ViewModel
()
{
QIds
=
accountIdStr
});
}
}
foreach
(
var
item
in
contentList
)
{
if
(!
string
.
IsNullOrEmpty
(
item
.
FileURL
))
{
try
{
item
.
FileList
=
Common
.
Plugin
.
JsonHelper
.
DeserializeObject
<
List
<
string
>>(
item
.
FileURL
);
}
catch
(
Exception
ex
)
{
Common
.
Plugin
.
LogHelper
.
Write
(
ex
,
"OnDutyModule_FileList"
);
}
}
}
List
<
object
>
pList
=
new
List
<
object
>();
var
currentPlanContetList
=
contentList
.
Where
(
qitem
=>
qitem
.
PlanShift
==
Shift
&&
qitem
.
PlanType
==
1
&&
qitem
.
CreateBy
==
userId
)?.
ToList
();
if
(
currentPlanContetList
==
null
||
(
currentPlanContetList
!=
null
&&
currentPlanContetList
.
Count
==
0
))
{
foreach
(
var
dayItem
in
dutyItemList
.
Where
(
qitem
=>
qitem
.
DutyCategory
==
1
&&
qitem
.
DutyType
==
2
))
{
duty_ContentRepository
.
Insert
(
new
Model
.
Entity
.
Duty
.
RB_Duty_Content
()
{
CreateBy
=
userId
,
CreateTime
=
DateTime
.
Now
,
FileURL
=
""
,
Group_Id
=
model
.
Group_Id
,
Id
=
0
,
ItemId
=
dayItem
.
Id
,
OtherContent
=
""
,
OtherRemark
=
""
,
PlanId
=
model
.
Id
,
PlanShift
=
Shift
,
PlanType
=
1
,
Status
=
DateStateEnum
.
Normal
,
UpdateBy
=
userId
,
UpdateTime
=
DateTime
.
Now
,
WorkContent
=
""
,
WorkIsFinish
=
0
,
ItemType
=
(
int
)
dayItem
.
ItemType
});
}
contentList
=
duty_ContentRepository
.
GetDutyContentListRepository
(
new
RB_Duty_Content_ViewModel
()
{
PlanId
=
model
.
Id
});
currentPlanContetList
=
contentList
.
Where
(
qitem
=>
qitem
.
PlanShift
==
Shift
&&
qitem
.
PlanType
==
1
)?.
ToList
();
}
if
(
currentModel
.
Status
==
DutyStatusEnum
.
DutyFinished
)
{
foreach
(
var
item
in
currentPlanContetList
.
Where
(
qitem
=>
qitem
.
CreateBy
==
userId
))
{
var
c_itemModel
=
dutyItemList
?.
Where
(
qitem
=>
qitem
.
Id
==
item
.
ItemId
)?.
FirstOrDefault
();
if
(
c_itemModel
!=
null
)
{
var
itemType
=
c_itemModel
.
ItemType
;
int
workIsFinish
=
0
;
if
(
itemType
==
ItemTypeEnum
.
FillIn
)
{
if
(!
string
.
IsNullOrEmpty
(
item
?.
WorkContent
))
{
workIsFinish
=
1
;
}
}
else
{
workIsFinish
=
item
?.
WorkIsFinish
??
0
;
}
List
<
string
>
ItemImgList
=
new
List
<
string
>();
if
(!
string
.
IsNullOrEmpty
(
c_itemModel
.
ItemImg
))
{
ItemImgList
=
Common
.
Plugin
.
JsonHelper
.
DeserializeObject
<
List
<
string
>>(
c_itemModel
.
ItemImg
);
}
var
pObj
=
new
{
Id
=
item
?.
Id
??
0
,
item
?.
ItemId
,
ItemName
=
c_itemModel
?.
ItemName
??
""
,
ItemType
=
c_itemModel
?.
ItemType
??
ItemTypeEnum
.
FillIn
,
IsChecked
=
workIsFinish
,
WorkContent
=
item
?.
WorkContent
??
""
,
item
.
FileList
,
ItemImgList
};
pList
.
Add
(
pObj
);
}
}
}
else
{
foreach
(
var
item
in
PlanList
)
{
var
c_workModel
=
currentPlanContetList
?.
Where
(
qitem
=>
qitem
.
ItemId
==
item
.
Id
&&
qitem
.
CreateBy
==
userId
)?.
FirstOrDefault
();
var
itemType
=
item
.
ItemType
;
int
workIsFinish
=
0
;
if
(
itemType
==
ItemTypeEnum
.
FillIn
)
{
if
(!
string
.
IsNullOrEmpty
(
c_workModel
?.
WorkContent
))
{
workIsFinish
=
1
;
}
}
else
{
workIsFinish
=
c_workModel
?.
WorkIsFinish
??
0
;
}
List
<
string
>
ItemImgList
=
new
List
<
string
>();
if
(!
string
.
IsNullOrEmpty
(
item
.
ItemImg
))
{
ItemImgList
=
Common
.
Plugin
.
JsonHelper
.
DeserializeObject
<
List
<
string
>>(
item
.
ItemImg
);
}
var
pObj
=
new
{
Id
=
c_workModel
?.
Id
??
0
,
ItemId
=
item
.
Id
,
item
.
ItemName
,
item
.
ItemType
,
IsChecked
=
workIsFinish
,
WorkContent
=
c_workModel
?.
WorkContent
??
""
,
ItemImgList
,
c_workModel
?.
FileList
};
pList
.
Add
(
pObj
);
}
}
result
.
Add
(
"WorkList"
,
pList
);
result
.
Add
(
"WorkRuleList"
,
dutyItemList
.
Where
(
qitem
=>
qitem
.
DutyCategory
==
1
&&
qitem
.
DutyType
==
1
).
Select
(
qitem
=>
new
{
qitem
.
Id
,
qitem
.
ItemImgList
,
qitem
.
ItemName
}));
//突发事项列表
List
<
object
>
EmergenciesList
=
new
List
<
object
>();
foreach
(
var
item
in
model
.
PlanDetails
)
{
if
(
item
.
Id
!=
currentModel
.
Id
)
{
var
tempEmergenciesList
=
contentList
?.
Where
(
qitem
=>
qitem
.
PlanType
==
3
&&
qitem
.
PlanId
==
item
.
PlanId
&&
qitem
.
PlanShift
==
item
.
Shift
&&
qitem
.
CreateBy
!=
userId
)?.
ToList
()
??
new
List
<
RB_Duty_Content_ViewModel
>();
if
(
tempEmergenciesList
!=
null
&&
tempEmergenciesList
.
Count
>
0
)
{
tempEmergenciesList
.
ForEach
(
item
=>
item
.
IsOperate
=
0
);
foreach
(
var
subItem
in
tempEmergenciesList
)
{
subItem
.
IsOperate
=
0
;
subItem
.
CreateByName
=
empList
?.
Where
(
qitem
=>
qitem
.
Id
==
subItem
.
CreateBy
)?.
FirstOrDefault
()?.
EmployeeName
??
""
;
}
EmergenciesList
.
AddRange
(
tempEmergenciesList
);
}
}
else
{
var
tempEmergenciesList
=
contentList
?.
Where
(
qitem
=>
qitem
.
PlanType
==
3
&&
qitem
.
PlanId
==
item
.
PlanId
&&
qitem
.
PlanShift
==
item
.
Shift
&&
qitem
.
CreateBy
==
userId
)?.
ToList
()
??
new
List
<
RB_Duty_Content_ViewModel
>();
if
(
tempEmergenciesList
!=
null
&&
tempEmergenciesList
.
Count
>
0
)
{
foreach
(
var
subItem
in
tempEmergenciesList
)
{
subItem
.
IsOperate
=
1
;
subItem
.
CreateByName
=
empList
?.
Where
(
qitem
=>
qitem
.
Id
==
subItem
.
CreateBy
)?.
FirstOrDefault
()?.
EmployeeName
??
""
;
}
EmergenciesList
.
AddRange
(
tempEmergenciesList
);
}
}
}
result
.
Add
(
"EmergenciesList"
,
EmergenciesList
);
result
.
Add
(
"EmergenciesRuleList"
,
dutyItemList
.
Where
(
qitem
=>
qitem
.
DutyCategory
==
2
&&
qitem
.
DutyType
==
1
).
Select
(
qitem
=>
new
{
qitem
.
Id
,
qitem
.
ItemImgList
,
qitem
.
ItemName
}));
//交接事项
List
<
object
>
HandoverList
=
new
List
<
object
>();
foreach
(
var
item
in
model
.
PlanDetails
)
{
if
(
item
.
Id
!=
currentModel
.
Id
)
{
if
(
item
.
Status
==
DutyStatusEnum
.
DutyFinished
)
{
var
tempHandOverList
=
contentList
?.
Where
(
qitem
=>
qitem
.
PlanType
==
2
&&
qitem
.
PlanId
==
item
.
PlanId
&&
qitem
.
PlanShift
==
item
.
Shift
&&
qitem
.
CreateBy
!=
userId
)?.
ToList
()
??
new
List
<
RB_Duty_Content_ViewModel
>();
if
(
tempHandOverList
!=
null
&&
tempHandOverList
.
Count
>
0
)
{
foreach
(
var
subItem
in
tempHandOverList
)
{
subItem
.
IsOperate
=
0
;
subItem
.
CreateByName
=
empList
?.
Where
(
qitem
=>
qitem
.
Id
==
subItem
.
CreateBy
)?.
FirstOrDefault
()?.
EmployeeName
??
""
;
}
HandoverList
.
AddRange
(
tempHandOverList
);
}
}
}
else
{
var
tempHandOverList
=
contentList
?.
Where
(
qitem
=>
qitem
.
PlanType
==
2
&&
qitem
.
PlanId
==
item
.
PlanId
&&
qitem
.
PlanShift
==
item
.
Shift
&&
qitem
.
CreateBy
==
userId
)?.
ToList
()
??
new
List
<
RB_Duty_Content_ViewModel
>();
if
(
tempHandOverList
!=
null
&&
tempHandOverList
.
Count
>
0
)
{
foreach
(
var
subItem
in
tempHandOverList
)
{
subItem
.
IsOperate
=
1
;
subItem
.
CreateByName
=
empList
?.
Where
(
qitem
=>
qitem
.
Id
==
subItem
.
CreateBy
)?.
FirstOrDefault
()?.
EmployeeName
??
""
;
}
HandoverList
.
AddRange
(
tempHandOverList
);
}
}
}
result
.
Add
(
"HandoverList"
,
HandoverList
);
result
.
Add
(
"HandoverRuleList"
,
dutyItemList
.
Where
(
qitem
=>
qitem
.
DutyCategory
==
3
&&
qitem
.
DutyType
==
1
).
Select
(
qitem
=>
new
{
qitem
.
Id
,
qitem
.
ItemImgList
,
qitem
.
ItemName
}));
}
return
result
;
}
/// <summary>
/// 计算当前值班人员索引
/// </summary>
...
...
Edu.WebApi/Controllers/Duty/DutyPlanController.cs
View file @
4635d02f
...
...
@@ -283,7 +283,45 @@ namespace Edu.WebApi.Controllers.Duty
{
UserId
=
DutyMan
;
}
var
obj
=
dutyPlanModule
.
OnDutyModule
(
Id
,
Shift
,
UserId
,
isQueryWork
:
true
);
var
obj
=
dutyPlanModule
.
OnDutyModule
(
Id
,
Shift
,
UserId
,
isQueryWork
:
true
);
return
ApiResult
.
Success
(
data
:
obj
);
}
/// <summary>
/// 用户值班【第二版】
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
OnDuty_V2
()
{
var
Id
=
base
.
ParmJObj
.
GetInt
(
"Id"
);
var
Shift
=
base
.
ParmJObj
.
GetInt
(
"Shift"
);
int
UserId
=
base
.
UserInfo
.
Id
;
int
DutyMan
=
base
.
ParmJObj
.
GetInt
(
"DutyMan"
);
if
(
DutyMan
>
0
)
{
UserId
=
DutyMan
;
}
var
obj
=
dutyPlanModule
.
OnDutyModule_V2
(
Id
,
Shift
,
UserId
);
return
ApiResult
.
Success
(
data
:
obj
);
}
/// <summary>
/// 用户值班【第二版】
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetDutyWork_V2
()
{
var
Id
=
base
.
ParmJObj
.
GetInt
(
"Id"
);
var
Shift
=
base
.
ParmJObj
.
GetInt
(
"Shift"
);
int
UserId
=
base
.
UserInfo
.
Id
;
int
DutyMan
=
base
.
ParmJObj
.
GetInt
(
"DutyMan"
);
if
(
DutyMan
>
0
)
{
UserId
=
DutyMan
;
}
var
obj
=
dutyPlanModule
.
OnDutyModule_V2
(
Id
,
Shift
,
UserId
,
isQueryWork
:
true
);
return
ApiResult
.
Success
(
data
:
obj
);
}
...
...
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