username@email.com
2021-09-10 83c4efe25b7b5ee027a34987f8ee508a379c1d47
zhengcaioa/zhengcaioa/Controllers/ProjectController.cs
@@ -25,9 +25,11 @@
        private readonly IIntentionCustomerService _intentionCustomerService;
        private readonly IUserService _userService;
        private readonly ICooperatecustomCustomerService _cooperatecustomCustomerService;
        private readonly ISysBaimingdanService _sysBaimingdanService;
        public ProjectController(ILogger<ProjectController> logger, IProjectService projectService, ILiaotianService liaotianService,IIntentionCustomerService intentionCustomerService, IUserService userService
            , ICooperatecustomCustomerService cooperatecustomCustomerService)
            , ICooperatecustomCustomerService cooperatecustomCustomerService
            , ISysBaimingdanService sysBaimingdanService)
        {
            _logger = logger;
            _projectService = projectService;
@@ -35,6 +37,7 @@
            _intentionCustomerService = intentionCustomerService;
            _userService = userService;
            _cooperatecustomCustomerService = cooperatecustomCustomerService;
            _sysBaimingdanService = sysBaimingdanService;
        }
        [CheckLogin]
        public IActionResult Index()
@@ -636,5 +639,81 @@
            }
        }
        //获取对手分析
        public IActionResult GetProjectFenxi([FromBody] ProjectDTOSearch search)
        {
            ReturnMsg<List<ProjectDTO>> returnMsg = new ReturnMsg<List<ProjectDTO>>();
            returnMsg.code = 2;
            var sysBaimingdanDTOs =  _sysBaimingdanService.GetList();
            if (!string.IsNullOrEmpty(search.Zhuanjia))
            {
             var sss =    sysBaimingdanDTOs.Where(x => x.PostType == "01" && search.Zhuanjia.Contains(x.BaimingdanName)).Count();
                if (sss > 0)
                {
                    returnMsg.code = 2;
                    returnMsg.error = "该专家请直接联系政采咨询";
                    returnMsg.count = 0;
                    return new JsonResult(returnMsg);
                }
            }
            if (!string.IsNullOrEmpty(search.Names))
            {
                var sss = sysBaimingdanDTOs.Where(x => x.PostType == "02" && search.Names.Contains(x.BaimingdanName)).Count();
                if (sss > 0)
                {
                    returnMsg.code = 11;
                    returnMsg.error = "该供应商请直接联系政采咨询";
                    returnMsg.count = 0;
                    return new JsonResult(returnMsg);
                }
            }
            if (!string.IsNullOrEmpty(search.NamesToubiao))
            {
                var sss = sysBaimingdanDTOs.Where(x => x.PostType == "02" && search.NamesToubiao.Contains(x.BaimingdanName)).Count();
                if (sss > 0)
                {
                    returnMsg.code = 11;
                    returnMsg.error = "该供应商请直接联系政采咨询";
                    returnMsg.count = 0;
                    return new JsonResult(returnMsg);
                }
            }
            if (!string.IsNullOrEmpty(search.Reasonname))
            {
                var sss = sysBaimingdanDTOs.Where(x => x.PostType == "02" && search.Reasonname.Contains(x.BaimingdanName)).Count();
                if (sss > 0)
                {
                    returnMsg.code = 11;
                    returnMsg.error = "该供应商请直接联系政采咨询";
                    returnMsg.count = 0;
                    return new JsonResult(returnMsg);
                }
            }
            try
            {
                //search.page = 1;
                //search.rows = 1;
                ResultDataEntity<ProjectDTO> resultDataEntity = _projectService.SearchByPaging(search);
                returnMsg.code = 1;
                returnMsg.count = search.totalrows;
                returnMsg.returnObj = resultDataEntity.DataList;
            }
            catch (Exception ex)
            {
                returnMsg.code = 2;
                returnMsg.error = "没有获取到token";
                returnMsg.count = 0;
            }
            return new JsonResult(returnMsg);
        }
    }
}