コード例 #1
0
        public bool MergeContact(long fromConId, long toConId, long userId, bool isDelete = false)
        {
            crm_contact fromCon = GetContact(fromConId);
            crm_contact toCon   = GetContact(toConId);

            if (fromCon == null || toCon == null || fromConId == toConId)
            {
                return(false);
            }
            CompanyBLL accBll = new CompanyBLL();


            // 商机// 销售订单
            OpportunityBLL         oppoBll  = new OpportunityBLL();
            List <crm_opportunity> oppoList = new OpportunityBLL().GetOppoBySql($"SELECT * from crm_opportunity where delete_time =0 and contact_id = {fromConId.ToString()} ");

            if (oppoList != null && oppoList.Count > 0)
            {
                oppoList.ForEach(_ =>
                {
                    _.contact_id = toConId;
                    oppoBll.EdotOpportunity(_, userId);
                });
            }

            // 待办 // 活动
            ActivityBLL         actBll       = new ActivityBLL();
            List <com_activity> activityList = new ActivityBLL().GetToListBySql($"select * from com_activity where delete_time =0 and  contact_id = {fromConId.ToString()} and (status_id <> {(int)DicEnum.ACTIVITY_STATUS.COMPLETED} or status_id is null)");

            if (activityList != null && activityList.Count > 0)
            {
                activityList.ForEach(_ =>
                {
                    _.contact_id = toConId;
                    actBll.EditActivity(_, userId);
                });
            }
            // 工单 // 任务
            TicketBLL       taskBll    = new TicketBLL();
            List <sdk_task> ticketList = accBll.GetBySql <sdk_task>($"SELECT * from sdk_task where type_id in (1809,1807) and delete_time = 0 and contact_id =  {fromConId.ToString()}");

            if (ticketList != null && ticketList.Count > 0)
            {
                ticketList.ForEach(_ =>
                {
                    _.contact_id = toConId;
                    taskBll.EditTicket(_, userId);
                });
            }
            // 调查

            // 联系人群组
            List <crm_contact_group>      groupList = accBll.GetBySql <crm_contact_group>($"SELECT ccg.* from crm_contact_group ccg INNER JOIN crm_contact_group_contact ccgc on ccg.id = ccgc.contact_group_id where ccg.delete_time =0 and ccgc.delete_time = 0 and ccgc.contact_id =  {fromConId.ToString()}");
            crm_contact_group_contact_dal ccgcDal   = new crm_contact_group_contact_dal();

            if (groupList != null && groupList.Count > 0)
            {
                groupList.ForEach(_ =>
                {
                    var list = GetGroupContactByGroup(_.id);
                    if (list != null && list.Count > 0)
                    {
                        var from = list.FirstOrDefault(l => l.contact_id == toConId);
                        if (from != null)
                        {
                            if (list.Any(l => l.contact_id == toConId))  // 删除源
                            {
                                ccgcDal.SoftDelete(from, userId);
                            }
                            else     // 更改源
                            {
                                from.contact_id = toConId;
                                ccgcDal.Update(from);
                            }
                        }
                    }
                });
            }

            // 合同
            ContractBLL         contractBll  = new ContractBLL();
            List <ctt_contract> contractList = accBll.GetBySql <ctt_contract>($"SELECT id, name from ctt_contract where delete_time = 0 and contact_id = { fromConId.ToString()}");

            if (contractList != null && contractList.Count > 0)
            {
                contractList.ForEach(_ =>
                {
                    _.contact_id = toConId;
                    contractBll.EditContractOnly(_, userId);
                });
            }

            if (isDelete)
            {
                DeleteContact(fromConId, userId);
            }
            return(true);
        }
