コード例 #1
0
        public async Task <ApiResult <GetComplaintFollowUpOutput> > Get([FromUri] GetComplaintFollowUpInput input, CancellationToken cancelToken)
        {
            if (string.IsNullOrWhiteSpace(input.Id))
            {
                throw new NotImplementedException("投诉ID为空!");
            }
            if (Authorization == null)
            {
                return(new ApiResult <GetComplaintFollowUpOutput>(APIResultCode.Unknown, new GetComplaintFollowUpOutput {
                }, APIResultMessage.TokenNull));
            }

            var user = _tokenRepository.GetUser(Authorization);

            if (user == null)
            {
                return(new ApiResult <GetComplaintFollowUpOutput>(APIResultCode.Unknown, new GetComplaintFollowUpOutput {
                }, APIResultMessage.TokenError));
            }

            var data = await _complaintFollowUpRepository.GetListForComplaintIdAsync(input.Id, cancelToken);

            var complaintAnnexList = await _complaintAnnexRepository.GetByFollowUpIdsAsync(data.Select(x => x.Id.ToString()).ToList());

            List <GetComplaintFollowUpListOutput> list = new List <GetComplaintFollowUpListOutput>();

            foreach (var item in data)
            {
                string OperationName = "";
                bool   IsCreateUser  = false;
                if (item.OperationDepartmentValue == Department.YeZhu.Value)
                {
                    OperationName = (await _ownerCertificationRecordRepository.GetIncludeAsync(item.OwnerCertificationRecordId.ToString(), cancelToken))?.Owner.Name;
                    IsCreateUser  = item.OwnerCertificationRecordId.ToString() == input.OwnerCertificationId ? true : false;
                }
                else if (item.OperationDepartmentValue == Department.YeZhuWeiYuanHui.Value)
                {
                    OperationName = (await _ownerCertificationRecordRepository.GetIncludeAsync(item.OwnerCertificationRecordId.ToString(), cancelToken))?.Owner.Name;
                    IsCreateUser  = item.OwnerCertificationRecordId.ToString() == input.OwnerCertificationId ? true : false;
                }
                else
                {
                    OperationName = (await _userRepository.GetForIdAsync(item.CreateOperationUserId, cancelToken)).Name;
                    IsCreateUser  = user.Name == OperationName ? true : false;
                }
                var entity = new GetComplaintFollowUpListOutput
                {
                    Aappeal                 = string.IsNullOrWhiteSpace(item.Aappeal) ? "" : item.Aappeal,
                    IsCreateUser            = IsCreateUser,
                    Description             = item.Description,
                    OperationDepartmentName = item.OperationDepartmentName,
                    OperationName           = OperationName,
                    Url        = (complaintAnnexList?.Where(x => x.ComplaintFollowUpId == item.Id)).FirstOrDefault()?.AnnexContent,
                    CreateTime = item.CreateOperationTime.Value
                };
                list.Add(entity);
            }

            var complaintEntity = await _complaintRepository.GetIncludeAsync(input.Id, cancelToken);

            var complaintTypeEntyity = await _complaintTypeRepository.GetAsync(complaintEntity.ComplaintTypeId.ToString(), cancelToken);

            var remainingPeriod = (complaintEntity.ExpiredTime - DateTimeOffset.Now).Value.Days + 1;

            return(new ApiResult <GetComplaintFollowUpOutput>(APIResultCode.Success, new GetComplaintFollowUpOutput
            {
                ExpiredTime = complaintEntity.ExpiredTime.Value,
                ProcessUpTime = complaintEntity.ProcessUpTime.Value,
                ComplaintPeriod = complaintTypeEntyity.ComplaintPeriod,
                ProcessingPeriod = complaintTypeEntyity.ProcessingPeriod,
                StatusName = complaintEntity.StatusName,
                StatusValue = complaintEntity.StatusValue,
                DepartmentName = complaintEntity.DepartmentName,
                DepartmentValue = complaintEntity.DepartmentValue,
                Description = complaintEntity.Description,
                ComplaintTypeName = complaintEntity.ComplaintType.Name,
                List = list,
                RemainingPeriod = remainingPeriod > 0 ? remainingPeriod : 0
            }));
        }
