username@email.com
2022-12-16 6108fe7c4f3a329e8d309d00ee0b1761b8c5ad8f
zhengcaioa/Services/IntentionCustomerService.cs
@@ -3,6 +3,7 @@
using System.Linq;
using System.Text;
using AutoMapper;
using CommonToolsCore;
using DTO;
using IServices;
using Microsoft.AspNetCore.Mvc.Rendering;
@@ -100,10 +101,20 @@
                    updateproject.Weixiner = intentionCustomer.Weixiner;
                    updateproject.Weixintime = intentionCustomer.Weixintime;
                    if (!string.IsNullOrEmpty(intentionCustomer.HuiyuanId))
                    {
                        updateproject.HuiyuanId = intentionCustomer.HuiyuanId;
                    }
                }
            _context.SaveChanges();
            resultEntity.ReturnID = intentionCustomer.Id;
                var listPosition = _context.IntentionCustomers.Where(r => r.RecStatus == "A").ToList();
              var  intentionCustomerDTOs = _mapper.Map<List<IntentionCustomerDTO>>(listPosition);
                CacheHelperNetCore.CacheInsert("intentionCustomerDTOs", intentionCustomerDTOs);
                resultEntity.ReturnID = intentionCustomer.Id;
            resultEntity.Result = true;
        }
        catch (Exception ex)
@@ -281,6 +292,7 @@
                         Modifier = a.Modifier,
                         Modifytime = a.Modifytime,
                         CreatetimeName = a.Createtime.ToString("yyyy-MM-dd"),
                         Customertype = "档案客户",
                                 Yixiangtime = a.Yixiangtime,
                                 YixiangtimeName = a.Yixiangtime.HasValue? a.Yixiangtime.Value.ToString("yyyy-MM-dd"):"",
                                 Yixiang = a.Yixiang,
@@ -295,6 +307,19 @@
            {
                query = query.Where( a=>a.Shifoutianjiaweixin == searchEntity.Shifouweixin.Trim()).ToList();
            }
            if (!string.IsNullOrWhiteSpace(searchEntity.ShifouDianhua))
            {
                if (searchEntity.ShifouDianhua != "A")
                {
                    query = query.Where(a => a.Tel == null ||  a.Tel == "").ToList();
                }
                else
                {
                    query = query.Where(a => a.Tel != null && a.Tel != "").ToList();
                }
            }
        //if (searchEntity.totalrows == 0)
            searchEntity.totalrows = query.Count();
@@ -336,10 +361,17 @@
        /// <returns></returns>
        public List<IntentionCustomerDTO> GetList()
        {
            List<IntentionCustomerDTO> intentionCustomerDTOs = (List<IntentionCustomerDTO>)CacheHelperNetCore.CacheValue("intentionCustomerDTOs");
            if (intentionCustomerDTOs != null && intentionCustomerDTOs.Count > 0)
            {
                return intentionCustomerDTOs;
            }
            var listPosition = _context.IntentionCustomers.Where(r => r.RecStatus == "A").ToList();
            intentionCustomerDTOs = _mapper.Map<List<IntentionCustomerDTO>>(listPosition);
            CacheHelperNetCore.CacheInsert("intentionCustomerDTOs", intentionCustomerDTOs);
            var list = _mapper.Map<List<IntentionCustomerDTO>>(listPosition);
            return list;
        }