コード例 #2
0
ファイル: MergeAccount.aspx.cs プロジェクト: evelh/Done
        protected string GetDetailByAccount(long accId)
        {
            StringBuilder html        = new StringBuilder();
            crm_account   thisAccount = accBll.GetCompany(accId);

            if (thisAccount == null)
            {
                return("");
            }
            //
            html.Append("<div class='workspace'>");
            #region  客户信息-地址信息
            html.Append($"<p align='left' style='padding-left: 10px;' class='FieldLabels'>{thisAccount.name}");
            if (!string.IsNullOrEmpty(thisAccount.phone))
            {
                html.Append($"<span style='font-weight:normal;'> {thisAccount.phone} </span ><br />");
            }
            else
            {
                html.Append($"<br />");
            }

            var location = new LocationBLL().GetLocationByAccountId(accId);
            if (location != null)
            {
                if (!string.IsNullOrEmpty(location.address))
                {
                    html.Append($"<span style='font-weight:normal;'>{location.address} </span ><br />");
                }
                if (!string.IsNullOrEmpty(location.additional_address))
                {
                    html.Append($"<span style='font-weight:normal;'>{location.additional_address} </span ><br />");
                }
                var ddDal   = new DAL.d_district_dal();
                var thisPro = ddDal.FindById(location.province_id);
                if (thisPro != null)
                {
                    html.Append($"<span style='font-weight:normal;'>{thisPro.name} </span >&nbsp;&nbsp;");
                }
                var thisCity = ddDal.FindById(location.city_id);
                if (thisCity != null)
                {
                    html.Append($"<span style='font-weight:normal;'>{thisCity.name} </span >&nbsp;&nbsp;");
                }
                if (location.district_id != null)
                {
                    var thisDis = ddDal.FindById((long)location.district_id);
                    if (thisDis != null)
                    {
                        html.Append($"<span style='font-weight:normal;'>{thisDis.name} </span ><br />");
                    }
                }
                if (location.country_id != null)
                {
                    var thisCoun = new DAL.d_country_dal().FindById((long)location.country_id);
                    if (thisCoun != null)
                    {
                        html.Append($"<span style='font-weight:normal;'>{thisCoun.country_name_display} </span ><br />");
                    }
                }
            }
            html.Append("</p>");
            #endregion
            html.Append("<div style='padding-left: 10px;'><table cellspacing='0' cellpadding='4' border='0' class='FieldLabels'><tbody>");

            #region  联系人信息
            html.Append("<tr><td align='left'>客户</td></tr>");
            List <crm_contact> contactList = new ContactBLL().GetContactByCompany(accId);
            if (contactList != null && contactList.Count > 0)
            {
                contactList.ForEach(_ =>
                {
                    html.Append($"<tr><td style='padding-left: 10px; font-weight:normal;'>{_.name}-手机号 : &nbsp; {_.phone}</td></tr>");
                });
            }
            #endregion

            #region  商机信息
            html.Append("<tr><td align='left' style='padding-top:20px;'>商机</td></tr>");
            List <crm_opportunity> oppoList = new OpportunityBLL().GetOppoBySql($"SELECT id,name from crm_opportunity where delete_time =0 and account_id = {accId.ToString()} ");
            // and status_id not in ({(int)DicEnum.OPPORTUNITY_STATUS.LOST},{(int)DicEnum.OPPORTUNITY_STATUS.CLOSED},{(int)DicEnum.OPPORTUNITY_STATUS.IMPLEMENTED})
            if (oppoList != null && oppoList.Count > 0)
            {
                oppoList.ForEach(_ =>
                {
                    html.Append($"<tr><td style='padding-left: 10px; font-weight:normal;'>{_.name}</td></tr>");
                });
            }

            #endregion

            #region  销售订单信息  销售订单没有name 使用商机name
            html.Append("<tr><td align='left' style='padding-top:20px;'>销售订单</td></tr>");
            List <crm_opportunity> saleList = accBll.GetBySql <crm_opportunity>($"SELECT s.id,p.name from crm_sales_order s INNER JOIN crm_opportunity p on s.opportunity_id = p.id where s.delete_time = 0 and p.delete_time =0 and p.account_id = {accId.ToString()} ");
            if (saleList != null && saleList.Count > 0)
            {
                saleList.ForEach(_ =>
                {
                    html.Append($"<tr><td style='padding-left: 10px; font-weight:normal;'>{_.name}</td></tr>");
                });
            }

            #endregion


            #region  采购订单信息
            html.Append("<tr><td align='left' style='padding-top:20px;'>采购订单</td></tr>");
            List <ivt_order> orderList = accBll.GetBySql <ivt_order>($"SELECT v.id from ivt_order v where v.delete_time = 0 and v.vendor_account_id = {accId.ToString()} ");
            html.Append($"<tr><td style='padding-left: 10px; font-weight:normal;'>这个客户有{(orderList!=null? orderList.Count:0)}个采购订单</td></tr>");
            #endregion

            #region  待办信息
            html.Append("<tr><td align='left' style='padding-top:20px;'>待办</td></tr>");
            List <com_activity> todoList = new ActivityBLL().GetToListBySql($"select id,name,description from com_activity where delete_time =0 and cate_id = {(int)DicEnum.ACTIVITY_CATE.TODO} and account_id = {accId.ToString()} and (status_id <> {(int)DicEnum.ACTIVITY_STATUS.COMPLETED} or status_id is null)");
            if (todoList != null && todoList.Count > 0)
            {
                todoList.ForEach(_ =>
                {
                    html.Append($"<tr><td style='padding-left: 10px; font-weight:normal;'>{_.description}</td></tr>");
                });
            }
            #endregion

            #region  活动信息
            html.Append("<tr><td align='left' style='padding-top:20px;'>活动</td></tr>");
            List <com_activity> actList = new ActivityBLL().GetToListBySql($"select id,name,description from com_activity where delete_time =0 and cate_id <> {(int)DicEnum.ACTIVITY_CATE.TODO} and account_id = {accId.ToString()} and (status_id <> {(int)DicEnum.ACTIVITY_STATUS.COMPLETED} or status_id is null)");

            html.Append($"<tr><td style='padding-left: 10px; font-weight:normal;'>这个客户有{(actList != null ? actList.Count : 0)}个活动</td></tr>");

            #endregion

            #region  配置项信息
            html.Append("<tr><td align='left' style='padding-top:20px;'>配置项</td></tr>");
            List <ivt_product> insProList = accBll.GetBySql <ivt_product>($"SELECT i.id,p.name from crm_installed_product i INNER JOIN ivt_product p on i.product_id = p.id and i.delete_time =0 and p.delete_time =0 and i.account_id = {accId.ToString()}");
            if (insProList != null && insProList.Count > 0)
            {
                insProList.ForEach(_ =>
                {
                    html.Append($"<tr><td style='padding-left: 10px; font-weight:normal;'>{_.name}</td></tr>");
                });
            }
            #endregion

            #region 项目信息
            html.Append("<tr><td align='left' style='padding-top:20px;'>项目</td></tr>");
            List <pro_project> proList = accBll.GetBySql <pro_project>($"SELECT id,name from pro_project where delete_time= 0 and account_id =  {accId.ToString()}");
            if (proList != null && proList.Count > 0)
            {
                proList.ForEach(_ =>
                {
                    html.Append($"<tr><td style='padding-left: 10px; font-weight:normal;'>{_.name}</td></tr>");
                });
            }
            #endregion

            #region 费用信息
            html.Append("<tr><td align='left' style='padding-top:20px;'>费用</td></tr>");
            List <sdk_expense> expList = accBll.GetBySql <sdk_expense>($"SELECT id from sdk_expense where delete_time= 0 and account_id =  {accId.ToString()}");
            html.Append($"<tr><td style='padding-left: 10px; font-weight:normal;'>这个客户有{(expList != null ? expList.Count : 0)}个费用</td></tr>");
            #endregion

            #region 工单信息
            html.Append("<tr><td align='left' style='padding-top:20px;'>工单</td></tr>");
            List <sdk_task> ticketList = accBll.GetBySql <sdk_task>($"SELECT id from sdk_task where type_id = 1809 and delete_time = 0 and account_id =  {accId.ToString()}");
            html.Append($"<tr><td style='padding-left: 10px; font-weight:normal;'>这个客户有{(ticketList != null ? ticketList.Count : 0)}个工单</td></tr>");
            #endregion

            #region 调查问卷信息

            #endregion

            #region 任务或工单备注信息
            html.Append("<tr><td align='left' style='padding-top:20px;'>任务或工单备注</td></tr>");
            List <sdk_task>     taskList     = accBll.GetBySql <sdk_task>($"SELECT id from sdk_task where type_id = 1807 and delete_time = 0 and account_id =  {accId.ToString()}");
            List <com_activity> taskNoteList = accBll.GetBySql <com_activity>($"SELECT * from com_activity where delete_time =0 and cate_id = 1500 and account_id = {accId.ToString()}");

            html.Append($"<tr><td style='padding-left: 10px; font-weight:normal;'>这个客户有{((taskList != null ? taskList.Count : 0)+(taskNoteList != null ? taskNoteList.Count : 0))}个任务或工单备注</td></tr>");

            #endregion

            #region 备注信息
            html.Append("<tr><td align='left' style='padding-top:20px;'>备注</td></tr>");
            List <com_activity> noteList = accBll.GetBySql <com_activity>($"SELECT * from com_activity where delete_time =0 and cate_id = 31 and account_id = {accId.ToString()}");
            if (noteList != null && noteList.Count > 0)
            {
                noteList.ForEach(_ =>
                {
                    html.Append($"<tr><td style='padding-left: 10px; font-weight:normal;'>{_.name}</td></tr>");
                });
            }

            #endregion

            #region 合同信息
            html.Append("<tr><td align='left' style='padding-top:20px;'>合同</td></tr>");
            List <ctt_contract> contractList = accBll.GetBySql <ctt_contract>($"SELECT id, name from ctt_contract where delete_time = 0 and account_id = { accId.ToString()}");
            if (contractList != null && contractList.Count > 0)
            {
                contractList.ForEach(_ =>
                {
                    html.Append($"<tr><td style='padding-left: 10px; font-weight:normal;'>{_.name}</td></tr>");
                });
            }
            #endregion

            #region 附件信息
            html.Append("<tr><td align='left' style='padding-top:20px;'>附件</td></tr>");
            List <com_attachment> attList = accBll.GetBySql <com_attachment>($"SELECT id from com_attachment where delete_time =0 and account_id = { accId.ToString()}");
            html.Append($"<tr><td style='padding-left: 10px; font-weight:normal;'>这个客户有{(attList != null ? attList.Count : 0)}个附件</td></tr>");
            #endregion

            #region  务信息
            html.Append("<tr><td align='left' style='padding-top:20px;'>服务</td></tr>");
            List <ivt_service> serviceList = accBll.GetBySql <ivt_service>($"SELECT id,name from ivt_service where delete_time = 0 and vendor_account_id = { accId.ToString()}");
            if (serviceList != null && serviceList.Count > 0)
            {
                serviceList.ForEach(_ =>
                {
                    html.Append($"<tr><td style='padding-left: 10px; font-weight:normal;'>{_.name}</td></tr>");
                });
            }
            #endregion


            html.Append("</tbody></table></div>");
            html.Append("</div>");

            return(html.ToString());
        }
