From d4a6d65f5e449c3e5464aa18ae97bf8953987217 Mon Sep 17 00:00:00 2001
From: LR-20210131IOQH\Administrator <jackcold@163.com>
Date: 星期二, 10 八月 2021 15:44:14 +0800
Subject: [PATCH] Merge branch 'master' of http://47.108.235.38:8080/r/zhengcaioa

---
 zhengcaioa/zhengcaioa/Controllers/Customer/IntentionCustomerController.cs |  161 +++++++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 137 insertions(+), 24 deletions(-)

diff --git a/zhengcaioa/zhengcaioa/Controllers/Customer/IntentionCustomerController.cs b/zhengcaioa/zhengcaioa/Controllers/Customer/IntentionCustomerController.cs
index d7b9f68..9393781 100644
--- a/zhengcaioa/zhengcaioa/Controllers/Customer/IntentionCustomerController.cs
+++ b/zhengcaioa/zhengcaioa/Controllers/Customer/IntentionCustomerController.cs
@@ -15,6 +15,7 @@
 using System.Threading.Tasks;
 using zhengcaioa.Models;
 using zhengcaioa.IService;
+using System.Transactions;
 
 namespace zhengcaioa.Controllers.Customer
 {
@@ -29,9 +30,11 @@
         private readonly ICooperatecustomCustomerService _cooperatecustomCustomerService;
         private readonly IMapper _mapper;
         private readonly IHrDeptService _hrDeptService;
+        private readonly IPltPageService _pltPageService;
 
 
-        public IntentionCustomerController(ILogger<IntentionCustomerController> logger, IProjectService projectService, ILiaotianService liaotianService, IIntentionCustomerService intentionCustomerService, IUserService userService, ICooperatecustomCustomerService cooperatecustomCustomerService, IMapper mapper, IHrDeptService hrDeptService)
+        public IntentionCustomerController(ILogger<IntentionCustomerController> logger, IProjectService projectService, ILiaotianService liaotianService, IIntentionCustomerService intentionCustomerService, IUserService userService
+            , ICooperatecustomCustomerService cooperatecustomCustomerService, IMapper mapper, IHrDeptService hrDeptService, IPltPageService pltPageService)
         {
             _logger = logger;
             _projectService = projectService;
@@ -41,6 +44,7 @@
             _cooperatecustomCustomerService = cooperatecustomCustomerService;
             _mapper = mapper;
             _hrDeptService = hrDeptService;
+            _pltPageService = pltPageService;
         }
 
         public IActionResult Index()
@@ -113,14 +117,14 @@
 
 
             ViewBag.khlx = _liaotianService.GetSYScode("CooperatecustomCustomer", "khlx").Select(x => new { code = x.CodeSn, label = x.Comments }).ToList();
-            ViewBag.khly = _liaotianService.GetSYScode("CooperatecustomCustomer", "khly").Select(x => new { code = x.CodeSn, label = x.Comments }).ToList();
+            ViewBag.khly = _liaotianService.GetSYScode("IntentionCustomer", "khly").Select(x => new { code = x.CodeSn, label = x.Comments }).ToList();
             ViewBag.hyfl = _liaotianService.GetSYScode("CooperatecustomCustomer", "hyfl").Select(x => new { code = x.CodeSn, label = x.Comments }).ToList();
 
             ViewBag.users = _userService.GetList().Where(x => x.IsYwjl == "A").Select(x => new { code = x.Id, label = x.UserName }).ToList();
 
             ViewBag.Creater = _userService.GetList().Select(x => new { code = x.Id, label = x.UserName }).ToList();
 
-
+            ViewBag.shifou = _liaotianService.GetSYScode("system", "shifou").Select(x => new { code = x.CodeSn, label = x.Comments }).ToList();
 
 
             ViewBag.ShengDropDown = _projectService.Getsheng().Select(x => new { code = x.CodeId, label = x.Name }).ToList();
@@ -132,6 +136,83 @@
         {
             //JsonResult jsonResult =   new JsonResult(_liaotianService.SearchByPaging(search), new Newtonsoft.Json.Serialization.DefaultContractResolver());
             return new JsonResult(_intentionCustomerService.SearchByPaging(search));
+        }
+
+
+        public IActionResult IndexYiXiang()
+        {
+            var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
+            ViewData["curentuser"] = curentuser;
+            List<ActionEntity> actionlist = new List<ActionEntity>();
+           
+
+             
+
+
+           
+
+            List<PageEntity> pageEntities = _pltPageService.GetUserPage(curentuser.Id, "/IntentionCustomer/IndexYiXiang/");
+            foreach(var pageEntity in pageEntities)
+            {
+                ActionEntity actionEntity = new ActionEntity();
+                actionEntity.OpenType = pageEntity.OpenType;
+                actionEntity.ActionUrl = "";
+                actionEntity.ActionFun = pageEntity.PageShortcut;
+                actionEntity.PageIco = pageEntity.PageIco;
+                actionEntity.ActionName = pageEntity.PageName;
+                actionlist.Add(actionEntity);
+            }
+
+            ViewData["ActionInfo"] = actionlist;
+
+
+            ViewBag.khly = _liaotianService.GetSYScode("IntentionCustomer", "khly").Select(x => new { code = x.CodeSn, label = x.Comments }).ToList();
+
+            ViewBag.ywjl = _userService.GetList().Where(x => x.IsYwjl == "A").Select(x => new { code = x.Id, label = x.UserName }).ToList();
+
+            ViewBag.Dianxiaozhuanyuan = _userService.GetList().Select(x => new { code = x.Id, label = x.UserName }).ToList();
+
+
+            ViewBag.ywjlId = curentuser.Id;
+
+            //ViewBag.khlx = _liaotianService.GetSYScode("CooperatecustomCustomer", "khlx").Select(x => new { code = x.CodeSn, label = x.Comments }).ToList();
+
+            //ViewBag.hyfl = _liaotianService.GetSYScode("CooperatecustomCustomer", "hyfl").Select(x => new { code = x.CodeSn, label = x.Comments }).ToList();
+            //ViewBag.ShengDropDown = _projectService.Getsheng().Select(x => new { code = x.CodeId, label = x.Name }).ToList();
+            return View();
+
+        }
+
+        /// <summary>
+        /// 瑙g粦
+        /// </summary>
+        /// <param name="id"></param>
+        /// <returns></returns>
+        [HttpPost]
+        public JsonResult UnBind(string id)
+        {
+            var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
+            ResultEntity resultEntity = new ResultEntity();
+            using (TransactionScope scope = new TransactionScope())
+            {
+                string[] ids = id.Split(',');
+                foreach (var iddd in ids)
+                {
+                    var intentionCustomerDTO = _intentionCustomerService.Get(iddd);
+                    intentionCustomerDTO.Yixiang = null;
+                    intentionCustomerDTO.Yixiangtime = null;
+                    resultEntity =  _intentionCustomerService.save(intentionCustomerDTO);
+                    if (!resultEntity.Result)
+                    {
+                        return new JsonResult(resultEntity);
+                    }
+                }
+
+                  
+                
+                scope.Complete();
+            }
+            return new JsonResult(resultEntity);
         }
 
         public IActionResult Edit(string id = null,string namecus = null)
@@ -162,7 +243,7 @@
             var users = _userService.GetList().Where(x => x.IsYwjl == "A").ToList(); ;
 
             ViewData["khlx"] = _liaotianService.GetSYScode("CooperatecustomCustomer", "khlx");
-            ViewData["khly"] = _liaotianService.GetSYScode("CooperatecustomCustomer", "khly");
+            ViewData["khly"] = _liaotianService.GetSYScode("IntentionCustomer", "khly");
             ViewData["hyfl"] = _liaotianService.GetSYScode("CooperatecustomCustomer", "hyfl");
 
             ViewData["users"] = users;
@@ -195,7 +276,7 @@
             var users = _userService.GetList().Where(x => x.IsYwjl == "A").ToList(); ;
 
             ViewData["khlx"] = _liaotianService.GetSYScode("CooperatecustomCustomer", "khlx");
-            ViewData["khly"] = _liaotianService.GetSYScode("CooperatecustomCustomer", "khly");
+            ViewData["khly"] = _liaotianService.GetSYScode("IntentionCustomer", "khly");
             ViewData["hyfl"] = _liaotianService.GetSYScode("CooperatecustomCustomer", "hyfl");
 
             ViewData["users"] = users;
@@ -222,6 +303,30 @@
             var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
             ViewData["curentuser"] = curentuser;
             data.RecStatus = "A";
+            if (string.IsNullOrEmpty(data.Shifoutianjiaweixin))
+            {
+                data.Shifoutianjiaweixin = "D";
+                data.Weixiner = null;
+                data.Weixintime = null;
+            }
+            else
+            {
+                if (String.IsNullOrEmpty(data.Id))
+                {
+                    data.Weixiner = curentuser.Id;
+                    data.Weixintime = DateTime.Now;
+                }
+                else
+                {
+                    var cooperatecustomCustomerDTO = _intentionCustomerService.Get(data.Id);
+                    if (string.IsNullOrEmpty(cooperatecustomCustomerDTO.Weixiner))
+                    {
+                        data.Weixiner = curentuser.Id;
+                        data.Weixintime = DateTime.Now;
+                    }
+
+                }
+            }
             if (String.IsNullOrEmpty(data.Id))
             {
                 data.Creater = curentuser.Id;
@@ -274,31 +379,39 @@
                 resultEntity.Result = false;
                 resultEntity.Message = "娌℃湁鎵惧埌瀹㈡埛!";
             }
-          
-         
-            if (result != null && result.Count > 0)
+             using(TransactionScope scope = new TransactionScope())
             {
-                for (int i = 0; i < result.Count; i++)
+                if (result != null && result.Count > 0)
                 {
-                    var dto = _mapper.Map<CooperatecustomCustomerDTO>(result[i]);
-                    dto.Id = "";
-                    dto.Creater = curentuser.Id;
-                    dto.Modifier = curentuser.Id;
-                    dto.Createtime = DateTime.Now;
-                    dto.Modifytime = dto.Createtime;
-                    dto.zhuanyi = true;
-                    resultEntity =  _cooperatecustomCustomerService.save(dto);
-                    if (!resultEntity.Result)
+                    for (int i = 0; i < result.Count; i++)
                     {
-                        return new JsonResult(resultEntity);
+
+                        resultEntity = _intentionCustomerService.ModifyStatus(result[i].Id, curentuser.Id);
+                        if (!resultEntity.Result)
+                        {
+                            return new JsonResult(resultEntity);
+                        }
+
+                        var dto = _mapper.Map<CooperatecustomCustomerDTO>(result[i]);
+                        dto.Id = "";
+                        dto.Creater = curentuser.Id;
+                        dto.Modifier = curentuser.Id;
+                        dto.Createtime = DateTime.Now;
+                        dto.Modifytime = dto.Createtime;
+                        dto.zhuanyi = true;
+                        resultEntity = _cooperatecustomCustomerService.save(dto);
+                        if (!resultEntity.Result)
+                        {
+                            return new JsonResult(resultEntity);
+                        }
                     }
                 }
+                
+
+                scope.Complete();
             }
-            else
-            {
-                resultEntity.Result = false;
-                resultEntity.Message = "鏃犺仈绯讳汉鍙风爜";
-            }
+         
+            
 
             
 

--
Gitblit v1.9.1