Commit f6bbca5f by sxy

feat: 生成材料下载地址

parent 533da2e8
...@@ -266,8 +266,8 @@ class Dao { ...@@ -266,8 +266,8 @@ class Dao {
async findById(oid) { async findById(oid) {
return this.model.findById(oid); return this.model.findById(oid);
} }
async findAll(obj) { async findAll(obj, include = []) {
return this.model.findAll({ "where": obj, row: true }); return this.model.findAll({ "where": obj, include, row: true });
} }
} }
module.exports = Dao; module.exports = Dao;
...@@ -17,7 +17,8 @@ class MaterialDao extends Dao { ...@@ -17,7 +17,8 @@ class MaterialDao extends Dao {
implementationPlanInfo: pobj.cache_info.implementationPlanInfo, implementationPlanInfo: pobj.cache_info.implementationPlanInfo,
safetyInfo: pobj.cache_info.safetyInfo, safetyInfo: pobj.cache_info.safetyInfo,
otherMaterialsInfo: pobj.cache_info.otherMaterialsInfo, otherMaterialsInfo: pobj.cache_info.otherMaterialsInfo,
deliver_id: pobj.deliver_id deliver_id: pobj.deliver_id,
ifDownload: false
} }
dataInfo.proposerInfo.businessInformation.ifListed = dataInfo.proposerInfo.businessInformation.ifListed === "true" dataInfo.proposerInfo.businessInformation.ifListed = dataInfo.proposerInfo.businessInformation.ifListed === "true"
if (materialData) { if (materialData) {
......
...@@ -25,6 +25,14 @@ module.exports = (db, DataTypes) => { ...@@ -25,6 +25,14 @@ module.exports = (db, DataTypes) => {
otherMaterialsInfo: { otherMaterialsInfo: {
allowNull: false, allowNull: false,
type: DataTypes.JSON type: DataTypes.JSON
},
ifDownload: {//是否生成下载文件
type: DataTypes.BOOLEAN,
defaultValue: false
},
downloadUrl: {
allowNull: true,
type: DataTypes.STRING
} }
}, { }, {
paranoid: false,//假的删除 paranoid: false,//假的删除
......
...@@ -75,11 +75,14 @@ class ServiceBase { ...@@ -75,11 +75,14 @@ class ServiceBase {
async findById(oid) { async findById(oid) {
return this.dao.findById(oid); return this.dao.findById(oid);
} }
async findAll(obj, include = []) {
return this.dao.findAll(obj, include);
}
/* /*
返回20位业务订单号 返回20位业务订单号
prefix:业务前缀 prefix:业务前缀
*/ */
async getBusUid(prefix) { async getBusUid(prefix) {
prefix = (prefix || ""); prefix = (prefix || "");
if (prefix) { if (prefix) {
prefix = prefix.toUpperCase(); prefix = prefix.toUpperCase();
...@@ -97,7 +100,7 @@ class ServiceBase { ...@@ -97,7 +100,7 @@ class ServiceBase {
len:返回长度 len:返回长度
radix:参与计算的长度,最大为62 radix:参与计算的长度,最大为62
*/ */
async getUidInfo(len, radix) { async getUidInfo(len, radix) {
var chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'.split('');//长度62,到yz长度为长36 var chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'.split('');//长度62,到yz长度为长36
var uuid = [], i; var uuid = [], i;
radix = radix || chars.length; radix = radix || chars.length;
......
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