コード例 #2
0
        /// <summary>
        /// 后台执行校验 上传图片认证信息
        /// </summary>
        /// <param name="annex"></param>
        private async Task <ApiResult> Verification(OwnerCertificationAnnex annex)
        {
            var ownerCertificationRecordEntity = await _ownerCertificationRecordRepository.GetIncludeAsync(annex.ApplicationRecordId.ToString());

            try
            {
                OwnerCertificationRecordDto dto = new OwnerCertificationRecordDto
                {
                    OperationTime   = DateTimeOffset.Now,
                    OperationUserId = "system",
                    Id = ownerCertificationRecordEntity.Id.ToString()
                };

                try
                {
                    var entity = await PostALiYun(annex);

                    JsonModel json = new JsonModel();
                    try
                    {
                        json = JsonConvert.DeserializeObject <JsonModel>(entity.Message);
                        if (string.IsNullOrEmpty(json.Num))
                        {
                            throw new NotImplementedException("未识别到身份证信息,请提交正规清晰的身份证照片!");
                        }
                    }
                    catch (Exception)
                    {
                        throw new NotImplementedException("未识别到身份证信息,请提交正规清晰的身份证照片!");
                    }
                    var owner = (await _ownerRepository.GetListForLegalizeIncludeAsync(new OwnerDto {
                        IndustryId = ownerCertificationRecordEntity.IndustryId.ToString()
                    })).Where(x => x.IDCard == json.Num).FirstOrDefault();

                    if (owner != null)
                    {
                        dto.CertificationStatusValue = OwnerCertificationStatus.Success.Value;
                        dto.CertificationStatusName  = OwnerCertificationStatus.Success.Name;
                        dto.OwnerId             = owner.Id.ToString();
                        dto.OwnerName           = owner.Name.ToString();
                        dto.CertificationResult = "认证通过";
                    }
                    else
                    {
                        dto.CertificationStatusValue = OwnerCertificationStatus.Failure.Value;
                        dto.CertificationStatusName  = OwnerCertificationStatus.Failure.Name;
                        dto.CertificationResult      = "未查询到相关业主信息";
                    }
                }
                catch (Exception e)
                {
                    dto.CertificationStatusValue = OwnerCertificationStatus.Failure.Value;
                    dto.CertificationStatusName  = OwnerCertificationStatus.Failure.Name;
                    dto.CertificationResult      = e.Message;
                    throw new NotImplementedException(e.Message);
                }
                var recordEntity = await _ownerCertificationRecordRepository.UpdateStatusAsync(dto);

                if (string.IsNullOrWhiteSpace(dto.OwnerId))
                {
                    throw new NotImplementedException("未查询到相关业主信息");
                }

                await _ownerRepository.UpdateForLegalizeAsync(new OwnerDto
                {
                    OwnerCertificationRecordId = ownerCertificationRecordEntity.Id.ToString(),
                    Id   = recordEntity.OwnerId.ToString(),
                    Name = dto.OwnerName,
                });

                return(new ApiResult(APIResultCode.Success));
            }
            catch (Exception e)
            {
                await _ownerCertificationRecordRepository.UpdateInvalidAsync(new OwnerCertificationRecordDto
                {
                    Id              = ownerCertificationRecordEntity.Id.ToString(),
                    OperationTime   = DateTimeOffset.Now,
                    OperationUserId = "system",
                });

                await _ownerCertificationRecordRepository.DeleteAsync(new OwnerCertificationRecordDto
                {
                    Id              = ownerCertificationRecordEntity.Id.ToString(),
                    OperationTime   = DateTimeOffset.Now,
                    OperationUserId = "system",
                });

                throw new NotImplementedException(e.Message);
            }
        }
コード例 #3
0
        public async Task <ApiResult <AddVipOwnerAnnouncementOutput> > AddVipOwnerAnnouncement([FromBody] AddVipOwnerAnnouncementInput input, CancellationToken cancelToken)
        {
            if (Authorization == null)
            {
                return(new ApiResult <AddVipOwnerAnnouncementOutput>(APIResultCode.Unknown, new AddVipOwnerAnnouncementOutput {
                }, APIResultMessage.TokenNull));
            }
            if (string.IsNullOrWhiteSpace(input.Content))
            {
                throw new NotImplementedException("公告内容信息为空!");
            }
            if (string.IsNullOrWhiteSpace(input.Title))
            {
                throw new NotImplementedException("公告标题信息为空!");
            }
            if (string.IsNullOrWhiteSpace(input.OwnerCertificationId))
            {
                throw new NotImplementedException("业主认证Id信息为空!");
            }

            var user = _tokenRepository.GetUser(Authorization);

            if (user == null)
            {
                return(new ApiResult <AddVipOwnerAnnouncementOutput>(APIResultCode.Unknown, new AddVipOwnerAnnouncementOutput {
                }, APIResultMessage.TokenError));
            }

            var entity = await _announcementRepository.AddVipOwnerAsync(new AnnouncementDto
            {
                Content              = input.Content,
                Summary              = input.Summary,
                Title                = input.Title,
                DepartmentValue      = Department.YeZhuWeiYuanHui.Value,
                DepartmentName       = Department.YeZhuWeiYuanHui.Name,
                OperationTime        = DateTimeOffset.Now,
                OperationUserId      = user.Id.ToString(),
                OwnerCertificationId = input.OwnerCertificationId
            }, cancelToken);

            if (!string.IsNullOrWhiteSpace(input.AnnexId))
            {
                await _announcementAnnexRepository.AddAsync(new AnnouncementAnnexDto
                {
                    AnnexContent    = input.AnnexId,
                    AnnouncementId  = entity.Id.ToString(),
                    OperationTime   = DateTimeOffset.Now,
                    OperationUserId = user.Id.ToString()
                }, cancelToken);
            }

            var url           = (await _announcementAnnexRepository.GetAsync(entity.Id.ToString()))?.AnnexContent;
            var OperationName = (await _ownerCertificationRecordRepository.GetIncludeAsync(entity.OwnerCertificationId, cancelToken))?.Owner.Name;

            await AnnouncementPushRemind(new AnnouncementPushModel
            {
                Content        = entity.Content,
                Id             = entity.Id.ToString(),
                ReleaseTime    = entity.CreateOperationTime.Value.ToString("yyyy'-'MM'-'dd' 'HH':'mm':'ss"),
                Summary        = entity.Summary,
                Title          = entity.Title,
                Url            = url,
                CreateUserName = OperationName
            }, entity.SmallDistrictArray);

            return(new ApiResult <AddVipOwnerAnnouncementOutput>(APIResultCode.Success, new AddVipOwnerAnnouncementOutput {
                Id = entity.Id.ToString()
            }));
        }