コード例 #3
0
ファイル: TransResource.aspx.cs プロジェクト: evelh/Done
        protected string GetDetailByRes(long resId)
        {
            StringBuilder html    = new StringBuilder();
            sys_resource  thisRes = userBll.GetResourceById(resId);

            if (thisRes == null)
            {
                return("");
            }
            //
            html.Append("<div class='workspace'>");
            #region  用户信息
            html.Append($"<p align='left' style='padding-left: 10px;' class='FieldLabels'>{thisRes.name}<br />");

            if (!string.IsNullOrEmpty(thisRes.office_phone))
            {
                html.Append($"<span style='font-weight:normal;'>办公电话: {thisRes.office_phone} </span ><br />");
            }
            if (!string.IsNullOrEmpty(thisRes.home_phone))
            {
                html.Append($"<span style='font-weight:normal;'>家庭电话: {thisRes.home_phone} </span ><br />");
            }
            if (!string.IsNullOrEmpty(thisRes.email))
            {
                html.Append($"<span style='font-weight:normal;'>邮箱: {thisRes.email} </span ><br />");
            }
            html.Append("</p>");
            #endregion
            html.Append("<div style='padding-left: 10px;'><table cellspacing='0' cellpadding='4' border='0' class='FieldLabels'><tbody>");

            #region  客户信息
            html.Append("<tr><td align='left'>客户</td></tr>");
            List <crm_account> accList = new CompanyBLL().GetBySql <crm_account>("SELECT id,name,phone from crm_account a where a.delete_time =0 and a.resource_id = " + resId.ToString());
            if (accList != null && accList.Count > 0)
            {
                accList.ForEach(_ =>
                {
                    html.Append($"<tr><td style='padding-left: 10px; font-weight:normal;'>{_.name}-手机号 : &nbsp; {_.phone}</td></tr>");
                });
            }
            #endregion

            #region  商机信息
            html.Append("<tr><td align='left' style='padding-top:20px;'>商机</td></tr>");
            List <crm_opportunity> oppoList = new OpportunityBLL().GetOppoBySql($"SELECT id,name from crm_opportunity where delete_time =0 and resource_id = {resId.ToString()} and status_id not in ({(int)DicEnum.OPPORTUNITY_STATUS.LOST},{(int)DicEnum.OPPORTUNITY_STATUS.CLOSED},{(int)DicEnum.OPPORTUNITY_STATUS.IMPLEMENTED})");
            if (oppoList != null && oppoList.Count > 0)
            {
                oppoList.ForEach(_ =>
                {
                    html.Append($"<tr><td style='padding-left: 10px; font-weight:normal;'>{_.name}</td></tr>");
                });
            }

            #endregion

            #region  待办信息
            html.Append("<tr><td align='left' style='padding-top:20px;'>待办</td></tr>");
            List <com_activity> todoList = new ActivityBLL().GetToListBySql($"select id,name,description from com_activity where delete_time =0 and cate_id = {(int)DicEnum.ACTIVITY_CATE.TODO} and resource_id = {resId.ToString()} and (status_id <> {(int)DicEnum.ACTIVITY_STATUS.COMPLETED} or status_id is null)");
            if (todoList != null && todoList.Count > 0)
            {
                todoList.ForEach(_ =>
                {
                    html.Append($"<tr><td style='padding-left: 10px; font-weight:normal;'>{_.description}</td></tr>");
                });
            }
            #endregion

            #region  活动信息
            html.Append("<tr><td align='left' style='padding-top:20px;'>活动</td></tr>");
            List <com_activity> actList = new ActivityBLL().GetToListBySql($"select id,name,description from com_activity where delete_time =0 and cate_id <> {(int)DicEnum.ACTIVITY_CATE.TODO} and resource_id = {resId.ToString()} and (status_id <> {(int)DicEnum.ACTIVITY_STATUS.COMPLETED} or status_id is null)");
            if (actList != null && actList.Count > 0)
            {
                actList.ForEach(_ =>
                {
                    html.Append($"<tr><td style='padding-left: 10px; font-weight:normal;'>{_.description}</td></tr>");
                });
            }
            #endregion
            html.Append("</tbody></table></div>");
            html.Append("</div>");

            return(html.ToString());
        }
