| | |
| | | using IServices; |
| | | using Microsoft.AspNetCore.Http; |
| | | using Microsoft.AspNetCore.Mvc; |
| | | using Microsoft.Extensions.Configuration; |
| | | using Microsoft.Extensions.Logging; |
| | | using Newtonsoft.Json; |
| | | using Newtonsoft.Json.Linq; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Net.Http; |
| | | using System.Net.Http.Headers; |
| | | using System.Threading.Tasks; |
| | | using System.Transactions; |
| | | using zhengcaioa.IService; |
| | |
| | | private readonly IFiAccountService _fiAccountService; |
| | | |
| | | private readonly IFiAccountRecordService _iFiAccountRecordService; |
| | | private readonly IConfiguration _configuration; |
| | | |
| | | public AdmAskController(ILogger<AdmAskController> logger, IAskService askService, IHrDeptService hrDeptService, IWfRunProcessService wfRunProcessService |
| | | , IWfHistoryService wfHistoryService, IWfNeeddeelService wfNeeddeelService |
| | |
| | | , IAdmGoodsRecordService admGoodsRecordService |
| | | , IFiSubjectService ifiSubjectService |
| | | , IFiAccountService fiAccountService |
| | | , IFiAccountRecordService iFiAccountRecordService) |
| | | , IFiAccountRecordService iFiAccountRecordService |
| | | , IConfiguration configuration |
| | | ) |
| | | { |
| | | _logger = logger; |
| | | _hrDeptService = hrDeptService; |
| | |
| | | _ifiSubjectService = ifiSubjectService; |
| | | _fiAccountService = fiAccountService; |
| | | _iFiAccountRecordService = iFiAccountRecordService; |
| | | _configuration = configuration; |
| | | } |
| | | |
| | | public IActionResult Askcost(string id = "") |
| | |
| | | return JsonConvert.SerializeObject(resultEntity); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | //获取招标信息网试用审批 |
| | | |
| | | public IActionResult AskZBXXW(string id = "") |
| | | { |
| | | AdmAskzczbwsyDTO dto = new AdmAskzczbwsyDTO(); |
| | | var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User")); |
| | | |
| | | |
| | | //流程相关 |
| | | string shifoubiaoji = "A"; |
| | | string sifoudangqian = "A"; |
| | | string dangqianbuzhou = "提交"; |
| | | var lishiyijian = new List<WfHistoryDTO>(); |
| | | |
| | | if (string.IsNullOrEmpty(id)) |
| | | { |
| | | dto.CreaterName = curentuser.UserName; |
| | | dto.Tittle = "招标信息网试用申请(" + curentuser.UserName + ")"; |
| | | } |
| | | else if (dto != null) |
| | | { |
| | | dto = _askService.GetAskZBXXW(id); |
| | | |
| | | var wfRunProcessDTO = _wfRunProcessService.GetList(dto.Id, "24").FirstOrDefault(); |
| | | if (wfRunProcessDTO == null) |
| | | { |
| | | shifoubiaoji = "D"; |
| | | sifoudangqian = "D"; |
| | | } |
| | | else |
| | | { |
| | | dangqianbuzhou = wfRunProcessDTO.Step; |
| | | //查询审批进度 |
| | | lishiyijian = _wfHistoryService.GetListshenpi(wfRunProcessDTO.Id); |
| | | if (wfRunProcessDTO.Step != "提交") |
| | | { |
| | | shifoubiaoji = "D"; |
| | | } |
| | | |
| | | //查询待办 |
| | | var chaxundaiban = _wfNeeddeelService.GetListTracking(wfRunProcessDTO.Id, wfRunProcessDTO.Step).Where(x => x.DeelUserId == curentuser.Id).ToList(); |
| | | if (chaxundaiban != null && chaxundaiban.Count > 0) |
| | | { |
| | | sifoudangqian = "A"; |
| | | } |
| | | else |
| | | { |
| | | sifoudangqian = "D"; |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | ViewBag.shifoubiaoji = shifoubiaoji; |
| | | ViewBag.sifoudangqian = sifoudangqian; |
| | | ViewBag.lishiyijian = lishiyijian; |
| | | ViewBag.dangqianbuzhou = dangqianbuzhou; |
| | | |
| | | ViewBag.shiyongstandard = _liaotianService.GetSYScode("ADM_Askzczbwsy", "shiyongstandard"); |
| | | |
| | | |
| | | //ViewBag.CooperatecustomCustomerDTOs = _cooperatecustomCustomerService.GetList(); |
| | | |
| | | ViewData.Model = dto; |
| | | return View(); |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 保存销售费用申请 |
| | | /// </summary> |
| | | /// <param name="data"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public IActionResult SaveZBXXW(AdmAskzczbwsyDTO data) |
| | | { |
| | | var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User")); |
| | | ResultEntity resultEntity = new ResultEntity(); |
| | | using (TransactionScope scope = new TransactionScope()) |
| | | { |
| | | if (data.Step == "提交") |
| | | { |
| | | |
| | | data.ShenpiStatus = "D"; |
| | | data.RecStatus = "A"; |
| | | data.Creater = curentuser.Id; |
| | | data.Createtime = DateTime.Now; |
| | | data.Modifier = data.Creater; |
| | | data.Modifytime = data.Createtime; |
| | | |
| | | resultEntity = _askService.SaveAskZBXXW(data); |
| | | if (!resultEntity.Result) |
| | | { |
| | | return new JsonResult(resultEntity); |
| | | } |
| | | } |
| | | if (data.Step == "招标信息网试用审批" && data.Tongguojujue == "A") |
| | | { |
| | | //调用接口开启用户试用权限 |
| | | |
| | | var admAskzczbwsyDTO = _askService.GetAskZBXXW(data.Id); |
| | | var userDTO = _userService.GetPltUserEntity(admAskzczbwsyDTO.Creater); |
| | | |
| | | string huiyuanurl = _configuration.GetSection("huiyuanurl").Value; |
| | | string SetCaseOrder = _configuration.GetSection("OASetOtherBusiness").Value; |
| | | |
| | | Uri postUrl2 = new Uri(huiyuanurl + SetCaseOrder); |
| | | if (data.CustomerId != null && data.CustomerId.Length > 0) |
| | | { |
| | | for(int i=0;i< data.CustomerId.Length; i++) |
| | | { |
| | | if (data.Customertype[i] == "合作客户") |
| | | { |
| | | var cooperatecustomCustomerDTO = _cooperatecustomCustomerService.Get(data.CustomerId[i]); |
| | | JObject questions2 = new JObject(); |
| | | questions2.Add("UserID", cooperatecustomCustomerDTO.HuiyuanId); |
| | | questions2.Add("UserName", cooperatecustomCustomerDTO.Name); |
| | | questions2.Add("PhoneNumber", cooperatecustomCustomerDTO.Tel); |
| | | questions2.Add("BusinessKey", "CGGG"); |
| | | if (admAskzczbwsyDTO.Shiyongstandard == "01") |
| | | { |
| | | questions2.Add("EndTime", DateTime.Now.AddMonths(1).ToString("yyyy-MM-dd HH:mm:ss")); |
| | | } |
| | | else if (admAskzczbwsyDTO.Shiyongstandard == "02") |
| | | { |
| | | questions2.Add("EndTime", DateTime.Now.AddMonths(1).ToString("yyyy-MM-dd HH:mm:ss")); |
| | | } |
| | | else if(admAskzczbwsyDTO.Shiyongstandard == "03") |
| | | { |
| | | questions2.Add("EndTime", DateTime.Now.AddMonths(1).ToString("yyyy-MM-dd HH:mm:ss")); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | questions2.Add("FromName", userDTO.UserName +" " +userDTO.Phone); |
| | | questions2.Add("Describe", "OA"); |
| | | |
| | | |
| | | string requestJson2 = questions2.ToString(); |
| | | string result2 = string.Empty; |
| | | |
| | | using (HttpContent httpContent = new StringContent(requestJson2)) |
| | | { |
| | | httpContent.Headers.ContentType = new MediaTypeHeaderValue("application/json"); |
| | | |
| | | |
| | | using (HttpClient httpClient = new HttpClient()) |
| | | { |
| | | httpClient.Timeout = new TimeSpan(0, 0, 10); |
| | | HttpResponseMessage responseMessage = httpClient.PostAsync(postUrl2, httpContent).Result; |
| | | result2 = responseMessage.Content.ReadAsStringAsync().Result; |
| | | } |
| | | } |
| | | |
| | | _logger.LogInformation("result2:" + result2); |
| | | JObject jobjectresult = (JObject)JsonConvert.DeserializeObject(result2); |
| | | |
| | | if (jobjectresult["code"] != null && jobjectresult["code"].ToString() == "1") |
| | | { |
| | | cooperatecustomCustomerDTO.HuiyuanId = jobjectresult["UserID"].ToString(); |
| | | _cooperatecustomCustomerService.save(cooperatecustomCustomerDTO); |
| | | resultEntity.Result = true; |
| | | } |
| | | else |
| | | { |
| | | resultEntity.Result = false; |
| | | resultEntity.Message = "开通招标信息网试用权限失败"; |
| | | return new JsonResult(resultEntity); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | var cooperatecustomCustomerDTO = _intentionCustomerService.Get(data.CustomerId[i]); |
| | | JObject questions2 = new JObject(); |
| | | questions2.Add("UserID", cooperatecustomCustomerDTO.HuiyuanId); |
| | | questions2.Add("UserName", cooperatecustomCustomerDTO.Name); |
| | | questions2.Add("PhoneNumber", cooperatecustomCustomerDTO.Tel); |
| | | questions2.Add("BusinessKey", "CGGG"); |
| | | if (admAskzczbwsyDTO.Shiyongstandard == "01") |
| | | { |
| | | questions2.Add("EndTime", DateTime.Now.AddMonths(1).ToString("yyyy-MM-dd HH:mm:ss")); |
| | | } |
| | | else if (admAskzczbwsyDTO.Shiyongstandard == "02") |
| | | { |
| | | questions2.Add("EndTime", DateTime.Now.AddMonths(2).ToString("yyyy-MM-dd HH:mm:ss")); |
| | | } |
| | | else if (admAskzczbwsyDTO.Shiyongstandard == "03") |
| | | { |
| | | questions2.Add("EndTime", DateTime.Now.AddMonths(3).ToString("yyyy-MM-dd HH:mm:ss")); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | questions2.Add("FromName", userDTO.UserName + " " + userDTO.Phone); |
| | | questions2.Add("Describe", "OA"); |
| | | |
| | | |
| | | |
| | | string requestJson2 = questions2.ToString(); |
| | | string result2 = string.Empty; |
| | | |
| | | using (HttpContent httpContent = new StringContent(requestJson2)) |
| | | { |
| | | httpContent.Headers.ContentType = new MediaTypeHeaderValue("application/json"); |
| | | |
| | | |
| | | using (HttpClient httpClient = new HttpClient()) |
| | | { |
| | | httpClient.Timeout = new TimeSpan(0, 0, 10); |
| | | HttpResponseMessage responseMessage = httpClient.PostAsync(postUrl2, httpContent).Result; |
| | | result2 = responseMessage.Content.ReadAsStringAsync().Result; |
| | | } |
| | | } |
| | | |
| | | _logger.LogInformation("result2:" + result2); |
| | | JObject jobjectresult = (JObject)JsonConvert.DeserializeObject(result2); |
| | | |
| | | if (jobjectresult["code"] != null && jobjectresult["code"].ToString() == "1") |
| | | { |
| | | cooperatecustomCustomerDTO.HuiyuanId = jobjectresult["UserID"].ToString(); |
| | | _intentionCustomerService.save(cooperatecustomCustomerDTO); |
| | | resultEntity.Result = true; |
| | | } |
| | | else |
| | | { |
| | | resultEntity.Result = false; |
| | | resultEntity.Message = "开通招标信息网试用权限失败"; |
| | | return new JsonResult(resultEntity); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | //发起流程相关 |
| | | |
| | | resultEntity = _wfRunProcessService.WfAskZBXXW(data.Id, data.Step, data.Tongguojujue, curentuser.Id, data.Content, data.Tittle, "v1"); |
| | | if (!resultEntity.Result) |
| | | { |
| | | return new JsonResult(resultEntity); |
| | | } |
| | | scope.Complete(); |
| | | } |
| | | return new JsonResult(resultEntity); |
| | | } |
| | | |
| | | } |
| | | } |