Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mall.oytour.com
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
黄奎
mall.oytour.com
Commits
c9edb1ab
Commit
c9edb1ab
authored
Apr 11, 2022
by
黄奎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
页面修改
parent
ba5aa3de
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
95 additions
and
12 deletions
+95
-12
AppletEducationController.cs
...WebApi/Controllers/Education/AppletEducationController.cs
+95
-12
No files found.
Mall.WebApi/Controllers/Education/AppletEducationController.cs
View file @
c9edb1ab
...
...
@@ -1138,11 +1138,60 @@ namespace Mall.WebApi.Controllers.Education
/// <param name="request"></param>
/// <returns></returns>
[
HttpPost
]
[
AllowAnonymous
]
public
ApiResult
SetGuestSurvey
()
{
JObject
jObj
=
JObject
.
Parse
(
RequestParm
.
msg
.
ToString
());
var
userInfo
=
AppletUserInfo
;
List
<
Rb_Survey_Extend
>
modelSurvey
=
JsonConvert
.
DeserializeObject
<
List
<
Rb_Survey_Extend
>>(
RequestParm
.
msg
.
ToString
());
var
userInfo
=
new
AppletUserInfo
();
if
(
base
.
AppletUserInfo
!=
null
)
{
userInfo
=
base
.
AppletUserInfo
;
}
else
{
userInfo
=
new
AppletUserInfo
()
{
TenantId
=
RequestParm
.
TenantId
,
MallBaseId
=
RequestParm
.
MallBaseId
,
EduStudentId
=
RequestParm
.
EduStudentId
,
};
}
List
<
Rb_Survey_Extend
>
modelSurvey
=
new
List
<
Rb_Survey_Extend
>();
string
baseListStr
=
jObj
.
GetStringValue
(
"BaseList"
);
if
(!
string
.
IsNullOrEmpty
(
baseListStr
))
{
modelSurvey
.
AddRange
(
JsonHelper
.
DeserializeObject
<
List
<
Rb_Survey_Extend
>>(
baseListStr
));
}
string
courseArrangementListStr
=
jObj
.
GetStringValue
(
"CourseArrangementList"
);
if
(!
string
.
IsNullOrEmpty
(
courseArrangementListStr
))
{
modelSurvey
.
AddRange
(
JsonHelper
.
DeserializeObject
<
List
<
Rb_Survey_Extend
>>(
courseArrangementListStr
));
}
string
learningEnvironmentListStr
=
jObj
.
GetStringValue
(
"LearningEnvironmentList"
);
if
(!
string
.
IsNullOrEmpty
(
learningEnvironmentListStr
))
{
modelSurvey
.
AddRange
(
JsonHelper
.
DeserializeObject
<
List
<
Rb_Survey_Extend
>>(
learningEnvironmentListStr
));
}
string
opinionandsuggestionListStr
=
jObj
.
GetStringValue
(
"OpinionandsuggestionList"
);
if
(!
string
.
IsNullOrEmpty
(
opinionandsuggestionListStr
))
{
modelSurvey
.
AddRange
(
JsonHelper
.
DeserializeObject
<
List
<
Rb_Survey_Extend
>>(
opinionandsuggestionListStr
));
}
string
teachersSituationListStr
=
jObj
.
GetStringValue
(
"TeachersSituationList"
);
if
(!
string
.
IsNullOrEmpty
(
teachersSituationListStr
))
{
modelSurvey
.
AddRange
(
JsonHelper
.
DeserializeObject
<
List
<
Rb_Survey_Extend
>>(
teachersSituationListStr
));
}
string
teachingAssistantListStr
=
jObj
.
GetStringValue
(
"TeachingAssistantList"
);
if
(!
string
.
IsNullOrEmpty
(
teachingAssistantListStr
))
{
modelSurvey
.
AddRange
(
JsonHelper
.
DeserializeObject
<
List
<
Rb_Survey_Extend
>>(
teachingAssistantListStr
));
}
if
(
modelSurvey
==
null
||
!
modelSurvey
.
Any
())
{
...
...
@@ -1150,7 +1199,7 @@ namespace Mall.WebApi.Controllers.Education
}
Rb_GuestSurvey_Extend
model
=
new
Rb_GuestSurvey_Extend
()
{
UserType
=
jObj
.
GetInt
(
"UserType"
),
UserType
=
jObj
.
GetInt
(
"UserType"
),
};
if
((
modelSurvey
.
FirstOrDefault
()?.
ActivitySurveyId
??
0
)
==
0
)
{
...
...
@@ -1169,7 +1218,7 @@ namespace Mall.WebApi.Controllers.Education
ActivitySurveyId
=
modelSurvey
.
FirstOrDefault
()?.
ActivitySurveyId
??
0
,
TenantId
=
userInfo
.
TenantId
,
MallBaseId
=
userInfo
.
MallBaseId
,
UserType
=
model
.
UserType
,
UserType
=
model
.
UserType
,
});
if
(
activeSurueyModel
.
StartDate
.
HasValue
&&
activeSurueyModel
.
EndDate
.
HasValue
)
...
...
@@ -1183,13 +1232,24 @@ namespace Mall.WebApi.Controllers.Education
return
ApiResult
.
Failed
(
"问卷调查活动已结束"
);
}
}
if
(
GuestSurvey
.
Where
(
x
=>
x
.
UserId
==
userInfo
.
UserId
).
Count
()
>
0
)
if
(
base
.
AppletUserInfo
!=
null
)
{
return
ApiResult
.
Failed
(
"请勿重复参与问卷调查"
);
if
(
GuestSurvey
.
Where
(
x
=>
x
.
UserId
==
userInfo
.
UserId
&&
x
.
UserType
==
1
).
Count
()
>
0
)
{
return
ApiResult
.
Failed
(
"请勿重复参与问卷调查"
);
}
model
.
UserId
=
userInfo
.
UserId
;
}
else
{
if
(
GuestSurvey
.
Where
(
x
=>
x
.
UserId
==
userInfo
.
EduStudentId
&&
x
.
UserType
==
2
).
Count
()
>
0
)
{
return
ApiResult
.
Failed
(
"请勿重复参与问卷调查"
);
}
model
.
UserId
=
userInfo
.
EduStudentId
;
}
model
.
UserId
=
userInfo
.
UserId
;
model
.
TenantId
=
userInfo
.
TenantId
;
model
.
MallBaseId
=
userInfo
.
MallBaseId
;
model
.
CreateDate
=
System
.
DateTime
.
Now
;
...
...
@@ -1266,10 +1326,25 @@ namespace Mall.WebApi.Controllers.Education
/// <param name="request"></param>
/// <returns></returns>
[
HttpPost
]
[
AllowAnonymous
]
public
ApiResult
GetSurveyShowList
()
{
var
req
=
RequestParm
;
var
userInfo
=
AppletUserInfo
;
var
userInfo
=
new
AppletUserInfo
();
JObject
jobj
=
JObject
.
Parse
(
req
.
msg
.
ToString
());
if
(
base
.
AppletUserInfo
!=
null
)
{
userInfo
=
base
.
AppletUserInfo
;
}
else
{
userInfo
=
new
AppletUserInfo
()
{
TenantId
=
req
.
TenantId
,
MallBaseId
=
req
.
MallBaseId
,
UserId
=
req
.
EduStudentId
};
}
Rb_Survey_Extend
model
=
JsonConvert
.
DeserializeObject
<
Rb_Survey_Extend
>(
req
.
msg
.
ToString
());
var
activeSurueyModel
=
surveyModule
.
GetActivitySurveyList
(
new
RB_ActivitySurvey_Extend
{
TenantId
=
userInfo
.
TenantId
,
MallBaseId
=
userInfo
.
MallBaseId
,
ID
=
model
.
ActivitySurveyId
}).
FirstOrDefault
();
if
(
activeSurueyModel
==
null
||
activeSurueyModel
.
ID
==
0
)
...
...
@@ -1310,8 +1385,16 @@ namespace Mall.WebApi.Controllers.Education
activeSurueyModel
.
PrizeType
,
activeSurueyModel
.
ID
,
FillInNum
=
GuestSurvey
.
Where
(
x
=>
x
.
UserId
==
userInfo
.
UserId
).
Count
(),
BaseList
=
list
.
Where
(
x
=>
x
.
FormType
==
FormTypeEnum
.
Base
).
OrderBy
(
x
=>
x
.
Sort
).
Select
(
x
=>
new
{
x
.
ID
,
x
.
IsRequired
,
x
.
ActivitySurveyId
,
SurveyType
=
(
int
)
x
.
SurveyType
,
x
.
FormType
,
x
.
Title
,
x
.
Sort
,
SurveyTypeStr
=
EnumHelper
.
GetEnumName
(
x
.
SurveyType
),
FormTypeStr
=
EnumHelper
.
GetEnumName
(
x
.
FormType
),
x
.
SurveyOptionsList
,
ScoreNum
=
(
x
.
SurveyType
.
HasValue
&&
x
.
SurveyType
==
SurveyTypeEnum
.
Score
)
?
5
:
0
,
TextContent
=
""
}).
ToList
(),
SurveyList
=
list
.
Where
(
x
=>
x
.
FormType
==
FormTypeEnum
.
Survey
).
OrderBy
(
x
=>
x
.
Sort
).
Select
(
x
=>
new
{
x
.
ID
,
x
.
IsRequired
,
x
.
ActivitySurveyId
,
SurveyType
=
(
int
)
x
.
SurveyType
,
x
.
FormType
,
x
.
Title
,
x
.
Sort
,
SurveyTypeStr
=
EnumHelper
.
GetEnumName
(
x
.
SurveyType
),
FormTypeStr
=
EnumHelper
.
GetEnumName
(
x
.
FormType
),
x
.
SurveyOptionsList
,
ScoreNum
=
(
x
.
SurveyType
.
HasValue
&&
x
.
SurveyType
==
SurveyTypeEnum
.
Score
)
?
5
:
0
,
TextContent
=
""
}).
ToList
()
BaseList
=
list
.
Where
(
x
=>
x
.
FormType
==
FormTypeEnum
.
Base
)
.
OrderBy
(
x
=>
x
.
Sort
)
.
Select
(
x
=>
new
{
x
.
ID
,
x
.
IsRequired
,
x
.
ActivitySurveyId
,
SurveyType
=
(
int
)
x
.
SurveyType
,
x
.
FormType
,
x
.
Title
,
x
.
Sort
,
SurveyTypeStr
=
EnumHelper
.
GetEnumName
(
x
.
SurveyType
),
FormTypeStr
=
EnumHelper
.
GetEnumName
(
x
.
FormType
),
x
.
SurveyOptionsList
,
ScoreNum
=
(
x
.
SurveyType
.
HasValue
&&
x
.
SurveyType
==
SurveyTypeEnum
.
Score
)
?
5
:
0
,
TextContent
=
""
}).
ToList
(),
SurveyList
=
list
.
Where
(
x
=>
x
.
FormType
==
FormTypeEnum
.
Survey
).
OrderBy
(
x
=>
x
.
Sort
).
Select
(
x
=>
new
{
x
.
ID
,
x
.
IsRequired
,
x
.
ActivitySurveyId
,
SurveyType
=
(
int
)
x
.
SurveyType
,
x
.
FormType
,
x
.
Title
,
x
.
Sort
,
SurveyTypeStr
=
EnumHelper
.
GetEnumName
(
x
.
SurveyType
),
FormTypeStr
=
EnumHelper
.
GetEnumName
(
x
.
FormType
),
x
.
SurveyOptionsList
,
ScoreNum
=
(
x
.
SurveyType
.
HasValue
&&
x
.
SurveyType
==
SurveyTypeEnum
.
Score
)
?
3
:
0
,
TextContent
=
""
}).
ToList
(),
CourseArrangementList
=
list
.
Where
(
x
=>
x
.
FormType
==
FormTypeEnum
.
CourseArrangement
).
OrderBy
(
x
=>
x
.
Sort
).
Select
(
x
=>
new
{
x
.
ID
,
x
.
IsRequired
,
x
.
ActivitySurveyId
,
SurveyType
=
(
int
)
x
.
SurveyType
,
x
.
FormType
,
x
.
Title
,
x
.
Sort
,
SurveyTypeStr
=
EnumHelper
.
GetEnumName
(
x
.
SurveyType
),
FormTypeStr
=
EnumHelper
.
GetEnumName
(
x
.
FormType
),
x
.
SurveyOptionsList
,
ScoreNum
=
(
x
.
SurveyType
.
HasValue
&&
x
.
SurveyType
==
SurveyTypeEnum
.
Score
)
?
3
:
0
,
TextContent
=
""
}).
ToList
(),
TeachersSituationList
=
list
.
Where
(
x
=>
x
.
FormType
==
FormTypeEnum
.
TeachersSituation
).
OrderBy
(
x
=>
x
.
Sort
).
Select
(
x
=>
new
{
x
.
ID
,
x
.
IsRequired
,
x
.
ActivitySurveyId
,
SurveyType
=
(
int
)
x
.
SurveyType
,
x
.
FormType
,
x
.
Title
,
x
.
Sort
,
SurveyTypeStr
=
EnumHelper
.
GetEnumName
(
x
.
SurveyType
),
FormTypeStr
=
EnumHelper
.
GetEnumName
(
x
.
FormType
),
x
.
SurveyOptionsList
,
ScoreNum
=
(
x
.
SurveyType
.
HasValue
&&
x
.
SurveyType
==
SurveyTypeEnum
.
Score
)
?
3
:
0
,
TextContent
=
""
}).
ToList
(),
TeachingAssistantList
=
list
.
Where
(
x
=>
x
.
FormType
==
FormTypeEnum
.
TeachingAssistant
).
OrderBy
(
x
=>
x
.
Sort
).
Select
(
x
=>
new
{
x
.
ID
,
x
.
IsRequired
,
x
.
ActivitySurveyId
,
SurveyType
=
(
int
)
x
.
SurveyType
,
x
.
FormType
,
x
.
Title
,
x
.
Sort
,
SurveyTypeStr
=
EnumHelper
.
GetEnumName
(
x
.
SurveyType
),
FormTypeStr
=
EnumHelper
.
GetEnumName
(
x
.
FormType
),
x
.
SurveyOptionsList
,
ScoreNum
=
(
x
.
SurveyType
.
HasValue
&&
x
.
SurveyType
==
SurveyTypeEnum
.
Score
)
?
3
:
0
,
TextContent
=
""
}).
ToList
(),
LearningEnvironmentList
=
list
.
Where
(
x
=>
x
.
FormType
==
FormTypeEnum
.
LearningEnvironment
).
OrderBy
(
x
=>
x
.
Sort
).
Select
(
x
=>
new
{
x
.
ID
,
x
.
IsRequired
,
x
.
ActivitySurveyId
,
SurveyType
=
(
int
)
x
.
SurveyType
,
x
.
FormType
,
x
.
Title
,
x
.
Sort
,
SurveyTypeStr
=
EnumHelper
.
GetEnumName
(
x
.
SurveyType
),
FormTypeStr
=
EnumHelper
.
GetEnumName
(
x
.
FormType
),
x
.
SurveyOptionsList
,
ScoreNum
=
(
x
.
SurveyType
.
HasValue
&&
x
.
SurveyType
==
SurveyTypeEnum
.
Score
)
?
3
:
0
,
TextContent
=
""
}).
ToList
(),
OpinionandsuggestionList
=
list
.
Where
(
x
=>
x
.
FormType
==
FormTypeEnum
.
Opinionandsuggestion
).
OrderBy
(
x
=>
x
.
Sort
).
Select
(
x
=>
new
{
x
.
ID
,
x
.
IsRequired
,
x
.
ActivitySurveyId
,
SurveyType
=
(
int
)
x
.
SurveyType
,
x
.
FormType
,
x
.
Title
,
x
.
Sort
,
SurveyTypeStr
=
EnumHelper
.
GetEnumName
(
x
.
SurveyType
),
FormTypeStr
=
EnumHelper
.
GetEnumName
(
x
.
FormType
),
x
.
SurveyOptionsList
,
ScoreNum
=
(
x
.
SurveyType
.
HasValue
&&
x
.
SurveyType
==
SurveyTypeEnum
.
Score
)
?
3
:
0
,
TextContent
=
""
}).
ToList
(),
};
return
ApiResult
.
Success
(
""
,
result
);
}
...
...
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