parent
3df91527d8
commit
1c5a108514
|
|
@ -71,6 +71,39 @@ namespace Nirvana.Common
|
||||||
public static readonly int NORESOURCE = 100002;
|
public static readonly int NORESOURCE = 100002;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class ApiResultState
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 系统繁忙
|
||||||
|
/// </summary>
|
||||||
|
public static readonly int SYSTEMBUSY = -1;
|
||||||
|
/// <summary>
|
||||||
|
/// 成功 0
|
||||||
|
/// </summary>
|
||||||
|
public static readonly int SUCCESS = 0;
|
||||||
|
/// <summary>
|
||||||
|
/// 参数有误
|
||||||
|
/// </summary>
|
||||||
|
public static readonly int PARAMERROR = 40000;
|
||||||
|
/// <summary>
|
||||||
|
/// appid无效
|
||||||
|
/// </summary>
|
||||||
|
public static readonly int NONAPPID = 40001;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// IP不合法
|
||||||
|
/// </summary>
|
||||||
|
public static readonly int IPNOALLOW = 40003;
|
||||||
|
/// <summary>
|
||||||
|
/// 缺少appid参数
|
||||||
|
/// </summary>
|
||||||
|
public static readonly int NOAPPID = 41001;
|
||||||
|
/// <summary>
|
||||||
|
/// 无可用数据
|
||||||
|
/// </summary>
|
||||||
|
public static readonly int NODATA = 50001;
|
||||||
|
}
|
||||||
|
|
||||||
public class ResultInfoV1
|
public class ResultInfoV1
|
||||||
{
|
{
|
||||||
public string state { get; set; }
|
public string state { get; set; }
|
||||||
|
|
|
||||||
|
|
@ -298,7 +298,7 @@ namespace Nirvana.Common
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static string ToStr(this string data)
|
public static string ToStr(this string data)
|
||||||
{
|
{
|
||||||
return string.IsNullOrEmpty(data) ? string.Empty : data;
|
return string.IsNullOrEmpty(data) ? string.Empty : data.Replace(" ","");
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
|
||||||
|
|
@ -266,10 +266,9 @@ namespace Nirvana.Common
|
||||||
return month <= 0 ? age*12 : age*12+month;
|
return month <= 0 ? age*12 : age*12+month;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static long GetTimeStamp(this DateTime time)
|
public static int GetTimeStamp(this DateTime time)
|
||||||
{
|
{
|
||||||
DateTime dateTimeStart = TimeZoneInfo.ConvertTimeToUtc(new DateTime(1970, 1, 1));
|
int t = Convert.ToInt32((time.ToUniversalTime().Ticks - 621355968000000000) / 10000000);
|
||||||
long t = (time.Ticks - dateTimeStart.Ticks) / 10000;//除10000调整为13位
|
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
using System.Collections;
|
using System;
|
||||||
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace Nirvana.Common.Extend
|
namespace Nirvana.Common.Extend
|
||||||
|
|
@ -30,5 +31,44 @@ namespace Nirvana.Common.Extend
|
||||||
list.CopyTo(array, 0);
|
list.CopyTo(array, 0);
|
||||||
return new List<T>(array);
|
return new List<T>(array);
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// list去重
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T"></typeparam>
|
||||||
|
/// <param name="list"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static List<Guid> IDistinctList(this List<Guid> list)
|
||||||
|
{
|
||||||
|
if(list == null || list.Count == 0)
|
||||||
|
{
|
||||||
|
return new List<Guid>();
|
||||||
|
}
|
||||||
|
List<Guid> newlist = new List<Guid>();
|
||||||
|
foreach(var item in list)
|
||||||
|
{
|
||||||
|
if(!newlist.Exists(x=>x == item))
|
||||||
|
{
|
||||||
|
newlist.Add(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return newlist;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<string> IDistinctList(this List<string> list)
|
||||||
|
{
|
||||||
|
if (list == null || list.Count == 0)
|
||||||
|
{
|
||||||
|
return new List<string>();
|
||||||
|
}
|
||||||
|
List<string> newlist = new List<string>();
|
||||||
|
foreach (var item in list)
|
||||||
|
{
|
||||||
|
if (!newlist.Exists(x => x== item))
|
||||||
|
{
|
||||||
|
newlist.Add(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return newlist;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,7 @@ namespace Nirvana.Common
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static string GetCookie(string strName)
|
public static string GetCookie(string strName)
|
||||||
{
|
{
|
||||||
if (MyHttpContext.current.Request.Cookies != null && !string.IsNullOrEmpty(MyHttpContext.current.Request.Cookies[strName]))
|
if (MyHttpContext.current !=null && MyHttpContext.current.Request.Cookies != null && !string.IsNullOrEmpty(MyHttpContext.current.Request.Cookies[strName]))
|
||||||
{
|
{
|
||||||
return MyHttpContext.current.Request.Cookies[strName];
|
return MyHttpContext.current.Request.Cookies[strName];
|
||||||
}
|
}
|
||||||
|
|
@ -117,7 +117,7 @@ namespace Nirvana.Common
|
||||||
{
|
{
|
||||||
if (key.IsEmpty())
|
if (key.IsEmpty())
|
||||||
return string.Empty;
|
return string.Empty;
|
||||||
if (MyHttpContext.current.Session == null)
|
if (MyHttpContext.current == null || MyHttpContext.current.Session == null)
|
||||||
{
|
{
|
||||||
return string.Empty;
|
return string.Empty;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,62 @@
|
||||||
|
using Furion;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.AspNetCore.Mvc.Filters;
|
||||||
|
using Nirvana.Common;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Waste.Application
|
||||||
|
{
|
||||||
|
public class ApiAsyncActionFilter : Attribute, IAsyncActionFilter
|
||||||
|
{
|
||||||
|
private readonly ILoggerService _loggerService;
|
||||||
|
private readonly IBusinessApiService _businessApiService;
|
||||||
|
public ApiAsyncActionFilter()
|
||||||
|
{
|
||||||
|
_loggerService = App.GetService<ILoggerService>();
|
||||||
|
_businessApiService = App.GetService<IBusinessApiService>();
|
||||||
|
}
|
||||||
|
public async Task OnActionExecutionAsync(ActionExecutingContext context,
|
||||||
|
ActionExecutionDelegate next)
|
||||||
|
{
|
||||||
|
// 拦截之前
|
||||||
|
var request = context.HttpContext.Request;
|
||||||
|
if (!request.Query.ContainsKey("appid"))
|
||||||
|
{
|
||||||
|
var result = new ResultInfo(ApiResultState.NOAPPID, "缺少appid参数");
|
||||||
|
var jsonresult = new JsonResult(result);
|
||||||
|
context.Result = jsonresult;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
string appid = request.Query.Where(x => x.Key == "appid").FirstOrDefault().Value;
|
||||||
|
if (string.IsNullOrEmpty(appid))
|
||||||
|
{
|
||||||
|
var result = new ResultInfo(ApiResultState.NONAPPID, "appid无效");
|
||||||
|
var jsonresult = new JsonResult(result);
|
||||||
|
context.Result = jsonresult;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
string ip = request.HttpContext.Connection.RemoteIpAddress.ToString();
|
||||||
|
var res = await _businessApiService.IsWhiteIP(appid, ip);
|
||||||
|
if(res.code != ApiResultState.SUCCESS)
|
||||||
|
{
|
||||||
|
var jsonresult = new JsonResult(res);
|
||||||
|
context.Result = jsonresult;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var resultContext = await next();
|
||||||
|
|
||||||
|
// 拦截之后
|
||||||
|
|
||||||
|
// 异常拦截
|
||||||
|
if (resultContext.Exception != null)
|
||||||
|
{
|
||||||
|
var action = $"{request.Path}{request.QueryString.Value}";
|
||||||
|
_loggerService.AddErrorLogger(resultContext.Exception, $"appid={appid}", action);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,183 @@
|
||||||
|
using Furion.DependencyInjection;
|
||||||
|
using Furion.DistributedIDGenerator;
|
||||||
|
using Nirvana.Common;
|
||||||
|
using SqlSugar;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Waste.Domain;
|
||||||
|
|
||||||
|
namespace Waste.Application
|
||||||
|
{
|
||||||
|
public class BusinessApiService : BaseInfoService, IBusinessApiService, ITransient
|
||||||
|
{
|
||||||
|
private readonly ISqlSugarRepository<W_BusinessAppApi> repository;
|
||||||
|
private readonly SqlSugarClient dbClient;
|
||||||
|
|
||||||
|
public BusinessApiService(ISqlSugarRepository<W_BusinessAppApi> sqlSugarRepository)
|
||||||
|
{
|
||||||
|
repository = sqlSugarRepository;
|
||||||
|
dbClient = repository.Context;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 删除
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="keyValue"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<ResultInfo> DeleteFormAsync(Guid keyValue)
|
||||||
|
{
|
||||||
|
if (!await dbClient.Queryable<W_BusinessAppApi>().AnyAsync(x => x.Id == keyValue))
|
||||||
|
{
|
||||||
|
return new ResultInfo(ResultState.FAIL, "记录未找到");
|
||||||
|
}
|
||||||
|
await dbClient.Deleteable<W_BusinessAppApi>().Where(x => x.Id == keyValue).ExecuteCommandAsync();
|
||||||
|
return new ResultInfo(ResultState.SUCCESS, "删除成功");
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 详情
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<W_BusinessAppApi> DetailAsync(Guid id)
|
||||||
|
{
|
||||||
|
return await dbClient.Queryable<W_BusinessAppApi>().FirstAsync(x => x.Id == id);
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 授权列表
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="param"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<PageParms<BusinessApiInfo>> GetListAsync(QueryParams param)
|
||||||
|
{
|
||||||
|
RefAsync<int> totalnum = 0;
|
||||||
|
var temquery = dbClient.Queryable<W_BusinessAppApi>();
|
||||||
|
if (param.queryParam != null && param.queryParam.Count > 0)
|
||||||
|
{
|
||||||
|
List<IConditionalModel> conModels = new List<IConditionalModel>();
|
||||||
|
param.queryParam.ForEach(x =>
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrEmpty(x.Value))
|
||||||
|
{
|
||||||
|
conModels.Add(new ConditionalModel()
|
||||||
|
{
|
||||||
|
FieldName = x.Name,
|
||||||
|
ConditionalType = (ConditionalType)x.Type,
|
||||||
|
FieldValue = x.Value.Trim()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (conModels.Count > 0)
|
||||||
|
{
|
||||||
|
temquery = temquery.Where(conModels);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
string sorts = string.Format("{0} {1}", param.sort, param.order);
|
||||||
|
var query = await temquery.OrderBy(sorts)
|
||||||
|
.Select(x => new BusinessApiInfo
|
||||||
|
{
|
||||||
|
Id = x.Id,
|
||||||
|
AppId = x.AppId,
|
||||||
|
Status = x.Status,
|
||||||
|
AppSecret = x.AppSecret,
|
||||||
|
CreateTime = x.CreateTime,
|
||||||
|
IPList = x.IPList,
|
||||||
|
PushUrl = x.PushUrl
|
||||||
|
})
|
||||||
|
.Mapper((it, cache) =>
|
||||||
|
{
|
||||||
|
var allbus = cache.Get(list =>
|
||||||
|
{
|
||||||
|
var ids = list.Select(x => x.Id).ToList();
|
||||||
|
return repository.Change<W_Business>().Context.Queryable<W_Business>().Where(x => ids.Contains(x.Id)).ToList();
|
||||||
|
});
|
||||||
|
var bus = allbus.FirstOrDefault(x => x.Id == it.Id);
|
||||||
|
it.BusinessName = bus != null ? bus.Name : "";
|
||||||
|
})
|
||||||
|
.ToPageListAsync(param.offset, param.limit, totalnum);
|
||||||
|
return new PageParms<BusinessApiInfo>
|
||||||
|
{
|
||||||
|
page = param.offset,
|
||||||
|
Items = query,
|
||||||
|
totalnum = totalnum,
|
||||||
|
limit = param.limit
|
||||||
|
};
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 信息提交
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="role"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<ResultInfo> SubmitFormAsync(W_BusinessAppApi role)
|
||||||
|
{
|
||||||
|
role.IPList = role.IPList.ToStr();
|
||||||
|
role.PushUrl = role.PushUrl.ToStr();
|
||||||
|
if (string.IsNullOrEmpty(role.PushUrl))
|
||||||
|
{
|
||||||
|
return new ResultInfo(ResultState.FAIL, "推送地址不可为空");
|
||||||
|
}
|
||||||
|
if (!role.PushUrl.ToLower().StartsWith("http"))
|
||||||
|
{
|
||||||
|
return new ResultInfo(ResultState.FAIL, "推送地址格式不正确");
|
||||||
|
}
|
||||||
|
if (await dbClient.Queryable<W_BusinessAppApi>().AnyAsync(x => x.Id == role.Id))
|
||||||
|
{
|
||||||
|
await dbClient.Updateable<W_BusinessAppApi>().SetColumns(x => new W_BusinessAppApi
|
||||||
|
{
|
||||||
|
PushUrl = role.PushUrl,
|
||||||
|
IPList = role.IPList
|
||||||
|
}).Where(x => x.Id == role.Id).ExecuteCommandAsync();
|
||||||
|
return new ResultInfo(ResultState.SUCCESS, "授权更新成功");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
role.AppId = $"jt_{IDGen.NextID().ToString("N")}";
|
||||||
|
string secret = Md5.md5(role.AppId, 32);
|
||||||
|
role.AppSecret = Convert.ToBase64String(Encoding.UTF8.GetBytes(secret));
|
||||||
|
role.Status = (int)StatusType.Enabled;
|
||||||
|
role.CreateTime = DateTime.Now;
|
||||||
|
await dbClient.Insertable<W_BusinessAppApi>(role).ExecuteCommandAsync();
|
||||||
|
return new ResultInfo(ResultState.SUCCESS, "授权分配成功");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 检查是否在IP白名单中
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="appid"></param>
|
||||||
|
/// <param name="ip"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<ResultInfo> IsWhiteIP(string appid, string ip)
|
||||||
|
{
|
||||||
|
var data = await dbClient.Queryable<W_BusinessAppApi>().FirstAsync(x => x.AppId == appid);
|
||||||
|
if (data == null)
|
||||||
|
{
|
||||||
|
return new ResultInfo(ApiResultState.NONAPPID, "appid无效");
|
||||||
|
}
|
||||||
|
if (!string.IsNullOrEmpty(data.IPList) && !data.IPList.Contains(ip))
|
||||||
|
{
|
||||||
|
return new ResultInfo(ApiResultState.IPNOALLOW, "IP不合法");
|
||||||
|
}
|
||||||
|
return new ResultInfo(ApiResultState.SUCCESS, "success");
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 根据商户ID获取详情
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<List<W_BusinessPush>> GetPushListAsync()
|
||||||
|
{
|
||||||
|
var query = await dbClient.Ado.UseStoredProcedure().GetDataTableAsync("proc_getthirdpush", new { });
|
||||||
|
var list = query.ToList<W_BusinessPush>();
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 增加推送消息
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="data"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task InsertPushInfoAsync(W_BusinessPush data)
|
||||||
|
{
|
||||||
|
await dbClient.Insertable<W_BusinessPush>(data).ExecuteCommandAsync();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -19,11 +19,13 @@ namespace Waste.Application
|
||||||
private readonly IBusinessService _businessService;
|
private readonly IBusinessService _businessService;
|
||||||
private static readonly string LoginUserKey = Configs.GetString("LoginProviderKey");
|
private static readonly string LoginUserKey = Configs.GetString("LoginProviderKey");
|
||||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||||
|
private readonly IBusinessApiService _businessApiService;
|
||||||
|
|
||||||
public BusinessAppService(IBusinessService businessService, IHttpContextAccessor httpContextAccessor)
|
public BusinessAppService(IBusinessService businessService, IHttpContextAccessor httpContextAccessor,IBusinessApiService businessApiService)
|
||||||
{
|
{
|
||||||
_businessService = businessService;
|
_businessService = businessService;
|
||||||
_httpContextAccessor = httpContextAccessor;
|
_httpContextAccessor = httpContextAccessor;
|
||||||
|
_businessApiService = businessApiService;
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 商户列表
|
/// 商户列表
|
||||||
|
|
@ -88,5 +90,38 @@ namespace Waste.Application
|
||||||
OperatorProvider.Provider.RemoveCurrent();
|
OperatorProvider.Provider.RemoveCurrent();
|
||||||
return new ResultInfo(ResultState.SUCCESS, "success");
|
return new ResultInfo(ResultState.SUCCESS, "success");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 授权列表
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="param"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost]
|
||||||
|
public async Task<PageParms<BusinessApiInfo>> GetApiListAsync(QueryParams param)
|
||||||
|
{
|
||||||
|
return await _businessApiService.GetListAsync(param);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 授权信息提交
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="param"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost]
|
||||||
|
public async Task<ResultInfo> SubmitApiFormAsync(W_BusinessAppApi param)
|
||||||
|
{
|
||||||
|
return await _businessApiService.SubmitFormAsync(param);
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 删除授权
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="keyValue"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpGet]
|
||||||
|
[QueryParameters]
|
||||||
|
public async Task<ResultInfo> DeleteApiFormAsync(Guid keyValue)
|
||||||
|
{
|
||||||
|
return await _businessApiService.DeleteFormAsync(keyValue);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -81,7 +81,8 @@ namespace Waste.Application
|
||||||
}
|
}
|
||||||
if (currentUser.AccountType != (int)AccountType.platform)
|
if (currentUser.AccountType != (int)AccountType.platform)
|
||||||
{
|
{
|
||||||
tempquery = tempquery.Where(x => x.ParentId == currentUser.BusinessId || x.Id == currentUser.BusinessId);
|
var sql = $"code like '{currentUser.BusinessCode}'+'%'";
|
||||||
|
tempquery = tempquery.Where(sql);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -104,4 +104,35 @@ namespace Waste.Application
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public decimal YestodayPureWeight { get; set; } = 0;
|
public decimal YestodayPureWeight { get; set; } = 0;
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 商户授权信息
|
||||||
|
/// </summary>
|
||||||
|
public class BusinessApiInfo:W_BusinessAppApi
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 商户名称
|
||||||
|
/// </summary>
|
||||||
|
public string BusinessName { get; set; }
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 第三方推送的消息体内容
|
||||||
|
/// </summary>
|
||||||
|
public class BusinessApiS2CDto
|
||||||
|
{
|
||||||
|
public string devcode { get; set; }
|
||||||
|
|
||||||
|
public string devname { get; set; }
|
||||||
|
|
||||||
|
public string address { get; set; }
|
||||||
|
|
||||||
|
public decimal weight { get; set; }
|
||||||
|
|
||||||
|
public decimal tare { get; set; }
|
||||||
|
|
||||||
|
public decimal pweight { get; set; }
|
||||||
|
|
||||||
|
public string type { get; set; }
|
||||||
|
|
||||||
|
public int time { get; set; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,59 @@
|
||||||
|
using Nirvana.Common;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Waste.Domain;
|
||||||
|
|
||||||
|
namespace Waste.Application
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 商户授权处理
|
||||||
|
/// </summary>
|
||||||
|
public interface IBusinessApiService
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 授权列表
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="param"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<PageParms<BusinessApiInfo>> GetListAsync(QueryParams param);
|
||||||
|
/// <summary>
|
||||||
|
/// 信息提交
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="role"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<ResultInfo> SubmitFormAsync(W_BusinessAppApi role);
|
||||||
|
/// <summary>
|
||||||
|
/// 删除
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="keyValue"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<ResultInfo> DeleteFormAsync(Guid keyValue);
|
||||||
|
/// <summary>
|
||||||
|
/// 详情
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<W_BusinessAppApi> DetailAsync(Guid id);
|
||||||
|
/// <summary>
|
||||||
|
/// 获取推送列表
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<List<W_BusinessPush>> GetPushListAsync();
|
||||||
|
/// <summary>
|
||||||
|
/// 检查是否在IP白名单中
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="appid"></param>
|
||||||
|
/// <param name="ip"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<ResultInfo> IsWhiteIP(string appid, string ip);
|
||||||
|
/// <summary>
|
||||||
|
/// 增加推送消息
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="data"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task InsertPushInfoAsync(W_BusinessPush data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,102 @@
|
||||||
|
using Furion;
|
||||||
|
using Furion.DependencyInjection;
|
||||||
|
using Furion.FriendlyException;
|
||||||
|
using Furion.RemoteRequest.Extensions;
|
||||||
|
using Furion.TaskScheduler;
|
||||||
|
using Nirvana.Common;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Waste.Domain;
|
||||||
|
|
||||||
|
namespace Waste.Application
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 定时任务
|
||||||
|
/// </summary>
|
||||||
|
public class JobWorkder : ISpareTimeWorker
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 每隔 5s 执行
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="timer"></param>
|
||||||
|
/// <param name="count"></param>
|
||||||
|
[SpareTime(5000, "推送测量结果", StartNow = true, ExecuteType = SpareTimeExecuteTypes.Serial)]
|
||||||
|
public void DoSomethingAsync(SpareTimer timer, long count)
|
||||||
|
{
|
||||||
|
bool IsTask = App.Configuration["IsTask"].ToBool();
|
||||||
|
if (!IsTask)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Scoped.Create(async (_, scope) =>
|
||||||
|
{
|
||||||
|
var services = scope.ServiceProvider;
|
||||||
|
var _businessapiService = App.GetService<IBusinessApiService>(services);
|
||||||
|
var _loggerServicec = App.GetService<ILoggerService>(services);
|
||||||
|
//判断是否有异常
|
||||||
|
if (timer.Exception.Any())
|
||||||
|
{
|
||||||
|
_loggerServicec.AddLogger($"{count}定时任务发生异常,{timer.Exception.Values.LastOrDefault()?.Message}", 1);
|
||||||
|
//执行第三次抛异常
|
||||||
|
if (count > 2)
|
||||||
|
{
|
||||||
|
throw Oops.Oh($"{count}定时任务发生异常");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var list = await _businessapiService.GetPushListAsync();
|
||||||
|
if (list.Count > 0)
|
||||||
|
{
|
||||||
|
foreach (W_BusinessPush x in list)
|
||||||
|
{
|
||||||
|
//发送请求
|
||||||
|
var param = new BusinessApiS2CDto
|
||||||
|
{
|
||||||
|
devcode = x.DevCode,
|
||||||
|
devname = x.DevName,
|
||||||
|
address = x.Address.ToStr(),
|
||||||
|
weight = x.Weight,
|
||||||
|
tare = x.Tare,
|
||||||
|
pweight = x.PWeight,
|
||||||
|
type = x.Type,
|
||||||
|
time = x.Time.GetTimeStamp()
|
||||||
|
};
|
||||||
|
var response = await x.PushUrl
|
||||||
|
.SetBody(param)
|
||||||
|
.SetContentType("application/json")
|
||||||
|
.SetContentEncoding(Encoding.UTF8)
|
||||||
|
.PostAsync();
|
||||||
|
if (response.IsSuccessStatusCode)
|
||||||
|
{
|
||||||
|
var returninfo = await response.Content.ReadAsStringAsync();
|
||||||
|
if (returninfo.ToLower() == "success")
|
||||||
|
{
|
||||||
|
_loggerServicec.AddLogger($"{count}第三方发送成功,参数:{param.ToJson()}\r\n返回值:{returninfo}", 3);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (x.Cnt < 2)
|
||||||
|
{
|
||||||
|
x.Cnt = x.Cnt + 1;
|
||||||
|
await _businessapiService.InsertPushInfoAsync(x);
|
||||||
|
}
|
||||||
|
_loggerServicec.AddLogger($"{count}第三方响应失败,参数:{param.ToJson()}\r\n返回值:{returninfo}", 3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var returninfo = await response.Content.ReadAsStringAsync();
|
||||||
|
_loggerServicec.AddLogger($"{count}第三方发送失败,参数:{param.ToJson()}\r\n返回值:{returninfo}", 3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -12,7 +12,12 @@ namespace Waste.Application
|
||||||
{
|
{
|
||||||
public void Register(TypeAdapterConfig config)
|
public void Register(TypeAdapterConfig config)
|
||||||
{
|
{
|
||||||
|
config.ForType<ApiReportBaseDataItem, ApiReportBaseData>()
|
||||||
|
.Map(dest => dest.weight, src => src.DayWeight.ToString("f2"))
|
||||||
|
.Map(dest => dest.pweight, src => src.DayPureWeight.ToString("f2"))
|
||||||
|
.Map(dest=>dest.time,src=>src.CreateTime.ToString("yyyy-MM-dd"))
|
||||||
|
.Map(dest=>dest.type,src=>src.WasteType)
|
||||||
|
;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
using Furion;
|
using Furion;
|
||||||
using Furion.DependencyInjection;
|
using Furion.DependencyInjection;
|
||||||
using Furion.RemoteRequest.Extensions;
|
using Furion.RemoteRequest.Extensions;
|
||||||
using MessagePack;
|
using MessagePack;
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,10 @@ namespace Waste.Application
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string DevName { get; set; } = "";
|
public string DevName { get; set; } = "";
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
/// 设备地址
|
||||||
|
/// </summary>
|
||||||
|
public string DevAddress { get; set; } = "";
|
||||||
|
/// <summary>
|
||||||
/// 设备编号
|
/// 设备编号
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string DevCode { get; set; } = "";
|
public string DevCode { get; set; } = "";
|
||||||
|
|
@ -39,4 +43,75 @@ namespace Waste.Application
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public decimal TotalDayWeight { get; set; } = 0;
|
public decimal TotalDayWeight { get; set; } = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class ApiReportBaseData<T>
|
||||||
|
{
|
||||||
|
public List<T> list { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 总条数
|
||||||
|
/// </summary>
|
||||||
|
public int totalcount { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ApiReportBaseData
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 点位地址,包含省市区县详细地址
|
||||||
|
/// </summary>
|
||||||
|
public string address { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 设备唯一编号
|
||||||
|
/// </summary>
|
||||||
|
public string devcode { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 设备名称
|
||||||
|
/// </summary>
|
||||||
|
public string devname { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 总毛重,精确到小数点后两位,单位为KG
|
||||||
|
/// </summary>
|
||||||
|
public string weight { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 总净重,精确到小数点后两位,单位为KG
|
||||||
|
/// </summary>
|
||||||
|
public string pweight { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 垃圾类型
|
||||||
|
/// </summary>
|
||||||
|
public string type { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 统计时间,时间格式
|
||||||
|
/// </summary>
|
||||||
|
public string time { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ApiReportBaseDataItem : W_DeviceStatistics
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 点位地址,包含省市区县详细地址
|
||||||
|
/// </summary>
|
||||||
|
public string address { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 设备唯一编号
|
||||||
|
/// </summary>
|
||||||
|
public string devcode { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 设备名称
|
||||||
|
/// </summary>
|
||||||
|
public string devname { get; set; }
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 获取统计结果请求数据
|
||||||
|
/// </summary>
|
||||||
|
public class ApiReportRequestData
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 开始时间
|
||||||
|
/// </summary>
|
||||||
|
public DateTime begindate { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 结束时间
|
||||||
|
/// </summary>
|
||||||
|
public DateTime enddate { get; set; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,5 +24,12 @@ namespace Waste.Application
|
||||||
/// <param name="param"></param>
|
/// <param name="param"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<PageParms<ReportList>> GetListByBusinessAsync(QueryParams param);
|
Task<PageParms<ReportList>> GetListByBusinessAsync(QueryParams param);
|
||||||
|
/// <summary>
|
||||||
|
/// 获取一定时间段内的统计数据,第三方接口对接使用
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="param"></param>
|
||||||
|
/// <param name="appid">第三方授权的appid</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<ResultInfo> GetDataAsync(ApiReportRequestData param,string appid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -40,5 +40,20 @@ namespace Waste.Application.ReportInfo
|
||||||
{
|
{
|
||||||
return await _reportService.GetListByBusinessAsync(param);
|
return await _reportService.GetListByBusinessAsync(param);
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 获取一定时间段内的统计数据,第三方接口对接使用
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="appid"></param>
|
||||||
|
/// <param name="param"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost]
|
||||||
|
[QueryParameters]
|
||||||
|
[ApiDescriptionSettings("Api")]
|
||||||
|
[ApiAsyncActionFilter]
|
||||||
|
[NonUnify]
|
||||||
|
public async Task<ResultInfo> GetDataAsync([FromQuery]string appid, [FromBody]ApiReportRequestData param)
|
||||||
|
{
|
||||||
|
return await _reportService.GetDataAsync(param,appid);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
using Furion.DependencyInjection;
|
using Furion.DependencyInjection;
|
||||||
|
using Mapster;
|
||||||
using Nirvana.Common;
|
using Nirvana.Common;
|
||||||
|
using Nirvana.Common.Extend;
|
||||||
using SqlSugar;
|
using SqlSugar;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
@ -23,6 +25,103 @@ namespace Waste.Application
|
||||||
repository = sqlSugarRepository;
|
repository = sqlSugarRepository;
|
||||||
dbClient = repository.Context;
|
dbClient = repository.Context;
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 获取一定时间段内的统计数据,第三方接口对接使用
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="param"></param>
|
||||||
|
/// <param name="appid">第三方授权的appid</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<ResultInfo> GetDataAsync(ApiReportRequestData param, string appid)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(appid))
|
||||||
|
{
|
||||||
|
return new ResultInfo(ApiResultState.NOAPPID, "缺少appid参数");
|
||||||
|
}
|
||||||
|
//根据appid获取商户信息
|
||||||
|
var bussapi = await repository.Change<W_BusinessAppApi>().FirstOrDefaultAsync(x => x.AppId == appid);
|
||||||
|
if (bussapi == null)
|
||||||
|
{
|
||||||
|
return new ResultInfo(ApiResultState.NONAPPID, "appid无效");
|
||||||
|
}
|
||||||
|
//检查参数
|
||||||
|
if (param.enddate > DateTime.Now.Date.AddDays(-1))
|
||||||
|
{
|
||||||
|
return new ResultInfo(ApiResultState.PARAMERROR, "时间不可大于昨日");
|
||||||
|
}
|
||||||
|
if (param.enddate < param.begindate)
|
||||||
|
{
|
||||||
|
return new ResultInfo(ApiResultState.PARAMERROR, "结束时间不可小于开始时间");
|
||||||
|
}
|
||||||
|
if (param.begindate < param.enddate.AddDays(-7))
|
||||||
|
{
|
||||||
|
return new ResultInfo(ApiResultState.PARAMERROR, "时间跨度最多是七日");
|
||||||
|
}
|
||||||
|
if (param.begindate < DateTime.Now.AddMonths(-6))
|
||||||
|
{
|
||||||
|
return new ResultInfo(ApiResultState.PARAMERROR, "超过半年的数据无法进行查询");
|
||||||
|
}
|
||||||
|
var tempquery = dbClient.Queryable<W_DeviceStatistics>();
|
||||||
|
tempquery = tempquery.Where(x => x.Businessid == bussapi.Id);
|
||||||
|
int totalcount = await tempquery.Clone().CountAsync();
|
||||||
|
if (totalcount == 0)
|
||||||
|
{
|
||||||
|
return new ResultInfo(ApiResultState.NODATA, "无可用数据");
|
||||||
|
}
|
||||||
|
List<ApiReportBaseData> data = new List<ApiReportBaseData>();
|
||||||
|
var list = await tempquery
|
||||||
|
.Clone()
|
||||||
|
.OrderBy(x => x.CreateTime, OrderByType.Asc)
|
||||||
|
.Select(x => new ApiReportBaseDataItem
|
||||||
|
{
|
||||||
|
Id = x.Id,
|
||||||
|
CreateTime = x.CreateTime,
|
||||||
|
DevId = x.DevId,
|
||||||
|
DayCount = x.DayCount,
|
||||||
|
DayPureWeight = x.DayPureWeight,
|
||||||
|
DayWeight = x.DayWeight,
|
||||||
|
WasteType = x.WasteType
|
||||||
|
})
|
||||||
|
.Mapper((it, cache) =>
|
||||||
|
{
|
||||||
|
var alldev = cache.Get(list =>
|
||||||
|
{
|
||||||
|
List<Guid> ids = list.Select(x => x.DevId).ToList();
|
||||||
|
List<Guid> newids = ids.IDistinctList();
|
||||||
|
return repository.Change<W_Device>().Context.Queryable<W_Device>().Where(x => newids.Contains(x.Id)).ToList();
|
||||||
|
});
|
||||||
|
var allarea = cache.Get(list =>
|
||||||
|
{
|
||||||
|
var provinces = alldev.Select(x => x.Province).ToList();
|
||||||
|
var citys = alldev.Select(x => x.City).ToList();
|
||||||
|
var areas = alldev.Select(x => x.Area).ToList();
|
||||||
|
provinces = provinces.IDistinctList();
|
||||||
|
citys = citys.IDistinctList();
|
||||||
|
areas = areas.IDistinctList();
|
||||||
|
return repository.Change<W_AreaInfo>().Where(x => provinces.Contains(x.code) || citys.Contains(x.code) || areas.Contains(x.code)).ToList();
|
||||||
|
});
|
||||||
|
var dev = alldev.FirstOrDefault(x => x.Id == it.DevId);
|
||||||
|
if (dev != null)
|
||||||
|
{
|
||||||
|
it.devname = dev.Name;
|
||||||
|
it.devcode = dev.Ecode;
|
||||||
|
|
||||||
|
var Province = allarea.FirstOrDefault(x => x.code == dev.Province);
|
||||||
|
var City = allarea.FirstOrDefault(x => x.code == dev.City);
|
||||||
|
var Area = allarea.FirstOrDefault(x => x.code == dev.Area);
|
||||||
|
it.address = $"{(Province != null ? Province.name.ToStr() : "")}{(City != null ? City.name.ToStr() : "")}{(Area != null ? Area.name.ToStr() : "")}";
|
||||||
|
}
|
||||||
|
var dto = it.Adapt<ApiReportBaseData>();
|
||||||
|
data.Add(dto);
|
||||||
|
})
|
||||||
|
.ToListAsync();
|
||||||
|
var returndata = new ApiReportBaseData<ApiReportBaseData>()
|
||||||
|
{
|
||||||
|
list = data,
|
||||||
|
totalcount = totalcount
|
||||||
|
};
|
||||||
|
return new ResultInfo(ResultState.SUCCESS, "success", returndata);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 统计列表
|
/// 统计列表
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -40,7 +139,7 @@ namespace Waste.Application
|
||||||
x.Value = x.Value.ToStr();
|
x.Value = x.Value.ToStr();
|
||||||
if (!string.IsNullOrEmpty(x.Value))
|
if (!string.IsNullOrEmpty(x.Value))
|
||||||
{
|
{
|
||||||
if(x.Name.ToLower() == "devname")
|
if (x.Name.ToLower() == "devname")
|
||||||
{
|
{
|
||||||
temquery = temquery.Where(e => SqlFunc.Subqueryable<W_Device>().Where(w => w.Name == x.Value && e.DevId == w.Id).Any());
|
temquery = temquery.Where(e => SqlFunc.Subqueryable<W_Device>().Where(w => w.Name == x.Value && e.DevId == w.Id).Any());
|
||||||
}
|
}
|
||||||
|
|
@ -99,6 +198,7 @@ namespace Waste.Application
|
||||||
var dev = alldev.FirstOrDefault(x => x.Id == it.DevId);
|
var dev = alldev.FirstOrDefault(x => x.Id == it.DevId);
|
||||||
it.DevName = dev != null ? dev.Name : "";
|
it.DevName = dev != null ? dev.Name : "";
|
||||||
it.DevCode = dev != null ? dev.Ecode : "";
|
it.DevCode = dev != null ? dev.Ecode : "";
|
||||||
|
it.DevAddress = dev != null ? dev.Address : "";
|
||||||
it.TotalDayCount = totaldaycount;
|
it.TotalDayCount = totaldaycount;
|
||||||
it.TotalDayPureWeight = totaldaypureweight;
|
it.TotalDayPureWeight = totaldaypureweight;
|
||||||
it.TotalDayWeight = totaldayweight;
|
it.TotalDayWeight = totaldayweight;
|
||||||
|
|
@ -157,7 +257,7 @@ namespace Waste.Application
|
||||||
{
|
{
|
||||||
Businessid = x.BusinessId,
|
Businessid = x.BusinessId,
|
||||||
CreateTime = x.CreateTime,
|
CreateTime = x.CreateTime,
|
||||||
DayCount = x.DayCount,
|
DayCount = x.DayCount,
|
||||||
DayPureWeight = x.DayPureWeight,
|
DayPureWeight = x.DayPureWeight,
|
||||||
DayWeight = x.DayWeight,
|
DayWeight = x.DayWeight,
|
||||||
WasteType = x.WasteType
|
WasteType = x.WasteType
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,8 @@
|
||||||
using Furion.DependencyInjection;
|
using Furion;
|
||||||
|
using Furion.DependencyInjection;
|
||||||
using Furion.DistributedIDGenerator;
|
using Furion.DistributedIDGenerator;
|
||||||
|
using Furion.RemoteRequest.Extensions;
|
||||||
|
using Furion.TaskScheduler;
|
||||||
using Nirvana.Common;
|
using Nirvana.Common;
|
||||||
using SqlSugar;
|
using SqlSugar;
|
||||||
using System;
|
using System;
|
||||||
|
|
@ -20,13 +23,15 @@ namespace Waste.Application
|
||||||
private readonly SqlSugarClient dbClient;
|
private readonly SqlSugarClient dbClient;
|
||||||
private readonly ILoggerService _loggerService;
|
private readonly ILoggerService _loggerService;
|
||||||
private readonly ISuZhouService _suZhouService;
|
private readonly ISuZhouService _suZhouService;
|
||||||
|
private readonly IBusinessApiService _businessApiService;
|
||||||
|
|
||||||
public ResultService(ISqlSugarRepository<W_Result> sqlSugarRepository, ILoggerService loggerService, ISuZhouService suZhouService)
|
public ResultService(ISqlSugarRepository<W_Result> sqlSugarRepository, ILoggerService loggerService, ISuZhouService suZhouService,IBusinessApiService businessApiService)
|
||||||
{
|
{
|
||||||
repository = sqlSugarRepository;
|
repository = sqlSugarRepository;
|
||||||
dbClient = repository.Context;
|
dbClient = repository.Context;
|
||||||
_loggerService = loggerService;
|
_loggerService = loggerService;
|
||||||
_suZhouService = suZhouService;
|
_suZhouService = suZhouService;
|
||||||
|
_businessApiService = businessApiService;
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取投放记录
|
/// 获取投放记录
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,36 @@
|
||||||
|
using Furion.DynamicApiController;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Nirvana.Common;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Waste.Application
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 测试专用
|
||||||
|
/// </summary>
|
||||||
|
public class TestAppService : IDynamicApiController
|
||||||
|
{
|
||||||
|
private readonly ILoggerService _loggerService;
|
||||||
|
public TestAppService(ILoggerService loggerService)
|
||||||
|
{
|
||||||
|
_loggerService = loggerService;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 接收测试
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="data"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost]
|
||||||
|
[NonUnify]
|
||||||
|
public string Subscribe(BusinessApiS2CDto data)
|
||||||
|
{
|
||||||
|
var msg = $"平台推送的消息内容:{data.ToJson()}";
|
||||||
|
_loggerService.AddLogger(msg, 1);
|
||||||
|
return "success";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -114,6 +114,48 @@
|
||||||
</summary>
|
</summary>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:Waste.Application.BusinessApiService.DeleteFormAsync(System.Guid)">
|
||||||
|
<summary>
|
||||||
|
删除
|
||||||
|
</summary>
|
||||||
|
<param name="keyValue"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:Waste.Application.BusinessApiService.DetailAsync(System.Guid)">
|
||||||
|
<summary>
|
||||||
|
详情
|
||||||
|
</summary>
|
||||||
|
<param name="id"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:Waste.Application.BusinessApiService.GetListAsync(Nirvana.Common.QueryParams)">
|
||||||
|
<summary>
|
||||||
|
授权列表
|
||||||
|
</summary>
|
||||||
|
<param name="param"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:Waste.Application.BusinessApiService.SubmitFormAsync(Waste.Domain.W_BusinessAppApi)">
|
||||||
|
<summary>
|
||||||
|
信息提交
|
||||||
|
</summary>
|
||||||
|
<param name="role"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:Waste.Application.BusinessApiService.IsWhiteIP(System.String,System.String)">
|
||||||
|
<summary>
|
||||||
|
检查是否在IP白名单中
|
||||||
|
</summary>
|
||||||
|
<param name="appid"></param>
|
||||||
|
<param name="ip"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:Waste.Application.BusinessApiService.GetPushListAsync">
|
||||||
|
<summary>
|
||||||
|
根据商户ID获取详情
|
||||||
|
</summary>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
<member name="T:Waste.Application.BusinessAppService">
|
<member name="T:Waste.Application.BusinessAppService">
|
||||||
<summary>
|
<summary>
|
||||||
商户管理
|
商户管理
|
||||||
|
|
@ -161,6 +203,27 @@
|
||||||
</summary>
|
</summary>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:Waste.Application.BusinessAppService.GetApiListAsync(Nirvana.Common.QueryParams)">
|
||||||
|
<summary>
|
||||||
|
授权列表
|
||||||
|
</summary>
|
||||||
|
<param name="param"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:Waste.Application.BusinessAppService.SubmitApiFormAsync(Waste.Domain.W_BusinessAppApi)">
|
||||||
|
<summary>
|
||||||
|
授权信息提交
|
||||||
|
</summary>
|
||||||
|
<param name="param"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:Waste.Application.BusinessAppService.DeleteApiFormAsync(System.Guid)">
|
||||||
|
<summary>
|
||||||
|
删除授权
|
||||||
|
</summary>
|
||||||
|
<param name="keyValue"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
<member name="T:Waste.Application.BusinessService">
|
<member name="T:Waste.Application.BusinessService">
|
||||||
<summary>
|
<summary>
|
||||||
商户管理
|
商户管理
|
||||||
|
|
@ -364,6 +427,68 @@
|
||||||
昨日测量净重
|
昨日测量净重
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="T:Waste.Application.BusinessApiInfo">
|
||||||
|
<summary>
|
||||||
|
商户授权信息
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:Waste.Application.BusinessApiInfo.BusinessName">
|
||||||
|
<summary>
|
||||||
|
商户名称
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="T:Waste.Application.BusinessApiS2CDto">
|
||||||
|
<summary>
|
||||||
|
第三方推送的消息体内容
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="T:Waste.Application.IBusinessApiService">
|
||||||
|
<summary>
|
||||||
|
商户授权处理
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="M:Waste.Application.IBusinessApiService.GetListAsync(Nirvana.Common.QueryParams)">
|
||||||
|
<summary>
|
||||||
|
授权列表
|
||||||
|
</summary>
|
||||||
|
<param name="param"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:Waste.Application.IBusinessApiService.SubmitFormAsync(Waste.Domain.W_BusinessAppApi)">
|
||||||
|
<summary>
|
||||||
|
信息提交
|
||||||
|
</summary>
|
||||||
|
<param name="role"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:Waste.Application.IBusinessApiService.DeleteFormAsync(System.Guid)">
|
||||||
|
<summary>
|
||||||
|
删除
|
||||||
|
</summary>
|
||||||
|
<param name="keyValue"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:Waste.Application.IBusinessApiService.DetailAsync(System.Guid)">
|
||||||
|
<summary>
|
||||||
|
详情
|
||||||
|
</summary>
|
||||||
|
<param name="id"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:Waste.Application.IBusinessApiService.GetPushListAsync">
|
||||||
|
<summary>
|
||||||
|
获取推送列表
|
||||||
|
</summary>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:Waste.Application.IBusinessApiService.IsWhiteIP(System.String,System.String)">
|
||||||
|
<summary>
|
||||||
|
检查是否在IP白名单中
|
||||||
|
</summary>
|
||||||
|
<param name="appid"></param>
|
||||||
|
<param name="ip"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
<member name="M:Waste.Application.IBusinessService.ResetPwdAsync(System.Guid,System.String)">
|
<member name="M:Waste.Application.IBusinessService.ResetPwdAsync(System.Guid,System.String)">
|
||||||
<summary>
|
<summary>
|
||||||
重置密码
|
重置密码
|
||||||
|
|
@ -596,6 +721,18 @@
|
||||||
<param name="deviceBatchModel"></param>
|
<param name="deviceBatchModel"></param>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="T:Waste.Application.JobWorkder">
|
||||||
|
<summary>
|
||||||
|
定时任务
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="M:Waste.Application.JobWorkder.DoSomethingAsync(Furion.TaskScheduler.SpareTimer,System.Int64)">
|
||||||
|
<summary>
|
||||||
|
每隔 5s 执行
|
||||||
|
</summary>
|
||||||
|
<param name="timer"></param>
|
||||||
|
<param name="count"></param>
|
||||||
|
</member>
|
||||||
<member name="M:Waste.Application.LogExceptionHandler.OnExceptionAsync(Microsoft.AspNetCore.Mvc.Filters.ExceptionContext)">
|
<member name="M:Waste.Application.LogExceptionHandler.OnExceptionAsync(Microsoft.AspNetCore.Mvc.Filters.ExceptionContext)">
|
||||||
<summary>
|
<summary>
|
||||||
全局异常处理提供器
|
全局异常处理提供器
|
||||||
|
|
@ -1095,6 +1232,11 @@
|
||||||
设备名称
|
设备名称
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="P:Waste.Application.ReportList.DevAddress">
|
||||||
|
<summary>
|
||||||
|
设备地址
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
<member name="P:Waste.Application.ReportList.DevCode">
|
<member name="P:Waste.Application.ReportList.DevCode">
|
||||||
<summary>
|
<summary>
|
||||||
设备编号
|
设备编号
|
||||||
|
|
@ -1115,6 +1257,76 @@
|
||||||
合计测量重量
|
合计测量重量
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="P:Waste.Application.ApiReportBaseData`1.totalcount">
|
||||||
|
<summary>
|
||||||
|
总条数
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:Waste.Application.ApiReportBaseData.address">
|
||||||
|
<summary>
|
||||||
|
点位地址,包含省市区县详细地址
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:Waste.Application.ApiReportBaseData.devcode">
|
||||||
|
<summary>
|
||||||
|
设备唯一编号
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:Waste.Application.ApiReportBaseData.devname">
|
||||||
|
<summary>
|
||||||
|
设备名称
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:Waste.Application.ApiReportBaseData.weight">
|
||||||
|
<summary>
|
||||||
|
总毛重,精确到小数点后两位,单位为KG
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:Waste.Application.ApiReportBaseData.pweight">
|
||||||
|
<summary>
|
||||||
|
总净重,精确到小数点后两位,单位为KG
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:Waste.Application.ApiReportBaseData.type">
|
||||||
|
<summary>
|
||||||
|
垃圾类型
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:Waste.Application.ApiReportBaseData.time">
|
||||||
|
<summary>
|
||||||
|
统计时间,时间格式
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:Waste.Application.ApiReportBaseDataItem.address">
|
||||||
|
<summary>
|
||||||
|
点位地址,包含省市区县详细地址
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:Waste.Application.ApiReportBaseDataItem.devcode">
|
||||||
|
<summary>
|
||||||
|
设备唯一编号
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:Waste.Application.ApiReportBaseDataItem.devname">
|
||||||
|
<summary>
|
||||||
|
设备名称
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="T:Waste.Application.ApiReportRequestData">
|
||||||
|
<summary>
|
||||||
|
获取统计结果请求数据
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:Waste.Application.ApiReportRequestData.begindate">
|
||||||
|
<summary>
|
||||||
|
开始时间
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:Waste.Application.ApiReportRequestData.enddate">
|
||||||
|
<summary>
|
||||||
|
结束时间
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
<member name="T:Waste.Application.IReportService">
|
<member name="T:Waste.Application.IReportService">
|
||||||
<summary>
|
<summary>
|
||||||
统计信息
|
统计信息
|
||||||
|
|
@ -1134,6 +1346,14 @@
|
||||||
<param name="param"></param>
|
<param name="param"></param>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:Waste.Application.IReportService.GetDataAsync(Waste.Application.ApiReportRequestData,System.String)">
|
||||||
|
<summary>
|
||||||
|
获取一定时间段内的统计数据,第三方接口对接使用
|
||||||
|
</summary>
|
||||||
|
<param name="param"></param>
|
||||||
|
<param name="appid">第三方授权的appid</param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
<member name="T:Waste.Application.ReportInfo.ReportAppService">
|
<member name="T:Waste.Application.ReportInfo.ReportAppService">
|
||||||
<summary>
|
<summary>
|
||||||
统计报表
|
统计报表
|
||||||
|
|
@ -1153,11 +1373,27 @@
|
||||||
<param name="param"></param>
|
<param name="param"></param>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:Waste.Application.ReportInfo.ReportAppService.GetDataAsync(System.String,Waste.Application.ApiReportRequestData)">
|
||||||
|
<summary>
|
||||||
|
获取一定时间段内的统计数据,第三方接口对接使用
|
||||||
|
</summary>
|
||||||
|
<param name="appid"></param>
|
||||||
|
<param name="param"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
<member name="T:Waste.Application.ReportService">
|
<member name="T:Waste.Application.ReportService">
|
||||||
<summary>
|
<summary>
|
||||||
统计管理
|
统计管理
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:Waste.Application.ReportService.GetDataAsync(Waste.Application.ApiReportRequestData,System.String)">
|
||||||
|
<summary>
|
||||||
|
获取一定时间段内的统计数据,第三方接口对接使用
|
||||||
|
</summary>
|
||||||
|
<param name="param"></param>
|
||||||
|
<param name="appid">第三方授权的appid</param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
<member name="M:Waste.Application.ReportService.GetListAsync(Nirvana.Common.QueryParams)">
|
<member name="M:Waste.Application.ReportService.GetListAsync(Nirvana.Common.QueryParams)">
|
||||||
<summary>
|
<summary>
|
||||||
统计列表
|
统计列表
|
||||||
|
|
@ -1656,6 +1892,11 @@
|
||||||
<param name="data"></param>
|
<param name="data"></param>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="T:Waste.Application.TestAppService">
|
||||||
|
<summary>
|
||||||
|
测试专用
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
<member name="M:Waste.Application.IWasteService.GetTypeListAsync(Nirvana.Common.QueryParams)">
|
<member name="M:Waste.Application.IWasteService.GetTypeListAsync(Nirvana.Common.QueryParams)">
|
||||||
<summary>
|
<summary>
|
||||||
垃圾分类列表
|
垃圾分类列表
|
||||||
|
|
|
||||||
|
|
@ -15,11 +15,11 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Furion" Version="2.7.2" />
|
<PackageReference Include="Furion" Version="2.7.7" />
|
||||||
<PackageReference Include="Furion.Extras.Authentication.JwtBearer" Version="2.7.2" />
|
<PackageReference Include="Furion.Extras.Authentication.JwtBearer" Version="2.7.7" />
|
||||||
<PackageReference Include="Furion.Extras.DatabaseAccessor.SqlSugar" Version="2.7.2" />
|
<PackageReference Include="Furion.Extras.DatabaseAccessor.SqlSugar" Version="2.7.7" />
|
||||||
<PackageReference Include="Furion.Extras.Logging.Serilog" Version="2.7.2" />
|
<PackageReference Include="Furion.Extras.Logging.Serilog" Version="2.7.7" />
|
||||||
<PackageReference Include="Furion.Extras.ObjectMapper.Mapster" Version="2.7.2" />
|
<PackageReference Include="Furion.Extras.ObjectMapper.Mapster" Version="2.7.7" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,60 @@
|
||||||
|
using SqlSugar;
|
||||||
|
|
||||||
|
namespace Waste.Domain
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 商户授权信息
|
||||||
|
/// </summary>
|
||||||
|
public class W_BusinessAppApi
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 商户授权信息
|
||||||
|
/// </summary>
|
||||||
|
public W_BusinessAppApi()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
private System.Guid _Id;
|
||||||
|
/// <summary>
|
||||||
|
/// 商户的BusinessId
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(IsPrimaryKey = true)]
|
||||||
|
public System.Guid Id { get { return this._Id; } set { this._Id = value; } }
|
||||||
|
|
||||||
|
private System.String _PushUrl;
|
||||||
|
/// <summary>
|
||||||
|
/// 消息推送地址
|
||||||
|
/// </summary>
|
||||||
|
public System.String PushUrl { get { return this._PushUrl; } set { this._PushUrl = value?.Trim(); } }
|
||||||
|
|
||||||
|
private System.String _IPList;
|
||||||
|
/// <summary>
|
||||||
|
/// IP白名单列表,为空则不限制
|
||||||
|
/// </summary>
|
||||||
|
public System.String IPList { get { return this._IPList; } set { this._IPList = value?.Trim(); } }
|
||||||
|
|
||||||
|
private System.String _AppId;
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public System.String AppId { get { return this._AppId; } set { this._AppId = value?.Trim(); } }
|
||||||
|
|
||||||
|
private System.String _AppSecret;
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public System.String AppSecret { get { return this._AppSecret; } set { this._AppSecret = value?.Trim(); } }
|
||||||
|
|
||||||
|
private System.Int32 _Status;
|
||||||
|
/// <summary>
|
||||||
|
/// 状态,0-禁用,1-正常
|
||||||
|
/// </summary>
|
||||||
|
public System.Int32 Status { get { return this._Status; } set { this._Status = value; } }
|
||||||
|
|
||||||
|
private System.DateTime _CreateTime;
|
||||||
|
/// <summary>
|
||||||
|
/// 添加时间
|
||||||
|
/// </summary>
|
||||||
|
public System.DateTime CreateTime { get { return this._CreateTime; } set { this._CreateTime = value; } }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,89 @@
|
||||||
|
using SqlSugar;
|
||||||
|
|
||||||
|
namespace Waste.Domain
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 商户消息推送
|
||||||
|
/// </summary>
|
||||||
|
public class W_BusinessPush
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 商户消息推送
|
||||||
|
/// </summary>
|
||||||
|
public W_BusinessPush()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
private System.Guid _BusinessId;
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public System.Guid BusinessId { get { return this._BusinessId; } set { this._BusinessId = value; } }
|
||||||
|
|
||||||
|
private System.String _PushUrl;
|
||||||
|
/// <summary>
|
||||||
|
/// 推送地址
|
||||||
|
/// </summary>
|
||||||
|
public System.String PushUrl { get { return this._PushUrl; } set { this._PushUrl = value?.Trim(); } }
|
||||||
|
|
||||||
|
private System.String _DevCode;
|
||||||
|
/// <summary>
|
||||||
|
/// 设备唯一编号
|
||||||
|
/// </summary>
|
||||||
|
public System.String DevCode { get { return this._DevCode; } set { this._DevCode = value?.Trim(); } }
|
||||||
|
|
||||||
|
private System.String _DevName;
|
||||||
|
/// <summary>
|
||||||
|
/// 设备名称
|
||||||
|
/// </summary>
|
||||||
|
public System.String DevName { get { return this._DevName; } set { this._DevName = value?.Trim(); } }
|
||||||
|
|
||||||
|
private System.String _Address;
|
||||||
|
/// <summary>
|
||||||
|
/// 设备地址
|
||||||
|
/// </summary>
|
||||||
|
public System.String Address { get { return this._Address; } set { this._Address = value?.Trim(); } }
|
||||||
|
|
||||||
|
private System.Decimal _Weight;
|
||||||
|
/// <summary>
|
||||||
|
/// 毛重
|
||||||
|
/// </summary>
|
||||||
|
public System.Decimal Weight { get { return this._Weight; } set { this._Weight = value; } }
|
||||||
|
|
||||||
|
private System.Decimal _Tare;
|
||||||
|
/// <summary>
|
||||||
|
/// 皮重
|
||||||
|
/// </summary>
|
||||||
|
public System.Decimal Tare { get { return this._Tare; } set { this._Tare = value; } }
|
||||||
|
|
||||||
|
private System.Decimal _PWeight;
|
||||||
|
/// <summary>
|
||||||
|
/// 净重
|
||||||
|
/// </summary>
|
||||||
|
public System.Decimal PWeight { get { return this._PWeight; } set { this._PWeight = value; } }
|
||||||
|
|
||||||
|
private System.String _Type;
|
||||||
|
/// <summary>
|
||||||
|
/// 垃圾类型
|
||||||
|
/// </summary>
|
||||||
|
public System.String Type { get { return this._Type; } set { this._Type = value?.Trim(); } }
|
||||||
|
|
||||||
|
private System.DateTime _Time;
|
||||||
|
/// <summary>
|
||||||
|
/// 测量时间
|
||||||
|
/// </summary>
|
||||||
|
public System.DateTime Time { get { return this._Time; } set { this._Time = value; } }
|
||||||
|
|
||||||
|
private System.Int32 _Cnt;
|
||||||
|
/// <summary>
|
||||||
|
/// 重试推送的次数
|
||||||
|
/// </summary>
|
||||||
|
public System.Int32 Cnt { get { return this._Cnt; } set { this._Cnt = value; } }
|
||||||
|
|
||||||
|
private System.DateTime _CreateTime;
|
||||||
|
/// <summary>
|
||||||
|
/// 添加时间
|
||||||
|
/// </summary>
|
||||||
|
public System.DateTime CreateTime { get { return this._CreateTime; } set { this._CreateTime = value; } }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -25,7 +25,7 @@ namespace Waste.Web.Core
|
||||||
//});
|
//});
|
||||||
services.AddDataProtection().PersistKeysToFileSystem(new DirectoryInfo(Directory.GetCurrentDirectory() + Path.DirectorySeparatorChar + "DataProtection"));
|
services.AddDataProtection().PersistKeysToFileSystem(new DirectoryInfo(Directory.GetCurrentDirectory() + Path.DirectorySeparatorChar + "DataProtection"));
|
||||||
services.AddCorsAccessor();
|
services.AddCorsAccessor();
|
||||||
// services.AddRemoteRequest();
|
// services.AddRemoteRequest();
|
||||||
services.AddHttpClient();
|
services.AddHttpClient();
|
||||||
services.AddControllers(options => {
|
services.AddControllers(options => {
|
||||||
options.EnableEndpointRouting = true;
|
options.EnableEndpointRouting = true;
|
||||||
|
|
@ -40,6 +40,7 @@ namespace Waste.Web.Core
|
||||||
options.SerializerSettings.ContractResolver = new CustomContractResolver();
|
options.SerializerSettings.ContractResolver = new CustomContractResolver();
|
||||||
});
|
});
|
||||||
services.AddSingleton<ITempDataProvider, CookieTempDataProvider>();
|
services.AddSingleton<ITempDataProvider, CookieTempDataProvider>();
|
||||||
|
services.AddTaskScheduler();
|
||||||
#region 注入获取IP
|
#region 注入获取IP
|
||||||
services.AddSingleton<IHttpContextAccessor, HttpContextAccessor>();
|
services.AddSingleton<IHttpContextAccessor, HttpContextAccessor>();
|
||||||
MyHttpContext.serviceCollection = services;
|
MyHttpContext.serviceCollection = services;
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,62 @@
|
||||||
|
@page
|
||||||
|
@model Waste.Web.Entry.Pages.AppApi.EditModel
|
||||||
|
@{
|
||||||
|
ViewData["Title"] = "授权管理";
|
||||||
|
}
|
||||||
|
<div class="layui-card">
|
||||||
|
<div class="layui-card-body">
|
||||||
|
<div class="layui-form">
|
||||||
|
<div class="layui-form-item row">
|
||||||
|
<label class="layui-form-label col-md-2" for="Name">商户</label>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<select id="id" name="id">
|
||||||
|
@foreach (var item in Model.blist)
|
||||||
|
{
|
||||||
|
if (Model.data.Id == item.Id)
|
||||||
|
{
|
||||||
|
<option value="@item.Id" selected>@item.Name</option>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<option value="@item.Id">@item.Name</option>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="layui-form-item row">
|
||||||
|
<label class="layui-form-label col-md-2" for="pushurl">推送地址</label>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<input type="text" class="layui-input" value="@Model.data.PushUrl" name="pushurl" id="pushurl" placeholder="请输入推送地址" />
|
||||||
|
<span class="tiptext">必须以http开头</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="layui-form-item row">
|
||||||
|
<label class="layui-form-label col-md-2" for="pushurl">IP白名单</label>
|
||||||
|
<div class="col-md-8">
|
||||||
|
<textarea name="iplist" class="layui-textarea">@Model.data.IPList</textarea>
|
||||||
|
<span class="tiptext">多个IP之间以;分隔</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="text-center col-md-7">
|
||||||
|
<button class="btn btn-primary btn-lg" lay-submit lay-filter="submit" type="button">提交</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@section Scripts{
|
||||||
|
<script type="text/javascript">
|
||||||
|
layui.use(['form', 'common'], function () {
|
||||||
|
var form = layui.form,
|
||||||
|
common = layui.common;
|
||||||
|
|
||||||
|
form.on("submit(submit)", function (data) {
|
||||||
|
common.ajax({
|
||||||
|
url: "/api/business/submitapiform",
|
||||||
|
type: "post",
|
||||||
|
data: data.field
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,35 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||||
|
using Waste.Application;
|
||||||
|
using Waste.Domain;
|
||||||
|
|
||||||
|
namespace Waste.Web.Entry.Pages.AppApi
|
||||||
|
{
|
||||||
|
public class EditModel : BaseModel
|
||||||
|
{
|
||||||
|
private readonly IBusinessService _businessService;
|
||||||
|
private readonly IBusinessApiService _businessApiService;
|
||||||
|
|
||||||
|
public List<W_Business> blist = new List<W_Business>();
|
||||||
|
|
||||||
|
public W_BusinessAppApi data = new W_BusinessAppApi();
|
||||||
|
|
||||||
|
public EditModel(IBusinessService businessService, IBusinessApiService businessApiService)
|
||||||
|
{
|
||||||
|
_businessService = businessService;
|
||||||
|
_businessApiService = businessApiService;
|
||||||
|
}
|
||||||
|
public async Task OnGetAsync(Guid? id=null)
|
||||||
|
{
|
||||||
|
blist = await _businessService.GetAllList();
|
||||||
|
if(id.HasValue && id.Value != Guid.Empty)
|
||||||
|
{
|
||||||
|
data = await _businessApiService.DetailAsync(id.Value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,108 @@
|
||||||
|
@page
|
||||||
|
@model Waste.Web.Entry.Pages.AppApi.IndexModel
|
||||||
|
@{
|
||||||
|
ViewData["Title"] = "授权平台";
|
||||||
|
}
|
||||||
|
<div class="layui-card">
|
||||||
|
<div class="layui-form layui-card-header layuiadmin-card-header-auto">
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<div class="layui-inline">
|
||||||
|
<div class="layui-input-inline">
|
||||||
|
<select id="BusinessId" name="BusinessId">
|
||||||
|
<option value="">请选择商户</option>
|
||||||
|
@foreach (var item in Model.blist)
|
||||||
|
{
|
||||||
|
<option value="@item.Id">@item.Name</option>
|
||||||
|
}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="layui-inline">
|
||||||
|
<button class="btn btn-primary btn-lg js-search" type="button">查询</button>
|
||||||
|
<button class="btn btn-primary btn-lg js-add" type="button">添加</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="layui-card-body">
|
||||||
|
<table class="layui-table" id="list" lay-filter="list">
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<script type="text/html" id="optpl">
|
||||||
|
<a href="#" class="js-edit" title="编辑" data-id="{{d.id}}">编辑</a>
|
||||||
|
<a href="#" class="js-return" title="删除" data-id="{{d.id}}">删除</a>
|
||||||
|
</script>
|
||||||
|
@section Scripts
|
||||||
|
{
|
||||||
|
<script type="text/javascript">
|
||||||
|
layui.use(['common'], function () {
|
||||||
|
var common = layui.common;
|
||||||
|
common.initTable({
|
||||||
|
url: '/api/business/getapilist'
|
||||||
|
, method: 'post'
|
||||||
|
, cols: [[
|
||||||
|
{
|
||||||
|
field: 'businessname', title: '商户'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'appid', title: 'appid'
|
||||||
|
}
|
||||||
|
,
|
||||||
|
{
|
||||||
|
field: 'appsecret', title: 'appsecret'
|
||||||
|
}
|
||||||
|
,
|
||||||
|
{
|
||||||
|
field: 'pushurl', title: '推送地址'
|
||||||
|
}
|
||||||
|
,
|
||||||
|
{
|
||||||
|
field: 'status', title: '状态', templet: function (d) {
|
||||||
|
return StatusType[d.status];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
,
|
||||||
|
{
|
||||||
|
field: 'createtime', title: '授权时间'
|
||||||
|
}
|
||||||
|
,
|
||||||
|
{
|
||||||
|
title: '操作', templet: "#optpl"
|
||||||
|
}
|
||||||
|
]]
|
||||||
|
});
|
||||||
|
$(".js-search").on("click", function () {
|
||||||
|
common.reloadtable("list", {
|
||||||
|
where: {
|
||||||
|
queryParam: [{
|
||||||
|
"Name": 'id',
|
||||||
|
"Type": QueryCond.Equal,
|
||||||
|
"Value": $("#BusinessId").val()
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
$(".js-add").on("click", function () {
|
||||||
|
common.dialog({
|
||||||
|
title: '添加授权',
|
||||||
|
content: '/AppApi/Edit'
|
||||||
|
});
|
||||||
|
});
|
||||||
|
$("body").on("click", ".js-edit", function () {
|
||||||
|
var id = $(this).data('id');
|
||||||
|
common.dialog({
|
||||||
|
title: '编辑授权',
|
||||||
|
content: '/AppApi/Edit?id=' + id
|
||||||
|
});
|
||||||
|
});
|
||||||
|
$("body").on("click", ".js-return", function () {
|
||||||
|
var id = $(this).data('id');
|
||||||
|
common.confirm("确定删除?", function () {
|
||||||
|
common.uajax({
|
||||||
|
url: "/api/business/DeleteApiForm?keyvalue=" + id
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||||
|
using Waste.Application;
|
||||||
|
using Waste.Domain;
|
||||||
|
|
||||||
|
namespace Waste.Web.Entry.Pages.AppApi
|
||||||
|
{
|
||||||
|
public class IndexModel : BaseModel
|
||||||
|
{
|
||||||
|
private readonly IBusinessService _businessService;
|
||||||
|
public List<W_Business> blist = new List<W_Business>();
|
||||||
|
public IndexModel(IBusinessService businessService)
|
||||||
|
{
|
||||||
|
_businessService = businessService;
|
||||||
|
}
|
||||||
|
public async Task OnGetAsync()
|
||||||
|
{
|
||||||
|
blist = await _businessService.GetAllList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -206,6 +206,9 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'devcode', title: '设备编号', hide: true
|
field: 'devcode', title: '设备编号', hide: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'devaddress', title: '设备地址', hide: false
|
||||||
}
|
}
|
||||||
,
|
,
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,6 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<_PublishTargetUrl>D:\webpublish\waste.ybhdmob.com</_PublishTargetUrl>
|
<_PublishTargetUrl>D:\webpublish\waste.ybhdmob.com</_PublishTargetUrl>
|
||||||
<History>True|2021-05-28T05:59:02.2308877Z;True|2021-05-28T11:56:26.6796406+08:00;True|2021-05-28T11:28:00.4087907+08:00;True|2021-05-27T16:18:09.5993838+08:00;True|2021-05-27T16:07:31.3484951+08:00;True|2021-05-27T11:30:37.9119310+08:00;True|2021-05-27T11:28:35.5374674+08:00;True|2021-05-27T08:00:09.1625592+08:00;True|2021-05-26T20:42:17.0852150+08:00;True|2021-05-26T20:36:49.7527415+08:00;True|2021-05-25T17:57:31.8791293+08:00;True|2021-05-25T13:49:29.6488978+08:00;True|2021-05-25T13:48:24.6686105+08:00;True|2021-05-25T13:25:41.2512493+08:00;True|2021-05-24T17:55:33.3800078+08:00;True|2021-05-20T14:35:30.6957985+08:00;True|2021-05-20T13:17:22.6192995+08:00;True|2021-05-20T10:51:38.1268169+08:00;True|2021-05-19T19:50:03.7000224+08:00;True|2021-05-19T19:44:27.2518811+08:00;True|2021-05-19T19:43:26.5916681+08:00;True|2021-05-19T19:36:29.3197365+08:00;True|2021-05-19T19:30:00.3802430+08:00;True|2021-05-19T17:55:23.7939835+08:00;True|2021-05-19T11:05:17.9043392+08:00;True|2021-05-19T10:19:38.4839988+08:00;True|2021-05-19T10:17:19.7430612+08:00;True|2021-05-19T10:13:23.0031721+08:00;True|2021-05-19T10:06:03.9881599+08:00;True|2021-05-18T14:39:03.8876574+08:00;True|2021-05-18T14:23:46.9818836+08:00;True|2021-05-18T14:19:56.2382079+08:00;True|2021-05-18T11:29:53.5497590+08:00;True|2021-05-18T11:16:18.0123853+08:00;True|2021-05-17T18:59:52.4159105+08:00;True|2021-05-17T18:53:37.9438984+08:00;True|2021-05-17T18:48:14.9625161+08:00;True|2021-05-17T17:46:03.7723404+08:00;True|2021-05-17T17:14:20.2312990+08:00;True|2021-05-17T16:44:34.5837616+08:00;True|2021-05-17T16:25:20.1087804+08:00;True|2021-05-17T11:35:27.9388562+08:00;</History>
|
<History>True|2021-06-02T07:08:52.8245632Z;True|2021-06-02T15:05:50.3614099+08:00;True|2021-06-02T14:59:32.3690948+08:00;True|2021-06-02T14:10:25.1182836+08:00;True|2021-06-02T14:09:54.9215833+08:00;True|2021-06-01T10:41:54.9488501+08:00;True|2021-06-01T10:38:56.0283198+08:00;True|2021-05-28T13:59:02.2308877+08:00;True|2021-05-28T11:56:26.6796406+08:00;True|2021-05-28T11:28:00.4087907+08:00;True|2021-05-27T16:18:09.5993838+08:00;True|2021-05-27T16:07:31.3484951+08:00;True|2021-05-27T11:30:37.9119310+08:00;True|2021-05-27T11:28:35.5374674+08:00;True|2021-05-27T08:00:09.1625592+08:00;True|2021-05-26T20:42:17.0852150+08:00;True|2021-05-26T20:36:49.7527415+08:00;True|2021-05-25T17:57:31.8791293+08:00;True|2021-05-25T13:49:29.6488978+08:00;True|2021-05-25T13:48:24.6686105+08:00;True|2021-05-25T13:25:41.2512493+08:00;True|2021-05-24T17:55:33.3800078+08:00;True|2021-05-20T14:35:30.6957985+08:00;True|2021-05-20T13:17:22.6192995+08:00;True|2021-05-20T10:51:38.1268169+08:00;True|2021-05-19T19:50:03.7000224+08:00;True|2021-05-19T19:44:27.2518811+08:00;True|2021-05-19T19:43:26.5916681+08:00;True|2021-05-19T19:36:29.3197365+08:00;True|2021-05-19T19:30:00.3802430+08:00;True|2021-05-19T17:55:23.7939835+08:00;True|2021-05-19T11:05:17.9043392+08:00;True|2021-05-19T10:19:38.4839988+08:00;True|2021-05-19T10:17:19.7430612+08:00;True|2021-05-19T10:13:23.0031721+08:00;True|2021-05-19T10:06:03.9881599+08:00;True|2021-05-18T14:39:03.8876574+08:00;True|2021-05-18T14:23:46.9818836+08:00;True|2021-05-18T14:19:56.2382079+08:00;True|2021-05-18T11:29:53.5497590+08:00;True|2021-05-18T11:16:18.0123853+08:00;True|2021-05-17T18:59:52.4159105+08:00;True|2021-05-17T18:53:37.9438984+08:00;True|2021-05-17T18:48:14.9625161+08:00;True|2021-05-17T17:46:03.7723404+08:00;True|2021-05-17T17:14:20.2312990+08:00;True|2021-05-17T16:44:34.5837616+08:00;True|2021-05-17T16:25:20.1087804+08:00;True|2021-05-17T11:35:27.9388562+08:00;</History>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|
@ -3,6 +3,6 @@
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<RazorPage_SelectedScaffolderID>RazorPageScaffolder</RazorPage_SelectedScaffolderID>
|
<RazorPage_SelectedScaffolderID>RazorPageScaffolder</RazorPage_SelectedScaffolderID>
|
||||||
<RazorPage_SelectedScaffolderCategoryPath>root/Common/RazorPage</RazorPage_SelectedScaffolderCategoryPath>
|
<RazorPage_SelectedScaffolderCategoryPath>root/Common/RazorPage</RazorPage_SelectedScaffolderCategoryPath>
|
||||||
<NameOfLastUsedPublishProfile>F:\liuzl_ybhdmob\Waste\Waste.Web.Entry\Properties\PublishProfiles\waste.ybhdmob.com.pubxml</NameOfLastUsedPublishProfile>
|
<NameOfLastUsedPublishProfile>E:\workspace_ybhdmob\Waste\Waste.Web.Entry\Properties\PublishProfiles\waste.ybhdmob.com.pubxml</NameOfLastUsedPublishProfile>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|
@ -43,6 +43,7 @@
|
||||||
"ApiSecret": "1KXWKC1WA8V8eCDX",
|
"ApiSecret": "1KXWKC1WA8V8eCDX",
|
||||||
"ApiSecretHash": "5567485e9458ee89"
|
"ApiSecretHash": "5567485e9458ee89"
|
||||||
},
|
},
|
||||||
|
"IsTask": "false",//定时任务是否开启
|
||||||
"SoftName": "巨鼎物联网数字平台", //软件名称
|
"SoftName": "巨鼎物联网数字平台", //软件名称
|
||||||
"SecureKey": "ybhdmob_waste_2021",
|
"SecureKey": "ybhdmob_waste_2021",
|
||||||
"SoftDesc": "", //软件描述
|
"SoftDesc": "", //软件描述
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue