diff --git a/src/Shentun.WebPeis.Application/Persons/PersonAppService.cs b/src/Shentun.WebPeis.Application/Persons/PersonAppService.cs index 44054b9..ca60d24 100644 --- a/src/Shentun.WebPeis.Application/Persons/PersonAppService.cs +++ b/src/Shentun.WebPeis.Application/Persons/PersonAppService.cs @@ -371,7 +371,7 @@ namespace Shentun.WebPeis.Persons MaritalStatusName = _cacheService.GetMaritalStatusNameAsync(person.MaritalStatusId).Result, IdNo = person.IdNo, MobileTelephone = user.PhoneNumber, - IsHaveQuestionRegister = haveQuestionRegister==null? 'N':'Y' + IsHaveQuestionRegister = haveQuestionRegister.QuestionRegisterId == Guid.Empty ? 'N':'Y' }).Distinct().ToList(); diff --git a/src/Shentun.WebPeis.Application/QuestionRegisters/QuestionRegisterAppService.cs b/src/Shentun.WebPeis.Application/QuestionRegisters/QuestionRegisterAppService.cs index cfaf6d7..2c3aba2 100644 --- a/src/Shentun.WebPeis.Application/QuestionRegisters/QuestionRegisterAppService.cs +++ b/src/Shentun.WebPeis.Application/QuestionRegisters/QuestionRegisterAppService.cs @@ -64,11 +64,11 @@ namespace Shentun.WebPeis.QuestionRegisters if (questionRegister == null) { //没有登记过 - var questionRegisterEntity = new QuestionRegister(); - questionRegisterEntity.PersonId = input.PersonId; - questionRegisterEntity = await _questionRegisterManager.CreateAsync(questionRegisterEntity); - await _repository.InsertAsync(questionRegisterEntity); - questionRegisterDto.QuestionRegisterId = questionRegisterEntity.QuestionRegisterId; + questionRegister = new QuestionRegister(); + questionRegister.PersonId = input.PersonId; + questionRegister = await _questionRegisterManager.CreateAsync(questionRegister); + await _repository.InsertAsync(questionRegister); + questionRegisterDto.QuestionRegisterId = questionRegister.QuestionRegisterId; await _unitOfWorkManager.Current.SaveChangesAsync(); //return questionRegisterDto; } diff --git a/test/Shentun.WebPeis.Application.Tests/QuestionRegisterAppServiceTest.cs b/test/Shentun.WebPeis.Application.Tests/QuestionRegisterAppServiceTest.cs index 7b71c38..be86b73 100644 --- a/test/Shentun.WebPeis.Application.Tests/QuestionRegisterAppServiceTest.cs +++ b/test/Shentun.WebPeis.Application.Tests/QuestionRegisterAppServiceTest.cs @@ -38,7 +38,7 @@ namespace Shentun.WebPeis var entity = await _appService.GetByPersonIdAsync(new PersonIdInputDto() { - PersonId = new Guid("3a12d7fa-63f1-d549-c2f8-01123e5b7a8a") + PersonId = new Guid("3a12d72c-19d9-e8b2-71f6-cf283103e191") // 3a12d7fa-63f1-d549-c2f8-01123e5b7a8a }); foreach (var item in entity.QuestionRegisterItems) {