Exemplo n.º 1
0
        /// <summary>
        /// 发送投诉与建议的微信通知
        /// <para>作    者:郭伟佳</para>
        /// <para>创建时间:2019-03-08</para>
        /// </summary>
        /// <param name="feedbackInfo">投诉与建议信息</param>
        public void SendWxMessage(TblDatFeedback feedbackInfo)
        {
            //获取学生信息
            var studentInfo = StudentService.GetStudentInfo(feedbackInfo.StudentId);

            //请假信息
            WxNotifyInDto wxNotify = new WxNotifyInDto
            {
                Data = new List <WxNotifyItemInDto> {
                    new WxNotifyItemInDto {
                        DataKey = "first", Value = ClientConfigManager.HssConfig.WeChatTemplateTitle.FeedbackNotice
                    },
                    new WxNotifyItemInDto {
                        DataKey = "keyword1", Value = WeChatTemplateContentConstants.FeedbackReceiver
                    },
                    new WxNotifyItemInDto {
                        DataKey = "keyword2", Value = feedbackInfo.CreateTime.ToString("yyyy.MM.dd HH:mm")
                    },
                    new WxNotifyItemInDto {
                        DataKey = "remark", Value = feedbackInfo.SchoolName
                    }
                },
                ToUser     = StudentService.GetWxOpenId(studentInfo),
                TemplateId = WeChatTemplateConstants.FeedbackTemplateId,
                Url        = string.Empty
            };

            WxNotifyProducerService.Instance.Publish(wxNotify);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 添加投诉与建议信息
        /// <para>作    者: 郭伟佳</para>
        /// <para>创建时间: 2019-03-07</para>
        /// </summary>
        /// <param name="feedbackRequest">回馈添加请求对象</param>
        public async Task AddIFeedback(FeedbackAddRequest feedbackRequest)
        {
            //1、数据校验
            CheckData(feedbackRequest);

            //2、添加投诉与建议信息
            TblDatFeedback feedbackInfo = new TblDatFeedback()
            {
                FeedbackId     = IdGenerator.NextId(),
                CompanyId      = _companyId,
                SchoolId       = feedbackRequest.SchoolId,
                SchoolName     = feedbackRequest.SchoolName,
                StudentId      = feedbackRequest.StudentId,
                ParentUserCode = feedbackRequest.LinkMobile,
                LinkMobile     = feedbackRequest.LinkMobile,
                CreatorName    = feedbackRequest.CreatorName,
                Content        = feedbackRequest.Content,
                CreateTime     = DateTime.Now,
                ProcessStatus  = (int)FeedbackProcessStatus.ToBeProcessed
            };
            await _repository.Value.AddTask(feedbackInfo);

            //3、保存上传的附件
            await AddAttachment(feedbackRequest.SchoolId, feedbackRequest.AttachmentUrlList, feedbackInfo.FeedbackId);

            //4、发送投诉与建议的微信通知
            SendWxMessage(feedbackInfo);

            //5、发送投诉与建议的邮件
            SendEmail(feedbackRequest, feedbackInfo);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 根据主键编号获取对应的投诉与建议详情
        /// <para>作    者:Huang GaoLiang </para>
        /// <para>创建时间:2019-03-07</para>
        /// </summary>
        /// <param name="detailId">投诉与建议Id</param>
        /// <returns>信息投诉与建议详情</returns>
        public async Task <FeedbackDetailResponse> GetFeedbackDetail(long detailId)
        {
            // 1、根据主键编号获取对应的投诉与建议详情
            TblDatFeedback feedbackDetail = await GetFeedbackInfoById(detailId);

            var feedbackDetailResponse = Mapper.Map <FeedbackDetailResponse>(feedbackDetail);

            // 2、根据主键编号和类型获取附件
            feedbackDetailResponse.Urls = new AttchmentService(feedbackDetail.SchoolId).GetAttchList(feedbackDetail.FeedbackId, AttchmentType.FEEDBACK).Select(m => m.Url).ToList();

            return(feedbackDetailResponse);
        }
Exemplo n.º 4
0
        /// <summary>
        /// 更新信息投诉与建议的处理状态
        /// <para>作    者:Huang GaoLiang </para>
        /// <para>创建时间:2019-03-07</para>
        /// </summary>
        /// <param name="detailId">投诉与建议Id</param>
        /// <param name="feedbackRequest">处理信息</param>
        /// <returns>信息投诉与建议详情</returns>
        /// <exception cref = "BussinessException" >
        /// 异常ID:1,异常描述:未找到数据
        /// </exception>
        public async Task UpdateProcessStatus(long detailId, FeedbackRequest feedbackRequest)
        {
            // 1、根据主键编号获取信息
            TblDatFeedback feedbackDetail = await GetFeedbackInfoById(detailId);

            feedbackDetail.ProcessStatus   = (int)feedbackRequest.ProcessStatus;
            feedbackDetail.ProcessRemark   = feedbackRequest.ProcessRemark;
            feedbackDetail.ProcessUserId   = feedbackRequest.ProcessUserId;
            feedbackDetail.ProcessUserName = feedbackRequest.ProcessUserName;
            feedbackDetail.ProcessTime     = DateTime.Now;
            await _repository.Value.UpdateFeedbackById(feedbackDetail);
        }
Exemplo n.º 5
0
        /// <summary>
        /// 发送投诉与建议的邮件
        /// <para>作    者: 郭伟佳</para>
        /// <para>创建时间: 2019-03-07</para>
        /// </summary>
        /// <param name="feedbackRequest">回馈添加请求对象</param>
        /// <param name="feedbackInfo">投诉与建议信息</param>
        private void SendEmail(FeedbackAddRequest feedbackRequest, TblDatFeedback feedbackInfo)
        {
            //1、获取校区的公司信息
            var schoolInfo = new JDWService().GetSchoolInfo(feedbackInfo.SchoolId);

            //2、获取公司家校互联相关的配置
            var schoolSettingInfo = new HomeSchoolSettingService().GetSettingList(schoolInfo.CompanyId)
                                    .Where(a => a.FuntionId == (int)HomeSchoolBusinessType.Feedback).FirstOrDefault();

            if (schoolSettingInfo != null)
            {
                //邮件内容
                StringBuilder contentMsg = new StringBuilder();
                contentMsg.Append("<div>");
                contentMsg.Append($"<span>{DatumConstants.Content}:{feedbackInfo.Content}</span><br /><br />");
                contentMsg.Append($"<span>{DatumConstants.School}: {feedbackInfo.SchoolName}</span><br />");
                contentMsg.Append($"<span>{DatumConstants.ContactPhone}:{feedbackInfo.LinkMobile}</span><br />");
                contentMsg.Append($"<span>{DatumConstants.StudentName}: {feedbackInfo.CreatorName}</span><br />");
                contentMsg.Append($"<span>{DatumConstants.SubmitTime}:{feedbackInfo.CreateTime.ToString("yyyy-MM-dd HH:mm")}</span><br /><br /><br /></div>");
                //3、发送邮件
                new MailSdk(ClientConfigManager.HssConfig.EmailSender.UserId, ClientConfigManager.HssConfig.EmailSender.UserName).SendMail(new MailSendDto()
                {
                    IsSaveDrafts = false,
                    Title        = DatumConstants.FeedbackTitle,
                    Contents     = contentMsg.ToString(),
                    FileList     = feedbackRequest.AttachmentUrlList.Select(a =>
                    {
                        //获取url文件扩展名
                        var fileSuffix = Regex.Match(a.Url, @"(\.\w+)+(?!.*(\w+)(\.\w+)+)").ToString();
                        return(new FileInfoDto()
                        {
                            Url = a.Url,
                            Name = a.Name,
                            Suffix = fileSuffix.Remove(0, 1),//去掉扩展名前的点
                            Size = 0
                        });
                    }).ToList(),
                    ReceiverList = new List <MailUserInfoDto> {
                        new MailUserInfoDto {
                            UserId = schoolSettingInfo.DataId, UserName = schoolSettingInfo.DataValue
                        }
                    }
                });
            }
        }