Commit 065d5b49 by lixinming

no message

parent 567e1a92
...@@ -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 += `${diKuaiMap[dId]} `; didStr += `${dId} `;
}) });
dataList.push({ dataList.push({
plantType:changeEnumValue(PLANTTYPE, plantType), plantType:changeEnumValue(PLANTTYPE, plantType),
dIdList:didStr, dIdList:didStr,
......
...@@ -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};
}
...@@ -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),
......
...@@ -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
...@@ -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([
......
...@@ -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;
}
...@@ -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
...@@ -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 { getDataOut } from "./biz/dataOut"; import { getGuiYuOut } 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
...@@ -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,//地块类型 "/zjnt/xcx/public/plottype":enumConfig.PLOTTYPE,//地块类型
"/zj/xcx/public/purpose":enumConfig.PURPOSE,//用途 "/zjnt/xcx/public/purpose":enumConfig.PURPOSE,//用途
"/zj/xcx/public/planttype":enumConfig.PLANTTYPE,//种植种类 "/zjnt/xcx/public/planttype":enumConfig.PLANTTYPE,//种植种类
"/zj/xcx/public/arearange":enumConfig.AREARANGE,//面积范围 "/zjnt/xcx/public/arearange":enumConfig.AREARANGE,//面积范围
"/zj/xcx/public/nongzitype":enumConfig.NONGZITYPE,//农资类型 "/zjnt/xcx/public/nongzitype":enumConfig.NONGZITYPE,//农资类型
"/zj/xcx/public/nongshitype":enumConfig.NONGSHITYPE,//农事类型 "/zjnt/xcx/public/nongshitype":enumConfig.NONGSHITYPE,//农事类型
"/zj/xcx/public/zhongyangtype":enumConfig.ZHONGYANGTYPE,//种养类型 "/zjnt/xcx/public/zhongyangtype":enumConfig.ZHONGYANGTYPE,//种养类型
"/zj/xcx/public/zhongyangtype/shuichan":enumConfig.SHUICHAN,//水产 "/zjnt/xcx/public/zhongyangtype/shuichan":enumConfig.SHUICHAN,//水产
"/zj/xcx/public/zhongyangtype/huahui":enumConfig.HUAHUITYPE,//花卉 "/zjnt/xcx/public/zhongyangtype/huahui":enumConfig.HUAHUITYPE,//花卉
"/zj/xcx/public/zhongyangtype/liangshi":enumConfig.LIANGSHI,//粮食 "/zjnt/xcx/public/zhongyangtype/liangshi":enumConfig.LIANGSHI,//粮食
"/zj/xcx/public/zhongyangtype/shucai":enumConfig.SHUCAI,//蔬菜 "/zjnt/xcx/public/zhongyangtype/shucai":enumConfig.SHUCAI,//蔬菜
"/zj/xcx/public/xiaoshouquxiang":enumConfig.XIAOSHOUQUXIANG,//销售去向 "/zjnt/xcx/public/xiaoshouquxiang":enumConfig.XIAOSHOUQUXIANG,//销售去向
} }
......
...@@ -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);
}
/**================================================================首页 */ /**================================================================首页 */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment