Commit cf009c3f authored by liudong1993's avatar liudong1993

1

parent 849f0c76
......@@ -581,11 +581,11 @@ namespace OneTwoThreeZeroOne.EContracts {
/// <summary>成人费用(元)/每人</summary>
[JsonPropertyName("adultCost")] public decimal AdultCost { get; set; }
/// <summary>儿童费用(元)/每人</summary>
[JsonPropertyName("childCost")] public decimal ChildCost { get; set; }
[JsonPropertyName("childCost")] public decimal? ChildCost { get; set; }
/// <summary>导游服务费(元)/每人</summary>
[JsonPropertyName("guideServiceCost")] public decimal GuideServiceCost { get; set; }
[JsonPropertyName("guideServiceCost")] public decimal? GuideServiceCost { get; set; }
/// <summary>单间差费用</summary>
[JsonPropertyName("singleSupplementCost")] public decimal SingleSupplementCost { get; set; }
//[JsonPropertyName("singleSupplementCost")] public decimal? SingleSupplementCost { get; set; }
/// <summary>总费用(元)</summary>
[JsonPropertyName("totalCost")] public decimal TotalCost { get; set; }
/// <summary>餐饮费用</summary>
......
......@@ -316,8 +316,29 @@ namespace REBORN.Module.DMCModule
{nameof(RB_Contract_Extend.DepositDate),model.DepositDate },
{nameof(RB_Contract_Extend.FinalPrice),model.FinalPrice },
{nameof(RB_Contract_Extend.PriceDescription),model.PriceDescription },
{nameof(RB_Contract_Extend.UpdateTime),DateTime.Now },
};
flag = contractRepository.Update(fileds, new WhereHelper(nameof(RB_Contract_Extend.Id), model.Id));
if (flag) {
if (model.IsApplyContract == 1)
{
TourismContractService service = GetContractService(model.RB_Group_Id ?? 0, model.RB_Branch_Id ?? 0, out string cmsg);
if (cmsg != "") { return flag; }
Console.WriteLine("1");
//审核通过, 同步上传合同至 公众号
Model.Entity.Dmc.RB_Contract htModel = contractRepository.GetEntity(model.Id);
if (string.IsNullOrEmpty(htModel.UnionGuestIds)) { return flag; }
//注意默认值 正式需要删除
//注意默认值 正式需要删除
htModel.Client_Name = "刘东";
htModel.Client_IDCardNum = "510112199301013617";
htModel.Client_Call = "18328620563";
CreateContractToLYJ(service, htModel);
}
}
}
else
{
......@@ -326,11 +347,13 @@ namespace REBORN.Module.DMCModule
var newId = contractRepository.Insert(model);
model.Id = newId;
flag = newId > 0;
if (newId > 0 && model.IsApplyContract==1) {
if (newId > 0 && model.IsApplyContract==1)
{
TourismContractService service = GetContractService(model.RB_Group_Id ?? 0, model.RB_Branch_Id ?? 0, out string cmsg);
if (cmsg != "") { return flag; }
Console.WriteLine("1");
//审核通过, 同步上传合同至 公众号
Model.Entity.Dmc.RB_Contract htModel = contractRepository.GetEntity(newId);
if (string.IsNullOrEmpty(htModel.UnionGuestIds)) { return false; }
......@@ -340,7 +363,19 @@ namespace REBORN.Module.DMCModule
htModel.Client_Name = "刘东";
htModel.Client_IDCardNum = "510112199301013617";
htModel.Client_Call = "18328620563";
CreateContractToLYJ(service, htModel);
}
}
return flag;
}
/// <summary>
/// 创建合同
/// </summary>
/// <param name="service"></param>
/// <param name="htModel"></param>
private void CreateContractToLYJ(TourismContractService service, Model.Entity.Dmc.RB_Contract htModel)
{
Console.WriteLine("3");
#region 开始组装数据
......@@ -359,7 +394,8 @@ namespace REBORN.Module.DMCModule
var TouristId = new TouristId { IDType = (int)IDType.IDCard, IDNumber = item.IdCard };
if (string.IsNullOrEmpty(item.IdCard)) { TouristId = new TouristId { IDType = (int)IDType.Passport, IDNumber = item.PassportNo }; }
bool IsChild = false;
if (item.Birthday.HasValue && htModel.StartDate.HasValue) {
if (item.Birthday.HasValue && htModel.StartDate.HasValue)
{
// 计算基础年龄(年份差)
int age = htModel.StartDate.Value.Year - item.Birthday.Value.Year;
......@@ -500,8 +536,8 @@ namespace REBORN.Module.DMCModule
Cost = new CostInfo()
{
AdultCost = htModel.Adult_Price ?? 0,
ChildCost = htModel.Child_Price ?? 0,
GuideServiceCost = htModel.Service_Price ?? 0,
ChildCost = htModel.Child_Price ==0?null : htModel.Child_Price,
GuideServiceCost = htModel.Service_Price ==0?null : htModel.Service_Price,
TotalCost = htModel.Order_Price ?? 0,
PaymentTime = htModel.Pay_Date,
PaymentMethod = htModel.PayType ?? 1,
......@@ -542,7 +578,7 @@ namespace REBORN.Module.DMCModule
var payload = service.GetJson(req);
LogHelper.Write(payload);
var response = service.ApplyContract(payload);
var response = service.ApplyContract(payload, htModel.ThirdContractID);
LogHelper.Write(JsonHelper.Serialize(response));
Console.WriteLine("5");
......@@ -586,9 +622,6 @@ namespace REBORN.Module.DMCModule
}
#endregion
}
}
return flag;
}
/// <summary>
/// 更新是否旅行社盖章(0-未盖章,1-已盖章)【出境合同】
......@@ -981,6 +1014,27 @@ namespace REBORN.Module.DMCModule
{nameof(RB_Travel_Contract_Extend.Tourists_IDType),extModel.Tourists_IDType },
};
flag = travel_ContractRepository.Update(fileds, new WhereHelper(nameof(RB_Travel_Contract_Extend.ID), extModel.ID));
if (flag) {
if (Id > 0 && extModel.IsApplyContract == 1)
{
var htModel = extModel;
if (htModel.CType == 1 || htModel.CType == 2 || htModel.CType == 3)
{
//开始同步合同至旅游局
//审核通过, 同步上传合同至 公众号
if (string.IsNullOrEmpty(htModel.GuestJson)) { return flag; }
//注意默认值 正式需要删除
htModel.Tourists_Tel = "18328620563";
#region 初始化旅游局Key
TourismContractService service = GetContractService(htModel.RB_Group_Id ?? 0, htModel.RB_Branch_Id ?? 0, out string cmsg);
if (cmsg != "") { LogHelper.Write("初始化旅游局Key失败:" + cmsg); return false; }
#endregion
CreateSingleContractToLYJ(htModel, service);
}
}
}
}
else
{
......@@ -1004,6 +1058,20 @@ namespace REBORN.Module.DMCModule
TourismContractService service = GetContractService(htModel.RB_Group_Id ?? 0, htModel.RB_Branch_Id ?? 0, out string cmsg);
if (cmsg != "") { LogHelper.Write("初始化旅游局Key失败:" + cmsg); return false; }
#endregion
CreateSingleContractToLYJ(htModel, service);
}
}
}
return flag;
}
/// <summary>
/// 上传旅游局
/// </summary>
/// <param name="htModel"></param>
/// <param name="service"></param>
private void CreateSingleContractToLYJ(RB_Travel_Contract_Extend htModel, TourismContractService service)
{
//这一套合同 没有客人列表,走 合同里抓取
//查询旅客名单
......@@ -1221,8 +1289,8 @@ namespace REBORN.Module.DMCModule
Cost = new CostInfo()
{
AdultCost = htModel.C_AdultPrice ?? 0,
ChildCost = htModel.C_ChildrenPrice ?? 0,
GuideServiceCost = htModel.C_GuideServicePrice ?? 0,
ChildCost = htModel.C_ChildrenPrice ==0 ?null : htModel.C_ChildrenPrice,
GuideServiceCost = htModel.C_GuideServicePrice ==0?null : htModel.C_GuideServicePrice,
TotalCost = htModel.C_TotalPrice ?? 0,
PaymentTime = htModel.C_PayDate.HasValue ? htModel.C_PayDate.Value.ToString("yyyy-MM-dd") : "",
PaymentMethod = (htModel.C_PayType == 1 ? 1 : htModel.C_PayType == 5 ? 2 : 3),
......@@ -1586,10 +1654,6 @@ namespace REBORN.Module.DMCModule
}
}
}
}
}
return flag;
}
/// <summary>
/// 最新一套 初始化
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment