From ccebcce0dbb57914f0ad8c5369400166717ffe27 Mon Sep 17 00:00:00 2001
From: username@email.com <yzy2002yzy@163.com>
Date: 星期二, 16 十一月 2021 14:24:37 +0800
Subject: [PATCH] 提交
---
zhengcaioa/zhengcaioa/Controllers/BusinessOrder/CooperOrderController.cs | 558 +++++++++++++++++++++++++++++++++++++++++++++++--------
1 files changed, 476 insertions(+), 82 deletions(-)
diff --git a/zhengcaioa/zhengcaioa/Controllers/BusinessOrder/CooperOrderController.cs b/zhengcaioa/zhengcaioa/Controllers/BusinessOrder/CooperOrderController.cs
index ce5a7e6..c4cdcf7 100644
--- a/zhengcaioa/zhengcaioa/Controllers/BusinessOrder/CooperOrderController.cs
+++ b/zhengcaioa/zhengcaioa/Controllers/BusinessOrder/CooperOrderController.cs
@@ -18,10 +18,14 @@
using CommonToolsCore;
using Services;
using System.Transactions;
+using System.IdentityModel.Tokens.Jwt;
+using Microsoft.Extensions.Configuration;
+using Newtonsoft.Json.Linq;
+using System.Net.Http.Headers;
namespace zhengcaioa.Controllers.BusinessOrder
{
- [CheckLogin]
+
public class CooperOrderController : Controller
{
private readonly ILogger<CooperOrderController> _logger;
@@ -34,11 +38,23 @@
private readonly IFiBookService _fiBookService;
private readonly IFiServiceService _fiServiceService;
private readonly IFiMemberService _fiMemberService;
+ private readonly IConfiguration _configuration;
+ private readonly IHttpClientFactory _clientFactory;
+ private readonly IAskService _askService;
+ private readonly IAdmGoodsRecordService _admGoodsRecordService;
+
+ private readonly IAdmGoodsManageService _admGoodsManageService;
public CooperOrderController(ILogger<CooperOrderController> logger, ILiaotianService liaotianService, IUserService userService, ICooperOrderService cooperOrderService
, ICooperatecustomCustomerService cooperatecustomCustomerService, IProjectService projectService, IPltPageService pltPageService, IFiBookService fiBookService
- , IFiServiceService fiServiceService, IFiMemberService fiMemberService)
+ , IFiServiceService fiServiceService, IFiMemberService fiMemberService
+ , IConfiguration configuration
+ , IHttpClientFactory clientFactory
+ , IAskService askService
+ , IAdmGoodsRecordService admGoodsRecordService
+ , IAdmGoodsManageService admGoodsManageService
+ )
{
_logger = logger;
_liaotianService = liaotianService;
@@ -50,9 +66,14 @@
_fiBookService = fiBookService;
_fiServiceService = fiServiceService;
_fiMemberService = fiMemberService;
+ _configuration = configuration;
+ _clientFactory = clientFactory;
+ _askService = askService;
+ _admGoodsRecordService = admGoodsRecordService;
+ _admGoodsManageService = admGoodsManageService;
}
-
+ [CheckLogin]
public IActionResult Index()
{
var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
@@ -72,6 +93,15 @@
actionEntity1.PageIco = "fa fa-plus";
actionEntity1.ActionName = "鏂板";
actionlist.Add(actionEntity1);
+
+ ActionEntity actionEntity3 = new ActionEntity();
+ actionEntity3.OpenType = 0;
+ actionEntity3.ActionUrl = "";
+ actionEntity3.ActionFun = "Print";
+ actionEntity3.PageIco = "fa fa-print";
+ actionEntity3.ActionName = "鎵撳嵃";
+ actionlist.Add(actionEntity3);
+
ViewData["ActionInfo"] = actionlist;
List<PageEntity> pageEntities = _pltPageService.GetUserPage(curentuser.Id, "/CooperOrder/Index/");
@@ -87,23 +117,24 @@
ViewBag.PingjiaStatus = _liaotianService.GetSYScode("CooperOrder", "pingjia_status").Select(x => new { code = x.CodeSn, label = x.Comments }).ToList();
+ ViewBag.ShouliStatus = _liaotianService.GetSYScode("CooperOrder", "shouli_status").Select(x => new { code = x.CodeSn, label = x.Comments }).ToList();
return View();
}
-
+ [CheckLogin]
public IActionResult GetList(CooperOrderDTOSearch search)
{
var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
ViewData["curentuser"] = curentuser;
- search.Creater = curentuser.Id;
+ //search.Creater = curentuser.Id;
//JsonResult jsonResult = new JsonResult(_liaotianService.SearchByPaging(search), new Newtonsoft.Json.Serialization.DefaultContractResolver());
return new JsonResult(_cooperOrderService.SearchByPaging(search));
}
-
+ [CheckLogin]
public IActionResult ShouliList()
{
var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
@@ -131,7 +162,7 @@
return View();
}
-
+ [CheckLogin]
public IActionResult GetListshouli(CooperOrderDTOSearch search)
{
var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
@@ -142,7 +173,7 @@
}
-
+ [CheckLogin]
public IActionResult ChedanList()
{
var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
@@ -170,7 +201,7 @@
return View();
}
-
+ [CheckLogin]
public IActionResult GetListchedan(CooperOrderDTOSearch search)
{
var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
@@ -180,7 +211,7 @@
return new JsonResult(_cooperOrderService.SearchByPaging(search));
}
-
+ [CheckLogin]
public IActionResult WangongList()
{
var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
@@ -208,7 +239,7 @@
return View();
}
-
+ [CheckLogin]
public IActionResult GetListwangong(CooperOrderDTOSearch search)
{
var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
@@ -218,7 +249,7 @@
//JsonResult jsonResult = new JsonResult(_liaotianService.SearchByPaging(search), new Newtonsoft.Json.Serialization.DefaultContractResolver());
return new JsonResult(_cooperOrderService.SearchByPaging(search));
}
-
+ [CheckLogin]
public IActionResult SonghuoList()
{
var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
@@ -248,7 +279,7 @@
return View();
}
-
+ [CheckLogin]
public IActionResult GetListsonghuo(CooperOrderDTOSearch search)
{
var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
@@ -258,7 +289,7 @@
//JsonResult jsonResult = new JsonResult(_liaotianService.SearchByPaging(search), new Newtonsoft.Json.Serialization.DefaultContractResolver());
return new JsonResult(_cooperOrderService.SearchByPaging(search));
}
-
+ [CheckLogin]
public IActionResult HuifangList()
{
var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
@@ -286,7 +317,7 @@
return View();
}
-
+ [CheckLogin]
public IActionResult GetListHuifang(CooperOrderDTOSearch search)
{
var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
@@ -296,7 +327,7 @@
//JsonResult jsonResult = new JsonResult(_liaotianService.SearchByPaging(search), new Newtonsoft.Json.Serialization.DefaultContractResolver());
return new JsonResult(_cooperOrderService.SearchByPaging(search));
}
-
+ [CheckLogin]
public IActionResult PingjiaList()
{
var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
@@ -324,7 +355,7 @@
return View();
}
-
+ [CheckLogin]
public IActionResult GetListPingjia(CooperOrderDTOSearch search)
{
var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
@@ -348,6 +379,8 @@
actionEntity.ActionName = "鏌ヨ";
actionlist.Add(actionEntity);
+
+
ViewData["ActionInfo"] = actionlist;
ViewBag.OrderType = _liaotianService.GetSYScode("CooperVisit", "jtype").Select(x => new { code = x.CodeSn, label = x.Comments }).ToList();
@@ -362,7 +395,7 @@
return View();
}
-
+ [CheckLogin]
public IActionResult GetListYouhui(CooperOrderDTOSearch search)
{
var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
@@ -372,6 +405,7 @@
//JsonResult jsonResult = new JsonResult(_liaotianService.SearchByPaging(search), new Newtonsoft.Json.Serialization.DefaultContractResolver());
return new JsonResult(_cooperOrderService.SearchByPaging(search));
}
+ [CheckLogin]
public IActionResult Edit(string id = null, string ShouliStatus = "1")
{
var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
@@ -382,11 +416,15 @@
{
dto = _cooperOrderService.Get(id);
ViewBag.ShouliStatus = ShouliStatus;
+ //ViewBag.YouHuiList = _askService.GetAskYouHuiList(dto.Khdw, dto.OrderType);
}
else
{
dto.XdTime = DateTime.Now;
+ dto.OrderNum = 1;
ViewBag.ShouliStatus = "1";
+ dto.OrderNo = _cooperOrderService.GetOrderNo();
+ //ViewBag.YouHuiList = new List<AdmAskYouHuiDTO>();
}
@@ -430,12 +468,13 @@
/// <param name="data">宀椾綅瀹炰綋绫诲璞�</param>
/// <returns></returns>
///
+ [CheckLogin]
[HttpPost]
- public IActionResult Save(CooperOrderDTO data)
+ public async Task<IActionResult> SaveAsync(CooperOrderDTO data)
{
ResultEntity resultEntity = new ResultEntity();
- using (TransactionScope scope = new TransactionScope())
- {
+ //using (TransactionScope scope = new TransactionScope())
+ //{
var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
ViewData["curentuser"] = curentuser;
data.RecStatus = "A";
@@ -444,16 +483,114 @@
data.Creater = curentuser.Id;
data.Createtime = DateTime.Now;
data.XdTime = data.Createtime;
+ if (data.OrderType == "03" || data.OrderType == "07" || (data.OrderType == "02" && (data.OrderType1 == "浠f嫙鎶曡瘔涔�" || data.OrderType1 == "浠f嫙璐ㄧ枒鍑�")))
+ {
+ var cooperatecustomCustomerDTO = _cooperatecustomCustomerService.Get(data.Khdw);
+ if (cooperatecustomCustomerDTO != null && !string.IsNullOrEmpty(cooperatecustomCustomerDTO.HuiyuanId))
+ {
+ string huiyuanurl = _configuration.GetSection("huiyuanurl").Value;
+ string SetCaseOrder = _configuration.GetSection("SetCaseOrder").Value;
+
+ Uri postUrl2 = new Uri(huiyuanurl + SetCaseOrder);
+
+ JObject questions2 = new JObject();
+ questions2.Add("UserID", cooperatecustomCustomerDTO.HuiyuanId);
+ if (data.OrderType == "03")
+ {
+ questions2.Add("CaseType", 0);
+ }
+ else if (data.OrderType == "07")
+ {
+ questions2.Add("CaseType", 1);
+ }
+ else if (data.OrderType == "07")
+ {
+ questions2.Add("CaseType", 1);
+ }
+ else if (data.OrderType == "02" && (data.OrderType1 == "浠f嫙鎶曡瘔涔�" || data.OrderType1 == "浠f嫙璐ㄧ枒鍑�"))
+ {
+ questions2.Add("CaseType", 2);
+ }
+
+ questions2.Add("count", Decimal.ToInt32(data.OrderNum.Value) );
+
+ string requestJson2 = questions2.ToString();
+ string result2 = string.Empty;
+
+ using (HttpContent httpContent = new StringContent(requestJson2))
+ {
+ httpContent.Headers.ContentType = new MediaTypeHeaderValue("application/json");
+
+ var httpClient2 = _clientFactory.CreateClient();
+ httpClient2.Timeout = new TimeSpan(0, 0, 10);
+ var Result2 = await httpClient2.PostAsync(postUrl2, httpContent);
+ result2 = Result2.Content.ReadAsStringAsync().Result;
+ }
+
+ _logger.LogInformation("result2:" + result2);
+ JObject jobjectresult = (JObject)JsonConvert.DeserializeObject(result2);
+
+ if (jobjectresult["code"] != null && jobjectresult["code"].ToString() == "1")
+ {
+ resultEntity.Result = true;
+ }
+ else
+ {
+ resultEntity.Result = false;
+ resultEntity.Message = "鍐欏叆浼氬憳璁㈠崟澶辫触";
+ return new JsonResult(resultEntity);
+ }
+ }
+ }
+
+
+
+
+
+ }
+
+ var youHuiDTOs = _askService.GetAskYouHuiList(data.Khdw, data.OrderType).FirstOrDefault();
+ if (youHuiDTOs != null)
+ {
+ data.Youhuier = youHuiDTOs.Id;
+ if(youHuiDTOs.Youhuistandard == "01")
+ {
+ data.Youhui = youHuiDTOs.YouHui.Value;
+ if(data.Money.Value < data.Youhui.Value)
+ {
+ data.Money = 0;
+ }
+ else
+ {
+ data.Money = data.Money.Value - data.Youhui.Value;
+ }
}
- data.ShouliStatus = "1";
- data.Modifier = curentuser.Id;
- data.Modifytime = DateTime.Now;
-
- resultEntity = _cooperOrderService.save(data);
- scope.Complete();
+ else if (youHuiDTOs.Youhuistandard == "02")
+ {
+ if (youHuiDTOs.YouHui.Value >= 100)
+ {
+ data.Youhui = data.Money.Value;
+ data.Money = 0;
+ }
+ else
+ {
+ data.Youhui =Math.Round(data.Money.Value * youHuiDTOs.YouHui.Value * new decimal(0.01),2);
+ data.Money = data.Money.Value - data.Youhui.Value;
+ }
+ }
+
+
}
-
+
+ data.ShouliStatus = "1";
+ data.Modifier = curentuser.Id;
+ data.Modifytime = DateTime.Now;
+
+ resultEntity = _cooperOrderService.save(data);
+ // scope.Complete();
+ //}
+
return new JsonResult(resultEntity);
}
@@ -465,6 +602,7 @@
/// <param name="info">瀹炰綋</param>
/// <returns></returns>
///
+ [CheckLogin]
public IActionResult Nullify(string Id = "")
{
var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
@@ -479,18 +617,90 @@
/// <param name="data">宀椾綅瀹炰綋绫诲璞�</param>
/// <returns></returns>
///
-
+ [CheckLogin]
public IActionResult Shouli(string id)
{
var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
ViewData["curentuser"] = curentuser;
- CooperOrderDTO dto= new CooperOrderDTO();
- dto.Id = id;
- dto.Shoulier = curentuser.Id;
- dto.Shoulitime = DateTime.Now;
- dto.ShouliStatus = "2";
+ ResultEntity resultEntity = new ResultEntity();
+ resultEntity.Result = false;
- ResultEntity resultEntity = _cooperOrderService.shouli(dto);
+ using (TransactionScope scope = new TransactionScope())
+ {
+
+ CooperOrderDTO dto = _cooperOrderService.Get(id);
+ if (dto.ShouliStatus != "1")
+ {
+ resultEntity.Result = false;
+ resultEntity.Message = "鍙湁宸蹭笅鍗曠姸鎬佺殑璁㈠崟鎵嶈兘鍙楃悊";
+ return new JsonResult(resultEntity);
+ }
+
+
+ if (dto.OrderType == "01")
+ {
+ var shi = _fiBookService.Get(dto.OrderType1);
+ if (string.IsNullOrEmpty(shi.Id))
+ {
+ resultEntity.Result = false;
+ resultEntity.Message = "鏈壘鍒拌鍟嗗搧";
+ return new JsonResult(resultEntity);
+ }
+ var admGoodsManageDTOs = _admGoodsManageService.GetList().Where(x => x.ISBN == shi.BookNo).FirstOrDefault();
+
+ if (admGoodsManageDTOs == null)
+ {
+
+
+ resultEntity.Result = false;
+ resultEntity.Message = "娌℃湁鎵惧埌璇ュ晢鍝�";
+ return new JsonResult(resultEntity);
+
+ }
+ else if (!admGoodsManageDTOs.GoodsLeft.HasValue)
+ {
+ resultEntity.Result = false;
+ resultEntity.Message = "璇ュ晢鍝佹病鏈夊簱瀛�";
+ return new JsonResult(resultEntity);
+
+ }
+ else if (admGoodsManageDTOs.GoodsLeft.Value < dto.OrderNum)
+ {
+ resultEntity.Result = false;
+ resultEntity.Message = "璇ュ晢鍝佸簱瀛樹笉瓒�";
+ return new JsonResult(resultEntity);
+
+ }
+ var left = admGoodsManageDTOs.GoodsLeft - dto.OrderNum;
+ admGoodsManageDTOs.GoodsLeft = left;
+
+ resultEntity = _admGoodsManageService.save(admGoodsManageDTOs);
+
+ AdmGoodsRecordDTO dto1 = new AdmGoodsRecordDTO();
+ dto1.GoodsId = admGoodsManageDTOs.Id;
+ dto1.GoodsNum = dto.OrderNum;
+ dto1.GoodsLeft = admGoodsManageDTOs.GoodsLeft;
+ dto1.RecordTypeId = "02";
+ dto1.RecStatus = "A";
+ dto1.Creater = curentuser.Id;
+ dto1.Createtime = DateTime.Now;
+ dto1.Modifier = curentuser.Id;
+ dto1.Modifytime = DateTime.Now;
+ dto1.OperationalMatters = "璁㈠崟锛�" + dto.OrderNo + " 璐拱涔︾睄";
+ resultEntity = _admGoodsRecordService.save(dto1);
+
+ }
+
+
+
+ dto.Shoulier = curentuser.Id;
+ dto.Shoulitime = DateTime.Now;
+ dto.ShouliStatus = "2";
+
+ resultEntity = _cooperOrderService.shouli(dto);
+
+ scope.Complete();
+ }
return new JsonResult(resultEntity);
}
@@ -502,7 +712,7 @@
/// <param name="data">宀椾綅瀹炰綋绫诲璞�</param>
/// <returns></returns>
///
-
+ [CheckLogin]
public IActionResult Wangong(string id)
{
var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
@@ -518,28 +728,8 @@
return new JsonResult(resultEntity);
}
- /// <summary>
- /// 閫佽揣
- /// </summary>
- /// <param name="data">宀椾綅瀹炰綋绫诲璞�</param>
- /// <returns></returns>
- ///
- public IActionResult Songhuo(string id)
- {
- var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
- ViewData["curentuser"] = curentuser;
- CooperOrderDTO dto = _cooperOrderService.Get(id);
- // dto.Id = id;
- dto.Songhuoer = curentuser.Id;
- dto.Songhuotime = DateTime.Now;
- dto.ShouliStatus = "5";
-
- ResultEntity resultEntity = _cooperOrderService.save(dto);
-
- return new JsonResult(resultEntity);
- }
-
+ [CheckLogin]
public IActionResult Chedan(string id = null)
{
var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
@@ -550,57 +740,163 @@
return View();
}
-
+ [CheckLogin]
public IActionResult chedantuihuan(decimal Price, string Chedanid)
{
- ResultEntity resultEntity = new ResultEntity();
- resultEntity.Result = true;
var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
ViewData["curentuser"] = curentuser;
-
- CooperOrderDTO dto = new CooperOrderDTO();
- dto.Id = Chedanid;
- dto.Chedaner = curentuser.Id;
- dto.Chedantime = DateTime.Now;
- dto.ChedanStatus = "A";
- dto.Chedan = Price;
- dto.ShouliStatus = "0";
- resultEntity = _cooperOrderService.chedan(dto);
+ ResultEntity resultEntity = new ResultEntity();
+ resultEntity.Result = false;
+ using (TransactionScope scope = new TransactionScope())
+ {
+ CooperOrderDTO dto = _cooperOrderService.Get(Chedanid);
+ if (dto.ShouliStatus != "2")
+ {
+ resultEntity.Result = false;
+ resultEntity.Message = "鍙湁鍙楃悊鐘舵�佺殑璁㈠崟鎵嶈兘鎾ゅ崟";
+ return new JsonResult(resultEntity);
+ }
+
+
+ if (dto.OrderType == "01")
+ {
+ var shi = _fiBookService.Get(dto.OrderType1);
+ if (string.IsNullOrEmpty(shi.Id))
+ {
+ resultEntity.Result = false;
+ resultEntity.Message = "鏈壘鍒拌鍟嗗搧";
+ return new JsonResult(resultEntity);
+ }
+ var admGoodsManageDTOs = _admGoodsManageService.GetList().Where(x => x.ISBN == shi.BookNo).FirstOrDefault();
+
+ if (admGoodsManageDTOs == null)
+ {
+
+
+ resultEntity.Result = false;
+ resultEntity.Message = "娌℃湁鎵惧埌璇ュ晢鍝�";
+ return new JsonResult(resultEntity);
+
+ }
+
+ var left = admGoodsManageDTOs.GoodsLeft + dto.OrderNum;
+ admGoodsManageDTOs.GoodsLeft = left;
+
+ resultEntity = _admGoodsManageService.save(admGoodsManageDTOs);
+
+ AdmGoodsRecordDTO dto1 = new AdmGoodsRecordDTO();
+ dto1.GoodsId = admGoodsManageDTOs.Id;
+ dto1.GoodsNum = dto.OrderNum;
+ dto1.GoodsLeft = admGoodsManageDTOs.GoodsLeft;
+ dto1.RecordTypeId = "01";
+ dto1.RecStatus = "A";
+ dto1.Creater = curentuser.Id;
+ dto1.Createtime = DateTime.Now;
+ dto1.Modifier = curentuser.Id;
+ dto1.Modifytime = DateTime.Now;
+ dto1.OperationalMatters = "璁㈠崟锛�" + dto.OrderNo + " 鎾ゅ崟";
+ resultEntity = _admGoodsRecordService.save(dto1);
+
+ }
+
+
+ dto.Chedaner = curentuser.Id;
+ dto.Chedantime = DateTime.Now;
+ dto.ChedanStatus = "A";
+ dto.Chedan = Price;
+ dto.ShouliStatus = "0";
+
+ resultEntity = _cooperOrderService.chedan(dto);
+ scope.Complete();
+ }
return new JsonResult(resultEntity);
}
-
+ [CheckLogin]
public IActionResult Huifang(string id = null)
{
var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
ViewData["curentuser"] = curentuser;
ViewData["Huifangid"] = id;
-
+ ViewData["PingjiaStatus"] = _liaotianService.GetSYScode("CooperOrder", "pingjia_status");
+ ViewData.Model = _cooperOrderService.Get(id);
return View();
}
-
- public IActionResult Huifangtuihuan(string Huifangremark, string Huifangid)
+ [CheckLogin]
+ public IActionResult Huifangtuihuan(CooperOrderDTO dto)
{
ResultEntity resultEntity = new ResultEntity();
resultEntity.Result = true;
var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
ViewData["curentuser"] = curentuser;
- CooperOrderDTO dto = new CooperOrderDTO();
- dto.Id = Huifangid;
+
+
dto.Huifanger = curentuser.Id;
dto.Huifangtime = DateTime.Now;
dto.HuifangStatus = "A";
- dto.Huifangremark = Huifangremark;
+
resultEntity = _cooperOrderService.huifang(dto);
return new JsonResult(resultEntity);
}
+
+ /// <summary>
+ /// 閫佽揣
+ /// </summary>
+ /// <param name="data">宀椾綅瀹炰綋绫诲璞�</param>
+ /// <returns></returns>
+ ///
+ [CheckLogin]
+ public IActionResult Songhuo(string id)
+ {
+ var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
+ ViewData["curentuser"] = curentuser;
+ ViewData["Huifangid"] = id;
+
+ var cooperOrderDTO = _cooperOrderService.Get(id);
+ if (!cooperOrderDTO.SonghuoTime1.HasValue)
+ {
+ cooperOrderDTO.SonghuoTime1 = DateTime.Now;
+ }
+
+ ViewData.Model = cooperOrderDTO;
+
+ return View();
+
+
+ }
+
+ [CheckLogin]
+ public IActionResult Songhuotuihuan(CooperOrderDTO dto)
+ {
+ ResultEntity resultEntity = new ResultEntity();
+ resultEntity.Result = true;
+ var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
+ ViewData["curentuser"] = curentuser;
+ var cooperOrderDTO = _cooperOrderService.Get(dto.Id);
+ if (cooperOrderDTO.ShouliStatus != "2")
+ {
+ resultEntity.Result = false;
+ resultEntity.Message = "鍙湁鍙楃悊鐘舵�佺殑璁㈠崟鎵嶈兘閫佽揣";
+ return new JsonResult(resultEntity);
+ }
+
+ dto.Songhuoer = curentuser.Id;
+ dto.Songhuotime = DateTime.Now;
+ dto.ShouliStatus = "5";
+
+ resultEntity = _cooperOrderService.Songhuo(dto);
+
+ return new JsonResult(resultEntity);
+ }
+
+ [CheckLogin]
public IActionResult Pingjia(string id = null)
{
var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
@@ -611,7 +907,7 @@
return View();
}
-
+ [CheckLogin]
public IActionResult Pingjiatuihuan(string PingjiaStatus, string Pingjiaid)
{
ResultEntity resultEntity = new ResultEntity();
@@ -632,7 +928,7 @@
}
-
+ [CheckLogin]
public IActionResult Print(string id = null)
{
var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
@@ -660,6 +956,20 @@
ViewData.Model = dto;
return View();
}
+
+ [CheckLogin]
+ public IActionResult printList(CooperOrderDTOSearch search)
+ {
+ //JsonResult jsonResult = new JsonResult(_liaotianService.SearchByPaging(search), new Newtonsoft.Json.Serialization.DefaultContractResolver());
+ search.rows = 1000;
+ search.page = 1;
+ ViewBag.ListCooperOrderDTO = _cooperOrderService.SearchByPaging(search).DataList as List<CooperOrderDTO>;
+
+
+
+ return View();
+ }
+
@@ -694,7 +1004,7 @@
result = JsonConvert.SerializeObject(shi);
}
- if (OrderType == "08" || OrderType == "10")
+ if (OrderType == "08" || OrderType == "10" || OrderType == "11")
{
result = "[]";
@@ -740,7 +1050,7 @@
if (OrderType == "02" )
{
- if(OrderType1== "鐢佃瘽鍜ㄨ" || OrderType1 == "褰撻潰鍜ㄨ" || OrderType1 == "浠f嫙璐ㄧ枒绛斿" || OrderType1 == "浠f嫙鎶曡瘔澶勭悊鍐冲畾" || OrderType1 == "绔炰簤瀵规墜鍜岃瘎瀹′笓瀹舵煡璇�" || OrderType1 == "鏀块噰璐�")
+ if(OrderType1== "鐢佃瘽鍜ㄨ" || OrderType1 == "褰撻潰鍜ㄨ" || OrderType1 == "浠f嫙璐ㄧ枒绛斿" || OrderType1 == "浠f嫙鎶曡瘔澶勭悊鍐冲畾" || OrderType1 == "绔炰簤瀵规墜鍜岃瘎瀹′笓瀹跺弬鍔犳斂搴滈噰璐暟鎹俊鎭煡璇�" || OrderType1 == "鏀块噰璐�")
{
var shi = _fiServiceService.GetList().Where(x => x.ServiceTypeTop == OrderType && x.ServiceType == OrderType1).FirstOrDefault();
result = JsonConvert.SerializeObject(shi);
@@ -753,7 +1063,10 @@
}
-
+ if (result == "")
+ {
+ result = "[]";
+ }
return result;
}
@@ -777,6 +1090,87 @@
return result;
}
-
+
+
+
+ //鎻愰棶
+ public IActionResult GetHuiYuanOrder([FromBody]CooperOrderDTOSearch search)
+ {
+ ReturnMsg<List<UserOrders>> returnMsg = new ReturnMsg<List<UserOrders>>();
+ returnMsg.code = 2;
+ try
+ {
+ string userid = "";
+ 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;
+
+ }
+ //LZhuanjiahuidumDTOSearch searchEntity = new LZhuanjiahuidumDTOSearch();
+ //searchEntity.Userid = userid;
+ ////searchEntity.HuidaStatus = "A";
+ //searchEntity.page = 1;
+ //searchEntity.rows = 1000;
+ search.HuiyuanId = userid;
+ ResultDataEntity<CooperOrderDTO> resultDataEntity = _cooperOrderService.SearchByPaging(search);
+ List<CooperOrderDTO> cooperOrderDTOs = resultDataEntity.DataList;
+ List<UserOrders> userOrders = new List<UserOrders>();
+ //灏佽璁㈠崟
+ foreach (var cooperOrderDTO in cooperOrderDTOs)
+ {
+ UserOrders userOrder = new UserOrders();
+ userOrder.order_goods = new List<usercart_items>();
+ usercart_items usercart_Item = new usercart_items();
+
+ userOrder.order_type = "offline";
+ userOrder.order_no = cooperOrderDTO.OrderNo;
+ userOrder.accept_name = cooperOrderDTO.Shr;
+ userOrder.mobile = cooperOrderDTO.ShrTel;
+ userOrder.address = cooperOrderDTO.ShrAddress;
+ userOrder.order_amount = cooperOrderDTO.Money.HasValue ? cooperOrderDTO.Money.Value: 0;
+ userOrder.statusChs = cooperOrderDTO.ShouliStatusName;
+ userOrder.add_time = cooperOrderDTO.Createtime;
+
+ usercart_Item.sell_price = cooperOrderDTO.Price.HasValue ? cooperOrderDTO.Price.Value : 0;
+ usercart_Item.quantity = cooperOrderDTO.OrderNum.HasValue ? decimal.ToInt32(cooperOrderDTO.OrderNum.Value) : 0;
+ usercart_Item.name = cooperOrderDTO.OrderTypeName + "-" + cooperOrderDTO.OrderType1Name + (string.IsNullOrEmpty(cooperOrderDTO.OrderType2)?"": "-"+cooperOrderDTO.OrderType2);
+
+
+
+ userOrder.order_goods.Add(usercart_Item);
+ userOrders.Add(userOrder);
+ }
+ returnMsg.code = 1;
+ returnMsg.returnObj = userOrders;
+ returnMsg.count = resultDataEntity.DataList.Count;
+ }
+ catch (Exception ex)
+ {
+ returnMsg.code = 2;
+ returnMsg.error = "娌℃湁鑾峰彇鍒皌oken";
+ returnMsg.count = 0;
+
+ }
+ return new JsonResult(returnMsg);
+ }
+
}
}
--
Gitblit v1.9.1