hhx 3 years ago
parent
commit
6ff2fcecb6
  1. 2
      04.系统编码/App/App.csproj
  2. 13
      04.系统编码/App/Content/scripts/beijing/realtime-panel.js
  3. 1
      04.系统编码/App/Content/scripts/config.js
  4. 3
      04.系统编码/App/Controllers/BeijingController.cs
  5. 4
      04.系统编码/App/Controllers/PointController.cs
  6. 3
      04.系统编码/App/Controllers/StatisticAnalysisController.cs
  7. 1
      04.系统编码/BLL/BLL.csproj
  8. 14
      04.系统编码/BLL/ComputeBLL.cs
  9. 4
      04.系统编码/BLL/PointBLL.cs
  10. 5
      04.系统编码/BLL/TaskBLL.cs
  11. 42
      04.系统编码/DAL/ComputeDAL.cs
  12. 1
      04.系统编码/DAL/DAL.csproj
  13. 6
      04.系统编码/DAL/PointDAL.cs
  14. 34
      04.系统编码/DAL/TaskDAL.cs
  15. 3
      04.系统编码/Model/Point.cs

2
04.系统编码/App/App.csproj

@ -328,12 +328,14 @@
</ItemGroup>
<ItemGroup>
<Folder Include="App_Data\" />
<Folder Include="Content\json\menggu\" />
<Folder Include="Models\" />
</ItemGroup>
<ItemGroup>
<Content Include="Content\scripts\beijing\wind-template.json" />
<Content Include="Content\scripts\menggu\wind-template.json" />
<Content Include="Content\thirds\leaflet.draw-0.4.14\leaflet.draw-src.map" />
<Content Include="Content\json\beijing\202111060851610.json" />
<None Include="packages.config" />
<Content Include="Views\Tiananmen\Index.cshtml" />
<Content Include="Views\User\Login.cshtml" />

13
04.系统编码/App/Content/scripts/beijing/realtime-panel.js

@ -183,7 +183,7 @@
$.ajax({
type: "GET",
dataType: 'json',
url: 'http://{0}/bj/check?num={1}'.format(Config.ApiRoot, this.TaskInfo.Id),
url: this.getJsonUrl(this.TaskInfo.Id),
success: function (result) {
this.TaskInfo.Result = result;
@ -200,6 +200,13 @@
});
};
this.getJsonUrl = function (taskId) {
if (Config.InProductionMode)
return 'http://{0}/bj/check?num={1}'.format(Config.ApiRoot, taskId);
else
return '/Content/json/beijing/{0}.json'.format(taskId);
};
this.LoadData = function (result) {
$.getJSON("http://{0}/bj/getresult/{1}.json".format(Config.ApiRoot, result.num), function (data) {
var param = this.GetTaskParams(this.TaskInfo.Id);
@ -293,7 +300,7 @@
var partten = 'http://{0}/bj/{1}?lon={2}&lat={3}&num={4}&hgt={5}&rlen={6}&tlen={7}&tpoint={8}&rlen2={9}&tlen2={10}&fac={11}';
var url = partten.format(Config.ApiRoot, 'backward', params.lon, params.lat, params.num, params.hgt, params.rlen, params.tlen, params.tpoint, params.rlen2, params.tlen2, params.pullGround);
this.TestModel('202009241710391', parseFloat(params.lat), parseFloat(params.lon));
this.TestModel('202111060851610', parseFloat(params.lat), parseFloat(params.lon));
return;
$.ajax({
@ -318,7 +325,7 @@
$.ajax({
type: "GET",
dataType: 'json',
url: 'http://{0}/bj/check?num={1}'.format(Config.ApiRoot, taskId),
url: this.getJsonUrl(taskId),
success: function (result) {
this.TaskInfo.Id = taskId;
this.TaskInfo.Result = result;

1
04.系统编码/App/Content/scripts/config.js

@ -1,4 +1,5 @@
var Config = function () {
this.InProductionMode = false;
this.ApiRoot = '47.103.85.253:5003';
};

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

@ -1,4 +1,5 @@
using System;
using System.Web;
using System.Text;
using System.Web.Mvc;
using System.Collections.Generic;
@ -7,9 +8,7 @@ using Newtonsoft.Json;
using Pingchuan.BeijingSafeguard.BLL;
using Pingchuan.BeijingSafeguard.Model;
using Pingchuan.BeijingSafeguard.App.Controllers;
using MyTask = Pingchuan.BeijingSafeguard.Model.Task;
using System.Web;
namespace BeijingSafeguard.Controllers
{

4
04.系统编码/App/Controllers/PointController.cs

@ -34,10 +34,10 @@ namespace Pingchuan.BeijingSafeguard.App.Controllers
}
[HttpPost]
public JsonResult Query()
public JsonResult Query(string region)
{
User user = GetLoginUser();
List<Point> points = PointBLL.Query(user.Id);
List<Point> points = PointBLL.Query(region, user.Id);
return Json(points);
}
}

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);
}
}
}

4
04.系统编码/BLL/PointBLL.cs

@ -23,9 +23,9 @@ namespace Pingchuan.BeijingSafeguard.BLL
return PointDAL.Delete(id);
}
public static List<Point> Query(int userId)
public static List<Point> Query(string region, int userId)
{
return PointDAL.Query(userId);
return PointDAL.Query(region, userId);
}
}
}

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" />

6
04.系统编码/DAL/PointDAL.cs

@ -22,10 +22,10 @@ namespace Pingchuan.BeijingSafeguard.DAL
return db.Delete<Point>(id);
}
public static List<Point> Query(int userId)
public static List<Point> Query(string region, int userId)
{
string sql = $@"select * from points where user_id = @0";
return db.Fetch<Point>(sql, userId);
string sql = $@"select * from points where region = @0 and user_id = @1";
return db.Fetch<Point>(sql, region, userId);
}
}
}

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);
}
}
}

3
04.系统编码/Model/Point.cs

@ -13,6 +13,9 @@ namespace Pingchuan.BeijingSafeguard.Model
[Column("user_id")]
public int UserId { get; set; }
[Column("region")]
public string region { get; set; }
[Column("title")]
public string Title { get; set; }

Loading…
Cancel
Save