Commit 1a2d94e1 by lixinming

no message

parent 40726340
...@@ -12,7 +12,7 @@ import { checkChange, checkParamater, extractData, getTaskId } from "../../util/ ...@@ -12,7 +12,7 @@ import { checkChange, checkParamater, extractData, getTaskId } from "../../util/
import moment = require("moment"); import moment = require("moment");
import { createEnterprise, deleteEnterprise,findEnterpriseCount, findEnterpriseByUscc, findEnterpriseListToPage, findEnterpriseListByFuHuaQiUsccName, 查询所有已绑定过的孵化器id, findEnterpriseList } from "../../data/enterprise/enterprise"; import { createEnterprise, deleteEnterprise,findEnterpriseCount, findEnterpriseByUscc, findEnterpriseListToPage, findEnterpriseListByFuHuaQiUsccName, 查询所有已绑定过的孵化器id, findEnterpriseList } from "../../data/enterprise/enterprise";
import { EnterpriseListConfig } from "../../config/ojbectResultKeyConfig"; import { EnterpriseListConfig } from "../../config/ojbectResultKeyConfig";
import { findAllFuHuaQi, findFuHuaQiByUSCC } from "../../data/fuHuaQi/fuhuaqi"; import { findAllFuHuaQi, findAllFuHuaQiOperationNameMap, findFuHuaQiByUSCC } from "../../data/fuHuaQi/fuhuaqi";
import { OUTPUTTYPE } from "../../config/enum"; import { OUTPUTTYPE } from "../../config/enum";
...@@ -148,37 +148,42 @@ export async function deleteEnterpriseByUscc(uscc:string) { ...@@ -148,37 +148,42 @@ export async function deleteEnterpriseByUscc(uscc:string) {
/** /**
* 获取在孵企业信息列表 * 获取在孵企业信息列表
* 管理后台端 * 管理后台端
* @param time 新注册时间/迁入时间 * @param createType 新注册/迁入 1:全选 2:新注册 3:迁入 以前是时间 2/23日修改为类型
* @param fuHuaQiUscc 所属孵化器 * @param fuHuaQiUscc 所属孵化器
* @param industry 行业领域 * @param industry 行业领域
* @param isNaturalPersonHolding 自然人控股 * @param isNaturalPersonHolding 自然人控股
* @param page 页数 * @param page 页数
* @returns {dataList:[], count:0} dataList=数据列表 count:条件筛选下的数据总数 * @returns {dataList:[], count:0} dataList=数据列表 count:条件筛选下的数据总数
*/ */
export async function enterpriseList(time:string, fuHuaQiUscc:string, industry, isNaturalPersonHolding:number, page:number) { export async function enterpriseList(createType:number, fuHuaQiUscc:string, industry, isNaturalPersonHolding:number, page:number) {
let selectParam:any = {}; let selectParam:any = {};
if ( time.length > 0 ) { // if ( time.length > 0 ) {
let startT = moment(time).startOf('month').valueOf(); // let startT = moment(time).startOf('month').valueOf();
let endT = moment(time).endOf('month').valueOf(); // let endT = moment(time).endOf('month').valueOf();
selectParam['$or'] = [ // selectParam['$or'] = [
{"firstIncubationTime":{'$gt':startT, '$lt':endT}}, // {"firstIncubationTime":{'$gt':startT, '$lt':endT}},
{"timeOfImmigration":{'$gt':startT, '$lt':endT}}, // {"timeOfImmigration":{'$gt':startT, '$lt':endT}},
]; // ];
// }
// if (time) selectParam.logonTime = time; selectParam.timeOfImmigration = time;
if (createType == 2 || createType == 3) {
selectParam.createType = createType == 2 ? true : false;
} }
if (time) selectParam.logonTime = time; selectParam.timeOfImmigration = time;
if (fuHuaQiUscc) selectParam.fuHuaQiUscc = fuHuaQiUscc; if (fuHuaQiUscc) selectParam.fuHuaQiUscc = fuHuaQiUscc;
if (industry.length > 0) selectParam.industry = industry; if (industry.length > 0) selectParam.industry = industry;
if (isNaturalPersonHolding == 2 || isNaturalPersonHolding == 3) { if (isNaturalPersonHolding == 2 || isNaturalPersonHolding == 3) {
selectParam.isNaturalPersonHolding = isNaturalPersonHolding == 2 ? true : false; selectParam.isNaturalPersonHolding = isNaturalPersonHolding == 2 ? true : false;
} }
let usccMap = await findAllFuHuaQiOperationNameMap();
let dataBaseList = await findEnterpriseListToPage(selectParam, (page-1)*10 ); let dataBaseList = await findEnterpriseListToPage(selectParam, (page-1)*10 );
let count = await findEnterpriseCount(selectParam); let count = await findEnterpriseCount(selectParam);
let dataList = []; let dataList = [];
dataBaseList.forEach( info => {
let changeData = extractData(EnterpriseListConfig, info);
dataBaseList.forEach( info => {
let changeData:any = extractData(EnterpriseListConfig, info);
changeData.fuhuaqiUscc = usccMap[changeData.fuhuaqiUscc] || "";
dataList.push(changeData); dataList.push(changeData);
}); });
...@@ -189,25 +194,27 @@ export async function enterpriseList(time:string, fuHuaQiUscc:string, industry, ...@@ -189,25 +194,27 @@ export async function enterpriseList(time:string, fuHuaQiUscc:string, industry,
/** /**
* 导出在孵企业信息列表 * 导出在孵企业信息列表
* 管理后台端 * 管理后台端
* @param time 新注册时间/迁入时间 * @param createType 新注册时间/迁入时间
* @param fuHuaQiUscc 所属孵化器 * @param fuHuaQiUscc 所属孵化器
* @param industry 行业领域 * @param industry 行业领域
* @param isNaturalPersonHolding 自然人控股 * @param isNaturalPersonHolding 自然人控股
* @returns dataList * @returns dataList
*/ */
export async function outPutEnterpriseData(time:string, fuHuaQiUscc:string, industry, isNaturalPersonHolding:number, type:Number) { export async function outPutEnterpriseData(createType:number, fuHuaQiUscc:string, industry, isNaturalPersonHolding:number, type:Number) {
let selectParam:any = {}; let selectParam:any = {};
if (type == OUTPUTTYPE.当前数据) { if (type == OUTPUTTYPE.当前数据) {
if ( time.length > 0 ) { // if ( time.length > 0 ) {
let startT = moment(time).startOf('month').valueOf(); // let startT = moment(time).startOf('month').valueOf();
let endT = moment(time).endOf('month').valueOf(); // let endT = moment(time).endOf('month').valueOf();
selectParam['$or'] = [ // selectParam['$or'] = [
{"firstIncubationTime":{'$gt':startT, '$lt':endT}}, // {"firstIncubationTime":{'$gt':startT, '$lt':endT}},
{"timeOfImmigration":{'$gt':startT, '$lt':endT}}, // {"timeOfImmigration":{'$gt':startT, '$lt':endT}},
]; // ];
// }
// if (time) selectParam.logonTime = time; selectParam.timeOfImmigration = time;
if (createType == 2 || createType == 3) {
selectParam.createType = createType == 2 ? true : false;
} }
if (time) selectParam.logonTime = time; selectParam.timeOfImmigration = time;
if (fuHuaQiUscc) selectParam.fuHuaQiUscc = fuHuaQiUscc; if (fuHuaQiUscc) selectParam.fuHuaQiUscc = fuHuaQiUscc;
if (industry.length > 0) selectParam.industry = industry; if (industry.length > 0) selectParam.industry = industry;
if (isNaturalPersonHolding == 2 || isNaturalPersonHolding == 3) { if (isNaturalPersonHolding == 2 || isNaturalPersonHolding == 3) {
...@@ -216,11 +223,12 @@ export async function outPutEnterpriseData(time:string, fuHuaQiUscc:string, indu ...@@ -216,11 +223,12 @@ export async function outPutEnterpriseData(time:string, fuHuaQiUscc:string, indu
} }
let usccMap = await findAllFuHuaQiOperationNameMap();
let dataBaseList = await findEnterpriseList(selectParam ); let dataBaseList = await findEnterpriseList(selectParam );
let dataList = []; let dataList = [];
dataBaseList.forEach( info => { dataBaseList.forEach( info => {
let changeData = extractData(EnterpriseListConfig, info); let changeData:any = extractData(EnterpriseListConfig, info);
changeData.fuhuaqiUscc = usccMap[changeData.fuhuaqiUscc] || "";
dataList.push(changeData); dataList.push(changeData);
}); });
......
...@@ -25,8 +25,19 @@ import { OUTPUTTYPE } from "../../config/enum"; ...@@ -25,8 +25,19 @@ import { OUTPUTTYPE } from "../../config/enum";
* @returns {isSuccess:true/false} * @returns {isSuccess:true/false}
*/ */
export async function createFinancingInfo(uscc:string, param) { export async function createFinancingInfo(uscc:string, param) {
checkParamater("录入企业融资信息", FinancingParamConfig, param); checkParamater("录入企业融资信息", FinancingParamConfig, param, ["fuHuaQiInvestmentAmount", "fuHuaQiInvestmentStyle"]);
if (param.fuHuaQiInvestment) {
let subCheckName = "录入企业融资信息_孵化器是否参与";
let subCheckData = {
fuHuaQiInvestmentAmount:param.fuHuaQiInvestmentAmount,
fuHuaQiInvestmentStyle:param.fuHuaQiInvestmentStyle,
};
checkParamater(subCheckName, {fuHuaQiInvestmentAmount:"String", fuHuaQiInvestmentStyle:"String"}, subCheckData);
} else {
param.fuHuaQiInvestmentAmount = 0;
param.fuHuaQiInvestmentStyle = 0;
}
/**校验企业是否存在 */ /**校验企业是否存在 */
let enterpriseInfo = await findEnterpriseInfoByName(param.name); let enterpriseInfo = await findEnterpriseInfoByName(param.name);
if (!enterpriseInfo) throw new BizError(ERRORENUM.该企业不存在, uscc, param.name); if (!enterpriseInfo) throw new BizError(ERRORENUM.该企业不存在, uscc, param.name);
...@@ -54,7 +65,19 @@ export async function createFinancingInfo(uscc:string, param) { ...@@ -54,7 +65,19 @@ export async function createFinancingInfo(uscc:string, param) {
* @returns {isSuccess:true/false} * @returns {isSuccess:true/false}
*/ */
export async function updateFinancingInfo(uscc:string, param) { export async function updateFinancingInfo(uscc:string, param) {
checkParamater("更新融资企业信息", FinancingParamUpdateConfig, param); checkParamater("更新融资企业信息", FinancingParamUpdateConfig, param, ["fuHuaQiInvestmentAmount", "fuHuaQiInvestmentStyle"]);
if (param.fuHuaQiInvestment) {
let subCheckName = "录入企业融资信息_孵化器是否参与";
let subCheckData = {
fuHuaQiInvestmentAmount:param.fuHuaQiInvestmentAmount,
fuHuaQiInvestmentStyle:param.fuHuaQiInvestmentStyle,
};
checkParamater(subCheckName, {fuHuaQiInvestmentAmount:"String", fuHuaQiInvestmentStyle:"String"}, subCheckData);
} else {
param.fuHuaQiInvestmentAmount = 0;
param.fuHuaQiInvestmentStyle = 0;
}
const TaskId = getTaskId(uscc); const TaskId = getTaskId(uscc);
let dataBaseInfo = await findFinancingInfoByTaskIdAndSucc(TaskId, param.uscc); let dataBaseInfo = await findFinancingInfoByTaskIdAndSucc(TaskId, param.uscc);
......
...@@ -65,7 +65,7 @@ export async function deleteReport(uscc:string) { ...@@ -65,7 +65,7 @@ export async function deleteReport(uscc:string) {
const TaskId = getTaskId(uscc); const TaskId = getTaskId(uscc);
let dataBaseInfo = await monthData.findMonthTableByTaskId(TaskId); let dataBaseInfo = await monthData.findMonthTableByTaskId(TaskId);
if (!dataBaseInfo.isUpdate) throw new BizError(ERRORENUM.未找到数据); if (!dataBaseInfo.isUpdate) throw new BizError(ERRORENUM.未找到数据, `未找到${uscc}的月度报表`);
dataBaseInfo.isUpdate = false; //修改编辑状态 dataBaseInfo.isUpdate = false; //修改编辑状态
......
...@@ -28,7 +28,7 @@ export async function fuHuaQiTaskList(uscc:string) { ...@@ -28,7 +28,7 @@ export async function fuHuaQiTaskList(uscc:string) {
let result = []; let result = [];
const TaskId = getTaskId(uscc); const TaskId = getTaskId(uscc);
let taskMap = await findFuHuaQiTaskByTaskId(TaskId); let taskMap = await findFuHuaQiTaskByTaskId(TaskId, false);
// let taskTypeMapConf = {}; // let taskTypeMapConf = {};
for (let key in TASKTYPEENUM) { for (let key in TASKTYPEENUM) {
......
...@@ -22,7 +22,8 @@ export async function login(loginId:string, pwd:string) { ...@@ -22,7 +22,8 @@ export async function login(loginId:string, pwd:string) {
let userInfo = await findGuanWeiHuiUserInfoByLoginId(loginId); let userInfo = await findGuanWeiHuiUserInfoByLoginId(loginId);
if(!userInfo) throw new BizError(ERRORENUM.账号不存在, loginId); if(!userInfo) throw new BizError(ERRORENUM.账号不存在, loginId);
let checkPwd = getPwdMd5(userInfo.loginId, pwd); let checkPwd = getPwdMd5(userInfo.loginId, pwd);
console.log(loginId, checkPwd);//todo 后面删除
if (userInfo.pwd != checkPwd) throw new BizError(ERRORENUM.密码错误); if (userInfo.pwd != checkPwd) throw new BizError(ERRORENUM.密码错误);
const Token = getToken(loginId); const Token = getToken(loginId);
......
...@@ -65,7 +65,7 @@ export async function findEnterpriseByUscc(uscc:string) { ...@@ -65,7 +65,7 @@ export async function findEnterpriseByUscc(uscc:string) {
* @returns [{}] * @returns [{}]
*/ */
export async function findEnterpriseListByTaskId(taskId:string) { export async function findEnterpriseListByTaskId(taskId:string) {
return await enterpriseModel.find({taskId}); return await enterpriseModel.find({taskId, draftLock:false});
} }
......
...@@ -65,7 +65,7 @@ export async function findFinancingInfoByTaskIdAndSucc(taskId:string, uscc:strin ...@@ -65,7 +65,7 @@ export async function findFinancingInfoByTaskIdAndSucc(taskId:string, uscc:strin
* @returns [{}] * @returns [{}]
*/ */
export async function findFinancingListByTaskId(taskId:string) { export async function findFinancingListByTaskId(taskId:string) {
return await financingModel.find({taskId}); return await financingModel.find({taskId, draftLock:false});
} }
......
...@@ -49,7 +49,7 @@ export async function save(throwError=false) { ...@@ -49,7 +49,7 @@ export async function save(throwError=false) {
* @returns {} * @returns {}
*/ */
export async function findmonthTableListByTaskId(taskId:string) { export async function findmonthTableListByTaskId(taskId:string) {
return await monthTableModel.find({taskId}); return await monthTableModel.find({taskId, isUpdate:true});
} }
......
...@@ -46,8 +46,8 @@ export async function save(throwError=false) { ...@@ -46,8 +46,8 @@ export async function save(throwError=false) {
* @param taskId 任务id * @param taskId 任务id
* @returns {1:{}, 2:{}} * @returns {1:{}, 2:{}}
*/ */
export async function findFuHuaQiTaskByTaskId(taskId:string) { export async function findFuHuaQiTaskByTaskId(taskId:string, isSubmit:boolean) {
let findList = await fuHuaQiTaskModel.find({taskId}).exec() || []; let findList = await fuHuaQiTaskModel.find({taskId, isSubmit}).exec() || [];
let taskMap = {}; let taskMap = {};
findList.forEach(item => { findList.forEach(item => {
taskMap[item.type] = item; taskMap[item.type] = item;
......
...@@ -110,10 +110,10 @@ async function getMonthList(req, res) { ...@@ -110,10 +110,10 @@ async function getMonthList(req, res) {
* @param res * @param res
*/ */
async function getEnterpriseList(req, res) { async function getEnterpriseList(req, res) {
let reqConf = {time: 'Number', fuHuaQiUscc: 'String', industry: '[Number]', isNaturalPersonHolding: 'Number', page: 'Number' }; let reqConf = {createType: 'Number', fuHuaQiUscc: 'String', industry: '[Number]', isNaturalPersonHolding: 'Number', page: 'Number' };
let { time, fuHuaQiUscc, industry, isNaturalPersonHolding, page } = checkParamaterType(reqConf, req.body); let { createType, fuHuaQiUscc, industry, isNaturalPersonHolding, page } = checkParamaterType(reqConf, req.body);
let result = await enterpriseBiz.enterpriseList(time, fuHuaQiUscc, industry, isNaturalPersonHolding, page); let result = await enterpriseBiz.enterpriseList(createType, fuHuaQiUscc, industry, isNaturalPersonHolding, page);
res.success(result); res.success(result);
} }
...@@ -190,10 +190,10 @@ async function outPutFuHuaQiData(req, res) { ...@@ -190,10 +190,10 @@ async function outPutFuHuaQiData(req, res) {
async function outPutEnterpriseData(req, res) { async function outPutEnterpriseData(req, res) {
let reqConf = {time: 'Number', fuHuaQiUscc: 'String', industry: '[Number]', isNaturalPersonHolding: 'Number', type:'Number' }; let reqConf = {createType: 'Number', fuHuaQiUscc: 'String', industry: '[Number]', isNaturalPersonHolding: 'Number', type:'Number' };
let { time, fuHuaQiUscc, industry, isNaturalPersonHolding, page, type } = checkParamaterType(reqConf, req.body); let { createType, fuHuaQiUscc, industry, isNaturalPersonHolding, page, type } = checkParamaterType(reqConf, req.body);
let dataList = await enterpriseBiz.outPutEnterpriseData(time, fuHuaQiUscc, industry, isNaturalPersonHolding, type); let dataList = await enterpriseBiz.outPutEnterpriseData(createType, fuHuaQiUscc, industry, isNaturalPersonHolding, type);
let keyList = [ let keyList = [
"name", "createTime", "fuhuaqiUscc", "uscc", "industry", "logonTime", "name", "createTime", "fuhuaqiUscc", "uscc", "industry", "logonTime",
......
...@@ -348,10 +348,9 @@ async function deleteReport(req, res) { ...@@ -348,10 +348,9 @@ async function deleteReport(req, res) {
* @param res * @param res
*/ */
async function selectMonthInfo(req, res) { async function selectMonthInfo(req, res) {
let reqConf = {uscc: 'String' }; const Uscc = req.headers.uscc;
let { uscc } = checkReqParam(reqConf, req.body);
let result = await monthBiz.getMonthByUscc(uscc); let result = await monthBiz.getMonthByUscc(Uscc);
res.success(result); res.success(result);
} }
......
...@@ -27,8 +27,11 @@ export function getTimeKey() { ...@@ -27,8 +27,11 @@ export function getTimeKey() {
* @param config 校验配置 * @param config 校验配置
* @param param 需要校验的参数 * @param param 需要校验的参数
*/ */
export function checkParamater(name:string, keyTypeConf:object, param:object) { export function checkParamater(name:string, keyTypeConf:object, param:object, skipKeys?) {
for (let key in keyTypeConf ) { for (let key in keyTypeConf ) {
if ( skipKeys && skipKeys.indexOf(key) > -1 ) {
continue;
}
if ( !param[key] ) throw new BizError(ERRORENUM.表单校验失败, name, `缺失${key}字段`); if ( !param[key] ) throw new BizError(ERRORENUM.表单校验失败, name, `缺失${key}字段`);
let type = typeof param[key]; let type = typeof param[key];
switch(keyTypeConf[key]) { switch(keyTypeConf[key]) {
......
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