Commit 040a3662 by lixinming

bug:逻辑代码分层,修改添加账号没有任务的bug,修改添加账号后台没有联系人的bug, 修改添加账号密码未加密还有密码是6位不是3位的bug,

新功能:已办任务,过期任务,修改密码,我的企业列表
parent 8609f1d2
import { extractData } from "../../../util/piecemeal";
import * as enterpriseData from "../../../data/enterprise/enterprise";
import * as splitResultConfig from "../../../config/splitResultConfig";
import * as fuHuaQiData from "../../../data/fuHuaQi/fuhuaqi";
import * as configEnum from "../../../config/enum";
import * as verificationEnumTools from "../../../util/verificationEnum";
/**
* 获取在孵企业信息列表
* 管理后台端
* @param createType 新注册/迁入 1:全选 2:新注册 3:迁入 以前是时间 2/23日修改为类型
* @param fuHuaQiUscc 所属孵化器
* @param industry 行业领域
* @param isNaturalPersonHolding 自然人控股
* @param page 页数
* @returns {dataList:[], count:0} dataList=数据列表 count:条件筛选下的数据总数
*/
export async function enterpriseList(createType:number, fuHuaQiUscc:string, industry, isNaturalPersonHolding:number, page:number) {
/**拼接查询条件 */
let selectParam:any = {};
if (createType == 2 || createType == 3) {
selectParam.isCreate = createType == 2 ? true : false;
}
if (fuHuaQiUscc) selectParam.fuHuaQiUscc = fuHuaQiUscc;
if (industry.length > 0) {
verificationEnumTools.eccEnumValue('管理后台获取在孵企业信息列表', 'industry', configEnum.INDUSTRY, industry);
selectParam.industry = industry;
}
if (isNaturalPersonHolding == 2 || isNaturalPersonHolding == 3) {
selectParam.isNaturalPersonHolding = isNaturalPersonHolding == 2 ? true : false;
}
selectParam.draftLock = true; //未提交的企业不能查看
/**需要用到的查询数据 */
let usccMap = await fuHuaQiData.findAllFuHuaQiOperationNameMap();//用于将孵化器uscc变成孵化器名称
let dataBaseList = await enterpriseData.findEnterpriseListToPage(selectParam, (page-1)*10 );
let count = await enterpriseData.findEnterpriseCount(selectParam);//符合查询条件的数据总数
/**组合返回结果 */
let dataList = [];
dataBaseList.forEach( info => {
/**截取返回数据 */
let changeData:any = extractData(splitResultConfig.EnterpriseListConfig, info, true);
/**匹配所属孵化器名称 匹配不上时这里显示空字符串 */
changeData.fuhuaqiUscc = usccMap[info.fuHuaQiUscc] || "";
/** 返回的isCreate字段为字符串 当为导入数据时这里显示为空字符 */
if (info.enterpriseIsInPut) changeData.isCreate = "";
else changeData.isCreate = (changeData.isCreate) ? "新注册" : "新迁入";
/**将枚举值转为字符 */
changeData.industry = verificationEnumTools.changeEnumValue(configEnum.INDUSTRY, changeData.industry);
dataList.push(changeData);
});
return {count, dataList};
}
/**
* 导出在孵企业信息列表
* 管理后台端
* @param createType 新注册时间/迁入时间
* @param fuHuaQiUscc 所属孵化器
* @param industry 行业领域 数组
* @param isNaturalPersonHolding 自然人控股
* @returns 二维数组
*/
export async function outPutEnterpriseData(createType:number, fuHuaQiUscc:string, industry, isNaturalPersonHolding:number, type:Number) {
/**拼接查询条件 */
let selectParam:any = {};
if (type == configEnum.OUTPUTTYPE.当前数据) {
if (createType == 2 || createType == 3) {
selectParam.isCreate = createType == 2 ? true : false;
}
if (fuHuaQiUscc) selectParam.fuHuaQiUscc = fuHuaQiUscc;
if (industry.length > 0) selectParam.industry = industry;
if (isNaturalPersonHolding == 2 || isNaturalPersonHolding == 3) {
selectParam.isNaturalPersonHolding = isNaturalPersonHolding == 2 ? true : false;
}
}
selectParam.draftLock = true;//匹配已经提交入库的企业
/**查询内容 */
let usccMap = await fuHuaQiData.findAllFuHuaQiOperationNameMap();//用于将孵化器uscc变成孵化器名称
let dataBaseList = await enterpriseData.findEnterpriseList(selectParam );
/**组合二维数组 titleList 与 keyList 要一一对应 */
const TitleList = [
"企业名称", "入库时间", "所属孵化器", "统一信用代码", "行业领域",
"注册时间", "首次入孵时间", "迁入时间", "是否自然人控股", "迁入前注册地址",
"注册地址", "经营地址", "租赁面积(平方米)"
];//表头顺序 如果这里修改了 下面的keyList也要修改
const KeyList = [
"name", "createTime", "fuhuaqiUscc", "uscc", "industry", "logonTime",
"firstIncubationTime", "timeOfImmigration", "isNaturalPersonHolding", "oldLogonAdd",
"logonAdd", "operatingAdd", "leasedArea"
];//表头对应的字段顺序
let dataList = [TitleList];
dataBaseList.forEach( info => {
/**截取返回结果 */
let changeData:any = extractData(splitResultConfig.EnterpriseListConfig, info, true);
/**匹配所属孵化器名称 匹配不上时这里显示空字符串 */
changeData.fuhuaqiUscc = usccMap[info.fuHuaQiUscc] || "";
if (info.enterpriseIsInPut) changeData.isCreate = "";
else changeData.isCreate = (changeData.isCreate) ? "新注册" : "新迁入";
/**修改枚举值 */
changeData.industry = verificationEnumTools.changeEnumValue(configEnum.INDUSTRY, changeData.industry);
// dataList.push(changeData);
/**根据表头与key的顺序 生成小数组 */
let subList = [];
KeyList.forEach( keyStr => {
subList.push(info[keyStr] || '');
});
dataList.push(subList);
});
return dataList;
}
/**
* 在孵企业页面的所属孵化器 下拉框
* 管理后台端
* 只返回有入孵企业的孵化器
* @returns result result类型为数组对象 对象内容为{name, uscc}
*/
export async function getAffiliationFuHuaQi() {
/**获取已有入孵企业的孵化器统一信用代码列表 */
let bindList = await enterpriseData.findAllBindFuHuaQiUsccList();
/**限制为 非禁用状态下的孵化器 */
let notDisabledList = await fuHuaQiData.findAllNotDisabledFuHuaQi();
let distinctMap = {}; //去重用的map对象 格式为:{uscc:name}
notDisabledList.forEach(info => {
distinctMap[info.uscc] = info.operationName;
});
let result = [];
bindList.forEach(fuHuaQiUscc => {
let fuHuaQiName = distinctMap[fuHuaQiUscc];
if ( fuHuaQiName ) {
result.push({
name:fuHuaQiName,
uscc:fuHuaQiUscc
});
}
});
return {result}
}
\ No newline at end of file
import * as eccFormParamConfig from "../../../config/eccFormParamConfig";
import { ERRORENUM } from "../../../config/errorEnum";
import * as financingData from "../../../data/enterprise/financing";
import * as splitResultConfig from "../../../config/splitResultConfig";
import { BizError } from "../../../util/bizError";
import * as sysTools from "../../../tools/system";
import * as enterpriseData from "../../../data/enterprise/enterprise";
import * as fuhuaqiData from "../../../data/fuHuaQi/fuhuaqi";
import moment = require("moment");
import * as configEnum from "../../../config/enum";
import { eccFormParam } from "../../../util/verificationParam";
import { changeEnumValue, eccEnumValue } from "../../../util/verificationEnum";
import { checkChange, extractData } from "../../../util/piecemeal";
/**
* 融资企业信息列表
* 管理后台端
* @param monthData 数据月份 目前数据库没有该字段
* @param fuHuaQiName 所属孵化器 这里前端传的是孵化器的统一信用代码
* @param industry 行业领域
* @param fuHuaQiInvestment 孵化器是否参与投资
* @param page 页数
* @returns {data, count} data:数据列表 count:符合条件的数据量
*/
export async function financingList(monthData:string, fuHuaQiName:string, industry, fuHuaQiInvestment:number, page:number) {
/**拼接查询条件 */
let selectParam:any = {};
if (fuHuaQiName.length > 0) {
let fuHuaQiInfo = await fuhuaqiData.findFuHuaQiByUSCC(fuHuaQiName);
if(!fuHuaQiInfo) throw new BizError(ERRORENUM.未找到数据, `管理后台查询融资列表时 ${fuHuaQiName}不存在`);
selectParam.fuHuaQiUscc = fuHuaQiInfo.uscc;
}
if ( monthData.length > 0 ) {
let startT = moment(monthData).startOf('month').valueOf();
let endT = moment(monthData).endOf('month').valueOf();
selectParam.createTime = {'$gt':startT, '$lt':endT};
}
if (industry.length >0 ) selectParam.industry = industry;
if (fuHuaQiInvestment == 2 || fuHuaQiInvestment == 3) {
selectParam.fuHuaQiInvestment = fuHuaQiInvestment == 2 ? true : false;
}
/**查数据 */
let dataBaseList = await financingData.findFinancingListToPage(selectParam, (page-1)*10 );
let count = await financingData.findFinancingCount(selectParam);
let usccMap = await fuhuaqiData.findAllFuHuaQiOperationNameMap();//用于转换所属孵化器名称
/**拼接返回值 */
let dataList = [];
dataBaseList.forEach( info => {
/**截取返回字段 */
let changeData:any = extractData(splitResultConfig.FinancingListConfig, info, true);
/** 字段的特化处理 */
changeData.fuhuaqiUscc = usccMap[info.fuHuaQiUscc] || "";
changeData.industry = changeEnumValue(configEnum.INDUSTRY, info.industry);
changeData.financingRounds = changeEnumValue(configEnum.FINANCINGROUNDS, info.financingRounds);
changeData.fuHuaQiInvestmentStyle = changeEnumValue(configEnum.FUHUAQILNVESTMENTSTYLE, info.fuHuaQiInvestmentStyle);
dataList.push(changeData);
});
return {count, dataList};
}
/**
* 导出融资企业信息列表
* 管理后台端
* @param monthData 数据月份 目前数据库没有该字段
* @param fuHuaQiName 所属孵化器
* @param industry 行业领域
* @param fuHuaQiInvestment 孵化器是否参与投资
* @param type 页数
* @returns
*/
export async function outPutFinancingList(monthData:string, fuHuaQiName:string, industry, fuHuaQiInvestment:number, type:number) {
let selectParam:any = {};
if (type == configEnum.OUTPUTTYPE.当前数据 ) {
/**如果选择当前数据 则拼接查询条件 */
if (fuHuaQiName.length > 0) {
let fuHuaQiInfo = await fuhuaqiData.findFuHuaQiByName(fuHuaQiName);
if(!fuHuaQiInfo) throw new BizError(ERRORENUM.未找到数据, `管理后台查询融资列表时 ${fuHuaQiName}不存在`);
selectParam.fuHuaQiUscc = fuHuaQiInfo.uscc;
}
if ( monthData.length > 0 ) {
let startT = moment(monthData).startOf('month').valueOf();
let endT = moment(monthData).endOf('month').valueOf();
selectParam.createTime = {'$gt':startT, '$lt':endT};
}
if (industry.length >0 ) selectParam.industry = industry;
if (fuHuaQiInvestment == 2 || fuHuaQiInvestment == 3) {
selectParam.fuHuaQiInvestment = fuHuaQiInvestment == 2 ? true : false;
}
}
/**主要查询 */
let dataBaseList = await financingData.findFinancingList(selectParam );
let usccMap = await fuhuaqiData.findAllFuHuaQiOperationNameMap();
/**拼接返回 需要注意的是 keyList要和titleList一一对应 */
let keyList = [
"name", "logonAdd", "operatingAdd", "financingAmount","investmentInstitutionsName",
"timeToObtainInvestment", "fuHuaQiInvestment", "fuHuaQiInvestmentAmount", "fuHuaQiInvestmentStyle", "createTime"
];
let titleList = [
"企业名称","注册地址","经营地址","融资金额(万元)","投资机构名称","获得投资时间",
"孵化器是否投资","孵化器投资金额(万元)","孵化器投资方式","录入时间",
];
let result = [titleList];
dataBaseList.forEach( info => {
/**截取返回字段 */
let changeData:any = extractData(splitResultConfig.FinancingListConfig, info, true);
changeData.fuhuaqiUscc = usccMap[info.fuHuaQiUscc] || "";
changeData.industry = changeEnumValue(configEnum.INDUSTRY, info.industry);
/**根据keyList的顺序生成小数组 */
let subList = [];
keyList.forEach(keyStr => {
subList.push(changeData[keyStr] || '');
});
result.push(subList);
});
return result;
}
\ No newline at end of file
import * as eccFormParamConfig from "../../../config/eccFormParamConfig";
import { findEnterpriseCountByFuHuaQiUscc, groupFindEnterpriseCount } from "../../../data/enterprise/enterprise";
import * as fuhuaqiData from "../../../data/fuHuaQi/fuhuaqi";
import * as splitResultConfig from "../../../config/splitResultConfig";
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 { changeEnumValue, eccEnumValue } from "../../../util/verificationEnum";
import { getPwdMd5, getTaskId, getTimeKey, md5PwdStr } from "../../../tools/system";
import moment = require("moment");
import * as monthTableData from "../../../data/fuHuaQi/monthTable";
import * as taskData from "../../../data/fuHuaQi/task";
import { logHandle } from "../../../util/log";
/**
* 获取孵化器基本信息列表
* 管理后台端
* @param lv 孵化器等级
* @param institutionalNature 机构性质
* @param industry 领域
* @param operationModel 运营模式
* @param foundingTeam 创业团队
* @param page 页数
* @returns
*/
export async function fuHuaQiBaseList(lv:number, institutionalNature:number, industry:number, operationModel:number, foundingTeam:number, page:number) {
/**拼接查询条件 并且校验是否符合枚举范围 可优化 抽出一个方法统一校验 */
let selectParam:any = {};
if (lv) {
eccEnumValue("管理后台查询孵化器列表", " 孵化器级别 ", configEnum.FUHUAQILV, lv);
selectParam.lv = lv;
}
if (institutionalNature) {
eccEnumValue("管理后台查询孵化器列表", " 机构性质 ", configEnum.INSTITUTIONALNATURE, institutionalNature);
selectParam.institutionalNature = institutionalNature;
}
if (industry){
eccEnumValue("管理后台查询孵化器列表", " 领域 ", configEnum.FUHUAINDUSTRY, industry);
selectParam.industry = industry;
}
if (operationModel) {
eccEnumValue("管理后台查询孵化器列表", " 运营模式 ", configEnum.OPERATIONMODEL, operationModel);
selectParam.operationModel = operationModel;
}
if (foundingTeam) {
eccEnumValue("管理后台查询孵化器列表", " 创业团队 ", configEnum.TEAM, foundingTeam);
selectParam.foundingTeamType = foundingTeam;
}
let enterpriseMap = await groupFindEnterpriseCount();//计算孵化器拥有的企业总数
let dataBaseList = await fuhuaqiData.findFuHuaQiListByPage(selectParam, (page-1)*10 );
let count = await fuhuaqiData.findFuHuaQiCount(selectParam);
/**拼接返回结果 */
let dataList = [];
dataBaseList.forEach( info => {
/**截取所需字段 */
let changeData:any = extractData(splitResultConfig.FuHuaQiBaseListConfig, info, true);
const EnterpriseTotal = enterpriseMap[info.uscc] || 0; //企业总数
let numOfEntities = EnterpriseTotal - (info.virtualEnterpriseNum || 0 ); //实体企业
changeData.enterpriseTotal = EnterpriseTotal;
changeData.numOfEntities = numOfEntities < 0 ? 0 : numOfEntities;
/**枚举转换 */
changeData.lv = changeEnumValue(configEnum.FUHUAQILV, changeData.lv);
changeData.industry = changeEnumValue(configEnum.FUHUAINDUSTRY, changeData.industry);
changeData.institutionalNature = changeEnumValue(configEnum.INSTITUTIONALNATURE, changeData.institutionalNature);
changeData.operationModel = changeEnumValue(configEnum.OPERATIONMODEL, changeData.operationModel);
changeData.foundingTeamStr = changeData.foundingTeamStr ? changeEnumValue(configEnum.TEAM, changeData.foundingTeamStr) : "无";//创始团队文字
let foundingTeam = [];
if (changeData.foundingTeam && changeData.foundingTeam.length) {
changeData.foundingTeam.forEach(item => {
let {memberName, memberAge, memberSchool, des} = item;
let type = changeEnumValue(configEnum.TEAM, item.type);//人才类型
foundingTeam.push({
memberName, memberAge, memberSchool, des, type,
memberSex : changeEnumValue(configEnum.SEX, item.memberSex),//成员性别
memberDEGREE : changeEnumValue(configEnum.DEGREE, item.memberDEGREE),//成员最高学历
});
});
changeData.foundingTeam = foundingTeam;
}
dataList.push(changeData);
});
return {count, dataList};
}
/**
* 导出符合条件的孵化器基本信息数据
* @param lv 孵化器等级
* @param institutionalNature 机构性质
* @param industry 领域
* @param operationModel 运营模式
* @param foundingTeam 创业团队
* @param type 导出类型 OUTPUTTYPE 枚举
* @returns
*/
export async function outPutFuHuaQiBaseData(lv:number, institutionalNature:number, industry:number, operationModel:number, foundingTeam:number, type:Number) {
let selectParam:any = {};
if (type == configEnum.OUTPUTTYPE.当前数据) {
/**当选择了当前数据时 拼接查询条件 */
let selectParam:any = {};
if (lv) {
eccEnumValue("管理后台查询孵化器列表", " 孵化器级别 ", configEnum.FUHUAQILV, lv);
selectParam.lv = lv;
}
if (institutionalNature) {
eccEnumValue("管理后台查询孵化器列表", " 机构性质 ", configEnum.INSTITUTIONALNATURE, institutionalNature);
selectParam.institutionalNature = institutionalNature;
}
if (industry){
eccEnumValue("管理后台查询孵化器列表", " 领域 ", configEnum.FUHUAINDUSTRY, industry);
selectParam.industry = industry;
}
if (operationModel) {
eccEnumValue("管理后台查询孵化器列表", " 运营模式 ", configEnum.OPERATIONMODEL, operationModel);
selectParam.operationModel = operationModel;
}
if (foundingTeam) {
eccEnumValue("管理后台查询孵化器列表", " 创业团队 ", configEnum.TEAM, foundingTeam);
selectParam.foundingTeamType = foundingTeam;
}
}
let enterpriseMap = await groupFindEnterpriseCount();//计算所有孵化器拥有的企业总数
let dataBaseList = await fuhuaqiData.findFuHuaQiList(selectParam);
/**拼接二维数组 */
let keyList = [
"name", "operationName", "uscc", "enterpriseTotal", "virtualEnterpriseNum", "numOfEntities", "logonTime", "incubatedAcreage",
"acreageTotal", "acreagePersonalUse", "lv", "identificationTime", "industry", "institutionalNature",
"liaison", "liaisonPhone", "personInCharge", "personInChargePhone", "operationModel", "foundingTeamType",
];
let titleList = [
"名称", "运营机构名称", "统一信用代码", "企业总数", "虚拟孵化", "实体孵化",
"注册时间", "在孵面积", "孵化器总面积", "孵化器自用面积", "孵化器级别", "认定时间",
"领域", "机构性质", "联系人", "联系电话", "负责人", "负责人联系电话"
];
let dataList = [];
let maxTeamNumber = 0;//最大团队数
let maxHatching = 0;//最大场地数
dataBaseList.forEach( info => {
/**截取需要的返回字段 */
let changeData:any = extractData(splitResultConfig.FuHuaQiBaseListConfig, info, true);
const EnterpriseTotal = enterpriseMap[info.uscc] || 0; //企业总数
let numOfEntities = EnterpriseTotal - (info.virtualEnterpriseNum || 0 ); //实体企业
changeData.enterpriseTotal = EnterpriseTotal;
changeData.numOfEntities = numOfEntities < 0 ? 0 : numOfEntities;
/**枚举转换 */
changeData.lv = changeEnumValue(configEnum.FUHUAQILV, changeData.lv);
changeData.industry = changeEnumValue(configEnum.FUHUAINDUSTRY, changeData.industry);
changeData.institutionalNature = changeEnumValue(configEnum.INSTITUTIONALNATURE, changeData.institutionalNature);
changeData.operationModel = changeEnumValue(configEnum.OPERATIONMODEL, changeData.operationModel);
changeData.foundingTeamType = changeEnumValue(configEnum.TEAM, changeData.foundingTeamType) || "无";
/**算出最大的创始团队和场地 用于计算x轴下标 */
if (changeData.foundingTeam && changeData.foundingTeam.length ) {
maxTeamNumber = Math.max(changeData.foundingTeam.length, maxTeamNumber);
}
if (changeData.hatchingGround && changeData.hatchingGround.length ) {
maxHatching = Math.max(changeData.hatchingGround.length, maxHatching);
}
/**生成除了创始团队和场地之外的 小数组 */
let subList = [];
keyList.forEach(subInfo => {
subList.push(info[subInfo] || '');
});
dataList.push(subList);
});
/**根据最大的创始团队数量 生成标题 */
let teamKeyList = ["type", "memberName", "memberSex", "memberAge", "memberDEGREE", "memberSchool", "des"];
let teamTitleList = ["人才类型", "成员姓名", "成员性别", "成员年龄", "成员最高学历", "毕业学校", "履历描述"];
for (let i = 0; i < maxTeamNumber; i++) {//平铺的插入数据
let teamNum = i+1;
teamTitleList.forEach(title => {
titleList.push(`成员${teamNum}-${title}`);
});
}
/**根据最大的场地数量 生成标题 */
let hatchingKeyList = [ "personInChargeAdd", "siteAcreage", "leasePrice" ];
let hatchingTitleList = ["孵化场地地址", "孵化场地面积", "孵化场地出租单价" ];
for (let i = 0; i < maxHatching; i++) {
let hatchingNumber = i+1;
hatchingTitleList.forEach(title => {
titleList.push(`场地${hatchingNumber}-${title}`);
});
}
/**创始团队初始插入数据的x轴下标 = titleList的长度
* 场地初始插入数据的x轴下标 = titleList的长度+(创始团队长度*标题个数)
* 按照这个规则依次插入数据即可
*/
dataBaseList.forEach((info, index) => {
if (info.foundingTeam && info.foundingTeam.length ) {
info.foundingTeam.forEach(teamInfo => {
teamInfo.type = changeEnumValue(configEnum.TEAM, teamInfo.type);
teamInfo.memberSex = changeEnumValue(configEnum.SEX, teamInfo.memberSex);
teamInfo.memberDEGREE = changeEnumValue(configEnum.DEGREE, teamInfo.memberDEGREE);
teamKeyList.forEach( teamKey => {
dataList[index].push(teamInfo[teamKey]);
});
});
}
if (info.hatchingGround && info.hatchingGround.length ) {
info.hatchingGround.forEach((hatchingInfo, hatchingIndex) => {1
hatchingKeyList.forEach( (hatchingKey, hatchingKeyIndex) => {
let addIndex = teamKeyList.length + ( (hatchingIndex * 3 ) + (hatchingKeyIndex) )
dataList[index][addIndex] = hatchingInfo[hatchingKey];
});
});
}
});
/**最后将标题作数组为二维数组的第一个子数组 */
dataList.unshift(titleList)
return dataList;
}
/**
* 修改账号状态
* 管理后台端 禁用/启用
* @param uscc 孵化器统一信用代码
* @param userStatem 是否禁用 true=启用 false=禁用
* @returns
*/
export async function updateState(uscc:string, userState:boolean) {
let fuhuaqiInfo = await fuhuaqiData.findFuHuaQiByUSCC(uscc);
if(!fuhuaqiInfo) throw new BizError(ERRORENUM.账号不存在);
fuhuaqiInfo.userState = userState;
await fuhuaqiInfo.save();
return {isSuccess:true};
}
/**
* 添加孵化器账号
* 管理后台端
* @param param 表单信息
* @returns
*/
export async function addUser(param) {
eccFormParam("新增孵化器账号信息", eccFormParamConfig.FuHuaQiUserConfig, param);//校验表单参数
let fuhuaqiInfo = await fuhuaqiData.findFuHuaQiByUSCC(param.uscc);
if ( fuhuaqiInfo ) throw new BizError(ERRORENUM.该孵化器账号信息已存在, `${param.uscc}`);
const Pwd = param.uscc.slice(param.uscc.length-6);
param.pwd = getPwdMd5(param.uscc, md5PwdStr(Pwd));
await fuhuaqiData.createFuHuaQiUser(param);
let addList = [];//任务列表
let monthList = [];//月度填报列表
// const MonthNumber = moment().subtract(1, 'months').month() + 1;//数据填报月份
// const YearNumber =moment().subtract(1, 'months').year();
const MonthNumber = 1;//todo 数据填报月份 15号改回来
const YearNumber = 2023
const MonthTableName = `${MonthNumber}月孵化器月度填报`;
const TimeKey = "20232";//todo 这里要用20232 15号 改回来
let fuHuaQiList = [{uscc:param.uscc}];
fuHuaQiList.forEach(info => {
let { uscc } = info;
let taskId = getTaskId(uscc);
addList.push( { key:TimeKey, type:configEnum.TASKTYPEENUM.孵化器月度填报, month:MonthNumber, taskId, fuHuaQiUscc:uscc, isSubmit:false},
{ key:TimeKey, type:configEnum.TASKTYPEENUM.新注册或迁入企业登记, month:MonthNumber, taskId, fuHuaQiUscc:uscc, isSubmit:false },
{ key:TimeKey, type:configEnum.TASKTYPEENUM.融资企业填报, taskId, month:MonthNumber, fuHuaQiUscc:uscc, isSubmit:false});
/**任务报表的初始状态为 草稿(draftLock=fals) 未被编辑(isUpdate=false) */
monthList.push({ taskId, name:MonthTableName, fuHuaQiUscc:uscc, month:MonthNumber, year:YearNumber, draftLock:false, isUpdate:false });
});
try {
/**初始化 任务 */
await taskData.createTaskToList(addList);
logHandle(`添加了${addList.length} 任务`);
/**初始化 月度填报表 */
await monthTableData.createMonthTableToList(monthList);
logHandle(`添加了${monthList.length} 月度任务`);
} catch (err) {
new BizError(ERRORENUM.系统错误, '添加任务和月度报表的时候 出现了异常 请检查数据库 ', err);
}
return {isSuccess:true};
}
import { ERRORENUM } from "../../../config/errorEnum";
import { BizError } from "../../../util/bizError";
import * as monthData from "../../../data/fuHuaQi/monthTable";
import { extractData } from "../../../util/piecemeal";
import * as sysTools from "../../../tools/system";
import { findAllFuHuaQiOperationNameMap } from "../../../data/fuHuaQi/fuhuaqi";
import * as splitResultConfig from "../../../config/splitResultConfig";
import { OUTPUTTYPE } from "../../../config/enum";
/**
* 月度出租率数据列表
* 管理后台端
* @param state 填报状态
* @param year 数据年份
* @param month 数据月份
* @param page 页面
*/
export async function monthTableList(state:number, year:number, month:number, page:number) {
let selectParam:any = {};
if ( !(state >=1 || state <=3) ) throw new BizError(ERRORENUM.参数错误, `state状态不合法 不合法值为 ${state}`);
if (state == 2 || state == 3) {
selectParam.draftLock = state == 2 ? true : false;
}
if (year) selectParam.year = year;
if (month) selectParam.month = month;
let dataBaseList = await monthData.findMonthTableListToPage(selectParam, (page-1)*10 );
let count = await monthData.findMonthTableListCount(selectParam);
let operationNameMap = await findAllFuHuaQiOperationNameMap();
let dataList = [];
dataBaseList.forEach( info => {
let onceInfo = {
operationName:operationNameMap[info.fuHuaQiUscc],
state:info.draftLock==false?'未填报':'已填报',
time:`${info.year}${info.month}月`,
occupancyRate:info.occupancyRate || '-'
};
dataList.push(onceInfo);
});
return {count, dataList}
}
/**
* 导出月度出租率数据列表
* 管理后台端
* @param state 填报状态
* @param year 数据年份
* @param month 数据月份
* @param page 页面
*/
export async function outPutMonthTableList(state:number, year:number, month:number, type:number) {
let selectParam:any = {};
if ( !(state >=1 || state <=3) ) throw new BizError(ERRORENUM.参数错误, `state状态不合法 不合法值为 ${state}`);
if (type == OUTPUTTYPE.当前数据 ) {
if (state == 2 || state == 3) {
selectParam.draftLock = state == 2 ? true : false;
}
if (year) selectParam.year = year;
if (month) selectParam.month = month;
}
let dataBaseList = await monthData.findMonthTableList(selectParam);
let operationNameMap = await findAllFuHuaQiOperationNameMap();
let keyList = [ "operationName", "state", "time", "occupancyRate"];
let titleList = [ "运营机构名称","填报状态","数据月份","出租率(%)"];
let dataList = [titleList];
dataBaseList.forEach( info => {
let onceInfo = {
operationName:operationNameMap[info.fuHuaQiUscc],
state:info.draftLock==false?'未填报':'已填报',
time:`${info.year}${info.month}月`,
occupancyRate:info.occupancyRate || '-'
};
let subList = [];
keyList.forEach(subInfo => {
subList.push(onceInfo[subInfo] || '');
});
dataList.push(subList);
});
return dataList;
}
\ No newline at end of file
...@@ -4,17 +4,16 @@ ...@@ -4,17 +4,16 @@
* 包括新注册企业,迁入企业 * 包括新注册企业,迁入企业
* *
*/ */
import * as eccFormParamConfig from "../../config/eccFormParamConfig"; import * as eccFormParamConfig from "../../../config/eccFormParamConfig";
import { ERRORENUM } from "../../config/errorEnum"; import { ERRORENUM } from "../../../config/errorEnum";
import { BizError } from "../../util/bizError"; import { BizError } from "../../../util/bizError";
import * as sysTools from "../../tools/system"; import * as sysTools from "../../../tools/system";
import * as enterpriseData from "../../data/enterprise/enterprise"; import * as enterpriseData from "../../../data/enterprise/enterprise";
import * as splitResultConfig from "../../config/splitResultConfig"; import * as splitResultConfig from "../../../config/splitResultConfig";
import * as fuHuaQiData from "../../data/fuHuaQi/fuhuaqi"; import * as configEnum from "../../../config/enum";
import * as configEnum from "../../config/enum"; import { eccFormParam } from "../../../util/verificationParam";
import { eccFormParam } from "../../util/verificationParam"; import * as verificationEnumTools from "../../../util/verificationEnum";
import * as verificationEnumTools from "../../util/verificationEnum"; import { checkChange, extractData } from "../../../util/piecemeal";
import { checkChange, extractData } from "../../util/piecemeal";
/** /**
...@@ -178,152 +177,26 @@ export async function deleteEnterpriseByDraftId(draftId:string) { ...@@ -178,152 +177,26 @@ export async function deleteEnterpriseByDraftId(draftId:string) {
/** /**
* 获取在孵企业信息列表 * 我的企业
* 管理后台端 * 小程序端 2.0
* @param createType 新注册/迁入 1:全选 2:新注册 3:迁入 以前是时间 2/23日修改为类型 * @param uscc 孵化器统一信用代码
* @param fuHuaQiUscc 所属孵化器 * @param state 孵化器状态 遵循 枚举FUHUASTATE
* @param industry 行业领域 * @param name 孵化器名称
* @param isNaturalPersonHolding 自然人控股
* @param page 页数
* @returns {dataList:[], count:0} dataList=数据列表 count:条件筛选下的数据总数
*/
export async function enterpriseList(createType:number, fuHuaQiUscc:string, industry, isNaturalPersonHolding:number, page:number) {
/**拼接查询条件 */
let selectParam:any = {};
if (createType == 2 || createType == 3) {
selectParam.isCreate = createType == 2 ? true : false;
}
if (fuHuaQiUscc) selectParam.fuHuaQiUscc = fuHuaQiUscc;
if (industry.length > 0) {
verificationEnumTools.eccEnumValue('管理后台获取在孵企业信息列表', 'industry', configEnum.INDUSTRY, industry);
selectParam.industry = industry;
}
if (isNaturalPersonHolding == 2 || isNaturalPersonHolding == 3) {
selectParam.isNaturalPersonHolding = isNaturalPersonHolding == 2 ? true : false;
}
selectParam.draftLock = true; //未提交的企业不能查看
/**需要用到的查询数据 */
let usccMap = await fuHuaQiData.findAllFuHuaQiOperationNameMap();//用于将孵化器uscc变成孵化器名称
let dataBaseList = await enterpriseData.findEnterpriseListToPage(selectParam, (page-1)*10 );
let count = await enterpriseData.findEnterpriseCount(selectParam);//符合查询条件的数据总数
/**组合返回结果 */
let dataList = [];
dataBaseList.forEach( info => {
/**截取返回数据 */
let changeData:any = extractData(splitResultConfig.EnterpriseListConfig, info, true);
/**匹配所属孵化器名称 匹配不上时这里显示空字符串 */
changeData.fuhuaqiUscc = usccMap[info.fuHuaQiUscc] || "";
/** 返回的isCreate字段为字符串 当为导入数据时这里显示为空字符 */
if (info.enterpriseIsInPut) changeData.isCreate = "";
else changeData.isCreate = (changeData.isCreate) ? "新注册" : "新迁入";
/**将枚举值转为字符 */
changeData.industry = verificationEnumTools.changeEnumValue(configEnum.INDUSTRY, changeData.industry);
dataList.push(changeData);
});
return {count, dataList};
}
/**
* 导出在孵企业信息列表
* 管理后台端
* @param createType 新注册时间/迁入时间
* @param fuHuaQiUscc 所属孵化器
* @param industry 行业领域 数组
* @param isNaturalPersonHolding 自然人控股
* @returns 二维数组
*/ */
export async function outPutEnterpriseData(createType:number, fuHuaQiUscc:string, industry, isNaturalPersonHolding:number, type:Number) { export async function myEnterprise(uscc:string, state:number, name:string) {
/**拼接查询条件 */
let selectParam:any = {};
if (type == configEnum.OUTPUTTYPE.当前数据) {
if (createType == 2 || createType == 3) {
selectParam.isCreate = createType == 2 ? true : false;
}
if (fuHuaQiUscc) selectParam.fuHuaQiUscc = fuHuaQiUscc;
if (industry.length > 0) selectParam.industry = industry;
if (isNaturalPersonHolding == 2 || isNaturalPersonHolding == 3) {
selectParam.isNaturalPersonHolding = isNaturalPersonHolding == 2 ? true : false;
}
}
selectParam.draftLock = true;//匹配已经提交入库的企业
/**查询内容 */
let usccMap = await fuHuaQiData.findAllFuHuaQiOperationNameMap();//用于将孵化器uscc变成孵化器名称
let dataBaseList = await enterpriseData.findEnterpriseList(selectParam );
/**组合二维数组 titleList 与 keyList 要一一对应 */
const TitleList = [
"企业名称", "入库时间", "所属孵化器", "统一信用代码", "行业领域",
"注册时间", "首次入孵时间", "迁入时间", "是否自然人控股", "迁入前注册地址",
"注册地址", "经营地址", "租赁面积(平方米)"
];//表头顺序 如果这里修改了 下面的keyList也要修改
const KeyList = [
"name", "createTime", "fuhuaqiUscc", "uscc", "industry", "logonTime",
"firstIncubationTime", "timeOfImmigration", "isNaturalPersonHolding", "oldLogonAdd",
"logonAdd", "operatingAdd", "leasedArea"
];//表头对应的字段顺序
let dataList = [TitleList];
dataBaseList.forEach( info => { let selectParam:any = { state, fuHuaQiUscc:uscc};
/**截取返回结果 */ if (name) selectParam.name = name;
let changeData:any = extractData(splitResultConfig.EnterpriseListConfig, info, true);
let dataList = await enterpriseData.findEnterpriseList(selectParam);
/**匹配所属孵化器名称 匹配不上时这里显示空字符串 */
changeData.fuhuaqiUscc = usccMap[info.fuHuaQiUscc] || "";
if (info.enterpriseIsInPut) changeData.isCreate = "";
else changeData.isCreate = (changeData.isCreate) ? "新注册" : "新迁入";
/**修改枚举值 */
changeData.industry = verificationEnumTools.changeEnumValue(configEnum.INDUSTRY, changeData.industry);
// dataList.push(changeData);
/**根据表头与key的顺序 生成小数组 */
let subList = [];
KeyList.forEach( keyStr => {
subList.push(info[keyStr] || '');
});
dataList.push(subList);
});
return dataList;
}
/**
* 在孵企业页面的所属孵化器 下拉框
* 管理后台端
* 只返回有入孵企业的孵化器
* @returns result result类型为数组对象 对象内容为{name, uscc}
*/
export async function getAffiliationFuHuaQi() {
/**获取已有入孵企业的孵化器统一信用代码列表 */
let bindList = await enterpriseData.findAllBindFuHuaQiUsccList();
/**限制为 非禁用状态下的孵化器 */
let notDisabledList = await fuHuaQiData.findAllNotDisabledFuHuaQi();
let distinctMap = {}; //去重用的map对象 格式为:{uscc:name} let enterpriseList = [];
notDisabledList.forEach(info => {
distinctMap[info.uscc] = info.operationName;
});
let result = []; dataList.forEach(info => {
bindList.forEach(fuHuaQiUscc => { let changeData:any = extractData(splitResultConfig.myEnterpriseDataConfig, info, false);
let fuHuaQiName = distinctMap[fuHuaQiUscc]; changeData.state = verificationEnumTools.changeEnumValue(configEnum.FUHUASTATE, changeData.state);
if ( fuHuaQiName ) { enterpriseList.push(changeData);
result.push({
name:fuHuaQiName,
uscc:fuHuaQiUscc
});
}
}); });
return {result} return {enterpriseList};
} }
\ No newline at end of file \ No newline at end of file
...@@ -4,19 +4,17 @@ ...@@ -4,19 +4,17 @@
* 包括新融资信息的增删改查 * 包括新融资信息的增删改查
* *
*/ */
import * as eccFormParamConfig from "../../config/eccFormParamConfig"; import * as eccFormParamConfig from "../../../config/eccFormParamConfig";
import { ERRORENUM } from "../../config/errorEnum"; import { ERRORENUM } from "../../../config/errorEnum";
import * as financingData from "../../data/enterprise/financing"; import * as financingData from "../../../data/enterprise/financing";
import * as splitResultConfig from "../../config/splitResultConfig"; import * as splitResultConfig from "../../../config/splitResultConfig";
import { BizError } from "../../util/bizError"; import { BizError } from "../../../util/bizError";
import * as sysTools from "../../tools/system"; import * as sysTools from "../../../tools/system";
import * as enterpriseData from "../../data/enterprise/enterprise"; import * as enterpriseData from "../../../data/enterprise/enterprise";
import * as fuhuaqiData from "../../data/fuHuaQi/fuhuaqi"; import * as configEnum from "../../../config/enum";
import moment = require("moment"); import { eccFormParam } from "../../../util/verificationParam";
import * as configEnum from "../../config/enum"; import { eccEnumValue } from "../../../util/verificationEnum";
import { eccFormParam } from "../../util/verificationParam"; import { checkChange, extractData } from "../../../util/piecemeal";
import { changeEnumValue, eccEnumValue } from "../../util/verificationEnum";
import { checkChange, extractData } from "../../util/piecemeal";
/** /**
...@@ -173,117 +171,3 @@ export async function getFuHuaQiEnterpriseForSelect(uscc:string) { ...@@ -173,117 +171,3 @@ export async function getFuHuaQiEnterpriseForSelect(uscc:string) {
return dataList; return dataList;
} }
/**
* 融资企业信息列表
* 管理后台端
* @param monthData 数据月份 目前数据库没有该字段
* @param fuHuaQiName 所属孵化器 这里前端传的是孵化器的统一信用代码
* @param industry 行业领域
* @param fuHuaQiInvestment 孵化器是否参与投资
* @param page 页数
* @returns {data, count} data:数据列表 count:符合条件的数据量
*/
export async function financingList(monthData:string, fuHuaQiName:string, industry, fuHuaQiInvestment:number, page:number) {
/**拼接查询条件 */
let selectParam:any = {};
if (fuHuaQiName.length > 0) {
let fuHuaQiInfo = await fuhuaqiData.findFuHuaQiByUSCC(fuHuaQiName);
if(!fuHuaQiInfo) throw new BizError(ERRORENUM.未找到数据, `管理后台查询融资列表时 ${fuHuaQiName}不存在`);
selectParam.fuHuaQiUscc = fuHuaQiInfo.uscc;
}
if ( monthData.length > 0 ) {
let startT = moment(monthData).startOf('month').valueOf();
let endT = moment(monthData).endOf('month').valueOf();
selectParam.createTime = {'$gt':startT, '$lt':endT};
}
if (industry.length >0 ) selectParam.industry = industry;
if (fuHuaQiInvestment == 2 || fuHuaQiInvestment == 3) {
selectParam.fuHuaQiInvestment = fuHuaQiInvestment == 2 ? true : false;
}
/**查数据 */
let dataBaseList = await financingData.findFinancingListToPage(selectParam, (page-1)*10 );
let count = await financingData.findFinancingCount(selectParam);
let usccMap = await fuhuaqiData.findAllFuHuaQiOperationNameMap();//用于转换所属孵化器名称
/**拼接返回值 */
let dataList = [];
dataBaseList.forEach( info => {
/**截取返回字段 */
let changeData:any = extractData(splitResultConfig.FinancingListConfig, info, true);
/** 字段的特化处理 */
changeData.fuhuaqiUscc = usccMap[info.fuHuaQiUscc] || "";
changeData.industry = changeEnumValue(configEnum.INDUSTRY, info.industry);
changeData.financingRounds = changeEnumValue(configEnum.FINANCINGROUNDS, info.financingRounds);
changeData.fuHuaQiInvestmentStyle = changeEnumValue(configEnum.FUHUAQILNVESTMENTSTYLE, info.fuHuaQiInvestmentStyle);
dataList.push(changeData);
});
return {count, dataList};
}
/**
* 导出融资企业信息列表
* 管理后台端
* @param monthData 数据月份 目前数据库没有该字段
* @param fuHuaQiName 所属孵化器
* @param industry 行业领域
* @param fuHuaQiInvestment 孵化器是否参与投资
* @param type 页数
* @returns
*/
export async function outPutFinancingList(monthData:string, fuHuaQiName:string, industry, fuHuaQiInvestment:number, type:number) {
let selectParam:any = {};
if (type == configEnum.OUTPUTTYPE.当前数据 ) {
/**如果选择当前数据 则拼接查询条件 */
if (fuHuaQiName.length > 0) {
let fuHuaQiInfo = await fuhuaqiData.findFuHuaQiByName(fuHuaQiName);
if(!fuHuaQiInfo) throw new BizError(ERRORENUM.未找到数据, `管理后台查询融资列表时 ${fuHuaQiName}不存在`);
selectParam.fuHuaQiUscc = fuHuaQiInfo.uscc;
}
if ( monthData.length > 0 ) {
let startT = moment(monthData).startOf('month').valueOf();
let endT = moment(monthData).endOf('month').valueOf();
selectParam.createTime = {'$gt':startT, '$lt':endT};
}
if (industry.length >0 ) selectParam.industry = industry;
if (fuHuaQiInvestment == 2 || fuHuaQiInvestment == 3) {
selectParam.fuHuaQiInvestment = fuHuaQiInvestment == 2 ? true : false;
}
}
/**主要查询 */
let dataBaseList = await financingData.findFinancingList(selectParam );
let usccMap = await fuhuaqiData.findAllFuHuaQiOperationNameMap();
/**拼接返回 需要注意的是 keyList要和titleList一一对应 */
let keyList = [
"name", "logonAdd", "operatingAdd", "financingAmount","investmentInstitutionsName",
"timeToObtainInvestment", "fuHuaQiInvestment", "fuHuaQiInvestmentAmount", "fuHuaQiInvestmentStyle", "createTime"
];
let titleList = [
"企业名称","注册地址","经营地址","融资金额(万元)","投资机构名称","获得投资时间",
"孵化器是否投资","孵化器投资金额(万元)","孵化器投资方式","录入时间",
];
let result = [titleList];
dataBaseList.forEach( info => {
/**截取返回字段 */
let changeData:any = extractData(splitResultConfig.FinancingListConfig, info, true);
changeData.fuhuaqiUscc = usccMap[info.fuHuaQiUscc] || "";
changeData.industry = changeEnumValue(configEnum.INDUSTRY, info.industry);
/**根据keyList的顺序生成小数组 */
let subList = [];
keyList.forEach(keyStr => {
subList.push(changeData[keyStr] || '');
});
result.push(subList);
});
return result;
}
\ No newline at end of file
...@@ -4,16 +4,16 @@ ...@@ -4,16 +4,16 @@
* 孵化器相关逻辑 包括孵化器的增删改查 * 孵化器相关逻辑 包括孵化器的增删改查
* *
*/ */
import * as eccFormParamConfig from "../../config/eccFormParamConfig"; import * as eccFormParamConfig from "../../../config/eccFormParamConfig";
import { findEnterpriseCountByFuHuaQiUscc, groupFindEnterpriseCount } from "../../data/enterprise/enterprise"; import { findEnterpriseCountByFuHuaQiUscc, groupFindEnterpriseCount } from "../../../data/enterprise/enterprise";
import * as fuhuaqiData from "../../data/fuHuaQi/fuhuaqi"; import * as fuhuaqiData from "../../../data/fuHuaQi/fuhuaqi";
import * as splitResultConfig from "../../config/splitResultConfig"; import * as splitResultConfig from "../../../config/splitResultConfig";
import * as configEnum from "../../config/enum"; import * as configEnum from "../../../config/enum";
import { checkChange, extractData } from "../../util/piecemeal"; import { checkChange, extractData } from "../../../util/piecemeal";
import { BizError } from "../../util/bizError"; import { BizError } from "../../../util/bizError";
import { ERRORENUM } from "../../config/errorEnum"; import { ERRORENUM } from "../../../config/errorEnum";
import { eccFormParam } from "../../util/verificationParam"; import { eccFormParam } from "../../../util/verificationParam";
import { changeEnumValue, eccEnumValue } from "../../util/verificationEnum"; import { changeEnumValue, eccEnumValue } from "../../../util/verificationEnum";
/** /**
...@@ -152,224 +152,4 @@ export async function updateOrganizationData(uscc:string, param) { ...@@ -152,224 +152,4 @@ export async function updateOrganizationData(uscc:string, param) {
} }
/**
* 获取孵化器基本信息列表
* 管理后台端
* @param lv 孵化器等级
* @param institutionalNature 机构性质
* @param industry 领域
* @param operationModel 运营模式
* @param foundingTeam 创业团队
* @param page 页数
* @returns
*/
export async function fuHuaQiBaseList(lv:number, institutionalNature:number, industry:number, operationModel:number, foundingTeam:number, page:number) {
/**拼接查询条件 并且校验是否符合枚举范围 可优化 抽出一个方法统一校验 */
let selectParam:any = {};
if (lv) {
eccEnumValue("管理后台查询孵化器列表", " 孵化器级别 ", configEnum.FUHUAQILV, lv);
selectParam.lv = lv;
}
if (institutionalNature) {
eccEnumValue("管理后台查询孵化器列表", " 机构性质 ", configEnum.INSTITUTIONALNATURE, institutionalNature);
selectParam.institutionalNature = institutionalNature;
}
if (industry){
eccEnumValue("管理后台查询孵化器列表", " 领域 ", configEnum.FUHUAINDUSTRY, industry);
selectParam.industry = industry;
}
if (operationModel) {
eccEnumValue("管理后台查询孵化器列表", " 运营模式 ", configEnum.OPERATIONMODEL, operationModel);
selectParam.operationModel = operationModel;
}
if (foundingTeam) {
eccEnumValue("管理后台查询孵化器列表", " 创业团队 ", configEnum.TEAM, foundingTeam);
selectParam.foundingTeamType = foundingTeam;
}
let enterpriseMap = await groupFindEnterpriseCount();//计算孵化器拥有的企业总数
let dataBaseList = await fuhuaqiData.findFuHuaQiListByPage(selectParam, (page-1)*10 );
let count = await fuhuaqiData.findFuHuaQiCount(selectParam);
/**拼接返回结果 */
let dataList = [];
dataBaseList.forEach( info => {
/**截取所需字段 */
let changeData:any = extractData(splitResultConfig.FuHuaQiBaseListConfig, info, true);
const EnterpriseTotal = enterpriseMap[info.uscc] || 0; //企业总数
let numOfEntities = EnterpriseTotal - (info.virtualEnterpriseNum || 0 ); //实体企业
changeData.enterpriseTotal = EnterpriseTotal;
changeData.numOfEntities = numOfEntities < 0 ? 0 : numOfEntities;
/**枚举转换 */
changeData.lv = changeEnumValue(configEnum.FUHUAQILV, changeData.lv);
changeData.industry = changeEnumValue(configEnum.FUHUAINDUSTRY, changeData.industry);
changeData.institutionalNature = changeEnumValue(configEnum.INSTITUTIONALNATURE, changeData.institutionalNature);
changeData.operationModel = changeEnumValue(configEnum.OPERATIONMODEL, changeData.operationModel);
changeData.foundingTeamStr = changeData.foundingTeamStr ? changeEnumValue(configEnum.TEAM, changeData.foundingTeamStr) : "无";//创始团队文字
let foundingTeam = [];
if (changeData.foundingTeam && changeData.foundingTeam.length) {
changeData.foundingTeam.forEach(item => {
let {memberName, memberAge, memberSchool, des} = item;
let type = changeEnumValue(configEnum.TEAM, item.type);//人才类型
foundingTeam.push({
memberName, memberAge, memberSchool, des, type,
memberSex : changeEnumValue(configEnum.SEX, item.memberSex),//成员性别
memberDEGREE : changeEnumValue(configEnum.DEGREE, item.memberDEGREE),//成员最高学历
});
});
changeData.foundingTeam = foundingTeam;
}
dataList.push(changeData);
});
return {count, dataList};
}
/**
* 导出符合条件的孵化器基本信息数据
* @param lv 孵化器等级
* @param institutionalNature 机构性质
* @param industry 领域
* @param operationModel 运营模式
* @param foundingTeam 创业团队
* @param type 导出类型 OUTPUTTYPE 枚举
* @returns
*/
export async function outPutFuHuaQiBaseData(lv:number, institutionalNature:number, industry:number, operationModel:number, foundingTeam:number, type:Number) {
let selectParam:any = {};
if (type == configEnum.OUTPUTTYPE.当前数据) {
/**当选择了当前数据时 拼接查询条件 */
let selectParam:any = {};
if (lv) {
eccEnumValue("管理后台查询孵化器列表", " 孵化器级别 ", configEnum.FUHUAQILV, lv);
selectParam.lv = lv;
}
if (institutionalNature) {
eccEnumValue("管理后台查询孵化器列表", " 机构性质 ", configEnum.INSTITUTIONALNATURE, institutionalNature);
selectParam.institutionalNature = institutionalNature;
}
if (industry){
eccEnumValue("管理后台查询孵化器列表", " 领域 ", configEnum.FUHUAINDUSTRY, industry);
selectParam.industry = industry;
}
if (operationModel) {
eccEnumValue("管理后台查询孵化器列表", " 运营模式 ", configEnum.OPERATIONMODEL, operationModel);
selectParam.operationModel = operationModel;
}
if (foundingTeam) {
eccEnumValue("管理后台查询孵化器列表", " 创业团队 ", configEnum.TEAM, foundingTeam);
selectParam.foundingTeamType = foundingTeam;
}
}
let enterpriseMap = await groupFindEnterpriseCount();//计算所有孵化器拥有的企业总数
let dataBaseList = await fuhuaqiData.findFuHuaQiList(selectParam);
/**拼接二维数组 */
let keyList = [
"name", "operationName", "uscc", "enterpriseTotal", "virtualEnterpriseNum", "numOfEntities", "logonTime", "incubatedAcreage",
"acreageTotal", "acreagePersonalUse", "lv", "identificationTime", "industry", "institutionalNature",
"liaison", "liaisonPhone", "personInCharge", "personInChargePhone", "operationModel", "foundingTeamType",
];
let titleList = [
"名称", "运营机构名称", "统一信用代码", "企业总数", "虚拟孵化", "实体孵化",
"注册时间", "在孵面积", "孵化器总面积", "孵化器自用面积", "孵化器级别", "认定时间",
"领域", "机构性质", "联系人", "联系电话", "负责人", "负责人联系电话"
];
let dataList = [];
let maxTeamNumber = 0;//最大团队数
let maxHatching = 0;//最大场地数
dataBaseList.forEach( info => {
/**截取需要的返回字段 */
let changeData:any = extractData(splitResultConfig.FuHuaQiBaseListConfig, info, true);
const EnterpriseTotal = enterpriseMap[info.uscc] || 0; //企业总数
let numOfEntities = EnterpriseTotal - (info.virtualEnterpriseNum || 0 ); //实体企业
changeData.enterpriseTotal = EnterpriseTotal;
changeData.numOfEntities = numOfEntities < 0 ? 0 : numOfEntities;
/**枚举转换 */
changeData.lv = changeEnumValue(configEnum.FUHUAQILV, changeData.lv);
changeData.industry = changeEnumValue(configEnum.FUHUAINDUSTRY, changeData.industry);
changeData.institutionalNature = changeEnumValue(configEnum.INSTITUTIONALNATURE, changeData.institutionalNature);
changeData.operationModel = changeEnumValue(configEnum.OPERATIONMODEL, changeData.operationModel);
changeData.foundingTeamType = changeEnumValue(configEnum.TEAM, changeData.foundingTeamType) || "无";
/**算出最大的创始团队和场地 用于计算x轴下标 */
if (changeData.foundingTeam && changeData.foundingTeam.length ) {
maxTeamNumber = Math.max(changeData.foundingTeam.length, maxTeamNumber);
}
if (changeData.hatchingGround && changeData.hatchingGround.length ) {
maxHatching = Math.max(changeData.hatchingGround.length, maxHatching);
}
/**生成除了创始团队和场地之外的 小数组 */
let subList = [];
keyList.forEach(subInfo => {
subList.push(info[subInfo] || '');
});
dataList.push(subList);
});
/**根据最大的创始团队数量 生成标题 */
let teamKeyList = ["type", "memberName", "memberSex", "memberAge", "memberDEGREE", "memberSchool", "des"];
let teamTitleList = ["人才类型", "成员姓名", "成员性别", "成员年龄", "成员最高学历", "毕业学校", "履历描述"];
for (let i = 0; i < maxTeamNumber; i++) {//平铺的插入数据
let teamNum = i+1;
teamTitleList.forEach(title => {
titleList.push(`成员${teamNum}-${title}`);
});
}
/**根据最大的场地数量 生成标题 */
let hatchingKeyList = [ "personInChargeAdd", "siteAcreage", "leasePrice" ];
let hatchingTitleList = ["孵化场地地址", "孵化场地面积", "孵化场地出租单价" ];
for (let i = 0; i < maxHatching; i++) {
let hatchingNumber = i+1;
hatchingTitleList.forEach(title => {
titleList.push(`场地${hatchingNumber}-${title}`);
});
}
/**创始团队初始插入数据的x轴下标 = titleList的长度
* 场地初始插入数据的x轴下标 = titleList的长度+(创始团队长度*标题个数)
* 按照这个规则依次插入数据即可
*/
dataBaseList.forEach((info, index) => {
if (info.foundingTeam && info.foundingTeam.length ) {
info.foundingTeam.forEach(teamInfo => {
teamInfo.type = changeEnumValue(configEnum.TEAM, teamInfo.type);
teamInfo.memberSex = changeEnumValue(configEnum.SEX, teamInfo.memberSex);
teamInfo.memberDEGREE = changeEnumValue(configEnum.DEGREE, teamInfo.memberDEGREE);
teamKeyList.forEach( teamKey => {
dataList[index].push(teamInfo[teamKey]);
});
});
}
if (info.hatchingGround && info.hatchingGround.length ) {
info.hatchingGround.forEach((hatchingInfo, hatchingIndex) => {1
hatchingKeyList.forEach( (hatchingKey, hatchingKeyIndex) => {
let addIndex = teamKeyList.length + ( (hatchingIndex * 3 ) + (hatchingKeyIndex) )
dataList[index][addIndex] = hatchingInfo[hatchingKey];
});
});
}
});
/**最后将标题作数组为二维数组的第一个子数组 */
dataList.unshift(titleList)
return dataList;
}
...@@ -10,14 +10,14 @@ ...@@ -10,14 +10,14 @@
* 5.创建和删除按钮触发 相当于更新了isUpdate的状态 * 5.创建和删除按钮触发 相当于更新了isUpdate的状态
*/ */
import { ERRORENUM } from "../../config/errorEnum"; import { ERRORENUM } from "../../../config/errorEnum";
import { BizError } from "../../util/bizError"; import { BizError } from "../../../util/bizError";
import * as monthData from "../../data/fuHuaQi/monthTable"; import * as monthData from "../../../data/fuHuaQi/monthTable";
import { extractData } from "../../util/piecemeal"; import { extractData } from "../../../util/piecemeal";
import * as sysTools from "../../tools/system"; import * as sysTools from "../../../tools/system";
import { findAllFuHuaQiOperationNameMap } from "../../data/fuHuaQi/fuhuaqi"; import { findAllFuHuaQiOperationNameMap } from "../../../data/fuHuaQi/fuhuaqi";
import * as splitResultConfig from "../../config/splitResultConfig"; import * as splitResultConfig from "../../../config/splitResultConfig";
import { OUTPUTTYPE } from "../../config/enum"; import { OUTPUTTYPE } from "../../../config/enum";
/** /**
...@@ -107,85 +107,3 @@ export async function getMonthByUscc(uscc:string) { ...@@ -107,85 +107,3 @@ export async function getMonthByUscc(uscc:string) {
return { data }; return { data };
} }
/**
* 月度出租率数据列表
* 管理后台端
* @param state 填报状态
* @param year 数据年份
* @param month 数据月份
* @param page 页面
*/
export async function monthTableList(state:number, year:number, month:number, page:number) {
let selectParam:any = {};
if ( !(state >=1 || state <=3) ) throw new BizError(ERRORENUM.参数错误, `state状态不合法 不合法值为 ${state}`);
if (state == 2 || state == 3) {
selectParam.draftLock = state == 2 ? true : false;
}
if (year) selectParam.year = year;
if (month) selectParam.month = month;
let dataBaseList = await monthData.findMonthTableListToPage(selectParam, (page-1)*10 );
let count = await monthData.findMonthTableListCount(selectParam);
let operationNameMap = await findAllFuHuaQiOperationNameMap();
let dataList = [];
dataBaseList.forEach( info => {
let onceInfo = {
operationName:operationNameMap[info.fuHuaQiUscc],
state:info.draftLock==false?'未填报':'已填报',
time:`${info.year}${info.month}月`,
occupancyRate:info.occupancyRate || '-'
};
dataList.push(onceInfo);
});
return {count, dataList}
}
/**
* 导出月度出租率数据列表
* 管理后台端
* @param state 填报状态
* @param year 数据年份
* @param month 数据月份
* @param page 页面
*/
export async function outPutMonthTableList(state:number, year:number, month:number, type:number) {
let selectParam:any = {};
if ( !(state >=1 || state <=3) ) throw new BizError(ERRORENUM.参数错误, `state状态不合法 不合法值为 ${state}`);
if (type == OUTPUTTYPE.当前数据 ) {
if (state == 2 || state == 3) {
selectParam.draftLock = state == 2 ? true : false;
}
if (year) selectParam.year = year;
if (month) selectParam.month = month;
}
let dataBaseList = await monthData.findMonthTableList(selectParam);
let operationNameMap = await findAllFuHuaQiOperationNameMap();
let keyList = [ "operationName", "state", "time", "occupancyRate"];
let titleList = [ "运营机构名称","填报状态","数据月份","出租率(%)"];
let dataList = [titleList];
dataBaseList.forEach( info => {
let onceInfo = {
operationName:operationNameMap[info.fuHuaQiUscc],
state:info.draftLock==false?'未填报':'已填报',
time:`${info.year}${info.month}月`,
occupancyRate:info.occupancyRate || '-'
};
let subList = [];
keyList.forEach(subInfo => {
subList.push(onceInfo[subInfo] || '');
});
dataList.push(subList);
});
return dataList;
}
\ No newline at end of file
/**
* 孵化器入口的系统设置
*/
...@@ -13,27 +13,30 @@ ...@@ -13,27 +13,30 @@
*/ */
import moment = require("moment"); import moment = require("moment");
import { TASKTYPEENUM } from "../../config/enum"; import { TASKTYPEENUM } from "../../../config/enum";
import { ERRORENUM } from "../../config/errorEnum"; import { ERRORENUM } from "../../../config/errorEnum";
import { findEnterpriseListByTaskId, updateEnterpriseDraftLock } from "../../data/enterprise/enterprise"; import { findEnterpriseListByTaskId, updateEnterpriseDraftLock } from "../../../data/enterprise/enterprise";
import { findFinancingListByTaskId, updateFinancingDraftLock } from "../../data/enterprise/financing"; import { findFinancingListByTaskId, updateFinancingDraftLock } from "../../../data/enterprise/financing";
import { findAllNotDisabledFuHuaQi } from "../../data/fuHuaQi/fuhuaqi"; import { findAllNotDisabledFuHuaQi } from "../../../data/fuHuaQi/fuhuaqi";
import * as monthTableData from "../../data/fuHuaQi/monthTable"; import * as monthTableData from "../../../data/fuHuaQi/monthTable";
import * as taskData from "../../data/fuHuaQi/task"; import * as taskData from "../../../data/fuHuaQi/task";
import { BizError } from "../../util/bizError"; import { BizError } from "../../../util/bizError";
import { logHandle } from "../../util/log"; import { logHandle } from "../../../util/log";
import { getLastTimeKey, getTaskId, getTaskIdByTime, getTimeKey } from "../../tools/system"; import { getLastTimeKey, getTaskId, getTaskIdByTime, getTimeKey } from "../../../tools/system";
/** /**
* 孵化器的任务列表 * 孵化器的任务列表 (待办任务)
* 小程序端 * 小程序端
* @param uscc 孵化器统一信用 * @param uscc 孵化器统一信用
* @returns [{key:1, title:'', enterpriseList:[] }] * @returns [{key:1, title:'', enterpriseList:[] }]
*/ */
export async function fuHuaQiTaskList(uscc:string) { export async function fuHuaQiTaskList(uscc:string) {
/**得到这个月的任务map taskMap格式为{type:{isSubmit}} */ /**得到这个月的任务map taskMap格式为{type:{isSubmit}} */
const TaskId = getTaskId(uscc); // const TaskId = getTaskId(uscc);
//todo 测试代码 15日把注释放开把下面的代码删了
const TaskId =`${uscc}${20232}`;
let taskMap = await taskData.findFuHuaQiTaskByTaskId(TaskId); let taskMap = await taskData.findFuHuaQiTaskByTaskId(TaskId);
let result = []; let result = [];
...@@ -46,6 +49,7 @@ export async function fuHuaQiTaskList(uscc:string) { ...@@ -46,6 +49,7 @@ export async function fuHuaQiTaskList(uscc:string) {
let onceObj = { let onceObj = {
key:ValueNumber, key:ValueNumber,
title:anyKey, //标题 title:anyKey, //标题
month:taskMap[ValueStr].month + '月',
enterpriseList:[] //相关的列表 这里不应该用这个字段名称 当时不能修改前端 沿用了这个字段名称 enterpriseList:[] //相关的列表 这里不应该用这个字段名称 当时不能修改前端 沿用了这个字段名称
}; };
...@@ -86,16 +90,78 @@ export async function fuHuaQiTaskList(uscc:string) { ...@@ -86,16 +90,78 @@ export async function fuHuaQiTaskList(uscc:string) {
/** /**
* 孵化器 已办任务列表 * 孵化器 已办任务列表
* 小程序端 * 小程序端 2.0
* 只显示selectTime月分的 已经办理的任务
* @param uscc 孵化器统一信用 * @param uscc 孵化器统一信用
* @returns [{type:1, title:'', enterpriseList:[] }] * @returns [{type:1, title:'', enterpriseList:[] }]
*/ */
export async function fuHuaQiCompletedList(uscc:string, selectTime:number) { export async function fuHuaQiCompletedList(uscc:string, selectTime:number) {
/**得到查询月的任务map taskMap格式为{type:{isSubmit}} */ /**得到查询月的任务map taskMap格式为{type:{isSubmit}} */
const TaskId = getTaskIdByTime(uscc, selectTime); const TaskId = getTaskIdByTime(uscc, selectTime);
let editable = getTaskId(uscc) == TaskId;//如果是本月,就是可以编辑的
let taskMap = await taskData.findFuHuaQiTaskByTaskId(TaskId); let taskMap = await taskData.findFuHuaQiTaskByTaskId(TaskId);
let result = [];
for (let key in TASKTYPEENUM) {
let anyKey:any = key;
/** 当key是枚举的键的时候 进入到逻辑 */
if (isNaN(anyKey)) {
const ValueStr = TASKTYPEENUM[key];//字符型的枚举值 也就是 "1"或者"2"或者"3"
const ValueNumber = parseInt(ValueStr);//number型的枚举值 也就是 1或者2或者3
let onceObj = {
key:ValueNumber,
title:anyKey, //标题
enterpriseList:[] //相关的列表 这里不应该用这个字段名称 当时不能修改前端 沿用了这个字段名称
};
/**获取提交的任务 */
if (taskMap[ValueStr].isSubmit) {
let dataList = [];
switch(ValueNumber) {
case TASKTYPEENUM.孵化器月度填报:
/** 这里加限制 在月度任务中 isUpdate=true代表已经修改 isUpdate=false表示没有这个任务 详细说明看./month.ts注释*/
dataList = await monthTableData.findmonthTableListByTaskId(TaskId);
break;
case TASKTYPEENUM.新注册或迁入企业登记:
/**限制 draftLock = false 即草稿数据 这里可以不用这个限制 */
dataList = await findEnterpriseListByTaskId(TaskId);
dataList.forEach(item => {
item.uscc = item.draftId;//这里转换一下,为了不改前端代码 使用uscc这个名称,但是实际是draftId
});
break;
case TASKTYPEENUM.融资企业填报:
/**限制 draftLock = false 即草稿数据 这里可以不用这个限制 */
dataList = await findFinancingListByTaskId(TaskId);
break;
}
dataList.forEach(info => {
let addInfo:any = {name:info.name, id:info.uscc, editable, isCreate:info.isCreate || false};
onceObj.enterpriseList.push(addInfo);
});
result.push(onceObj);
}
}
}
return {taskList:result};
}
let lastDateKey = getLastTimeKey(); /**
* 孵化器 过期任务列表
* 小程序端 2.0
* 只显示selectTime月份的 过期任务
* @param uscc 孵化器统一信用
* @returns [{type:1, title:'', enterpriseList:[] }]
*/
export async function fuHuaQiPastdueList(uscc:string, selectTime:number) {
/**得到查询月的任务map taskMap格式为{type:{isSubmit}} */
const TaskId = getTaskIdByTime(uscc, selectTime);
let editable = getTaskId(uscc) == TaskId;//如果是本月,就是可以编辑的
let taskMap = await taskData.findFuHuaQiTaskByTaskId(TaskId);
let result = []; let result = [];
for (let key in TASKTYPEENUM) { for (let key in TASKTYPEENUM) {
...@@ -110,7 +176,7 @@ export async function fuHuaQiCompletedList(uscc:string, selectTime:number) { ...@@ -110,7 +176,7 @@ export async function fuHuaQiCompletedList(uscc:string, selectTime:number) {
enterpriseList:[] //相关的列表 这里不应该用这个字段名称 当时不能修改前端 沿用了这个字段名称 enterpriseList:[] //相关的列表 这里不应该用这个字段名称 当时不能修改前端 沿用了这个字段名称
}; };
/**没有提交任务 则获取本月提交的任务相关信息 */ /**未提交的任务 */
if (!taskMap[ValueStr].isSubmit) { if (!taskMap[ValueStr].isSubmit) {
let dataList = []; let dataList = [];
...@@ -133,7 +199,7 @@ export async function fuHuaQiCompletedList(uscc:string, selectTime:number) { ...@@ -133,7 +199,7 @@ export async function fuHuaQiCompletedList(uscc:string, selectTime:number) {
} }
dataList.forEach(info => { dataList.forEach(info => {
let addInfo:any = {name:info.name, id:info.uscc, isCreate:info.isCreate || false}; let addInfo:any = { name:info.name };
onceObj.enterpriseList.push(addInfo); onceObj.enterpriseList.push(addInfo);
}); });
result.push(onceObj); result.push(onceObj);
...@@ -145,6 +211,7 @@ export async function fuHuaQiCompletedList(uscc:string, selectTime:number) { ...@@ -145,6 +211,7 @@ export async function fuHuaQiCompletedList(uscc:string, selectTime:number) {
} }
/** /**
* 提交任务 * 提交任务
* 小程序端 * 小程序端
...@@ -206,17 +273,17 @@ export async function provideTask() { ...@@ -206,17 +273,17 @@ export async function provideTask() {
let addList = [];//任务列表 let addList = [];//任务列表
let monthList = [];//月度填报列表 let monthList = [];//月度填报列表
const MonthNumber = moment().subtract(1, 'months').month() + 1; const MonthNumber = moment().subtract(1, 'months').month() + 1;//数据填报月份
const YearNumber = new Date().getFullYear(); const YearNumber =moment().subtract(1, 'months').year();
const MonthTableName = `${MonthNumber}月孵化器月度填报`; const MonthTableName = `${MonthNumber}月孵化器月度填报`;
let fuHuaQiList = await findAllNotDisabledFuHuaQi(); let fuHuaQiList = await findAllNotDisabledFuHuaQi();
fuHuaQiList.forEach(info => { fuHuaQiList.forEach(info => {
let { uscc } = info; let { uscc } = info;
let taskId = getTaskId(uscc); let taskId = getTaskId(uscc);
addList.push( { key:TimeKey, type:TASKTYPEENUM.孵化器月度填报, taskId, fuHuaQiUscc:uscc, isSubmit:false}, addList.push( { key:TimeKey, type:TASKTYPEENUM.孵化器月度填报, month:MonthNumber, taskId, fuHuaQiUscc:uscc, isSubmit:false},
{ key:TimeKey, type:TASKTYPEENUM.新注册或迁入企业登记, taskId, fuHuaQiUscc:uscc, isSubmit:false }, { key:TimeKey, type:TASKTYPEENUM.新注册或迁入企业登记, month:MonthNumber, taskId, fuHuaQiUscc:uscc, isSubmit:false },
{ key:TimeKey, type:TASKTYPEENUM.融资企业填报, taskId, fuHuaQiUscc:uscc, isSubmit:false}); { key:TimeKey, type:TASKTYPEENUM.融资企业填报, taskId, month:MonthNumber, fuHuaQiUscc:uscc, isSubmit:false});
/**任务报表的初始状态为 草稿(draftLock=fals) 未被编辑(isUpdate=false) */ /**任务报表的初始状态为 草稿(draftLock=fals) 未被编辑(isUpdate=false) */
monthList.push({ taskId, name:MonthTableName, fuHuaQiUscc:uscc, month:MonthNumber, year:YearNumber, draftLock:false, isUpdate:false }); monthList.push({ taskId, name:MonthTableName, fuHuaQiUscc:uscc, month:MonthNumber, year:YearNumber, draftLock:false, isUpdate:false });
}); });
...@@ -224,11 +291,49 @@ export async function provideTask() { ...@@ -224,11 +291,49 @@ export async function provideTask() {
try { try {
/**初始化 任务 */ /**初始化 任务 */
await taskData.createTaskToList(addList); await taskData.createTaskToList(addList);
logHandle(`添加了${addList.length} 任务`);
/**初始化 月度填报表 */ /**初始化 月度填报表 */
await monthTableData.createMonthTableToList(monthList); await monthTableData.createMonthTableToList(monthList);
logHandle(`添加了${addList.length}`); logHandle(`添加了${monthList.length} 月度任务`);
} catch (err) { } catch (err) {
new BizError(ERRORENUM.系统错误, '添加任务和月度报表的时候 出现了异常 请检查数据库 ', err); new BizError(ERRORENUM.系统错误, '添加任务和月度报表的时候 出现了异常 请检查数据库 ', err);
} }
} }
/**
* 发放1月数据
*/
export async function provideLastTask() {
const TimeKey = '20232';
let addList = [];//任务列表
let monthList = [];//月度填报列表
const MonthNumber = 1;//数据填报月份
const YearNumber = 2023
const MonthTableName = `${MonthNumber}月孵化器月度填报`;
let fuHuaQiList = await findAllNotDisabledFuHuaQi();
fuHuaQiList.forEach(info => {
let { uscc } = info;
let taskId = `${uscc}${TimeKey}`;
addList.push( { key:TimeKey, type:TASKTYPEENUM.孵化器月度填报, month:1, taskId, fuHuaQiUscc:uscc, isSubmit:false},
{ key:TimeKey, type:TASKTYPEENUM.新注册或迁入企业登记, month:1, taskId, fuHuaQiUscc:uscc, isSubmit:false },
{ key:TimeKey, type:TASKTYPEENUM.融资企业填报, month:1, taskId, fuHuaQiUscc:uscc, isSubmit:false});
/**任务报表的初始状态为 草稿(draftLock=fals) 未被编辑(isUpdate=false) */
monthList.push({ taskId, name:MonthTableName, fuHuaQiUscc:uscc, month:MonthNumber, year:YearNumber, draftLock:false, isUpdate:false });
});
try {
/**初始化 任务 */
await taskData.createTaskToList(addList);
logHandle(`添加了${addList.length} 任务`);
/**初始化 月度填报表 */
await monthTableData.createMonthTableToList(monthList);
logHandle(`添加了${monthList.length} 月度任务`);
} catch (err) {
new BizError(ERRORENUM.系统错误, '添加任务和月度报表的时候 出现了异常 请检查数据库 ', err);
}
}
\ No newline at end of file
...@@ -6,14 +6,14 @@ ...@@ -6,14 +6,14 @@
* 密码规则:6-18位 只允许有数字和字符,可以只有数字也可以只有字母 不允许有特殊字符 2023年02月21日确定需求 * 密码规则:6-18位 只允许有数字和字符,可以只有数字也可以只有字母 不允许有特殊字符 2023年02月21日确定需求
*/ */
import * as eccFormParamConfig from "../../config/eccFormParamConfig"; import * as eccFormParamConfig from "../../../config/eccFormParamConfig";
import { ERRORENUM } from "../../config/errorEnum"; import { ERRORENUM } from "../../../config/errorEnum";
import * as splitResultConfig from "../../config/splitResultConfig"; import * as splitResultConfig from "../../../config/splitResultConfig";
import * as fuhuaqiData from "../../data/fuHuaQi/fuhuaqi" import * as fuhuaqiData from "../../../data/fuHuaQi/fuhuaqi"
import { BizError } from "../../util/bizError"; import { BizError } from "../../../util/bizError";
import * as sysTools from "../../tools/system"; import * as sysTools from "../../../tools/system";
import { eccFormParam } from "../../util/verificationParam"; import { eccFormParam } from "../../../util/verificationParam";
import { extractData } from "../../util/piecemeal"; import { extractData } from "../../../util/piecemeal";
/** /**
...@@ -75,23 +75,27 @@ export async function firstLoginChangePwd(uscc:string, pwd:string, confirmPwd:st ...@@ -75,23 +75,27 @@ export async function firstLoginChangePwd(uscc:string, pwd:string, confirmPwd:st
* 重置密码 * 重置密码
* 小程序端 * 小程序端
* @param uscc 信用代码 * @param uscc 信用代码
* @param pwd 原密码 * @param pwd 原密码 md5之后的
* @param newPwd 修改后的密码 * @param newPwd 新密码 未md5
* @param confirmPwd 确认新密码 未md5
* @returns {isSuccess:true/false} * @returns {isSuccess:true/false}
*/ */
export async function changePassword(uscc:string, pwd:string, newPwd:string) { export async function changePassword(uscc:string, pwd:string, newPwd:string, confirmPwd:string ) {
let reg = new RegExp("[`~!@#$^&*()=|{}':;',\\[\\].<>/?~!@#¥……&*()——|{}【】‘;:”“'。,、?]"); if (newPwd != confirmPwd) throw new BizError(ERRORENUM.密码不一致);
if (reg.test(newPwd)) { if (newPwd.search(/^[A-Za-z0-9]{6,18}$/) < 0) throw new BizError(ERRORENUM.密码只能由618位字符和数字组成);
throw new BizError(ERRORENUM.密码不允许有特殊字符, uscc, pwd);
}
if (pwd.length > 24) {
throw new BizError(ERRORENUM.密码长度不能超过24个字符, uscc, pwd);
}
let fuhuaqiInfo = await fuhuaqiData.findFuHuaQiByUSCC(uscc); let fuhuaqiInfo = await fuhuaqiData.findFuHuaQiByUSCC(uscc);
if (!fuhuaqiInfo) throw new BizError(ERRORENUM.未找到数据); if (!fuhuaqiInfo) throw new BizError(ERRORENUM.未找到数据);
/**由于pwd是md5之后的 所以这里md5一次即可 */
let checkPwd = sysTools.getPwdMd5(fuhuaqiInfo.uscc, pwd); let checkPwd = sysTools.getPwdMd5(fuhuaqiInfo.uscc, pwd);
if (fuhuaqiInfo.pwd != checkPwd) throw new BizError(ERRORENUM.密码错误); if (fuhuaqiInfo.pwd != checkPwd) throw new BizError(ERRORENUM.密码错误);
fuhuaqiInfo.pwd = sysTools.getPwdMd5(uscc, newPwd);
/**考虑到如果前端把新密码也md5 就不可以验证是不是符合规则 所以前端传的是明文
* 我们初始化密码的时候 有两次加密 第一次是密码md5 然后再和uscc 进行md5
* 于是这里也要如此操作
*/
fuhuaqiInfo.pwd = sysTools.getPwdMd5(uscc, sysTools.md5PwdStr(newPwd));
await fuhuaqiInfo.save(); await fuhuaqiInfo.save();
return {isSuccess:true}; return {isSuccess:true};
...@@ -133,48 +137,11 @@ export async function logout(uscc:string){ ...@@ -133,48 +137,11 @@ export async function logout(uscc:string){
let count = await fuhuaqiData.findFuHuaQiUserCount(selectParam); let count = await fuhuaqiData.findFuHuaQiUserCount(selectParam);
let dataList = []; let dataList = [];
dataBaseList.forEach( info => { dataBaseList.forEach( info => {
let changeData = extractData(splitResultConfig.FuHuaQiListConfig, info, true); let changeData:any = extractData(splitResultConfig.FuHuaQiListConfig, info, true);
changeData.liaison = info.personInCharge;//todo 这里陈金晶写的有bug 后续记得把协议和后台重新顶一下
dataList.push(changeData); dataList.push(changeData);
}); });
return {count, dataList}; return {count, dataList};
} }
/**
* 修改账号状态
* 管理后台端 禁用/启用
* @param uscc 孵化器统一信用代码
* @param userStatem 是否禁用 true=启用 false=禁用
* @returns
*/
export async function updateState(uscc:string, userState:boolean) {
let fuhuaqiInfo = await fuhuaqiData.findFuHuaQiByUSCC(uscc);
if(!fuhuaqiInfo) throw new BizError(ERRORENUM.账号不存在);
fuhuaqiInfo.userState = userState;
await fuhuaqiInfo.save();
return {isSuccess:true};
}
/**
* 添加孵化器账号
* 管理后台端
* @param param 表单信息
* @returns
*/
export async function addUser(param) {
eccFormParam("新增孵化器账号信息", eccFormParamConfig.FuHuaQiUserConfig, param);//校验表单参数
let fuhuaqiInfo = await fuhuaqiData.findFuHuaQiByUSCC(param.uscc);
if ( fuhuaqiInfo ) throw new BizError(ERRORENUM.该孵化器账号信息已存在, `${param.uscc}`);
const Pwd = param.uscc.slice(param.uscc.length-3);
param.pwd = Pwd;
await fuhuaqiData.createFuHuaQiUser(param);
return {isSuccess:true};
}
...@@ -5,10 +5,10 @@ ...@@ -5,10 +5,10 @@
* 预留好 重置密码 退出登录 接口 * 预留好 重置密码 退出登录 接口
*/ */
import { ERRORENUM } from "../../config/errorEnum"; import { ERRORENUM } from "../../../config/errorEnum";
import { findGuanWeiHuiUserInfoByLoginId } from "../../data/guanWeiHui/guanweihui"; import { findGuanWeiHuiUserInfoByLoginId } from "../../../data/guanWeiHui/guanweihui";
import { BizError } from "../../util/bizError"; import { BizError } from "../../../util/bizError";
import { getPwdMd5, getToken } from "../../tools/system"; import { getPwdMd5, getToken } from "../../../tools/system";
/** /**
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
import { findTaskCountByKey } from "../data/fuHuaQi/task"; import { findTaskCountByKey } from "../data/fuHuaQi/task";
import { getTimeKey } from "../tools/system"; import { getTimeKey } from "../tools/system";
import { provideTask } from "./fuHuqQi/task"; import { provideTask } from "./mobileFuHuaQi/fuHuaQi/task";
export function initSystemTask() { export function initSystemTask() {
fuHuaQiTask(); fuHuaQiTask();
......
...@@ -153,7 +153,7 @@ export const FuHuaQiListConfig = { ...@@ -153,7 +153,7 @@ export const FuHuaQiListConfig = {
operationName:{key:"运营机构名称 不可修改"}, operationName:{key:"运营机构名称 不可修改"},
uscc:{key:"营业执照"}, uscc:{key:"营业执照"},
liaison:{key:"联系人"}, liaison:{key:"联系人"},
liaisonPhone:{key:"负责人"}, liaisonPhone:{key:"联系人电话"},
personInChargePhone:{key:"负责人联系电话"}, personInChargePhone:{key:"负责人联系电话"},
userState:{key:"账号状态"} userState:{key:"账号状态"}
} }
...@@ -222,4 +222,17 @@ export const OrganizationBaseDataConfig = { ...@@ -222,4 +222,17 @@ export const OrganizationBaseDataConfig = {
personInChargePhone:{key:"负责人联系电话"}, personInChargePhone:{key:"负责人联系电话"},
operationModelDes:{key:"运营模式描述"} operationModelDes:{key:"运营模式描述"}
// hatchingGround:{key:"经备案孵化场地"} // hatchingGround:{key:"经备案孵化场地"}
}
/**
* 使用端: 小程序端【孵化器入口】
* 场景: 我的企业列表
* 备注:
*/
export const myEnterpriseDataConfig = {
name:{key:"名称"},
uscc:{key:"统一信用代码"},
state:{key:"孵化器状态"},
leasedArea:{key:"租赁面积"}
} }
\ No newline at end of file
...@@ -27,6 +27,7 @@ const enterpriseSchema = new Schema({ ...@@ -27,6 +27,7 @@ const enterpriseSchema = new Schema({
enterpriseIsInPut:{type:Boolean, default:false},//是否是初始数据 todo 后续要弃用 兼容原始数据无法判断是否是迁入企业这个问题加的字段 enterpriseIsInPut:{type:Boolean, default:false},//是否是初始数据 todo 后续要弃用 兼容原始数据无法判断是否是迁入企业这个问题加的字段
draftId:{type:String, index:true},//草稿id 编辑的时候使用这个id 保存之后就不认这个id了 draftId:{type:String, index:true},//草稿id 编辑的时候使用这个id 保存之后就不认这个id了
mainBusiness:{type:String, default:""},//主营业务 mainBusiness:{type:String, default:""},//主营业务
state:Number,//孵化状态 遵循枚举 FUHUASTATE 值
}); });
var enterpriseModel; var enterpriseModel;
...@@ -165,7 +166,6 @@ export async function deleteEnterprise(draftId:string) { ...@@ -165,7 +166,6 @@ export async function deleteEnterprise(draftId:string) {
/** /**
* 获取符合条件的所有企业 * 获取符合条件的所有企业
* @param selectParam 查询参数 * @param selectParam 查询参数
* @param skipCount 跳过数量
* @returns [] 孵化器列表 * @returns [] 孵化器列表
*/ */
export async function findEnterpriseList(selectParam) { export async function findEnterpriseList(selectParam) {
......
...@@ -16,8 +16,8 @@ const monthTableSchema = new Schema({ ...@@ -16,8 +16,8 @@ const monthTableSchema = new Schema({
occupancyRate:Number,//出租率 单位为% occupancyRate:Number,//出租率 单位为%
/**不下发字段 */ /**不下发字段 */
draftLock:{type:Boolean, default:false},//草稿锁,true为提交之后,false为草稿 draftLock:{type:Boolean, default:false},//草稿锁,true为提交之后,false为草稿
month:{type:Number, index:true}, month:{type:Number, index:true},//数据填报月份
year:{type:Number, index:true}, year:{type:Number, index:true},//数据填报年份
isUpdate:{type:Boolean, default:false}, isUpdate:{type:Boolean, default:false},
submitTime:Number,//提交时间 submitTime:Number,//提交时间
}); });
...@@ -111,3 +111,14 @@ export async function findMonthTableListCount(selectParam:object) { ...@@ -111,3 +111,14 @@ export async function findMonthTableListCount(selectParam:object) {
export async function createMonthTableToList(tableList:object) { export async function createMonthTableToList(tableList:object) {
await monthTableModel.insertMany(tableList); await monthTableModel.insertMany(tableList);
} }
/**
* 获取所有月度任务数据
* @param selectParam 查询参数
* @returns number 数据数量
*/
export async function findMonthCount(selectParam) {
return await monthTableModel.find(selectParam).count();
}
...@@ -18,6 +18,7 @@ const fuHuaQiTaskSchema = new Schema({ ...@@ -18,6 +18,7 @@ const fuHuaQiTaskSchema = new Schema({
submitTime:Number,//提交时间 submitTime:Number,//提交时间
// relevanceId:String,//任务关联的表 financing 或 enterprise 的id 弃用 // relevanceId:String,//任务关联的表 financing 或 enterprise 的id 弃用
isSubmit:Boolean,//是否提交 isSubmit:Boolean,//是否提交
month:Number,//数据填报月
}); });
var fuHuaQiTaskModel; var fuHuaQiTaskModel;
...@@ -50,7 +51,7 @@ export async function findFuHuaQiTaskByTaskId(taskId:string) { ...@@ -50,7 +51,7 @@ export async function findFuHuaQiTaskByTaskId(taskId:string) {
let findList = await fuHuaQiTaskModel.find({taskId}).exec() || []; let findList = await fuHuaQiTaskModel.find({taskId}).exec() || [];
let taskMap = {}; let taskMap = {};
findList.forEach(item => { findList.forEach(item => {
taskMap[item.type] = {isSubmit:item.isSubmit}; taskMap[item.type] = {isSubmit:item.isSubmit, month:item.month};
}); });
return taskMap; return taskMap;
} }
......
...@@ -8,7 +8,7 @@ async function lanuch() { ...@@ -8,7 +8,7 @@ async function lanuch() {
await initConfig();//初始化配置解析 await initConfig();//初始化配置解析
await initDB(); await initDB();
await initBasicData(); await initBasicData();
await initSystemTask(); // await initSystemTask();
httpServer.createServer(systemConfig.port); httpServer.createServer(systemConfig.port);
console.log('This indicates that the server is started successfully.'); console.log('This indicates that the server is started successfully.');
} }
......
...@@ -57,4 +57,24 @@ export async function checkGuanWeiHuiToken(req, res, next) { ...@@ -57,4 +57,24 @@ export async function checkGuanWeiHuiToken(req, res, next) {
req.headers.uscc = req.headers.userid; req.headers.uscc = req.headers.userid;
next(); next();
}
/**
* 中间件 校验管委会token
* @param req
* @param res
* @param next
* @returns
*/
export async function checkInterior(req, res, next) {
if (!req.headers) req.headers = {};
const Sign = req.headers.sign;
let sysSign = 'sadfjslakdfjlksadjffujisdaiofjsajl09092302'
if (!Sign || Sign != sysSign) return next(new BizError(ERRORENUM.非法登录, `内部接口非法调用 ${Sign}`));
next();
} }
\ No newline at end of file
...@@ -34,3 +34,8 @@ let financingModel; ...@@ -34,3 +34,8 @@ let financingModel;
export function initModel() { export function initModel() {
financingModel = new mySqlTableClass("monthTable", TableConfig, SQLENUM, MORETABLESQLENUM); financingModel = new mySqlTableClass("monthTable", TableConfig, SQLENUM, MORETABLESQLENUM);
} }
export async function createMonthTableToList(fuHuaQiList:object) {
await financingModel.insertMany(fuHuaQiList);
}
\ No newline at end of file
...@@ -5,8 +5,8 @@ ...@@ -5,8 +5,8 @@
*/ */
import * as asyncHandler from 'express-async-handler'; import * as asyncHandler from 'express-async-handler';
import * as enterpriseBiz from '../../biz/enterprise/enterprise'; import * as enterpriseAdminBiz from '../../biz/admin/enterprise/enterprise';
import * as financingBiz from '../../biz/enterprise/financing'; import * as financingAdminBiz from '../../biz/admin/enterprise/financing';
import { getTimeKey } from '../../tools/system'; import { getTimeKey } from '../../tools/system';
import { checkGuanWeiHuiToken } from '../../middleware/user'; import { checkGuanWeiHuiToken } from '../../middleware/user';
import { eccReqParamater } from '../../util/verificationParam'; import { eccReqParamater } from '../../util/verificationParam';
...@@ -31,7 +31,7 @@ async function getEnterpriseList(req, res) { ...@@ -31,7 +31,7 @@ async function getEnterpriseList(req, res) {
const NotMustHaveKeys = ["createType", "fuHuaQiUscc", "industry", "isNaturalPersonHolding" ]; const NotMustHaveKeys = ["createType", "fuHuaQiUscc", "industry", "isNaturalPersonHolding" ];
let { createType, fuHuaQiUscc, industry, isNaturalPersonHolding, page } = eccReqParamater(reqConf, req.body, NotMustHaveKeys); let { createType, fuHuaQiUscc, industry, isNaturalPersonHolding, page } = eccReqParamater(reqConf, req.body, NotMustHaveKeys);
let result = await enterpriseBiz.enterpriseList(createType, fuHuaQiUscc, industry, isNaturalPersonHolding, page); let result = await enterpriseAdminBiz.enterpriseList(createType, fuHuaQiUscc, industry, isNaturalPersonHolding, page);
res.success(result); res.success(result);
} }
...@@ -46,7 +46,7 @@ async function getFinancingList(req, res) { ...@@ -46,7 +46,7 @@ async function getFinancingList(req, res) {
const NotMustHaveKeys = ["monthData", "fuHuaQiName", "fuHuaQiInvestment", "industry" ]; const NotMustHaveKeys = ["monthData", "fuHuaQiName", "fuHuaQiInvestment", "industry" ];
let {monthData, fuHuaQiName, industry, fuHuaQiInvestment, page} = eccReqParamater(reqConf, req.body, NotMustHaveKeys); let {monthData, fuHuaQiName, industry, fuHuaQiInvestment, page} = eccReqParamater(reqConf, req.body, NotMustHaveKeys);
let result = await financingBiz.financingList(monthData, fuHuaQiName, industry, fuHuaQiInvestment, page); let result = await financingAdminBiz.financingList(monthData, fuHuaQiName, industry, fuHuaQiInvestment, page);
res.success(result); res.success(result);
} }
...@@ -58,7 +58,7 @@ async function getFinancingList(req, res) { ...@@ -58,7 +58,7 @@ async function getFinancingList(req, res) {
* @param res * @param res
*/ */
async function affiliationFuHuaQi(req, res) { async function affiliationFuHuaQi(req, res) {
let result = await enterpriseBiz.getAffiliationFuHuaQi(); let result = await enterpriseAdminBiz.getAffiliationFuHuaQi();
res.success(result); res.success(result);
} }
...@@ -74,7 +74,7 @@ async function outPutEnterpriseData(req, res) { ...@@ -74,7 +74,7 @@ async function outPutEnterpriseData(req, res) {
let { createType, fuHuaQiUscc, industry, isNaturalPersonHolding, type } = eccReqParamater(reqConf, req.body, NotMustHaveKeys); let { createType, fuHuaQiUscc, industry, isNaturalPersonHolding, type } = eccReqParamater(reqConf, req.body, NotMustHaveKeys);
let dataList = await enterpriseBiz.outPutEnterpriseData(createType, fuHuaQiUscc, industry, isNaturalPersonHolding, type); let dataList = await enterpriseAdminBiz.outPutEnterpriseData(createType, fuHuaQiUscc, industry, isNaturalPersonHolding, type);
let name = `在孵企业${getTimeKey()}.xlsx`; let name = `在孵企业${getTimeKey()}.xlsx`;
...@@ -92,7 +92,7 @@ async function outPutFinancingData(req, res) { ...@@ -92,7 +92,7 @@ async function outPutFinancingData(req, res) {
const NotMustHaveKeys = ["monthData", "fuHuaQiName", "fuHuaQiInvestment", "industry" ]; const NotMustHaveKeys = ["monthData", "fuHuaQiName", "fuHuaQiInvestment", "industry" ];
let {monthData, fuHuaQiName, industry, fuHuaQiInvestment, type} = eccReqParamater(reqConf, req.body, NotMustHaveKeys); let {monthData, fuHuaQiName, industry, fuHuaQiInvestment, type} = eccReqParamater(reqConf, req.body, NotMustHaveKeys);
let dataList = await financingBiz.outPutFinancingList(monthData, fuHuaQiName, industry, fuHuaQiInvestment, type); let dataList = await financingAdminBiz.outPutFinancingList(monthData, fuHuaQiName, industry, fuHuaQiInvestment, type);
let name = `融资企业${getTimeKey()}.xlsx`; let name = `融资企业${getTimeKey()}.xlsx`;
......
...@@ -3,12 +3,13 @@ ...@@ -3,12 +3,13 @@
*/ */
import * as asyncHandler from 'express-async-handler'; import * as asyncHandler from 'express-async-handler';
import * as userBiz from '../../biz/fuHuqQi/user'; import * as userBiz from '../../biz/mobileFuHuaQi/fuHuaQi/user';
import * as baseBiz from '../../biz/fuHuqQi/base'; import * as monthAdminBiz from '../../biz/admin/fuHuaQi/month';
import * as fuHuaQiAdminBiz from '../../biz/admin/fuHuaQi/fuHuaQi';
import * as taskBiz from '../../biz/mobileFuHuaQi/fuHuaQi/task';
import { getTimeKey } from '../../tools/system'; import { getTimeKey } from '../../tools/system';
import { monthTableList } from '../../biz/fuHuqQi/month'; import { checkGuanWeiHuiToken, checkInterior } from '../../middleware/user';
import { checkGuanWeiHuiToken } from '../../middleware/user'; import * as monthBiz from '../../biz/mobileFuHuaQi/fuHuaQi/month';
import * as monthBiz from '../../biz/fuHuqQi/month';
import { eccReqParamater } from '../../util/verificationParam'; import { eccReqParamater } from '../../util/verificationParam';
...@@ -20,9 +21,16 @@ export function setRouter(httpServer) { ...@@ -20,9 +21,16 @@ export function setRouter(httpServer) {
httpServer.post('/admin/fuhuaqi/adduser',checkGuanWeiHuiToken,asyncHandler(addUser)); httpServer.post('/admin/fuhuaqi/adduser',checkGuanWeiHuiToken,asyncHandler(addUser));
httpServer.post('/admin/data/output/fuhuaqi',checkGuanWeiHuiToken, asyncHandler(outPutFuHuaQiData)); httpServer.post('/admin/data/output/fuhuaqi',checkGuanWeiHuiToken, asyncHandler(outPutFuHuaQiData));
httpServer.post('/admin/data/output/month',checkGuanWeiHuiToken, asyncHandler(outPutMonthData)); httpServer.post('/admin/data/output/month',checkGuanWeiHuiToken, asyncHandler(outPutMonthData));
/**测试接口 用于发放1月份任务 */
httpServer.post('/admin/admin/task/add12',checkInterior, asyncHandler(provideLastTask));
} }
async function provideLastTask(req, res) {
await taskBiz.provideLastTask();
res.success({isUsccess:true});
}
/** /**
* 孵化器基本信息列表 * 孵化器基本信息列表
* @param req * @param req
...@@ -40,7 +48,7 @@ async function fuHuaQiBaseList(req, res) { ...@@ -40,7 +48,7 @@ async function fuHuaQiBaseList(req, res) {
const NotMustHaveKeys = ["lv", "institutionalNature", "operationModel", "foundingTeam" , "industry"]; const NotMustHaveKeys = ["lv", "institutionalNature", "operationModel", "foundingTeam" , "industry"];
let {lv, institutionalNature, industry, operationModel, foundingTeam, page} = eccReqParamater(reqConf, req.body, NotMustHaveKeys); let {lv, institutionalNature, industry, operationModel, foundingTeam, page} = eccReqParamater(reqConf, req.body, NotMustHaveKeys);
let result = await baseBiz.fuHuaQiBaseList(lv, institutionalNature, industry, operationModel, foundingTeam, page); let result = await fuHuaQiAdminBiz.fuHuaQiBaseList(lv, institutionalNature, industry, operationModel, foundingTeam, page);
res.success(result); res.success(result);
} }
...@@ -56,7 +64,7 @@ async function getMonthList(req, res) { ...@@ -56,7 +64,7 @@ async function getMonthList(req, res) {
const NotMustHaveKeys = ["state", "year", "month"]; const NotMustHaveKeys = ["state", "year", "month"];
let { state, year, month, page } = eccReqParamater(reqConf, req.body, NotMustHaveKeys); let { state, year, month, page } = eccReqParamater(reqConf, req.body, NotMustHaveKeys);
let result = await monthTableList(state, year, month, page); let result = await monthAdminBiz.monthTableList(state, year, month, page);
res.success(result); res.success(result);
} }
...@@ -85,7 +93,7 @@ async function getMonthList(req, res) { ...@@ -85,7 +93,7 @@ async function getMonthList(req, res) {
let reqConf = {userState: 'Boolean', uscc: 'String' }; let reqConf = {userState: 'Boolean', uscc: 'String' };
let { userState, uscc } = eccReqParamater(reqConf, req.body); let { userState, uscc } = eccReqParamater(reqConf, req.body);
let result = await userBiz.updateState(uscc, userState); let result = await fuHuaQiAdminBiz.updateState(uscc, userState);
res.success(result); res.success(result);
} }
...@@ -99,7 +107,7 @@ async function addUser(req, res) { ...@@ -99,7 +107,7 @@ async function addUser(req, res) {
let reqConf = {form: 'Object' }; let reqConf = {form: 'Object' };
let { form } = eccReqParamater(reqConf, req.body); let { form } = eccReqParamater(reqConf, req.body);
let result = await userBiz.addUser(form); let result = await fuHuaQiAdminBiz.addUser(form);
res.success(result); res.success(result);
} }
...@@ -110,7 +118,7 @@ async function outPutFuHuaQiData(req, res) { ...@@ -110,7 +118,7 @@ async function outPutFuHuaQiData(req, res) {
const NotMustHaveKeys = ["lv", "institutionalNature", "industry", "operationModel", "foundingTeam"]; const NotMustHaveKeys = ["lv", "institutionalNature", "industry", "operationModel", "foundingTeam"];
let { lv, institutionalNature, industry, type, operationModel, foundingTeam } = eccReqParamater(reqConf, req.body, NotMustHaveKeys); let { lv, institutionalNature, industry, type, operationModel, foundingTeam } = eccReqParamater(reqConf, req.body, NotMustHaveKeys);
let dataList = await baseBiz.outPutFuHuaQiBaseData(lv, institutionalNature, industry, operationModel, foundingTeam, type); let dataList = await fuHuaQiAdminBiz.outPutFuHuaQiBaseData(lv, institutionalNature, industry, operationModel, foundingTeam, type);
let name = `孵化器列表${getTimeKey()}.xlsx`; let name = `孵化器列表${getTimeKey()}.xlsx`;
...@@ -125,7 +133,7 @@ async function outPutMonthData(req, res) { ...@@ -125,7 +133,7 @@ async function outPutMonthData(req, res) {
const NotMustHaveKeys = ["state", "year", "month"]; const NotMustHaveKeys = ["state", "year", "month"];
let { state, year, month, type } = eccReqParamater(reqConf, req.body, NotMustHaveKeys); let { state, year, month, type } = eccReqParamater(reqConf, req.body, NotMustHaveKeys);
let dataList = await monthBiz.outPutMonthTableList(state, year, month, type); let dataList = await monthAdminBiz.outPutMonthTableList(state, year, month, type);
let name = `月度任务${getTimeKey()}.xlsx`; let name = `月度任务${getTimeKey()}.xlsx`;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* 管理后台端 管委会相关 * 管理后台端 管委会相关
*/ */
import * as guanWeiHuiBiz from '../../biz/guanWeiHui/user'; import * as guanWeiHuiBiz from '../../biz/mobileFuHuaQi/guanWeiHui/user';
import * as asyncHandler from 'express-async-handler'; import * as asyncHandler from 'express-async-handler';
import { eccReqParamater } from '../../util/verificationParam'; import { eccReqParamater } from '../../util/verificationParam';
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
*/ */
import * as asyncHandler from 'express-async-handler'; import * as asyncHandler from 'express-async-handler';
import * as enterpriseBiz from '../../biz/enterprise/enterprise'; import * as enterpriseBiz from '../../biz/mobileFuHuaQi/enterprise/enterprise';
import { checkFuHuaQiToken } from '../../middleware/user'; import { checkFuHuaQiToken } from '../../middleware/user';
import { eccReqParamater } from '../../util/verificationParam'; import { eccReqParamater } from '../../util/verificationParam';
...@@ -126,16 +126,24 @@ async function delEnterpriseInfo(req, res) { ...@@ -126,16 +126,24 @@ async function delEnterpriseInfo(req, res) {
* @param res * @param res
*/ */
async function myEnterpriseList(req, res) { async function myEnterpriseList(req, res) {
let reqConf = {name: 'String', state:"Number" };
let { name, state } = eccReqParamater(reqConf, req.body);
const Uscc = req.headers.uscc;
let data = await enterpriseBiz.myEnterprise(Uscc, state, name);
res.success(data);
} }
/** /**
* 企业基本信息 我的企业列表中按钮点开 * 企业基本信息
* 我的企业列表中点击查看按钮
* 2.0 * 2.0
* @param req * @param req
* @param res * @param res
*/ */
async function myEnterpriseInfo(req, res) { async function myEnterpriseInfo(req, res) {
let reqConf = {uscc: 'String' };
let { uscc } = eccReqParamater(reqConf, req.body);
const FuHuaQiUscc = req.headers.uscc;
} }
\ No newline at end of file
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
*/ */
import * as asyncHandler from 'express-async-handler'; import * as asyncHandler from 'express-async-handler';
import * as financingBiz from '../../biz/enterprise/financing'; import * as financingBiz from '../../biz/mobileFuHuaQi/enterprise/financing';
import { checkFuHuaQiToken } from '../../middleware/user'; import { checkFuHuaQiToken } from '../../middleware/user';
import { eccReqParamater } from '../../util/verificationParam'; import { eccReqParamater } from '../../util/verificationParam';
......
...@@ -5,8 +5,8 @@ ...@@ -5,8 +5,8 @@
*/ */
import * as asyncHandler from 'express-async-handler'; import * as asyncHandler from 'express-async-handler';
import * as baseBiz from '../../biz/fuHuqQi/base'; import * as baseBiz from '../../biz/mobileFuHuaQi/fuHuaQi/base';
import * as taskBiz from '../../biz/fuHuqQi/task'; import * as taskBiz from '../../biz/mobileFuHuaQi/fuHuaQi/task';
import { eccReqParamater } from '../../util/verificationParam'; import { eccReqParamater } from '../../util/verificationParam';
import { checkFuHuaQiToken } from '../../middleware/user'; import { checkFuHuaQiToken } from '../../middleware/user';
...@@ -143,7 +143,9 @@ async function completedList(req, res) { ...@@ -143,7 +143,9 @@ async function completedList(req, res) {
const Uscc = req.headers.uscc; const Uscc = req.headers.uscc;
res.success({}); let result = await taskBiz.fuHuaQiCompletedList(Uscc, selectTime);
res.success(result);
} }
...@@ -159,5 +161,7 @@ async function pastDueList(req, res) { ...@@ -159,5 +161,7 @@ async function pastDueList(req, res) {
let { selectTime } = eccReqParamater(reqConf, req.body, NotMustHaveKeys); let { selectTime } = eccReqParamater(reqConf, req.body, NotMustHaveKeys);
const Uscc = req.headers.uscc; const Uscc = req.headers.uscc;
res.success({}); let result = await taskBiz.fuHuaQiPastdueList(Uscc, selectTime);
res.success(result);
} }
\ No newline at end of file
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
*/ */
import * as asyncHandler from 'express-async-handler'; import * as asyncHandler from 'express-async-handler';
import * as monthBiz from '../../biz/fuHuqQi/month'; import * as monthBiz from '../../biz/mobileFuHuaQi/fuHuaQi/month';
import { eccReqParamater } from '../../util/verificationParam'; import { eccReqParamater } from '../../util/verificationParam';
import { checkFuHuaQiToken } from '../../middleware/user'; import { checkFuHuaQiToken } from '../../middleware/user';
...@@ -21,8 +21,8 @@ export function setRouter(httpServer) { ...@@ -21,8 +21,8 @@ export function setRouter(httpServer) {
* @param res * @param res
*/ */
async function addReport(req, res) { async function addReport(req, res) {
let reqConf = {occupancyRate: 'Number' }; let reqConf = {occupancyRate: 'Number' };//这里可以填0
let { occupancyRate } = eccReqParamater(reqConf, req.body); let { occupancyRate } = eccReqParamater(reqConf, req.body, ["occupancyRate"]);
const Uscc = req.headers.uscc; const Uscc = req.headers.uscc;
let monthInfo = monthBiz.createReport(Uscc, occupancyRate); let monthInfo = monthBiz.createReport(Uscc, occupancyRate);
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
*/ */
import * as asyncHandler from 'express-async-handler'; import * as asyncHandler from 'express-async-handler';
import * as userBiz from '../../biz/fuHuqQi/user'; import * as userBiz from '../../biz/mobileFuHuaQi/fuHuaQi/user';
import { eccReqParamater } from '../../util/verificationParam'; import { eccReqParamater } from '../../util/verificationParam';
import { checkFuHuaQiToken } from '../../middleware/user'; import { checkFuHuaQiToken } from '../../middleware/user';
...@@ -11,6 +11,7 @@ export function setRouter(httpServer) { ...@@ -11,6 +11,7 @@ export function setRouter(httpServer) {
httpServer.post('/fuhuaqi/login', asyncHandler(login)); httpServer.post('/fuhuaqi/login', asyncHandler(login));
httpServer.post('/fuhuaqi/logout', checkFuHuaQiToken, asyncHandler(logout)); httpServer.post('/fuhuaqi/logout', checkFuHuaQiToken, asyncHandler(logout));
httpServer.post('/fuhuaqi/login/firstupdate', checkFuHuaQiToken, asyncHandler(firstUpdatePwd)); httpServer.post('/fuhuaqi/login/firstupdate', checkFuHuaQiToken, asyncHandler(firstUpdatePwd));
httpServer.post('/fuhuaqi/changepwd', checkFuHuaQiToken, asyncHandler(changePwd));
} }
...@@ -47,7 +48,7 @@ async function logout(req, res) { ...@@ -47,7 +48,7 @@ async function logout(req, res) {
* @param res * @param res
*/ */
async function firstUpdatePwd(req, res) { async function firstUpdatePwd(req, res) {
let reqConf = {confirmPwd:'String', pwd:'String', }; let reqConf = {confirmPwd:'String', pwd:'String' };
let {confirmPwd, pwd} = eccReqParamater(reqConf, req.body); let {confirmPwd, pwd} = eccReqParamater(reqConf, req.body);
const Uscc = req.headers.uscc; const Uscc = req.headers.uscc;
...@@ -55,4 +56,15 @@ async function firstUpdatePwd(req, res) { ...@@ -55,4 +56,15 @@ async function firstUpdatePwd(req, res) {
let result = await userBiz.firstLoginChangePwd(Uscc, pwd, confirmPwd); let result = await userBiz.firstLoginChangePwd(Uscc, pwd, confirmPwd);
res.success(result); res.success(result);
}
async function changePwd(req, res) {
let reqConf = {confirmPwd:'String', newPwd:'String', pwd:'String' };
let {confirmPwd, newPwd, pwd} = eccReqParamater(reqConf, req.body);
const Uscc = req.headers.uscc;
let result = await userBiz.changePassword(Uscc, pwd, newPwd, confirmPwd);
res.success(result);
} }
\ No newline at end of file
...@@ -2,9 +2,11 @@ ...@@ -2,9 +2,11 @@
* 数据初始化 * 数据初始化
* *
*/ */
import { FUHUAQILV, INDUSTRY, INSTITUTIONALNATURE } from "../config/enum"; import { FUHUAQILNVESTMENTSTYLE, FUHUAQILV, INDUSTRY, INSTITUTIONALNATURE } from "../config/enum";
import { createEnterpriseToList, findEnterpriseCount } from "../data/enterprise/enterprise"; import { createEnterpriseToList, findEnterpriseCount } from "../data/enterprise/enterprise";
import { createFuHuaQiToList, findAllFuHuaQiOperationUsccMap, findFuHuaQiUserCount } from "../data/fuHuaQi/fuhuaqi"; import { findFinancingCount } from "../data/enterprise/financing";
import { createFuHuaQiToList, findAllFuHuaQiOperationUsccMap, findAllNotDisabledFuHuaQi, findFuHuaQiUserCount } from "../data/fuHuaQi/fuhuaqi";
import { createMonthTableToList, findMonthCount } from "../data/fuHuaQi/monthTable";
import { getPwdMd5, getTaskId } from "./system"; import { getPwdMd5, getTaskId } from "./system";
const xlsx = require('node-xlsx'); const xlsx = require('node-xlsx');
const path = require('path'); const path = require('path');
...@@ -73,6 +75,7 @@ function getExcel(filePath) { ...@@ -73,6 +75,7 @@ function getExcel(filePath) {
export async function initBasicData() { export async function initBasicData() {
await initFuHuaQiData(); await initFuHuaQiData();
await initEnterprise(); await initEnterprise();
await initMonth();
} }
async function initFuHuaQiData() { async function initFuHuaQiData() {
...@@ -240,4 +243,116 @@ async function initEnterprise() { ...@@ -240,4 +243,116 @@ async function initEnterprise() {
await createEnterpriseToList(addList); await createEnterpriseToList(addList);
console.log("---> 企业数据 初始化成功"); console.log("---> 企业数据 初始化成功");
} }
\ No newline at end of file
async function initMonth() {
let count = await findMonthCount({});
if (count > 10) {
console.log("*** 12月月度数据 无需初始化");
return;
}
let {sheetMap} = getExcel(path.join(__dirname.substring(0,__dirname.indexOf("out")), "res", '12月孵化器出租率.xlsx' ));
let dataList = sheetMap['孵化器月度数据'];
let addList= [];
let fhqList = await findAllNotDisabledFuHuaQi();
let distinctMap = {};
fhqList.forEach(info => {
let {uscc, operationName} = info;
distinctMap[operationName] = uscc;
});
dataList.forEach((subList, index) => {
let name = subList[2];
let occupancyRate = subList[6];
let uscc = distinctMap[name];
if (!uscc || !name || !occupancyRate ) {
return;
}
let addInfo = {
taskId:`${uscc}20231`,
name: `12月孵化器月度填报`,
fuHuaQiUscc:uscc,
occupancyRate : parseInt(`${occupancyRate *10000}`)/100,
draftLock:true,
month:12,
year:2022,
isUpdate:true,
submitTime:new Date().valueOf()
};
addList.push(addInfo);
});
await createMonthTableToList(addList);
console.log("---> 12月月度数据 初始化成功");
}
// async function initFinancing() {
// :{type:String, index:true},//融资企业统一信用代码 冗余字段
// :{type:String, index:true},//孵化器统一信用代码 冗余字段
// :String,//企业名称
// :{type:String, index:true},//任务id
// :String,//注册地址
// :String,//经营地址
// :Number,//融资金额(万元)
// :String,//投资机构名称
// :Number,//获得投资时间
// :{type:Boolean, default:false},//孵化器是否投资
// :Number,//孵化器投资金额(万元)
// :Number,//孵化器投资方式
// :{type:Boolean, default:false},//草稿锁,true为提交之后,false为草稿
// :Number,//录入时间
// industry:[Number],//领域
// logonTime:Number,//注册时间
// financingRounds:Number,//融资轮次
// let count = await findFinancingCount({});
// if (count > 10) {
// console.log("*** 融资数据 无需初始化");
// return;
// }
// let fhqList = await findAllNotDisabledFuHuaQi();
// let distinctMap = {};
// fhqList.forEach(info => {
// let {uscc, operationName} = info;
// distinctMap[operationName] = uscc;
// });
// let {sheetMap} = getExcel(path.join(__dirname.substring(0,__dirname.indexOf("out")), "res", '12月融资企业数据.xlsx' ));
// let dataList = sheetMap['在孵企业月度数据'];
// let addList = [];
// dataList.forEach((subList, index) => {
// let uscc = subList[4];
// let fuhuaqi = subList[3];
// let fuHuaQiUscc = distinctMap[fuhuaqi];
// if ( !fuHuaQiUscc || !uscc) {
// return;
// }
// let name = subList[2];
// let taskId = `${fuHuaQiUscc}20231`;
// let logonAdd = subList[6];
// let operatingAdd = subList[7];
// let financingAmount = subList[11] || 0;
// let investmentInstitutionsName = subList[12];
// let timeToObtainInvestment = new Date(subList[13]).valueOf();
// let fuHuaQiInvestment = subList[13] == "是" ? true : false;
// let fuHuaQiInvestmentAmount = subList[14] ||0;
// let fuHuaQiInvestmentStyle = subList[15] ? FUHUAQILNVESTMENTSTYLE.自有基金
// let draftLock = true;
// let createTime = new Date().valueOf();
// addList.push({
// });
// });
// await createFuHuaQiToList(addList);
// console.log("---> 孵化器数据 初始化成功");
// }
\ No newline at end of file
...@@ -17,7 +17,9 @@ const md5 = require("md5"); ...@@ -17,7 +17,9 @@ const md5 = require("md5");
* @returns * @returns
*/ */
export function getTaskId(uscc:string) { export function getTaskId(uscc:string) {
return `${uscc}${getTimeKey()}`; // return `${uscc}${getTimeKey()}`;
//todo 这里15号要改掉
return `${uscc}${20232}`;
} }
......
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