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); } } zhengcaioa/IServices/IIntentionCustomerService.cs
@@ -37,5 +37,8 @@ List<IntentionCustomerDTO> GetListsalaryyixiang(string userid, DateTime datemin, DateTime datemax); ResultEntity saveKhlx(CooperatecustomCustomerDTO cooperatecustomCustomerDTO); } } 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 = "档案客户", } ); 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; } } } 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; } } } zhengcaioa/zhengcaioa/Controllers/APIController.cs
New file @@ -0,0 +1,456 @@ using 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 = "没有获取到token"; 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 = "没有获取到token"; 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 = "没有获取到token"; 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 = "没有获取到token"; 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 = "没有获取到token"; 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 = "没有获取到token"; 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 = "没有获取到token"; 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 = "没有获取到token"; 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 = "没有获取到token"; 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 = "没有获取到token"; returnMsg.count = 0; } return new JsonResult(returnMsg); } } } 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 = "没有获取到token"; 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 = "没有获取到token"; 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 = "没有获取到token"; @@ -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 = "没有获取到token"; 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 = "没有获取到权限信息"; 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 = "没有获取到token"; 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) ;