Browse Source

完善市场客户资料

yuanrf 1 year ago
parent
commit
eee675d2af

+ 13 - 3
OASystem/OASystem.Api/Controllers/MarketCustomerResourcesController.cs

@@ -25,15 +25,25 @@ namespace OASystem.API.Controllers
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
         public async Task<IActionResult> QueryNewClientData(NewClientDataQueryDto dto)
         {
+            JsonView jw = new JsonView();
             try
             {
-                Result resTable = await _clientDataRepository.QueryNewClientData(dto);
-                return Ok(JsonView(true, resTable.Msg, resTable.Data));
+                Result resultData = await _clientDataRepository.QueryNewClientData(dto);
+                if (resultData.Code == 0)
+                {
+                    jw = JsonView(true, resultData.Msg, resultData.Data);
+                }
+                else
+                {
+                    jw = JsonView(false, resultData.Msg, resultData.Data);
+                }
             }
             catch (Exception)
             {
-                return Ok(JsonView(false, "程序错误!"));
+                jw = JsonView(false, "程序错误!");
             }
+
+            return Ok(jw);
         }
         /// <summary>
         /// 客户资料操作(Status:1.新增,2.修改)

+ 3 - 3
OASystem/OASystem.Infrastructure/Repositories/CRM/NewClientDataRepository.cs

@@ -47,7 +47,7 @@ namespace OASystem.Infrastructure.Repositories.CRM
                 #region 负责人
                 if (!string.IsNullOrWhiteSpace(dto.Userid))
                 {
-                    string sql = string.Format(@"select u1.UsersId,u2.CnName,u1.NewClientDataId from Crm_ClientDataAndUser u1,Sys_Users u2 where u1.UsersId=u2.Id and u1.UsersId in ({0})", dto.Userid);
+                    string sql = string.Format(@"select u1.UsersId,u2.CnName,u1.NewClientDataId from Crm_ClientDataAndUser u1,Sys_Users u2 where u1.UsersId=u2.Id and u1.UsersId in ({0})  and u1.IsDel = 0", dto.Userid);
                     List<AscribedUser> ascribedUsers = await _sqlSugar.SqlQueryable<AscribedUser>(sql).ToListAsync();
                     if (ascribedUsers.Count != 0)
                     {
@@ -70,7 +70,7 @@ namespace OASystem.Infrastructure.Repositories.CRM
                 #region 业务归属
                 if (!string.IsNullOrWhiteSpace(dto.Business))
                 {
-                    string sql = string.Format(@"select d1.*,d2.Name from Crm_ClientDataAndBusiness d1,Sys_SetData d2 where d1.SetDataId=d2.Id and d1.SetDataId in ({0})", dto.Business);
+                    string sql = string.Format(@"select d1.*,d2.Name from Crm_ClientDataAndBusiness d1,Sys_SetData d2 where d1.SetDataId=d2.Id and d1.SetDataId in ({0}) and d1.isdel = 0", dto.Business);
                     List<AscribedDepartment> AscribedDepartment = await _sqlSugar.SqlQueryable<AscribedDepartment>(sql).ToListAsync();
                     if (AscribedDepartment.Count != 0)
                     {
@@ -294,7 +294,7 @@ namespace OASystem.Infrastructure.Repositories.CRM
                         List<dynamic> _ServiceClass = new List<dynamic>();
                         List<Sys_SetData> ServiceClass = _sqlSugar.Queryable<Sys_SetData>()
                         .Where(u => u.STid == 36 && u.IsDel == 0).ToList();
-                        foreach (Sys_SetData item in province)
+                        foreach (Sys_SetData item in ServiceClass)
                         {
                             var data = new
                             {