Unify ports to 9002/9000 and fix report grouping sort, weigh summary in wan
This commit is contained in:
@@ -30,16 +30,26 @@ public class ReportsController(AppDbContext db, DataScopeService scope, CurrentU
|
|||||||
|
|
||||||
var rows = dimension switch
|
var rows = dimension switch
|
||||||
{
|
{
|
||||||
"month" => await query
|
"month" => (await query
|
||||||
.GroupBy(p => new { p.CreatedAt.Year, p.CreatedAt.Month })
|
.GroupBy(p => new { p.CreatedAt.Year, p.CreatedAt.Month })
|
||||||
.Select(g => new
|
.Select(g => new
|
||||||
{
|
{
|
||||||
Key = $"{g.Key.Year}-{g.Key.Month:D2}",
|
Year = g.Key.Year,
|
||||||
|
Month = g.Key.Month,
|
||||||
Amount = g.Sum(p => p.Amount),
|
Amount = g.Sum(p => p.Amount),
|
||||||
Weight = g.Sum(p => p.NetWeight),
|
Weight = g.Sum(p => p.NetWeight),
|
||||||
Cnt = g.Count()
|
Cnt = g.Count()
|
||||||
})
|
})
|
||||||
.OrderBy(g => g.Key).ToListAsync(),
|
.OrderBy(g => g.Year).ThenBy(g => g.Month)
|
||||||
|
.ToListAsync())
|
||||||
|
.Select(g => new
|
||||||
|
{
|
||||||
|
Key = $"{g.Year}-{g.Month:D2}",
|
||||||
|
g.Amount,
|
||||||
|
g.Weight,
|
||||||
|
g.Cnt
|
||||||
|
})
|
||||||
|
.ToList(),
|
||||||
"product" => await query
|
"product" => await query
|
||||||
.GroupBy(p => p.Product!.Name)
|
.GroupBy(p => p.Product!.Name)
|
||||||
.Select(g => new { Key = g.Key, Amount = g.Sum(p => p.Amount), Weight = g.Sum(p => p.NetWeight), Cnt = g.Count() })
|
.Select(g => new { Key = g.Key, Amount = g.Sum(p => p.Amount), Weight = g.Sum(p => p.NetWeight), Cnt = g.Count() })
|
||||||
@@ -52,16 +62,27 @@ public class ReportsController(AppDbContext db, DataScopeService scope, CurrentU
|
|||||||
.GroupBy(p => p.PurchaserOrg!.Name)
|
.GroupBy(p => p.PurchaserOrg!.Name)
|
||||||
.Select(g => new { Key = g.Key, Amount = g.Sum(p => p.Amount), Weight = g.Sum(p => p.NetWeight), Cnt = g.Count() })
|
.Select(g => new { Key = g.Key, Amount = g.Sum(p => p.Amount), Weight = g.Sum(p => p.NetWeight), Cnt = g.Count() })
|
||||||
.OrderByDescending(g => g.Amount).ToListAsync(),
|
.OrderByDescending(g => g.Amount).ToListAsync(),
|
||||||
_ => await query
|
_ => (await query
|
||||||
.GroupBy(p => new { p.CreatedAt.Year, p.CreatedAt.Month, p.CreatedAt.Day })
|
.GroupBy(p => new { p.CreatedAt.Year, p.CreatedAt.Month, p.CreatedAt.Day })
|
||||||
.Select(g => new
|
.Select(g => new
|
||||||
{
|
{
|
||||||
Key = $"{g.Key.Year}-{g.Key.Month:D2}-{g.Key.Day:D2}",
|
Year = g.Key.Year,
|
||||||
|
Month = g.Key.Month,
|
||||||
|
Day = g.Key.Day,
|
||||||
Amount = g.Sum(p => p.Amount),
|
Amount = g.Sum(p => p.Amount),
|
||||||
Weight = g.Sum(p => p.NetWeight),
|
Weight = g.Sum(p => p.NetWeight),
|
||||||
Cnt = g.Count()
|
Cnt = g.Count()
|
||||||
})
|
})
|
||||||
.OrderBy(g => g.Key).ToListAsync()
|
.OrderBy(g => g.Year).ThenBy(g => g.Month).ThenBy(g => g.Day)
|
||||||
|
.ToListAsync())
|
||||||
|
.Select(g => new
|
||||||
|
{
|
||||||
|
Key = $"{g.Year}-{g.Month:D2}-{g.Day:D2}",
|
||||||
|
g.Amount,
|
||||||
|
g.Weight,
|
||||||
|
g.Cnt
|
||||||
|
})
|
||||||
|
.ToList()
|
||||||
};
|
};
|
||||||
|
|
||||||
return Ok(new PurchaseSummaryResult(
|
return Ok(new PurchaseSummaryResult(
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
"commandName": "Project",
|
"commandName": "Project",
|
||||||
"dotnetRunMessages": true,
|
"dotnetRunMessages": true,
|
||||||
"launchBrowser": false,
|
"launchBrowser": false,
|
||||||
"applicationUrl": "http://0.0.0.0:5246",
|
"applicationUrl": "http://0.0.0.0:9002",
|
||||||
"environmentVariables": {
|
"environmentVariables": {
|
||||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,9 +19,9 @@
|
|||||||
"Issuer": "AgriculturalPlatform",
|
"Issuer": "AgriculturalPlatform",
|
||||||
"Audience": "AgriculturalPlatform.Client"
|
"Audience": "AgriculturalPlatform.Client"
|
||||||
},
|
},
|
||||||
"FrontendUrl": "http://localhost:5173",
|
"FrontendUrl": "http://localhost:9000",
|
||||||
"Server": {
|
"Server": {
|
||||||
"LanPort": 5246
|
"LanPort": 9002
|
||||||
},
|
},
|
||||||
"Storage": {
|
"Storage": {
|
||||||
"UseOss": true
|
"UseOss": true
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<el-col :span="4"><div class="stat-card"><div class="stat-num">{{ summary.orderCount }}</div><div class="stat-label">收购单数(单)</div></div></el-col>
|
<el-col :span="4"><div class="stat-card"><div class="stat-num">{{ summary.orderCount }}</div><div class="stat-label">收购单数(单)</div></div></el-col>
|
||||||
<el-col :span="4"><div class="stat-card"><div class="stat-num">{{ summary.totalNetWeight.toLocaleString() }}</div><div class="stat-label">重量合计({{ unitLabel }})</div></div></el-col>
|
<el-col :span="4"><div class="stat-card"><div class="stat-num">{{ summary.totalNetWeight.toLocaleString() }}</div><div class="stat-label">重量合计({{ unitLabel }})</div></div></el-col>
|
||||||
<el-col :span="4"><div class="stat-card"><div class="stat-num">{{ fmtMoney(summary.avgPrice) }}</div><div class="stat-label">均价(元/{{ unitLabel }})</div></div></el-col>
|
<el-col :span="4"><div class="stat-card"><div class="stat-num">{{ fmtMoney(summary.avgPrice) }}</div><div class="stat-label">均价(元/{{ unitLabel }})</div></div></el-col>
|
||||||
<el-col :span="4"><div class="stat-card"><div class="stat-num">¥ {{ fmtMoney(summary.totalAmount) }}</div><div class="stat-label">金额合计(元)</div></div></el-col>
|
<el-col :span="4"><div class="stat-card"><div class="stat-num">{{ fmtSummaryMoney(summary.totalAmount) }}</div><div class="stat-label">金额合计({{ summary.totalAmount >= 1000000 ? '万元' : '元' }})</div></div></el-col>
|
||||||
<el-col :span="4"><div class="stat-card"><div class="stat-num">{{ summary.farmerCount }}</div><div class="stat-label">合作农户(户)</div></div></el-col>
|
<el-col :span="4"><div class="stat-card"><div class="stat-num">{{ summary.farmerCount }}</div><div class="stat-label">合作农户(户)</div></div></el-col>
|
||||||
<el-col :span="4"><div class="stat-card"><div class="stat-num">{{ summary.todayOrderCount }}</div><div class="stat-label">今日单数(单)</div></div></el-col>
|
<el-col :span="4"><div class="stat-card"><div class="stat-num">{{ summary.todayOrderCount }}</div><div class="stat-label">今日单数(单)</div></div></el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
@@ -858,6 +858,12 @@ const onTransfer = async () => {
|
|||||||
|
|
||||||
// ---------- 工具 ----------
|
// ---------- 工具 ----------
|
||||||
const fmtMoney = (v?: number) => (v ?? 0).toLocaleString('zh-CN', { minimumFractionDigits: 2, maximumFractionDigits: 2 })
|
const fmtMoney = (v?: number) => (v ?? 0).toLocaleString('zh-CN', { minimumFractionDigits: 2, maximumFractionDigits: 2 })
|
||||||
|
// 金额合计:超过 100 万显示为万元,否则保留原样
|
||||||
|
const fmtSummaryMoney = (v?: number) => {
|
||||||
|
const n = v ?? 0
|
||||||
|
if (n >= 1000000) return '¥ ' + (n / 10000).toLocaleString('zh-CN', { minimumFractionDigits: 2, maximumFractionDigits: 2 }) + ' 万'
|
||||||
|
return '¥ ' + n.toLocaleString('zh-CN', { minimumFractionDigits: 2, maximumFractionDigits: 2 })
|
||||||
|
}
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
products.value = await getProducts()
|
products.value = await getProducts()
|
||||||
|
|||||||
@@ -11,18 +11,18 @@ export default defineConfig({
|
|||||||
},
|
},
|
||||||
server: {
|
server: {
|
||||||
host: '0.0.0.0',
|
host: '0.0.0.0',
|
||||||
port: 5173,
|
port: 9000,
|
||||||
proxy: {
|
proxy: {
|
||||||
'/api': {
|
'/api': {
|
||||||
target: 'http://localhost:5246',
|
target: 'http://localhost:9002',
|
||||||
changeOrigin: true
|
changeOrigin: true
|
||||||
},
|
},
|
||||||
'/uploads': {
|
'/uploads': {
|
||||||
target: 'http://localhost:5246',
|
target: 'http://localhost:9002',
|
||||||
changeOrigin: true
|
changeOrigin: true
|
||||||
},
|
},
|
||||||
'/mobile-upload.html': {
|
'/mobile-upload.html': {
|
||||||
target: 'http://localhost:5246',
|
target: 'http://localhost:9002',
|
||||||
changeOrigin: true
|
changeOrigin: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,4 +7,4 @@ Start-Process -FilePath "dotnet" `
|
|||||||
-RedirectStandardError "$root/backend-run.err.log" `
|
-RedirectStandardError "$root/backend-run.err.log" `
|
||||||
-WindowStyle Hidden
|
-WindowStyle Hidden
|
||||||
Start-Sleep -Seconds 6
|
Start-Sleep -Seconds 6
|
||||||
Get-NetTCPConnection -LocalPort 5246 -ErrorAction SilentlyContinue | Where-Object State -eq Listen | Select-Object LocalPort, State, OwningProcess
|
Get-NetTCPConnection -LocalPort 9002 -ErrorAction SilentlyContinue | Where-Object State -eq Listen | Select-Object LocalPort, State, OwningProcess
|
||||||
|
|||||||
Reference in New Issue
Block a user