|
@@ -203,6 +203,8 @@ module.exports = app => {
|
|
const params = JSON.parse(ctx.request.body.params);
|
|
const params = JSON.parse(ctx.request.body.params);
|
|
const prjId = params.prjId;
|
|
const prjId = params.prjId;
|
|
const stgId = params.stgId;
|
|
const stgId = params.stgId;
|
|
|
|
+ const tdId = params.tenderId;
|
|
|
|
+ const bzId = params.businessId;
|
|
const rptId = params.rptId;
|
|
const rptId = params.rptId;
|
|
const ttlPgs = params.ttlPgs;
|
|
const ttlPgs = params.ttlPgs;
|
|
const uuid = params.uuid;
|
|
const uuid = params.uuid;
|
|
@@ -212,7 +214,7 @@ module.exports = app => {
|
|
const reportName = params.reportName;
|
|
const reportName = params.reportName;
|
|
const userId = ctx.session.sessionUser.accountId;
|
|
const userId = ctx.session.sessionUser.accountId;
|
|
const content = params.content;
|
|
const content = params.content;
|
|
- const orgArchiveList = await ctx.service.rptArchiveEncryption.getPrjStgArchiveEncryption(prjId, stgId);
|
|
|
|
|
|
+ const orgArchiveList = await ctx.service.rptArchiveEncryption.getArchiveEncryptionByBzId(prjId, stgId, bzId);
|
|
if (orgArchiveList.length > 0) {
|
|
if (orgArchiveList.length > 0) {
|
|
const contentArr = JSON.parse(orgArchiveList[0].content);
|
|
const contentArr = JSON.parse(orgArchiveList[0].content);
|
|
let hasArchive = false;
|
|
let hasArchive = false;
|
|
@@ -244,20 +246,20 @@ module.exports = app => {
|
|
} else {
|
|
} else {
|
|
//
|
|
//
|
|
}
|
|
}
|
|
- const updatedRst = await ctx.service.rptArchiveEncryption.updateArchiveEncryption(orgArchiveList[0].id, prjId, stgId, contentArr);
|
|
|
|
|
|
+ const updatedRst = await ctx.service.rptArchiveEncryption.updateArchiveEncryption(orgArchiveList[0].id, prjId, stgId, tdId, bzId, contentArr);
|
|
// console.log(updatedRst);
|
|
// console.log(updatedRst);
|
|
ctx.body = { err: 0, msg: '', data: { addedRst: contentArr } };
|
|
ctx.body = { err: 0, msg: '', data: { addedRst: contentArr } };
|
|
} else {
|
|
} else {
|
|
// 需要增加
|
|
// 需要增加
|
|
const archiveArr = [];
|
|
const archiveArr = [];
|
|
archiveArr.push({ rpt_id: rptId, uuid, total_page: ttlPgs, encryption: content, user_id: userId, report_name: reportName, childUuids, splitArcPages });
|
|
archiveArr.push({ rpt_id: rptId, uuid, total_page: ttlPgs, encryption: content, user_id: userId, report_name: reportName, childUuids, splitArcPages });
|
|
- const addedRst = await ctx.service.rptArchiveEncryption.createArchiveEncryption(prjId, stgId, archiveArr);
|
|
|
|
|
|
+ const addedRst = await ctx.service.rptArchiveEncryption.createArchiveEncryption(prjId, stgId, tdId, bzId, archiveArr);
|
|
// console.log(addedRst);
|
|
// console.log(addedRst);
|
|
ctx.body = { err: 0, msg: '', data: { addedRst: archiveArr } };
|
|
ctx.body = { err: 0, msg: '', data: { addedRst: archiveArr } };
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- async _updateArchiveCommon(ctx, prjId, stgId, rptId, parentUuidName, childUuids) {
|
|
|
|
|
|
+ async _updateArchiveCommon(ctx, prjId, stgId, bzId, tdId, rptId, parentUuidName, childUuids) {
|
|
const updateDate = new Date();
|
|
const updateDate = new Date();
|
|
const montStr = (updateDate.getMonth() + 1) < 10 ? ('0' + (updateDate.getMonth() + 1)) : (updateDate.getMonth() + 1);
|
|
const montStr = (updateDate.getMonth() + 1) < 10 ? ('0' + (updateDate.getMonth() + 1)) : (updateDate.getMonth() + 1);
|
|
const dateStr = (updateDate.getDate()) < 10 ? ('0' + updateDate.getDate()) : (updateDate.getDate());
|
|
const dateStr = (updateDate.getDate()) < 10 ? ('0' + updateDate.getDate()) : (updateDate.getDate());
|
|
@@ -272,7 +274,7 @@ module.exports = app => {
|
|
let rst = null;
|
|
let rst = null;
|
|
const fileName = parentUuidName + '.PDF';
|
|
const fileName = parentUuidName + '.PDF';
|
|
let removeUuid = ''; // 因这里把增删功能做在一起,有可能要删除一个旧的uuid,需要返回,给加密处理用
|
|
let removeUuid = ''; // 因这里把增删功能做在一起,有可能要删除一个旧的uuid,需要返回,给加密处理用
|
|
- const orgArchiveList = await ctx.service.rptArchive.getPrjStgArchive(prjId, stgId);
|
|
|
|
|
|
+ const orgArchiveList = await ctx.service.rptArchive.getArchiveByBzId(prjId, stgId, bzId);
|
|
if (orgArchiveList.length > 0) {
|
|
if (orgArchiveList.length > 0) {
|
|
const contentArr = JSON.parse(orgArchiveList[0].content);
|
|
const contentArr = JSON.parse(orgArchiveList[0].content);
|
|
let hasArchive = false;
|
|
let hasArchive = false;
|
|
@@ -324,14 +326,14 @@ module.exports = app => {
|
|
// 表示有新的模板需要添加
|
|
// 表示有新的模板需要添加
|
|
contentArr.push({ rpt_id: rptId, items: [{ uuid: parentUuidName, updateDate_time: dtStr, childUuids }] });
|
|
contentArr.push({ rpt_id: rptId, items: [{ uuid: parentUuidName, updateDate_time: dtStr, childUuids }] });
|
|
}
|
|
}
|
|
- const updatedRst = await ctx.service.rptArchive.updateArchive(orgArchiveList[0].id, prjId, stgId, contentArr);
|
|
|
|
|
|
+ const updatedRst = await ctx.service.rptArchive.updateArchive(orgArchiveList[0].id, prjId, stgId, tdId, bzId, contentArr);
|
|
// console.log(updatedRst);
|
|
// console.log(updatedRst);
|
|
rst = { err: 0, msg: parentUuidName, data: { uuid: parentUuidName, childUuids, removeUuid, fileName, updateDate, updatedRst: contentArr } };
|
|
rst = { err: 0, msg: parentUuidName, data: { uuid: parentUuidName, childUuids, removeUuid, fileName, updateDate, updatedRst: contentArr } };
|
|
} else {
|
|
} else {
|
|
// 需要增加
|
|
// 需要增加
|
|
const archiveArr = [];
|
|
const archiveArr = [];
|
|
archiveArr.push({ rpt_id: rptId, items: [{ uuid: parentUuidName, updateDate_time: dtStr, childUuids }] });
|
|
archiveArr.push({ rpt_id: rptId, items: [{ uuid: parentUuidName, updateDate_time: dtStr, childUuids }] });
|
|
- const addedRst = await ctx.service.rptArchive.createArchive(prjId, stgId, archiveArr);
|
|
|
|
|
|
+ const addedRst = await ctx.service.rptArchive.createArchive(prjId, stgId, tdId, bzId, archiveArr);
|
|
rst = { err: 0, msg: parentUuidName, data: { uuid: parentUuidName, childUuids, removeUuid, fileName, updateDate, updatedRst: archiveArr } };
|
|
rst = { err: 0, msg: parentUuidName, data: { uuid: parentUuidName, childUuids, removeUuid, fileName, updateDate, updatedRst: archiveArr } };
|
|
}
|
|
}
|
|
return rst;
|
|
return rst;
|
|
@@ -343,6 +345,8 @@ module.exports = app => {
|
|
try {
|
|
try {
|
|
const prjId = ctx.params.prjId;
|
|
const prjId = ctx.params.prjId;
|
|
const stgId = ctx.params.stgId;
|
|
const stgId = ctx.params.stgId;
|
|
|
|
+ const bzId = ctx.params.bzId;
|
|
|
|
+ const tdId = ctx.params.tdId;
|
|
const rptId = ctx.params.rptId;
|
|
const rptId = ctx.params.rptId;
|
|
// const childAmt = parseInt(ctx.params.childAmt); // 子分页数量
|
|
// const childAmt = parseInt(ctx.params.childAmt); // 子分页数量
|
|
const childInfo = ctx.params.splitInfo.split(';'); // 这个参数带比较多的信息,包含分割指标的:1. 名称 2. ID 3. 内容
|
|
const childInfo = ctx.params.splitInfo.split(';'); // 这个参数带比较多的信息,包含分割指标的:1. 名称 2. ID 3. 内容
|
|
@@ -389,7 +393,7 @@ module.exports = app => {
|
|
}
|
|
}
|
|
// stream = await parts();
|
|
// stream = await parts();
|
|
}
|
|
}
|
|
- const body = await this._updateArchiveCommon(ctx, prjId, stgId, rptId, parentUuid, childUuids);
|
|
|
|
|
|
+ const body = await this._updateArchiveCommon(ctx, prjId, stgId, bzId, tdId, rptId, parentUuid, childUuids);
|
|
ctx.body = body;
|
|
ctx.body = body;
|
|
} catch (error) {
|
|
} catch (error) {
|
|
ctx.helper.log(error);
|
|
ctx.helper.log(error);
|
|
@@ -406,6 +410,8 @@ module.exports = app => {
|
|
const stream = await ctx.getFileStream();
|
|
const stream = await ctx.getFileStream();
|
|
const prjId = ctx.params.prjId;
|
|
const prjId = ctx.params.prjId;
|
|
const stgId = ctx.params.stgId;
|
|
const stgId = ctx.params.stgId;
|
|
|
|
+ const bzId = ctx.params.bzId;
|
|
|
|
+ const tdId = ctx.params.tdId;
|
|
const rptId = ctx.params.rptId;
|
|
const rptId = ctx.params.rptId;
|
|
const newUuidName = uuidV1();
|
|
const newUuidName = uuidV1();
|
|
const fileName = newUuidName + '.PDF';
|
|
const fileName = newUuidName + '.PDF';
|
|
@@ -413,7 +419,8 @@ module.exports = app => {
|
|
if (!(oss_result && oss_result.url && oss_result.res.status === 200)) {
|
|
if (!(oss_result && oss_result.url && oss_result.res.status === 200)) {
|
|
throw '上传文件失败';
|
|
throw '上传文件失败';
|
|
}
|
|
}
|
|
- const body = await this._updateArchiveCommon(ctx, prjId, stgId, rptId, newUuidName, []);
|
|
|
|
|
|
+ const body = await this._updateArchiveCommon(ctx, prjId, stgId, bzId, tdId, rptId, newUuidName, []);
|
|
|
|
+ // console.log(body);
|
|
ctx.body = body;
|
|
ctx.body = body;
|
|
} catch (err) {
|
|
} catch (err) {
|
|
this.log(err);
|
|
this.log(err);
|
|
@@ -431,6 +438,8 @@ module.exports = app => {
|
|
const stream = await ctx.getFileStream();
|
|
const stream = await ctx.getFileStream();
|
|
const prjId = ctx.params.prjId;
|
|
const prjId = ctx.params.prjId;
|
|
const stgId = ctx.params.stgId;
|
|
const stgId = ctx.params.stgId;
|
|
|
|
+ const bzId = ctx.params.bzId;
|
|
|
|
+ const tdId = ctx.params.tdId;
|
|
const rptId = ctx.params.rptId;
|
|
const rptId = ctx.params.rptId;
|
|
const orgUuidName = ctx.params.orgName;
|
|
const orgUuidName = ctx.params.orgName;
|
|
const orgFileName = orgUuidName + '.PDF';
|
|
const orgFileName = orgUuidName + '.PDF';
|
|
@@ -453,8 +462,7 @@ module.exports = app => {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- // const body = await this._updateArchiveCommon(ctx, prjId, stgId, rptId, orgUuidName, []);
|
|
|
|
- const body = await this._updateArchiveCommon(ctx, prjId, stgId, rptId, newUuidName, []); // 只管用新的uuid,此方法中会自动删除最旧的那个记录及相关PDF文档
|
|
|
|
|
|
+ const body = await this._updateArchiveCommon(ctx, prjId, stgId, bzId, tdId, rptId, newUuidName, []); // 只管用新的uuid,此方法中会自动删除最旧的那个记录及相关PDF文档
|
|
ctx.body = body;
|
|
ctx.body = body;
|
|
} catch (err) {
|
|
} catch (err) {
|
|
this.log(err);
|
|
this.log(err);
|
|
@@ -467,9 +475,10 @@ module.exports = app => {
|
|
try {
|
|
try {
|
|
const prjId = ctx.params.prjId;
|
|
const prjId = ctx.params.prjId;
|
|
const stgId = ctx.params.stgId;
|
|
const stgId = ctx.params.stgId;
|
|
|
|
+ const bzId = ctx.params.bzId;
|
|
const rptId = parseInt(ctx.params.rptId);
|
|
const rptId = parseInt(ctx.params.rptId);
|
|
const uuid = ctx.params.orgName;
|
|
const uuid = ctx.params.orgName;
|
|
- const orgArchiveList = await ctx.service.rptArchiveEncryption.getPrjStgArchiveEncryption(prjId, stgId);
|
|
|
|
|
|
+ const orgArchiveList = await ctx.service.rptArchiveEncryption.getArchiveEncryptionByBzId(prjId, stgId, bzId);
|
|
if (orgArchiveList.length > 0) {
|
|
if (orgArchiveList.length > 0) {
|
|
const contentArr = JSON.parse(orgArchiveList[0].content);
|
|
const contentArr = JSON.parse(orgArchiveList[0].content);
|
|
for (let idx = contentArr.length - 1; idx >= 0; idx--) {
|
|
for (let idx = contentArr.length - 1; idx >= 0; idx--) {
|
|
@@ -478,8 +487,7 @@ module.exports = app => {
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- // const updatedRst = await ctx.service.rptArchive.updateArchive(prjId, stgId, contentArr);
|
|
|
|
- rst = await ctx.service.rptArchiveEncryption.updateArchiveEncryption(orgArchiveList[0].id, prjId, stgId, contentArr);
|
|
|
|
|
|
+ rst = await ctx.service.rptArchiveEncryption.updateArchiveEncryption(orgArchiveList[0].id, prjId, stgId, orgArchiveList[0].tender_id, bzId, contentArr);
|
|
}
|
|
}
|
|
} catch (err) {
|
|
} catch (err) {
|
|
this.log(err);
|
|
this.log(err);
|
|
@@ -507,9 +515,10 @@ module.exports = app => {
|
|
const prjId = ctx.params.prjId;
|
|
const prjId = ctx.params.prjId;
|
|
const stgId = ctx.params.stgId;
|
|
const stgId = ctx.params.stgId;
|
|
const rptId = ctx.params.rptId;
|
|
const rptId = ctx.params.rptId;
|
|
|
|
+ const bzId = ctx.params.bzId;
|
|
const orgUuidName = ctx.params.orgName;
|
|
const orgUuidName = ctx.params.orgName;
|
|
// const fileName = orgUuidName + '.PDF';
|
|
// const fileName = orgUuidName + '.PDF';
|
|
- const orgArchiveList = await ctx.service.rptArchive.getPrjStgArchive(prjId, stgId);
|
|
|
|
|
|
+ const orgArchiveList = await ctx.service.rptArchive.getArchiveByBzId(prjId, stgId, bzId);
|
|
if (orgArchiveList.length > 0) {
|
|
if (orgArchiveList.length > 0) {
|
|
const contentArr = JSON.parse(orgArchiveList[0].content);
|
|
const contentArr = JSON.parse(orgArchiveList[0].content);
|
|
for (let idx = contentArr.length - 1; idx >= 0; idx--) {
|
|
for (let idx = contentArr.length - 1; idx >= 0; idx--) {
|
|
@@ -542,7 +551,7 @@ module.exports = app => {
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- rst = await ctx.service.rptArchive.updateArchive(orgArchiveList[0].id, prjId, stgId, contentArr);
|
|
|
|
|
|
+ rst = await ctx.service.rptArchive.updateArchive(orgArchiveList[0].id, prjId, stgId, orgArchiveList[0].tender_id, bzId, contentArr);
|
|
}
|
|
}
|
|
} catch (err) {
|
|
} catch (err) {
|
|
this.log(err);
|
|
this.log(err);
|