|
@@ -21,6 +21,8 @@ namespace Sharing.DaoShu110.Controllers
|
|
|
private readonly ICapPublisher _capPublisher;
|
|
|
private readonly IPoliceReceiveChainAlarmDsRepository _policeReceiveChainAlarmDsRepository;
|
|
|
private readonly IPoliceReceiveChainDealDsRepository _policeReceiveChainDealDsRepository;
|
|
|
+ private readonly IPoliceSendChainAlarmDsRepository _policeSendChainAlarmDsRepository;
|
|
|
+ private readonly IPoliceSendChainDealDsRepository _policeSendChainDealDsRepository;
|
|
|
|
|
|
/// <summary>
|
|
|
///
|
|
@@ -31,12 +33,16 @@ namespace Sharing.DaoShu110.Controllers
|
|
|
/// <param name="policeReceiveChainDealDsRepository"></param>
|
|
|
public PoliceDSController(IMapper mapper, ICapPublisher capPublisher,
|
|
|
IPoliceReceiveChainAlarmDsRepository policeReceiveChainAlarmDsRepository,
|
|
|
- IPoliceReceiveChainDealDsRepository policeReceiveChainDealDsRepository)
|
|
|
+ IPoliceReceiveChainDealDsRepository policeReceiveChainDealDsRepository,
|
|
|
+ IPoliceSendChainAlarmDsRepository policeSendChainAlarmDsRepository,
|
|
|
+ IPoliceSendChainDealDsRepository policeSendChainDealDsRepository)
|
|
|
{
|
|
|
_mapper = mapper;
|
|
|
_capPublisher = capPublisher;
|
|
|
_policeReceiveChainAlarmDsRepository = policeReceiveChainAlarmDsRepository;
|
|
|
_policeReceiveChainDealDsRepository = policeReceiveChainDealDsRepository;
|
|
|
+ _policeSendChainAlarmDsRepository = policeSendChainAlarmDsRepository;
|
|
|
+ _policeSendChainDealDsRepository = policeSendChainDealDsRepository;
|
|
|
}
|
|
|
|
|
|
#region receive-工单受理
|
|
@@ -92,9 +98,6 @@ namespace Sharing.DaoShu110.Controllers
|
|
|
{
|
|
|
#region 写入本地数据库
|
|
|
var data = _mapper.Map<PoliceReceiveChainAlarmDs>(chainAlarm);
|
|
|
- data.DataInsertTime = DateTime.Now;
|
|
|
- data.DataState = 1;
|
|
|
- data.DataSyncTime = DateTime.Now;
|
|
|
if (!string.IsNullOrEmpty(await _policeReceiveChainAlarmDsRepository.AddAsync(data)))
|
|
|
{
|
|
|
result.rcode = 0;
|
|
@@ -197,9 +200,6 @@ namespace Sharing.DaoShu110.Controllers
|
|
|
{
|
|
|
#region 写入本地数据库
|
|
|
var data = _mapper.Map<PoliceReceiveChainDealDs>(chainDeal);
|
|
|
- data.DataInsertTime = DateTime.Now;
|
|
|
- data.DataState = 1;
|
|
|
- data.DataSyncTime = DateTime.Now;
|
|
|
if (!string.IsNullOrEmpty(await _policeReceiveChainDealDsRepository.AddAsync(data)))
|
|
|
{
|
|
|
result.rcode = 0;
|
|
@@ -242,190 +242,161 @@ namespace Sharing.DaoShu110.Controllers
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
- //#region send-工单受理
|
|
|
+ #region send-工单受理
|
|
|
|
|
|
- ///// <summary>
|
|
|
- ///// 工单受理
|
|
|
- ///// </summary>
|
|
|
- ///// <returns></returns>
|
|
|
- //[Route("service/api/ds/12345To110/chainAlarm")]
|
|
|
- //[HttpPost]
|
|
|
- //public async Task<HttpResponseMessage> ChainAlarm_Send()
|
|
|
- //{
|
|
|
- // CToken_DaoShu cToken = new CToken_DaoShu();
|
|
|
- // string dcsm = cToken.token3_dcsm;
|
|
|
- // string sm4 = cToken.token3_sm4_mw;
|
|
|
+ /// <summary>
|
|
|
+ /// 工单受理
|
|
|
+ /// </summary>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost("service/api/ds/12345To110/chainAlarm")]
|
|
|
+ [AllowAnonymous]
|
|
|
+ public async Task<HttpResponseMessage> ChainAlarm_Send()
|
|
|
+ {
|
|
|
+ //{"startDate":"2023-04-01 10:43:17","endDate":"2023-04-17 10:43:17"}
|
|
|
+ //gzWXSn3A2ZW9u3k9yrHdEqE5zRzto/Rud6LZ6JRJ1k59ou5nWABc8t8fR/sWU89lGweFQMsZkefowEBYzArADnSXjbKwfQj19UoF5RN/0mI=
|
|
|
+ CToken_DaoShu cToken = new CToken_DaoShu();
|
|
|
+ string sm4 = cToken.token3_sm4_mw;
|
|
|
|
|
|
- // IApiResultR apiR = null;
|
|
|
- // try
|
|
|
- // {
|
|
|
- // // 验证dcsm
|
|
|
- // string dcsmMsg = CComm.checkDcsm(Request.Headers["dcsm"].ToString(), dcsm);
|
|
|
- // if (false == string.IsNullOrEmpty(dcsmMsg))
|
|
|
- // {
|
|
|
- // apiR = ApiResultR.Failed(dcsmMsg);
|
|
|
- // }
|
|
|
- // else
|
|
|
- // {
|
|
|
- // string base64String = await CComm.getStreamBase64(HttpContext.Request);
|
|
|
- // string startDate = "", endDate = "";
|
|
|
- // if (false == string.IsNullOrEmpty(base64String))
|
|
|
- // {
|
|
|
- // // 解密:base64通过sm4解密转json
|
|
|
- // string jsonRes = Sm4Crypto.Decrypt_ECB_Base64(sm4, base64String);
|
|
|
- // // json 转 实体类
|
|
|
- // ChainAlarm_DS chainAlarm = System.Text.Json.JsonSerializer.Deserialize<ChainAlarm_DS>(jsonRes);
|
|
|
- // if (null == chainAlarm)
|
|
|
- // {
|
|
|
- // chainAlarm = new ChainAlarm_DS();
|
|
|
- // }
|
|
|
- // startDate = chainAlarm.startDate;
|
|
|
- // endDate = chainAlarm.endDate;
|
|
|
- // }
|
|
|
+ IApiResultR apiR;
|
|
|
+ try
|
|
|
+ {
|
|
|
+ // 验证dcsm
|
|
|
+ string dcsmMsg = CComm.checkDcsm(Request.Headers["dcsm"].ToString(), cToken.token3_dcsm);
|
|
|
+ if (false == string.IsNullOrEmpty(dcsmMsg))
|
|
|
+ {
|
|
|
+ apiR = ApiResultR.Failed(dcsmMsg);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ string base64String = await CComm.getStreamBase64(HttpContext.Request);
|
|
|
+ string startDate = "", endDate = "";
|
|
|
+ if (false == string.IsNullOrEmpty(base64String))
|
|
|
+ {
|
|
|
+ // 解密:base64通过sm4解密转json
|
|
|
+ string jsonRes = Sm4Crypto.Decrypt_ECB_Base64(sm4, base64String);
|
|
|
+ // json 转 实体类
|
|
|
+ OpenData openData = System.Text.Json.JsonSerializer.Deserialize<OpenData>(jsonRes);
|
|
|
+ if (null == openData)
|
|
|
+ {
|
|
|
+ openData = new OpenData();
|
|
|
+ }
|
|
|
+ startDate = openData.StartDate;
|
|
|
+ endDate = openData.EndDate;
|
|
|
+ }
|
|
|
|
|
|
- // bool bRun = true;
|
|
|
+ var listData = await _policeSendChainAlarmDsRepository.Queryable()
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(startDate), p => p.CallPoliceTime >= Convert.ToDateTime(startDate))
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(endDate), p => p.CallPoliceTime >= Convert.ToDateTime(endDate))
|
|
|
+ .OrderBy(p => p.CallPoliceTime)
|
|
|
+ .Take(50)
|
|
|
+ .ToListAsync();
|
|
|
|
|
|
- // if (string.IsNullOrEmpty(startDate) == false && CComm.IsDate(startDate) == false)
|
|
|
- // {
|
|
|
- // bRun = false;
|
|
|
- // apiR = ApiResultR.Failed("【开始时间】不是日期格式 yyyy-MM-dd HH:mm:ss");
|
|
|
- // }
|
|
|
- // if (string.IsNullOrEmpty(endDate) == false && CComm.IsDate(endDate) == false)
|
|
|
- // {
|
|
|
- // bRun = false;
|
|
|
- // apiR = ApiResultR.Failed("【结束时间】不是日期格式 yyyy-MM-dd HH:mm:ss");
|
|
|
- // }
|
|
|
+ if (null == listData)
|
|
|
+ apiR = ApiResultR.Failed();
|
|
|
+ else
|
|
|
+ {
|
|
|
+ var dto = _mapper.Map<IReadOnlyList<ChainAlarm_DS>>(listData);
|
|
|
+ // 返回数据
|
|
|
+ apiR = ApiResultR.Succeed(System.Text.Json.JsonSerializer.Serialize(dto));
|
|
|
+ }
|
|
|
|
|
|
- // if (bRun)
|
|
|
- // {
|
|
|
- // DataTable dtData = Hotline.BLL.Order.Police.COrder.chainAlarm_ds(startDate, endDate);
|
|
|
- // if (null == dtData)
|
|
|
- // {
|
|
|
- // apiR = ApiResultR.Failed();
|
|
|
- // }
|
|
|
- // else
|
|
|
- // {
|
|
|
- // // 更新状态
|
|
|
- // Hotline.BLL.Order.Police.COrder.updatechainAlarm_ds(dtData);
|
|
|
- // // 返回数据
|
|
|
- // apiR = ApiResultR.Succeed(dtData);
|
|
|
- // }
|
|
|
- // }
|
|
|
- // }
|
|
|
- // }
|
|
|
- // catch (System.Exception ex)
|
|
|
- // {
|
|
|
- // apiR = ApiResultR.Failed("接口异常");
|
|
|
- // }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (System.Exception)
|
|
|
+ {
|
|
|
+ apiR = ApiResultR.Failed("接口异常");
|
|
|
+ }
|
|
|
|
|
|
- // // 返回数据转Json
|
|
|
- // string jsonResult = CJson.modelToJson(apiR);
|
|
|
- // // 加密:json通过sm4加密转base64
|
|
|
- // string base64 = Sm4Crypto.Encrypt_ECB_Base64(sm4, jsonResult);
|
|
|
+ // 返回数据转Json
|
|
|
+ string jsonResult = CJson.modelToJson(apiR);
|
|
|
+ // 加密:json通过sm4加密转base64
|
|
|
+ string base64 = Sm4Crypto.Encrypt_ECB_Base64(sm4, jsonResult);
|
|
|
|
|
|
- // var resp = new HttpResponseMessage(HttpStatusCode.OK);
|
|
|
- // resp.Content = new StringContent(base64, System.Text.Encoding.UTF8, "text/plain");
|
|
|
- // return resp;
|
|
|
- //}
|
|
|
+ var resp = new HttpResponseMessage(HttpStatusCode.OK);
|
|
|
+ resp.Content = new StringContent(base64, System.Text.Encoding.UTF8, "text/plain");
|
|
|
+ return resp;
|
|
|
+ }
|
|
|
|
|
|
- //#endregion
|
|
|
+ #endregion
|
|
|
|
|
|
- //#region send-工单办结
|
|
|
+ #region send-工单办结
|
|
|
|
|
|
- ///// <summary>
|
|
|
- ///// 工单办结
|
|
|
- ///// </summary>
|
|
|
- ///// <returns></returns>
|
|
|
- //[Route("service/api/ds/12345To110/chainDeal")]
|
|
|
- //[HttpPost]
|
|
|
- //public async Task<HttpResponseMessage> ChainDeal_Send()
|
|
|
- //{
|
|
|
- // // 测试JSON
|
|
|
- // // {"JJDBH":"510300202304070001202304070001","CZLX":"1"}
|
|
|
+ /// <summary>
|
|
|
+ /// 工单办结
|
|
|
+ /// </summary>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost("service/api/ds/12345To110/chainDeal")]
|
|
|
+ [AllowAnonymous]
|
|
|
+ public async Task<HttpResponseMessage> ChainDeal_Send()
|
|
|
+ {
|
|
|
+ // 测试JSON
|
|
|
+ // {"JJDBH":"510300202304070001202304070001","CZLX":"1"}
|
|
|
|
|
|
- // // 测试Base64
|
|
|
- // // 6iTxDt+SA4luce9A0nT+th33Ji9vhqrffmcF8p+YbV3Jkc1wetlS7DMZM0xgxpYJxep4I9AvUkcC8kUH39M0BQ==
|
|
|
+ // 测试Base64
|
|
|
+ // 6RB6Hat8dpBfvCTtEpwotd/MlonxdmqZaa3TcLaua/xcjFv1SZJzKZPrhgsux63Gq/DXxtAQ25buLsI1fgFv3g==
|
|
|
|
|
|
- // CToken_DaoShu cToken = new CToken_DaoShu();
|
|
|
- // string dcsm = cToken.token2_dcsm;
|
|
|
- // string sm4 = cToken.token2_sm4_mw;
|
|
|
+ CToken_DaoShu cToken = new CToken_DaoShu();
|
|
|
+ string sm4 = cToken.token2_sm4_mw;
|
|
|
|
|
|
- // IApiResultR apiR = null;
|
|
|
- // try
|
|
|
- // {
|
|
|
- // // 验证dcsm
|
|
|
- // string dcsmMsg = CComm.checkDcsm(Request.Headers["dcsm"].ToString(), dcsm);
|
|
|
- // if (false == string.IsNullOrEmpty(dcsmMsg))
|
|
|
- // {
|
|
|
- // apiR = ApiResultR.Failed(dcsmMsg);
|
|
|
- // }
|
|
|
- // else
|
|
|
- // {
|
|
|
- // string base64String = await CComm.getStreamBase64(HttpContext.Request);
|
|
|
- // string JJDBH = "", CZLX = "";
|
|
|
- // string startDate = "", endDate = "";
|
|
|
- // if (false == string.IsNullOrEmpty(base64String))
|
|
|
- // {
|
|
|
- // // 解密:base64通过sm4解密转json
|
|
|
- // string jsonRes = Sm4Crypto.Decrypt_ECB_Base64(sm4, base64String);
|
|
|
- // // json 转 实体类
|
|
|
- // ChainDeal_DS chainDeal = System.Text.Json.JsonSerializer.Deserialize<ChainDeal_DS>(jsonRes);
|
|
|
- // if (null == chainDeal)
|
|
|
- // {
|
|
|
- // chainDeal = new ChainDeal_DS();
|
|
|
- // }
|
|
|
- // JJDBH = chainDeal.JJDBH;
|
|
|
- // CZLX = chainDeal.CZLX;
|
|
|
- // startDate = chainDeal.startDate;
|
|
|
- // endDate = chainDeal.endDate;
|
|
|
- // }
|
|
|
+ IApiResultR apiR;
|
|
|
+ try
|
|
|
+ {
|
|
|
+ // 验证dcsm
|
|
|
+ string dcsmMsg = CComm.checkDcsm(Request.Headers["dcsm"].ToString(), cToken.token2_dcsm);
|
|
|
+ if (false == string.IsNullOrEmpty(dcsmMsg))
|
|
|
+ {
|
|
|
+ apiR = ApiResultR.Failed(dcsmMsg);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ string base64String = await CComm.getStreamBase64(HttpContext.Request);
|
|
|
|
|
|
- // bool bRun = true;
|
|
|
+ OpenData openData = new OpenData();
|
|
|
+ if (false == string.IsNullOrEmpty(base64String))
|
|
|
+ {
|
|
|
+ // 解密:base64通过sm4解密转json
|
|
|
+ string jsonRes = Sm4Crypto.Decrypt_ECB_Base64(sm4, base64String);
|
|
|
+ // json 转 实体类
|
|
|
+ openData = System.Text.Json.JsonSerializer.Deserialize<OpenData>(jsonRes);
|
|
|
|
|
|
- // if (string.IsNullOrEmpty(startDate) == false && CComm.IsDate(startDate) == false)
|
|
|
- // {
|
|
|
- // bRun = false;
|
|
|
- // apiR = ApiResultR.Failed("【开始时间】不是日期格式 yyyy-MM-dd HH:mm:ss");
|
|
|
- // }
|
|
|
- // if (string.IsNullOrEmpty(endDate) == false && CComm.IsDate(endDate) == false)
|
|
|
- // {
|
|
|
- // bRun = false;
|
|
|
- // apiR = ApiResultR.Failed("【结束时间】不是日期格式 yyyy-MM-dd HH:mm:ss");
|
|
|
- // }
|
|
|
+ }
|
|
|
|
|
|
- // if (bRun)
|
|
|
- // {
|
|
|
- // DataTable dtData = Hotline.BLL.Order.Police.COrder.chainDealSearch_ds(startDate, endDate, JJDBH, CZLX);
|
|
|
- // if (null == dtData)
|
|
|
- // {
|
|
|
- // apiR = ApiResultR.Failed();
|
|
|
- // }
|
|
|
- // else
|
|
|
- // {
|
|
|
- // // 更新状态
|
|
|
- // Hotline.BLL.Order.Police.COrder.updatechainDeal_ds(dtData);
|
|
|
- // // 返回数据
|
|
|
- // apiR = ApiResultR.Succeed(dtData);
|
|
|
- // }
|
|
|
- // }
|
|
|
- // }
|
|
|
- // }
|
|
|
- // catch (System.Exception ex)
|
|
|
- // {
|
|
|
- // apiR = ApiResultR.Failed("接口异常");
|
|
|
- // }
|
|
|
+ var listData = await _policeSendChainDealDsRepository.Queryable()
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(openData.StartDate), p => p.WarehousingTime >= Convert.ToDateTime(openData.StartDate))
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(openData.EndDate), p => p.WarehousingTime >= Convert.ToDateTime(openData.EndDate))
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(openData.AlarmReceiptNumber), p => p.AlarmReceiptNumber == openData.AlarmReceiptNumber)
|
|
|
+ .Where(p => p.DisposalType == openData.DisposalType)
|
|
|
+ .OrderBy(p => p.WarehousingTime)
|
|
|
+ .Take(50)
|
|
|
+ .ToListAsync();
|
|
|
|
|
|
- // // 返回数据转Json
|
|
|
- // string jsonResult = CJson.modelToJson(apiR);
|
|
|
- // // 加密:json通过sm4加密转base64
|
|
|
- // string base64 = Sm4Crypto.Encrypt_ECB_Base64(sm4, jsonResult);
|
|
|
+ if (null == listData)
|
|
|
+ apiR = ApiResultR.Failed();
|
|
|
+ else
|
|
|
+ {
|
|
|
+ var dto = _mapper.Map<IReadOnlyList<ChainDeal_DS>>(listData);
|
|
|
+ // 返回数据
|
|
|
+ apiR = ApiResultR.Succeed(System.Text.Json.JsonSerializer.Serialize(dto));
|
|
|
+ }
|
|
|
|
|
|
- // var resp = new HttpResponseMessage(HttpStatusCode.OK);
|
|
|
- // resp.Content = new StringContent(base64, System.Text.Encoding.UTF8, "text/plain");
|
|
|
- // return resp;
|
|
|
- //}
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (System.Exception)
|
|
|
+ {
|
|
|
+ apiR = ApiResultR.Failed("接口异常");
|
|
|
+ }
|
|
|
|
|
|
- //#endregion
|
|
|
+ // 返回数据转Json
|
|
|
+ string jsonResult = CJson.modelToJson(apiR);
|
|
|
+ // 加密:json通过sm4加密转base64
|
|
|
+ string base64 = Sm4Crypto.Encrypt_ECB_Base64(sm4, jsonResult);
|
|
|
+
|
|
|
+ var resp = new HttpResponseMessage(HttpStatusCode.OK);
|
|
|
+ resp.Content = new StringContent(base64, System.Text.Encoding.UTF8, "text/plain");
|
|
|
+ return resp;
|
|
|
+ }
|
|
|
+
|
|
|
+ #endregion
|
|
|
|
|
|
//#region send-知识库列表
|
|
|
|
|
@@ -433,8 +404,8 @@ namespace Sharing.DaoShu110.Controllers
|
|
|
///// 查询知识库列表
|
|
|
///// </summary>
|
|
|
///// <returns></returns>
|
|
|
- //[Route("service/api/ds/get_knowledge_info")]
|
|
|
- //[HttpPost]
|
|
|
+ //[HttpPost("service/api/ds/get_knowledge_info")]
|
|
|
+ //[AllowAnonymous]
|
|
|
//public async Task<HttpResponseMessage> Get_Knowledge_Info()
|
|
|
//{
|
|
|
// // 测试Json
|
|
@@ -446,14 +417,13 @@ namespace Sharing.DaoShu110.Controllers
|
|
|
// // 93ObxWa6vhYID1pe3rx0ThmtcsgBLXGqvIYCMM8iUwPpItcJamHEbCHDV62/5tDIG7LZfbQCYscMo05nhdfdoQKo0xVndLdYFCsp6s291efskazkOkKJlTsM8iK4mdwj
|
|
|
|
|
|
// CToken_DaoShu cToken = new CToken_DaoShu();
|
|
|
- // string dcsm = cToken.token5_dcsm;
|
|
|
// string sm4 = cToken.token5_sm4_mw;
|
|
|
|
|
|
// IApiResultR apiR = null;
|
|
|
// try
|
|
|
// {
|
|
|
// // 验证dcsm
|
|
|
- // string dcsmMsg = CComm.checkDcsm(Request.Headers["dcsm"].ToString(), dcsm);
|
|
|
+ // string dcsmMsg = CComm.checkDcsm(Request.Headers["dcsm"].ToString(), cToken.token5_dcsm);
|
|
|
// if (false == string.IsNullOrEmpty(dcsmMsg))
|
|
|
// {
|
|
|
// apiR = ApiResultR.Failed(dcsmMsg);
|
|
@@ -524,8 +494,8 @@ namespace Sharing.DaoShu110.Controllers
|
|
|
///// 查询知识库内容
|
|
|
///// </summary>
|
|
|
///// <returns></returns>
|
|
|
- //[Route("service/api/ds/get_knowledge_content")]
|
|
|
- //[HttpPost]
|
|
|
+ //[HttpPost("service/api/ds/get_knowledge_content")]
|
|
|
+ // [AllowAnonymous]
|
|
|
//public async Task<HttpResponseMessage> Get_Knowledge_Content()
|
|
|
//{
|
|
|
// // 测试JSON
|