Exemple #1
0
 public async Task <List <Complaint> > GetAllAsync(ComplaintDto dto, CancellationToken token = default)
 {
     using (var db = new GuoGuoCommunityContext())
     {
         return(await db.Complaints.Where(x => x.IsDeleted == false && x.OwnerCertificationRecordId.ToString() == dto.OwnerCertificationId).ToListAsync(token));
     }
 }
Exemple #2
0
        public async Task <Complaint> Create(ComplaintDto complaintDto)
        {
            var complaint = _mapper.Map <Complaint>(complaintDto);

            if (string.IsNullOrWhiteSpace(complaintDto.ComplaintType))
            {
                throw new AppException("ComplaintType is required");
            }
            if (string.IsNullOrWhiteSpace(complaintDto.ComplaintDescription))
            {
                throw new AppException("ComplaintDescription is required");
            }
            if (string.IsNullOrWhiteSpace(complaintDto.CustomerName))
            {
                throw new AppException("CustomerName is required");
            }
            if (string.IsNullOrWhiteSpace(complaintDto.CustomerContact))
            {
                throw new AppException("CustomerContact is required");
            }
            if (string.IsNullOrWhiteSpace(complaintDto.DateOfComplaint))
            {
                throw new AppException("DateOfComplaint is required");
            }

            await _complaintRepository.AddAsync(complaint);

            await _complaintRepository.Complete();

            return(complaint);
        }
Exemple #3
0
        public async Task <Complaint> AddAsync(ComplaintDto dto, CancellationToken token = default)
        {
            using (var db = new GuoGuoCommunityContext())
            {
                if (!Guid.TryParse(dto.ComplaintTypeId, out var complaintTypeId))
                {
                    throw new NotImplementedException("投诉类型Id信息不正确!");
                }
                var complaintType = await db.ComplaintTypes.Where(x => x.Id == complaintTypeId && x.IsDeleted == false).FirstOrDefaultAsync(token);

                if (complaintType == null)
                {
                    throw new NotImplementedException("投诉类型不存在!");
                }

                if (!Guid.TryParse(dto.OwnerCertificationId, out var ownerCertificationId))
                {
                    throw new NotImplementedException("业主认证Id信息不正确!");
                }
                var ownerCertificationRecord = await db.OwnerCertificationRecords.Include(x => x.Industry.BuildingUnit.Building.SmallDistrict.Community.StreetOffice).Where(x => x.Id == ownerCertificationId && x.IsDeleted == false).FirstOrDefaultAsync(token);

                if (ownerCertificationRecord == null)
                {
                    throw new NotImplementedException("业主认证不存在!");
                }

                var entity = db.Complaints.Add(new Complaint
                {
                    //CommunityId = ownerCertificationRecord.Industry.BuildingUnit.Building.SmallDistrict.CommunityId.ToString(),
                    //CommunityName = ownerCertificationRecord.Industry.BuildingUnit.Building.SmallDistrict.Community.Name,
                    //SmallDistrictId = ownerCertificationRecord.Industry.BuildingUnit.Building.SmallDistrictId.ToString(),
                    //SmallDistrictName = ownerCertificationRecord.Industry.BuildingUnit.Building.SmallDistrict.Name,
                    //StreetOfficeId = ownerCertificationRecord.Industry.BuildingUnit.Building.SmallDistrict.Community.StreetOfficeId.ToString(),
                    //StreetOfficeName = ownerCertificationRecord.Industry.BuildingUnit.Building.SmallDistrict.Community.StreetOffice.Name,
                    ComplaintTypeId = complaintType.Id,
                    //ComplaintTypeName = complaintType.Name,
                    ProcessUpTime              = DateTimeOffset.Now.AddDays(complaintType.ProcessingPeriod),
                    ExpiredTime                = DateTimeOffset.Now.AddDays(complaintType.ComplaintPeriod),
                    DepartmentName             = dto.DepartmentName,
                    DepartmentValue            = dto.DepartmentValue,
                    Description                = dto.Description,
                    OwnerCertificationRecordId = ownerCertificationId,
                    StatusName               = ComplaintStatus.NotAccepted.Name,
                    StatusValue              = ComplaintStatus.NotAccepted.Value,
                    CreateOperationTime      = dto.OperationTime,
                    CreateOperationUserId    = dto.OperationUserId,
                    LastOperationTime        = dto.OperationTime,
                    LastOperationUserId      = dto.OperationUserId,
                    OperationDepartmentName  = dto.OperationDepartmentName,
                    OperationDepartmentValue = dto.OperationDepartmentValue
                });
                await db.SaveChangesAsync(token);

                return(entity);
            }

            throw new NotImplementedException();
        }
