Commit 2e583508 by 王勇飞

gyq

parent 8041accc
......@@ -10,66 +10,97 @@ class MaterialCtl extends CtlBase {
}
/*根据交付单id获取材料信息*/
async findInfoByDeliverId(mobj,qobj,req){
async findInfoByDeliverId(mobj, qobj, req) {
var pobj = mobj.d;
if (pobj.deliverId && pobj.deliverId != 'undefined')
{
try{
if (pobj.deliverId && pobj.deliverId != 'undefined') {
try {
var rs = await this.service.findInfoByDeliverId(pobj);
var rarr = {};
if (rs){
rarr.deliverId = rs.delivery_id;
rarr.deliverNumber = rs.delivery_code;
rarr.companyInfo = rs.company_info;
rarr.registeredInfo = rs.registered_info;
rarr.contributionInfo = rs.contribution_info;
rarr.positionInfo = rs.position_info;
rarr.regInfo = rs.file_info;
rarr.expressInfo = rs.express_info;
if (rs) {
rarr.deliverId = rs.delivery_id;
rarr.deliverNumber = rs.delivery_code;
rarr.companyInfo = rs.company_info;
rarr.registeredInfo = rs.registered_info;
rarr.contributionInfo = rs.contribution_info;
rarr.positionInfo = rs.position_info;
rarr.regInfo = rs.file_info;
rarr.expressInfo = rs.express_info;
}
return system.getResult(rarr);
}
catch(error){
catch (error) {
return system.getResultError(error);
}
}
else{
else {
return system.getResultError("参数错误!");
}
}
/*根据交付单id更新交付单编号信息*/
async updateInfoByDeliverId(mobj,qobj,req){
async updateInfoByDeliverId(mobj, qobj, req) {
var pobj = mobj.d;
if (pobj.deliverId && pobj.deliverId != 'undefined' && pobj.deliverNumber && pobj.deliverNumber != 'undefined'){
try{
if (pobj.deliverId && pobj.deliverId != 'undefined' && pobj.deliverNumber && pobj.deliverNumber != 'undefined') {
try {
var res = await this.service.updateInfoByDeliverId(pobj);
return system.getResult("更新成功!");
}
catch (error){
catch (error) {
return system.getResultError(error);
}
}
else{
else {
return system.getResultError("参数错误!");
}
}
/*插入缓存信息 */
async insertInfo(mobj,qobj,req){
async insertInfo(mobj, qobj, req) {
var pobj = mobj.d;
if (pobj.deliverId && pobj.deliverId != 'undefined'){
try{
var res = await this.service.insertInfo(pobj);
return system.getResult("插入成功!");
}
catch (error){
return system.getResultError(error);
}
if (pobj.deliverId && pobj.deliverId != 'undefined') {
try {
var res = await this.service.insertInfo(pobj);
return system.getResult("插入成功!");
}
else{
return system.getResultError("参数错误!");
catch (error) {
return system.getResultError(error);
}
}
else {
return system.getResultError("参数错误!");
}
}
/* 获取待压缩文件的信息*/
async waitGenerate() {
try {
var res = await this.service.findnoUrlInfo();
if (res && res != 'undefined') {
return system.getResult(res);
}
else {
return system.getResultError("没有待压缩的数据");
}
}
catch (error) {
return system.getResultError(error);
}
}
/* 根据id更新zip信息 */
async updateZipById(pobj, qobj, req) {
if (pobj.id && pobj.id != 'undefined' && pobj.url && pobj.url != 'undefined'){
try{
await this.service.updateZipById(pobj);
return system.getResult("更新压缩信息成功");
}
catch(error){
return system.getResultError(error);
}
}
else{
return system.getResultError("参数错误!");
}
}
timeFormat(date) {
......@@ -79,11 +110,10 @@ class MaterialCtl extends CtlBase {
}
}
module.exports = MaterialCtl;
// var task = new CacheInfoCtl();
// var obj={"demand_code":"30030302992","business_status":"isFinished"};
// task.updateStatusByDemandCode(obj,{},{}).then(d=>{
// console.log(d);
// var task = new MaterialCtl();
// var obj={"id":2,"url":"http://test-1258715722.cos.ap-beijing.myqcloud.com/materials/90c263e0-b9d6-11ea-9e11-29abb292cf5f.png"};
// task.updateZipById(obj).then(d=>{
// console.log(JSON.stringify(d));
// //console.log(d[0].analyse);
// })
......@@ -603,12 +603,12 @@ class DeliverybillCtl extends CtlBase {
pobj.baseInfo.companyProperties = pobj.companyInfo.companyProperties;
pobj.baseInfo.companyType = pobj.companyInfo.companyProperties;
}
else{
else {
pobj.companyInfo.companyType = pobj.companyInfo.companyPropertiesName;
pobj.baseInfo.companyProperties = pobj.companyInfo.companyPropertiesName;
pobj.baseInfo.companyType = pobj.companyInfo.companyPropertiesName;
}
}
if (pobj.companyInfo.engagedIndName && pobj.companyInfo.engagedIndName != 'undefined') {
pobj.companyInfo.engagedIndustry = appconfig.pdict.engagedIndustryDictT[pobj.companyInfo.engagedIndName];
......@@ -696,11 +696,11 @@ class DeliverybillCtl extends CtlBase {
if (pobj.baseInfo.contactsPhone && pobj.baseInfo.contactsPhone != 'undefined') {
pobj.cacheInfo.cmpContactInfo.contactsPhone = pobj.baseInfo.contactsPhone;
}
if (pobj.baseInfo.virtualPrice && pobj.baseInfo.virtualPrice != 'undefined'){//虚拟地址价格
if (pobj.baseInfo.virtualPrice && pobj.baseInfo.virtualPrice != 'undefined') {//虚拟地址价格
pobj.cacheInfo.virtualPrice = pobj.baseInfo.virtualPrice;
}
if ((pobj.deliverNumber != pobj.txOrderNum) && (pobj.businessType == "sealSevCase" || pobj.businessType == "agentCase")){
if ((pobj.deliverNumber != pobj.txOrderNum) && (pobj.businessType == "sealSevCase" || pobj.businessType == "agentCase")) {
pobj.companyInfo = {};
}
......@@ -756,6 +756,32 @@ class DeliverybillCtl extends CtlBase {
return system.getResultError("参数错误!");
}
}
/*获取压缩文件的信息 */
async findZipUrlByDeliverCode(mobj, qobj, req) {//
var pobj = mobj.d;
if (pobj.deliverNumber && pobj.deliverNumber != 'undefined') {
try {
var ms = await this.materialService.findInfoByDeliverNumber(pobj);
if (ms && ms != 'undefined') {
if (ms.download_url && ms.download_url != undefined) {
return system.getResult(ms.download_url);
}
else {
return system.getResultError("暂没有url信息!");
}
}
else {
return system.getResultError("没有相关信息!");
}
}
catch (error) {
return system.getResultError(error);
}
}
else {
return system.getResultError("参数错误!");
}
}
timeFormat(date) {
let localTime = moment.utc(date).toDate();
......@@ -840,11 +866,8 @@ module.exports = DeliverybillCtl;
// var diff = task.diffDays(ss,oneYear);
// console.log(oneYear);
// console.log(diff);
// var obj={"deliverNumber":"1111115","baseInfo":"","deliverInfo":{"isVirtual": "否", "isWhether": "是", "payStatus": "已交付", "contactsName": "张三", "contactsPhone": "13800138000"},"companyInfo":{"isWhether": "no", "addressType": "practical", "fullAddress": "gsgsgsgsgsg", "taxpayerType": "smallScaleTaxpayer", "businessScope": "sgsgsdgsdgd", "engagedIndustry": "culturalMedia", "companyProperties": "limitedLiabilityCompany"},
// "registeredInfo":{"registeredCapital":"500","registeredDate":"20","reserveProportion":"15"},"contributionInfo":{"contribution_info":[{"shareholderName":"王五","contributionAmount":"200","contributionProportion":"40","IdentificationNumber":"1111111","phoneNumber":"1111111","contactAddress":"北京"},
// {"shareholderName":"王六","contributionAmount":"200","contributionProportion":"40","IdentificationNumber":"1111111","phoneNumber":"1111111","contactAddress":"北京"},
// {"shareholderName":"王七","contributionAmount":"100","contributionProportion":"20","IdentificationNumber":"1111111","phoneNumber":"1111111","contactAddress":"北京"}]}};
// task.updateInfoByDeliverCode(obj,{},{}).then(d=>{
// var obj={"d":{"deliverNumber":"1111111"}};
// task.findZipUrlByDeliverCode(obj,{},{}).then(d=>{
// console.log(d);
// //console.log(d[0].analyse);
......
......@@ -10,6 +10,22 @@ class MaterialDao extends Dao {
var qcwhere = { "delivery_code": qobj.deliverNumber };
return await this.findOne(qcwhere);
}
/* 根据id更新zip信息 */
async updateZipById(qobj, t) {
try{
var whereobj = { "id": qobj.id };
var setobj= {
"is_download":1,
"download_url":qobj.url
};
return await this.updateByWhere(setobj, whereobj, t);
}
catch(error){
console.log("error----------" + error);
return error;
}
}
/*根据交付单编号更新交材料详情*/
async updateInfoByDeliverNumber(qobj, t) {
......@@ -39,7 +55,6 @@ class MaterialDao extends Dao {
return await this.updateByWhere(setobj, whereobj, t);
}
/*插入注册材料信息*/
async insertInfo(pobj, t) {//公司注册,云上园区注册时的信息
var obj = {
......
......@@ -38,7 +38,15 @@ module.exports = (db, DataTypes) => {
express_info: { // 邮寄信息
allowNull: true,
type: DataTypes.JSON
}
},
is_download: { // 是否已有压缩文件的路径
allowNull: true,
type: DataTypes.INTEGER
},
download_url: { // 压缩文件的路径
allowNull: true,
type: DataTypes.STRING
},
}, {
paranoid: false,//假的删除
underscored: true,
......
......@@ -13,23 +13,49 @@ class MaterialService extends ServiceBase {
// }
/*根据交付单编号获取注册材料信息详情*/
async findInfoByDeliverNumber(qobj){
async findInfoByDeliverNumber(qobj) {
return await this.dao.findInfoByDeliverNumber(qobj);
}
/* 根据交付单编号更新交付单编号信息 */
async updateInfoByDeliverNumber(qobj){
var self=this;
async updateInfoByDeliverNumber(qobj) {
var self = this;
return self.db.transaction(async function (t) {
return await self.dao.updateInfoByDeliverNumber(qobj,t);
return await self.dao.updateInfoByDeliverNumber(qobj, t);
});
}
/* 根据id更新zip信息 */
async updateZipById(qobj) {
var self = this;
return self.db.transaction(async function (t) {
return await self.dao.updateZipById(qobj, t);
});
}
/*获取没有压缩文件的信息*/
async findnoUrlInfo() {
var sql = "select id,file_info from material_information where is_download = 0 and file_info is not null";
var d = await this.dao.customQuery(sql);
if (d && d.length > 0) {
var rtndata = [];
d.forEach(item => {
if (item.file_info.uploadList && item.file_info.uploadList != 'undefined') {
rtndata.push({ "id": item.id, "uploadList": item.file_info.uploadList });
}
});
return rtndata;
}
else {
return [];
}
}
/*插入缓存信息*/
async insertInfo(qobj){
var self=this;
/*插入信息*/
async insertInfo(qobj) {
var self = this;
return self.db.transaction(async function (t) {
return await self.dao.insertInfo(qobj,t);
return await self.dao.insertInfo(qobj, t);
});
}
......
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