Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Z
zjnyxcxServer
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
node_server
zjnyxcxServer
Commits
065d5b49
Commit
065d5b49
authored
May 08, 2025
by
lixinming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
no message
parent
567e1a92
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
146 additions
and
40 deletions
+146
-40
caiShou.ts
src/biz/caiShou.ts
+2
-2
dataInt.ts
src/biz/dataInt.ts
+0
-0
dataOut.ts
src/biz/dataOut.ts
+53
-2
nongzi.ts
src/biz/nongzi.ts
+1
-1
enum.ts
src/config/enum.ts
+32
-2
caishou.ts
src/data/caishou.ts
+4
-0
zhongzhi.ts
src/data/zhongzhi.ts
+16
-0
mysqlInit.ts
src/db/mysqlInit.ts
+16
-15
main.ts
src/main.ts
+4
-5
public.ts
src/routers/public.ts
+12
-12
router.ts
src/routers/router.ts
+6
-1
No files found.
src/biz/caiShou.ts
View file @
065d5b49
...
@@ -102,8 +102,8 @@ export async function caiShouList(zhongYangType:number, selectStr:string, dId:st
...
@@ -102,8 +102,8 @@ export async function caiShouList(zhongYangType:number, selectStr:string, dId:st
let
dIds
=
dIdList
;
let
dIds
=
dIdList
;
let
didStr
=
""
;
let
didStr
=
""
;
dIds
.
forEach
(
dId
=>
{
dIds
.
forEach
(
dId
=>
{
didStr
+=
`
${
d
iKuaiMap
[
dId
]
}
`
;
didStr
+=
`
${
d
Id
}
`
;
})
})
;
dataList
.
push
({
dataList
.
push
({
plantType
:
changeEnumValue
(
PLANTTYPE
,
plantType
),
plantType
:
changeEnumValue
(
PLANTTYPE
,
plantType
),
dIdList
:
didStr
,
dIdList
:
didStr
,
...
...
src/biz/dataInt.ts
View file @
065d5b49
This diff is collapsed.
Click to expand it.
src/biz/dataOut.ts
View file @
065d5b49
...
@@ -3,10 +3,10 @@
...
@@ -3,10 +3,10 @@
*/
*/
import
moment
=
require
(
"moment"
);
import
moment
=
require
(
"moment"
);
import
{
LIANGSHI
,
NONGZITYPE
,
PLANTTYPE
,
PLOTTYPE
}
from
"../config/enum"
;
import
{
LIANGSHI
,
NONGZITYPE
,
PLANTTYPE
,
PLOTTYPE
,
XIAOSHOUQUXIANG
}
from
"../config/enum"
;
import
{
diKuaiSizeCountByParam
}
from
"../data/dikuai"
;
import
{
diKuaiSizeCountByParam
}
from
"../data/dikuai"
;
import
{
statisNongZiType
,
statisNongZiTypeCountByTime
}
from
"../data/nongzi"
;
import
{
statisNongZiType
,
statisNongZiTypeCountByTime
}
from
"../data/nongzi"
;
import
{
selectToParam
,
zhongZhiTongJiCount
}
from
"../data/zhongzhi"
import
{
zhongYangTongJiCount
,
zhongZhiTongJiCount
}
from
"../data/zhongzhi"
import
*
as
nongshiData
from
"../data/nongshi"
import
*
as
nongshiData
from
"../data/nongshi"
import
*
as
xiaoshouData
from
"../data/xiaoshou"
import
*
as
xiaoshouData
from
"../data/xiaoshou"
import
{
changeEnumValue
}
from
"../util/verificationEnum"
;
import
{
changeEnumValue
}
from
"../util/verificationEnum"
;
...
@@ -179,4 +179,55 @@ export async function getDataOut() {
...
@@ -179,4 +179,55 @@ export async function getDataOut() {
}
}
export
async
function
getGuiYuOut
()
{
let
zhongZhiList
=
await
zhongYangTongJiCount
();
let
ymyzsl
=
[];
let
count
=
0
;
let
kcMap
=
{};
zhongZhiList
.
forEach
(
info
=>
{
let
{
_id
,
sizeCount
}
=
info
;
ymyzsl
.
push
({
key
:
changeEnumValue
(
PLANTTYPE
,
_id
),
value
:
`
${
sizeCount
}
万尾`
});
count
+=
sizeCount
;
if
(
!
kcMap
[
_id
])
kcMap
[
_id
]
=
0
kcMap
[
_id
]
+=
(
info
.
sizeCount
*
10000
);
});
let
scyz
=
[
{
key
:
"养殖面积"
,
value
:
'0亩'
},
{
key
:
"鱼苗养殖"
,
value
:
`
${
count
/
10000
}
亿`
},
];
let
xiaoshouList
=
await
xiaoshouData
.
selectToParam
({
plantType
:{
"$gt"
:
100
,
"$lt"
:
200
}});
let
xsjl
=
[];
xiaoshouList
.
forEach
(
info
=>
{
let
subList
=
[
changeEnumValue
(
PLANTTYPE
,
info
.
plantType
),
changeEnumValue
(
XIAOSHOUQUXIANG
,
info
.
quXiang
),
info
.
weight
,
'尾'
,
moment
(
info
.
operationTime
).
format
(
"YYYY-MM-DD"
)
];
xsjl
.
push
(
subList
);
if
(
kcMap
[
info
.
plantType
])
{
kcMap
[
info
.
plantType
]
-=
info
.
weight
;
}
});
let
kcjlData
=
[];
for
(
let
key
in
kcMap
)
{
if
(
kcMap
[
key
]
>
0
)
{
kcjlData
.
push
({
key
:
changeEnumValue
(
PLANTTYPE
,
parseInt
(
key
)),
value
:
`
${
kcMap
[
key
]}
尾`
})
}
}
return
{
kcjlData
,
scyz
,
ymyzsl
,
xsjl
};
}
src/biz/nongzi.ts
View file @
065d5b49
...
@@ -87,7 +87,7 @@ export async function nongZiList(selectStr:string, dId:string, nzType:number, us
...
@@ -87,7 +87,7 @@ export async function nongZiList(selectStr:string, dId:string, nzType:number, us
let
{
nzType
,
dIdList
,
plantType
,
count
,
useTime
}
=
item
;
let
{
nzType
,
dIdList
,
plantType
,
count
,
useTime
}
=
item
;
let
didStr
=
""
;
let
didStr
=
""
;
dIdList
.
forEach
(
dId
=>
{
dIdList
.
forEach
(
dId
=>
{
didStr
+=
`
${
diKuaiMap
[
dId
]
}
`
;
didStr
+=
`
${
diKuaiMap
[
dId
]
||
"-"
}
`
;
})
})
dataList
.
push
({
dataList
.
push
({
nzType
:
changeEnumValue
(
NONGZITYPE
,
nzType
),
nzType
:
changeEnumValue
(
NONGZITYPE
,
nzType
),
...
...
src/config/enum.ts
View file @
065d5b49
...
@@ -60,7 +60,16 @@ export enum SHUCAI {
...
@@ -60,7 +60,16 @@ export enum SHUCAI {
鸡毛菜
,
鸡毛菜
,
番茄
,
番茄
,
牛心菜
,
牛心菜
,
茼蒿
茼蒿
,
红米苋
,
青米苋
,
紫青菜
,
冬瓜
,
南瓜
,
红薯叶
,
樱桃萝卜
,
菠菜
,
豆苗
}
}
...
@@ -83,7 +92,12 @@ export enum SHUICHAN {
...
@@ -83,7 +92,12 @@ export enum SHUICHAN {
鳊鱼
,
鳊鱼
,
翘嘴鲌
,
翘嘴鲌
,
暗纹东方鲀
,
暗纹东方鲀
,
鳙鱼
鳙鱼
,
花䱻
,
长吻鮠
,
花鲢
,
细鳞鲴
,
白鲢
}
}
...
@@ -138,6 +152,15 @@ export enum PLANTTYPE {
...
@@ -138,6 +152,15 @@ export enum PLANTTYPE {
番茄
,
番茄
,
牛心菜
,
牛心菜
,
茼蒿
,
茼蒿
,
红米苋
,
青米苋
,
紫青菜
,
冬瓜
,
南瓜
,
红薯叶
,
樱桃萝卜
,
菠菜
,
豆苗
,
鲈鱼
=
101
,
鲈鱼
=
101
,
鳜鱼
,
鳜鱼
,
鲢鱼
,
鲢鱼
,
...
@@ -153,6 +176,11 @@ export enum PLANTTYPE {
...
@@ -153,6 +176,11 @@ export enum PLANTTYPE {
翘嘴鲌
,
翘嘴鲌
,
暗纹东方鲀
,
暗纹东方鲀
,
鳙鱼
,
鳙鱼
,
花䱻
,
长吻鮠
,
花鲢
,
细鳞鲴
,
白鲢
,
水稻
=
201
,
水稻
=
201
,
蚕豆
=
202
,
蚕豆
=
202
,
鲜切花
=
301
,
鲜切花
=
301
,
...
@@ -206,4 +234,5 @@ export enum NONGSHITYPE {
...
@@ -206,4 +234,5 @@ export enum NONGSHITYPE {
export
enum
XIAOSHOUQUXIANG
{
export
enum
XIAOSHOUQUXIANG
{
田头销售
=
1
,
田头销售
=
1
,
本地
}
}
\ No newline at end of file
src/data/caishou.ts
View file @
065d5b49
...
@@ -47,6 +47,10 @@ export async function selectToParam(param) {
...
@@ -47,6 +47,10 @@ export async function selectToParam(param) {
return
await
caishouModel
.
find
(
param
);
return
await
caishouModel
.
find
(
param
);
}
}
export
async
function
addManyData
(
param
)
{
return
await
caishouModel
.
insertMany
(
param
);
}
export
async
function
selectChanLiangOfMonth
()
{
export
async
function
selectChanLiangOfMonth
()
{
return
await
caishouModel
.
aggregate
([
return
await
caishouModel
.
aggregate
([
...
...
src/data/zhongzhi.ts
View file @
065d5b49
...
@@ -5,6 +5,7 @@
...
@@ -5,6 +5,7 @@
import
{
Schema
}
from
'mongoose'
;
import
{
Schema
}
from
'mongoose'
;
import
{
baseDB
}
from
'../db/dbInit'
;
import
{
baseDB
}
from
'../db/dbInit'
;
import
{
PLANTTYPE
}
from
'../config/enum'
;
const
zhongzhiSchema
=
new
Schema
({
const
zhongzhiSchema
=
new
Schema
({
zId
:{
type
:
String
,
index
:
true
},
//
zId
:{
type
:
String
,
index
:
true
},
//
...
@@ -89,3 +90,18 @@ export async function zhongZhiTongJiCount() {
...
@@ -89,3 +90,18 @@ export async function zhongZhiTongJiCount() {
return
list
;
return
list
;
}
}
export
async
function
zhongYangTongJiCount
()
{
let
list
=
await
zhongzhiModel
.
aggregate
([
{
$match
:
{
plantType
:{
"$gt"
:
100
,
"$lt"
:
200
}
}
},
{
"$group"
:{
_id
:
"$plantType"
,
sizeCount
:{
"$sum"
:
"$size"
}
}
}
]);
return
list
;
}
src/db/mysqlInit.ts
View file @
065d5b49
...
@@ -4,21 +4,21 @@ const Sequelize = require('sequelize');
...
@@ -4,21 +4,21 @@ const Sequelize = require('sequelize');
var
mysqlDB
;
var
mysqlDB
;
export
async
function
initMysqlDB
()
{
export
async
function
initMysqlDB
()
{
mysqlDB
=
new
Sequelize
(
systemConfig
.
mysqldb
.
dataBase
,
systemConfig
.
mysqldb
.
user
,
systemConfig
.
mysqldb
.
pwd
,{
//
mysqlDB = new Sequelize(systemConfig.mysqldb.dataBase,systemConfig.mysqldb.user,systemConfig.mysqldb.pwd,{
host
:
systemConfig
.
mysqldb
.
host
,
//
host:systemConfig.mysqldb.host,
port
:
systemConfig
.
mysqldb
.
port
,
//
port:systemConfig.mysqldb.port,
dialect
:
'mysql'
,
//数据库类型
//
dialect:'mysql', //数据库类型
pool
:{
//数据库连接池
//
pool:{ //数据库连接池
max
:
20
,
//最大连接对象的个数
//
max:20, //最大连接对象的个数
min
:
5
,
//最小连接对象的个数
//
min:5, //最小连接对象的个数
idle
:
1000
//最长等待时间,单位为毫秒
//
idle:1000 //最长等待时间,单位为毫秒
},
//
},
timezone
:
'+08:00'
,
//东八时区
//
timezone: '+08:00', //东八时区
dialectOptions
:
{
//
dialectOptions: {
dateStrings
:
true
,
//
dateStrings: true,
typeCast
:
true
//
typeCast: true
},
//
},
});
//
});
}
}
export
{
mysqlDB
};
export
{
mysqlDB
};
\ No newline at end of file
src/main.ts
View file @
065d5b49
...
@@ -2,8 +2,8 @@
...
@@ -2,8 +2,8 @@
import
{
initConfig
,
systemConfig
}
from
"./config/serverConfig"
;
import
{
initConfig
,
systemConfig
}
from
"./config/serverConfig"
;
import
{
httpServer
}
from
"./net/http_server"
;
import
{
httpServer
}
from
"./net/http_server"
;
import
{
initDB
}
from
"./db/dbInit"
;
import
{
initDB
}
from
"./db/dbInit"
;
import
{
dataInit
}
from
"./biz/dataInt"
;
import
{
dataInit
,
dataInit0508
,
yjDataInit0508
}
from
"./biz/dataInt"
;
import
{
get
Data
Out
}
from
"./biz/dataOut"
;
import
{
get
GuiYu
Out
}
from
"./biz/dataOut"
;
async
function
lanuch
()
{
async
function
lanuch
()
{
/**初始化配置解析 */
/**初始化配置解析 */
...
@@ -15,9 +15,9 @@ async function lanuch() {
...
@@ -15,9 +15,9 @@ async function lanuch() {
console
.
log
(
'This indicates that the server is started successfully.'
);
console
.
log
(
'This indicates that the server is started successfully.'
);
// await dataInit();
// await dataInit();
// await dataInit0508();
// await yjDataInit0508();
}
}
lanuch
();
lanuch
();
\ No newline at end of file
src/routers/public.ts
View file @
065d5b49
...
@@ -5,18 +5,18 @@ import * as asyncHandler from 'express-async-handler';
...
@@ -5,18 +5,18 @@ import * as asyncHandler from 'express-async-handler';
import
*
as
enumConfig
from
'../config/enum'
;
import
*
as
enumConfig
from
'../config/enum'
;
const
config
=
{
const
config
=
{
"/zj/xcx/public/plottype"
:
enumConfig
.
PLOTTYPE
,
//地块类型
"/zj
nt
/xcx/public/plottype"
:
enumConfig
.
PLOTTYPE
,
//地块类型
"/zj/xcx/public/purpose"
:
enumConfig
.
PURPOSE
,
//用途
"/zj
nt
/xcx/public/purpose"
:
enumConfig
.
PURPOSE
,
//用途
"/zj/xcx/public/planttype"
:
enumConfig
.
PLANTTYPE
,
//种植种类
"/zj
nt
/xcx/public/planttype"
:
enumConfig
.
PLANTTYPE
,
//种植种类
"/zj/xcx/public/arearange"
:
enumConfig
.
AREARANGE
,
//面积范围
"/zj
nt
/xcx/public/arearange"
:
enumConfig
.
AREARANGE
,
//面积范围
"/zj/xcx/public/nongzitype"
:
enumConfig
.
NONGZITYPE
,
//农资类型
"/zj
nt
/xcx/public/nongzitype"
:
enumConfig
.
NONGZITYPE
,
//农资类型
"/zj/xcx/public/nongshitype"
:
enumConfig
.
NONGSHITYPE
,
//农事类型
"/zj
nt
/xcx/public/nongshitype"
:
enumConfig
.
NONGSHITYPE
,
//农事类型
"/zj/xcx/public/zhongyangtype"
:
enumConfig
.
ZHONGYANGTYPE
,
//种养类型
"/zj
nt
/xcx/public/zhongyangtype"
:
enumConfig
.
ZHONGYANGTYPE
,
//种养类型
"/zj/xcx/public/zhongyangtype/shuichan"
:
enumConfig
.
SHUICHAN
,
//水产
"/zj
nt
/xcx/public/zhongyangtype/shuichan"
:
enumConfig
.
SHUICHAN
,
//水产
"/zj/xcx/public/zhongyangtype/huahui"
:
enumConfig
.
HUAHUITYPE
,
//花卉
"/zj
nt
/xcx/public/zhongyangtype/huahui"
:
enumConfig
.
HUAHUITYPE
,
//花卉
"/zj/xcx/public/zhongyangtype/liangshi"
:
enumConfig
.
LIANGSHI
,
//粮食
"/zj
nt
/xcx/public/zhongyangtype/liangshi"
:
enumConfig
.
LIANGSHI
,
//粮食
"/zj/xcx/public/zhongyangtype/shucai"
:
enumConfig
.
SHUCAI
,
//蔬菜
"/zj
nt
/xcx/public/zhongyangtype/shucai"
:
enumConfig
.
SHUCAI
,
//蔬菜
"/zj/xcx/public/xiaoshouquxiang"
:
enumConfig
.
XIAOSHOUQUXIANG
,
//销售去向
"/zj
nt
/xcx/public/xiaoshouquxiang"
:
enumConfig
.
XIAOSHOUQUXIANG
,
//销售去向
}
}
...
...
src/routers/router.ts
View file @
065d5b49
...
@@ -54,7 +54,8 @@ export function setRouter(httpServer){
...
@@ -54,7 +54,8 @@ export function setRouter(httpServer){
httpServer
.
post
(
'/zjnt/xcx/user/login'
,
asyncHandler
(
user_login
));
//登录
httpServer
.
post
(
'/zjnt/xcx/user/login'
,
asyncHandler
(
user_login
));
//登录
httpServer
.
post
(
'/zjnt/xcx/user/logout'
,
checkUserToken
,
asyncHandler
(
user_logout
));
//登出
httpServer
.
post
(
'/zjnt/xcx/user/logout'
,
checkUserToken
,
asyncHandler
(
user_logout
));
//登出
httpServer
.
post
(
'/zjnt/xcx/dataout/zzzmj'
,
asyncHandler
(
data_out
));
//登录
httpServer
.
post
(
'/zjnt/xcx/dataout/zzzmj'
,
asyncHandler
(
data_out
));
//
httpServer
.
post
(
'/zjnt/xcx/dataout/guiyu'
,
asyncHandler
(
data_out_guiyu
));
//
...
@@ -67,6 +68,10 @@ async function data_out(req, res) {
...
@@ -67,6 +68,10 @@ async function data_out(req, res) {
res
.
success
(
result
);
res
.
success
(
result
);
}
}
async
function
data_out_guiyu
(
req
,
res
)
{
let
result
=
await
dataOutBiz
.
getGuiYuOut
();
res
.
success
(
result
);
}
/**================================================================首页 */
/**================================================================首页 */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment