117 lines
4.3 KiB
C#
117 lines
4.3 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Configuration;
|
|
using System.Threading.Tasks;
|
|
using System.Web.Http;
|
|
using System.Web.Http.Description;
|
|
using SuperMap.RealEstate.ServiceModel;
|
|
using ESCG = EShang.Common.GeneralMethod;
|
|
using ESCM = EShang.Common.Model;
|
|
using HZQR.Common;
|
|
|
|
namespace OpenApi.Controllers.BigData
|
|
{
|
|
/// <summary>
|
|
/// 大数据分析相关接口【卡口数据传输】
|
|
/// </summary>
|
|
public class BigDataController : BaseController
|
|
{
|
|
/// <summary>
|
|
/// 涉疫车辆推送
|
|
/// </summary>
|
|
protected string WarningPlate = ConfigurationManager.AppSettings["WarningPlate"];
|
|
|
|
#region 添加实时卡口流水
|
|
/// <summary>
|
|
/// 添加实时卡口流水
|
|
/// </summary>
|
|
/// <param name="BayonetList">卡口流水集合</param>
|
|
/// <returns></returns>
|
|
[Route("BigData/AddBayonet")]
|
|
[AcceptVerbs("POST")]
|
|
[ResponseType(typeof(Models.JsonMsg<string>))]
|
|
public IHttpActionResult AddBayonet(List<ESCM.BAYONETModel> BayonetList)
|
|
{
|
|
try
|
|
{
|
|
//新增卡口流水表
|
|
ESCG.BAYONETHelper.AddBayonet(transaction, BayonetList);
|
|
|
|
//开启异步线程
|
|
Task task = Task.Factory.StartNew(() =>
|
|
{
|
|
Transaction _Transaction = new Transaction();
|
|
|
|
try
|
|
{
|
|
foreach (ESCM.BAYONETModel bayonetModel in BayonetList)
|
|
{
|
|
if (!string.IsNullOrWhiteSpace(bayonetModel.LICENSE_PLATE) &&
|
|
!string.IsNullOrWhiteSpace(WarningPlate) && bayonetModel.INOUT_TYPE == 1)
|
|
{
|
|
foreach (string Plate in WarningPlate.Split(','))
|
|
{
|
|
if (bayonetModel.LICENSE_PLATE.StartsWith(Plate))
|
|
{
|
|
Method.WeChatPush.WeChat_SendMessage(_Transaction, bayonetModel);
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
catch (Exception _Exception)
|
|
{
|
|
LogUtil.WriteLog(null, "消息推送错误:" + _Exception.Message,
|
|
DateTime.Now.ToString("yyyyMMdd") + "_SafetyWarning");
|
|
}
|
|
finally
|
|
{
|
|
_Transaction.Release();
|
|
_Transaction.Dispose();
|
|
}
|
|
});
|
|
|
|
return Ok(Method.Common.ReturnJson(100, "添加成功"));
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
//事务回滚
|
|
transaction.Rollback();
|
|
LogUtil.WriteLog(null, "添加失败!失败原因:" + ex.Message,
|
|
DateTime.Now.ToString("yyyyMMdd") + "_AddBayonet");
|
|
return Ok(Method.Common.ReturnJson(999, "添加失败" + ex.Message));
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 添加断面流量数据
|
|
/// <summary>
|
|
/// 添加断面流量数据
|
|
/// </summary>
|
|
/// <param name="SectionFlowList">断面流量数据集合</param>
|
|
/// <returns></returns>
|
|
[Route("BigData/AddSectionFlow")]
|
|
[AcceptVerbs("POST")]
|
|
[ResponseType(typeof(Models.JsonMsg<string>))]
|
|
public IHttpActionResult AddSectionFlow(List<ESCM.SECTIONFLOWModel> SectionFlowList)
|
|
{
|
|
try
|
|
{
|
|
//新增卡口流水表
|
|
ESCG.SECTIONFLOWHelper.AddSectionFlow(transaction, SectionFlowList);
|
|
|
|
return Ok(Method.Common.ReturnJson(100, "添加成功"));
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
//事务回滚
|
|
transaction.Rollback();
|
|
LogUtil.WriteLog(null, "添加失败!失败原因:" + ex.Message,
|
|
DateTime.Now.ToString("yyyyMMdd") + "_AddSectionFlow");
|
|
return Ok(Method.Common.ReturnJson(999, "添加失败" + ex.Message));
|
|
}
|
|
}
|
|
#endregion
|
|
}
|
|
} |