diff --git a/New_College.Api/Controllers/Front/TestController.cs b/New_College.Api/Controllers/Front/TestController.cs index edc0096..f6c6b1a 100644 --- a/New_College.Api/Controllers/Front/TestController.cs +++ b/New_College.Api/Controllers/Front/TestController.cs @@ -193,6 +193,27 @@ namespace New_College.Api.Controllers.Front }; } + + /// + /// 获取霍兰德测评结果解析 + /// + /// + /// + [HttpGet] + [Authorize] + public async Task> GetHollandOccupDetail([FromQuery] ResultLookQuery query) + { + var result = await test_PsychMeasurementInfoServices.GetHollandOccupDetail(query); + return new MessageModel() + { + success = true, + msg = "获取成功", + response = result + }; + } + + + /// /// 获取MBTI测评结果 /// diff --git a/New_College.Api/New_College.Model.xml b/New_College.Api/New_College.Model.xml index 9febf40..db968f1 100644 --- a/New_College.Api/New_College.Model.xml +++ b/New_College.Api/New_College.Model.xml @@ -5000,6 +5000,41 @@ + + + 标签关联职业 + + + + + 标签关联人物 + + + + + 标签解析 + + + + + 标签描述 + + + + + 标签基本特征 + + + + + 职业特征 + + + + + 标签关联职业 + + 测评结果 diff --git a/New_College.Api/New_College.xml b/New_College.Api/New_College.xml index 238aecd..7b8251a 100644 --- a/New_College.Api/New_College.xml +++ b/New_College.Api/New_College.xml @@ -494,6 +494,13 @@ + + + 获取霍兰德测评结果解析 + + + + 获取MBTI测评结果 diff --git a/New_College.IServices/ITest_PsychMeasurementInfoServices.cs b/New_College.IServices/ITest_PsychMeasurementInfoServices.cs index a6e7a55..eb19b4d 100644 --- a/New_College.IServices/ITest_PsychMeasurementInfoServices.cs +++ b/New_College.IServices/ITest_PsychMeasurementInfoServices.cs @@ -22,7 +22,7 @@ namespace New_College.IServices Task SaveHolland(SaveHollandQuery query); - + Task GetHollandOccupDetail(ResultLookQuery query); Task GetHollandResult(ResultLookQuery query); Task GetMBTIResult(ResultLookQuery query); diff --git a/New_College.Model/ViewModels/Result/PsychMeasurementListResult.cs b/New_College.Model/ViewModels/Result/PsychMeasurementListResult.cs index f155fee..6fd1e27 100644 --- a/New_College.Model/ViewModels/Result/PsychMeasurementListResult.cs +++ b/New_College.Model/ViewModels/Result/PsychMeasurementListResult.cs @@ -133,9 +133,68 @@ namespace New_College.Model.ViewModels public Radar radar { get; set; } public string TagName { get; set; } + } + public class HollandOccupDetail + { + public TagtestingHollandResult tagtestingHolland { get; set; } + + /// + /// 标签关联职业 + /// + public List TagOccupations { get; set; } + + /// + /// 标签关联人物 + /// + public List tagMapPeople { get; set; } + + /// + /// 标签解析 + /// + public HollandTagMapExplain tagMapExplain { get; set; } + + + } + + + public class HollandTagMapExplain + { + /// + /// 标签描述 + /// + public string Description { get; set; } + + /// + /// 标签基本特征 + /// + public string BaseProperty { get; set; } + + /// + /// 职业特征 + /// + public List OccupationProperty { get; set; } + + /// + /// 标签关联职业 + /// + public string Occupation { get; set; } + + + } + + + public class HollandTagMapPerson + { + public string NickName { get; set; } + + public string AvatarUrl { get; set; } + } + + + public class Radar { public List categories { get; set; } diff --git a/New_College.Services/Test_PsychMeasurementInfoServices.cs b/New_College.Services/Test_PsychMeasurementInfoServices.cs index 1cb0ae5..34d8e49 100644 --- a/New_College.Services/Test_PsychMeasurementInfoServices.cs +++ b/New_College.Services/Test_PsychMeasurementInfoServices.cs @@ -17,6 +17,7 @@ using New_College.Model; using New_College.Model.ViewModels.Result; using New_College.Model.ViewModels.Query; using Microsoft.Extensions.Logging; +using SqlSugar; namespace New_College.Services { @@ -30,6 +31,9 @@ namespace New_College.Services private readonly IT_PlanMapTagRepository t_PlanMapTagRepository; private readonly IT_EnrollmentPlaneRepository t_EnrollmentPlaneRepository; private readonly IT_EnrollmentPlanedescRepository t_EnrollmentPlanedescRepository; + private readonly ID_TagMapPersonRepository _TagMapPersonRepository; + private readonly ID_HollandMapExplainRepository _HollandMapExplainRepository; + private IHoldGroupMapOccupRepository _groupMapOccupRepository; private readonly ILogger _loggerHelper; public Test_PsychMeasurementInfoServices(IBaseRepository dal @@ -39,7 +43,11 @@ namespace New_College.Services , IV_SubjectSelectRepository IV_SubjectSelectRepository , IT_PlanMapTagRepository IT_PlanMapTagRepository , IT_EnrollmentPlaneRepository IT_EnrollmentPlaneRepository - , IT_EnrollmentPlanedescRepository IT_EnrollmentPlanedescRepository, ILogger loggerHelper) + , IT_EnrollmentPlanedescRepository IT_EnrollmentPlanedescRepository, + ILogger loggerHelper, + ID_TagMapPersonRepository tagMapPersonRepository, + ID_HollandMapExplainRepository hollandMapExplainRepository, + IHoldGroupMapOccupRepository groupMapOccupRepository) { this._dal = dal; _QuestionTypeInfoRepository = ITest_QuestionTypeInfoRepository; @@ -51,6 +59,9 @@ namespace New_College.Services t_EnrollmentPlanedescRepository = IT_EnrollmentPlanedescRepository; base.BaseDal = dal; this._loggerHelper = loggerHelper; + _TagMapPersonRepository = tagMapPersonRepository; + _HollandMapExplainRepository = hollandMapExplainRepository; + _groupMapOccupRepository = groupMapOccupRepository; } public List permut = new List(); /// @@ -452,6 +463,60 @@ namespace New_College.Services return false; } + + + /// + /// + /// + /// + /// + public async Task GetHollandOccupDetail(ResultLookQuery query) + { + var response = new HollandOccupDetail(); + Test_PsychMeasurementInfo info = new Test_PsychMeasurementInfo() { }; + if (query.CycleTimeId > 0) + { + info = (await _dal.Query(x => x.CategoryId == query.CategoryId && x.StudentId == query.StudentId && x.CycleTimeId == query.CycleTimeId)).FirstOrDefault(); + } + else + { + info = (await _dal.Query(x => x.CategoryId == query.CategoryId && x.StudentId == query.StudentId)).OrderByDescending(x => x.CreateTime).FirstOrDefault(); + } + if (info == null || string.IsNullOrEmpty(info.Result)) + return new HollandOccupDetail() { }; + var taginfo = JsonConvert.DeserializeObject(info.Result); + response.tagtestingHolland = taginfo; + var tagmappersons = await _TagMapPersonRepository.Query(c => SqlFunc.Contains(taginfo.TagName, c.Tag)); + response.tagMapPeople = tagmappersons.Select(c => new HollandTagMapPerson() { AvatarUrl = c.AvatarUrl, NickName = c.NickName }).ToList(); + var tagmapexplain = await _HollandMapExplainRepository.Query(c => SqlFunc.Contains(taginfo.TagName, c.Tag)); + var baseprop = string.Empty; + var occupationprop = string.Empty; + var description = string.Empty; + var occupation = string.Empty; + tagmapexplain.ForEach(a => + { + baseprop += a.BaseProperty; + + occupationprop += a.OccupationProperty; + + description += a.Description; + occupation += a.Occupation; + + }); + response.tagMapExplain = new HollandTagMapExplain() + { + BaseProperty = baseprop, + Description = description, + OccupationProperty = occupationprop.Replace(" ","").Replace("1","").Replace("2", "").Replace("3", "").Replace("4", "").Replace("5", "").Split('.', StringSplitOptions.RemoveEmptyEntries).ToList(), + Occupation = occupation + }; + + + + return response; + } + + /// /// 获取霍兰德测评结果 /// @@ -488,7 +553,7 @@ namespace New_College.Services return new UserResult() { }; return new UserResult() { - Occupation=mbtiresult.Occupation, + Occupation = mbtiresult.Occupation, PersonType = mbtiresult.PersonType, Advantage = mbtiresult.Advantage, BlindSpot = mbtiresult.BlindSpot,