Commit 75350878 by lixinming

no message

parent 826c3ec8
......@@ -3,7 +3,7 @@ import { TABLENAME } from "../config/dbEnum";
import { NONGSHITYPE, NONGZITYPE, PLANTTYPE, PLOTTYPE, PURPOSE, SHUCAI, XIAOSHOUQUXIANG } from "../config/enum";
import * as dikuaiData from "../data/dikuai";
import * as usersData from "../data/users";
import { getPwdMd5, md5PwdStr, randomId } from "../tools/system";
import { getDraftId, getPwdMd5, md5PwdStr, randomId } from "../tools/system";
import { onceSheetBecomeOfblockData } from "../util/analysisExcel";
import { info } from "console";
import * as zhongzhiData from "../data/zhongzhi";
......@@ -1698,7 +1698,7 @@ export async function dataInit0618() {
校验面积Map[info.code] = info.size;
});
let filePath = path.join(__dirname.substring(0,__dirname.indexOf("out")), "res", "导入数据0618.xlsx" );
let filePath = path.join(__dirname.substring(0,__dirname.indexOf("out")), "res", "导入数据0618.xlsx" );
let {sheetMap} = getExcel(filePath);
let 种植 = sheetMap["种植"];
let 采收 = sheetMap["采收"];
......@@ -1929,3 +1929,83 @@ export async function dataInit0618() {
console.log("数据导入成功");
}
export async function dataInit0816() {
let Now = new Date().valueOf();
let diKuaiList = await dikuaiData.selectToParam({});
let 校验面积Map = {};
let diKuaiMap = {}
diKuaiList.forEach(info => {
diKuaiMap[info.name] = info.dId;
校验面积Map[info.code] = info.size;
});
let filePath = path.join(__dirname.substring(0,__dirname.indexOf("out")), "res", "导入数据0816.xlsx" );
let {sheetMap} = getExcel(filePath);
let 采收 = sheetMap["采收"];
let caiShouList = [];
采收.forEach((subList, index) => {
if (!index) {
return
}
let name = subList[0];
let dk = subList[2];
let weight = subList[3];
let time = subList[5];
let ms = new Date(time).valueOf();
if (!PLANTTYPE[name]) console.log(name, "名称不在枚举范围")
if (!diKuaiMap[dk])return
let csId = randomId("cs");
let dIdList = [diKuaiMap[dk]];
caiShouList.push({csId, dIdList, weight:parseFloat(weight), code:dk, dId:diKuaiMap[dk], plantType:PLANTTYPE[name], createUser:"admin", ct:ms });
});
let addCaiShouList = [];
for (let i= 0; i < caiShouList.length; i++) {
let {code, plantType} = caiShouList[i];
// if (!校验种养map[`${code}_${plantType}`]) {
// console.log(code, "种类:", changeEnumValue(SHUCAI, plantType) ,"无效");
// notChangeCaiShouList.push(caiShouList[i]);
// }
// else {
// addCaiShouList.push(caiShouList[i]);
// 映射Map[`${code}_${plantType}`] = 校验种养map[`${code}_${plantType}`];
// }
await caishouData.addData(caiShouList[i]);
}
console.log("数据导入成功");
}
export async function dataInit0817() {
let addList = [
{csId:randomId(TABLENAME.采收),dIdList:["f4bb9433b1c3cfaea7b0adcf1dde97bf"], plantType:PLANTTYPE.鳜鱼, weight:50, ct:new Date("2025-05-04").valueOf(), createUser:"admin"},
{csId:randomId(TABLENAME.采收),dIdList:["674e14b48d26cfff1c204fa52ef06e5b"], plantType:PLANTTYPE.花䱻, weight:50, ct:new Date("2025-05-08").valueOf(), createUser:"admin"},
{csId:randomId(TABLENAME.采收),dIdList:["d22ae98272f334308358aebf2f857926"], plantType:PLANTTYPE.黄颡鱼, weight:50, ct:new Date("2025-05-16").valueOf(), createUser:"admin"},
{csId:randomId(TABLENAME.采收),dIdList:["2f50547ce2f338f6266ddfaa052b7d70"], plantType:PLANTTYPE.长吻鮠, weight:30, ct:new Date("2025-05-20").valueOf(), createUser:"admin"},
{csId:randomId(TABLENAME.采收),dIdList:["d22ae98272f334308358aebf2f857926"], plantType:PLANTTYPE.翘嘴鲌, weight:100, ct:new Date("2025-05-10").valueOf(), createUser:"admin"},
{csId:randomId(TABLENAME.采收),dIdList:["327b4c896b727f2cc07fdb8f65318f8c"], plantType:PLANTTYPE.草鱼, weight:5000, ct:new Date("2025-05-17").valueOf(), createUser:"admin"},
{csId:randomId(TABLENAME.采收),dIdList:["d2245f515ece4076d3e42e5ad933775e"], plantType:PLANTTYPE.白鲢, weight:1000, ct:new Date("2025-05-11").valueOf(), createUser:"admin"},
{csId:randomId(TABLENAME.采收),dIdList:["d2245f515ece4076d3e42e5ad933775e"], plantType:PLANTTYPE.花鲢, weight:1000, ct:new Date("2025-05-12").valueOf(), createUser:"admin"},
{csId:randomId(TABLENAME.采收),dIdList:["0f5fec160be9b7fd6524c796ba050777"], plantType:PLANTTYPE.鲤鱼, weight:5000, ct:new Date("2025-04-25").valueOf(), createUser:"admin"},
{csId:randomId(TABLENAME.采收),dIdList:["21b6ce0a70754002891f6b8f179b4852"], plantType:PLANTTYPE.胭脂鱼, weight:10, ct:new Date("2025-05-11").valueOf(), createUser:"admin"},
{csId:randomId(TABLENAME.采收),dIdList:["c1d82c2abc5f9336fed3f42cb26ea871"], plantType:PLANTTYPE.鳊鱼, weight:5000, ct:new Date("2025-05-02").valueOf(), createUser:"admin"},
{csId:randomId(TABLENAME.采收),dIdList:["d2245f515ece4076d3e42e5ad933775e"], plantType:PLANTTYPE.细鳞鯝, weight:70, ct:new Date("2025-05-11").valueOf(), createUser:"admin"},
{csId:randomId(TABLENAME.采收),dIdList:["0f5fec160be9b7fd6524c796ba050777"], plantType:PLANTTYPE.青鱼, weight:10, ct:new Date("2025-05-14").valueOf(), createUser:"admin"},
{csId:randomId(TABLENAME.采收),dIdList:["b6a1a870c4c3d41aab0c6ed0107b5da6"], plantType:PLANTTYPE.黄瓜, weight:6000, ct:new Date("2025-07-27").valueOf(), createUser:"admin"},
];
await caishouData.addManyData(addList);
console.log("数据导入成功");
}
\ No newline at end of file
......@@ -150,6 +150,7 @@ export async function getDataOut() {
let key = getKey(ct)
if (!作物产量Map[key]) 作物产量Map[key] = 0;
作物产量Map[key] += weight;
});
let 今年 = [];
......
......@@ -119,6 +119,7 @@ export async function diKuaiList(plotType:number, selectStr:string, code:string,
* @param purpose
* @param area
* @returns
*
*/
export async function diKuaiListToPage(pageNumber) {
......@@ -126,7 +127,9 @@ export async function diKuaiListToPage(pageNumber) {
let dataList = [];
diKuaiList.forEach(item => {
let { size, dId, purpose, code, area, ct } = item;
dataList.push({size,dId,type:changeEnumValue(PURPOSE, purpose),code,area,ct});
dataList.push({size,dId,type:changeEnumValue(PURPOSE, purpose),code,area,
});
});
return {dataList}
......
......@@ -2,7 +2,7 @@
import { initConfig, systemConfig } from "./config/serverConfig";
import { httpServer } from "./net/http_server";
import { initDB } from "./db/dbInit";
import { dataInit0516, dataInit, dataInit0508, yjDataInit0508, dataInit0522, dataInit0604, dataInit0609, dataInit0618 } from "./biz/dataInt";
import { dataInit0516, dataInit, dataInit0508, yjDataInit0508, dataInit0522, dataInit0604, dataInit0609, dataInit0618, dataInit0817 } from "./biz/dataInt";
import { getDataOut, getGuiYuOut } from "./biz/dataOut";
import { homePageStatisChanLiang } from "./biz/user";
import { getPwdMd5, md5PwdStr } from "./tools/system";
......@@ -27,6 +27,7 @@ async function lanuch() {
// await dataInit0522();
// await dataInit0604();
// await dataInit0618();
await dataInit0817();
let checkPwd = getPwdMd5("18120935727", md5PwdStr("123456"))
console.log();
......
......@@ -103,7 +103,7 @@ async function dikuai_info(req, res) {
res.success(result);
}
async function dikuai_list(req, res) {
async function dikuai_list(req, res) {
let reqConf = {pageNumber:'Number'};
let { pageNumber } = eccReqParamater(reqConf, req.body);
let result = await diKuaiBiz.diKuaiListToPage(pageNumber);
......
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