Browse Source

Update files

master
fanwensheng 3 years ago
parent
commit
abdb841b0f
  1. 3
      04.系统编码/App/Controllers/StatisticAnalysisController.cs
  2. 1
      04.系统编码/BLL/BLL.csproj
  3. 14
      04.系统编码/BLL/ComputeBLL.cs
  4. 5
      04.系统编码/BLL/TaskBLL.cs
  5. 42
      04.系统编码/DAL/ComputeDAL.cs
  6. 1
      04.系统编码/DAL/DAL.csproj
  7. 34
      04.系统编码/DAL/TaskDAL.cs

3
04.系统编码/App/Controllers/StatisticAnalysisController.cs

@ -8,7 +8,6 @@ namespace Pingchuan.BeijingSafeguard.App.Controllers
{
public class StatisticAnalysisController : BaseController
{
// GET: StatisticAnalysis
public ActionResult Index()
{
return View();
@ -17,7 +16,7 @@ namespace Pingchuan.BeijingSafeguard.App.Controllers
[HttpPost]
public JsonResult Query(string typeCode, DateTime fromTime, DateTime toTime, int page, int rows)
{
Pagination<Statistic> pagination = ComputeBLL.Statistics(typeCode, fromTime, toTime, page, rows);
Pagination<Statistic> pagination = TaskBLL.Statistics(typeCode, fromTime, toTime, page, rows);
return Json(pagination);
}
}

1
04.系统编码/BLL/BLL.csproj

@ -46,7 +46,6 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="ComputeBLL.cs" />
<Compile Include="GmapNetCacheBLL.cs" />
<Compile Include="ConfigBLL.cs" />
<Compile Include="OrgBLL.cs" />

14
04.系统编码/BLL/ComputeBLL.cs

@ -1,14 +0,0 @@
using System;
using Pingchuan.BeijingSafeguard.DAL;
using Pingchuan.BeijingSafeguard.Model;
namespace Pingchuan.BeijingSafeguard.BLL
{
public class ComputeBLL
{
public static Pagination<Statistic> Statistics(string typeCode, DateTime fromTime, DateTime toTime, int pageIndex, int pageSize)
{
return ComputeDAL.Statistics(typeCode, fromTime, toTime, pageIndex, pageSize);
}
}
}

5
04.系统编码/BLL/TaskBLL.cs

@ -30,6 +30,11 @@ namespace Pingchuan.BeijingSafeguard.BLL
return TaskDAL.GetTaskIdByRegion(region);
}
public static Pagination<Statistic> Statistics(string typeCode, DateTime fromTime, DateTime toTime, int pageIndex, int pageSize)
{
return TaskDAL.Statistics(typeCode, fromTime, toTime, pageIndex, pageSize);
}
public static Task ToModel(int userId, string taskId, string region, decimal longitude, decimal latitude, decimal height, decimal simulatedDuration, decimal simulatedInterval, DateTime releaseTime, int resultState, string resultMessage)
{
return new Task

42
04.系统编码/DAL/ComputeDAL.cs

@ -1,42 +0,0 @@
using System;
using PetaPoco;
using Pingchuan.BeijingSafeguard.Model;
namespace Pingchuan.BeijingSafeguard.DAL
{
public class ComputeDAL : BaseDAL
{
public static Pagination<Statistic> Statistics(string typeCode, DateTime fromTime, DateTime toTime, int pageIndex, int pageSize)
{
if (typeCode == "user")
return UserStatistics(fromTime, toTime, pageIndex, pageSize);
else if (typeCode == "org")
return OrgStatistics(fromTime, toTime, pageIndex, pageSize);
else
return null;
}
public static Pagination<Statistic> UserStatistics(DateTime fromTime, DateTime toTime, int pageIndex, int pageSize)
{
string sql = $@"select temp.*, u.real_name user_name, o.id org_id, o.name org_name, o.name org_name2 from (
select user_id, count(*) compute_count, max(create_time) last_compute_time from computes
where create_time >= @0 and create_time < @1
group by user_id) temp
left join users u on u.id = temp.user_id
left join orgs o on o.id = u.id";
Page<Statistic> page = db.Page<Statistic>(pageIndex, pageSize, sql, fromTime, toTime, pageIndex, pageSize);
return Pagination<Statistic>.FromPage(page);
}
public static Pagination<Statistic> OrgStatistics(DateTime fromTime, DateTime toTime, int pageIndex, int pageSize)
{
string sql = $@"select temp.*, o.name org_name, o.name org_name2 from (
select org_id, count(*) compute_count, max(create_time) last_compute_time from computes
where create_time >= @0 and create_time < @1
group by org_id) temp
left join orgs o on o.id = temp.org_id";
Page<Statistic> page = db.Page<Statistic>(pageIndex, pageSize, sql, fromTime, toTime, pageIndex, pageSize);
return Pagination<Statistic>.FromPage(page);
}
}
}

1
04.系统编码/DAL/DAL.csproj

@ -50,7 +50,6 @@
</ItemGroup>
<ItemGroup>
<Compile Include="BaseDAL.cs" />
<Compile Include="ComputeDAL.cs" />
<Compile Include="GmapNetCacheDAL.cs" />
<Compile Include="ConfigDAL.cs" />
<Compile Include="OrgDAL.cs" />

34
04.系统编码/DAL/TaskDAL.cs

@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using PetaPoco;
using Pingchuan.BeijingSafeguard.Model;
namespace Pingchuan.BeijingSafeguard.DAL
@ -47,5 +48,38 @@ namespace Pingchuan.BeijingSafeguard.DAL
where c.user_id = {userId} and c.region = '{regionCode}' and c.release_time >= '{startTime}' and c.release_time < '{endTime}'
order by c.release_time desc";
}
public static Pagination<Statistic> Statistics(string typeCode, DateTime fromTime, DateTime toTime, int pageIndex, int pageSize)
{
if (typeCode == "user")
return UserStatistics(fromTime, toTime, pageIndex, pageSize);
else if (typeCode == "org")
return OrgStatistics(fromTime, toTime, pageIndex, pageSize);
else
return null;
}
public static Pagination<Statistic> UserStatistics(DateTime fromTime, DateTime toTime, int pageIndex, int pageSize)
{
string sql = $@"select temp.*, u.real_name user_name, o.id org_id, o.name org_name, o.name org_name2 from (
select user_id, count(*) compute_count, max(create_time) last_compute_time from computes
where create_time >= @0 and create_time < @1
group by user_id) temp
left join users u on u.id = temp.user_id
left join orgs o on o.id = u.id";
Page<Statistic> page = db.Page<Statistic>(pageIndex, pageSize, sql, fromTime, toTime, pageIndex, pageSize);
return Pagination<Statistic>.FromPage(page);
}
public static Pagination<Statistic> OrgStatistics(DateTime fromTime, DateTime toTime, int pageIndex, int pageSize)
{
string sql = $@"select temp.*, o.name org_name, o.name org_name2 from (
select org_id, count(*) compute_count, max(create_time) last_compute_time from computes
where create_time >= @0 and create_time < @1
group by org_id) temp
left join orgs o on o.id = temp.org_id";
Page<Statistic> page = db.Page<Statistic>(pageIndex, pageSize, sql, fromTime, toTime, pageIndex, pageSize);
return Pagination<Statistic>.FromPage(page);
}
}
}
Loading…
Cancel
Save