Commit b7e9d031 by lixinming

no message

parent a79ab03d
...@@ -8,10 +8,11 @@ ...@@ -8,10 +8,11 @@
import { FinancingParamConfig } from "../../config/checkParamConfig"; import { FinancingParamConfig } from "../../config/checkParamConfig";
import { ERRORENUM } from "../../config/errorEnum"; import { ERRORENUM } from "../../config/errorEnum";
import { EnterpriseFinancingInfoConfig } from "../../config/ojbectResultKeyConfig"; import { EnterpriseFinancingInfoConfig } from "../../config/ojbectResultKeyConfig";
import { createFinancing, deleteEnterpriseFinancing, findAddByName, findEnterpriseFinancingByUscc, findFinancingByName, findFinancingCount, findFinancingInfoByTaskIdAndSucc, findFinancingList, groupFindFinancing } from "../../data/enterprise/financing"; import { createFinancing, deleteEnterpriseFinancing, findAddByName, findEnterpriseFinancingByUscc, findFinancingCount, findFinancingInfoByTaskIdAndSucc, findFinancingList, groupFindFinancing } from "../../data/enterprise/financing";
import { FinancingListConfig } from "../../config/ojbectResultKeyConfig"; import { FinancingListConfig } from "../../config/ojbectResultKeyConfig";
import { BizError } from "../../util/bizError"; import { BizError } from "../../util/bizError";
import { checkChange, checkParamater, extractData, getTaskId } from "../../util/tools"; import { checkChange, checkParamater, extractData, getTaskId } from "../../util/tools";
import { findEnterpriseInfoByName, findEnterpriseListByFuHuaQiUsccName } from "../../data/enterprise/enterprise";
/** /**
...@@ -25,6 +26,11 @@ export async function createFinancingInfo(uscc, param) { ...@@ -25,6 +26,11 @@ export async function createFinancingInfo(uscc, param) {
checkParamater("录入企业融资信息", FinancingParamConfig, param); checkParamater("录入企业融资信息", FinancingParamConfig, param);
let enterpriseInfo = await findEnterpriseInfoByName(param.name);
if (!enterpriseInfo) throw new BizError(ERRORENUM.该企业不存在, uscc, param.name);
param.uscc = enterpriseInfo.uscc;
let dataBaseInfo = await findFinancingInfoByTaskIdAndSucc(TaskId, param.uscc); let dataBaseInfo = await findFinancingInfoByTaskIdAndSucc(TaskId, param.uscc);
if ( dataBaseInfo&& dataBaseInfo.uscc) throw new BizError(ERRORENUM.该企业当月数据已存在, `${param.uscc}的融资信息已经存在`); if ( dataBaseInfo&& dataBaseInfo.uscc) throw new BizError(ERRORENUM.该企业当月数据已存在, `${param.uscc}的融资信息已经存在`);
...@@ -90,32 +96,25 @@ export async function deleteEnterpriseFinancingByUscc(fuHuaQiUscc:string, uscc:s ...@@ -90,32 +96,25 @@ export async function deleteEnterpriseFinancingByUscc(fuHuaQiUscc:string, uscc:s
return {isSuccess:true}; return {isSuccess:true};
} }
/** /**
* 融资企业名称模糊查询 * 融资企业名称模糊查询
* @param name 融资企业名称 *
*/ */
export async function getFinancingByName(name:string) { export async function getFinancingByName(uscc:string) {
let financingInfo = await findFinancingByName(name); let financingInfo = await findEnterpriseListByFuHuaQiUsccName(uscc);
let dataList = []; let dataList = [];
financingInfo.forEach( info => { financingInfo.forEach( info => {
dataList.push(info.name); dataList.push({
name:info.name,
logonAdd:info.logonAdd,
operatingAdd:info.operatingAdd
});
}); });
return dataList; return dataList;
} }
/**
* 根据融资企业名称获取注册地址、经营地址
* @param name
*/
export async function getAddByName(name:string) {
let financingInfo = await findAddByName(name);
let dataList = [];
let keyList = ["logonAdd", "operatingAdd"];
keyList.forEach( key => {
dataList[key] = financingInfo[key];
})
return dataList;
}
/** /**
* 融资企业信息列表 * 融资企业信息列表
......
...@@ -8,8 +8,9 @@ import { BizError } from "../../util/bizError"; ...@@ -8,8 +8,9 @@ import { BizError } from "../../util/bizError";
import * as monthData from "../../data/fuHuaQi/monthTable"; import * as monthData from "../../data/fuHuaQi/monthTable";
import { extractData, getTaskId } from "../../util/tools"; import { extractData, getTaskId } from "../../util/tools";
import moment = require("moment"); import moment = require("moment");
import { findAllFuHuaQiOperationNameMap, getFuHuaQiCreateDataTimeMap } from "../../data/fuHuaQi/fuhuaqi"; import { findAllFuHuaQiOperationNameMap } from "../../data/fuHuaQi/fuhuaqi";
import { MonthListConfig } from "../../config/ojbectResultKeyConfig"; import { MonthListConfig } from "../../config/ojbectResultKeyConfig";
import { TASKTYPEENUM } from "../../config/enum";
/** /**
* 新添加孵化器月度填报 * 新添加孵化器月度填报
...@@ -76,37 +77,8 @@ export async function monthTableList(state:number, year:number, month:number, pa ...@@ -76,37 +77,8 @@ export async function monthTableList(state:number, year:number, month:number, pa
if (year) selectParam.year = year; if (year) selectParam.year = year;
if (month) selectParam.month = month; if (month) selectParam.month = month;
if (state == 1) { // findTaskListByType(TASKTYPEENUM.孵化器月度填报);
let {dataList, count} = await getCompleted(selectParam, page);
return {dataList, count};
} else if (state == 2) {
} else {
let {dataList, count} = await getCompleted(selectParam, page);
/**组合未填报 */
}
// let 需要组合未填报数 = 10 - dataList.length;
// return {count, dataList};
}
async function getNotCompleted(year, month) {
/** 算总数 */
getFuHuaQiCreateDataTimeMap();
}
/**
* 获取已填报数据
* @param selectParam
* @param page
* @returns
*/
async function getCompleted(selectParam, page) {
let dataBaseList = await monthData.findMonthTableList(selectParam, (page-1)*10 ); let dataBaseList = await monthData.findMonthTableList(selectParam, (page-1)*10 );
let count = await monthData.findMonthTableListCount(selectParam); let count = await monthData.findMonthTableListCount(selectParam);
...@@ -122,10 +94,16 @@ async function getCompleted(selectParam, page) { ...@@ -122,10 +94,16 @@ async function getCompleted(selectParam, page) {
}; };
dataList.push(onceInfo); dataList.push(onceInfo);
}); });
//==
return {count, dataList} return {count, dataList}
} }
/** /**
* 根据uscc查询任务信息 * 根据uscc查询任务信息
* @param uscc 企业统一信用代码 * @param uscc 企业统一信用代码
......
...@@ -11,7 +11,7 @@ import { findEnterpriseListByTaskId, updateEnterpriseDraftLock } from "../../dat ...@@ -11,7 +11,7 @@ import { findEnterpriseListByTaskId, updateEnterpriseDraftLock } from "../../dat
import { findFinancingListByTaskId, updateFinancingDraftLock } from "../../data/enterprise/financing"; import { findFinancingListByTaskId, updateFinancingDraftLock } from "../../data/enterprise/financing";
import { findAllFuHuaQi } from "../../data/fuHuaQi/fuhuaqi"; import { findAllFuHuaQi } from "../../data/fuHuaQi/fuhuaqi";
import { findmonthTableByTaskId, findmonthTableListByTaskId } from "../../data/fuHuaQi/monthTable"; import { findmonthTableByTaskId, findmonthTableListByTaskId } from "../../data/fuHuaQi/monthTable";
import { findEnterpriseByTaskIdAndType, createTaskToList, findFuHuaQiTaskByTaskId, findTaskByTaskId, findTaskCountByKey } from "../../data/fuHuaQi/task"; import { findEnterpriseByTaskIdAndType, createTaskToList, findFuHuaQiTaskByTaskId, findTaskCountByKey } from "../../data/fuHuaQi/task";
import { BizError } from "../../util/bizError"; import { BizError } from "../../util/bizError";
import { logConsole, logHandle } from "../../util/log"; import { logConsole, logHandle } from "../../util/log";
import { extractData, getTaskId, getTimeKey } from "../../util/tools"; import { extractData, getTaskId, getTimeKey } from "../../util/tools";
......
...@@ -18,7 +18,8 @@ export enum ERRORENUM { ...@@ -18,7 +18,8 @@ export enum ERRORENUM {
密码长度不能超过24个字符, 密码长度不能超过24个字符,
账号不存在, 账号不存在,
已入库的企业不能删除, 已入库的企业不能删除,
任务不存在 任务不存在,
该企业不存在
} }
export enum ERRORCODEENUM { export enum ERRORCODEENUM {
......
...@@ -138,3 +138,23 @@ export async function deleteEnterprise(uscc:string) { ...@@ -138,3 +138,23 @@ export async function deleteEnterprise(uscc:string) {
export async function findEnterpriseCount(selectParam) { export async function findEnterpriseCount(selectParam) {
return await enterpriseModel.find(selectParam).count(); return await enterpriseModel.find(selectParam).count();
} }
/**
* 通过企业名称获取企业信息
* @param selectParam 查询参数
* @returns number 数据数量
*/
export async function findEnterpriseInfoByName(name:string) {
return await enterpriseModel.findOne({name});
}
/**
* todo 注释后加
* @param selectParam 查询参数
* @returns number 数据数量
*/
export async function findEnterpriseListByFuHuaQiUsccName(fuHuaQiUscc:string) {
return await enterpriseModel.find({fuHuaQiUscc});
}
...@@ -101,15 +101,6 @@ export async function deleteEnterpriseFinancing(uscc:string, taskId:string) { ...@@ -101,15 +101,6 @@ export async function deleteEnterpriseFinancing(uscc:string, taskId:string) {
/** /**
* 融资企业名称模糊查询
* @param name 融资企业名称
* @returns
*/
export async function findFinancingByName(name:string) {
return await financingModel.find({name:"/"+name+"/"});
}
/**
* 根据融资企业名称获取融资数据 * 根据融资企业名称获取融资数据
* @param name * @param name
* @returns * @returns
...@@ -162,18 +153,4 @@ export async function findEnterpriseFinancingByUscc(uscc:string, taskId:string) ...@@ -162,18 +153,4 @@ export async function findEnterpriseFinancingByUscc(uscc:string, taskId:string)
*/ */
export async function findFinancingCount(selectParam) { export async function findFinancingCount(selectParam) {
return await financingModel.find(selectParam).count(); return await financingModel.find(selectParam).count();
}
export async function superSelect(selectParam) {
await financingModel.aggregate([
{
'$lookup':{
from:'enterprise',
localField:''
}
}
]);
} }
\ No newline at end of file
...@@ -135,20 +135,6 @@ export async function findAllFuHuaQiOperationNameMap() { ...@@ -135,20 +135,6 @@ export async function findAllFuHuaQiOperationNameMap() {
/** /**
* 获取所有企业创建时间
* @returns {} key:企业统一信用代码
*/
export async function getFuHuaQiCreateDataTimeMap() {
let list = await fuHuaQiModel.find({});
let result = {};
list.forEach(info => {
result[info.uscc] = info.createTime;
});
return result;
}
/**
* 聚合查询 孵化器所拥有的企业数量 * 聚合查询 孵化器所拥有的企业数量
* @returns {} key=孵化器统一信用 value=企业数量 * @returns {} key=孵化器统一信用 value=企业数量
*/ */
......
...@@ -78,14 +78,11 @@ export async function createTaskToList(taskList:object) { ...@@ -78,14 +78,11 @@ export async function createTaskToList(taskList:object) {
await fuHuaQiTaskModel.insertMany(taskList); await fuHuaQiTaskModel.insertMany(taskList);
} }
export async function findTaskListByType(taskType:number ) {
/** let taskList = await fuHuaQiTaskModel.find({taskType});
* 通过任务id获取任务信息 let map = {};
* 支持.save方法保存对象修改 taskList.forEach(info => {
* @param taskId 任务id map[info.taskId] = info.isSubmit
* @returns {} });
*/ return map;
export async function findTaskByTaskId(taskId:string) { }
return await fuHuaQiTaskModel.selectOnceData({taskId}); \ No newline at end of file
}
...@@ -35,7 +35,6 @@ export function setRouter(httpServer) { ...@@ -35,7 +35,6 @@ export function setRouter(httpServer) {
httpServer.post('/fuhuaqi/financing/select', checkFuHuaQiToken, asyncHandler(selectFinancingInfo)); httpServer.post('/fuhuaqi/financing/select', checkFuHuaQiToken, asyncHandler(selectFinancingInfo));
httpServer.post('/fuhuaqi/financing/delete', checkFuHuaQiToken, asyncHandler(delFinancingInfo)); httpServer.post('/fuhuaqi/financing/delete', checkFuHuaQiToken, asyncHandler(delFinancingInfo));
httpServer.post('/admin/financing/namelist', asyncHandler(getFinancingInfoByName)); httpServer.post('/admin/financing/namelist', asyncHandler(getFinancingInfoByName));
httpServer.post('/admin/financing/add', asyncHandler(getAddInfoByName));
/**新注册或迁入企业 */ /**新注册或迁入企业 */
httpServer.post('/fuhuaqi/enterprise/register', checkFuHuaQiToken, asyncHandler(registerEnterprise)); httpServer.post('/fuhuaqi/enterprise/register', checkFuHuaQiToken, asyncHandler(registerEnterprise));
...@@ -170,26 +169,9 @@ async function delFinancingInfo(req, res) { ...@@ -170,26 +169,9 @@ async function delFinancingInfo(req, res) {
* @param res * @param res
*/ */
async function getFinancingInfoByName(req, res) { async function getFinancingInfoByName(req, res) {
let reqConf = {name: 'String' };
let { name } = checkReqParam(reqConf, req.body);
const Uscc = req.headers.uscc; const Uscc = req.headers.uscc;
let result = await financingBiz.getFinancingByName(name); let result = await financingBiz.getFinancingByName(Uscc);
res.success(result);
}
/**
* 根据融资企业名称获取注册地址和经营地址
* @param req
* @param res
*/
async function getAddInfoByName(req, res) {
let reqConf = {name: 'String' };
let { name } = checkReqParam(reqConf, req.body);
const Uscc = req.headers.uscc;
let result = await financingBiz.getAddByName(name);
res.success(result); 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