Commit 599f324c by lixinming

3.0

parent d2970f38
......@@ -7,3 +7,4 @@
/video
*test*
*.logs
*.zip
......@@ -98,7 +98,7 @@ export async function outPutEnterpriseData(createType:number, fuHuaQiUscc:string
selectParam.isCreate = createType == 2 ? true : false;
}
if (fuHuaQiUscc) selectParam.fuHuaQiUscc = fuHuaQiUscc;
if (industry.length > 0) selectParam.industry = industry;
if (industry && industry.length > 0) selectParam.industry = industry;
if (isNaturalPersonHolding == 2 || isNaturalPersonHolding == 3) {
selectParam.isNaturalPersonHolding = isNaturalPersonHolding == 2 ? true : false;
}
......
......@@ -8,14 +8,18 @@ import * as taskData from "../../data/fuHuaQi/task";
import * as enterpriseData from "../../data/enterprise/enterprise";
import * as fuhuaqiData from "../../data/fuHuaQi/fuhuaqi";
import * as financingData from "../../data/enterprise/financing";
import { FUHUASTATE, SCOREWAYS, TASKTYPEENUM } from "../../config/enum";
import { CHANGEMODE, FUHUASTATE, SCOREWAYS, TASKTYPEENUM } from "../../config/enum";
import { ERRORENUM } from "../../config/errorEnum";
import { findAllNotDisabledFuHuaQi, findFuHuaQiList } from "../../data/fuHuaQi/fuhuaqi";
import { BizError } from "../../util/bizError";
import { logHandle } from "../../util/log";
import { initFuHuaQiScore } from "../../data/fuHuaQi/score";
import { updateScore } from "../mobileFuHuaQi/fuHuaQi/score";
import * as scoreData from "../../data/fuHuaQi/score";
import * as scoreLogData from "../../data/fuHuaQi/scoreLog";
import { ScoreConfig } from "../../config/scoreConfig";
import moment = require("moment");
import * as sysTools from "../../tools/system";
/**
* 发放1月数据
......@@ -94,14 +98,66 @@ export async function initScoreData() {
/**初始化任务得分 */
let taskList = await taskData.findTaskListByParam({});
for (let i =0; i < taskList.length; i++) {
let {fuHuaQiUscc, isSubmit, type} = taskList[i];
if ( isSubmit ) await updateScore(fuHuaQiUscc, SCOREWAYS.任务得分, true, type);
else await updateScore(fuHuaQiUscc, SCOREWAYS.任务得分, false, type);
let {fuHuaQiUscc, isSubmit, type, month, year} = taskList[i];
let timeMs = moment([year, month, 1, 2]).add(1, 'M').valueOf();
if ( isSubmit ) await initTaskScore(fuHuaQiUscc, SCOREWAYS.任务得分, true,timeMs, type);
else await initTaskScore(fuHuaQiUscc, SCOREWAYS.任务得分, false,timeMs, type);
}
console.log("初始化评分成功");
}
async function initTaskScore(uscc:string, type:number, isSubmitTask:boolean, timeMs:number, subType?) {
/**得分信息 */
let scoreInfo = await scoreData.findFuHuaQiScoreInfo(uscc);
if (!scoreInfo) return
let fuHuaQiInfo = await fuhuaqiData.findFuHuaQiByUSCC(uscc);
let newScore = 0;//新分数
let oldScore = 0;//老分数
let countScore = scoreInfo.startScore +scoreInfo.myDataScore +scoreInfo.baseDataScore +scoreInfo.myEnterpriseScore +scoreInfo.taskScore;
/**单个任务得分 */
let createMonth = !fuHuaQiInfo.createTime ? 0 : new Date(fuHuaQiInfo.createTime).getMonth();
if (isSubmitTask) newScore = getOnceTaskScore(createMonth);
else newScore = getOnceTaskDeductScore(createMonth);
/**赋值新的分数 */
scoreInfo.taskScore = scoreInfo.taskScore + newScore
/**分数没有变化 */
if (oldScore == newScore) return;
let changeMode = oldScore > newScore ? CHANGEMODE.减少 : CHANGEMODE.增加;
let newCountScore = countScore - oldScore + newScore;
if (SCOREWAYS.任务得分 == type) {
newScore = -1 * newScore;
await scoreLogData.addLogTOInitData(uscc, type, changeMode, newCountScore, newScore, timeMs,subType);
} else await scoreLogData.addLogTOInitData(uscc, type, changeMode, newCountScore, timeMs,newScore);
scoreInfo.updateTime = new Date().valueOf();
await scoreInfo.save();
}
/**
* 算单个任务得分
* @param month 入住月份 如果是去年 就是0 范围是0-11
* @returns
*/
function getOnceTaskScore(month:number) {
let thisMonthTaskCount = 3; //后续接入任务可编辑要改这里
return (ScoreConfig["任务常量_加分"]/(12-month)) * (1/thisMonthTaskCount);
}
/**
* 算单个任务扣分
* @param month 入住月份 如果是去年 就是0 范围是0-11
* @returns
*/
function getOnceTaskDeductScore(month:number) {
let thisMonthTaskCount = 3; //后续接入任务可编辑要改这里
return -((ScoreConfig["任务常量_扣分"]/(12-month)) * (1/thisMonthTaskCount));
}
export async function replenishTaskData() {
let list = await enterpriseData.findStats();
......@@ -246,3 +302,19 @@ function getNewAdd(addStr:string) {
return ["上海市", cityStr, areaStr, detailedStr];
}
export async function updateEnterpriseDataInfo() {
let result = await enterpriseData.findEnterpriseList({});
for (let i = 0; i < result.length; i++) {
let dataItem = result[i];
let info = await enterpriseData.findEnterpriseByUscc(dataItem.uscc);
info.pwd = sysTools.getPwdMd5(info.uscc, sysTools.md5PwdStr(dataItem.uscc.slice(dataItem.uscc.length-6)));
info.firstLoginIsChangePwd = false;
await info.save();
}
console.log("补全企业密码成功");
}
\ No newline at end of file
/**
* 企业经营数据相关
* 作者:lxm
* 说明: 首页经营数据 经营数据补充
* 备注: 填报的经营数据在 填报逻辑 里
*/
import moment = require("moment");
import { findBusinessDataByUsccAndYear } from "../../data/enterprise/businessdata";
/**
* 获取经营数据
* @param uscc 企业统一信用代码
*/
export async function getBusinessData(uscc:string) {
let lastYear = moment().subtract(1, 'years').year();
let thisYear = new Date().getFullYear();
let thisYearData = await findBusinessDataByUsccAndYear(uscc, thisYear);
let lastYearData = await findBusinessDataByUsccAndYear(uscc, lastYear);
let thisYearBusinessData = countBusinessData(thisYearData);
let lastYearBusinessData = countBusinessData(lastYearData);
let result = {
lastYearBI:lastYearBusinessData.BI,
lastYearRD:lastYearBusinessData.RD,
lastYearTXP:lastYearBusinessData.TXP,
yearTotalBI:thisYearBusinessData.BI,
yearTotalRD:thisYearBusinessData.RD,
yearTotalTXP:thisYearBusinessData.TXP
};
for (let key in result) {
result[key].notReported = !result[key].count;
}
return result;
}
function countBusinessData(dataList) {
let countRD = 0;
let countBI = 0;
let countTXP = 0;
dataList.forEach(info => {
countBI += info.BI;
countRD += info.RD;
countTXP += info.TXP;
});
return {
RD:countUnitData(countRD),
BI:countUnitData(countBI),
TXP:countUnitData(countTXP),
}
}
/**
* 获取格式 将金额数据转换为金额加单位
* 单位为:元 万元 根据长度自动转换
* 超过千万 单位为万 否则单位为元
* @param data
* @returns
*/
function countUnitData(data:number) {
if (!data) return {unit:"元", count:0};
if (data/10000000 < 10) {
return {
unit:"元",
count:Math.floor(data)
}
}
return {
unit:"万元",
count:Math.floor(data/10000)
}
}
/**
* 小程序端 企业用户的 企业基础信息
* 作者:lxm
*/
import { EnterpriseQualificationUpdateConfig, EnterpriseUpdateBaseDataConfig, InitialTeamUpdateConfig } from "../../config/eccFormParamConfig";
import { ENTERPRISETEAM, INDUSTRY, LISTINGSITUATION } from "../../config/enum";
import { ERRORENUM } from "../../config/errorEnum";
import { EnterpriseBaseConfig } from "../../config/splitResultConfig";
import * as enterpriseData from "../../data/enterprise/enterprise";
import { selectFinancingInfo } from "../../data/enterprise/financingInfo";
import { findEnterpriseNewTeamData } from "../../data/enterprise/team";
import { BizError } from "../../util/bizError";
import { checkChange, extractData } from "../../util/piecemeal";
import { eccEnumValue } from "../../util/verificationEnum";
import { eccFormParam } from "../../util/verificationParam";
/**
* 校验参数是否为空
* @param param 参数
* @returns true就是空
*/
function paramIsNull(param) {
if (!param) return true;
let isNull = false;
if (typeof param == "object") {
if (Array.isArray(param) ) isNull = param.length == 0;
else isNull = Object.keys(param).length == 0;
}
else isNull = !param;
return isNull;
}
/**
* 获取首页基础信(首页顶端数据)
* @param uscc 企业统一信用代码
* @returns
*/
export async function getHomePageHeaderData(uscc:string) {
let enterpriseInfo = await enterpriseData.findEnterpriseByUscc(uscc);
//企业名称
let name = enterpriseInfo.name;
let newTeamInfo = await findEnterpriseNewTeamData(uscc);
let teamInfo = !paramIsNull(newTeamInfo) ? newTeamInfo : {doctor:0, master:0, undergraduate:0, juniorCollege:0, other:0 };
//团队总数
let memberCount = teamInfo.doctor + teamInfo.master+ teamInfo.undergraduate+ teamInfo.juniorCollege+ teamInfo.other;
let initialTeam = enterpriseInfo.initialTeam.length == 0;//创始团队缺失 true=缺失
let qualification = paramIsNull(enterpriseInfo.qualification);//企业资质缺失 true=缺失 需要标红
let intellectualProperty = paramIsNull(enterpriseInfo.intellectualProperty);//知识产权缺失 true=缺失 需要标红
let financingInfo = await selectFinancingInfo(uscc);//融资情况缺失 true=缺失 需要标红
let financing = paramIsNull(financingInfo);
//todo
let baseInfo = paramIsNull({});//基本信息缺失 true=缺失 需要标红
return {
name,
memberCount,
hiatus:{
initialTeam,
qualification,
financing,
intellectualProperty,
baseInfo
}
}
}
/**
* 修改创始团队信息
* @param uscc 企业统一信用代码
* @param firstClassTalent 是否拥有国际一流人才
* @param teams 创始团队信息
* @returns isSuccess
*/
export async function updateInitialTeamInfo(uscc:string, firstClassTalent:boolean, teams) {
/**校验参数 */
if ( (firstClassTalent && !Array.isArray(teams)) || (firstClassTalent && !teams.length) ) {
throw new BizError(ERRORENUM.参数错误, "修改创始团队信息", "缺少参数 teams");
}
if (!firstClassTalent) teams = [];
teams.forEach((info, index) => {
eccFormParam(`修改创始团队信息 下标:${index}`, InitialTeamUpdateConfig, info);
eccEnumValue('修改创始团队信息', 'type', ENTERPRISETEAM, info.type);
if (info.des.length > 200) throw new BizError(ERRORENUM.字数超过200限制, `修改创始团队信息 下标:${index}`);
});
let enterpriseInfo = await enterpriseData.findEnterpriseByUscc(uscc);
/**赋值 */
enterpriseInfo.firstClassTalent = firstClassTalent;
enterpriseInfo.initialTeam = teams;
await enterpriseInfo.save();
return {isSuccess:true};
}
/**
* 获取创始团队信息
* 回显
* @param uscc 企业统一信用代码
* @returns initialTeam 团队列表 firstClassTalent 是否拥有国际一流人才
*/
export async function selectInitialTeamInfo(uscc:string) {
let enterpriseInfo = await enterpriseData.findEnterpriseByUscc(uscc);
let initialTeam = enterpriseInfo.initialTeam || [];
let firstClassTalent = enterpriseInfo.firstClassTalent;
return { initialTeam, firstClassTalent };
}
/**
* 修改企业知识产权信息
* @param uscc 企业统一信用代码
* @param alienPatent 海外专利个数
* @param classIPatent 一类专利个数
* @param secondClassPatent 二类专利个数
* @returns isSuccess
*/
export async function updateIntellectualProperty(uscc:string, alienPatent:number, classIPatent:number, secondClassPatent:number) {
let enterpriseInfo = await enterpriseData.findEnterpriseByUscc(uscc);
enterpriseInfo.intellectualProperty = {alienPatent, classIPatent, secondClassPatent};
await enterpriseInfo.save();
return {isSuccess:true}
}
/**
* 查询企业专利信息
* 回显
* @param uscc 企业统一信用代码
* @returns
*/
export async function selectIntellectualProperty(uscc:string) {
let enterpriseInfo = await enterpriseData.findEnterpriseByUscc(uscc);
let intellectualProperty = {alienPatent:0, classIPatent:0, secondClassPatent:0};
if (!paramIsNull(enterpriseInfo.intellectualProperty)) {
intellectualProperty = enterpriseInfo.intellectualProperty;
}
return intellectualProperty;
}
/**
* 获取企业资质信息
* @param uscc 企业统一信用代码
* @returns
*/
export async function selectQualification(uscc:string) {
let enterpriseInfo = await enterpriseData.findEnterpriseByUscc(uscc);
let defaultQualification = {
isHighTech:false,//是否是高新技术企业
highTechMs:0,//高新技术认证时间戳
isZjtx:false,//是否专精特新企业
zjtxMs:0,//专精特新认证时间戳
isXjrpy:false,//是否小巨人培育企业
xjrpyMs:0,//小巨人培育企业时间戳
isXjr:false,//是否是小巨人企业
xjrMs:0,//小巨人企业认证时间
beOnTheMarket:[],//上市情况
isBeOnTheMarket:false
};
return enterpriseInfo.qualification || defaultQualification;
}
/**
* 修改企业资质
* @param uscc 企业统一信用代码
* @returns
*/
export async function updateQualification(uscc:string, param) {
eccFormParam("修改企业资质", EnterpriseQualificationUpdateConfig, param);
if (param.isBeOnTheMarket) {
if (!param.beOnTheMarket.length) throw new BizError(ERRORENUM.参数错误, '修改企业资质', '缺失 beOnTheMarket ')
eccEnumValue("修改企业资质", "beOnTheMarket", LISTINGSITUATION, param.beOnTheMarket );
} else param.beOnTheMarket = [];
let enterpriseInfo = await enterpriseData.findEnterpriseByUscc(uscc);
enterpriseInfo.qualification = JSON.parse(JSON.stringify(param) );
await enterpriseInfo.save();
return {isSuccess:true};
}
/**
* 获取企业基本信息
* 回显
* @param uscc
*/
export async function enterpriseBaseInfo(uscc:string) {
let enterpriseInfo = await enterpriseData.findEnterpriseByUscc(uscc);
let updateInfo = extractData(EnterpriseBaseConfig, enterpriseInfo, false);
return updateInfo;
}
/**
* 修改我的企业信息
* @param uscc 企业统一信用代码
* @param param 表单
* @returns
*/
export async function updateEnterpriseBaseInfo(uscc:string, param) {
eccFormParam("企业修改我的信息", EnterpriseUpdateBaseDataConfig, param );
eccEnumValue('企业修改我的信息', 'industry', INDUSTRY, param.industry);
let enterpriseInfo = await enterpriseData.findEnterpriseByUscc(uscc);
/**修改字段 */
let changeList = checkChange(param, enterpriseInfo);
if ( !changeList.length ) throw new BizError(ERRORENUM.数据无更新, `${param.uscc}数据无更新`);
changeList.forEach(key => {
if (key != "uscc" && key != "name") {
enterpriseInfo[key] = param[key];
}
});
await enterpriseInfo.save();
return {isSuccess:true};
}
\ No newline at end of file
/**
* 企业融资情况
* 作者:lxm
*/
import { EnterpriseCreateFinancingDataConfig, EnterpriseCreateFinancingParamSubConfig, EnterpriseUpdateFinancingDataConfig } from "../../config/eccFormParamConfig";
import { FINANCINGROUNDS, FUHUAQILNVESTMENTSTYLE } from "../../config/enum";
import { ERRORENUM } from "../../config/errorEnum";
import { EnterpriseFinancingListDataConfig } from "../../config/splitResultConfig";
import { findEnterpriseByUscc } from "../../data/enterprise/enterprise";
import { addFinancingInfo, deleteFinancingById, getFinancingById, selectFinancingListByUscc } from "../../data/enterprise/financingInfo";
import { getFinancingId } from "../../tools/system";
import { BizError } from "../../util/bizError";
import { checkChange, extractData } from "../../util/piecemeal";
import { eccEnumValue } from "../../util/verificationEnum";
import { eccFormParam } from "../../util/verificationParam";
/**
* 获取企业融资情况信息列表
* @param uscc 企业统一信用代码
*/
export async function getEnterpriseFinancingList(uscc:string) {
let financingList = await selectFinancingListByUscc(uscc);
let resultList = [];
financingList.forEach(info => {
let updateInfo = extractData(EnterpriseFinancingListDataConfig, info, false);
resultList.push(updateInfo);
});
return { dataList:resultList };
}
/**
* 添加融资信息
* @param uscc 企业统一信用代码
* @param form 表单
* @returns
*/
export async function addEnterpriseFinancing(uscc:string, form) {
eccFormParam("企业录入企业融资信息", EnterpriseCreateFinancingDataConfig, form);
eccEnumValue( "录入企业融资信息", "financingRounds", FINANCINGROUNDS, form.financingRounds);
if (form.fuHuaQiInvestment) {
/**如果当孵化器是否投资填了true 则校验 fuHuaQiInvestmentAmount, fuHuaQiInvestmentStyle 两个字段 */
let subCheckName = "录入企业融资信息_孵化器是否参与";
let subCheckData = {
fuHuaQiInvestmentAmount:form.fuHuaQiInvestmentAmount,
fuHuaQiInvestmentStyle:form.fuHuaQiInvestmentStyle,
};
eccFormParam(subCheckName, EnterpriseCreateFinancingParamSubConfig, subCheckData);
/**校验投资方式是否符合枚举规则 */
eccEnumValue("添加企业融资信息", "fuHuaQiInvestmentStyle", FUHUAQILNVESTMENTSTYLE, form.fuHuaQiInvestmentStyle);
} else {
/**如果 没有填这里给默认数据*/
form.fuHuaQiInvestmentAmount = 0;
form.fuHuaQiInvestmentStyle = 0;
}
let enterpriseInfo = await findEnterpriseByUscc(uscc);
let addInfo:any = {
id:getFinancingId(uscc), uscc, name:enterpriseInfo.name, createTime:new Date().valueOf(), type:2
};
await addFinancingInfo(Object.assign(addInfo, form));
return {isSuccess:true};
}
/**
* 获取 企业融资情况
* 回显
* @param uscc 企业统一信用代码
* @param id 融资数据标识
*/
export async function getEnterpriseFinancingInfo(uscc:string, id:string) {
let financingInfo = await getFinancingById(id);
if (!financingInfo) throw new BizError(ERRORENUM.参数错误, `获取企业融资情况 id在库里找不到`);
if ( financingInfo.uscc != uscc ) throw new BizError(ERRORENUM.只能修改本企业信息, `${uscc} 想修改 ${id}`);
let updateInfo = extractData(EnterpriseFinancingListDataConfig, financingInfo, false);
return updateInfo;
}
/**
* 修改企业融资数据
* @param uscc 企业统一信用代码
* @param form 表单
* @returns
*/
export async function updateEnterpriseFinancingInfo(uscc:string, form) {
eccFormParam("企业修改企业融资信息", EnterpriseUpdateFinancingDataConfig, form);
eccEnumValue( "录入企业融资信息", "financingRounds", FINANCINGROUNDS, form.financingRounds);
if (form.fuHuaQiInvestment) {
/**如果当孵化器是否投资填了true 则校验 fuHuaQiInvestmentAmount, fuHuaQiInvestmentStyle 两个字段 */
let subCheckName = "录入企业融资信息_孵化器是否参与";
let subCheckData = {
fuHuaQiInvestmentAmount:form.fuHuaQiInvestmentAmount,
fuHuaQiInvestmentStyle:form.fuHuaQiInvestmentStyle,
};
eccFormParam(subCheckName, EnterpriseCreateFinancingParamSubConfig, subCheckData);
/**校验投资方式是否符合枚举规则 */
eccEnumValue("添加企业融资信息", "fuHuaQiInvestmentStyle", FUHUAQILNVESTMENTSTYLE, form.fuHuaQiInvestmentStyle);
} else {
/**如果 没有填这里给默认数据*/
form.fuHuaQiInvestmentAmount = 0;
form.fuHuaQiInvestmentStyle = 0;
}
let financingInfo = await getFinancingById(form.id);
if (!financingInfo) throw new BizError(ERRORENUM.参数错误, `修改企业信息的时候 id在库里找不到`);
if ( financingInfo.uscc != uscc ) throw new BizError(ERRORENUM.只能修改本企业信息, `${uscc} 想修改 ${form.id}`);
let changeList = checkChange(form, financingInfo);
if ( !changeList.length ) throw new BizError(ERRORENUM.数据无更新, `企业更新融资数据`, `${form.id}数据无更新`);
changeList.forEach(key => {
if (key != "id") {
financingInfo[key] = form[key];
}
});
await financingInfo.save();
return {isSuccess:true};
}
/**
* 删除企业融资数据
* @param uscc 企业统一信用代码
* @param id 唯一标识
* @returns
*/
export async function deleteEnterpriseFinancingInfo(uscc:string, id:string) {
let financingInfo = await getFinancingById(id);
if (!financingInfo) throw new BizError(ERRORENUM.参数错误, `获取企业融资情况 id在库里找不到`);
if ( financingInfo.uscc != uscc ) throw new BizError(ERRORENUM.只能删除本企业信息, `${uscc} 想修改 ${id}`);
await deleteFinancingById(id);
return {isSuccess:true};
}
\ No newline at end of file
/**
* 小程序端 企业角色用户 逻辑
* 作者:lxm
* 3.0更新功能
*/
import { ERRORENUM } from "../../config/errorEnum";
import * as sysTools from "../../tools/system";
import { BizError } from "../../util/bizError";
import * as enterpriseData from "../../data/enterprise/enterprise";
/**
* 企业登录
* @param uscc 企业统一信用代码
* @param pwd
*/
export async function enterpriseLogin(uscc:string, pwd:string) {
if (!sysTools.eccUscc(uscc)) throw new BizError(ERRORENUM.统一社会信用代码不合法, '孵化器登录时');
let enterpriseInfo = await enterpriseData.findEnterpriseByUscc(uscc);
if (!enterpriseInfo) throw new BizError(ERRORENUM.账号不存在);
let checkPwd = sysTools.getPwdMd5(enterpriseInfo.uscc, pwd);
if (enterpriseInfo.pwd != checkPwd) throw new BizError(ERRORENUM.密码错误);
const Token = sysTools.getToken(uscc);
let userInfo = {
uscc: enterpriseInfo.uscc,
// name: fuhuaqiInfo.name,
firstLogin : !enterpriseInfo.firstLoginIsChangePwd,
token:Token
};
enterpriseInfo.token = Token;
enterpriseInfo.tokenMs = new Date().valueOf();
await enterpriseInfo.save();
return userInfo;
}
/**
* 首次登录修改密码
* @param uscc 企业统一信用代码
* @param pwd 密码
* @param confirmPwd 确认密码
*/
export async function firstChangePwd(uscc:string, pwd:string, confirmPwd:string) {
if (pwd != confirmPwd) throw new BizError(ERRORENUM.密码不一致);
if (pwd.search(/^[A-Za-z0-9]{6,18}$/) < 0) throw new BizError(ERRORENUM.密码只能由618位字符和数字组成);
let dataBaseInfo = await enterpriseData.findEnterpriseByUscc(uscc);
if (dataBaseInfo.firstLoginIsChangePwd) throw new BizError(ERRORENUM.不能重复修改密码, `重复调用了首次登录之后的修改密码接口${uscc}`);
dataBaseInfo.pwd = sysTools.getPwdMd5(uscc, sysTools.md5PwdStr(pwd));
dataBaseInfo.firstLoginIsChangePwd = true;
await dataBaseInfo.save();
return {isSuccess:true};
}
/**
* 找回密码
* todo 有问题, 企业没有负责人
* @param phone 负责人电话号码 如果和库里的对不上 就要报错
* @param uscc 企业统一信用代码
* @param code 验证码
* @param pwd 密码
* @param confirmPwd 确认密码
*/
export async function resettingPwd(phone:string, uscc:string, code:string, pwd:string, confirmPwd:string) {
// if (!sysTools.eccUscc(uscc)) throw new BizError(ERRORENUM.统一社会信用代码不合法, '重置密码时');
// let enterpriseInfo = await enterpriseData.findEnterpriseByUscc(uscc);
// if (!enterpriseInfo) throw new BizError(ERRORENUM.账号不存在, `重置密码时 uscc:${uscc}`);
// if ( phone != fuHuaQiInfo.personInChargePhone) throw new BizError(ERRORENUM.号码与主体不一致, '修改密码发验证码时');
// if (pwd != confirmPwd) throw new BizError(ERRORENUM.密码不一致);
// if (pwd.search(/^[A-Za-z0-9]{6,18}$/) < 0) throw new BizError(ERRORENUM.密码只能由6至18位字符和数字组成);
// let todayMs = sysTools.getTodayMs();
// let codeList = await codeData.findTodayCodeByUscc(uscc, todayMs);
// let now = new Date().valueOf();
// let codeId = '';
// let msg = ERRORENUM.验证码错误;
// codeList.forEach(info => {
// if (info.code == code) {
// if (info.isUse) msg = ERRORENUM.验证码失效;
// else if ( (now - info.sendMs) > (30 * 60 * 1000) ) msg = ERRORENUM.验证码过期
// else codeId = info.id;
// }
// });
// if (!codeId) throw new BizError(msg, `uscc:${uscc}重置密码的code:${code}`);
// await codeData.updateCodeState(codeId);
// fuHuaQiInfo.pwd = sysTools.getPwdMd5(uscc, sysTools.md5PwdStr(pwd));
// await fuHuaQiInfo.save();
// return {isSuccess:true};
}
\ No newline at end of file
......@@ -12,7 +12,7 @@ import * as sysTools from "../../../tools/system";
import * as enterpriseData from "../../../data/enterprise/enterprise";
import * as splitResultConfig from "../../../config/splitResultConfig";
import * as configEnum from "../../../config/enum";
import { eccFormParam } from "../../../util/verificationParam";
import { eccFormParam, eccReqParamater } from "../../../util/verificationParam";
import * as verificationEnumTools from "../../../util/verificationEnum";
import { checkChange, extractData } from "../../../util/piecemeal";
import * as scoreBiz from "../fuHuaQi/score";
......@@ -326,12 +326,33 @@ export async function updateVirtualInfo(fuHuaQiUscc:string, uscc:string, virtual
* @param fuHuaQiUscc 孵化器统一信用代码
* @param uscc 企业统一信用代码
* @param moveOutType 迁出类型
* @param moveOutTrace 迁出去向 2.3新加字段
* @param moveOutCause 迁出原因 多选
* @returns {isSuccess:true/false}
*/
export async function updateMoveOutInfo(fuHuaQiUscc:string, uscc:string, moveOutType:number, moveOutCause ) {
export async function updateMoveOutInfo(fuHuaQiUscc:string, uscc:string, moveOutType:number, moveOutTrace:number, moveOutCause ) {
/**校验参数 */
verificationEnumTools.eccEnumValue('修改企业孵化状态', '修改为迁出', configEnum.MOVEOUTTYPE, moveOutType);
if (moveOutType != configEnum.MOVEOUTTYPE.企业注销 ) {
//选择了 非企业注销时 moveOutTrace 和 moveOutCause 为必选项
await eccReqParamater({moveOutTrace:"Number", moveOutCause:"[Number]" }, {moveOutTrace, moveOutCause} );
/**校验moveOutCause 和 moveOutTrace 是否符合规则*/
verificationEnumTools.eccEnumValue('修改企业孵化状态', '修改为迁出', configEnum.MOVEOUTTRACE, moveOutTrace);
verificationEnumTools.eccEnumValue('修改企业孵化状态', '修改为迁出', configEnum.MOVEOUTCAUSE, moveOutCause);
/**根据 不同的迁出类型 校验不同的迁出原因枚举 */
if (moveOutType == configEnum.MOVEOUTTYPE.毕业迁出) {
moveOutCause = [moveOutCause[0]];//非毕业迁出是单选
verificationEnumTools.eccEnumValue('修改企业孵化状态', '修改为迁出', configEnum.MOVEOUTCAUSECLIENT, moveOutCause);
}
if (moveOutType == configEnum.MOVEOUTTYPE.非毕业迁出) {
verificationEnumTools.eccEnumValue('修改企业孵化状态', '修改为迁出', configEnum.MOVEOUTCAUSENOTCLIENT, moveOutCause);
}
} else {
/**如果是选择了企业注销 这里的两个参数要为空 */
moveOutTrace = 0;
moveOutCause = [];
}
let enterpriseInfo = await enterpriseData.findEnterpriseByUscc(uscc);
if (!enterpriseInfo) throw new BizError(ERRORENUM.该企业不存在, "修改企业孵化状态 修改为实体",`孵化器 ${fuHuaQiUscc} -> 企业${uscc}`);
......@@ -340,6 +361,7 @@ export async function updateMoveOutInfo(fuHuaQiUscc:string, uscc:string, moveOu
enterpriseInfo.moveOutType = moveOutType;
enterpriseInfo.moveOutCause = moveOutCause;
enterpriseInfo.moveOutTrace = moveOutTrace;
enterpriseInfo.moveOutTime = new Date().valueOf();
enterpriseInfo.state = configEnum.FUHUASTATE.迁出;
......
......@@ -27,6 +27,7 @@ import { checkChange, extractData } from "../../../util/piecemeal";
export async function createFinancingInfo(uscc:string, param) {
/**校验表单参数*/
eccFormParam("录入企业融资信息", eccFormParamConfig.FinancingParamConfig, param);
eccEnumValue( "录入企业融资信息", "financingRounds", configEnum.FINANCINGROUNDS, param.financingRounds);
if (param.fuHuaQiInvestment) {
/**如果当孵化器是否投资填了true 则校验 fuHuaQiInvestmentAmount, fuHuaQiInvestmentStyle 两个字段 */
let subCheckName = "录入企业融资信息_孵化器是否参与";
......
......@@ -12,7 +12,7 @@ import * as configEnum from "../../../config/enum";
import { checkChange, extractData } from "../../../util/piecemeal";
import { BizError } from "../../../util/bizError";
import { ERRORENUM } from "../../../config/errorEnum";
import { eccFormParam } from "../../../util/verificationParam";
import { eccFormParam, eccReqParamater } from "../../../util/verificationParam";
import { changeEnumValue, eccEnumValue } from "../../../util/verificationEnum";
import * as scoreBiz from "./score";
......@@ -104,6 +104,30 @@ export async function updateFuHuaQiBaseData(uscc:string, param) {
if (!param.professionalTechnologyCreateTime ) throw new BizError(ERRORENUM.参数错误, "修改孵化器=>我的数据信息", "professionalTechnologyCreateTime" );
if (!param.professionalTechnologyAmount) throw new BizError(ERRORENUM.参数错误, "修改孵化器=>我的数据信息", "professionalTechnologyAmount" );
}
//校验 专业技术平台 参数
if (param.isProfessionalTechnology) {
const ProfessionalTechnologyConf = {
professionalTechnologyName:"String",
professionalTechnologyCreateTime:"Number",
professionalTechnologyAmount:"Number",
};
const CheckProfessionalTechnologyConf = {
professionalTechnologyName:param.professionalTechnologyName,
professionalTechnologyCreateTime:param.professionalTechnologyCreateTime,
professionalTechnologyAmount:param.professionalTechnologyAmount,
};
eccReqParamater(ProfessionalTechnologyConf, CheckProfessionalTechnologyConf);
} else {
param.professionalTechnologyName = "";
param.professionalTechnologyCreateTime = 0;
param.professionalTechnologyAmount = 0;
}
//校验是否与第三方机构合作
if (param.isCooperation) {
eccReqParamater({cooperationInstitutions:"String"}, {cooperationInstitutions:param.cooperationInstitutions});
}else {
param.cooperationInstitutions = "";
}
let baseDataInfo = await fuhuaqiData.findFuHuaQiByUSCC(uscc);
/**这里无法判断数组里面的内容是否有变化 所以 hatchingGround 直接赋值 */
......@@ -148,7 +172,10 @@ export async function updateOrganizationData(uscc:string, param) {
if (param.industry) eccEnumValue("更新孵化器机构信息数据", " 领域 ", configEnum.FUHUAINDUSTRY, param.fuHuaQiInvestmentStyle);
if (param.institutionalNature) eccEnumValue("更新孵化器机构信息数据", " 机构性质 ", configEnum.INSTITUTIONALNATURE, param.fuHuaQiInvestmentStyle);
if (param.operationModel && param.operationModel.length) eccEnumValue("更新孵化器机构信息数据", " 运营模式 ", configEnum.OPERATIONMODEL, param.fuHuaQiInvestmentStyle);
//限制企业简介长度
if (param.introduction) {
if (param.introduction.length > 200) throw new BizError(ERRORENUM.字数超过200限制, "更新孵化器机构信息数据 孵化器简介");
}
let baseDataInfo = await fuhuaqiData.findFuHuaQiByUSCC(uscc);
/**赋值内容 */
......@@ -156,7 +183,6 @@ export async function updateOrganizationData(uscc:string, param) {
for (let i = 0; i < changeList.length; i++) {
let key = changeList[i];
if (key == "operationName" || key == "uscc") continue;
baseDataInfo[key] = param[key];
}
/**这里无法判断数组里面的内容是否有变化 所以 foundingTeam 直接赋值 */
......
......@@ -126,7 +126,9 @@ export async function updateScore(uscc:string, type:number, isSubmitTask:boolean
if (SCOREWAYS.任务得分 == type) {
newScore = -1 * newScore;
await scoreLogData.addLog(uscc, type, changeMode, newCountScore, newScore, subType);
} await scoreLogData.addLog(uscc, type, changeMode, newCountScore, newScore);
} else {
await scoreLogData.addLog(uscc, type, changeMode, newCountScore, newScore);
}
scoreInfo.updateTime = new Date().valueOf();
await scoreInfo.save();
......
......@@ -20,6 +20,8 @@ export const BaseParamUpdateConfig = {
hatchingGround:{type:"[Object]", notMustHave:true},//经备案孵化场地
isProfessionalTechnology:{type:"Boolean", notMustHave:true},//是否专业技术平台
professionalTechnologyName:{type:"String", notMustHave:true},//专业技术平台名称
cooperationInstitutions:{type:"String", notMustHave:true},//合作机构名称
isCooperation:{type:"Boolean", notMustHave:true},//是否与第三方机构合作
professionalTechnologyCreateTime:{type:"Number", notMustHave:true},//时间 年份 xxxx年01月01日 的时间戳
professionalTechnologyAmount:{type:"Number", notMustHave:true},//投资金额 万元
};
......@@ -58,6 +60,7 @@ export const OrganizationParamUpdateConfig = {
// personInChargePhone:{type:"String", notMustHave:true},// {key:"负责人联系电话"}, 2.0去掉了
operationModelDes:{type:"String", notMustHave:true},//{key:"运营模式描述"},
foundingTeamType:{type:"Number", notMustHave:true},//{key:"团队类型"}
introduction:{type:"String", notMustHave:true},//孵化器简介 2.3新加
};
/**
* 使用端: 小程序端【孵化器入口】
......@@ -277,3 +280,127 @@ export const ReplenishMyEnterpriseCreateDataConfig = {
leasedArea:{type:"Number"},//租赁面积(平方米)
}
/**
* 使用端: 小程序端【企业入口】
* 场景: 创建新的融资信息
* 备注: 所有参数为必填
*/
export const EnterpriseCreateFinancingDataConfig = {
financingRounds:{type:"Number"},//融资轮次
financingAmount:{type:"Number"}, //融资金额_单位 万元
investmentInstitutionsName:{type:"String"},//投资机构名称
timeToObtainInvestment:{type:"Number"},//获得投资时间时间戳
fuHuaQiInvestment:{type:"Boolean"},//孵化器是否投资
fuHuaQiInvestmentAmount:{type:"Number"},//孵化器投资金额_单位 万元
fuHuaQiInvestmentStyle:{type:"Number"},//孵化器投资方式
}
/**
* 使用端: 小程序端【企业入口】
* 场景: 创建新的融资信息选择了孵化器投资
* 备注:
*/
export const EnterpriseCreateFinancingParamSubConfig = {
fuHuaQiInvestmentAmount:{type:"Number"},
fuHuaQiInvestmentStyle:{type:"Number"}
}
/**
* 使用端: 小程序端【企业入口】
* 场景: 修改融资信息
* 备注: 所有参数为必填
*/
export const EnterpriseUpdateFinancingDataConfig = {
id:{type:"String"},//id
financingRounds:{type:"Number"},//融资轮次
financingAmount:{type:"Number"}, //融资金额_单位 万元
investmentInstitutionsName:{type:"String"},//投资机构名称
timeToObtainInvestment:{type:"Number"},//获得投资时间时间戳
fuHuaQiInvestment:{type:"Boolean"},//孵化器是否投资
fuHuaQiInvestmentAmount:{type:"Number"},//孵化器投资金额_单位 万元
fuHuaQiInvestmentStyle:{type:"Number"},//孵化器投资方式
}
/**
* 使用端: 小程序端【企业入口】
* 场景: 修改企业信息
* 备注: 所有参数为必填
*/
export const EnterpriseUpdateBaseDataConfig = {
name:{type:"String"},//企业名称
uscc:{type:"String"},//统一信用代码
industry:{type:"[Number]"},//领域
mainBusiness:{type:"String"},//主营业务
logonTime:{type:"Number"},//注册时间
firstIncubationTime:{type:"Number"},//首次入孵时间
isNaturalPersonHolding:{type:"Boolean"},//是否自然人控股企业
logonAddress:{type:"Address"},//注册地址
operatingAddress:{type:"Address"},//经营地址
}
/**
* 使用端: 小程序端【企业入口】
* 场景: 申报经营数据
* 备注: 所有参数为必填
*/
export const EnterpriseAddBusinessDataConfig = {
BI:{type:"Number"},//营业收入
RD:{type:"Number"},//研发投入
TXP:{type:"Number"},//纳税
}
/**
* 使用端: 小程序端【企业入口】
* 场景: 申报团队信息数据
* 备注: 所有参数为必填
*/
export const EnterpriseAddTeamDataConfig = {
doctor:{type:"Number"},//博士
master:{type:"Number"},//硕士
undergraduate:{type:"Number"},//本科
juniorCollege:{type:"Number"},//专科
other:{type:"Number"},//其他
studyAbroad:{type:"Number"},//留学人数
graduates:{type:"Number"},//应届毕业生
}
/**
* 使用端: 小程序端【企业入口】
* 场景: 修改企业创始团队
* 备注: 所有参数为必填
*/
export const InitialTeamUpdateConfig = {
type:{type:"Number"},//创始团队人才类型
memberName:{type:"String"},//成员姓名
memberSex:{type:"Number"},//成员性别
memberAge:{type:"Number"},//成员年龄 出生年月时间戳
memberDEGREE:{type:"Number"},//成员最高学历
memberSchool:{type:"String"},//毕业学校
des:{type:"String"},//履历描述
}
/**
* 使用端: 小程序端【企业入口】
* 场景: 企业修改资质信息
* 备注: 所有参数为必填
*/
export const EnterpriseQualificationUpdateConfig = {
isHighTech:{type:"Boolean"},
highTechMs:{type:"Number"},//高新技术
isZjtx:{type:"Boolean"},
zjtxMs:{type:"Number"},//专精特新
isXjrpy:{type:"Boolean"},
xjrpyMs:{type:"Number"},//小巨人培育
isXjr:{type:"Boolean"},
xjrMs:{type:"Number"},//小巨人
beOnTheMarket:{type:"[Number]", notMustHave:true},//上市情况
isBeOnTheMarket:{type:"Boolean"}
}
\ No newline at end of file
......@@ -31,6 +31,15 @@ export enum TEAM {
/**
* 孵化器创业团队 【企业端用】
*/
export enum ENTERPRISETEAM {
国际一流人才=2,
国内一流人才
}
/**
* 运营模式
*/
export enum OPERATIONMODEL {
......@@ -186,54 +195,116 @@ export enum VIRTUALCAUSE{
*/
export enum MOVEOUTTYPE{
企业注销 = 1,
迁出孵化器_仍在张江,
非毕业迁出,//2.3修改
毕业迁出,//2.3修改
// 迁出孵化器_仍在张江,
// 迁出张江_仍在浦东,
// 迁出浦东_仍在上海,
// 迁出上海,
// 毕业迁出,//2.1新加
}
/**
* 迁出去向
* 2.3新加
*/
export enum MOVEOUTTRACE {
迁出孵化器_仍在张江 = 1,
迁出张江_仍在浦东,
迁出浦东_仍在上海,
迁出上海,
毕业迁出,//2.1新加
迁出上海
}
/**
* 迁出原因
* 非毕业迁出原因
* 2.3
*/
export enum MOVEOUTCAUSE{
export enum MOVEOUTCAUSENOTCLIENT {
政策不给力 = 1,
人才需求不足,
经营成本过高_场地成本或人员成本_,
办公空间拓展_无合适办公空间_,
产业环境不足,
其他,
认定高新企业 = 7,//2.1加入 选择毕业迁出之后
企业孵化到期,
其他
}
/**
* 毕业迁出原因
* 2.3
*/
export enum MOVEOUTCAUSECLIENT {
认定高新企业 = 8,
认定专精特新,
累计融资超500万元,
年营业收超1000万元
}
/**
* 迁出原因 前端用 不包含 毕业原因
* 迁出原因
* 2.3
*/
export enum MOVEOUTCAUSE_CLIENT{
export enum MOVEOUTCAUSE {
政策不给力 = 1,
人才需求不足,
经营成本过高_场地成本或人员成本_,
办公空间拓展_无合适办公空间_,
产业环境不足,
其他
}
/**
* 毕业原因
* 2.1新加
*/
export enum GRADUATECAUSE {
认定高新企业 = 7,//2.1加入 选择毕业迁出之后
企业孵化到期,
其他,
认定高新企业 = 8,
认定专精特新,
累计融资超500万元,
年营业收超1000万元
}
// /**
// * 迁出原因
// */
// export enum MOVEOUTCAUSE{
// 政策不给力 = 1,
// 人才需求不足,
// 经营成本过高_场地成本或人员成本_,
// 办公空间拓展_无合适办公空间_,
// 产业环境不足,
// 企业孵化到期,
// 其他,
// 认定高新企业 = 7,//2.1加入 选择毕业迁出之后
// 认定专精特新,
// 累计融资超500万元,
// 年营业收超1000万元
// }
// /**
// * 迁出原因 前端用 不包含 毕业原因
// */
// export enum MOVEOUTCAUSE_CLIENT{
// 政策不给力 = 1,
// 人才需求不足,
// 经营成本过高_场地成本或人员成本_,
// 办公空间拓展_无合适办公空间_,
// 产业环境不足,
// 其他
// }
// /**
// * 毕业原因
// * 2.1新加
// */
// export enum GRADUATECAUSE {
// 认定高新企业 = 7,//2.1加入 选择毕业迁出之后
// 认定专精特新,
// 累计融资超500万元,
// 年营业收超1000万元
// }
/**
* 得分途径
*/
......@@ -270,3 +341,22 @@ export enum SMSTYPE {
信息填报提醒,
创建孵化器提醒
}
/**
* 企业申报数据类型表
*/
export enum ENTERPRISEDECLARATIONTYPE {
经营状况 = 1,
团队信息
}
/**
* 上市情况
*/
export enum LISTINGSITUATION {
A = 1,
科创板,
海外,
}
......@@ -44,7 +44,14 @@ export enum ERRORENUM {
验证码过期,
不能修改过期任务数据,
短信发送失败,
地址数据不完整
地址数据不完整,
字数超过200限制,
只能修改本企业信息,
请勿重复提交填报数据,
未提交填报数据不能修改,
未提交填报数据,
不在填报范围之内,
只能删除本企业信息
}
export enum ERRORCODEENUM {
......
......@@ -227,6 +227,8 @@ export const FuHuaQiBaseDataConfig = {
isProfessionalTechnology:{key:"是否专业技术平台"},
professionalTechnologyName:{key:"专业技术平台名称"},
professionalTechnologyCreateTime:{key:"专业技术平台时间"},
isCooperation:{key:"是否与第三方机构合作"},
cooperationInstitutions:{key:"合作机构名称"},
professionalTechnologyAmount:{key:"专业技术平台投资金额"},
enterpriseTotal:{key:"累计企业"}
}
......@@ -253,7 +255,8 @@ export const OrganizationBaseDataConfig = {
liaisonPhone:{key:"联系电话"},
// personInCharge:{key:"负责人"}, 2.0去掉了
// personInChargePhone:{key:"负责人联系电话"}, 2.0去掉了
operationModelDes:{key:"运营模式描述"}
operationModelDes:{key:"运营模式描述"},
introduction:{key:"简介"} //2.3新加
// hatchingGround:{key:"经备案孵化场地"}
}
......@@ -278,15 +281,67 @@ export const MyEnterpriseDataConfig = {
* 备注: 回显
*/
export const MyEnterpriseBaseDataConfig = {
name: {key:"企业名称"},//
uscc:{key:"统一信用代码" },//
industry:{key:"领域"},//
mainBusiness:{key:"主营业务"},//
logonTime:{key:"注册时间"},//
firstIncubationTime:{key:"首次入孵时间"},//
isNaturalPersonHolding:{key:"是否自然人控股企业"},//
logonAddress:{key:"注册地址"},//
operatingAddress:{key:"经营地址"},//
name: {key:"企业名称"},
uscc:{key:"统一信用代码" },
industry:{key:"领域"},
mainBusiness:{key:"主营业务"},
logonTime:{key:"注册时间"},
firstIncubationTime:{key:"首次入孵时间"},
isNaturalPersonHolding:{key:"是否自然人控股企业"},
logonAddress:{key:"注册地址"},
operatingAddress:{key:"经营地址"},
}
/**=================================================================小程序 => 企业入口配置 */
/**
* 使用端: 小程序端【企业入口】
* 场景: 企业融资列表 和 修改的回显
* 备注: 这里截取的是 financinginfo 表 而不是 financing 表
*/
export const EnterpriseFinancingListDataConfig = {
id:{key:"唯一标识"},
financingRounds:{key:"融资轮次"},
financingAmount:{key:"融资金额_万元"},
investmentInstitutionsName:{key:"投资机构名称"},
timeToObtainInvestment:{key:"获得投资时间"},
fuHuaQiInvestment:{key:"孵化器是否投资"},
fuHuaQiInvestmentAmount:{key:"孵化器投资金额_万元"},
fuHuaQiInvestmentStyle:{key:"孵化器投资方式"},
}
/**
* 使用端: 小程序端【企业入口】
* 场景: 企业信息回显
* 备注:
*/
export const EnterpriseBaseConfig = {
name:{key:"企业名称"},
uscc:{key:"统一信用代码"},
industry:{key:"领域"},
logonTime:{key:"注册时间"},
firstIncubationTime:{key:"首次入孵时间"},
isNaturalPersonHolding:{key:"是否自然人控股企业"},
logonAddress:{key:"注册地址"},
operatingAddress:{key:"经营地址"},
mainBusiness:{key:"主营业务"},
}
/**
* 使用端: 小程序端【企业入口】
* 场景: 企业的团队信息申报回显
* 备注:
*/
export const EnterpriseTeamConfig = {
doctor:{key:"博士"},
master:{key:"硕士"},
undergraduate:{key:"本科"},
juniorCollege:{key:"专科"},
other:{key:"其他"},
studyAbroad:{key:"留学人数"},
graduates:{key:"应届毕业生"},
}
/**
* 企业经营数据
*/
import {Schema} from 'mongoose';
import { baseDB } from '../../db/mongo/dbInit';
const businessSchema = new Schema({
year:{type:Number, index:true},//年度
quarters:{type:Number, index:true},//季度
uscc:{type:String, index:true},
BI:Number,//营业收入
RD:Number,//研发投入
TXP:Number,//纳税
createTime:Number,//填写时间
isSubmit:{type:Boolean, default:false},//是否提交
// isReplenish:{type:Boolean, default:false},//是否补充数据
});
var businessDataModel;
export function initModel(){
businessDataModel = baseDB.model('business', businessSchema);
businessDataModel.selectOnceData = async function (paramater:object) {
let selectInfo = await businessDataModel.findOne(paramater).exec();
if (selectInfo) {
if (!selectInfo.runSave) {
selectInfo.runSave = selectInfo.save;
selectInfo.save = save.bind(selectInfo)
}
}
return selectInfo;
}
}
export async function save(throwError=false) {
if (!this.isModified()) return;
await this.runSave({validateBeforeSave:false}).catch(err=>{
console.log(err);
});
}
/**
* 获取特定企业某年度的经营数据
* @param uscc 企业统一信用代码
* @param year 年度
*/
export async function findBusinessDataByUsccAndYear(uscc:string, year:number) {
return await businessDataModel.find({uscc, year});
}
export async function findBusinessDataByTimeAndUscc(uscc:string, year:number, quarters:number) {
return await businessDataModel.selectOnceData({uscc, year, quarters});
}
export async function findNotSubmitBusinessDataByTimeAndUscc(uscc:string, year:number, quarters:number) {
return await businessDataModel.selectOnceData({uscc, year, quarters, isSubmit:false});
}
export async function createBusinessData(uscc:string, year:number, quarters:number, BI:number, RD:number, TXP:number ) {
let addInfo = {uscc, year, quarters, BI, RD, TXP, createTime:new Date().valueOf() };
await businessDataModel.create(addInfo);
}
\ No newline at end of file
......@@ -7,6 +7,42 @@ import {Schema} from 'mongoose';
import { baseDB } from '../../db/mongo/dbInit';
import { FUHUASTATE } from '../../config/enum';
/**
* 创始团队
*/
const initialTeamSchema = new Schema({
type:Number,//创始团队人才类型
memberName:String,//成员姓名
memberSex:Number,//成员性别
memberAge:Number,//成员年龄 出生年月时间戳
memberDEGREE:Number,//成员最高学历
memberSchool:String,//毕业学校
des:String,//履历描述
},{_id:false});
/**企业资质 */
const qualificationSchema = new Schema({
isHighTech:Boolean,
highTechMs:Number,//高新技术
isZjtx:Boolean,
zjtxMs:Number,//专精特新
isXjrpy:Boolean,
xjrpyMs:Number,//小巨人培育
isXjr:Boolean,
xjrMs:Number,//小巨人
beOnTheMarket:[Number],//上市情况
isBeOnTheMarket:{type:Boolean, default:false}//是否上市
}, {_id:false});
const intellectualPropertySchema = new Schema({
alienPatent:Number,//海外专利
classIPatent:Number,//一类专利
secondClassPatent:Number,//二类专利
}, {_id:false});
const enterpriseSchema = new Schema({
name: {type:String, index: true},//企业名称
taskId:{type:String, index:true},//绑定的任务id
......@@ -28,17 +64,28 @@ const enterpriseSchema = new Schema({
draftLock:{type:Boolean, default:false},//草稿锁,true为提交之后,false为草稿
enterpriseIsInPut:{type:Boolean, default:false},//是否是初始数据 todo 后续要弃用 兼容原始数据无法判断是否是迁入企业这个问题加的字段
draftId:{type:String, index:true},//草稿id 编辑的时候使用这个id 保存之后就不认这个id了
/** 用户相关 */
pwd:String,//登录密码
token:{type:String, index:true},
tokenMs:Number,
firstLoginIsChangePwd:{type:Boolean, default:false},//首次登录是否修改密码
/**孵化状态相关 */
state:{type:Number, default: FUHUASTATE.实体孵化 },//孵化状态 遵循枚举 FUHUASTATE 值 默认实体孵化 ----2.0
virtualCause:Number,//虚拟孵化原因 遵循 VIRTUALCAUSE 的值 ----2.0
virtualCauseDes:String,//虚拟孵化描述 ----2.0
moveOutType:Number,// 迁出类型 遵循 MOVEOUTTYPE 的值 ----2.0
moveOutTrace:Number,//迁出去向 遵循 MOVEOUTTRACE 的值 ----2.3
moveOutCause:[Number],//迁出原因 遵循 MOVEOUTCAUSE 的值 ----2.0
moveOutTime:Number,//迁出时间
/**2.0 后改的地址 */
logonAddress:{type:[String], default:[]},//注册地址
operatingAddress:{type:[String], default:[]},//经营地址
oldLogonAddress:{type:[String], default:[]},//迁入前注册地址
/**3.0新加字段 */
initialTeam:{type:[initialTeamSchema], default:[]},//创始团队
qualification:{type:qualificationSchema},//企业资质
intellectualProperty:{type:intellectualPropertySchema},//知识产权
firstClassTalent:{type:Boolean, default:false},//是否拥有国际一流人才 默认没有
});
var enterpriseModel;
......
......@@ -28,7 +28,6 @@ const financingSchema = new Schema({
/**2.0新加的 */
logonAddress:{type:[String], default:[]},//注册地址
operatingAddress:{type:[String], default:[]},//经营地址
});
var financingModel;
......
/**
* 企业投资详情表
* financing 确定好的数据才会到这里来
*/
import {Schema} from 'mongoose';
import { baseDB } from '../../db/mongo/dbInit';
const financingSchema = new Schema({
id:{type:String, index:true},//唯一标识
uscc:{type:String, index:true},//融资企业统一信用代码 冗余字段
name:String,//企业名称
financingRounds:Number,//融资轮次
financingAmount:Number,//融资金额(万元)
investmentInstitutionsName:String,//投资机构名称
timeToObtainInvestment:Number,//获得投资时间
fuHuaQiInvestment:{type:Boolean, default:false},//孵化器是否投资
fuHuaQiInvestmentAmount:Number,//孵化器投资金额(万元)
fuHuaQiInvestmentStyle:Number,//孵化器投资方式
createTime:Number,//录入时间
type:{type:Number, default:1},//1为 孵化器 2为企业自己添加 3为孵化器添加企业修改
});
var financingInfoModel;
export function initModel(){
financingInfoModel = baseDB.model('financinginfo', financingSchema);
financingInfoModel.selectOnceData = async function (paramater:object) {
let selectInfo = await financingInfoModel.findOne(paramater).exec();
if (selectInfo) {
if (!selectInfo.runSave) {
selectInfo.runSave = selectInfo.save;
selectInfo.save = save.bind(selectInfo)
}
}
return selectInfo;
}
}
export async function save(throwError=false) {
if (!this.isModified()) return;
await this.runSave({validateBeforeSave:false}).catch(err=>{
console.log(err);
});
}
export async function addFinancingInfo(addInfo) {
await financingInfoModel.create(addInfo);
}
/**
* 获取企业融资情况列表
* @param uscc
* @returns
*/
export async function selectFinancingListByUscc(uscc:string) {
return await financingInfoModel.find({uscc});
}
export async function selectFinancingInfo(uscc:string) {
return await financingInfoModel.findOne({uscc});
}
export async function getFinancingById(id:string) {
return await financingInfoModel.selectOnceData({id});
}
export async function deleteFinancingById(id:string) {
return await financingInfoModel.deleteOne({id});
}
\ No newline at end of file
/**
* 企业经营数据补充表
*/
import {Schema} from 'mongoose';
import { baseDB } from '../../db/mongo/dbInit';
const replenishSchema = new Schema({
year:{type:Number, index:true},//年度
quarters:{type:Number, index:true},//季度
uscc:{type:String, index:true},
type:Number,
value:Number,
timeMs:Number,//填写时间
});
var replenishDataModel;
export function initModel(){
replenishDataModel = baseDB.model('replenish', replenishSchema);
replenishDataModel.selectOnceData = async function (paramater:object) {
let selectInfo = await replenishDataModel.findOne(paramater).exec();
if (selectInfo) {
if (!selectInfo.runSave) {
selectInfo.runSave = selectInfo.save;
selectInfo.save = save.bind(selectInfo)
}
}
return selectInfo;
}
}
export async function save(throwError=false) {
if (!this.isModified()) return;
await this.runSave({validateBeforeSave:false}).catch(err=>{
console.log(err);
});
}
/**
* 补充经营数据
* @param uscc 企业统一信用代码
* @param year 年度
* @param quarters 季度
* @param type 类型
* @param value 值
*/
export async function replenishData(uscc:string, year:number, quarters:number, type:number, value:number) {
let addInfo = {uscc, year, quarters, type, value, timeMs:new Date().valueOf() };
await replenishDataModel.create(addInfo);
}
\ No newline at end of file
/**
* 团队信息表
*/
import {Schema} from 'mongoose';
import { baseDB } from '../../db/mongo/dbInit';
/**团队信息 */
const teamSchema = new Schema({
uscc:{type:String, index:true},
year:Number,
quarters:Number,
doctor:Number,//博士
master:Number,//硕士
undergraduate:Number,//本科
juniorCollege:Number,//专科
other:Number,//其他
studyAbroad:Number,//留学人数
graduates:Number,//应届毕业生
createMs:Number,//填报时间
isSubmit:{type:Boolean, default:false}//是否提交
});
var teamModel;
export function initModel(){
teamModel = baseDB.model('team', teamSchema);
teamModel.selectOnceData = async function (paramater:object) {
let selectInfo = await teamModel.findOne(paramater).exec();
if (selectInfo) {
if (!selectInfo.runSave) {
selectInfo.runSave = selectInfo.save;
selectInfo.save = save.bind(selectInfo)
}
}
return selectInfo;
}
}
export async function save(throwError=false) {
if (!this.isModified()) return;
await this.runSave({validateBeforeSave:false}).catch(err=>{
console.log(err);
});
}
/**
* 查询特定时间的企业团队信息数据
* @param uscc 企业统一信用代码
* @param year 年度
* @param quarters 季度
* @returns
*/
export async function findTeamByUsccAndTime(uscc:string, year:number, quarters:number) {
return await teamModel.selectOnceData({uscc, year, quarters});
}
export async function findNotSubmitTeamByUsccAndTime(uscc:string, year:number, quarters:number) {
return await teamModel.selectOnceData({uscc, year, quarters, isSubmit:false});
}
/**
* 获取企业最新的团队数据
* @param uscc
* @returns
*/
export async function findEnterpriseNewTeamData(uscc:string) {
let list = await teamModel.find({ uscc, isSubmit:true }).sort({"createMs":-1}).limit(1);
return list[0] || {};
}
export async function addTeamData(addInfo) {
await teamModel.create(addInfo);
}
\ No newline at end of file
......@@ -55,6 +55,8 @@ const fuHuaQiSchema = new Schema({
professionalTechnologyName:String,//专业技术平台名称
professionalTechnologyCreateTime:Number,//时间 年份 xxxx年01月01日 的时间戳
professionalTechnologyAmount:Number,//投资金额 万元
isCooperation:{type:Boolean, default:false},//是否与第三方合作
cooperationInstitutions:{type:String, default:""},//合作机构名称
/** 累计孵化企业数量*/
fuHuaEnterpriseTotal:{type:Number, default:0},//累计孵化企业数量 初始值
/**用户相关 */
......@@ -67,6 +69,8 @@ const fuHuaQiSchema = new Schema({
/**绑定账号相关 */
bindDeviceId:String,//绑定时的设备号
bindId:{type:String},//绑定标识
/**2.3加入字段 */
introduction:{type:String, default:""},//孵化器简介
});
var fuHuaQiModel;
......
......@@ -71,3 +71,19 @@ export async function getUptotheminuteScore(startTimeMs:number, endTimeMs:number
{"$group":{_id:"$uscc", maxScore:{"$last":"$score"} } }
]);
}
/**
* 添加得分日志 初始化用
* @param ways 途径
* @param changeMode 增加或减少
* @param uscc 孵化器uscc
* @param score 分数
* @param addScore 增加/删除分数
* @param taskType 任务类型 选填
*/
export async function addLogTOInitData(uscc:string, ways:number, changeMode:number, score:number, addScore:number, timeMs:number, taskType?) {
let addInfo:any = {uscc, ways, changeMode, score, addScore, timeMs };
if (taskType) addInfo.taskType = taskType;
await fuHuaQiScoreLogModel.create(addInfo);
}
......@@ -9,6 +9,11 @@ import * as scoreLogModel from "../../data/fuHuaQi/scoreLog";
import * as codeModel from "../../data/fuHuaQi/code";
import * as smsPointOutModel from "../../data/fuHuaQi/smsPointOut";
import * as businessdataModel from "../../data/enterprise/businessdata";
import * as financingInfoModel from "../../data/enterprise/financingInfo";
import * as teamModel from "../../data/enterprise/team";
export async function initTable() {
taskinModel.initModel();
fuhuaqiinModel.initModel();
......@@ -20,4 +25,8 @@ export async function initTable() {
scoreLogModel.initModel();
codeModel.initModel();
smsPointOutModel.initModel();
businessdataModel.initModel();
financingInfoModel.initModel();
teamModel.initModel();
}
\ No newline at end of file
import { ERRORENUM } from "../config/errorEnum";
import { findEnterpriseByUscc } from "../data/enterprise/enterprise";
import { findFuHuaQiByUSCC } from "../data/fuHuaQi/fuhuaqi";
import { findGuanWeiHuiUserInfoByLoginId } from "../data/guanWeiHui/guanweihui";
import { BizError } from "../util/bizError";
......@@ -61,7 +62,35 @@ export async function checkGuanWeiHuiToken(req, res, next) {
/**
* 中间件 校验管委会token
* 中间件 校验企业token
* @param req
* @param res
* @param next
* @returns
*/
export async function checkEnterpriseToken(req, res, next) {
if (!req.headers) req.headers = {};
const reqToken = req.headers.token;
const userId = req.headers.userid || "";
if (!userId) return next(new BizError(ERRORENUM.身份验证失败, `userId:${userId} token:${reqToken}`));
let userInfo = await findEnterpriseByUscc(userId);
if (!userInfo) return next(new BizError(ERRORENUM.非法登录, `userId:${userId} token:${reqToken}`));
/**2023-2-8日需求 登录一次一直有效 */
// if (userInfo.token != reqToken || (new Date().valueOf() - userInfo.tokenMs) > (3600*100*24*7) ) return next(new BizError(ERRORENUM.身份验证过期, `userId:${userId} token:${reqToken}`));
if (userInfo.token != reqToken ) return next(new BizError(ERRORENUM.身份验证过期, `userId:${userId} token:${reqToken}`));
req.headers.uscc = req.headers.userid;
next();
}
/**
* 中间件 数据维护接口
* @param req
* @param res
* @param next
......
/**
* 小程序端 企业入口 用户基础功能路由
*/
import * as asyncHandler from 'express-async-handler';
import { checkEnterpriseToken } from '../../middleware/user';
import { eccReqParamater } from '../../util/verificationParam';
import * as enterpriseBiz from '../../biz/mobileEnterprise/enterprise';
export function setRouter(httpServer) {
/**首页 */
httpServer.post('/enterprise/base/headeinfo', checkEnterpriseToken, asyncHandler(homePageHeaderInfo));
/**基本信息 */
httpServer.post('/enterprise/base/info', checkEnterpriseToken, asyncHandler(baseInfo));
httpServer.post('/enterprise/base/update', checkEnterpriseToken, asyncHandler(updateBaseInfo));
/**创始团队 */
httpServer.post('/enterprise/initialteam/update', checkEnterpriseToken, asyncHandler(updateTeamsState));
httpServer.post('/enterprise/initialteam/info', checkEnterpriseToken, asyncHandler(initialTeamInfo));
/**知识产权 */
httpServer.post('/enterprise/intellectualproperty/update', checkEnterpriseToken, asyncHandler(updateIntellectualproperty));
httpServer.post('/enterprise/intellectualproperty/info', checkEnterpriseToken, asyncHandler(intellectualpropertyInfo));
/**企业资质 */
httpServer.post('/enterprise/qualification/update', checkEnterpriseToken, asyncHandler(updateQualification));
httpServer.post('/enterprise/qualification/info', checkEnterpriseToken, asyncHandler(qualificationInfo));
}
/**
* 首页数据 顶部信息
* @param req
* @param res
*/
async function homePageHeaderInfo(req, res) {
const Uscc = req.headers.uscc;
let result = await enterpriseBiz.getHomePageHeaderData(Uscc);
res.success(result);
}
/**
* 修改团队状态
* @param req
* @param res
*/
async function updateTeamsState(req, res) {
const Uscc = req.headers.uscc;
let reqConf = {firstClassTalent:'Boolean', teams:'[Object]'};
let {firstClassTalent, teams} = eccReqParamater(reqConf, req.body, ["teams"]);
let result = await enterpriseBiz.updateInitialTeamInfo(Uscc, firstClassTalent, teams);
res.success(result);
}
/**
* 创始团队信息
* @param req
* @param res
*/
async function initialTeamInfo(req, res) {
const Uscc = req.headers.uscc;
let result = await enterpriseBiz.selectInitialTeamInfo(Uscc);
res.success(result);
}
/**
* 修改知识产权信息
* @param req
* @param res
*/
async function updateIntellectualproperty(req, res) {
const Uscc = req.headers.uscc;
let reqConf = {alienPatent:'Number', classIPatent:'Number', secondClassPatent:'Number'};
let {alienPatent, classIPatent, secondClassPatent} = eccReqParamater(reqConf, req.body);
let result = await enterpriseBiz.updateIntellectualProperty(Uscc, alienPatent, classIPatent, secondClassPatent);
res.success(result);
}
/**
* 查询知识产权信息
* @param req
* @param res
*/
async function intellectualpropertyInfo(req, res) {
const Uscc = req.headers.uscc;
let result = await enterpriseBiz.selectIntellectualProperty(Uscc);
res.success(result);
}
/**
* 查询企业资质信息
* @param req
* @param res
*/
async function qualificationInfo(req, res) {
const Uscc = req.headers.uscc;
let result = await enterpriseBiz.selectQualification(Uscc);
res.success(result);
}
/**
* 修改知识产权信息
* @param req
* @param res
*/
async function updateQualification(req, res) {
const Uscc = req.headers.uscc;
let reqConf = {form:'Object'};
let {form} = eccReqParamater(reqConf, req.body);
let result = await enterpriseBiz.updateQualification(Uscc, form);
res.success(result);
}
/**
* 修改企业基本信息
* @param req
* @param res
*/
async function updateBaseInfo(req, res) {
const Uscc = req.headers.uscc;
let reqConf = {form:'Object'};
let {form} = eccReqParamater(reqConf, req.body);
let result = await enterpriseBiz.updateEnterpriseBaseInfo(Uscc, form);
res.success(result);
}
/**
* 查询企业基本信息
* @param req
* @param res
*/
async function baseInfo(req, res) {
const Uscc = req.headers.uscc;
let result = await enterpriseBiz.enterpriseBaseInfo(Uscc);
res.success(result);
}
\ No newline at end of file
/**
* 小程序端 企业入口 经营数据接口
*/
import * as asyncHandler from 'express-async-handler';
import { checkEnterpriseToken } from '../../middleware/user';
import * as businessDataBiz from '../../biz/mobileEnterprise/businessData';
export function setRouter(httpServer) {
httpServer.post('/enterprise/businessdata/homepage', checkEnterpriseToken, asyncHandler(homePageBusinessData));
/**可修改的经营数据 */
httpServer.post('/enterprise/businessdata/', checkEnterpriseToken, asyncHandler(homePageBusinessData));
}
/**
* 首页经营数据
* @param req
* @param res
*/
async function homePageBusinessData(req, res) {
const Uscc = req.headers.uscc;
let result = await businessDataBiz.getBusinessData(Uscc);
res.success(result);
}
\ No newline at end of file
/**
* 小程序端 企业入口 数据申报相关接口
*/
import * as asyncHandler from 'express-async-handler';
import { checkEnterpriseToken } from '../../middleware/user';
import * as dataDeclarationBiz from '../../biz/mobileEnterprise/dataDeclaration';
import { eccReqParamater } from '../../util/verificationParam';
export function setRouter(httpServer) {
httpServer.post('/enterprise/datadeclaration/todo', checkEnterpriseToken, asyncHandler(unsubmitted));
httpServer.post('/enterprise/datadeclaration/completed', checkEnterpriseToken, asyncHandler(completed));
httpServer.post('/enterprise/datadeclaration/submit', checkEnterpriseToken, asyncHandler(submitDataDeclaration) );
/**经营数据 */
httpServer.post('/enterprise/datadeclaration/businessdata/add', checkEnterpriseToken, asyncHandler(addBusiness));
httpServer.post('/enterprise/datadeclaration/businessdata/update', checkEnterpriseToken, asyncHandler(updateBusiness));
httpServer.post('/enterprise/datadeclaration/businessdata/info', checkEnterpriseToken, asyncHandler(businessInfo));
/**团队数据 */
httpServer.post('/enterprise/datadeclaration/team/add', checkEnterpriseToken, asyncHandler(addTeamData));
httpServer.post('/enterprise/datadeclaration/team/info', checkEnterpriseToken, asyncHandler(teamInfo));
httpServer.post('/enterprise/datadeclaration/team/update', checkEnterpriseToken, asyncHandler(updateTeamData));
}
/**
* 待申报列表
* @param req
* @param res
*/
async function unsubmitted(req, res) {
const Uscc = req.headers.uscc;
let result = await dataDeclarationBiz.todoList(Uscc);
res.success(result);
}
/**
* 已申报列表
* @param req
* @param res
*/
async function completed(req, res) {
let reqConf = {year:'Number', quarters:'Number'};
let {year, quarters} = eccReqParamater(reqConf, req.body);
const Uscc = req.headers.uscc;
let result = await dataDeclarationBiz.completedList(Uscc, year, quarters);
res.success(result);
}
/**
* 提交申报经营状况数据
* @param req
* @param res
*/
async function addBusiness(req, res) {
let reqConf = {BI:'Number', RD:'Number', TXP:'Number'};
let {BI, RD, TXP} = eccReqParamater(reqConf, req.body);
const Uscc = req.headers.uscc;
let result = await dataDeclarationBiz.addBusinessData(Uscc, BI, RD, TXP);
res.success(result);
}
/**
* 修改经营状况数据
* @param req
* @param res
*/
async function updateBusiness(req, res) {
let reqConf = {BI:'Number', RD:'Number', TXP:'Number'};
let {BI, RD, TXP} = eccReqParamater(reqConf, req.body);
const Uscc = req.headers.uscc;
let result = await dataDeclarationBiz.updateBusinessData(Uscc, BI, RD, TXP);
res.success(result);
}
/**
* 经营状况数据详情
* 回显
* @param req
* @param res
*/
async function businessInfo(req, res) {
const Uscc = req.headers.uscc;
let result = await dataDeclarationBiz.businessInfo(Uscc );
res.success(result);
}
/**
* 添加团队信息数据
* @param req
* @param res
*/
async function addTeamData(req, res) {
const Uscc = req.headers.uscc;
let reqConf = {form:'Object'};
let { form } = eccReqParamater(reqConf, req.body);
let result = await dataDeclarationBiz.addTeamInfo(Uscc, form);
res.success(result);
}
/**
* 团队信息数据
* 回显
* @param req
* @param res
*/
async function teamInfo(req, res) {
const Uscc = req.headers.uscc;
let result = await dataDeclarationBiz.getTeamInfo(Uscc );
res.success(result);
}
/**
* 修改团队信息数据
* @param req
* @param res
*/
async function updateTeamData(req, res) {
const Uscc = req.headers.uscc;
let reqConf = {form:'Object'};
let { form } = eccReqParamater(reqConf, req.body);
let result = await dataDeclarationBiz.updateTeamInfo(Uscc, form);
res.success(result);
}
/**
* 修改团队信息数据
* @param req
* @param res
*/
async function submitDataDeclaration(req, res) {
const Uscc = req.headers.uscc;
let reqConf = {type:'Number'};
let { type } = eccReqParamater(reqConf, req.body);
let result = await dataDeclarationBiz.submit(Uscc, type);
res.success(result);
}
/**
* 小程序端 企业入口 融资相关接口
*/
import * as asyncHandler from 'express-async-handler';
import { checkEnterpriseToken } from '../../middleware/user';
import * as financingBiz from '../../biz/mobileEnterprise/financing';
import { eccReqParamater } from '../../util/verificationParam';
export function setRouter(httpServer) {
httpServer.post('/enterprise/financing/list', checkEnterpriseToken, asyncHandler(financingList));
httpServer.post('/enterprise/financing/add', checkEnterpriseToken, asyncHandler(addFinancing));
httpServer.post('/enterprise/financing/info', checkEnterpriseToken, asyncHandler(financingInfo));
httpServer.post('/enterprise/financing/update', checkEnterpriseToken, asyncHandler(updateFinancing));
httpServer.post('/enterprise/financing/del', checkEnterpriseToken, asyncHandler(deleteFinancing));
}
/**
* 融资列表
* @param req
* @param res
*/
async function financingList(req, res) {
const Uscc = req.headers.uscc;
let result = await financingBiz.getEnterpriseFinancingList(Uscc);
res.success(result);
}
/**
* 添加融资信息
* @param req
* @param res
*/
async function addFinancing(req, res) {
const Uscc = req.headers.uscc;
let reqConf = {form:'Object'};
let {form} = eccReqParamater(reqConf, req.body);
let result = await financingBiz.addEnterpriseFinancing(Uscc, form);
res.success(result);
}
/**
* 回显融资信息
* @param req
* @param res
*/
async function financingInfo(req, res) {
const Uscc = req.headers.uscc;
let reqConf = {id:'String'};
let {id} = eccReqParamater(reqConf, req.body);
let result = await financingBiz.getEnterpriseFinancingInfo(Uscc, id);
res.success(result);
}
/**
* 修改融资信息
* @param req
* @param res
*/
async function updateFinancing(req, res) {
const Uscc = req.headers.uscc;
let reqConf = {form:'Object'};
let {form} = eccReqParamater(reqConf, req.body);
let result = await financingBiz.updateEnterpriseFinancingInfo(Uscc, form);
res.success(result);
}
/**
* 删除融资信息
* @param req
* @param res
*/
async function deleteFinancing(req, res) {
const Uscc = req.headers.uscc;
let reqConf = {id:'String'};
let {id} = eccReqParamater(reqConf, req.body);
let result = await financingBiz.deleteEnterpriseFinancingInfo(Uscc, id);
res.success(result);
}
\ No newline at end of file
/**
* 小程序端 企业入口 用户基础功能路由
*/
import * as asyncHandler from 'express-async-handler';
import * as userBiz from '../../biz/mobileEnterprise/user';
import { eccReqParamater } from '../../util/verificationParam';
import { checkEnterpriseToken } from '../../middleware/user';
export function setRouter(httpServer) {
httpServer.post('/enterprise/login', asyncHandler(login));
httpServer.post('/enterprise/user/firstchangepwd', checkEnterpriseToken, asyncHandler(firstLoginChangeEnterprisePwd));
}
/**
* 企业登录
* @param req
* @param res
*/
async function login(req, res) {
let reqConf = {uscc:'String', pwd:'String'};
let {uscc, pwd} = eccReqParamater(reqConf, req.body);
let result = await userBiz.enterpriseLogin(uscc, pwd);
res.success(result);
}
/**
* 首次登录修改密码
* @param req
* @param res
*/
async function firstLoginChangeEnterprisePwd(req, res) {
let reqConf = {confirmPwd:'String', pwd:'String'};
let {confirmPwd, pwd} = eccReqParamater(reqConf, req.body);
const Uscc = req.headers.uscc;
let result = await userBiz.firstChangePwd(Uscc, pwd, confirmPwd);
res.success(result);
}
......@@ -219,11 +219,12 @@ async function updateVirtual(req, res) {
* @param res
*/
async function updateMoveOut(req, res) {
let reqConf = {moveOutType: 'Number', uscc:"String" , moveOutCause:"[Number]"};
let { moveOutType, uscc, moveOutCause} = await eccReqParamater(reqConf, req.body, );
let reqConf = {moveOutType: 'Number', uscc:"String" , moveOutTrace:"Number", moveOutCause:"[Number]"};
const skipList = ["moveOutTrace", "moveOutCause"];
let { moveOutType, uscc, moveOutCause, moveOutTrace } = await eccReqParamater(reqConf, req.body, skipList);
const FuHuaQiUscc = req.headers.uscc;
let result = await enterpriseBiz.updateMoveOutInfo(FuHuaQiUscc, uscc, moveOutType, moveOutCause);
let result = await enterpriseBiz.updateMoveOutInfo(FuHuaQiUscc, uscc, moveOutType, moveOutTrace, moveOutCause);
res.success(result);
}
......
......@@ -14,7 +14,7 @@ import { checkFuHuaQiToken } from '../../middleware/user';
export function setRouter(httpServer) {
httpServer.post('/fuhuaqi/base', checkFuHuaQiToken, asyncHandler(baseInfo));
/**我的数据 */
httpServer.post('/fuhuaqi/mydata', checkFuHuaQiToken, asyncHandler(myDataInfo));//todo 后续这里的路由要改成 /fuhuaqi/base/mydata 改了要通知前端更改
httpServer.post('/fuhuaqi/base/mydata', checkFuHuaQiToken, asyncHandler(myDataInfo));
httpServer.post('/fuhuaqi/base/update', checkFuHuaQiToken, asyncHandler(updateMyDataInfo));
/**机构信息(我的信息) */
httpServer.post('/fuhuaqi/organization/info', checkFuHuaQiToken, asyncHandler(organizationInfo));
......
......@@ -16,6 +16,8 @@ export function setRouter(httpServer) {
httpServer.post('/admin/provide/task/replenishtaskcount',checkInterior, asyncHandler(replenishTaskCount));
/**2.1 */
httpServer.post('/admin/provide/data/updateadd',checkInterior, asyncHandler(updateAddress));
/**3.0 */
httpServer.post('/admin/provide/enterprise/enterpriseinfo',checkInterior, asyncHandler(enterpriseInfo));
}
......@@ -79,3 +81,8 @@ async function updateAddress(req, res) {
await provideBiz.updateAdd();
res.success({isUsccess:true});
}
async function enterpriseInfo(req, res) {
await provideBiz.updateEnterpriseDataInfo();
res.success({isUsccess:true});
}
\ No newline at end of file
......@@ -3,7 +3,7 @@
*/
import * as asyncHandler from 'express-async-handler';
import { FUHUAQILV, INSTITUTIONALNATURE, FUHUAINDUSTRY, INDUSTRY, FUHUAQILNVESTMENTSTYLE, OPERATIONMODEL, TEAM, DEGREE, FINANCINGROUNDS, INSIDESTATE, VIRTUALCAUSE, MOVEOUTTYPE, MOVEOUTCAUSE, GRADUATECAUSE, MOVEOUTCAUSE_CLIENT } from '../config/enum';
import { FUHUAQILV, INSTITUTIONALNATURE, FUHUAINDUSTRY, INDUSTRY, FUHUAQILNVESTMENTSTYLE, OPERATIONMODEL, TEAM, DEGREE, FINANCINGROUNDS, INSIDESTATE, VIRTUALCAUSE, MOVEOUTTYPE, MOVEOUTCAUSE, MOVEOUTCAUSECLIENT, MOVEOUTCAUSENOTCLIENT, MOVEOUTTRACE, ENTERPRISETEAM, LISTINGSITUATION } from '../config/enum';
export function setRouter(httpServer) {
httpServer.post('/public/fuhuaqilv', asyncHandler(getFuHuaQiLv));
......@@ -22,19 +22,83 @@ export function setRouter(httpServer) {
httpServer.post('/public/moveoutcause', asyncHandler(moveOutCause));
/**2.1 */
httpServer.post('/public/graduatecause', asyncHandler(graduateCauseType));
/**2.3 */
httpServer.post('/public/moveouttrace', asyncHandler(moveOutTrace) );
/**3.0 */
httpServer.post('/public/enterpriseteam', asyncHandler(initTeam) );
httpServer.post('/public/listingsituation', asyncHandler(listingSituation) );
}
/**
* 小程序端 上市情况
* @param req
* @param res
*/
function listingSituation(req, res) {
let dataList = [];
for (let key in LISTINGSITUATION) {
let anyKey:any = key;
if (isNaN(anyKey)) {
let keyStr = key;
dataList.push({key:keyStr, value:LISTINGSITUATION[key]});
}
}
res.success({dataList});
}
/**
* 迁出类型
* 小程序端 企业创始团队
* @param req
* @param res
*/
function initTeam(req, res) {
let dataList = [];
for (let key in ENTERPRISETEAM) {
let anyKey:any = key;
if (isNaN(anyKey)) {
let keyStr = key;
dataList.push({key:keyStr, value:ENTERPRISETEAM[key]});
}
}
res.success({dataList});
}
/**
* 迁出去向
* @param req
* @param res
*/
function moveOutTrace(req, res) {
let dataList = [];
for (let key in MOVEOUTTRACE) {
let anyKey:any = key;
if (isNaN(anyKey)) {
let keyStr = key;
if (keyStr == "迁出孵化器_仍在张江" || keyStr == "迁出张江_仍在浦东" || keyStr == "迁出浦东_仍在上海") {
keyStr = keyStr.replace("_",",");
}
dataList.push({key:keyStr, value:MOVEOUTTRACE[key]});
}
}
res.success({dataList});
}
/**
* 毕业迁出原因
*/
function graduateCauseType(req, res) {
let dataList = [];
for (let key in GRADUATECAUSE) {
for (let key in MOVEOUTCAUSECLIENT) {
let anyKey:any = key;
if (isNaN(anyKey)) {
let keyStr = key;
dataList.push({key:keyStr, value:GRADUATECAUSE[key]});
dataList.push({key:keyStr, value:MOVEOUTCAUSECLIENT[key]});
}
}
res.success({dataList});
......@@ -62,11 +126,11 @@ function moveOutType(req, res) {
/**
* 迁出原因
* 非毕业迁出原因
*/
function moveOutCause(req, res) {
let dataList = [];
for (let key in MOVEOUTCAUSE_CLIENT) {
for (let key in MOVEOUTCAUSENOTCLIENT) {
let anyKey:any = key;
if (isNaN(anyKey)) {
let keyStr = key;
......@@ -75,7 +139,7 @@ function moveOutCause(req, res) {
keyStr = keyStr.replace("_",")");
}
dataList.push({key:keyStr, value:MOVEOUTCAUSE_CLIENT[key]});
dataList.push({key:keyStr, value:MOVEOUTCAUSENOTCLIENT[key]});
}
}
res.success({dataList});
......
......@@ -17,6 +17,12 @@ import * as adminTaskRouters from './admin/task';
import * as provideRouters from './provide';
import * as enterpriseMobileBaseRouters from './enterpriseMobileClient/base';
import * as enterpriseMobileBusinessdataRouters from './enterpriseMobileClient/businessdata';
import * as enterpriseMobileDatadeclarationRouters from './enterpriseMobileClient/datadeclaration';
import * as enterpriseMobileUserRouters from './enterpriseMobileClient/user';
import * as enterpriseMobileFinancingRouters from './enterpriseMobileClient/financing';
export function setRouter(httpServer){
/**下拉框等公用 路由 */
......@@ -35,4 +41,10 @@ export function setRouter(httpServer){
adminTaskRouters.setRouter(httpServer);
/**系统维护 入口路由 */
provideRouters.setRouter(httpServer);
/**小程序企业端 入口路由 */
enterpriseMobileBaseRouters.setRouter(httpServer);
enterpriseMobileBusinessdataRouters.setRouter(httpServer);
enterpriseMobileDatadeclarationRouters.setRouter(httpServer);
enterpriseMobileUserRouters.setRouter(httpServer);
enterpriseMobileFinancingRouters.setRouter(httpServer);
}
\ No newline at end of file
......@@ -169,3 +169,11 @@ export function getSMSCode() {
}
/**
* 获取融资id
* @param uscc
* @returns
*/
export function getFinancingId(uscc) {
return md5(`${uscc}${new Date().valueOf()}${Math.ceil(Math.random() * 1000)}`);
}
\ No newline at end of file
......@@ -9,6 +9,8 @@ import { BizError } from "./bizError";
/**
* 校验value是否符合传入的枚举
* @param name 被掉用名称 用于输出异常日志
* @param key 目标字段 用于输出异常日志
* @param enumConf 目标枚举
* @param value 目标值
* 无返回 有异常直接报错
......
......@@ -11,30 +11,34 @@ import { BizError } from "./bizError";
* 包括类型 String, Number, Boolean, [Number], [Object]
* 参数是必填
* 方法会校验表单中存在的多余字段
* todo 后续优化配置
* @param name 被调用的方法名
* @param config 校验配置
* @param param 需要校验的参数
* @returns true 无需关注返回
*/
export function eccFormParam(name:string, keyTypeConf:object, param:object) {
/**校验多余字段 */
for (let key in param) {
if (!keyTypeConf[key]) throw new BizError(ERRORENUM.参数错误, `多余${key}字段`);
}
/**校验已填参数 */
for (let key in keyTypeConf ) {
let {type, notMustHave} = keyTypeConf[key];
let isError = false; //校验是否异常
let errorStr = "";//异常说明
if ( (typeof param[key] != 'boolean' && !param[key] ) ) {
if (!notMustHave) {
isError = true;
errorStr = `缺失${key}字段`;
let value = param[key];
let valueType = typeof value;
if ( (value == null || value == undefined ) && !notMustHave ) {
throw new BizError(ERRORENUM.参数错误, `缺失${key}字段`);
}
} else if (param[key]) {
let paramType = typeof param[key];
let confType = keyTypeConf[key].type;
switch(confType) {
switch(type) {
case 'Number':
if ( paramType != 'number' ) {
if ( type.toLowerCase() != valueType ) {
isError = true;
} else {
if ((""+param[key]).indexOf('.') > -1) {
......@@ -43,10 +47,8 @@ export function eccFormParam(name:string, keyTypeConf:object, param:object) {
}
break;
case 'String':
if ( paramType != 'string' ) isError = true;
break;
case 'Boolean':
if ( paramType != 'boolean' ) isError = true;
if ( type.toLowerCase() != valueType ) isError = true;
break;
case '[Number]':
if ( !Array.isArray(param[key]) ) isError = true;
......@@ -102,16 +104,10 @@ export function eccFormParam(name:string, keyTypeConf:object, param:object) {
break;
}
errorStr = isError && errorStr == "" ? `${key}应该是${type}型 而不是${paramType}`: errorStr;
}
errorStr = isError && errorStr == "" ? `${key}应该是${type}型 而不是${valueType}`: errorStr;
if ( isError ) throw new BizError(ERRORENUM.表单校验失败, name, errorStr);
}
/**判断多余的参数 */
for (let key in param) {
if (!keyTypeConf[key]) throw new BizError(ERRORENUM.表单校验失败, name, `多余${key}字段`);
}
return true;
}
......@@ -124,31 +120,42 @@ export function eccFormParam(name:string, keyTypeConf:object, param:object) {
*/
export function eccReqParamater(conf:object, param, skipKeys?) {
skipKeys = skipKeys || [];
let skipMap = {};
skipKeys.forEach(keyName => {
skipMap[keyName] = 1;
});
/**校验多余字段 */
for (let key in param) {
if (!conf[key]) throw new BizError(ERRORENUM.参数错误, `多余${key}字段`);
}
/**校验必填和缺失字段 */
for (let key in conf) {
let type = conf[key];
let confType = conf[key];
let value = param[key];
let valueType = typeof value;
let isError = false; //校验是否异常
let errorStr = "";//异常说明
if ( (typeof value != 'boolean') && !value ) {
if (skipKeys.indexOf(key) < 0 ) {
isError = true;
errorStr = `缺少 ${key} 字段`;
if ( (value == null || value == undefined ) && !skipMap[key] ) {
throw new BizError(ERRORENUM.参数错误, `缺失${key}字段`);
}
} else if(param[key]) {
let paramType = typeof param[key];
switch(conf[key]) {
let isError = false;
let errorStr = "";
switch(confType) {
case 'Number':
if ( paramType != 'number' ) {
isError = true;
if ( confType.toLowerCase() != valueType ) isError = true;
else {
if ((""+param[key]).indexOf('.') > -1) {
param[key] = parseInt(`${param[key] *100}`)/100;
}
}
break;
case 'String':
if ( paramType != 'string' ) isError = true;
break;
case 'Boolean':
if ( paramType != 'boolean' ) isError = true;
if ( confType.toLowerCase() != valueType ) isError = true;
break;
case '[Number]':
if ( !Array.isArray(param[key]) ) isError = true;
......@@ -204,14 +211,10 @@ export function eccReqParamater(conf:object, param, skipKeys?) {
break;
}
errorStr = isError && errorStr == "" ? `${key}应该是${type}型 而不是${paramType}`: errorStr;
}
errorStr = isError && errorStr == "" ? `${key}应该是${confType}型 而不是${valueType}`: errorStr;
if (isError) throw new BizError(ERRORENUM.参数错误, errorStr);
}
for (let key in param) {
if (!conf[key]) throw new BizError(ERRORENUM.参数错误, `多余${key}字段`);
}
return param;
}
\ No newline at end of file
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