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
832d9371
Commit
832d9371
authored
Apr 28, 2021
by
黄奎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
页面修改
parent
faddee3b
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
261 additions
and
13 deletions
+261
-13
RB_Duty_PlanDetails_ViewModel.cs
Edu.Model/ViewModel/Duty/RB_Duty_PlanDetails_ViewModel.cs
+20
-0
RB_Duty_Plan_ViewModel.cs
Edu.Model/ViewModel/Duty/RB_Duty_Plan_ViewModel.cs
+20
-0
DutyPlanModule.cs
Edu.Module.Duty/DutyPlanModule.cs
+80
-4
RB_Duty_PlanDetailsRepository.cs
Edu.Repository/Duty/RB_Duty_PlanDetailsRepository.cs
+3
-2
RB_Duty_PlanRepository.cs
Edu.Repository/Duty/RB_Duty_PlanRepository.cs
+17
-7
DutyPlanController.cs
Edu.WebApi/Controllers/Duty/DutyPlanController.cs
+120
-0
Edu.WebApi.csproj
Edu.WebApi/Edu.WebApi.csproj
+1
-0
No files found.
Edu.Model/ViewModel/Duty/RB_Duty_PlanDetails_ViewModel.cs
View file @
832d9371
...
...
@@ -14,5 +14,25 @@ namespace Edu.Model.ViewModel.Duty
/// 计划编号【查询使用】
/// </summary>
public
string
QPlanIds
{
get
;
set
;
}
/// <summary>
/// 班次名称
/// </summary>
public
string
ShiftName
{
get
;
set
;
}
/// <summary>
/// 值班开始时间
/// </summary>
public
string
StartTime
{
get
;
set
;
}
/// <summary>
/// 值班结束时间
/// </summary>
public
string
EndTime
{
get
;
set
;
}
/// <summary>
/// 值班人员姓名
/// </summary>
public
string
DutyManName
{
get
;
set
;
}
}
}
Edu.Model/ViewModel/Duty/RB_Duty_Plan_ViewModel.cs
View file @
832d9371
...
...
@@ -14,5 +14,25 @@ namespace Edu.Model.ViewModel.Duty
/// 值班详情
/// </summary>
public
List
<
RB_Duty_PlanDetails_ViewModel
>
PlanDetails
{
get
;
set
;
}
/// <summary>
/// 创建人
/// </summary>
public
string
CreateByName
{
get
;
set
;
}
/// <summary>
/// 修改人
/// </summary>
public
string
UpdateByName
{
get
;
set
;
}
/// <summary>
/// 校区名称
/// </summary>
public
string
SchoolName
{
get
;
set
;
}
/// <summary>
/// 值班人员
/// </summary>
public
int
QDutyMan
{
get
;
set
;
}
}
}
Edu.Module.Duty/DutyPlanModule.cs
View file @
832d9371
using
Edu.Model.ViewModel.Duty
;
using
Edu.Common.Enum
;
using
Edu.Model.ViewModel.Duty
;
using
Edu.Model.ViewModel.User
;
using
Edu.Repository.Duty
;
using
Edu.Repository.User
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
...
...
@@ -24,6 +27,11 @@ namespace Edu.Module.Duty
/// </summary>
private
readonly
RB_Duty_PlanDetailsRepository
duty_PlanDetailsRepository
=
new
RB_Duty_PlanDetailsRepository
();
/// <summary>
/// 账号仓储层对象
/// </summary>
private
readonly
RB_AccountRepository
accountRepository
=
new
RB_AccountRepository
();
/// <summary>
/// 获取值班计划分页列表【管理端】
/// </summary>
...
...
@@ -35,6 +43,19 @@ namespace Edu.Module.Duty
public
List
<
RB_Duty_Plan_ViewModel
>
GetDutyPlanPageModule
(
int
pageIndex
,
int
pageSize
,
out
long
rowsCount
,
RB_Duty_Plan_ViewModel
query
)
{
var
list
=
duty_PlanRepository
.
GetDutyPlanPageRepository
(
pageIndex
,
pageSize
,
out
rowsCount
,
query
);
if
(
list
!=
null
&&
list
.
Count
>
0
)
{
var
ids
=
string
.
Join
(
","
,
list
.
Select
(
qitem
=>
qitem
.
Id
));
List
<
RB_Duty_PlanDetails_ViewModel
>
planDetails
=
new
List
<
RB_Duty_PlanDetails_ViewModel
>();
if
(!
string
.
IsNullOrEmpty
(
ids
))
{
planDetails
=
GetDutyPlanDetailsListModule
(
new
RB_Duty_PlanDetails_ViewModel
()
{
QPlanIds
=
ids
},
IsQueryDutyMan
:
true
);
}
foreach
(
var
item
in
list
)
{
item
.
PlanDetails
=
planDetails
?.
Where
(
qitem
=>
qitem
.
PlanId
==
item
.
Id
)?.
ToList
()
??
new
List
<
RB_Duty_PlanDetails_ViewModel
>();
}
}
return
list
;
}
...
...
@@ -49,6 +70,45 @@ namespace Edu.Module.Duty
public
List
<
RB_Duty_Plan_ViewModel
>
GetMyDutyPlanPageModule
(
int
pageIndex
,
int
pageSize
,
out
long
rowsCount
,
RB_Duty_Plan_ViewModel
query
)
{
var
list
=
duty_PlanRepository
.
GetMyDutyPlanPageRepository
(
pageIndex
,
pageSize
,
out
rowsCount
,
query
);
if
(
list
!=
null
&&
list
.
Count
>
0
)
{
var
ids
=
string
.
Join
(
","
,
list
.
Select
(
qitem
=>
qitem
.
Id
));
List
<
RB_Duty_PlanDetails_ViewModel
>
planDetails
=
new
List
<
RB_Duty_PlanDetails_ViewModel
>();
if
(!
string
.
IsNullOrEmpty
(
ids
))
{
planDetails
=
GetDutyPlanDetailsListModule
(
new
RB_Duty_PlanDetails_ViewModel
()
{
QPlanIds
=
ids
},
IsQueryDutyMan
:
true
);
}
foreach
(
var
item
in
list
)
{
item
.
PlanDetails
=
planDetails
?.
Where
(
qitem
=>
qitem
.
PlanId
==
item
.
Id
)?.
ToList
()
??
new
List
<
RB_Duty_PlanDetails_ViewModel
>();
}
}
return
list
;
}
/// <summary>
/// 获取值班班次详情列表
/// </summary>
/// <param name="query"></param>
/// <param name="IsQueryDutyMan">true-查询人员</param>
/// <returns></returns>
public
List
<
RB_Duty_PlanDetails_ViewModel
>
GetDutyPlanDetailsListModule
(
RB_Duty_PlanDetails_ViewModel
query
,
bool
IsQueryDutyMan
=
false
)
{
var
list
=
duty_PlanDetailsRepository
.
GetDutyPlanDetailsListRepository
(
query
);
if
(
IsQueryDutyMan
&&
list
!=
null
&&
list
.
Count
>
0
)
{
var
ids
=
string
.
Join
(
","
,
list
.
Select
(
qitem
=>
qitem
.
DutyMan
));
List
<
Employee_ViewModel
>
empList
=
new
List
<
Employee_ViewModel
>();
if
(!
string
.
IsNullOrEmpty
(
ids
))
{
empList
=
accountRepository
.
GetEmployeeListRepository
(
new
Model
.
ViewModel
.
User
.
Employee_ViewModel
()
{
QIds
=
ids
});
}
foreach
(
var
item
in
list
)
{
item
.
DutyManName
=
empList
?.
Where
(
qitem
=>
qitem
.
Id
==
item
.
DutyMan
)?.
FirstOrDefault
()?.
EmployeeName
??
""
;
}
}
return
list
;
}
...
...
@@ -65,7 +125,8 @@ namespace Edu.Module.Duty
{
Dictionary
<
string
,
object
>
fileds
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Duty_Plan_ViewModel
.
Date
),
model
.
Date
}
{
nameof
(
RB_Duty_Plan_ViewModel
.
Date
),
model
.
Date
},
{
nameof
(
RB_Duty_Plan_ViewModel
.
School_Id
),
model
.
School_Id
},
};
flag
=
duty_PlanRepository
.
Update
(
fileds
,
new
WhereHelper
(
nameof
(
RB_Duty_Plan_ViewModel
.
Id
),
model
.
Id
));
}
...
...
@@ -77,7 +138,7 @@ namespace Edu.Module.Duty
}
//原班次列表
var
oldPlanDetailsList
=
duty_PlanDetailsRepository
.
GetDutyPlanDetailsListRepository
(
new
RB_Duty_PlanDetails_ViewModel
()
var
oldPlanDetailsList
=
GetDutyPlanDetailsListModule
(
new
RB_Duty_PlanDetails_ViewModel
()
{
PlanId
=
model
.
Id
});
...
...
@@ -135,9 +196,24 @@ namespace Edu.Module.Duty
RB_Duty_Plan_ViewModel
model
=
duty_PlanRepository
.
GetEntity
<
RB_Duty_Plan_ViewModel
>(
Id
);
if
(
model
!=
null
&&
model
.
Id
>
0
)
{
model
.
PlanDetails
=
duty_PlanDetailsRepository
.
GetDutyPlanDetailsListRepository
(
new
RB_Duty_PlanDetails_ViewModel
()
{
PlanId
=
model
.
Id
});
model
.
PlanDetails
=
GetDutyPlanDetailsListModule
(
new
RB_Duty_PlanDetails_ViewModel
()
{
PlanId
=
model
.
Id
});
}
return
model
;
}
/// <summary>
/// 删除值班计划
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
public
bool
RemoveDutyPlanModule
(
int
Id
)
{
Dictionary
<
string
,
object
>
fileds
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Duty_Plan_ViewModel
.
Status
),(
int
)
DateStateEnum
.
Delete
}
};
var
flag
=
duty_PlanRepository
.
Update
(
fileds
,
new
WhereHelper
(
nameof
(
RB_Duty_Plan_ViewModel
.
Id
),
Id
));
return
flag
;
}
}
}
Edu.Repository/Duty/RB_Duty_PlanDetailsRepository.cs
View file @
832d9371
...
...
@@ -21,8 +21,8 @@ namespace Edu.Repository.Duty
{
StringBuilder
builder
=
new
StringBuilder
();
builder
.
AppendFormat
(
@"
SELECT A.*
FROM RB_Duty_PlanDetails AS A
SELECT A.*
,IFNULL(B.Name,'') AS ShiftName,IFNULL(B.StartTime,'') AS StartTime,IFNULL(B.EndTime,'') AS EndTime
FROM RB_Duty_PlanDetails AS A
LEFT JOIN rb_duty_frequency AS B ON A.Shift=B.Id
WHERE 1=1
"
);
if
(
query
==
null
)
...
...
@@ -40,6 +40,7 @@ WHERE 1=1
builder
.
AppendFormat
(
@" AND A.{0} IN({1}) "
,
nameof
(
RB_Duty_PlanDetails_ViewModel
.
PlanId
),
query
.
QPlanIds
);
}
}
builder
.
AppendFormat
(
" ORDER BY B.{0} ASC "
,
nameof
(
RB_Duty_Frequency_ViewModel
.
StartTime
));
return
Get
<
RB_Duty_PlanDetails_ViewModel
>(
builder
.
ToString
()).
ToList
();
}
...
...
Edu.Repository/Duty/RB_Duty_PlanRepository.cs
View file @
832d9371
using
Edu.Model.Entity.Duty
;
using
Edu.Common.Enum
;
using
Edu.Model.Entity.Duty
;
using
Edu.Model.ViewModel.Duty
;
using
System
;
using
System.Collections.Generic
;
...
...
@@ -25,10 +26,11 @@ namespace Edu.Repository.Duty
rowsCount
=
0
;
StringBuilder
builder
=
new
StringBuilder
();
builder
.
AppendFormat
(
@"
SELECT A.*
FROM RB_Duty_Plan AS A
SELECT A.*
,IFNULL(B.SName,'') AS SchoolName
FROM RB_Duty_Plan AS A
LEFT JOIN rb_school AS B ON A.School_Id=B.SId
WHERE 1=1
"
);
builder
.
AppendFormat
(
@" AND A.{0}={1} "
,
nameof
(
RB_Duty_Plan_ViewModel
.
Status
),
(
int
)
DateStateEnum
.
Normal
);
if
(
query
==
null
)
{
return
new
List
<
RB_Duty_Plan_ViewModel
>();
...
...
@@ -39,6 +41,10 @@ WHERE 1=1
{
builder
.
AppendFormat
(
@" AND A.{0}={1} "
,
nameof
(
RB_Duty_Plan_ViewModel
.
Group_Id
),
query
.
Group_Id
);
}
if
(
query
.
School_Id
>
0
)
{
builder
.
AppendFormat
(
@" AND A.{0}={1} "
,
nameof
(
RB_Duty_Plan_ViewModel
.
School_Id
),
query
.
School_Id
);
}
}
return
GetPage
<
RB_Duty_Plan_ViewModel
>(
pageIndex
,
pageSize
,
out
rowsCount
,
builder
.
ToString
()).
ToList
();
}
...
...
@@ -56,9 +62,9 @@ WHERE 1=1
rowsCount
=
0
;
StringBuilder
builder
=
new
StringBuilder
();
builder
.
AppendFormat
(
@"
SELECT A.
*
FROM RB_Duty_Plan AS A
WHERE 1=1
SELECT A.
ID,A.Date
FROM RB_Duty_Plan AS A
INNER JOIN rb_duty_plandetails AS B ON A.Id=B.PlanId
WHERE 1=1
AND A.`Status`=0 AND B.`Status`=0
"
);
if
(
query
==
null
)
{
...
...
@@ -70,8 +76,12 @@ WHERE 1=1
{
builder
.
AppendFormat
(
@" AND A.{0}={1} "
,
nameof
(
RB_Duty_Plan_ViewModel
.
Group_Id
),
query
.
Group_Id
);
}
if
(
query
.
QDutyMan
>
0
)
{
builder
.
AppendFormat
(
@" AND B.{0}={1} "
,
nameof
(
RB_Duty_PlanDetails_ViewModel
.
DutyMan
),
query
.
QDutyMan
);
}
}
builder
.
AppendFormat
(
" GROUP BY A.Id,A.Date "
);
return
GetPage
<
RB_Duty_Plan_ViewModel
>(
pageIndex
,
pageSize
,
out
rowsCount
,
builder
.
ToString
()).
ToList
();
}
}
...
...
Edu.WebApi/Controllers/Duty/DutyPlanController.cs
0 → 100644
View file @
832d9371
using
Edu.Cache.User
;
using
Edu.Common.API
;
using
Edu.Common.Plugin
;
using
Edu.Model.ViewModel.Duty
;
using
Edu.Module.Duty
;
using
Edu.WebApi.Filter
;
using
Microsoft.AspNetCore.Cors
;
using
Microsoft.AspNetCore.Mvc
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Threading.Tasks
;
namespace
Edu.WebApi.Controllers.Duty
{
/// <summary>
/// 值班计划控制器
/// </summary>
[
Route
(
"api/[controller]/[action]"
)]
[
ApiExceptionFilter
]
[
ApiController
]
[
EnableCors
(
"AllowCors"
)]
public
class
DutyPlanController
:
BaseController
{
private
readonly
DutyPlanModule
dutyPlanModule
=
new
DutyPlanModule
();
/// <summary>
/// 获取值班计划分页列表【管理端】
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetDutyPlanPage
()
{
var
pageModel
=
Common
.
Plugin
.
JsonHelper
.
DeserializeObject
<
ResultPageModel
>(
RequestParm
.
Msg
.
ToString
());
var
query
=
new
RB_Duty_Plan_ViewModel
()
{
School_Id
=
base
.
ParmJObj
.
GetInt
(
"School_Id"
)
};
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
);
foreach
(
var
item
in
list
)
{
if
(
item
.
CreateBy
>
0
)
{
item
.
CreateByName
=
UserReidsCache
.
GetUserLoginInfo
(
item
.
CreateBy
)?.
AccountName
??
""
;
}
if
(
item
.
UpdateBy
>
0
)
{
item
.
UpdateByName
=
UserReidsCache
.
GetUserLoginInfo
(
item
.
UpdateBy
)?.
AccountName
??
""
;
}
result
.
Add
(
new
{
item
.
Id
,
PlanDate
=
Common
.
ConvertHelper
.
FormatDate
(
item
.
Date
),
item
.
SchoolName
,
item
.
School_Id
,
PlanDetails
=
item
?.
PlanDetails
?.
Select
(
qitem
=>
new
{
qitem
.
Id
,
qitem
.
PlanId
,
qitem
.
DutyMan
,
qitem
.
DutyManName
,
qitem
.
StartTime
,
qitem
.
EndTime
,
qitem
.
Shift
,
qitem
.
ShiftName
})
});
}
pageModel
.
Count
=
rowsCount
;
pageModel
.
PageData
=
result
;
return
ApiResult
.
Success
(
data
:
pageModel
);
}
/// <summary>
/// 获取我的值班计划分页列表
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetMyDutyPlanPage
()
{
var
pageModel
=
Common
.
Plugin
.
JsonHelper
.
DeserializeObject
<
ResultPageModel
>(
RequestParm
.
Msg
.
ToString
());
var
query
=
new
RB_Duty_Plan_ViewModel
()
{
School_Id
=
base
.
ParmJObj
.
GetInt
(
"School_Id"
)
};
query
.
Group_Id
=
base
.
UserInfo
.
Group_Id
;
List
<
object
>
result
=
new
List
<
object
>();
var
list
=
dutyPlanModule
.
GetMyDutyPlanPageModule
(
pageModel
.
PageIndex
,
pageModel
.
PageSize
,
out
long
rowsCount
,
query
);
foreach
(
var
item
in
list
)
{
if
(
item
.
CreateBy
>
0
)
{
item
.
CreateByName
=
UserReidsCache
.
GetUserLoginInfo
(
item
.
CreateBy
)?.
AccountName
??
""
;
}
if
(
item
.
UpdateBy
>
0
)
{
item
.
UpdateByName
=
UserReidsCache
.
GetUserLoginInfo
(
item
.
UpdateBy
)?.
AccountName
??
""
;
}
if
(
item
.
PlanDetails
!=
null
&&
item
.
PlanDetails
.
Count
>
0
)
{
}
result
.
Add
(
new
{
item
.
Id
,
PlanDate
=
Common
.
ConvertHelper
.
FormatDate
(
item
.
Date
),
item
.
SchoolName
,
item
.
School_Id
,
});
}
pageModel
.
Count
=
rowsCount
;
pageModel
.
PageData
=
result
;
return
ApiResult
.
Success
(
data
:
pageModel
);
}
}
}
Edu.WebApi/Edu.WebApi.csproj
View file @
832d9371
...
...
@@ -32,6 +32,7 @@
<ProjectReference Include="..\Edu.Common\Edu.Common.csproj" />
<ProjectReference Include="..\Edu.Model\Edu.Model.csproj" />
<ProjectReference Include="..\Edu.Module.Course\Edu.Module.Course.csproj" />
<ProjectReference Include="..\Edu.Module.Duty\Edu.Module.Duty.csproj" />
<ProjectReference Include="..\Edu.Module.Finance\Edu.Module.Finance.csproj" />
<ProjectReference Include="..\Edu.Module.OKR\Edu.Module.OKR.csproj" />
<ProjectReference Include="..\Edu.Module.Public\Edu.Module.Public.csproj" />
...
...
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