diff --git a/04.系统编码/App/App.csproj b/04.系统编码/App/App.csproj
index cd0ca82..05162a3 100644
--- a/04.系统编码/App/App.csproj
+++ b/04.系统编码/App/App.csproj
@@ -328,12 +328,14 @@
+
+
diff --git a/04.系统编码/App/Content/scripts/beijing/realtime-panel.js b/04.系统编码/App/Content/scripts/beijing/realtime-panel.js
index 165e0d2..1acda66 100644
--- a/04.系统编码/App/Content/scripts/beijing/realtime-panel.js
+++ b/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;
diff --git a/04.系统编码/App/Content/scripts/config.js b/04.系统编码/App/Content/scripts/config.js
index bc24a26..0e5785b 100644
--- a/04.系统编码/App/Content/scripts/config.js
+++ b/04.系统编码/App/Content/scripts/config.js
@@ -1,4 +1,5 @@
var Config = function () {
+ this.InProductionMode = false;
this.ApiRoot = '47.103.85.253:5003';
};
diff --git a/04.系统编码/App/Controllers/BeijingController.cs b/04.系统编码/App/Controllers/BeijingController.cs
index c7826e3..7ed89b7 100644
--- a/04.系统编码/App/Controllers/BeijingController.cs
+++ b/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
{
diff --git a/04.系统编码/App/Controllers/PointController.cs b/04.系统编码/App/Controllers/PointController.cs
index 9b8fea5..bfad013 100644
--- a/04.系统编码/App/Controllers/PointController.cs
+++ b/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 points = PointBLL.Query(user.Id);
+ List points = PointBLL.Query(region, user.Id);
return Json(points);
}
}
diff --git a/04.系统编码/App/Controllers/StatisticAnalysisController.cs b/04.系统编码/App/Controllers/StatisticAnalysisController.cs
index 3834212..9cb8bd4 100644
--- a/04.系统编码/App/Controllers/StatisticAnalysisController.cs
+++ b/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 pagination = ComputeBLL.Statistics(typeCode, fromTime, toTime, page, rows);
+ Pagination pagination = TaskBLL.Statistics(typeCode, fromTime, toTime, page, rows);
return Json(pagination);
}
}
diff --git a/04.系统编码/BLL/BLL.csproj b/04.系统编码/BLL/BLL.csproj
index fe1c026..3383447 100644
--- a/04.系统编码/BLL/BLL.csproj
+++ b/04.系统编码/BLL/BLL.csproj
@@ -46,7 +46,6 @@
-
diff --git a/04.系统编码/BLL/ComputeBLL.cs b/04.系统编码/BLL/ComputeBLL.cs
deleted file mode 100644
index a878efb..0000000
--- a/04.系统编码/BLL/ComputeBLL.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-using System;
-using Pingchuan.BeijingSafeguard.DAL;
-using Pingchuan.BeijingSafeguard.Model;
-
-namespace Pingchuan.BeijingSafeguard.BLL
-{
- public class ComputeBLL
- {
- public static Pagination Statistics(string typeCode, DateTime fromTime, DateTime toTime, int pageIndex, int pageSize)
- {
- return ComputeDAL.Statistics(typeCode, fromTime, toTime, pageIndex, pageSize);
- }
- }
-}
diff --git a/04.系统编码/BLL/PointBLL.cs b/04.系统编码/BLL/PointBLL.cs
index 55427ca..2a8dde6 100644
--- a/04.系统编码/BLL/PointBLL.cs
+++ b/04.系统编码/BLL/PointBLL.cs
@@ -23,9 +23,9 @@ namespace Pingchuan.BeijingSafeguard.BLL
return PointDAL.Delete(id);
}
- public static List Query(int userId)
+ public static List Query(string region, int userId)
{
- return PointDAL.Query(userId);
+ return PointDAL.Query(region, userId);
}
}
}
\ No newline at end of file
diff --git a/04.系统编码/BLL/TaskBLL.cs b/04.系统编码/BLL/TaskBLL.cs
index ce258ef..00cb08c 100644
--- a/04.系统编码/BLL/TaskBLL.cs
+++ b/04.系统编码/BLL/TaskBLL.cs
@@ -30,6 +30,11 @@ namespace Pingchuan.BeijingSafeguard.BLL
return TaskDAL.GetTaskIdByRegion(region);
}
+ public static Pagination 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
diff --git a/04.系统编码/DAL/ComputeDAL.cs b/04.系统编码/DAL/ComputeDAL.cs
deleted file mode 100644
index 7868e84..0000000
--- a/04.系统编码/DAL/ComputeDAL.cs
+++ /dev/null
@@ -1,42 +0,0 @@
-using System;
-using PetaPoco;
-using Pingchuan.BeijingSafeguard.Model;
-
-namespace Pingchuan.BeijingSafeguard.DAL
-{
- public class ComputeDAL : BaseDAL
- {
- public static Pagination 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 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 page = db.Page(pageIndex, pageSize, sql, fromTime, toTime, pageIndex, pageSize);
- return Pagination.FromPage(page);
- }
-
- public static Pagination 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 page = db.Page(pageIndex, pageSize, sql, fromTime, toTime, pageIndex, pageSize);
- return Pagination.FromPage(page);
- }
- }
-}
\ No newline at end of file
diff --git a/04.系统编码/DAL/DAL.csproj b/04.系统编码/DAL/DAL.csproj
index 83c42d1..9d17df4 100644
--- a/04.系统编码/DAL/DAL.csproj
+++ b/04.系统编码/DAL/DAL.csproj
@@ -50,7 +50,6 @@
-
diff --git a/04.系统编码/DAL/PointDAL.cs b/04.系统编码/DAL/PointDAL.cs
index fdcdcee..ed0caed 100644
--- a/04.系统编码/DAL/PointDAL.cs
+++ b/04.系统编码/DAL/PointDAL.cs
@@ -22,10 +22,10 @@ namespace Pingchuan.BeijingSafeguard.DAL
return db.Delete(id);
}
- public static List Query(int userId)
+ public static List Query(string region, int userId)
{
- string sql = $@"select * from points where user_id = @0";
- return db.Fetch(sql, userId);
+ string sql = $@"select * from points where region = @0 and user_id = @1";
+ return db.Fetch(sql, region, userId);
}
}
}
\ No newline at end of file
diff --git a/04.系统编码/DAL/TaskDAL.cs b/04.系统编码/DAL/TaskDAL.cs
index d848707..be2c16d 100644
--- a/04.系统编码/DAL/TaskDAL.cs
+++ b/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 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 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 page = db.Page(pageIndex, pageSize, sql, fromTime, toTime, pageIndex, pageSize);
+ return Pagination.FromPage(page);
+ }
+
+ public static Pagination 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 page = db.Page(pageIndex, pageSize, sql, fromTime, toTime, pageIndex, pageSize);
+ return Pagination.FromPage(page);
+ }
}
}
\ No newline at end of file
diff --git a/04.系统编码/Model/Point.cs b/04.系统编码/Model/Point.cs
index 2f01e34..5f7eafb 100644
--- a/04.系统编码/Model/Point.cs
+++ b/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; }