Commit 15ce8f2e by linboxuan

Merge branch 'center-order' of http://gitlab.gongsibao.com/jiangyong/zhichan into center-order

parents f10e68f9 0af15996
...@@ -33,36 +33,36 @@ class IcpAPI extends APIBase { ...@@ -33,36 +33,36 @@ class IcpAPI extends APIBase {
async opActionProcess(pobj, action_type, req) { async opActionProcess(pobj, action_type, req) {
var opResult = null; var opResult = null;
switch (action_type) { switch (action_type) {
case "submitIcpProgramme"://icp方案提交 // case "submitIcpProgramme"://icp方案提交
opResult = await this.needsolutionSve.submitIcpProgramme(pobj); // opResult = await this.needsolutionSve.submitIcpProgramme(pobj);
break; // break;
case "submitIcpMaterial"://icp材料提交 // case "submitIcpMaterial"://icp材料提交
opResult = await this.needsolutionSve.submitIcpMaterial(pobj); // opResult = await this.needsolutionSve.submitIcpMaterial(pobj);
break; // break;
case "acceptIcpPartnerNotification"://icp通知状态变更 // case "acceptIcpPartnerNotification"://icp通知状态变更
opResult = await this.needsolutionSve.acceptIcpPartnerNotification(pobj); // opResult = await this.needsolutionSve.acceptIcpPartnerNotification(pobj);
break; // break;
case "abolishIcpProgramme"://服务商icp方案关闭 // case "abolishIcpProgramme"://服务商icp方案关闭
opResult = await this.needsolutionSve.abolishIcpProgramme(pobj); // opResult = await this.needsolutionSve.abolishIcpProgramme(pobj);
break; // break;
case "getIcpProgrammeDetail"://获取icp方案 // case "getIcpProgrammeDetail"://获取icp方案
opResult = await this.needsolutionSve.getIcpProgrammeDetail(pobj); // opResult = await this.needsolutionSve.getIcpProgrammeDetail(pobj);
break; // break;
case "getNeedSolutionDetailByUser"://获取方案详情 // case "getNeedSolutionDetailByUser"://获取方案详情
opResult = await this.needsolutionSve.getNeedSolutionDetailByUser(pobj); // opResult = await this.needsolutionSve.getNeedSolutionDetailByUser(pobj);
break; // break;
case "receiveIcpStatusNotify"://接收渠道方案状态变更通知 // case "receiveIcpStatusNotify"://接收渠道方案状态变更通知
opResult = await this.needsolutionSve.receiveIcpStatusNotify(pobj); // opResult = await this.needsolutionSve.receiveIcpStatusNotify(pobj);
break; // break;
case "receiveIcpFeedback"://接收icp用户方案反馈 // case "receiveIcpFeedback"://接收icp用户方案反馈
opResult = await this.needsolutionSve.receiveIcpFeedback(pobj); // opResult = await this.needsolutionSve.receiveIcpFeedback(pobj);
break; // break;
case "getIcpProgrammeDetail"://获取方案详情(内部调用) // case "getIcpProgrammeDetail"://获取方案详情(内部调用)
opResult = await this.needsolutionSve.getIcpProgrammeDetail(pobj); // opResult = await this.needsolutionSve.getIcpProgrammeDetail(pobj);
break; // break;
case "getProgrammeInfoByChannelNeedNo"://获取需求方案列表 // case "getProgrammeInfoByChannelNeedNo"://获取需求方案列表
opResult = await this.needsolutionSve.getProgrammeInfoByChannelNeedNo(pobj); // opResult = await this.needsolutionSve.getProgrammeInfoByChannelNeedNo(pobj);
break; // break;
default: default:
opResult = system.getResult(null, "action_type参数错误"); opResult = system.getResult(null, "action_type参数错误");
break; break;
......
...@@ -36,9 +36,9 @@ class QcAPI extends APIBase { ...@@ -36,9 +36,9 @@ class QcAPI extends APIBase {
case "submitIcpProgramme"://icp方案提交 case "submitIcpProgramme"://icp方案提交
opResult = await this.aliyunqcSve.submitIcpProgramme(pobj); opResult = await this.aliyunqcSve.submitIcpProgramme(pobj);
break; break;
case "submitIcpMaterial"://icp材料提交 // case "submitIcpMaterial"://icp材料提交
opResult = await this.aliyunqcSve.submitIcpMaterial(pobj); // opResult = await this.aliyunqcSve.submitIcpMaterial(pobj);
break; // break;
case "acceptIcpPartnerNotification"://icp通知状态变更 case "acceptIcpPartnerNotification"://icp通知状态变更
opResult = await this.aliyunqcSve.acceptIcpPartnerNotification(pobj); opResult = await this.aliyunqcSve.acceptIcpPartnerNotification(pobj);
break; break;
...@@ -51,10 +51,10 @@ class QcAPI extends APIBase { ...@@ -51,10 +51,10 @@ class QcAPI extends APIBase {
case "getNeedSolutionDetailByUser"://获取方案详情 case "getNeedSolutionDetailByUser"://获取方案详情
opResult = await this.aliyunqcSve.getNeedSolutionDetailByUser(pobj); opResult = await this.aliyunqcSve.getNeedSolutionDetailByUser(pobj);
break; break;
case "receiveIcpStatusNotify"://接收渠道方案状态变更通知 case "receiveIcpStatusNotify"://接收渠道方案状态变更通知2.3
opResult = await this.aliyunqcSve.receiveIcpStatusNotify(pobj); opResult = await this.aliyunqcSve.receiveIcpStatusNotify(pobj);
break; break;
case "receiveIcpFeedback"://接收icp用户方案反馈 case "receiveIcpFeedback"://接收icp用户方案反馈2.2
opResult = await this.aliyunqcSve.receiveIcpFeedback(pobj); opResult = await this.aliyunqcSve.receiveIcpFeedback(pobj);
break; break;
case "getIcpProgrammeDetail"://获取方案详情(内部调用) case "getIcpProgrammeDetail"://获取方案详情(内部调用)
...@@ -63,7 +63,7 @@ class QcAPI extends APIBase { ...@@ -63,7 +63,7 @@ class QcAPI extends APIBase {
case "getProgrammeInfoByChannelNeedNo"://获取需求方案列表 case "getProgrammeInfoByChannelNeedNo"://获取需求方案列表
opResult = await this.aliyunqcSve.getProgrammeInfoByChannelNeedNo(pobj); opResult = await this.aliyunqcSve.getProgrammeInfoByChannelNeedNo(pobj);
break; break;
case "serviceProviderSubmitMaterial"://交付商提交材料信息 case "serviceProviderSubmitMaterial"://交付商提交材料信息
opResult = await this.aliyunqcSve.serviceProviderSubmitMaterial(pobj); opResult = await this.aliyunqcSve.serviceProviderSubmitMaterial(pobj);
break; break;
...@@ -73,7 +73,12 @@ class QcAPI extends APIBase { ...@@ -73,7 +73,12 @@ class QcAPI extends APIBase {
case "closeOrderDelivery"://交付商关闭交付单 case "closeOrderDelivery"://交付商关闭交付单
opResult = await this.aliyunqcSve.closeOrderDelivery(pobj); opResult = await this.aliyunqcSve.closeOrderDelivery(pobj);
break; break;
case "abolishIcpProgrammeByNeed"://前端关闭ICP需求及方案
opResult = await this.aliyunqcSve.abolishIcpProgrammeByNeed(pobj);
break;
case "receiveIcpConfirmUrl"://前端关闭ICP需求及方案
opResult = await this.aliyunqcSve.receiveIcpConfirmUrl(pobj);
break;
default: default:
opResult = system.getResult(null, "action_type参数错误"); opResult = system.getResult(null, "action_type参数错误");
break; break;
......
const system = require("../../../system"); const system = require("../../../system");
const Dao = require("../../dao.base"); const Dao = require("../../dao.base");
class OrderdeliveryofficialDao extends Dao { class OrderOfficialDao extends Dao {
constructor() { constructor() {
super(Dao.getModelName(OrderdeliveryofficialDao)); super(Dao.getModelName(OrderOfficialDao));
} }
} }
module.exports = OrderdeliveryofficialDao; module.exports = OrderOfficialDao;
...@@ -2,8 +2,8 @@ const system = require("../../../system"); ...@@ -2,8 +2,8 @@ const system = require("../../../system");
const settings = require("../../../../config/settings"); const settings = require("../../../../config/settings");
const uiconfig = system.getUiConfig2(settings.appKey); const uiconfig = system.getUiConfig2(settings.appKey);
module.exports = (db, DataTypes) => { module.exports = (db, DataTypes) => {
return db.define("orderOfficial", { return db.define("orderofficial", {
sourceNo: DataTypes.STRING(128), // 订单号 serviceNo: DataTypes.STRING(128), // 订单号
channelUserId: DataTypes.STRING(128), // 用户id channelUserId: DataTypes.STRING(128), // 用户id
officialInfo: DataTypes.JSON // 官文信息 officialInfo: DataTypes.JSON // 官文信息
}, { }, {
...@@ -12,7 +12,7 @@ module.exports = (db, DataTypes) => { ...@@ -12,7 +12,7 @@ module.exports = (db, DataTypes) => {
version: true, version: true,
freezeTableName: true, freezeTableName: true,
timestamps: true, timestamps: true,
updatedAt: true, updated_at: true,
tableName: 'c_delivery_official', tableName: 'c_delivery_official',
validate: { validate: {
......
...@@ -21,6 +21,7 @@ module.exports = (db, DataTypes) => { ...@@ -21,6 +21,7 @@ module.exports = (db, DataTypes) => {
}, },
statusName: DataTypes.STRING(50), //状态名称 statusName: DataTypes.STRING(50), //状态名称
createUserId: DataTypes.INTEGER, //创建者id createUserId: DataTypes.INTEGER, //创建者id
isInvalid:DataTypes.INTEGER, //是否废弃的无效的方案
}, { }, {
paranoid: true,//假的删除 paranoid: true,//假的删除
underscored: true, underscored: true,
......
const system = require("../../../system"); const system = require("../../../system");
const settings = require("../../../../config/settings"); const settings = require("../../../../config/settings");
const uiconfig = system.getUiConfig2(settings.appKey);
const ServiceBase = require("../../sve.base"); const ServiceBase = require("../../sve.base");
const uuidv4 = require('uuid/v4');
class OrderInfoService extends ServiceBase { class OrderInfoService extends ServiceBase {
constructor() { constructor() {
...@@ -11,7 +9,7 @@ class OrderInfoService extends ServiceBase { ...@@ -11,7 +9,7 @@ class OrderInfoService extends ServiceBase {
this.orderproductDao = system.getObject("db.dbcorder.orderproductDao"); this.orderproductDao = system.getObject("db.dbcorder.orderproductDao");
this.ordercontactsDao = system.getObject("db.dbcorder.ordercontactsDao"); this.ordercontactsDao = system.getObject("db.dbcorder.ordercontactsDao");
this.orderReceiptVoucherDao = system.getObject("db.dbcpay.orderreceiptvoucherDao"); this.orderReceiptVoucherDao = system.getObject("db.dbcpay.orderreceiptvoucherDao");
this.officialDao = system.getObject("db.dbcorder.orderdeliveryofficialDao"); this.officialDao = system.getObject("db.dbcorder.orderofficialDao");
this.centerChannelUrl = settings.centerChannelUrl(); this.centerChannelUrl = settings.centerChannelUrl();
} }
...@@ -180,23 +178,12 @@ class OrderInfoService extends ServiceBase { ...@@ -180,23 +178,12 @@ class OrderInfoService extends ServiceBase {
const applyUser = actionBody.deliveryData.applyUser; const applyUser = actionBody.deliveryData.applyUser;
//复审证据材料 //复审证据材料
const askForData = actionBody.deliveryData.askForData; const askForData = actionBody.deliveryData.askForData;
//商标驳回信息
const trademarkRejInfo = actionBody.deliveryData.trademarkRejInfo;
//补充材料
const supData = actionBody.deliveryData.supData;
//申请信息校验 //申请信息校验
let re1 = await this.checkApply(apply); let re1 = await this.checkApply(apply);
if (re1.status != 0) { if (re1.status != 0) {
return re1; return re1;
} }
//商标驳回信息校验
let re2= await this.checkRejInfo(trademarkRejInfo);
if (re2.status != 0) {
return re2;
}
if (Object.keys(applyUser).length === 0 || Object.keys(askForData).length === 0) { if (Object.keys(applyUser).length === 0 || Object.keys(askForData).length === 0) {
var deliveryStatusName = "待完善材料"; var deliveryStatusName = "待完善材料";
var recDate = ""; var recDate = "";
...@@ -206,7 +193,6 @@ class OrderInfoService extends ServiceBase { ...@@ -206,7 +193,6 @@ class OrderInfoService extends ServiceBase {
var recDate = deliveryData.reDate || ""; var recDate = deliveryData.reDate || "";
var askforDate = deliveryData.askforDate || ""; var askforDate = deliveryData.askforDate || "";
} }
pobj.actionBody.deliveryData.deliveryStatusName = deliveryStatusName; pobj.actionBody.deliveryData.deliveryStatusName = deliveryStatusName;
pobj.actionBody.deliveryData.reDate = recDate; pobj.actionBody.deliveryData.reDate = recDate;
pobj.actionBody.deliveryData.askforDate = askforDate; pobj.actionBody.deliveryData.askforDate = askforDate;
...@@ -221,28 +207,38 @@ class OrderInfoService extends ServiceBase { ...@@ -221,28 +207,38 @@ class OrderInfoService extends ServiceBase {
* @param orderNo * @param orderNo
*/ */
addOrderDelivery(data, orderNo) { addOrderDelivery(data, orderNo) {
var sql = "INSERT INTO `c_order_delivery` (`sourceOrderNo`,`deliveryContent`) VALUE('" + try{
orderNo + "','" + JSON.stringify(data) + "')"; var sql = "INSERT INTO `c_order_delivery` (`sourceOrderNo`,`deliveryContent`) VALUE('" +
this.customQuery(sql); orderNo + "','" + JSON.stringify(data) + "')";
this.customQuery(sql);
return system.getResultSuccess();
}catch (e) {
return system.getResultFail();
}
} }
/** /**
* 修改交付信息并推送到交付中心 * 修改交付信息
* @param pobj * @param pobj
* @param actionBody * @param actionBody
* @returns {Promise<{msg: *, data: (*|null), status: number}>} * @returns {Promise<{msg: *, data: (*|null), status: number}>}
*/ */
async submitReview(pobj, actionBody) { async submitReview(pobj, actionBody) {
var packagingTmResult = await this.packagingTmReDeliveryData(pobj, pobj.actionBody); try{
if (packagingTmResult.status != 0) { var packagingTmResult = await this.packagingTmReDeliveryData(pobj, pobj.actionBody);
return packagingTmResult; if (packagingTmResult.status != 0) {
return packagingTmResult;
}
const orderNo = actionBody.orderNo;
const deliveryData = JSON.stringify(pobj.actionBody.deliveryData);
let sql = `UPDATE c_order_delivery SET deliveryContent ='${deliveryData}' where sourceOrderNo='${orderNo}'`;
sql = sql.replace('\n', '');
const result = await this.customUpdate(sql);
return system.getResultSuccess();
}catch (e) {
return system.getResultFail();
} }
const orderNo = actionBody.orderNo;
const deliveryData = JSON.stringify(pobj.actionBody.deliveryData);
let sql = `UPDATE c_order_delivery SET deliveryContent ='${deliveryData}' where sourceOrderNo='${orderNo}'`;
sql = sql.replace('\n', '');
const result = await this.customUpdate(sql);
return system.getResultSuccess();
} }
//申请信息校验 //申请信息校验
...@@ -271,29 +267,6 @@ class OrderInfoService extends ServiceBase { ...@@ -271,29 +267,6 @@ class OrderInfoService extends ServiceBase {
return system.getResultSuccess(); return system.getResultSuccess();
} }
//复审证据材料校验
async checkRejInfo(trademarkRejInfo) {
if(!trademarkRejInfo.noticeDate){
return system.getResult(null,'收到通知书日期不能为空');
}
if(!trademarkRejInfo.noticeMode){
return system.getResult(null,'通知的方式不能为空');
}
if(!["电子版","纸质版"].includes(trademarkRejInfo.noticeMode)){
return system.getResult(null,'通知书的类型错误')
}
if(!trademarkRejInfo.zhichanNumber){
return system.getResult(null,'知识产权局发文号不能为空');
}
if(!trademarkRejInfo.rejNotice){
return system.getResult(null,'商标驳回通知书不能为空');
}
if(!trademarkRejInfo.quotedTrademark){
return system.getResult(null,'引证商标不能为空');
}
return system.getResultSuccess()
}
/** /**
* 商标驳回复审列表 + 模糊查询 * 商标驳回复审列表 + 模糊查询
* @param pobj * @param pobj
...@@ -325,7 +298,7 @@ class OrderInfoService extends ServiceBase { ...@@ -325,7 +298,7 @@ class OrderInfoService extends ServiceBase {
} }
if(actionBody.applicantName){ if(actionBody.applicantName){
sql += ` and json_extract(deliveryContent,'$.applyUser.applicantName') like '%${actionBody.applicantName}%'`; sql += ` and json_extract(deliveryContent,'$.applyUser.applicantName') like '%${actionBody.applicantName}%'`;
sqlCount += ` and json_extract(deliveryContent,'$.applyUser.applicantName') like '%${actionBody.applicantName}'%`; sqlCount += ` and json_extract(deliveryContent,'$.applyUser.applicantName') like '%${actionBody.applicantName}%'`;
} }
if(actionBody.status){ if(actionBody.status){
sql += ` and json_extract(deliveryContent,'$.deliveryStatusName')='${actionBody.status}'`; sql += ` and json_extract(deliveryContent,'$.deliveryStatusName')='${actionBody.status}'`;
...@@ -335,8 +308,8 @@ class OrderInfoService extends ServiceBase { ...@@ -335,8 +308,8 @@ class OrderInfoService extends ServiceBase {
if (actionBody.startTime && actionBody.entTime) { if (actionBody.startTime && actionBody.entTime) {
var startTime = actionBody.startTime.trim() + " 00:00:00"; var startTime = actionBody.startTime.trim() + " 00:00:00";
var endTime = actionBody.entTime + " 23:59:59"; var endTime = actionBody.entTime + " 23:59:59";
sql += ` and json_extract(deliveryContent,'$.deliveryUpdated') between '${startTime}' and '${endTime}'`; sql += ` and json_extract(deliveryContent,'$.deliveryUpdated') >= '${startTime}' and json_extract(deliveryContent,'$.deliveryUpdated') <= '${endTime}'`;
sqlCount += ` and json_extract(deliveryContent,'$.deliveryUpdated') between '${startTime}' and '${endTime}'`; sqlCount += ` and json_extract(deliveryContent,'$.deliveryUpdated') between '${startTime}' and json_extract(deliveryContent,'$.deliveryUpdated') <= '${endTime}'`;
} }
sql += ` order by i.id desc LIMIT ${pageSize} OFFSET ${from}`; sql += ` order by i.id desc LIMIT ${pageSize} OFFSET ${from}`;
...@@ -367,7 +340,7 @@ class OrderInfoService extends ServiceBase { ...@@ -367,7 +340,7 @@ class OrderInfoService extends ServiceBase {
let pageIndex = Number(actionBody.pageIndex || 1); let pageIndex = Number(actionBody.pageIndex || 1);
let from = pageIndex == 1 ? 0 : Number((pageIndex - 1) * pageSize); let from = pageIndex == 1 ? 0 : Number((pageIndex - 1) * pageSize);
let sql = `select o.serviceNo,json_extract(officialInfo,'$.applyUser') applyUser,json_extract(officialInfo,'$.askforId') askforId,json_extract(officialInfo,'$.tmType') tmType,json_extract(officialInfo,'$.tmPicUrl') tmPicUrl,json_extract(officialInfo,'$.applicantName') applicantName,json_extract(officialInfo,'$.fileType') fileType from c_order_info i left join c_delivery_official o on i.orderNo = o.serviceNo where i.uapp_id = ${pobj.appInfo.uapp_id}`; let sql = `select o.serviceNo,json_extract(officialInfo,'$.dir') dir,json_extract(officialInfo,'$.askforId') askforId,json_extract(officialInfo,'$.tradeType') tmType,json_extract(officialInfo,'$.tradeImg') tmPicUrl,json_extract(officialInfo,'$.applicantName') applicantName,json_extract(officialInfo,'$.fileType') fileType,json_extract(officialInfo,'$.received_at') received_at from c_order_info i left join c_delivery_official o on i.orderNo = o.serviceNo where i.uapp_id = ${pobj.appInfo.uapp_id}`;
let sqlCount = `select count(1) as dataCount from c_order_info i left join c_delivery_official o on i.orderNo = o.serviceNo where i.uapp_id = ${pobj.appInfo.uapp_id}` let sqlCount = `select count(1) as dataCount from c_order_info i left join c_delivery_official o on i.orderNo = o.serviceNo where i.uapp_id = ${pobj.appInfo.uapp_id}`
if (pobj.userInfo.channel_userid) { if (pobj.userInfo.channel_userid) {
...@@ -375,8 +348,8 @@ class OrderInfoService extends ServiceBase { ...@@ -375,8 +348,8 @@ class OrderInfoService extends ServiceBase {
sqlCount += ` and o.channelUserId='${pobj.userInfo.channel_userid}'`; sqlCount += ` and o.channelUserId='${pobj.userInfo.channel_userid}'`;
} }
if (actionBody.orderNo) { if (actionBody.orderNo) {
sql += ` and serviceNo='${actionBody.orderNo}'`; sql += ` and o.serviceNo='${actionBody.orderNo}'`;
sqlCount += ` and serviceNo='${actionBody.orderNo}'`; sqlCount += ` and o.serviceNo='${actionBody.orderNo}'`;
} }
if (actionBody.askforId) { if (actionBody.askforId) {
sql += ` and json_extract(officialInfo,'$.askforId')='${actionBody.askforId}'`; sql += ` and json_extract(officialInfo,'$.askforId')='${actionBody.askforId}'`;
...@@ -392,8 +365,8 @@ class OrderInfoService extends ServiceBase { ...@@ -392,8 +365,8 @@ class OrderInfoService extends ServiceBase {
} }
if (actionBody.startTime && actionBody.entTime) { if (actionBody.startTime && actionBody.entTime) {
var startTime = actionBody.startTime.trim() + " 00:00:00"; var startTime = actionBody.startTime.trim();
var endTime = actionBody.entTime + " 23:59:59"; var endTime = actionBody.entTime;
sql += ` and json_extract(officialInfo,'$.received_at') >='${startTime}' and json_extract(officialInfo,'$.received_at')<='${endTime}'`; sql += ` and json_extract(officialInfo,'$.received_at') >='${startTime}' and json_extract(officialInfo,'$.received_at')<='${endTime}'`;
sqlCount += ` and json_extract(officialInfo,'$.received_at') >='${startTime}' and json_extract(officialInfo,'$.received_at')<='${endTime}'`; sqlCount += ` and json_extract(officialInfo,'$.received_at') >='${startTime}' and json_extract(officialInfo,'$.received_at')<='${endTime}'`;
} }
...@@ -421,21 +394,26 @@ class OrderInfoService extends ServiceBase { ...@@ -421,21 +394,26 @@ class OrderInfoService extends ServiceBase {
if(!actionBody.orderNo){ if(!actionBody.orderNo){
return system.getResult(null,'orderNo can not be empty'); return system.getResult(null,'orderNo can not be empty');
} }
let orderSql = `select channelUserId from c_order_info where orderNo = '${actionBody.orderNo}'`; try{
let list = await this.customQuery(orderSql); let orderSql = `select channelUserId from c_order_info where orderNo = '${actionBody.orderNo}'`;
if (!list || list.length == 0) { let list = await this.customQuery(orderSql);
return system.getResult(null, "订单数据为空,30200"); if (!list || list.length == 0) {
} return system.getResult(null, "订单数据为空,30200");
let orderItem = list[0]; }
let orderItem = list[0];
let officialData = { let data = {
serviceNo: actionBody.orderNo, serviceNo: actionBody.orderNo,
channelUserId:orderItem.channelUserId, channelUserId:orderItem.channelUserId,
officialInfo: JSON.parse(actionBody.officialData), officialInfo: actionBody.officialData,
created_at: new Date(), created_at: new Date(),
updated_at: new Date() updated_at: new Date()
}
await this.officialDao.create(data);
return system.getResultSuccess();
}catch (e) {
return system.getResultFail();
} }
await this.officialDao.create(officialData,"");
} }
} }
......
...@@ -246,7 +246,7 @@ class OrderInfoService extends ServiceBase { ...@@ -246,7 +246,7 @@ class OrderInfoService extends ServiceBase {
quantity: actionBody.quantity,// 订单数量(即产品的倍数,默认值为1) quantity: actionBody.quantity,// 订单数量(即产品的倍数,默认值为1)
opPayType: "00",// 操作付款类型:00: 创建订单, 10: 补单 opPayType: "00",// 操作付款类型:00: 创建订单, 10: 补单
serviceItemSnapshot: JSON.stringify(actionBody.product_info),//产品快照 serviceItemSnapshot: JSON.stringify(actionBody.product_info),//产品快照
orderSnapshot:JSON.stringify(actionBody.registerData) orderSnapshot: JSON.stringify(actionBody.registerData)
}; };
var orderProduct = await this.orderproductDao.create(orderProductObj, t);//订单产品 var orderProduct = await this.orderproductDao.create(orderProductObj, t);//订单产品
var orderReceiptVoucherObj = { var orderReceiptVoucherObj = {
...@@ -525,12 +525,17 @@ class OrderInfoService extends ServiceBase { ...@@ -525,12 +525,17 @@ class OrderInfoService extends ServiceBase {
return await self.db.transaction(async function (t) { return await self.db.transaction(async function (t) {
var orderNo = await self.getBusUid("ot" + pobj.appInfo.uapp_id); var orderNo = await self.getBusUid("ot" + pobj.appInfo.uapp_id);
if (pobj.actionBody.channelOrder && pobj.actionBody.channelOrder.channelOrderNo) { if (pobj.actionBody.channelOrder && pobj.actionBody.channelOrder.channelOrderNo) {
var count = await self.dao.findCount({ where: { channelOrderNo: pobj.actionBody.channelOrder.channelOrderNo } }); var rtn = await self.dao.findOne({ channelOrderNo: pobj.actionBody.channelOrder.channelOrderNo }, t);
if (count > 0) { if (rtn) {
return system.getResultFail(-1, "订单不能重复创建s"); return system.getResultSuccess({
orderNo: rtn.orderNo,
channelServiceNo: pobj.actionBody.channelOrder.channelServiceNo || rtn.orderNo,
channelOrderNo: pobj.actionBody.channelOrder.channelOrderNo || rtn.orderNo,
channelParams: pobj.actionBody.channelOrder.channelParams || ""
});
} }
var item = await self.createOrder(pobj, orderNo, t);
} }
var item = await self.createOrder(pobj, orderNo, t);
return system.getResultSuccess({ return system.getResultSuccess({
orderNo: orderNo, orderNo: orderNo,
channelServiceNo: pobj.actionBody.channelOrder.channelServiceNo || orderNo, channelServiceNo: pobj.actionBody.channelOrder.channelServiceNo || orderNo,
...@@ -541,7 +546,7 @@ class OrderInfoService extends ServiceBase { ...@@ -541,7 +546,7 @@ class OrderInfoService extends ServiceBase {
} }
async createH5Order(pobj){ async createH5Order(pobj) {
var self = this; var self = this;
if (!pobj.actionBody.registerData) { if (!pobj.actionBody.registerData) {
return system.getResult(null, "注册信息为空"); return system.getResult(null, "注册信息为空");
...@@ -625,8 +630,8 @@ class OrderInfoService extends ServiceBase { ...@@ -625,8 +630,8 @@ class OrderInfoService extends ServiceBase {
orderStatus: 2 orderStatus: 2
} }
var item = await self.createOrder(pobj, orderNo, t); var item = await self.createOrder(pobj, orderNo, t);
needsolutioninfo.status = "ywc"; // needsolutioninfo.status = "ywc";
await self.needsolutionDao.update(needsolutioninfo, t); await self.needsolutionDao.update({ id: needsolutioninfo.id, status: "dqr" }, t);
self.addOrderDelivery(pobj.actionBody.deliveryData, orderNo); self.addOrderDelivery(pobj.actionBody.deliveryData, orderNo);
return system.getResultSuccess({ return system.getResultSuccess({
orderNo: orderNo, orderNo: orderNo,
...@@ -1086,21 +1091,21 @@ class OrderInfoService extends ServiceBase { ...@@ -1086,21 +1091,21 @@ class OrderInfoService extends ServiceBase {
var list = await this.customQuery(sql, paramWhere); var list = await this.customQuery(sql, paramWhere);
// 2020 0714 lin 新增 用来处理订单列表的进入详情权限 // 2020 0714 lin 新增 用来处理订单列表的进入详情权限
for(let i = 0;i < list.length;i++) { for (let i = 0; i < list.length; i++) {
// 如果没有交付信息跳出 // 如果没有交付信息跳出
if(!list[i]["deliveryContent"]){ if (!list[i]["deliveryContent"]) {
list[i]["isDetail"] = 0;
delete list[i]["deliveryContent"];
continue;
}
// 如果交付信息状态不等于 待确认方案 || 方案不通过 判断为可进入详情
if(list[i]["deliveryContent"]["deliveryStatus"] != "dqrfa" && list[i]["deliveryContent"]["deliveryStatus"] != "fabtg") {
list[i]["isDetail"] = 1;
delete list[i]["deliveryContent"];
continue;
}
list[i]["isDetail"] = 0; list[i]["isDetail"] = 0;
delete list[i]["deliveryContent"]; delete list[i]["deliveryContent"];
continue;
}
// 如果交付信息状态不等于 待确认方案 || 方案不通过 判断为可进入详情
if (list[i]["deliveryContent"]["deliveryStatus"] != "dqrfa" && list[i]["deliveryContent"]["deliveryStatus"] != "fabtg") {
list[i]["isDetail"] = 1;
delete list[i]["deliveryContent"];
continue;
}
list[i]["isDetail"] = 0;
delete list[i]["deliveryContent"];
} }
var result = system.getResultSuccess(list); var result = system.getResultSuccess(list);
...@@ -1518,20 +1523,20 @@ class OrderInfoService extends ServiceBase { ...@@ -1518,20 +1523,20 @@ class OrderInfoService extends ServiceBase {
if (deliveryInfoResult && deliveryInfoResult.status == 0) { if (deliveryInfoResult && deliveryInfoResult.status == 0) {
resultParams.delivery_content = deliveryInfoResult.data; resultParams.delivery_content = deliveryInfoResult.data;
// 2020 0717 lin新增 在回调处增加客户销售分布地区统计 // 2020 0717 lin新增 在回调处增加客户销售分布地区统计
if(deliveryInfoResult.data.apply) { if (deliveryInfoResult.data.apply) {
if(deliveryInfoResult.data.apply.applyAddr) { if (deliveryInfoResult.data.apply.applyAddr) {
var applyAddr = deliveryInfoResult.data.apply.applyAddr var applyAddr = deliveryInfoResult.data.apply.applyAddr
// 获取地址数组 该setting数组 与orderRegion province相同 // 获取地址数组 该setting数组 与orderRegion province相同
var addArr = settings.addArr(); var addArr = settings.addArr();
for(var i = 0;i < addArr.length;i++) { for (var i = 0; i < addArr.length; i++) {
if(applyAddr.indexOf(addArr[i]) >= 0 ){ if (applyAddr.indexOf(addArr[i]) >= 0) {
var sql = "update c_order_region set count=count+1 where province=:province"; var sql = "update c_order_region set count=count+1 where province=:province";
// 修改条件 省名字相同,appid相同 // 修改条件 省名字相同,appid相同
var paramWhere = { where:{province: addArr[i],uapp_id:item.uapp_id}}; var paramWhere = { where: { province: addArr[i], uapp_id: item.uapp_id } };
var updateFields = { var updateFields = {
count: sequelize.literal('count+1') count: sequelize.literal('count+1')
} }
await this.orderRegionDao.updateByWhere(updateFields, paramWhere) await this.orderRegionDao.updateByWhere(updateFields, paramWhere)
} }
} }
} }
......
...@@ -413,7 +413,7 @@ class NeedsolutionService extends ServiceBase { ...@@ -413,7 +413,7 @@ class NeedsolutionService extends ServiceBase {
return system.getResultFail(-103, "方案状态错误,不能废弃已完成方案"); return system.getResultFail(-103, "方案状态错误,不能废弃已完成方案");
} }
} }
await this.dao.model.update({ status: "yzf" }, { where: { needNo: needinfo.needNo } });//方案废弃 await this.dao.model.update({ status: "yzf",isInvalid:1 }, { where: { needNo: needinfo.needNo } });//方案废弃
return system.getResultSuccess(); return system.getResultSuccess();
} }
...@@ -474,7 +474,7 @@ class NeedsolutionService extends ServiceBase { ...@@ -474,7 +474,7 @@ class NeedsolutionService extends ServiceBase {
// return system.getResultFail(-102,"状态不能为空"); // return system.getResultFail(-102,"状态不能为空");
// } // }
var needsolutioninfo = await this.dao.model.findOne({ var needsolutioninfo = await this.dao.model.findOne({
where: { channelSolutionNo: ab.channelSolutionNo }, raw: true where: { channelSolutionNo: ab.channelSolutionNo,isInvalid:0 }, raw: true
}); });
if (!needsolutioninfo || !needsolutioninfo.id) { if (!needsolutioninfo || !needsolutioninfo.id) {
return system.getResultFail(-400, "未知方案"); return system.getResultFail(-400, "未知方案");
...@@ -493,7 +493,7 @@ class NeedsolutionService extends ServiceBase { ...@@ -493,7 +493,7 @@ class NeedsolutionService extends ServiceBase {
} }
await this.dao.update(needsolutioninfo); await this.dao.update(needsolutioninfo);
var ns = await this.dao.model.findOne({ var ns = await this.dao.model.findOne({
where: { channelSolutionNo: ab.channelSolutionNo }, raw: true where: { id: needsolutioninfo.id }, raw: true
}); });
return system.getResultSuccess(ns); return system.getResultSuccess(ns);
} }
......
...@@ -26,6 +26,54 @@ class AliyunQcService{ ...@@ -26,6 +26,54 @@ class AliyunQcService{
512:"⼯商部未通过" 512:"⼯商部未通过"
}; };
} }
//根据需求关闭ICP方案(关闭需求后调用)
async abolishIcpProgrammeByNeed(pobj) {
var ab = pobj.actionBody;
var app = pobj.appInfo;
if (!app || !app.uapp_id) {
return system.getResultFail(-100, "未知渠道");
}
if (!ab.intentionBizId) {
return system.getResultFail(-101, "需求编号不能为空");
}
//获取需求信息
var needinfo = await this.needinfoDao.model.findOne({
attributes:["id","status","statusName","needNo"],
where: { channelNeedNo: ab.intentionBizId }, raw: true
});
if (!needinfo || !needinfo.id) {
return system.getResultFail(-201, "未知需求信息");
}
if (needinfo.status == "ygb") {
return system.getResultFail(-202, "该方案需求状态为" + needinfo.statusName + ",不能执行此操作");
}
//获取方案信息
var ns = await this.needsolutionDao.model.findOne({
where: { needNo: needinfo.needNo,isInvalid:0 }, raw: true
});
if(ns && ns.id){
if (ns.status == "ywc") {
return system.getResultFail(-103, "方案状态错误,不能废弃已完成方案");
}
var flowStatus = ns.solutionContent && ns.solutionContent.status?ns.solutionContent.status:"";
if(flowStatus && [ "GXB_REFUSE","CLOSE"].indexOf(flowStatus)<0){
return system.getResultFail(-104, "⽅案状态为关闭或不予受理才可关闭需求");
}
}
var self = this;
return await this.needsolutionDao.db.transaction(async function (t) {
var needObj = {
id:needinfo.id,status:"ygb",notes:ab.note
};
await self.needinfoDao.update(needObj,t);//关闭需求
if(ns && ns.id){
await self.needsolutionDao.model.update({ status: "yzf",isInvalid:1 }, { where: { id: ns.id }, transaction: t });//方案废弃
return system.getResultSuccess(ns.orderNo);
}
return system.getResultSuccess();
})
}
//根据需求查看方案列表 //根据需求查看方案列表
async getProgrammeInfoByChannelNeedNo(pobj) { async getProgrammeInfoByChannelNeedNo(pobj) {
var ab = pobj.actionBody; var ab = pobj.actionBody;
...@@ -58,7 +106,7 @@ class AliyunQcService{ ...@@ -58,7 +106,7 @@ class AliyunQcService{
} }
//获取方案信息 //获取方案信息
var ns = await this.needsolutionDao.model.findAll({ var ns = await this.needsolutionDao.model.findAll({
where: { channelSolutionNo: ab.BizId }, raw: true where: { channelSolutionNo: ab.BizId,isInvalid:0 }, raw: true
}); });
return system.getResultSuccess(ns); return system.getResultSuccess(ns);
} }
...@@ -121,17 +169,20 @@ class AliyunQcService{ ...@@ -121,17 +169,20 @@ class AliyunQcService{
ab.solutionContent.typeCode = needinfo.typeCode; ab.solutionContent.typeCode = needinfo.typeCode;
ab.solutionContent.typeName = needinfo.typeName; ab.solutionContent.typeName = needinfo.typeName;
var ns = await this.needsolutionDao.model.findAll({ var ns = await this.needsolutionDao.model.findAll({
where: { channelNeedNo: ab.needNo }, raw: true where: { channelNeedNo: ab.needNo }, raw: true,order: [["id", 'asc']]
}); });
for (var i = 0; i < ns.length; i++) { for (var i = 0; i < ns.length; i++) {
var fa = ns[i]; var fa = ns[i];
if (fa.status == "dqr" || fa.status == "ywc") { if (fa.status == "dqr" || fa.status == "ywc") {
return system.getResultFail(-207, "需求方案已存在,不能重复提交"); return system.getResultFail(-207, "需求方案已存在,不能重复提交");
} }
if (fa.status == "ybh") {
ab.channelSolutionNo = fa.channelSolutionNo;
}
if (fa.status == "yzf") {
ab.channelSolutionNo = "";
}
} }
// if (!ab.solutionContent.solution) {
// return system.getResultFail(-104, "业务方案信息不能为空");
// }
var solution = ab.solutionContent.solution; var solution = ab.solutionContent.solution;
if (!solution) { if (!solution) {
return system.getResultFail(-103, "方案交付信息有误"); return system.getResultFail(-103, "方案交付信息有误");
...@@ -143,12 +194,6 @@ class AliyunQcService{ ...@@ -143,12 +194,6 @@ class AliyunQcService{
}else{ }else{
return system.getResultFail(-208, "需求业务类型有误"); return system.getResultFail(-208, "需求业务类型有误");
} }
// ab.solutionContent.applicationStatusList = [{
// "OfficialFileURL": "",
// "ApplicationStatus": "submitIcpProgramme",
// "ApplicationStatusName": "提交方案",
// "created_at": new Date()
// }];
if (!solution.CompanyName) { if (!solution.CompanyName) {
return system.getResultFail(-105, "公司名不能为空"); return system.getResultFail(-105, "公司名不能为空");
} }
...@@ -169,6 +214,18 @@ class AliyunQcService{ ...@@ -169,6 +214,18 @@ class AliyunQcService{
var solutionNo = await this.getBusUid("ns"); var solutionNo = await this.getBusUid("ns");
ab["solutionNo"] = solutionNo; ab["solutionNo"] = solutionNo;
ab["status"] = "dqr"; ab["status"] = "dqr";
var customerInfo = {//客户信息
"publishName":needinfo.publishName,
"publishMobile":needinfo.publishMobile
};
var salesmanInfo = {//业务员信息
"salesmanName":user.channel_username,
"salesmanMobile":user.mobile,
"salesmanId":user.id,
"salesmanChannelId":user.channel_userid
};
ab.solutionContent["customerInfo"]= customerInfo;
ab.solutionContent["salesmanInfo"]= salesmanInfo;
ab.solutionContent = JSON.stringify(ab.solutionContent); ab.solutionContent = JSON.stringify(ab.solutionContent);
var self = this; var self = this;
return await this.needsolutionDao.db.transaction(async function (t) { return await this.needsolutionDao.db.transaction(async function (t) {
...@@ -242,7 +299,7 @@ class AliyunQcService{ ...@@ -242,7 +299,7 @@ class AliyunQcService{
} }
//获取方案信息 //获取方案信息
var ns = await this.needsolutionDao.model.findOne({ var ns = await this.needsolutionDao.model.findOne({
where: { channelSolutionNo: ab.BizId, createUserId: user.id }, raw: true where: { channelSolutionNo: ab.BizId,isInvalid:0}, raw: true
}); });
if (!ns || !ns.id) { if (!ns || !ns.id) {
return system.getResultFail(-300, "未知方案"); return system.getResultFail(-300, "未知方案");
...@@ -256,21 +313,27 @@ class AliyunQcService{ ...@@ -256,21 +313,27 @@ class AliyunQcService{
if (needinfo.status == "ycd" || needinfo.status == "ygb") { if (needinfo.status == "ycd" || needinfo.status == "ygb") {
return system.getResultFail(-401, "该方案需求状态为" + needinfo.statusName + ",不能执行此操作"); return system.getResultFail(-401, "该方案需求状态为" + needinfo.statusName + ",不能执行此操作");
} }
if (ns.status != "dqr") { // if (ns.status != "dqr") {
return system.getResultFail(-301, "方案状态错误,只能废弃待确认方案"); // return system.getResultFail(-301, "方案状态错误,只能废弃待确认方案");
}
var solutionContent = ns.solutionContent;
// if (!solutionContent.status || ["USER_UPLOADED", "MATERIAL_UNCONFIRM", "USER_CONFIRMED", "ACCOUNT_REGISTERED", "MATERIAL_SUBMITTED"].indexOf(solutionContent.status) < 0) {
// return system.getResultFail(-302, "方案流程状态错误,不能执行此操作");
// } // }
var solutionContent = ns.solutionContent;
if (!solutionContent.status || ["USER_UPLOADED", "MATERIAL_UNCONFIRM", "USER_CONFIRMED", "ACCOUNT_REGISTERED", "MATERIAL_SUBMITTED"].indexOf(solutionContent.status) < 0) {
return system.getResultFail(-302, "方案流程状态错误,不能执行此操作");
}
solutionContent.serviceProviderNote = ab.Note; solutionContent.serviceProviderNote = ab.Note;
var solutionFlowList = solutionContent.solutionFlowList || [];
solutionFlowList.push({
status: "CLOSE", statusName: this.icpSolutionStatusReference.CLOSE, updated_at: new Date()
});
solutionContent.status = "CLOSE";
solutionContent.statusName = this.icpSolutionStatusReference.CLOSE;
solutionContent = JSON.stringify(solutionContent); solutionContent = JSON.stringify(solutionContent);
await this.needsolutionDao.update({ id: ns.id, status: "yzf", solutionContent: solutionContent });//方案废弃 await this.needsolutionDao.update({ id: ns.id, status: "yzf",isInvalid:1, solutionContent: solutionContent });//方案废弃
//获取方案信息 //获取方案信息
ns = await this.needsolutionDao.model.findOne({ var new_ns = await this.needsolutionDao.model.findOne({
where: { channelSolutionNo: ab.BizId, createUserId: user.id }, raw: true where: { id:ns.id}, raw: true
}); });
return system.getResultSuccess(ns); return system.getResultSuccess(new_ns);
} }
//交付商提交材料信息 //交付商提交材料信息
async serviceProviderSubmitMaterial(pobj){ async serviceProviderSubmitMaterial(pobj){
...@@ -295,7 +358,7 @@ class AliyunQcService{ ...@@ -295,7 +358,7 @@ class AliyunQcService{
if (!user || !user.id) { if (!user || !user.id) {
return system.getResultFail(-100, "未知用户"); return system.getResultFail(-100, "未知用户");
} }
ab["createUserId"] = user.id; // ab["createUserId"] = user.id;
if (!ab.BizId) { if (!ab.BizId) {
return system.getResultFail(-101, "渠道方案编号不能为空"); return system.getResultFail(-101, "渠道方案编号不能为空");
} }
...@@ -304,7 +367,8 @@ class AliyunQcService{ ...@@ -304,7 +367,8 @@ class AliyunQcService{
} }
//获取方案信息 //获取方案信息
var needsolutioninfo = await this.needsolutionDao.model.findOne({ var needsolutioninfo = await this.needsolutionDao.model.findOne({
where: { channelSolutionNo: ab.BizId }, raw: true attributes:["id","needNo","solutionContent"],
where: { channelSolutionNo: ab.BizId ,isInvalid:0}, raw: true
}); });
if (!needsolutioninfo || !needsolutioninfo.id) { if (!needsolutioninfo || !needsolutioninfo.id) {
return system.getResultFail(-400, "未知方案"); return system.getResultFail(-400, "未知方案");
...@@ -357,10 +421,10 @@ class AliyunQcService{ ...@@ -357,10 +421,10 @@ class AliyunQcService{
var self = this; var self = this;
return await this.needsolutionDao.db.transaction(async function (t) { return await this.needsolutionDao.db.transaction(async function (t) {
await self.needsolutionDao.update(needsolutioninfo, t); await self.needsolutionDao.update(needsolutioninfo, t);
needsolutioninfo = await self.needsolutionDao.model.findOne({ var new_needsolutioninfo = await self.needsolutionDao.model.findOne({
where: { channelSolutionNo: ab.BizId }, raw: true where: { id: needsolutioninfo.id }, raw: true
}); });
return system.getResultSuccess(needsolutioninfo); return system.getResultSuccess(new_needsolutioninfo);
}) })
} }
...@@ -375,6 +439,10 @@ class AliyunQcService{ ...@@ -375,6 +439,10 @@ class AliyunQcService{
}else{ }else{
ab["ApplicationStatus"] = ab.status; ab["ApplicationStatus"] = ab.status;
} }
if (ab.officialFileURL) {
ab["OfficialFileURL"] = ab.officialFileURL;
}
var ns = await this.needsolutionDao.model.findOne({ var ns = await this.needsolutionDao.model.findOne({
where:{orderNo:ab.orderNo},raw:true where:{orderNo:ab.orderNo},raw:true
}); });
...@@ -382,6 +450,7 @@ class AliyunQcService{ ...@@ -382,6 +450,7 @@ class AliyunQcService{
return system.getResultFail(-301, "未知方案"); return system.getResultFail(-301, "未知方案");
} }
ab["BizId"] = ns.channelSolutionNo; ab["BizId"] = ns.channelSolutionNo;
ab["solutionNo"] = ns.solutionNo;
pobj.actionBody = ab; pobj.actionBody = ab;
return this.acceptIcpPartnerNotification(pobj); return this.acceptIcpPartnerNotification(pobj);
} }
...@@ -392,16 +461,20 @@ class AliyunQcService{ ...@@ -392,16 +461,20 @@ class AliyunQcService{
if (!user || !user.id) { if (!user || !user.id) {
return system.getResultFail(-100, "未知用户"); return system.getResultFail(-100, "未知用户");
} }
ab["createUserId"] = user.id; // ab["createUserId"] = user.id;
if (!ab.BizId) { // if (!ab.BizId) {
return system.getResultFail(-101, "渠道方案编号不能为空"); // return system.getResultFail(-101, "渠道方案编号不能为空");
// }
if (!ab.solutionNo) {
return system.getResultFail(-101, "方案编号不能为空");
} }
if (!ab.ApplicationStatus) { if (!ab.ApplicationStatus) {
return system.getResultFail(-102, "通知状态不能为空"); return system.getResultFail(-102, "通知状态不能为空");
} }
//获取方案信息 //获取方案信息
var needsolutioninfo = await this.needsolutionDao.model.findOne({ var needsolutioninfo = await this.needsolutionDao.model.findOne({
where: { channelSolutionNo: ab.BizId }, raw: true attributes:["id","status","solutionContent","needNo"],
where: { solutionNo: ab.solutionNo }, raw: true
}); });
if (!needsolutioninfo || !needsolutioninfo.id) { if (!needsolutioninfo || !needsolutioninfo.id) {
return system.getResultFail(-400, "未知方案"); return system.getResultFail(-400, "未知方案");
...@@ -413,7 +486,12 @@ class AliyunQcService{ ...@@ -413,7 +486,12 @@ class AliyunQcService{
if (!solutionContent) { if (!solutionContent) {
return system.getResultFail(-402, "方案交付信息有误"); return system.getResultFail(-402, "方案交付信息有误");
} }
// if(solutionContent.) if (solutionContent.applicationStatus && solutionContent.applicationStatus>ab.ApplicationStatus) {
return system.getResultFail(-403, "操作失败,交付流程未按顺序执行");
}
if (solutionContent.ApplicationStatus && solutionContent.ApplicationStatus==ab.ApplicationStatus) {
return system.getResultFail(-405, "操作失败,该流程状态已提交,不能重复提交");
}
//获取需求信息 //获取需求信息
var needinfo = await this.needinfoDao.model.findOne({ var needinfo = await this.needinfoDao.model.findOne({
where: { needNo: needsolutioninfo.needNo }, raw: true where: { needNo: needsolutioninfo.needNo }, raw: true
...@@ -424,17 +502,12 @@ class AliyunQcService{ ...@@ -424,17 +502,12 @@ class AliyunQcService{
if (needinfo.status == "ycd" || needinfo.status == "ygb") { if (needinfo.status == "ycd" || needinfo.status == "ygb") {
return system.getResultFail(-202, "该方案需求状态为" + needinfo.statusName + ",不能执行此操作"); return system.getResultFail(-202, "该方案需求状态为" + needinfo.statusName + ",不能执行此操作");
} }
var applicationStatusList = solutionContent.applicationStatusList || [];
var solutionFlowList = solutionContent.solutionFlowList || []; var solutionFlowList = solutionContent.solutionFlowList || [];
var statusObj = {
"OfficialFileURL": ab.OfficialFileURL || "",
"ApplicationStatus": ab.ApplicationStatus,
"ApplicationStatusName": this.icpApplicationStatusReference[ab.ApplicationStatus],
"created_at": new Date()
};
applicationStatusList.push(statusObj);
solutionContent.applicationStatusList = applicationStatusList;
if (ab.ApplicationStatus == 507) {//完成账户注册 if (ab.ApplicationStatus == 507) {//完成账户注册
if(solutionContent.status!="USER_CONFIRMED"){
return system.getResultFail(-508, "交付流程错误,用户确认递交⽂件后才能执行此操作");
}
solutionContent.ApplicationStatus = 507;
solutionFlowList.push({ solutionFlowList.push({
file: ab.OfficialFileURL || "", file: ab.OfficialFileURL || "",
status: "ACCOUNT_REGISTERED", statusName: this.icpSolutionStatusReference.ACCOUNT_REGISTERED, updated_at: new Date() status: "ACCOUNT_REGISTERED", statusName: this.icpSolutionStatusReference.ACCOUNT_REGISTERED, updated_at: new Date()
...@@ -443,6 +516,9 @@ class AliyunQcService{ ...@@ -443,6 +516,9 @@ class AliyunQcService{
solutionContent.statusName = this.icpSolutionStatusReference.ACCOUNT_REGISTERED; solutionContent.statusName = this.icpSolutionStatusReference.ACCOUNT_REGISTERED;
} }
if (ab.ApplicationStatus == 508) {//"服务商完成提交资料到⼯信部 if (ab.ApplicationStatus == 508) {//"服务商完成提交资料到⼯信部
if(solutionContent.status!="ACCOUNT_REGISTERED"){
return system.getResultFail(-508, "交付流程错误,请先完成账户注册");
}
solutionFlowList.push({ solutionFlowList.push({
file: ab.OfficialFileURL || "", file: ab.OfficialFileURL || "",
status: "MATERIAL_SUBMITTED", statusName: this.icpSolutionStatusReference.MATERIAL_SUBMITTED, updated_at: new Date() status: "MATERIAL_SUBMITTED", statusName: this.icpSolutionStatusReference.MATERIAL_SUBMITTED, updated_at: new Date()
...@@ -451,6 +527,9 @@ class AliyunQcService{ ...@@ -451,6 +527,9 @@ class AliyunQcService{
solutionContent.statusName = this.icpSolutionStatusReference.MATERIAL_SUBMITTED; solutionContent.statusName = this.icpSolutionStatusReference.MATERIAL_SUBMITTED;
} }
if (ab.ApplicationStatus == 509) {//⼯商部已受理 if (ab.ApplicationStatus == 509) {//⼯商部已受理
if(solutionContent.status!="MATERIAL_SUBMITTED"){
return system.getResultFail(-509, "交付流程错误,请先完成资料递交");
}
solutionFlowList.push({ solutionFlowList.push({
file: ab.OfficialFileURL || "", file: ab.OfficialFileURL || "",
status: "GXB_ACCEPT", statusName: this.icpSolutionStatusReference.GXB_ACCEPT, updated_at: new Date() status: "GXB_ACCEPT", statusName: this.icpSolutionStatusReference.GXB_ACCEPT, updated_at: new Date()
...@@ -459,15 +538,21 @@ class AliyunQcService{ ...@@ -459,15 +538,21 @@ class AliyunQcService{
solutionContent.statusName = this.icpSolutionStatusReference.GXB_ACCEPT; solutionContent.statusName = this.icpSolutionStatusReference.GXB_ACCEPT;
} }
if (ab.ApplicationStatus == 510) {//⼯商部不予受理 if (ab.ApplicationStatus == 510) {//⼯商部不予受理
if(solutionContent.status!="MATERIAL_SUBMITTED"){
return system.getResultFail(-510, "交付流程错误,请先完成资料递交");
}
solutionFlowList.push({ solutionFlowList.push({
file: ab.OfficialFileURL || "", file: ab.OfficialFileURL || "",
status: "GXB_REFUSE", statusName: this.icpSolutionStatusReference.GXB_REFUSE, updated_at: new Date() status: "GXB_REFUSE", statusName: this.icpSolutionStatusReference.GXB_REFUSE, updated_at: new Date()
}); });
solutionContent.status = "GXB_REFUSE"; solutionContent.status = "GXB_REFUSE";
needsolutioninfo.status = "yzf"; needsolutioninfo.status = "ywc";
solutionContent.statusName = this.icpSolutionStatusReference.GXB_REFUSE; solutionContent.statusName = this.icpSolutionStatusReference.GXB_REFUSE;
} }
if (ab.ApplicationStatus == 511) {//⼯商部通过 if (ab.ApplicationStatus == 511) {//⼯商部通过
if(solutionContent.status!="GXB_ACCEPT"){
return system.getResultFail(-511, "交付流程错误,⼯信部已受理后才能执行此操作");
}
solutionFlowList.push({ solutionFlowList.push({
file: ab.OfficialFileURL || "", file: ab.OfficialFileURL || "",
status: "GXB_SUCCESS", statusName: this.icpSolutionStatusReference.GXB_SUCCESS, updated_at: new Date() status: "GXB_SUCCESS", statusName: this.icpSolutionStatusReference.GXB_SUCCESS, updated_at: new Date()
...@@ -477,22 +562,32 @@ class AliyunQcService{ ...@@ -477,22 +562,32 @@ class AliyunQcService{
solutionContent.statusName = this.icpSolutionStatusReference.GXB_SUCCESS; solutionContent.statusName = this.icpSolutionStatusReference.GXB_SUCCESS;
} }
if (ab.ApplicationStatus == 512) {//⼯信部未通过 if (ab.ApplicationStatus == 512) {//⼯信部未通过
if(solutionContent.status!="GXB_ACCEPT"){
return system.getResultFail(-512, "交付流程错误,⼯信部已受理后才能执行此操作");
}
solutionFlowList.push({ solutionFlowList.push({
file: ab.OfficialFileURL || "", file: ab.OfficialFileURL || "",
status: "GXB_FAIL", statusName: this.icpSolutionStatusReference.GXB_FAIL, updated_at: new Date() status: "GXB_FAIL", statusName: this.icpSolutionStatusReference.GXB_FAIL, updated_at: new Date()
}); });
solutionContent.status = "GXB_FAIL"; solutionContent.status = "GXB_FAIL";
needsolutioninfo.status = "yzf"; needsolutioninfo.status = "ywc";
solutionContent.statusName = this.icpSolutionStatusReference.GXB_FAIL; solutionContent.statusName = this.icpSolutionStatusReference.GXB_FAIL;
} }
solutionContent.solutionFlowList = solutionFlowList; solutionContent.solutionFlowList = solutionFlowList;
var applicationStatusList = solutionContent.applicationStatusList || [];
var statusObj = {
"OfficialFileURL": ab.OfficialFileURL || "",
"ApplicationStatus": ab.ApplicationStatus,
"ApplicationStatusName": this.icpApplicationStatusReference[ab.ApplicationStatus],
"created_at": new Date()
};
applicationStatusList.push(statusObj);
solutionContent.applicationStatusList = applicationStatusList;
solutionContent.applicationStatus = ab.ApplicationStatus;
needsolutioninfo.solutionContent = JSON.stringify(solutionContent); needsolutioninfo.solutionContent = JSON.stringify(solutionContent);
var self = this; var self = this;
return await this.needsolutionDao.db.transaction(async function (t) { return await this.needsolutionDao.db.transaction(async function (t) {
await self.needsolutionDao.update(needsolutioninfo, t); await self.needsolutionDao.update(needsolutioninfo, t);
needsolutioninfo = await self.needsolutionDao.model.findOne({
where: { channelSolutionNo: ab.BizId }, raw: true
});
statusObj["BizId"] = ab.BizId; statusObj["BizId"] = ab.BizId;
return system.getResultSuccess(statusObj); return system.getResultSuccess(statusObj);
}) })
...@@ -509,7 +604,7 @@ class AliyunQcService{ ...@@ -509,7 +604,7 @@ class AliyunQcService{
} }
//获取方案信息 //获取方案信息
var ns = await this.needsolutionDao.model.findOne({ var ns = await this.needsolutionDao.model.findOne({
where: { channelSolutionNo: ab.BizId }, raw: true where: { channelSolutionNo: ab.BizId ,isInvalid:0}, raw: true
}); });
if (!ns || !ns.id) { if (!ns || !ns.id) {
return system.getResultFail(-102, "未知方案"); return system.getResultFail(-102, "未知方案");
...@@ -520,65 +615,83 @@ class AliyunQcService{ ...@@ -520,65 +615,83 @@ class AliyunQcService{
if (!needinfo) { if (!needinfo) {
return system.getResultFail(-104, "未知方案需求"); return system.getResultFail(-104, "未知方案需求");
} }
if (needinfo.status == "ycd" || needinfo.status == "ygb") { if (needinfo.status == "ygb") {
return system.getResultFail(-105, "该方案需求状态为" + needinfo.statusName + ",不能执行此操作"); return system.getResultFail(-105, "该方案需求状态为" + needinfo.statusName + ",不能执行此操作");
} }
if (ns.status != "dqr" && ns.status != "yzf" && ns.status != "ybh") { // if (ns.status == "yzf" || ns.status == "ywc") {
return system.getResultFail(-103, "方案状态错误,不能作废已完成方案"); // return system.getResultFail(-103, "该方案状态为" + ns.statusName + ",不能执行此操作");
} // }
var solutionContent = ns.solutionContent; var solutionContent = ns.solutionContent;
var checkStatus = {ACCOUNT_REGISTERED: "完成账户注册", MATERIAL_SUBMITTED: "完成资料递交",
GXB_ACCEPT: "⼯信部已受理", GXB_REFUSE: "⼯信部不予受理", GXB_FAIL: "⼯信部未通过", GXB_SUCCESS: "工信部通过"
, CLOSE: "方案关闭"};
if(solutionContent.status && checkStatus[solutionContent.status]){
return system.getResultFail(-111, "方案已进入"+solutionContent.statusName+"流程,不能执行此操作");
}
//方案流程列表 //方案流程列表
var solutionFlowList = solutionContent.solutionFlowList || []; var solutionFlowList = solutionContent.solutionFlowList || [];
if (ab.status == "2") {//⽤户已上传 if (ab.status == "1") {//⽤户已支付
solutionFlowList.push({
status: "PAID", statusName: this.icpSolutionStatusReference.PAID, updated_at: new Date()
});
solutionContent.status = "PAID";
solutionContent.statusName = this.icpSolutionStatusReference.PAID;
}else if (ab.status == "2") {//⽤户已上传
if(solutionContent.status =="USER_CONFIRMED"){//防止用户确认后又否决
return system.getResultFail(-112, "操作失败,⽤户已确认递交⽂件");
}
solutionFlowList.push({ solutionFlowList.push({
status: "USER_UPLOADED", statusName: this.icpSolutionStatusReference.USER_UPLOADED, updated_at: new Date() status: "USER_UPLOADED", statusName: this.icpSolutionStatusReference.USER_UPLOADED, updated_at: new Date()
}); });
solutionContent.status = "USER_UPLOADED"; solutionContent.status = "USER_UPLOADED";
solutionContent.statusName = this.icpSolutionStatusReference.USER_UPLOADED; solutionContent.statusName = this.icpSolutionStatusReference.USER_UPLOADED;
} }else if (ab.status == "4") {//⽤户已确认
if (ab.status == "4") {//⽤户已确认 if(solutionContent.status !="MATERIAL_UNCONFIRM"){
return system.getResultFail(-113, "操作失败,服务商递交⽂件后才能执行此操作");
}
solutionFlowList.push({ solutionFlowList.push({
status: "USER_CONFIRMED", statusName: this.icpSolutionStatusReference.USER_CONFIRMED, updated_at: new Date() status: "USER_CONFIRMED", statusName: this.icpSolutionStatusReference.USER_CONFIRMED, updated_at: new Date()
}); });
solutionContent.status = "USER_CONFIRMED"; solutionContent.status = "USER_CONFIRMED";
solutionContent.statusName = this.icpSolutionStatusReference.USER_CONFIRMED; solutionContent.statusName = this.icpSolutionStatusReference.USER_CONFIRMED;
} }else if (ab.status == "11") {//⽅案已关闭
if (ab.status == "11") {//⽅案已关闭
solutionFlowList.push({ solutionFlowList.push({
status: "CLOSE", statusName: this.icpSolutionStatusReference.CLOSE, updated_at: new Date() status: "CLOSE", statusName: this.icpSolutionStatusReference.CLOSE, updated_at: new Date()
}); });
solutionContent.status = "CLOSE"; solutionContent.status = "CLOSE";
solutionContent.statusName = this.icpSolutionStatusReference.CLOSE; solutionContent.statusName = this.icpSolutionStatusReference.CLOSE;
}else{
return system.getResultFail(-110, "状态错误");
} }
solutionContent.solutionFlowList = solutionFlowList; solutionContent.solutionFlowList = solutionFlowList;
var material = solutionContent.material || {}; var material = solutionContent.customerMaterial || {};
if (ab.remark) { if (ab.remark) {
solutionContent.customerRemark = ab.remark; solutionContent.customerRemark = ab.remark;
} }
if (ab.newbusinessLicense) { if (ab.newbusinessLicense) {
material.PartnerBusinessLicense = ab.newbusinessLicense; material.businessLicense = ab.newbusinessLicense;
material.aliPartnerBusinessLicense = ab.businessLicense; material.aliBusinessLicense = ab.businessLicense;
} }
if (ab.newidCardUrlList && ab.newidCardUrlList.length > 0) { if (ab.newidCardUrlList && ab.newidCardUrlList.length > 0) {
material.PartnerIdCardList = ab.newidCardUrlList; material.idCardUrlList = ab.newidCardUrlList;
material.aliPartnerIdCardList = ab.idCardUrlList; material.aliIdCardUrlList = ab.idCardUrlList;
} }
if (ab.newuserPlan) { if (ab.newuserPlan) {
material.PartnerPlan = ab.newuserPlan; material.userPlan = ab.newuserPlan;
material.aliPartnerPlan = ab.userPlan; material.aliUserPlan = ab.userPlan;
} }
if (ab.newuserForeig) { if (ab.newuserForeig) {
material.PartnerForeignInvestment = ab.newuserForeig; material.userForeig = ab.newuserForeig;
material.aliPartnerForeignInvestment = ab.userForeig; material.aliUserForeig = ab.userForeig;
} }
if (ab.newuserLaw) { if (ab.newuserLaw) {
material.PartnerLaw = ab.newuserLaw; material.userLaw = ab.newuserLaw;
material.aliPartnerLaw = ab.userLaw; material.aliUserLaw = ab.userLaw;
} }
if (ab.newuserOtherList && ab.newuserOtherList.length > 0) { if (ab.newuserOtherList && ab.newuserOtherList.length > 0) {
material.PartnerSignAndStampOtherList = ab.newuserOtherList; material.userOtherList = ab.newuserOtherList;
material.aliPartnerSignAndStampOtherList = ab.userOtherList; material.aliUserOtherList = ab.userOtherList;
} }
solutionContent.customerMaterial = material; solutionContent.customerMaterial = material;
solutionContent = JSON.stringify(solutionContent); solutionContent = JSON.stringify(solutionContent);
...@@ -587,10 +700,11 @@ class AliyunQcService{ ...@@ -587,10 +700,11 @@ class AliyunQcService{
}; };
if (ab.status == "11") {//⽅案已关闭 if (ab.status == "11") {//⽅案已关闭
updateObj["status"] = "yzf"; updateObj["status"] = "yzf";
updateObj["isInvalid"]=1;
} }
await this.needsolutionDao.update(updateObj);//方案状态修改 await this.needsolutionDao.update(updateObj);//方案状态修改
ns = await this.needsolutionDao.model.findOne({ var new_ns = await this.needsolutionDao.model.findOne({
where: { channelSolutionNo: ab.BizId }, raw: true where: { id: ns.id }, raw: true
}); });
return system.getResultSuccess(ns); return system.getResultSuccess(ns);
} }
...@@ -618,7 +732,7 @@ class AliyunQcService{ ...@@ -618,7 +732,7 @@ class AliyunQcService{
} }
//获取方案信息 //获取方案信息
var ns = await this.needsolutionDao.model.findOne({ var ns = await this.needsolutionDao.model.findOne({
where: { channelNeedNo: ab.intentionBizId, status: "dqr" }, raw: true where: { channelNeedNo: ab.intentionBizId, isInvalid:0 }, raw: true
}); });
if (!ns) { if (!ns) {
return system.getResultFail(-106, "未知方案"); return system.getResultFail(-106, "未知方案");
...@@ -632,12 +746,16 @@ class AliyunQcService{ ...@@ -632,12 +746,16 @@ class AliyunQcService{
solutionContent.needStatus = ab.intentionStatus; solutionContent.needStatus = ab.intentionStatus;
if(ab.intentionStatus == 1){ if(ab.intentionStatus == 1){
updateObj["status"] = "ybh"; updateObj["status"] = "ybh";
updateObj["isInvalid"]=1;
}else if (ab.intentionStatus == 2) { }else if (ab.intentionStatus == 2) {
updateObj["status"] = "dqr"; updateObj["status"] = "dqr";
} else if (ab.intentionStatus == 4 || ab.intentionStatus == 3) { }else if (ab.intentionStatus == 3) {
updateObj["status"] = "ywc"; updateObj["status"] = "dqr";
} else if (ab.intentionStatus == 4) {
updateObj["status"] = "dqr";
} else if (ab.intentionStatus == 5) { } else if (ab.intentionStatus == 5) {
updateObj["status"] = "yzf"; updateObj["status"] = "yzf";
updateObj["isInvalid"]=1;
} else { } else {
return system.getResultFail(-107, "需求当前状态错误--" + ab.intentionStatus); return system.getResultFail(-107, "需求当前状态错误--" + ab.intentionStatus);
} }
...@@ -657,7 +775,7 @@ class AliyunQcService{ ...@@ -657,7 +775,7 @@ class AliyunQcService{
return system.getResultFail(-102, "方案业务编号不能为空"); return system.getResultFail(-102, "方案业务编号不能为空");
} }
var ns = await this.needsolutionDao.model.findOne({ var ns = await this.needsolutionDao.model.findOne({
where: { solutionNo: ab.solutionNo }, raw: true where: { solutionNo: ab.solutionNo,isInvalid:0 }, raw: true
}); });
if (!ns || !ns.id) { if (!ns || !ns.id) {
return system.getResultFail(-103, "未知方案"); return system.getResultFail(-103, "未知方案");
...@@ -675,6 +793,36 @@ class AliyunQcService{ ...@@ -675,6 +793,36 @@ class AliyunQcService{
return system.getResultSuccess(); return system.getResultSuccess();
} }
//接收确认方案后阿里返回链接
async receiveIcpConfirmUrl(pobj) {
var ab = pobj.actionBody;
if (!ab.confirmUrl) {
return system.getResultFail(-101, "confirmUrl不能为空");
}
if (!ab.solutionNo) {
return system.getResultFail(-102, "方案业务编号不能为空");
}
var ns = await this.needsolutionDao.model.findOne({
where: { solutionNo: ab.solutionNo,isInvalid:0 }, raw: true
});
if (!ns || !ns.id) {
return system.getResultFail(-103, "未知方案");
}
var needinfo = await this.needinfoDao.model.findOne({
where: { needNo: ns.needNo }, raw: true
});
if (!needinfo) {
return system.getResultFail(-104, "未知方案需求");
}
if (needinfo.status == "ycd" || needinfo.status == "ygb") {
return system.getResultFail(-105, "该方案需求状态为" + needinfo.statusName + ",不能执行此操作");
}
ns.solutionContent.confirmUrl =ab.confirmUrl;
var solutionContent = JSON.stringify(ns.solutionContent);
await this.needsolutionDao.model.update({ solutionContent: solutionContent }, { where: { id: ns.id } });//修改方案信息
return system.getResultSuccess();
}
/* /*
返回20位业务订单号 返回20位业务订单号
prefix:业务前缀 prefix:业务前缀
......
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