Exemple #4
0
        public async Task <List <Complaint> > GetAllForVipOwnerAsync(ComplaintDto dto, CancellationToken token = default)
        {
            using (var db = new GuoGuoCommunityContext())
            {
                if (!Guid.TryParse(dto.OwnerCertificationId, out var ownerCertificationId))
                {
                    throw new NotImplementedException("业主认证Id不正确!");
                }
                var ownerCertificationRecord = await db.OwnerCertificationRecords.Include(x => x.Industry.BuildingUnit.Building.SmallDistrict.Community.StreetOffice).Where(x => x.Id == ownerCertificationId && x.IsDeleted == false).FirstOrDefaultAsync(token);

                if (ownerCertificationRecord == null)
                {
                    throw new NotImplementedException("业主认证信息不存在!");
                }
                return(await db.Complaints.Include(x => x.OwnerCertificationRecord.Industry.BuildingUnit.Building.SmallDistrict.Community.StreetOffice).Where(x => x.IsDeleted == false && x.DepartmentValue == Department.YeZhuWeiYuanHui.Value && x.OwnerCertificationRecord.Industry.BuildingUnit.Building.SmallDistrictId.ToString() == ownerCertificationRecord.Industry.BuildingUnit.Building.SmallDistrictId.ToString()).ToListAsync(token));
            }
        }
        public async Task <IActionResult> Create(ComplaintDto model)
        {
            try
            {
                var complaint = await _complaintService.Create(model);

                return(Ok(new
                {
                    ComplaintId = complaint.Id,
                    message = "Complaint Registered Successfully."
                }));
            }
            catch (AppException ex)
            {
                return(BadRequest(new { message = ex.Message }));
            }
        }
Exemple #6
0
        public async Task <List <Complaint> > GetAllForStreetOfficeIncludeAsync(ComplaintDto dto, CancellationToken token = default)
        {
            using (var db = new GuoGuoCommunityContext())
            {
                var list = await db.Complaints.Include(x => x.ComplaintType).Include(x => x.OwnerCertificationRecord.Industry.BuildingUnit.Building.SmallDistrict.Community.StreetOffice).Where(x => x.IsDeleted == false && x.DepartmentValue == Department.JieDaoBan.Value && x.OwnerCertificationRecord.Industry.BuildingUnit.Building.SmallDistrict.Community.StreetOfficeId.ToString() == dto.StreetOfficeId).ToListAsync(token);

                list = list.Where(x => x.CreateOperationTime >= dto.StartTime && x.CreateOperationTime <= dto.EndTime).ToList();
                if (!string.IsNullOrWhiteSpace(dto.StatusValue))
                {
                    list = list.Where(x => x.StatusValue == dto.StatusValue).ToList();
                }
                if (!string.IsNullOrWhiteSpace(dto.Description))
                {
                    list = list.Where(x => x.Description.Contains(dto.Description)).ToList();
                }
                return(list);
            }
        }
Exemple #7
0
        public async Task ViewForVipOwnerAsync(ComplaintDto dto, CancellationToken token = default)
        {
            using (var db = new GuoGuoCommunityContext())
            {
                if (!Guid.TryParse(dto.Id, out Guid guid))
                {
                    throw new NotImplementedException("投诉id信息不正确");
                }
                var entity = await db.Complaints.Where(x => x.IsDeleted == false && x.Id == guid).FirstOrDefaultAsync(token);

                if (entity == null)
                {
                    throw new NotImplementedException("投诉信息不存在");
                }
                entity.LastOperationTime   = dto.OperationTime;
                entity.LastOperationUserId = dto.OperationUserId;
                entity.StatusValue         = ComplaintStatus.Processing.Value;
                entity.StatusName          = ComplaintStatus.Processing.Name;
                await db.SaveChangesAsync(token);
            }
        }
Exemple #8
0
        public async Task DeleteAsync(ComplaintDto dto, CancellationToken token = default)
        {
            using (var db = new GuoGuoCommunityContext())
            {
                if (!Guid.TryParse(dto.Id, out var uid))
                {
                    throw new NotImplementedException("投诉信息不正确!");
                }
                var complaint = await db.Complaints.Where(x => x.Id == uid && x.IsDeleted == false).FirstOrDefaultAsync(token);

                if (complaint == null)
                {
                    throw new NotImplementedException("该投诉不存在!");
                }

                complaint.LastOperationTime   = dto.OperationTime;
                complaint.LastOperationUserId = dto.OperationUserId;
                complaint.DeletedTime         = dto.OperationTime;
                complaint.IsDeleted           = true;
                await db.SaveChangesAsync(token);
            }
        }
Exemple #9
0
        public async Task UpdateForStreetOfficeAsync(ComplaintDto dto, CancellationToken token = default)
        {
            using (var db = new GuoGuoCommunityContext())
            {
                if (!Guid.TryParse(dto.Id, out var uid))
                {
                    throw new NotImplementedException("投诉信息不正确!");
                }
                var complaint = await db.Complaints.Where(x => x.Id == uid).FirstOrDefaultAsync(token);

                if (complaint == null)
                {
                    throw new NotImplementedException("投诉信息不存在!");
                }

                complaint.StatusValue         = ComplaintStatus.Completed.Value;
                complaint.StatusName          = ComplaintStatus.Completed.Name;
                complaint.LastOperationTime   = dto.OperationTime;
                complaint.LastOperationUserId = dto.OperationUserId;
                await db.SaveChangesAsync(token);
            }
        }
Exemple #10
0
        public void Save(ComplaintDto ComplaintDto, Login userLogin)
        {
            var dbComplaint = Mapper.Map <MST_COMPLAINT_CATEGORY>(ComplaintDto);

            _complaint.save(dbComplaint, userLogin);
        }
Exemple #11
0
        public void Save(ComplaintDto ComplaintDto)
        {
            var dbComplaint = Mapper.Map <MST_COMPLAINT_CATEGORY>(ComplaintDto);

            _complaint.save(dbComplaint);
        }
Exemple #12
0
 public Task <List <Complaint> > GetListIncludeAsync(ComplaintDto dto, CancellationToken token = default)
 {
     throw new NotImplementedException();
 }
Exemple #13
0
 public Task UpdateAsync(ComplaintDto dto, CancellationToken token = default)
 {
     throw new NotImplementedException();
 }