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
0d34ba67
Commit
0d34ba67
authored
May 06, 2021
by
黄奎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增枚举
parent
b0ba828d
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
153 additions
and
34 deletions
+153
-34
DutyStatusEnum.cs
Edu.Common/Enum/Duty/DutyStatusEnum.cs
+28
-0
RB_Duty_PlanDetails_ViewModel.cs
Edu.Model/ViewModel/Duty/RB_Duty_PlanDetails_ViewModel.cs
+19
-2
RB_Duty_Plan_ViewModel.cs
Edu.Model/ViewModel/Duty/RB_Duty_Plan_ViewModel.cs
+20
-10
DutyPlanModule.cs
Edu.Module.Duty/DutyPlanModule.cs
+42
-10
RB_Duty_ConfigRepository.cs
Edu.Repository/Duty/RB_Duty_ConfigRepository.cs
+1
-1
RB_Duty_PlanRepository.cs
Edu.Repository/Duty/RB_Duty_PlanRepository.cs
+30
-0
DutyController.cs
Edu.WebApi/Controllers/Duty/DutyController.cs
+2
-6
DutyPlanController.cs
Edu.WebApi/Controllers/Duty/DutyPlanController.cs
+11
-5
No files found.
Edu.Common/Enum/Duty/DutyStatusEnum.cs
0 → 100644
View file @
0d34ba67
using
Edu.Common.Plugin
;
namespace
Edu.Common.Enum.Duty
{
/// <summary>
/// 值班状态枚举
/// </summary>
public
enum
DutyStatusEnum
{
/// <summary>
/// 选择
/// </summary>
[
EnumField
(
"未开始"
)]
NoStart
=
0
,
/// <summary>
/// 值班中
/// </summary>
[
EnumField
(
"值班中"
)]
DutyIng
=
1
,
/// <summary>
/// 值班完成
/// </summary>
[
EnumField
(
"值班完成"
)]
DutyFinished
=
2
,
}
}
Edu.Model/ViewModel/Duty/RB_Duty_PlanDetails_ViewModel.cs
View file @
0d34ba67
using
Edu.Model.Entity.Duty
;
using
Edu.Common.Enum.Duty
;
using
Edu.Model.Entity.Duty
;
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
...
...
@@ -50,7 +51,6 @@ namespace Edu.Model.ViewModel.Duty
/// </summary>
public
string
StatusStr
{
get
{
string
str
=
"未开始"
;
...
...
@@ -65,5 +65,22 @@ namespace Edu.Model.ViewModel.Duty
return
str
;
}
}
/// <summary>
/// 值班状态(见枚举)
/// </summary>
public
DutyStatusEnum
DutyStatus
{
get
;
set
;
}
/// <summary>
/// 值班状态字符串
/// </summary>
public
string
DutyStatusStr
{
get
{
string
str
=
Common
.
Plugin
.
EnumHelper
.
ToName
(
this
.
DutyStatus
);
return
str
;
}
}
}
}
Edu.Model/ViewModel/Duty/RB_Duty_Plan_ViewModel.cs
View file @
0d34ba67
using
Edu.Model.Entity.Duty
;
using
Edu.Common.Enum.Duty
;
using
Edu.Model.Entity.Duty
;
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
...
...
@@ -42,9 +43,9 @@ namespace Edu.Model.ViewModel.Duty
/// <summary>
/// 值班状态(
0-未开始,1-值班中,2-值班完成
)
/// 值班状态(
见枚举
)
/// </summary>
public
int
DutyStatus
{
get
;
set
;
}
public
DutyStatusEnum
DutyStatus
{
get
;
set
;
}
/// <summary>
/// 值班状态字符串
...
...
@@ -53,15 +54,24 @@ namespace Edu.Model.ViewModel.Duty
{
get
{
string
str
=
""
;
switch
(
this
.
DutyStatus
)
{
case
0
:
str
=
"未开始"
;
break
;
case
1
:
str
=
"值班中"
;
break
;
case
2
:
str
=
"值班完成"
;
break
;
}
string
str
=
Common
.
Plugin
.
EnumHelper
.
ToName
(
this
.
DutyStatus
);
return
str
;
}
}
/// <summary>
/// 校区查询
/// </summary>
public
List
<
int
>
SchoolIdList
{
get
;
set
;
}
/// <summary>
/// 开始日期
/// </summary>
public
string
QStartDate
{
get
;
set
;
}
/// <summary>
/// 结束日期
/// </summary>
public
string
QEndDate
{
get
;
set
;
}
}
}
Edu.Module.Duty/DutyPlanModule.cs
View file @
0d34ba67
using
Edu.Common.Enum
;
using
Edu.Common.Enum.Duty
;
using
Edu.Common.Message
;
using
Edu.Model.CacheModel
;
using
Edu.Model.ViewModel.Duty
;
...
...
@@ -71,6 +72,40 @@ namespace Edu.Module.Duty
foreach
(
var
item
in
list
)
{
item
.
PlanDetails
=
planDetails
?.
Where
(
qitem
=>
qitem
.
PlanId
==
item
.
Id
)?.
ToList
()
??
new
List
<
RB_Duty_PlanDetails_ViewModel
>();
item
.
DutyStatus
=
0
;
if
(
item
.
PlanDetails
!=
null
&&
item
.
PlanDetails
.
Count
>
0
)
{
foreach
(
var
subItem
in
item
.
PlanDetails
)
{
var
startTime
=
Convert
.
ToDateTime
(
Common
.
ConvertHelper
.
FormatDate
(
item
?.
Date
)
+
" "
+
subItem
?.
StartTime
);
var
endTime
=
Convert
.
ToDateTime
(
Common
.
ConvertHelper
.
FormatDate
(
item
?.
Date
)
+
" "
+
subItem
?.
EndTime
);
if
(
DateTime
.
Now
<
startTime
)
{
subItem
.
DutyStatus
=
DutyStatusEnum
.
NoStart
;
}
else
if
(
startTime
<=
DateTime
.
Now
&&
DateTime
.
Now
<=
endTime
)
{
subItem
.
DutyStatus
=
DutyStatusEnum
.
DutyIng
;
}
else
{
subItem
.
DutyStatus
=
DutyStatusEnum
.
DutyFinished
;
}
}
if
(
item
.
PlanDetails
.
Where
(
qitem
=>
qitem
.
DutyStatus
==
DutyStatusEnum
.
NoStart
).
Count
()
==
item
.
PlanDetails
.
Count
)
{
item
.
DutyStatus
=
DutyStatusEnum
.
NoStart
;
}
else
if
(
item
.
PlanDetails
.
Where
(
qitem
=>
qitem
.
DutyStatus
==
DutyStatusEnum
.
DutyFinished
).
Count
()
==
item
.
PlanDetails
.
Count
)
{
item
.
DutyStatus
=
DutyStatusEnum
.
DutyFinished
;
}
else
{
item
.
DutyStatus
=
DutyStatusEnum
.
DutyIng
;
}
}
}
}
return
list
;
...
...
@@ -403,24 +438,21 @@ namespace Edu.Module.Duty
nextModel
=
model
.
PlanDetails
[
nextIndex
];
}
}
int
DutyStatus
=
0
;
string
DutyStatusStr
=
"未开始"
;
//值班状态
DutyStatusEnum
dutyStatusEnum
=
DutyStatusEnum
.
NoStart
;
var
startTime
=
Convert
.
ToDateTime
(
Common
.
ConvertHelper
.
FormatDate
(
model
?.
Date
)
+
" "
+
currentModel
?.
StartTime
);
var
endTime
=
Convert
.
ToDateTime
(
Common
.
ConvertHelper
.
FormatDate
(
model
?.
Date
)
+
" "
+
currentModel
?.
EndTime
);
if
(
DateTime
.
Now
<
startTime
)
{
DutyStatus
=
0
;
DutyStatusStr
=
"未开始"
;
dutyStatusEnum
=
DutyStatusEnum
.
NoStart
;
}
else
if
(
startTime
<=
DateTime
.
Now
&&
DateTime
.
Now
<=
endTime
)
{
DutyStatus
=
1
;
DutyStatusStr
=
"值班中"
;
dutyStatusEnum
=
DutyStatusEnum
.
DutyIng
;
}
else
{
DutyStatus
=
2
;
DutyStatusStr
=
"值班结束"
;
dutyStatusEnum
=
DutyStatusEnum
.
DutyFinished
;
}
var
PlanList
=
currentModel
?.
DutyItemList
??
new
List
<
RB_Duty_Item_ViewModel
>();
List
<
object
>
pList
=
new
List
<
object
>();
...
...
@@ -459,8 +491,8 @@ namespace Edu.Module.Duty
HandoverList
=
contentList
?.
Where
(
qitem
=>
qitem
.
PlanType
==
2
)?.
ToList
()
??
new
List
<
RB_Duty_Content_ViewModel
>(),
ReciveMan
=
nextModel
?.
DutyManName
??
""
,
GiveMan
=
previousModel
?.
DutyManName
??
""
,
DutyStatus
,
DutyStatusStr
,
DutyStatus
=
(
int
)
dutyStatusEnum
,
DutyStatusStr
=
Common
.
Plugin
.
EnumHelper
.
ToName
(
dutyStatusEnum
)
,
};
return
result
;
}
...
...
Edu.Repository/Duty/RB_Duty_ConfigRepository.cs
View file @
0d34ba67
...
...
@@ -127,7 +127,7 @@ namespace Edu.Repository.Duty
{
builder
.
AppendFormat
(
" AND A.{0}<>{1} "
,
nameof
(
RB_Duty_Config_ViewModel
.
Id
),
query
.
Id
);
}
if
(
query
.
School_Id
>
0
)
if
(
query
.
School_Id
>
=
0
)
{
builder
.
AppendFormat
(
" AND A.{0}={1} "
,
nameof
(
RB_Duty_Config_ViewModel
.
School_Id
),
query
.
School_Id
);
}
...
...
Edu.Repository/Duty/RB_Duty_PlanRepository.cs
View file @
0d34ba67
...
...
@@ -45,6 +45,36 @@ WHERE 1=1
{
builder
.
AppendFormat
(
@" AND A.{0}={1} "
,
nameof
(
RB_Duty_Plan_ViewModel
.
School_Id
),
query
.
School_Id
);
}
if
(
query
.
SchoolIdList
!=
null
&&
query
.
SchoolIdList
.
Count
>
0
)
{
string
str
=
""
;
if
(
query
.
SchoolIdList
!=
null
&&
query
.
SchoolIdList
.
Count
>
0
)
{
for
(
var
i
=
0
;
i
<
query
.
SchoolIdList
.
Count
;
i
++)
{
if
(
i
==
0
)
{
str
+=
string
.
Format
(
" FIND_IN_SET('{0}', A.School_Id)>0 "
,
query
.
SchoolIdList
[
i
]);
}
else
{
str
+=
string
.
Format
(
" OR FIND_IN_SET('{0}', A.School_Id)>0 "
,
query
.
SchoolIdList
[
i
]);
}
}
}
if
(!
string
.
IsNullOrEmpty
(
str
))
{
builder
.
AppendFormat
(
" AND ({0}) "
,
str
);
}
}
if
(!
string
.
IsNullOrEmpty
(
query
.
QStartDate
))
{
builder
.
AppendFormat
(
@" AND A.{0}>='{1}' "
,
nameof
(
RB_Duty_Plan_ViewModel
.
Date
),
query
.
QStartDate
);
}
if
(!
string
.
IsNullOrEmpty
(
query
.
QEndDate
))
{
builder
.
AppendFormat
(
@" AND A.{0}<='{1} 23:59:59' "
,
nameof
(
RB_Duty_Plan_ViewModel
.
Date
),
query
.
QEndDate
);
}
}
builder
.
AppendFormat
(
@" ORDER BY A.{0} ASC "
,
nameof
(
RB_Duty_Plan_ViewModel
.
Date
));
return
GetPage
<
RB_Duty_Plan_ViewModel
>(
pageIndex
,
pageSize
,
out
rowsCount
,
builder
.
ToString
()).
ToList
();
...
...
Edu.WebApi/Controllers/Duty/DutyController.cs
View file @
0d34ba67
...
...
@@ -423,10 +423,6 @@ namespace Edu.WebApi.Controllers.Duty
{
return
ApiResult
.
Failed
(
"请选择班次"
);
}
if
(
query
.
School_Id
==
0
)
{
return
ApiResult
.
Failed
(
"请选择学校"
);
}
if
(
string
.
IsNullOrWhiteSpace
(
query
.
MachineCode
))
{
return
ApiResult
.
Failed
(
"请输入值班机器码"
);
...
...
@@ -445,10 +441,10 @@ namespace Edu.WebApi.Controllers.Duty
query
.
UpdateTime
=
System
.
DateTime
.
Now
;
if
(
dutyModule
.
CheckDutyConfigModule
(
query
))
{
ApiResult
.
Failed
(
"已经存在该校区的配置数据!"
);
return
ApiResult
.
Failed
(
"已经存在该校区的配置数据!"
);
}
bool
retult
=
dutyModule
.
SetDutyConfigModule
(
query
);
return
retult
?
ApiResult
.
Success
(
"
新增/修改值班设置成功"
)
:
ApiResult
.
Failed
(
"新增/修改
值班设置失败"
);
return
retult
?
ApiResult
.
Success
(
"
值班设置成功"
)
:
ApiResult
.
Failed
(
"
值班设置失败"
);
}
/// <summary>
...
...
Edu.WebApi/Controllers/Duty/DutyPlanController.cs
View file @
0d34ba67
...
...
@@ -34,8 +34,10 @@ namespace Edu.WebApi.Controllers.Duty
var
pageModel
=
Common
.
Plugin
.
JsonHelper
.
DeserializeObject
<
ResultPageModel
>(
RequestParm
.
Msg
.
ToString
());
var
query
=
new
RB_Duty_Plan_ViewModel
()
{
School_Id
=
base
.
ParmJObj
.
GetInt
(
"School_Id"
)
QStartDate
=
base
.
ParmJObj
.
GetStringValue
(
"StartDate"
),
QEndDate
=
base
.
ParmJObj
.
GetStringValue
(
"EndDate"
),
};
query
.
SchoolIdList
=
Common
.
Plugin
.
JsonHelper
.
DeserializeObject
<
List
<
int
>>(
base
.
ParmJObj
.
GetStringValue
(
"School_Ids"
));
query
.
Group_Id
=
base
.
UserInfo
.
Group_Id
;
List
<
object
>
result
=
new
List
<
object
>();
var
list
=
dutyPlanModule
.
GetDutyPlanPageModule
(
pageModel
.
PageIndex
,
pageModel
.
PageSize
,
out
long
rowsCount
,
query
);
...
...
@@ -55,6 +57,8 @@ namespace Edu.WebApi.Controllers.Duty
PlanDate
=
Common
.
ConvertHelper
.
FormatDate
(
item
.
Date
),
item
.
SchoolName
,
item
.
School_Id
,
item
.
DutyStatus
,
item
.
DutyStatusStr
,
PlanDetails
=
item
?.
PlanDetails
?.
Select
(
qitem
=>
new
{
qitem
.
Id
,
...
...
@@ -64,7 +68,9 @@ namespace Edu.WebApi.Controllers.Duty
qitem
.
StartTime
,
qitem
.
EndTime
,
qitem
.
Shift
,
qitem
.
ShiftName
qitem
.
ShiftName
,
qitem
.
DutyStatus
,
qitem
.
DutyStatusStr
,
})
});
}
...
...
@@ -129,15 +135,15 @@ namespace Edu.WebApi.Controllers.Duty
var
dutyEndTime
=
Convert
.
ToDateTime
(
Common
.
ConvertHelper
.
FormatDate
(
item
.
Date
)
+
" "
+
currentModel
.
EndTime
);
if
(
DateTime
.
Now
>
dutyEndTime
)
{
item
.
DutyStatus
=
2
;
item
.
DutyStatus
=
Common
.
Enum
.
Duty
.
DutyStatusEnum
.
DutyFinished
;
}
else
if
(
DateTime
.
Now
>=
dutyStartTime
&&
DateTime
.
Now
<=
dutyEndTime
)
{
item
.
DutyStatus
=
1
;
item
.
DutyStatus
=
Common
.
Enum
.
Duty
.
DutyStatusEnum
.
DutyIng
;
}
else
{
item
.
DutyStatus
=
0
;
item
.
DutyStatus
=
Common
.
Enum
.
Duty
.
DutyStatusEnum
.
NoStart
;
}
result
.
Add
(
new
{
...
...
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