明树Git Lab

Commit b86ed16d authored by zfp1's avatar zfp1

update

parent 8cb68fbc
Pipeline #104073 passed with stage
in 3 seconds
...@@ -4,6 +4,7 @@ const { Op } = require('sequelize'); ...@@ -4,6 +4,7 @@ const { Op } = require('sequelize');
const sequelize = require('sequelize'); const sequelize = require('sequelize');
const moment = require('moment'); const moment = require('moment');
const userModule = require('../module/userModule'); const userModule = require('../module/userModule');
const projectModule = require('../module/projectModule');
async function getProjectFields(req, res, next) { async function getProjectFields(req, res, next) {
try { try {
...@@ -669,7 +670,8 @@ async function getOwnProjects(req, res, next) { ...@@ -669,7 +670,8 @@ async function getOwnProjects(req, res, next) {
{ projectId: { [Op.ne]: null } }, { projectId: { [Op.ne]: null } },
] ]
}, },
attributes: ['projectId'] attributes: ['projectId'],
raw: true
}); });
console.log(messs) console.log(messs)
let projectIds = messs.map(o => { return o && o.projectId }); let projectIds = messs.map(o => { return o && o.projectId });
...@@ -691,8 +693,10 @@ async function getOwnProjects(req, res, next) { ...@@ -691,8 +693,10 @@ async function getOwnProjects(req, res, next) {
if (req.body.attributes && req.body.attributes.length) { if (req.body.attributes && req.body.attributes.length) {
search.attributes = req.body.attributes; search.attributes = req.body.attributes;
} }
search.raw = true;
console.log(search, "-==") console.log(search, "-==")
let ret = await DB.Project.findAndCountAll(search); let ret = await DB.Project.findAndCountAll(search);
// let lastRet = await projectModule.handleProjectData(ret, search.attributes);
return res.sendData(ret); return res.sendData(ret);
} catch (error) { } catch (error) {
next(error); next(error);
......
...@@ -103,34 +103,34 @@ const Project = sequelize.define('Project', { ...@@ -103,34 +103,34 @@ const Project = sequelize.define('Project', {
projectName: { type: DataTypes.STRING, allowNull: true, comment: "项目名称", _mark: "xmjbxx" }, projectName: { type: DataTypes.STRING, allowNull: true, comment: "项目名称", _mark: "xmjbxx" },
projectCode: { type: DataTypes.STRING, allowNull: true, comment: "项目编号", _mark: "xmjbxx" }, projectCode: { type: DataTypes.STRING, allowNull: true, comment: "项目编号", _mark: "xmjbxx" },
cym: { type: DataTypes.STRING, allowNull: true, comment: "曾用名", _mark: "xmjbxx" }, cym: { type: DataTypes.STRING, allowNull: true, comment: "曾用名", _mark: "xmjbxx" },
sfzjc: { type: DataTypes.INTEGER, allowNull: true, comment: "是否再决策", zjType: 'xiala', zjKey: 'sf', _mark: "xmjbxx" }, // 1是 2 否 sfzjc: { type: DataTypes.INTEGER, allowNull: true, comment: "是否再决策", zjType: 'danxuan', zjKey: 'sf', _mark: "xmjbxx" }, // 1是 2 否
projectForeignName: { type: DataTypes.STRING, allowNull: true, comment: "项目外文名称", _mark: "xmjbxx" }, projectForeignName: { type: DataTypes.STRING, allowNull: true, comment: "项目外文名称", _mark: "xmjbxx" },
sfnjlhtxm: { type: DataTypes.INTEGER, allowNull: true, comment: "是否能建联合体项目", zjType: 'xiala', zjKey: 'sf', _mark: "xmjbxx" }, // 1是 2 否 sfnjlhtxm: { type: DataTypes.INTEGER, allowNull: true, comment: "是否能建联合体项目", zjType: 'danxuan', zjKey: 'sf', _mark: "xmjbxx" }, // 1是 2 否
applicationUnit: { type: DataTypes.STRING, allowNull: true, comment: "申报单位", _mark: "xmjbxx" }, applicationUnit: { type: DataTypes.STRING, allowNull: true, comment: "申报单位", _mark: "xmjbxx" },
zyfzy: { type: DataTypes.STRING, allowNull: true, comment: "主业/非主业", zjType: 'xiala', _mark: "xmjbxx" }, //TODO:下拉 zyfzy: { type: DataTypes.STRING, allowNull: true, comment: "主业/非主业", zjType: 'danxuan', _mark: "xmjbxx" }, //TODO:下拉
zsqy: { type: DataTypes.STRING, allowNull: true, comment: "直属企业", _mark: "xmjbxx" }, zsqy: { type: DataTypes.STRING, allowNull: true, comment: "直属企业", _mark: "xmjbxx" },
sfnjzdhzytz: { type: DataTypes.INTEGER, allowNull: true, comment: "是否能建重大或重要投资", zjType: 'xiala', zjKey: 'sf', _mark: "xmjbxx" }, sfnjzdhzytz: { type: DataTypes.INTEGER, allowNull: true, comment: "是否能建重大或重要投资", zjType: 'danxuan', zjKey: 'sf', _mark: "xmjbxx" },
sfzzjc: { type: DataTypes.INTEGER, allowNull: true, comment: "是否自主决策", _mark: "xmjbxx" }, sfzzjc: { type: DataTypes.INTEGER, allowNull: true, comment: "是否自主决策", _mark: "xmjbxx" },
cwbblx: { type: DataTypes.STRING, allowNull: true, comment: "财务报表类型", zjType: 'xiala', _mark: "xmjbxx" }, //TODO:下拉 cwbblx: { type: DataTypes.STRING, allowNull: true, comment: "财务报表类型", zjType: 'danxuan', _mark: "xmjbxx" }, //TODO:下拉
zfsphzbajb: { type: DataTypes.STRING, allowNull: true, comment: "政府审批(核准、备案)级别", zjType: 'xiala', _mark: "xmjbxx" }, //TODO:下拉 zfsphzbajb: { type: DataTypes.STRING, allowNull: true, comment: "政府审批(核准、备案)级别", zjType: 'danxuan', _mark: "xmjbxx" }, //TODO:下拉
sflxbqyscx: { type: DataTypes.INTEGER, allowNull: true, comment: "是否履行标前预审程序", zjType: 'xiala', zjKey: 'sf', _mark: "xmjbxx" }, sflxbqyscx: { type: DataTypes.INTEGER, allowNull: true, comment: "是否履行标前预审程序", zjType: 'danxuan', zjKey: 'sf', _mark: "xmjbxx" },
xmztz: { type: DataTypes.DECIMAL(19, 8), allowNull: true, comment: "项目总投资", _mark: "xmjbxx" }, xmztz: { type: DataTypes.DECIMAL(19, 8), allowNull: true, comment: "项目总投资", _mark: "xmjbxx" },
glzt: { type: DataTypes.STRING, allowNull: true, comment: "管理主体", _mark: "xmjbxx" }, glzt: { type: DataTypes.STRING, allowNull: true, comment: "管理主体", _mark: "xmjbxx" },
tzms: { type: DataTypes.STRING, allowNull: true, comment: "投资模式", _mark: "xmjbxx" }, tzms: { type: DataTypes.STRING, allowNull: true, comment: "投资模式", _mark: "xmjbxx" },
dwqypp: { type: DataTypes.STRING, allowNull: true, comment: "对外签约品牌", _mark: "xmjbxx" }, dwqypp: { type: DataTypes.STRING, allowNull: true, comment: "对外签约品牌", _mark: "xmjbxx" },
xmzjly: { type: DataTypes.STRING, allowNull: true, comment: "项目资金来源", _mark: "xmjbxx" }, xmzjly: { type: DataTypes.STRING, allowNull: true, comment: "项目资金来源", _mark: "xmjbxx" },
swbxmlx: { type: DataTypes.STRING, allowNull: true, comment: "商务部项目类型", zjType: 'xiala', _mark: "xmjbxx" }, //TODO:下拉 swbxmlx: { type: DataTypes.STRING, allowNull: true, comment: "商务部项目类型", zjType: 'danxuan', _mark: "xmjbxx" }, //TODO:下拉
xmlx: { type: DataTypes.STRING, allowNull: true, comment: "项目类型", zjType: 'xiala', _mark: "xmjbxx" }, //TODO:下拉 xmlx: { type: DataTypes.STRING, allowNull: true, comment: "项目类型", zjType: 'danxuan', _mark: "xmjbxx" }, //TODO:下拉
sfpppxm: { type: DataTypes.INTEGER, allowNull: true, comment: "是否PPP项目", zjType: 'xiala', zjKey: 'sf', _mark: "xmjbxx" }, sfpppxm: { type: DataTypes.INTEGER, allowNull: true, comment: "是否PPP项目", zjType: 'danxuan', zjKey: 'sf', _mark: "xmjbxx" },
//项目所在地 //项目所在地
jnw: { type: DataTypes.STRING, allowNull: true, comment: "境内/外", zjType: 'xiala' },//TODO:下拉 jnw: { type: DataTypes.STRING, allowNull: true, comment: "境内/外", zjType: 'danxuan' },//TODO:下拉
sjnzjjw: { type: DataTypes.STRING, allowNull: true, comment: "省(境内)/洲际(境外)", zjType: 'xiala' },//TODO:下拉 sjnzjjw: { type: DataTypes.STRING, allowNull: true, comment: "省(境内)/洲际(境外)", zjType: 'danxuan' },//TODO:下拉
dsjngjjw: { type: DataTypes.STRING, allowNull: true, comment: "地市(境内)/国家(境外)", zjType: 'xiala' },//TODO:下拉 dsjngjjw: { type: DataTypes.STRING, allowNull: true, comment: "地市(境内)/国家(境外)", zjType: 'danxuan' },//TODO:下拉
qxjngjjw: { type: DataTypes.STRING, allowNull: true, comment: "区县(境内)/国家(境外)", zjType: 'xiala' },//TODO:下拉 qxjngjjw: { type: DataTypes.STRING, allowNull: true, comment: "区县(境内)/国家(境外)", zjType: 'danxuan' },//TODO:下拉
xmqy: { type: DataTypes.STRING, allowNull: true, comment: "项目区域", zjType: 'xiala' },//TODO:下拉 xmqy: { type: DataTypes.STRING, allowNull: true, comment: "项目区域", zjType: 'danxuan' },//TODO:下拉
sfydylyxgj: { type: DataTypes.INTEGER, allowNull: true, comment: "是否一带一路沿线国家", zjType: 'xiala', zjKey: 'sf' }, sfydylyxgj: { type: DataTypes.INTEGER, allowNull: true, comment: "是否一带一路沿线国家", zjType: 'danxuan', zjKey: 'sf' },
//计量币种 //计量币种
bizhong: { type: DataTypes.STRING, allowNull: true, comment: "币种", zjType: 'xiala' },//TODO:下拉 bizhong: { type: DataTypes.STRING, allowNull: true, comment: "币种", zjType: 'danxuan' },//TODO:下拉
huilv: { type: DataTypes.DECIMAL(3, 2), allowNull: true, comment: "汇率" }, huilv: { type: DataTypes.DECIMAL(3, 2), allowNull: true, comment: "汇率" },
//实施时间 //实施时间
xmjsqy: { type: DataTypes.STRING, allowNull: true, comment: "项目建设期(月)" }, xmjsqy: { type: DataTypes.STRING, allowNull: true, comment: "项目建设期(月)" },
......
const errorMessage = require("../utils/errorMessage");
const _ = require("lodash");
const { Op } = require('sequelize');
const sequelize = require('sequelize');
const moment = require('moment');
const userModule = require('../module/userModule');
const projectModule = require('../module/projectModule');
async function handleProjectData(ret, queryAttrs) {
let rawAttributes = DB.Project.rawAttributes;
console.log(rawAttributes, "====")
let queryRawAtr = [];
for (let index = 0; index < queryAttrs.length; index++) {
const element = queryAttrs[index];
if(rawAttributes[element]) {
queryRawAtr.push(rawAttributes[element]);
}
}
console.log(queryRawAtr);
let groupAttr = _.groupBy(queryRawAtr, 'zjType');
return groupAttr;
}
...@@ -29,5 +48,5 @@ ...@@ -29,5 +48,5 @@
module.exports = { module.exports = {
handleProjectData
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment