Esempio n. 1
0
        public void PushProjectToXieZou(Guid projectId)
        {
            var xietongdanweiOrgId        = _appConfiguration["App:XietongdanweiOrgId"];
            var xietongdanweiOrgModel     = _organizationUnitRepository.Get(xietongdanweiOrgId.ToLong());
            var projectAuditMember        = _projectAuditMemberRepository.GetAll().Where(r => r.ProjectBaseId == projectId && r.UserAuditRole == 2).ToList();
            var projectAuditMemberUserIds = projectAuditMember.Select(r => r.UserId).ToList();

            var query = from user in _useRepository.GetAll()
                        join ur in _userOrganizationUnitRepository.GetAll() on user.Id equals ur.UserId
                        join org in _organizationUnitRepository.GetAll() on ur.OrganizationUnitId equals org.Id
                        join c in _contractWithSystemRepository.GetAll() on user.Id equals c.UserId into g
                        from c in g.DefaultIfEmpty()
                        join s in _realationSystemRepository.GetAll() on c.SystemId equals s.Id into f
                        from s in f.DefaultIfEmpty()
                        where projectAuditMemberUserIds.Contains(user.Id)
                        //&& org.Type == 2
                        && org.Code.Contains(xietongdanweiOrgModel.Code)
                        select new { user, system = s };

            if (query.Count() > 0)
            {
                foreach (var item in query.ToList())
                {
                    if (item.system != null)
                    {
                        var queueName = item.system.Code;
                        var obj       = new { MessageType = "1", Parameter = projectId.ToString() };
                        var message   = JToken.FromObject(obj);
                        //RabbitMqPublish.PushInfo("FRMS", message.ToString());
                        RabbitMqPublish.PushInfo(queueName, message.ToString());
                    }
                }
            }
        }
Esempio n. 2
0
        public async Task SendProjectAuditResultToFRMS(Guid projectId)
        {
            var projectModel = await _projectBaseRepository.GetAsync(projectId);

            if (projectModel.Gov_ProjectId.HasValue && !projectModel.Gov_Code.IsNullOrWhiteSpace())
            {
                var queueName = projectModel.Gov_Code;
                var obj       = new { MessageType = "2", Parameter = projectModel.Gov_ProjectId.ToString() };
                var message   = JToken.FromObject(obj);
                RabbitMqPublish.PushInfo(queueName, message.ToString());
            }
        }