コード例 #4
0
        protected string GetDetailByContact(long conId)
        {
            StringBuilder html        = new StringBuilder();
            crm_contact   thisContact = conBll.GetContact(conId);

            if (thisContact == null)
            {
                return("");
            }

            html.Append("<div class='workspace'>");

            html.Append("<div style='padding-left: 10px;'><table cellspacing='0' cellpadding='4' border='0' class='FieldLabels'><tbody>");

            //

            #region  商机信息
            html.Append("<tr><td align='left' style='padding-top:20px;'>商机</td></tr>");
            List <crm_opportunity> oppoList = new OpportunityBLL().GetOppoBySql($"SELECT id,name from crm_opportunity where delete_time =0 and contact_id = {conId.ToString()} ");
            // and status_id not in ({(int)DicEnum.OPPORTUNITY_STATUS.LOST},{(int)DicEnum.OPPORTUNITY_STATUS.CLOSED},{(int)DicEnum.OPPORTUNITY_STATUS.IMPLEMENTED})
            if (oppoList != null && oppoList.Count > 0)
            {
                oppoList.ForEach(_ =>
                {
                    html.Append($"<tr><td style='padding-left: 10px; font-weight:normal;'>{_.name}</td></tr>");
                });
            }
            else
            {
                html.Append($"<tr><td class='errorSmall' align='left' style='padding-left:10px;text-align:left;font-weight :normal;'>该联系人下没有商机</td></tr>");
            }

            #endregion

            #region  销售订单信息  销售订单没有name 使用商机name
            html.Append("<tr><td align='left' style='padding-top:20px;'>销售订单</td></tr>");
            List <crm_opportunity> saleList = accBll.GetBySql <crm_opportunity>($"SELECT s.id,p.name from crm_sales_order s INNER JOIN crm_opportunity p on s.opportunity_id = p.id where s.delete_time = 0 and p.delete_time =0 and s.contact_id = {conId.ToString()} ");
            if (saleList != null && saleList.Count > 0)
            {
                saleList.ForEach(_ =>
                {
                    html.Append($"<tr><td style='padding-left: 10px; font-weight:normal;'>{_.name}</td></tr>");
                });
            }
            else
            {
                html.Append($"<tr><td class='errorSmall' align='left' style='padding-left:10px;text-align:left;font-weight :normal;'>该联系人下没有销售订单</td></tr>");
            }

            #endregion


            #region  待办信息
            html.Append("<tr><td align='left' style='padding-top:20px;'>待办</td></tr>");
            List <com_activity> todoList = new ActivityBLL().GetToListBySql($"select id,name,description from com_activity where delete_time =0 and cate_id = {(int)DicEnum.ACTIVITY_CATE.TODO} and contact_id = {conId.ToString()} and (status_id <> {(int)DicEnum.ACTIVITY_STATUS.COMPLETED} or status_id is null)");
            if (todoList != null && todoList.Count > 0)
            {
                todoList.ForEach(_ =>
                {
                    html.Append($"<tr><td style='padding-left: 10px; font-weight:normal;'>{_.description}</td></tr>");
                });
            }
            else
            {
                html.Append($"<tr><td class='errorSmall' align='left' style='padding-left:10px;text-align:left;font-weight :normal;'>该联系人下没有待办</td></tr>");
            }
            #endregion

            #region  活动信息
            html.Append("<tr><td align='left' style='padding-top:20px;'>活动</td></tr>");
            List <com_activity> actList = new ActivityBLL().GetToListBySql($"select id,name,description from com_activity where delete_time =0 and cate_id <> {(int)DicEnum.ACTIVITY_CATE.TODO} and contact_id = {conId.ToString()} and (status_id <> {(int)DicEnum.ACTIVITY_STATUS.COMPLETED} or status_id is null)");

            if (actList != null && actList.Count > 0)
            {
                actList.ForEach(_ =>
                {
                    html.Append($"<tr><td style='padding-left: 10px; font-weight:normal;'>{_.description}</td></tr>");
                });
            }
            else
            {
                html.Append($"<tr><td class='errorSmall' align='left' style='padding-left:10px;text-align:left;font-weight :normal;'>该联系人下没有活动</td></tr>");
            }

            #endregion



            #region 工单信息
            html.Append("<tr><td align='left' style='padding-top:20px;'>工单</td></tr>");
            List <sdk_task> ticketList = accBll.GetBySql <sdk_task>($"SELECT id from sdk_task where type_id = 1809 and delete_time = 0 and contact_id =  {conId.ToString()}");
            if (ticketList != null && ticketList.Count > 0)
            {
                ticketList.ForEach(_ =>
                {
                    html.Append($"<tr><td style='padding-left: 10px; font-weight:normal;'>{_.no}-{_.title}</td></tr>");
                });
            }
            else
            {
                html.Append($"<tr><td class='errorSmall' align='left' style='padding-left:10px;text-align:left;font-weight :normal;'>该联系人下没有工单</td></tr>");
            }
            #endregion

            #region 调查问卷信息

            #endregion

            #region 任务信息
            html.Append("<tr><td align='left' style='padding-top:20px;'>任务</td></tr>");
            List <sdk_task> taskList = accBll.GetBySql <sdk_task>($"SELECT t.id,t.title,p.name as description from sdk_task t INNER JOIN pro_project p where t.type_id = 1807 and t.delete_time = 0 and p.delete_time =0 and t.contact_id =   {conId.ToString()}");
            //
            if (taskList != null && taskList.Count > 0)
            {
                taskList.ForEach(_ =>
                {
                    html.Append($"<tr><td style='padding-left:10px;'>项目:&nbsp;<span style='font-weight :normal;'>{_.description}</span> <br>&nbsp; &nbsp; 任务: &nbsp;< span style='font-weight :normal;'>{_.title}</span></td></tr>");
                });
            }
            else
            {
                html.Append($"<tr><td class='errorSmall' align='left' style='padding-left:10px;text-align:left;font-weight :normal;'>该联系人下没有任务</td></tr>");
            }

            #endregion

            #region 联系人群组信息
            html.Append("<tr><td align='left' style='padding-top:20px;'>联系人群组</td></tr>");
            List <crm_contact_group> groupList = accBll.GetBySql <crm_contact_group>($"SELECT ccg.* from crm_contact_group ccg INNER JOIN crm_contact_group_contact ccgc on ccg.id = ccgc.contact_group_id where ccg.delete_time =0 and ccgc.delete_time = 0 and ccgc.contact_id =  {conId.ToString()}");
            if (groupList != null && groupList.Count > 0)
            {
                groupList.ForEach(_ =>
                {
                    html.Append($"<tr><td style='padding-left: 10px; font-weight:normal;'>{_.name}</td></tr>");
                });
            }
            else
            {
                html.Append($"<tr><td class='errorSmall' align='left' style='padding-left:10px;text-align:left;font-weight :normal;'>该联系人下没有联系人群组</td></tr>");
            }

            #endregion

            #region 合同信息
            html.Append("<tr><td align='left' style='padding-top:20px;'>合同</td></tr>");
            List <ctt_contract> contractList = accBll.GetBySql <ctt_contract>($"SELECT id, name from ctt_contract where delete_time = 0 and contact_id = { conId.ToString()}");
            if (contractList != null && contractList.Count > 0)
            {
                contractList.ForEach(_ =>
                {
                    html.Append($"<tr><td style='padding-left: 10px; font-weight:normal;'>{_.name}</td></tr>");
                });
            }
            else
            {
                html.Append($"<tr><td class='errorSmall' align='left' style='padding-left:10px;text-align:left;font-weight :normal;'>该联系人下没有合同</td></tr>");
            }
            #endregion

            html.Append("</tbody></table></div>");
            html.Append("</div>");

            return(html.ToString());
        }