From f7a2d28869cc31c7dbe057a1d80dd40536d97fed Mon Sep 17 00:00:00 2001 From: username@email.com <yzy2002yzy@163.com> Date: 星期三, 08 三月 2023 15:45:33 +0800 Subject: [PATCH] 业务经理查询客户接口 --- zhengcaioa/zhengcaioa/Controllers/BusinessOrder/OrderBanciOrderController.cs | 2 zhengcaioa/zhengcaioa/Controllers/Expert/ZhuanjiahuidaController.cs | 4 zhengcaioa/IServices/IIntentionCustomerService.cs | 3 zhengcaioa/Services/CooperatecustomCustomerService.cs | 371 ++++++++++++++++++++++++ zhengcaioa/zhengcaioa/Controllers/ProjectController.cs | 2 zhengcaioa/zhengcaioa/Timer/TimedBackgroundService.cs | 2 zhengcaioa/Services/IntentionCustomerService.cs | 37 ++ zhengcaioa/zhengcaioa/Controllers/UserController.cs | 2 zhengcaioa/zhengcaioa/Controllers/APIController.cs | 456 ++++++++++++++++++++++++++++++ zhengcaioa/IServices/ICooperatecustomCustomerService.cs | 5 zhengcaioa/zhengcaioa/Controllers/BusinessOrder/CooperOrderController.cs | 2 11 files changed, 877 insertions(+), 9 deletions(-) diff --git a/zhengcaioa/IServices/ICooperatecustomCustomerService.cs b/zhengcaioa/IServices/ICooperatecustomCustomerService.cs index 7d00cf5..d289062 100644 --- a/zhengcaioa/IServices/ICooperatecustomCustomerService.cs +++ b/zhengcaioa/IServices/ICooperatecustomCustomerService.cs @@ -36,5 +36,10 @@ List<CooperatecustomCustomerDTO> GetListCustomerGuanlian(string CustomerId); CustomerGuanlianDTO GetCustomerGuanlian(string CustomerId,string SecCustomerId); + + + ResultDataEntity<CooperatecustomCustomerDTO> SearchByPagingAll(CooperatecustomCustomerDTOSearch searchEntity); + + ResultEntity saveKhlx(CooperatecustomCustomerDTO cooperatecustomCustomerDTO); } } diff --git a/zhengcaioa/IServices/IIntentionCustomerService.cs b/zhengcaioa/IServices/IIntentionCustomerService.cs index d9787b4..994ff8b 100644 --- a/zhengcaioa/IServices/IIntentionCustomerService.cs +++ b/zhengcaioa/IServices/IIntentionCustomerService.cs @@ -37,5 +37,8 @@ List<IntentionCustomerDTO> GetListsalaryyixiang(string userid, DateTime datemin, DateTime datemax); + + ResultEntity saveKhlx(CooperatecustomCustomerDTO cooperatecustomCustomerDTO); + } } diff --git a/zhengcaioa/Services/CooperatecustomCustomerService.cs b/zhengcaioa/Services/CooperatecustomCustomerService.cs index aaef706..c4bee87 100644 --- a/zhengcaioa/Services/CooperatecustomCustomerService.cs +++ b/zhengcaioa/Services/CooperatecustomCustomerService.cs @@ -195,7 +195,7 @@ { var entity = _context.CooperatecustomCustomers.Find(id); - if(entity.RecStatus != "A") + if(entity == null || entity.RecStatus != "A") { entity = new CooperatecustomCustomer(); } @@ -666,5 +666,374 @@ } return cooperatecustomCustomerDTOs; } + + + public ResultDataEntity<CooperatecustomCustomerDTO> SearchByPagingAll(CooperatecustomCustomerDTOSearch searchEntity) + { + + + + ResultDataEntity<CooperatecustomCustomerDTO> data = new ResultDataEntity<CooperatecustomCustomerDTO>(); + List<CooperatecustomCustomerDTO> list = new List<CooperatecustomCustomerDTO>(); + + + + + var listCode = (from a in _context.SysCodeDtls + join b in _context.SysCodes + on a.CodeId equals b.Id + where a.RecStatus == "A" + && b.RecStatus == "A" + select new CodeDataEntity() + { + CodeId = b.Id, + CodeTable = b.CodeTable, + CodeField = b.CodeField, + CodeSn = a.CodeSn, + Comments = a.Comments, + Contents = a.Contents, + RecStatus = a.RecStatus, + Sort = a.Sort + } + ); + + + DateTime Createtimestart = DateTime.Now; + DateTime Createtimeend = DateTime.Now; + if (!string.IsNullOrWhiteSpace(searchEntity.Createtime)) + { + string[] Createtimes = searchEntity.Createtime.Split("|"); + DateTime.TryParse(Createtimes[0], out Createtimestart); + DateTime.TryParse(Createtimes[1], out Createtimeend); + Createtimeend = Createtimeend.AddDays(1); + } + + + var query = (from a in _context.CooperatecustomCustomers + join b in listCode.Where(x => x.CodeTable == "CooperatecustomCustomer" && x.CodeField == "khly") + on a.Khly equals b.CodeSn + into bsss + from bbb in bsss.DefaultIfEmpty() + + join c in listCode.Where(x => x.CodeTable == "CooperatecustomCustomer" && x.CodeField == "hyfl") + on a.Hyfl equals c.CodeSn + into csss + from ccc in csss.DefaultIfEmpty() + + join d in listCode.Where(x => x.CodeTable == "CooperatecustomCustomer" && x.CodeField == "khlx") + on a.Khlx equals d.CodeSn + into dsss + from ddd in dsss.DefaultIfEmpty() + + + join e in _context.PltUsers.Where(x => x.RecStatus == "A" && x.Zhiwustatus == "A" && x.IsYwjl == "A") + on a.Ywjl equals e.Id + into esss + from abi in esss.DefaultIfEmpty() + + + join i in _context.CooperOrders.Where(x => x.RecStatus == "A" && x.ChedanStatus != "A").GroupBy(q => new { q.Khdw }).Select(q => new + { + Khdw = q.Key.Khdw, + Moneycount = q.Sum(i => i.Money), + Ordercount = q.Count(), + } + ) + on a.Id equals i.Khdw + into isss + from iii in isss.DefaultIfEmpty() + + + + join f in _context.Areas on a.Sheng equals f.CodeId + into fsss + from fff in fsss.DefaultIfEmpty() + + + join g in _context.Areas on a.City equals g.CodeId + into gsss + from ggg in gsss.DefaultIfEmpty() + + + join h in _context.Areas on a.AreaId equals h.CodeId + into hsss + from hhh in hsss.DefaultIfEmpty() + + + + where a.RecStatus == "A" + && (string.IsNullOrWhiteSpace(searchEntity.Createtime) || (a.Createtime >= Createtimestart && a.Createtime <= Createtimeend)) + && (string.IsNullOrWhiteSpace(searchEntity.Name) || a.Name.Contains(searchEntity.Name.Trim())) + && (string.IsNullOrWhiteSpace(searchEntity.Khly) || a.Khly == searchEntity.Khly.Trim()) + && (string.IsNullOrWhiteSpace(searchEntity.Hyfl) || a.Hyfl == searchEntity.Hyfl.Trim()) + && (string.IsNullOrWhiteSpace(searchEntity.Khlx) || a.Khlx == searchEntity.Khlx.Trim()) + //&& (string.IsNullOrWhiteSpace(searchEntity.Ywjl) || a.Ywjl == searchEntity.Ywjl.Trim()) + && (string.IsNullOrWhiteSpace(searchEntity.Sheng) || a.Sheng == searchEntity.Sheng.Trim()) + && (string.IsNullOrWhiteSpace(searchEntity.City) || a.City == searchEntity.City.Trim()) + && (string.IsNullOrWhiteSpace(searchEntity.AreaId) || a.AreaId == searchEntity.AreaId.Trim()) + && (string.IsNullOrWhiteSpace(searchEntity.Shifouweixin) || a.Shifoutianjiaweixin == searchEntity.Shifouweixin.Trim()) + && (string.IsNullOrWhiteSpace(searchEntity.HuiyuanId) || a.HuiyuanId == searchEntity.HuiyuanId.Trim()) + + select new CooperatecustomCustomerDTO + { + Id = a.Id, + Sheng = a.Sheng, + City = a.City, + AreaId = a.AreaId, + Khly = a.Khly, + Hyfl = a.Hyfl, + Khlx = a.Khlx, + Ywjl = a.Ywjl, + ShengName = fff.Name + "-" + ggg.Name + "-" + hhh.Name, + CityName = ggg.Name, + AreaIdName = hhh.Name, + KhlyName = bbb.Comments, + HyflName = ccc.Comments, + KhlxName = ddd.Comments, + YwjlName = abi.UserName, + Name = a.Name, + Postal = a.Postal, + Address = a.Address, + Url = a.Url, + Tel = a.Tel, + Ordercount = iii.Ordercount.ToString(), + Moneycount = iii.Moneycount.ToString(), + Moneycountde = iii.Moneycount, + Phone = a.Phone, + Qq = a.Qq, + Email = a.Email, + FName = a.FName, + FTel = a.FTel, + + FQq = a.FQq, + YwName = a.YwName, + YwTel = a.YwTel, + YwQq = a.YwQq, + JgCode = a.JgCode, + Khh = a.Khh, + Count = a.Count, + ShrName = a.ShrName, + ShrTel = a.ShrTel, + ShrAddress = a.ShrAddress, + Remark = a.Remark, + + RecStatus = a.RecStatus, + Modifier = a.Modifier, + Modifytime = a.Modifytime, + CreatetimeName = a.Createtime.ToString("yyyy-MM-dd"), + Weixin = a.Weixin, + Shifoutianjiaweixin = a.Shifoutianjiaweixin, + HuiyuanId = a.HuiyuanId, + Weixiner = a.Weixiner, + Weixintime = a.Weixintime, + Yufukuan = a.Yufukuan ?? 0, + Shouxinedu = a.Shouxinedu ?? 0, + Shenyushouxin = a.Shenyushouxin ?? 0, + YufukuanName = a.Yufukuan.HasValue ? a.Yufukuan.Value.ToString("f2") : "", + ShouxineduName = a.Shouxinedu.HasValue ? a.Shouxinedu.Value.ToString("f2") : "", + ShenyushouxinName = a.Shenyushouxin.HasValue ? a.Shenyushouxin.Value.ToString("f2") : "", + Taocanjianshu = a.Taocanjianshu ?? 0, + Customertype = "鍚堜綔瀹㈡埛", + } + ); + + if (!string.IsNullOrWhiteSpace(searchEntity.Ywjl)) + { + if (searchEntity.Ywjl != "11111") + { + query = query.Where(a => a.Ywjl == searchEntity.Ywjl.Trim()); + } + else + { + query = query.Where(a => a.Ywjl == null); + } + } + + + + var queryinter = (from a in _context.IntentionCustomers + join b in listCode.Where(x => x.CodeTable == "CooperatecustomCustomer" && x.CodeField == "khly") + on a.Khly equals b.CodeSn + into bsss + from bbb in bsss.DefaultIfEmpty() + + join c in listCode.Where(x => x.CodeTable == "CooperatecustomCustomer" && x.CodeField == "hyfl") + on a.Hyfl equals c.CodeSn + into csss + from ccc in csss.DefaultIfEmpty() + + join d in listCode.Where(x => x.CodeTable == "CooperatecustomCustomer" && x.CodeField == "khlx") + on a.Khlx equals d.CodeSn + into dsss + from ddd in dsss.DefaultIfEmpty() + + + join e in _context.PltUsers.Where(x => x.RecStatus == "A" && x.Zhiwustatus == "A" && x.IsYwjl == "A") + on a.Ywjl equals e.Id + into esss + from abi in esss.DefaultIfEmpty() + + + join i in _context.CooperOrders.Where(x => x.RecStatus == "A" && x.ChedanStatus != "A").GroupBy(q => new { q.Khdw }).Select(q => new + { + Khdw = q.Key.Khdw, + Moneycount = q.Sum(i => i.Money), + Ordercount = q.Count(), + } + ) + on a.Id equals i.Khdw + into isss + from iii in isss.DefaultIfEmpty() + + + + join f in _context.Areas on a.Sheng equals f.CodeId + into fsss + from fff in fsss.DefaultIfEmpty() + + + join g in _context.Areas on a.City equals g.CodeId + into gsss + from ggg in gsss.DefaultIfEmpty() + + + join h in _context.Areas on a.AreaId equals h.CodeId + into hsss + from hhh in hsss.DefaultIfEmpty() + + + + where a.RecStatus == "A" + && (string.IsNullOrWhiteSpace(searchEntity.Createtime) || (a.Createtime >= Createtimestart && a.Createtime <= Createtimeend)) + && (string.IsNullOrWhiteSpace(searchEntity.Name) || a.Name.Contains(searchEntity.Name.Trim())) + && (string.IsNullOrWhiteSpace(searchEntity.Khly) || a.Khly == searchEntity.Khly.Trim()) + && (string.IsNullOrWhiteSpace(searchEntity.Hyfl) || a.Hyfl == searchEntity.Hyfl.Trim()) + && (string.IsNullOrWhiteSpace(searchEntity.Khlx) || a.Khlx == searchEntity.Khlx.Trim()) + //&& (string.IsNullOrWhiteSpace(searchEntity.Ywjl) || a.Ywjl == searchEntity.Ywjl.Trim()) + && (string.IsNullOrWhiteSpace(searchEntity.Sheng) || a.Sheng == searchEntity.Sheng.Trim()) + && (string.IsNullOrWhiteSpace(searchEntity.City) || a.City == searchEntity.City.Trim()) + && (string.IsNullOrWhiteSpace(searchEntity.AreaId) || a.AreaId == searchEntity.AreaId.Trim()) + && (string.IsNullOrWhiteSpace(searchEntity.Shifouweixin) || a.Shifoutianjiaweixin == searchEntity.Shifouweixin.Trim()) + && (string.IsNullOrWhiteSpace(searchEntity.HuiyuanId) || a.HuiyuanId == searchEntity.HuiyuanId.Trim()) + + select new CooperatecustomCustomerDTO + { + Id = a.Id, + Sheng = a.Sheng, + City = a.City, + AreaId = a.AreaId, + Khly = a.Khly, + Hyfl = a.Hyfl, + Khlx = a.Khlx, + Ywjl = a.Ywjl, + ShengName = fff.Name + "-" + ggg.Name + "-" + hhh.Name, + CityName = ggg.Name, + AreaIdName = hhh.Name, + KhlyName = bbb.Comments, + HyflName = ccc.Comments, + KhlxName = ddd.Comments, + YwjlName = abi.UserName, + Name = a.Name, + Postal = a.Postal, + Address = a.Address, + Url = a.Url, + Tel = a.Tel, + Ordercount = iii.Ordercount.ToString(), + Moneycount = iii.Moneycount.ToString(), + Moneycountde = iii.Moneycount, + Phone = a.Phone, + Qq = a.Qq, + Email = a.Email, + FName = a.FName, + FTel = a.FTel, + + FQq = a.FQq, + YwName = a.YwName, + YwTel = a.YwTel, + YwQq = a.YwQq, + JgCode = a.JgCode, + Khh = a.Khh, + Count = a.Count, + ShrName = a.ShrName, + ShrTel = a.ShrTel, + ShrAddress = a.ShrAddress, + Remark = a.Remark, + + RecStatus = a.RecStatus, + Modifier = a.Modifier, + Modifytime = a.Modifytime, + CreatetimeName = a.Createtime.ToString("yyyy-MM-dd"), + Weixin = a.Weixin, + Shifoutianjiaweixin = a.Shifoutianjiaweixin, + HuiyuanId = a.HuiyuanId, + Weixiner = a.Weixiner, + Weixintime = a.Weixintime, + Customertype = "妗f瀹㈡埛", + } + ); + + if (!string.IsNullOrWhiteSpace(searchEntity.Ywjl)) + { + if (searchEntity.Ywjl != "11111") + { + queryinter = queryinter.Where(a => a.Ywjl == searchEntity.Ywjl.Trim()); + } + else + { + queryinter = queryinter.Where(a => a.Ywjl == null); + } + } + var chaxun = query.ToList().Union(queryinter.ToList()); + + + + searchEntity.totalrows = chaxun.Count(); + + var lianlist = chaxun.OrderByDescending(x => x.Modifytime).Skip((searchEntity.page - 1) * searchEntity.rows).Take(searchEntity.rows).ToList(); + + + + + + + data.LoadData(searchEntity, lianlist); + return data; + } + + + public ResultEntity saveKhlx(CooperatecustomCustomerDTO cooperatecustomCustomerDTO) + { + ResultEntity resultEntity = new ResultEntity(); + try + { + + + + + + + var updateproject = _context.CooperatecustomCustomers.Find(cooperatecustomCustomerDTO.Id); + + + updateproject.Khlx = cooperatecustomCustomerDTO.Khlx; + + updateproject.Modifier = cooperatecustomCustomerDTO.Modifier; + updateproject.Modifytime = cooperatecustomCustomerDTO.Modifytime; + + + _context.SaveChanges(); + + + resultEntity.ReturnID = cooperatecustomCustomerDTO.Id; + resultEntity.Result = true; + } + catch (Exception ex) + { + resultEntity.Result = false; + resultEntity.Message = "淇濆瓨澶辫触锛岃鑱旂郴绠$悊鍛�"; + + } + return resultEntity; + } } } diff --git a/zhengcaioa/Services/IntentionCustomerService.cs b/zhengcaioa/Services/IntentionCustomerService.cs index 29c77ff..883d620 100644 --- a/zhengcaioa/Services/IntentionCustomerService.cs +++ b/zhengcaioa/Services/IntentionCustomerService.cs @@ -162,7 +162,7 @@ var entity = _context.IntentionCustomers.Find(id); - if (entity.RecStatus != "A") + if (entity ==null || entity.RecStatus != "A") { entity = new IntentionCustomer(); } @@ -592,5 +592,40 @@ return list; } + public ResultEntity saveKhlx(CooperatecustomCustomerDTO cooperatecustomCustomerDTO) + { + ResultEntity resultEntity = new ResultEntity(); + try + { + + + + + + + var updateproject = _context.IntentionCustomers.Find(cooperatecustomCustomerDTO.Id); + + + updateproject.Khlx = cooperatecustomCustomerDTO.Khlx; + + updateproject.Modifier = cooperatecustomCustomerDTO.Modifier; + updateproject.Modifytime = cooperatecustomCustomerDTO.Modifytime; + + + _context.SaveChanges(); + + + resultEntity.ReturnID = cooperatecustomCustomerDTO.Id; + resultEntity.Result = true; + } + catch (Exception ex) + { + resultEntity.Result = false; + resultEntity.Message = "淇濆瓨澶辫触锛岃鑱旂郴绠$悊鍛�"; + + } + return resultEntity; + } + } } diff --git a/zhengcaioa/zhengcaioa/Controllers/APIController.cs b/zhengcaioa/zhengcaioa/Controllers/APIController.cs new file mode 100644 index 0000000..906e412 --- /dev/null +++ b/zhengcaioa/zhengcaioa/Controllers/APIController.cs @@ -0,0 +1,456 @@ +锘縰sing DTO; +using IServices; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Logging; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.IdentityModel.Tokens.Jwt; +using System.Linq; +using System.Text.RegularExpressions; +using System.Threading.Tasks; +using System.Transactions; +using zhengcaioa.IService; +using zhengcaioa.Models; + +namespace zhengcaioa.Controllers +{ + public class APIController : Controller + { + + private readonly ILogger<UserController> _logger; + private readonly IUserService _userService; + private readonly IHrDeptService _hrDeptService; + private readonly IHrPositionService _hrPositionService; + private readonly ILiaotianService _liaotianService; + private readonly IPltJiatingchengyuanService _pltJiatingchengyuanService; + private readonly ISysAttachmentService _sysAttachmentService; + private readonly IPltRoleService _pltRoleService; + private readonly IPltPageService _pltPageService; + private readonly ICooperatecustomCustomerService _cooperatecustomCustomerService; + private readonly IIntentionCustomerService _intentionCustomerService; + private readonly ICooperVisitService _cooperVisitService; + private readonly IIntentionVisitService _intentionVisitService; + + + public APIController(ILogger<UserController> logger, IUserService userService, IHrDeptService hrDeptService, IHrPositionService hrPositionService, ILiaotianService liaotianService, IPltJiatingchengyuanService pltJiatingchengyuanService, ISysAttachmentService sysAttachmentService + , IPltRoleService pltRoleService + , IPltPageService pltPageService + , ICooperatecustomCustomerService cooperatecustomCustomerService + , IIntentionCustomerService intentionCustomerService + , ICooperVisitService cooperVisitService + , IIntentionVisitService intentionVisitService) + { + _logger = logger; + _userService = userService; + _hrDeptService = hrDeptService; + _hrPositionService = hrPositionService; + _liaotianService = liaotianService; + _pltJiatingchengyuanService = pltJiatingchengyuanService; + _sysAttachmentService = sysAttachmentService; + _pltRoleService = pltRoleService; + _pltPageService = pltPageService; + _cooperatecustomCustomerService = cooperatecustomCustomerService; + _intentionCustomerService = intentionCustomerService; + _cooperVisitService = cooperVisitService; + _intentionVisitService = intentionVisitService; + } + + + //鑾峰彇鏌愪釜瀹㈡埛缁忕悊鐨勬墍鏈夊鎴� + + // 鍒嗛〉锛屾煡璇㈡潯浠� 瀹㈡埛鍚嶇О 瀹㈡埛绫诲瀷 + + // 瀹㈡埛鎰忓悜 鏌ヨ 瀹㈡埛绫诲瀷 鏌ヨ + + //濉啓瀹㈡埛鎰忓悜 + //鐢宠涓嬭娴侀噺鍖� + + + //鑾峰彇瀹㈡埛绫诲瀷 + public IActionResult GetKhlx() + { + ReturnMsg<List<SysCodeDtl>> returnMsg = new ReturnMsg<List<SysCodeDtl>>(); + returnMsg.code = 2; + try + { + string userid = ""; + string usersn = "";//瀹㈡埛缁忕悊鐧诲綍鍚� + var headers = Request.Headers; + if (headers != null) + { + //string SecurityKey = _configuration.GetSection("SecurityKey").Value; + var keyId = headers["Authorization"].FirstOrDefault(); + if (string.IsNullOrEmpty(keyId)) + { + returnMsg.code = 2; + returnMsg.error = "娌℃湁鑾峰彇鍒皌oken"; + returnMsg.count = 0; + + return new JsonResult(returnMsg); + } + + + JwtSecurityToken jwt = null; + var handler = new JwtSecurityTokenHandler(); + var key1 = keyId.Replace("Bearer", "").Trim(); + jwt = handler.ReadJwtToken(key1); + System.Security.Claims.Claim sss = jwt.Claims.Where(x => x.Type == "id").FirstOrDefault(); + userid = sss.Value; + System.Security.Claims.Claim ssss = jwt.Claims.Where(x => x.Type == "sub").FirstOrDefault(); + usersn = ssss.Value; + } + + var aaaaa = _liaotianService.GetSYScode("CooperatecustomCustomer", "khlx"); + returnMsg.code = 1; + returnMsg.returnObj = aaaaa; + returnMsg.count = aaaaa.Count; + + + + } + catch (Exception ex) + { + returnMsg.code = 2; + returnMsg.error = "娌℃湁鑾峰彇鍒皌oken"; + returnMsg.count = 0; + + } + return new JsonResult(returnMsg); + } + + + //鑾峰彇瀹㈡埛鎴愪氦鎰忓悜 + public IActionResult GetCjyx() + { + ReturnMsg<List<SysCodeDtl>> returnMsg = new ReturnMsg<List<SysCodeDtl>>(); + returnMsg.code = 2; + try + { + string userid = ""; + string usersn = "";//瀹㈡埛缁忕悊鐧诲綍鍚� + var headers = Request.Headers; + if (headers != null) + { + //string SecurityKey = _configuration.GetSection("SecurityKey").Value; + var keyId = headers["Authorization"].FirstOrDefault(); + if (string.IsNullOrEmpty(keyId)) + { + returnMsg.code = 2; + returnMsg.error = "娌℃湁鑾峰彇鍒皌oken"; + returnMsg.count = 0; + + return new JsonResult(returnMsg); + } + + + JwtSecurityToken jwt = null; + var handler = new JwtSecurityTokenHandler(); + var key1 = keyId.Replace("Bearer", "").Trim(); + jwt = handler.ReadJwtToken(key1); + System.Security.Claims.Claim sss = jwt.Claims.Where(x => x.Type == "id").FirstOrDefault(); + userid = sss.Value; + System.Security.Claims.Claim ssss = jwt.Claims.Where(x => x.Type == "sub").FirstOrDefault(); + usersn = ssss.Value; + } + + var aaaaa = _liaotianService.GetSYScode("CooperVisit", "yx"); + returnMsg.code = 1; + returnMsg.returnObj = aaaaa; + returnMsg.count = aaaaa.Count; + + + + } + catch (Exception ex) + { + returnMsg.code = 2; + returnMsg.error = "娌℃湁鑾峰彇鍒皌oken"; + returnMsg.count = 0; + + } + return new JsonResult(returnMsg); + } + + + //鑾峰彇瀹㈡埛缁忕悊瀹㈡埛 + public IActionResult GetCustomer([FromBody]CooperatecustomCustomerDTOSearch search) + { + ReturnMsg<List<CooperatecustomCustomerDTO>> returnMsg = new ReturnMsg<List<CooperatecustomCustomerDTO>>(); + returnMsg.code = 2; + try + { + string userid = ""; + string usersn = "";//瀹㈡埛缁忕悊鐧诲綍鍚� + var headers = Request.Headers; + if (headers != null) + { + //string SecurityKey = _configuration.GetSection("SecurityKey").Value; + var keyId = headers["Authorization"].FirstOrDefault(); + if (string.IsNullOrEmpty(keyId)) + { + returnMsg.code = 2; + returnMsg.error = "娌℃湁鑾峰彇鍒皌oken"; + returnMsg.count = 0; + + return new JsonResult(returnMsg); + } + + + JwtSecurityToken jwt = null; + var handler = new JwtSecurityTokenHandler(); + var key1 = keyId.Replace("Bearer", "").Trim(); + jwt = handler.ReadJwtToken(key1); + System.Security.Claims.Claim sss = jwt.Claims.Where(x => x.Type == "id").FirstOrDefault(); + userid = sss.Value; + System.Security.Claims.Claim ssss = jwt.Claims.Where(x => x.Type == "sub").FirstOrDefault(); + usersn = ssss.Value; + } + + var aaaaa = _userService.GetList().Where(x=>x.UserSn == usersn).FirstOrDefault(); + if (aaaaa == null) + { + returnMsg.code = 2; + returnMsg.error = "娌℃湁鎵惧埌瀹㈡埛缁忕悊"; + returnMsg.count = 0; + + return new JsonResult(returnMsg); + } + search.Ywjl = aaaaa.Id; + //search.page = 1; + //search.rows = 20; + var resultDataEntity = _cooperatecustomCustomerService.SearchByPagingAll(search); + + + + + returnMsg.code = 1; + returnMsg.returnObj = resultDataEntity.DataList; + returnMsg.count = resultDataEntity.DataList.Count; + + + + } + catch (Exception ex) + { + returnMsg.code = 2; + returnMsg.error = "娌℃湁鑾峰彇鍒皌oken"; + returnMsg.count = 0; + + } + return new JsonResult(returnMsg); + } + + //淇敼瀹㈡埛瀹㈡埛绫诲瀷 + public IActionResult UpdateKhlx([FromBody] CooperatecustomCustomerDTO dTO) + { + ReturnMsg<CooperatecustomCustomerDTO> returnMsg = new ReturnMsg<CooperatecustomCustomerDTO>(); + returnMsg.code = 2; + try + { + string userid = ""; + string usersn = "";//瀹㈡埛缁忕悊鐧诲綍鍚� + var headers = Request.Headers; + if (headers != null) + { + //string SecurityKey = _configuration.GetSection("SecurityKey").Value; + var keyId = headers["Authorization"].FirstOrDefault(); + if (string.IsNullOrEmpty(keyId)) + { + returnMsg.code = 2; + returnMsg.error = "娌℃湁鑾峰彇鍒皌oken"; + returnMsg.count = 0; + + return new JsonResult(returnMsg); + } + + + JwtSecurityToken jwt = null; + var handler = new JwtSecurityTokenHandler(); + var key1 = keyId.Replace("Bearer", "").Trim(); + jwt = handler.ReadJwtToken(key1); + System.Security.Claims.Claim sss = jwt.Claims.Where(x => x.Type == "id").FirstOrDefault(); + userid = sss.Value; + System.Security.Claims.Claim ssss = jwt.Claims.Where(x => x.Type == "sub").FirstOrDefault(); + usersn = ssss.Value; + } + var aaaaa = _userService.GetList().Where(x => x.UserSn == usersn).FirstOrDefault(); + if (aaaaa == null) + { + returnMsg.code = 2; + returnMsg.error = "娌℃湁鎵惧埌瀹㈡埛缁忕悊"; + returnMsg.count = 0; + + return new JsonResult(returnMsg); + } + dTO.Modifier = aaaaa.Id; + dTO.Modifytime = DateTime.Now; + var cooperatecustomCustomerDTO = _cooperatecustomCustomerService.Get(dTO.Id); + if (!string.IsNullOrEmpty(cooperatecustomCustomerDTO.Id)) + { + var resultDataEntity = _cooperatecustomCustomerService.saveKhlx(dTO); + } + else + { + var intentionCustomerDTO = _intentionCustomerService.Get(dTO.Id); + if (!string.IsNullOrEmpty(intentionCustomerDTO.Id)) + { + var resultDataEntity = _intentionCustomerService.saveKhlx(dTO); + } + } + + + returnMsg.code = 1; + returnMsg.returnObj = dTO; + returnMsg.count = 1; + + + + } + catch (Exception ex) + { + returnMsg.code = 2; + returnMsg.error = "娌℃湁鑾峰彇鍒皌oken"; + returnMsg.count = 0; + + } + return new JsonResult(returnMsg); + } + + + + + //淇敼瀹㈡埛鎴愪氦鎰忓悜 + public IActionResult UpdateCjyx([FromBody] CooperVisitDTO dTO) + { + ReturnMsg<CooperVisitDTO> returnMsg = new ReturnMsg<CooperVisitDTO>(); + returnMsg.code = 2; + try + { + string userid = ""; + string usersn = "";//瀹㈡埛缁忕悊鐧诲綍鍚� + var headers = Request.Headers; + if (headers != null) + { + //string SecurityKey = _configuration.GetSection("SecurityKey").Value; + var keyId = headers["Authorization"].FirstOrDefault(); + if (string.IsNullOrEmpty(keyId)) + { + returnMsg.code = 2; + returnMsg.error = "娌℃湁鑾峰彇鍒皌oken"; + returnMsg.count = 0; + + return new JsonResult(returnMsg); + } + + + JwtSecurityToken jwt = null; + var handler = new JwtSecurityTokenHandler(); + var key1 = keyId.Replace("Bearer", "").Trim(); + jwt = handler.ReadJwtToken(key1); + System.Security.Claims.Claim sss = jwt.Claims.Where(x => x.Type == "id").FirstOrDefault(); + userid = sss.Value; + System.Security.Claims.Claim ssss = jwt.Claims.Where(x => x.Type == "sub").FirstOrDefault(); + usersn = ssss.Value; + } + + var aaaaa = _userService.GetList().Where(x => x.UserSn == usersn).FirstOrDefault(); + if (aaaaa == null) + { + returnMsg.code = 2; + returnMsg.error = "娌℃湁鎵惧埌瀹㈡埛缁忕悊"; + returnMsg.count = 0; + + return new JsonResult(returnMsg); + } + var cooperatecustomCustomerDTO = _cooperatecustomCustomerService.Get(dTO.Viscustomer); + if (!string.IsNullOrEmpty(cooperatecustomCustomerDTO.Id)) + { + dTO.VisType = "05"; + if(string.IsNullOrEmpty(dTO.Jtype)) + dTO.Jtype = "10"; + if (string.IsNullOrEmpty(dTO.Talk)) + dTO.Talk = "鎴愪氦鎰忓悜"; + if (string.IsNullOrEmpty(dTO.Khfk)) + dTO.Khfk = "鎴愪氦鎰忓悜"; + if (string.IsNullOrEmpty(dTO.Jy)) + dTO.Jy = "02"; + if (string.IsNullOrEmpty(dTO.Jdr)) + dTO.Jdr = "鏃�"; + if (string.IsNullOrEmpty(dTO.Zw)) + dTO.Zw = "08"; + + //dTO.Vistime = DateTime.Now; + dTO.Modifier = aaaaa.Id; + dTO.Modifytime = DateTime.Now; + dTO.Creater = aaaaa.Id; + dTO.Modifytime = dTO.Modifytime; + var resultDataEntity = _cooperVisitService.save(dTO); + } + else + { + var intentionCustomerDTO = _intentionCustomerService.Get(dTO.Viscustomer); + if (!string.IsNullOrEmpty(intentionCustomerDTO.Id)) + { + var intentionVisitDTO = new IntentionVisitDTO(); + + intentionVisitDTO.VisType = "05"; + if (string.IsNullOrEmpty(dTO.Jtype)) + intentionVisitDTO.Jtype = "10"; + else + intentionVisitDTO.Jtype = dTO.Jtype; + if (string.IsNullOrEmpty(dTO.Talk)) + intentionVisitDTO.Talk = "鎴愪氦鎰忓悜"; + else + intentionVisitDTO.Talk = dTO.Talk; + if (string.IsNullOrEmpty(dTO.Khfk)) + intentionVisitDTO.Khfk = "鎴愪氦鎰忓悜"; + else + intentionVisitDTO.Khfk = dTO.Khfk; + if (string.IsNullOrEmpty(dTO.Jy)) + intentionVisitDTO.Jy = "02"; + else + intentionVisitDTO.Jy = dTO.Jy; + if (string.IsNullOrEmpty(dTO.Jdr)) + dTO.Jdr = "鏃�"; + else + intentionVisitDTO.Jdr = dTO.Jdr; + if (string.IsNullOrEmpty(dTO.Zw)) + dTO.Zw = "08"; + else + intentionVisitDTO.Zw = dTO.Zw; + + //intentionVisitDTO.Vistime = DateTime.Now; + intentionVisitDTO.Viscustomer = dTO.Viscustomer; + intentionVisitDTO.Yx = dTO.Yx; + intentionVisitDTO.Modifier = aaaaa.Id; + intentionVisitDTO.Modifytime = DateTime.Now; + intentionVisitDTO.Creater = aaaaa.Id; + intentionVisitDTO.Modifytime = intentionVisitDTO.Modifytime; + var resultDataEntity = _intentionVisitService.save(intentionVisitDTO); + } + } + + + + returnMsg.code = 1; + returnMsg.returnObj = dTO; + returnMsg.count = 1; + + + + + } + catch (Exception ex) + { + returnMsg.code = 2; + returnMsg.error = "娌℃湁鑾峰彇鍒皌oken"; + returnMsg.count = 0; + + } + return new JsonResult(returnMsg); + } + + } +} diff --git a/zhengcaioa/zhengcaioa/Controllers/BusinessOrder/CooperOrderController.cs b/zhengcaioa/zhengcaioa/Controllers/BusinessOrder/CooperOrderController.cs index 2040acd..afee108 100644 --- a/zhengcaioa/zhengcaioa/Controllers/BusinessOrder/CooperOrderController.cs +++ b/zhengcaioa/zhengcaioa/Controllers/BusinessOrder/CooperOrderController.cs @@ -1769,7 +1769,7 @@ { //string SecurityKey = _configuration.GetSection("SecurityKey").Value; var keyId = headers["Authorization"].FirstOrDefault(); - if (string.IsNullOrEmpty("keyId")) + if (string.IsNullOrEmpty(keyId)) { returnMsg.code = 2; returnMsg.error = "娌℃湁鑾峰彇鍒皌oken"; diff --git a/zhengcaioa/zhengcaioa/Controllers/BusinessOrder/OrderBanciOrderController.cs b/zhengcaioa/zhengcaioa/Controllers/BusinessOrder/OrderBanciOrderController.cs index 83c6d9d..bf30661 100644 --- a/zhengcaioa/zhengcaioa/Controllers/BusinessOrder/OrderBanciOrderController.cs +++ b/zhengcaioa/zhengcaioa/Controllers/BusinessOrder/OrderBanciOrderController.cs @@ -456,7 +456,7 @@ { //string SecurityKey = _configuration.GetSection("SecurityKey").Value; var keyId = headers["Authorization"].FirstOrDefault(); - if (string.IsNullOrEmpty("keyId")) + if (string.IsNullOrEmpty(keyId)) { returnMsg.code = 2; returnMsg.error = "娌℃湁鑾峰彇鍒皌oken"; diff --git a/zhengcaioa/zhengcaioa/Controllers/Expert/ZhuanjiahuidaController.cs b/zhengcaioa/zhengcaioa/Controllers/Expert/ZhuanjiahuidaController.cs index cb26f66..299b638 100644 --- a/zhengcaioa/zhengcaioa/Controllers/Expert/ZhuanjiahuidaController.cs +++ b/zhengcaioa/zhengcaioa/Controllers/Expert/ZhuanjiahuidaController.cs @@ -166,7 +166,7 @@ { //string SecurityKey = _configuration.GetSection("SecurityKey").Value; var keyId = headers["Authorization"].FirstOrDefault(); - if (string.IsNullOrEmpty("keyId")) + if (string.IsNullOrEmpty(keyId)) { returnMsg.code = 2; returnMsg.error = "娌℃湁鑾峰彇鍒皌oken"; @@ -240,7 +240,7 @@ { //string SecurityKey = _configuration.GetSection("SecurityKey").Value; var keyId = headers["Authorization"].FirstOrDefault(); - if (string.IsNullOrEmpty("keyId")) + if (string.IsNullOrEmpty(keyId)) { returnMsg.code = 2; returnMsg.error = "娌℃湁鑾峰彇鍒皌oken"; diff --git a/zhengcaioa/zhengcaioa/Controllers/ProjectController.cs b/zhengcaioa/zhengcaioa/Controllers/ProjectController.cs index 4711c90..a2d268f 100644 --- a/zhengcaioa/zhengcaioa/Controllers/ProjectController.cs +++ b/zhengcaioa/zhengcaioa/Controllers/ProjectController.cs @@ -972,7 +972,7 @@ { //string SecurityKey = _configuration.GetSection("SecurityKey").Value; var keyId = headers["Authorization"].FirstOrDefault(); - if (string.IsNullOrEmpty("keyId")) + if (string.IsNullOrEmpty(keyId)) { returnMsg.code = 2; returnMsg.error = "娌℃湁鑾峰彇鍒版潈闄愪俊鎭�"; diff --git a/zhengcaioa/zhengcaioa/Controllers/UserController.cs b/zhengcaioa/zhengcaioa/Controllers/UserController.cs index eb4a16f..b0c74ce 100644 --- a/zhengcaioa/zhengcaioa/Controllers/UserController.cs +++ b/zhengcaioa/zhengcaioa/Controllers/UserController.cs @@ -605,7 +605,7 @@ { //string SecurityKey = _configuration.GetSection("SecurityKey").Value; var keyId = headers["Authorization"].FirstOrDefault(); - if (string.IsNullOrEmpty("keyId")) + if (string.IsNullOrEmpty(keyId)) { returnMsg.code = 2; returnMsg.error = "娌℃湁鑾峰彇鍒皌oken"; diff --git a/zhengcaioa/zhengcaioa/Timer/TimedBackgroundService.cs b/zhengcaioa/zhengcaioa/Timer/TimedBackgroundService.cs index b3e0898..3b3f70b 100644 --- a/zhengcaioa/zhengcaioa/Timer/TimedBackgroundService.cs +++ b/zhengcaioa/zhengcaioa/Timer/TimedBackgroundService.cs @@ -1703,7 +1703,7 @@ - if (userList[i].ShiyongDate.HasValue && userList[i].ShiyongDateEnd.HasValue && dateminkaoqin>= userList[i].ShiyongDate.Value && dateminkaoqin <= userList[i].ShiyongDateEnd.Value) + if (userList[i].ShiyongDate.HasValue && userList[i].ShiyongDateEnd.HasValue && datemaxkaoqin> userList[i].ShiyongDate.Value && dateminkaoqin <= userList[i].ShiyongDateEnd.Value) { hrSalaryDTO.Jibengongzi = Math.Round(hrJibengongzi.Jibengongzi.Value * chuqinlv * new decimal(0.8), 2) ; hrSalaryDTO.Baomifei = Math.Round(hrJibengongzi.Baomifei.Value * chuqinlv * new decimal(0.8), 2) ; -- Gitblit v1.9.1