From e8fc5d92457143ea8744e8f8b2bed45a0a651f18 Mon Sep 17 00:00:00 2001
From: username@email.com <yzy2002yzy@163.com>
Date: 星期五, 24 二月 2023 16:26:43 +0800
Subject: [PATCH] 提交
---
zhengcaioa/zhengcaioa/Controllers/admin/AdmAskController.cs | 440 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 439 insertions(+), 1 deletions(-)
diff --git a/zhengcaioa/zhengcaioa/Controllers/admin/AdmAskController.cs b/zhengcaioa/zhengcaioa/Controllers/admin/AdmAskController.cs
index 91cc7d4..66e6368 100644
--- a/zhengcaioa/zhengcaioa/Controllers/admin/AdmAskController.cs
+++ b/zhengcaioa/zhengcaioa/Controllers/admin/AdmAskController.cs
@@ -2,11 +2,15 @@
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;
@@ -31,6 +35,11 @@
private readonly IIntentionCustomerService _intentionCustomerService;
private readonly IHrPositionService _hrPositionService;
private readonly IAdmGoodsRecordService _admGoodsRecordService;
+ private readonly IFiSubjectService _ifiSubjectService;
+ 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
@@ -41,7 +50,12 @@
, ICooperatecustomCustomerService cooperatecustomCustomerService
, IIntentionCustomerService intentionCustomerService
, IHrPositionService hrPositionService
- , IAdmGoodsRecordService admGoodsRecordService)
+ , IAdmGoodsRecordService admGoodsRecordService
+ , IFiSubjectService ifiSubjectService
+ , IFiAccountService fiAccountService
+ , IFiAccountRecordService iFiAccountRecordService
+ , IConfiguration configuration
+ )
{
_logger = logger;
_hrDeptService = hrDeptService;
@@ -57,6 +71,10 @@
_intentionCustomerService = intentionCustomerService;
_hrPositionService = hrPositionService;
_admGoodsRecordService = admGoodsRecordService;
+ _ifiSubjectService = ifiSubjectService;
+ _fiAccountService = fiAccountService;
+ _iFiAccountRecordService = iFiAccountRecordService;
+ _configuration = configuration;
}
public IActionResult Askcost(string id = "")
@@ -1293,6 +1311,12 @@
//ViewBag.CooperatecustomCustomerDTOs =
+ if (dangqianbuzhou == "璐㈠姟瀹℃壒")
+ {
+ ViewBag.accounttype = _liaotianService.GetSYScode("fi_account", "accounttype");
+ ViewBag.FiSubject = _ifiSubjectService.GetList().Where(x => x.Subjecttype == "02").ToList();
+ }
+
ViewData.Model = dto;
return View();
}
@@ -1327,11 +1351,159 @@
}
}
+ if(data.Step == "璐㈠姟瀹℃壒" && data.Tongguojujue == "A")
+ {
+ WfRunProcessDTO wfRunProcessDTO = _wfRunProcessService.GetList(data.Id, "20").FirstOrDefault();
+
+ FiAccountRecordDTO datafi = new FiAccountRecordDTO();
+ datafi.Creater = curentuser.Id;
+ datafi.Createtime = DateTime.Now;
+ datafi.Modifier = curentuser.Id;
+ datafi.Modifytime = DateTime.Now;
+ datafi.AccountId = data.AccountId;
+ datafi.Accounttype = data.Accounttype;
+ datafi.SubjectId = data.SubjectId;
+ datafi.Money = data.Jine;
+ if(wfRunProcessDTO!=null)
+ datafi.OperationalMatters = data.Tittle + wfRunProcessDTO.Applyno;
+ datafi.PaymentUnit = data.Username;
+ FiAccountDTO firmAccount = _fiAccountService.Get(data.AccountId);
+
+
+ datafi.RecordTypeId = "2";//鏀嚭
+ //data.Department = "";
+
+ //resultEntity = _iFiAccountRecordService.save(data);
+
+ firmAccount.AllExpenses = (firmAccount.AllExpenses ?? 0) + datafi.Money;
+ firmAccount.Balance = (firmAccount.Balance ?? 0) - datafi.Money;
+
+ datafi.AccountMoney = firmAccount.Balance;
+
+ resultEntity = _iFiAccountRecordService.save(datafi);
+
+ resultEntity = _fiAccountService.save(firmAccount);
+ }
//鍙戣捣娴佺▼鐩稿叧
resultEntity = _wfRunProcessService.WfCustomerWithdrawal(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);
+ }
+
+
+
+ public IActionResult CustomerRefund(string id = "")
+ {
+ AdmCustomerWithdrawalDTO dto = new AdmCustomerWithdrawalDTO();
+ 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.GetCustomerWithdrawal(id);
+ dto.ShenqingtimeName = dto.Shenqingtime.ToString("yyyy-MM-dd");
+ dto.JineName = dto.Jine.Value.ToString("F2");
+
+ var wfRunProcessDTO = _wfRunProcessService.GetList(dto.Id, "23").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;
+
+
+
+ ViewData.Model = dto;
+ return View();
+ }
+
+
+ /// <summary>
+ /// 浼氬憳鎻愮幇鐢宠
+ /// </summary>
+ /// <param name="data"></param>
+ /// <returns></returns>
+ [HttpPost]
+ public IActionResult SaveCustomerRefund(AdmCustomerWithdrawalDTO 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.SaveCustomerWithdrawal(data);
+ if (!resultEntity.Result)
+ {
+ return new JsonResult(resultEntity);
+ }
+ }
+
+
+
+
+ //鍙戣捣娴佺▼鐩稿叧
+
+ resultEntity = _wfRunProcessService.WfCustomerRefund(data.Id, data.Step, data.Tongguojujue, curentuser.Id, data.Content, data.Tittle, "v1");
if (!resultEntity.Result)
{
return new JsonResult(resultEntity);
@@ -1813,5 +1985,271 @@
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);
+ }
+
}
}
--
Gitblit v1.9.1