Commit f4443e74 by lixinming

企业埋点

parent c7c9dfc9
/**
* 管理后台 数字看板 孵化器看板 主要逻辑
* 作者:lxm
*/
import { FUHUASTATE } from "../../../config/enum";
import { ERRORENUM } from "../../../config/errorEnum";
import { StarConfig } from "../../../config/scoreConfig";
import { findEnterpriseCount, findEnterpriseCountByFuHuaQiUscc } from "../../../data/enterprise/enterprise";
import { findFuHuaQiByUSCC } from "../../../data/fuHuaQi/fuhuaqi";
import * as i18nRegisterData from "../../../data/fuHuaQi/instituQualify/i18nRegister";
import * as zjBeyondLayoutData from "../../../data/fuHuaQi/instituQualify/zjBeyondLayout";
import { findMonthTableList } from "../../../data/fuHuaQi/monthTask/monthTable";
import * as scoreData from "../../../data/fuHuaQi/score";
import { BizError } from "../../../util/bizError";
/**
* 获取孵化器基本信息
* @param uscc 孵化器统一信用代码
*/
export async function fuHuaQiBaseData(uscc:string) {
let fuHuaQiInfo = await findFuHuaQiByUSCC(uscc);
if (!fuHuaQiInfo || !fuHuaQiInfo.uscc) throw new BizError(ERRORENUM.不合规操作);
/**基本信息 */
let name = fuHuaQiInfo.name; //名称
let acreageTotal = fuHuaQiInfo.acreageTotal; //孵化器总面积(㎡)
let incubatedAcreage = fuHuaQiInfo.incubatedAcreage; //在孵面积(㎡)
let acreagePersonalUse = fuHuaQiInfo.acreagePersonalUse; //孵化器自用面积(㎡)
let foundingTeamCount = fuHuaQiInfo.foundingTeam ? fuHuaQiInfo.foundingTeam.length : 0; //创业团队
let hatchingGroundCount = fuHuaQiInfo.hatchingGround ? fuHuaQiInfo.hatchingGround.length : 0; //经备案孵化场地
//张江以为布局数量+国际化登记数量=基地数量
let baseCount = await i18nRegisterData.getCount(uscc) + await zjBeyondLayoutData.getCount(uscc);
const BaseData = {
name, acreageTotal, incubatedAcreage, acreagePersonalUse, foundingTeamCount, hatchingGroundCount, baseCount
};
const FuHuaQiData = {
operationName:fuHuaQiInfo.operationName,//运营机构名称 不可修改
name,//名称
uscc:fuHuaQiInfo.uscc,//统一信用代码 也是登录账号 不可修改
lv:fuHuaQiInfo.lv,//孵化器级别
identificationTime:fuHuaQiInfo.identificationTime,//认定时间
industry:fuHuaQiInfo.industry,//孵化领域
institutionalNature:fuHuaQiInfo.institutionalNature,//机构性质
isCreatePTP:fuHuaQiInfo.isCreatePTP,//是成立创投基金
liaison:fuHuaQiInfo.liaison,//联系人
personInCharge:fuHuaQiInfo.personInCharge,//负责人
personInChargePhone:fuHuaQiInfo.personInChargePhone,//负责人联系电话
introduction:fuHuaQiInfo.introduction,//孵化器简介
};
let scoreInfoData = await scoreData.findFuHuaQiScoreInfo(uscc);
let { startScore, myDataScore, baseDataScore, myEnterpriseScore, taskScore } = scoreInfoData;
let count = Math.ceil(startScore +myDataScore +baseDataScore +myEnterpriseScore +taskScore);
let newStar = starCount(count);
let keyList = [
"name", "acreageTotal", "incubatedAcreage", "acreagePersonalUse", "foundingTeamCount", "hatchingGroundCount",
"operationName", "name", "uscc", "lv", "identificationTime", "industry", "institutionalNature", "isParticipateInPTP", "liaison", "personInCharge", "personInChargePhone",
];
let notCount = 0;
keyList.forEach(key => {
if (fuHuaQiInfo[key] == undefined) notCount += 1;
});
const ScoreData = { score:count, star:newStar, infoIntegrity:Math.ceil((notCount/keyList.length)*10000)/100 };
const PTPData = !fuHuaQiInfo.isCreatePTP ? {} : {
scalePTP: fuHuaQiInfo.scalePTP,//基金规模
participatingFundCompany: fuHuaQiInfo.isParticipateInPTP ? fuHuaQiInfo.participatingFundCompany : '',//参股基金公司名
};
return {BaseData, PTPData, ScoreData, FuHuaQiData};
}
/**
* 根据分数算星数
* @param socre 分数
* @returns 星数
*/
function starCount(socre:number) {
let star = 1;
for (let i = 0; i < StarConfig.length; i++) {
let {name, value, starNum} = StarConfig[i];
if ( socre <= value ) {
star = starNum;
break;
}
}
return star;
}
/**
* 孵化器运营分析
* @param uscc
*/
export async function fuHuaQiOperateStats(uscc:string) {
let enterpriseTotal = await findEnterpriseCountByFuHuaQiUscc(uscc); //非迁出企业总数
let virtualEnterpriseNum = await findEnterpriseCount({fuHuaQiUscc:uscc, state:FUHUASTATE.虚拟孵化, draftLock:true}) || 0; //虚拟孵化
let year = new Date().getFullYear();
let monthTableDataList = await findMonthTableList({uscc, year});
monthTableDataList.socre((a, b) => {return a.month - b.month});
let monthTableList = [];
monthTableDataList.forEach(info => {
monthTableList.push({month:info.month, value:info.occupancyRate});
});
/**在孵企业行业领域 */
}
\ No newline at end of file
......@@ -17,6 +17,8 @@ import { eccEnumValue } from "../../../util/verificationEnum";
import { eccFormParam } from "../../../util/verificationParam";
import { findBusinessDataByYear } from "../../../data/enterprise/quarterTask/businessdata";
import { findReplenishBusinessDataByYear } from "../../../data/enterprise/replenish";
import { addPoint } from "../../point";
import { ENTERPRISENODEENUM, POINTTYPEENUM } from "../../../config/pointConfig";
/**
......@@ -111,6 +113,8 @@ export async function updateEnterpriseBaseInfo(uscc:string, param) {
let enterpriseInfo = await enterpriseData.findEnterpriseByUscc(uscc);
addPoint(POINTTYPEENUM.企业, uscc, ENTERPRISENODEENUM.基本信息_经营地址, enterpriseInfo.operatingAddress, param.operatingAddress);
addPoint(POINTTYPEENUM.企业, uscc, ENTERPRISENODEENUM.基本信息_行业领域, enterpriseInfo.industry, param.industry);
/**修改字段 */
let changeList = checkChange(param, enterpriseInfo);
if ( !changeList.length ) throw new BizError(ERRORENUM.数据无更新, `${param.uscc}数据无更新`);
......@@ -120,6 +124,8 @@ export async function updateEnterpriseBaseInfo(uscc:string, param) {
}
});
addPoint
await enterpriseInfo.save();
return {isSuccess:true};
......
......@@ -6,6 +6,7 @@
import { InitialTeamUpdateConfig } from "../../../config/eccParam/enterprise";
import { ENTERPRISETEAM, STATEENUM } from "../../../config/enum";
import { ERRORENUM } from "../../../config/errorEnum";
import { ENTERPRISENODEENUM, POINTTYPEENUM } from "../../../config/pointConfig";
import { EnterpriseInitialTeamConfig } from "../../../config/splitResultConfig";
import * as enterpriseData from "../../../data/enterprise/enterprise";
import * as initialTeamData from "../../../data/enterprise/initialTeam";
......@@ -14,6 +15,7 @@ import { BizError } from "../../../util/bizError";
import { checkChange, extractData } from "../../../util/piecemeal";
import { eccEnumValue } from "../../../util/verificationEnum";
import { eccFormParam } from "../../../util/verificationParam";
import { addPoint } from "../../point";
/**
* 修改创始团队信息
......@@ -38,8 +40,10 @@ export async function updateInitialTeamInfo(uscc:string, firstClassTalent:number
if (info.des.length > 200) throw new BizError(ERRORENUM.字数超过200限制, `修改创始团队信息 下标:${index}`);
});
//是否拥有国际人才这个字段在 企业表中 需要单独做更改
let enterpriseInfo = await enterpriseData.findEnterpriseByUscc(uscc);
let oldHaveFirstClassTalent = enterpriseInfo.haveFirstClassTalent;
enterpriseInfo.haveFirstClassTalent = firstClassTalent;
await enterpriseInfo.save();
......@@ -83,6 +87,11 @@ export async function updateInitialTeamInfo(uscc:string, firstClassTalent:number
if (updateList.length) await initialTeamData.updateMoneyEnterpriseInitialTeam(updateList);
if (deleteList.length) await initialTeamData.deleteMoneyEnterpriseInitialTeam(deleteList);
/**添加埋点 */
let oldPointData = {haveFirstClassTalent:oldHaveFirstClassTalent, teams:enterpriseInitialTeamList || [] };
let newPointData = {haveFirstClassTalent:firstClassTalent, teams};
addPoint(POINTTYPEENUM.企业, uscc, ENTERPRISENODEENUM.创始团队, oldPointData, newPointData);
return {isSuccess:true};
}
......
......@@ -3,7 +3,9 @@
* 作者:lxm
*/
import { ENTERPRISENODEENUM, POINTTYPEENUM } from "../../../config/pointConfig";
import * as enterpriseData from "../../../data/enterprise/enterprise";
import { addPoint } from "../../point";
/**
* 校验参数是否为空
......@@ -34,14 +36,24 @@ function paramIsNull(param) {
export async function updateIntellectualProperty(uscc:string, alienPatent:number, classIPatent:number, secondClassPatent:number) {
let enterpriseInfo = await enterpriseData.findEnterpriseByUscc(uscc);
enterpriseInfo.intellectualProperty = {alienPatent, classIPatent, secondClassPatent};
if (enterpriseInfo.alienPatent != alienPatent) {
addPoint(POINTTYPEENUM.企业, uscc, ENTERPRISENODEENUM.知识产权_海外专利, enterpriseInfo.alienPatent || 0, alienPatent);
}
if (enterpriseInfo.classIPatent != classIPatent) {
addPoint(POINTTYPEENUM.企业, uscc, ENTERPRISENODEENUM.知识产权_一类专利, enterpriseInfo.classIPatent || 0, classIPatent);
}
if (enterpriseInfo.secondClassPatent != secondClassPatent) {
addPoint(POINTTYPEENUM.企业, uscc, ENTERPRISENODEENUM.知识产权_二类专利, enterpriseInfo.secondClassPatent || 0, secondClassPatent);
}
enterpriseInfo.intellectualProperty = {alienPatent, classIPatent, secondClassPatent};
await enterpriseInfo.save();
/**红框提示 */
if (!enterpriseInfo.tipsIntellectualProperty ) {
enterpriseInfo.tipsIntellectualProperty = true;
}
await enterpriseInfo.save();
return {isSuccess:true}
}
......
......@@ -10,6 +10,8 @@ import { BizError } from "../../../util/bizError";
import { eccEnumValue } from "../../../util/verificationEnum";
import { eccFormParam } from "../../../util/verificationParam";
import * as enterpriseData from "../../../data/enterprise/enterprise";
import { addPoint } from "../../point";
import { ENTERPRISENODEENUM, POINTTYPEENUM } from "../../../config/pointConfig";
......@@ -53,8 +55,38 @@ export async function updateQualification(uscc:string, param) {
let enterpriseInfo = await enterpriseData.findEnterpriseByUscc(uscc);
/**埋点 */
let oldQualification = enterpriseInfo.qualification || {};
let oldHighTechData = {highTechMs:oldQualification.highTechMs, isHighTech:oldQualification.isHighTech};
let newHighTechData = {highTechMs:param.highTechMs, isHighTech:param.isHighTech};
addPoint(POINTTYPEENUM.企业, uscc, ENTERPRISENODEENUM.企业资质_高新技术,oldHighTechData, newHighTechData );
let oldIsZjtxData = {isZjtx:oldQualification.isZjtx, zjtxMs:oldQualification.zjtxMs};
let newIsZjtxData = {isZjtx:param.isZjtx, zjtxMs:param.zjtxMs};
addPoint(POINTTYPEENUM.企业, uscc, ENTERPRISENODEENUM.企业资质_专精特新,oldIsZjtxData, newIsZjtxData );
let oldIsXjrpyData = {isXjrpy:oldQualification.isXjrpy, xjrpyMs:oldQualification.xjrpyMs};
let newIsXjrpyData = {isXjrpy:param.isXjrpy, xjrpyMs:param.xjrpyMs};
addPoint(POINTTYPEENUM.企业, uscc, ENTERPRISENODEENUM.企业资质_小巨人培育,oldIsXjrpyData, newIsXjrpyData );
let oldIsXjrData = {isXjr:oldQualification.isXjr, xjrMs:oldQualification.xjrMs};
let newIsXjrData = {isXjr:param.isXjr, xjrMs:param.xjrMs};
addPoint(POINTTYPEENUM.企业, uscc, ENTERPRISENODEENUM.企业资质_小巨人,oldIsXjrData, newIsXjrData );
let oldMarketData = {
beOnTheMarket:oldQualification.beOnTheMarket ? JSON.stringify(oldQualification.beOnTheMarket) : '[]',
isBeOnTheMarket:oldQualification.isBeOnTheMarket
};
let newMarketData = {
beOnTheMarket:param.beOnTheMarket ? JSON.stringify(param.beOnTheMarket) : '[]',
isBeOnTheMarket:param.isBeOnTheMarket
};
addPoint(POINTTYPEENUM.企业, uscc, ENTERPRISENODEENUM.企业资质_上市情况,oldMarketData, newMarketData );
enterpriseInfo.qualification = JSON.parse(JSON.stringify(param) );
/**修改了之后去掉 红框提示 */
if (!enterpriseInfo.tipsQualification ) {
enterpriseInfo.tipsQualification = true;
}
......
......@@ -4,6 +4,8 @@
import moment = require("moment");
import * as informationDat from "../../data/guanWeiHui/information";
import { addPoint } from "../point";
import { ENTERPRISENODEENUM, POINTTYPEENUM } from "../../config/pointConfig";
......@@ -82,6 +84,8 @@ export async function getOnceinformation(uscc:string, id:string) {
createTime:moment(dateBaseData.createTimeMs).format("MM/DD")
};
addPoint(POINTTYPEENUM.企业, uscc, ENTERPRISENODEENUM.政策速递, id);
return {infomation:reuslt};
}
......
......@@ -10,6 +10,8 @@ import { findBusinessDataByUsccAndYear } from "../../../data/enterprise/quarterT
import { eccEnumValue } from "../../../util/verificationEnum";
import { BUSINESSDATATYPE } from "../../../config/enum";
import * as replenishData from "../../../data/enterprise/replenish";
import { addPoint } from "../../point";
import { ENTERPRISENODEENUM, POINTTYPEENUM } from "../../../config/pointConfig";
/**
......@@ -138,6 +140,14 @@ export async function replenishBusinessData(uscc:string, type:number, data) {
await replenishData.replenishData(uscc, lastYear, quarter, type, value);
}
/**加入埋点 */
if (Object.keys(checkMap).length ) {
let pointId;
if (type == BUSINESSDATATYPE.研发投入) pointId = ENTERPRISENODEENUM.经营数据补录_研发投入;
if (type == BUSINESSDATATYPE.纳税) pointId = ENTERPRISENODEENUM.经营数据补录_纳税;
if (type == BUSINESSDATATYPE.营业收入) pointId = ENTERPRISENODEENUM.经营数据补录_营业收入;
addPoint(POINTTYPEENUM.企业, uscc, pointId, checkMap);
}
return {isSuccess:true};
}
......
/**
* 埋点主要逻辑
*/
import { ENTERPRISENODEENUM, FUHUAQINODEENUM, POINTTYPEENUM } from "../config/pointConfig";
import { post } from "../util/request";
export async function addPoint(pointType:number, uid:string, pointId:number, p1, p2?) {
let url = 'http://localhost:7078/point/';
let sign = "xxxx8901231kldosdjkfsdlk";
let pointInfo:any = {uid, ct:new Date().valueOf() };
if (pointType == POINTTYPEENUM.企业 ) {
url += "enterprise/add";
if (pointId != ENTERPRISENODEENUM.政策速递 && pointId != ENTERPRISENODEENUM.创始团队 ) {
pointInfo.pid = pointId;
}
/**组合埋点信息 */
if (pointId >= ENTERPRISENODEENUM.经营数据补录_营业收入 && pointId <= ENTERPRISENODEENUM.经营数据补录_纳税) {
/**经营数据不必保存旧值 */
pointInfo.p1 = JSON.stringify(p1);
post(url, {pointInfo, pointId}, {sign});
} else if (pointId == ENTERPRISENODEENUM.政策速递) {
pointInfo.p1 = p1;
post(url, {pointInfo, pointId}, {sign});
} else {
/**数组类型 or 对象类型 */
if (typeof p1 == "object") {
let oldData = JSON.stringify(p1);
let newData = JSON.stringify(p2);
pointInfo.p1 = oldData;
pointInfo.p2 = newData;
if (oldData != newData) {
post(url, {pointInfo, pointId}, {sign});
}
} else if (typeof p1 == "number") {
if (p1 != p2) {
pointInfo.p1 = p1+'';
pointInfo.p2 = p2+'';
post(url, {pointInfo, pointId}, {sign});
}
}
}
} else {
url += "fuhuaqi/add";
if (pointId != FUHUAQINODEENUM.政策速递 ) {
pointInfo.pid = pointId;
}
}
}
/**
* 孵化器端埋点
*/
export enum FUHUAQINODEENUM {
政策速递 = 1,
机构资质_创投基金登记,
机构资质_专业技术平台登记,
机构资质_国际化登记,
机构资质_大学科研院所合作机构 = 5,
机构资质_创业导师情况,
机构资质_张江以外布局,
我的数据_总面积,
我的数据_在孵面积,
我的数据_自用面积 = 10,
我的数据_经备案孵化场地,
我的企业_基本信息,
我的企业_孵化状态,
我的企业_占孵面积,
我的企业_补录企业 = 15
}
/**
* 企业端埋点
*/
export enum ENTERPRISENODEENUM {
政策速递 = 1,
创始团队,
企业资质_高新技术,
企业资质_专精特新,
企业资质_小巨人培育,
企业资质_小巨人,
企业资质_上市情况,
知识产权_海外专利,
知识产权_一类专利,
知识产权_二类专利,
基本信息_行业领域,
基本信息_经营地址,
经营数据补录_营业收入,
经营数据补录_研发投入,
经营数据补录_纳税
}
export enum POINTTYPEENUM {
企业 = 1,
孵化器
}
/**
* 操作
*/
export enum OPERATETYPEENUM {
查询 = 1,
添加,
删除,
修改,
}
\ No newline at end of file
......@@ -42,7 +42,7 @@ export function post(url, body, headers) {
resolve(body);
}
else {
reject(error)
// reject(error)
}
});
})
......
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