Commit a9349f03 by 王栋源

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

parents 60cf842f b282c988
...@@ -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;
......
...@@ -48,6 +48,9 @@ class IcAPI extends APIBase { ...@@ -48,6 +48,9 @@ class IcAPI extends APIBase {
case "getItemByChannelSolutionNo"://渠道方案号获取需求详情 case "getItemByChannelSolutionNo"://渠道方案号获取需求详情
opResult = await this.needinfoSve.getItemByChannelSolutionNo(pobj, pobj.actionBody, req); opResult = await this.needinfoSve.getItemByChannelSolutionNo(pobj, pobj.actionBody, req);
break; break;
case "writeCommunicationLog"://渠道方案号获取需求详情
opResult = await this.needinfoSve.writeCommunicationLog(pobj, pobj.actionBody, req);
break;
default: default:
opResult = system.getResult(null, "action_type参数错误"); opResult = system.getResult(null, "action_type参数错误");
break; break;
......
var APIBase = require("../../api.base");
var system = require("../../../system");
var settings = require("../../../../config/settings");
class QcAPI extends APIBase {
constructor() {
super();
this.aliyunqcSve = system.getObject("service.qcutils.aliyunqcSve");
}
/**
* 接口跳转-POST请求
* action_process 执行的流程
* action_type 执行的类型
* action_body 执行的参数
*/
async springBoard(pobj, qobj, req) {
if (!pobj.actionType) {
return system.getResult(null, "actionType参数不能为空");
}
if (pobj.actionType == 'getPolicyNeedList' || pobj.actionType == 'submitPolicyNeedNotes') {
if (!pobj.userInfo) {
return system.getResult(system.noLogin, "user no login!");
}
if (!pobj.appInfo) {
return system.getResult(system.noLogin, "app is null!");
}
}
var result = await this.opActionProcess(pobj, pobj.actionType, req);
return result;
}
async opActionProcess(pobj, action_type, req) {
var opResult = null;
switch (action_type) {
case "receiveProgrammeNo"://接收方案编号(方案推送至阿里后,接收保存方案信息)
opResult = await this.aliyunqcSve.receiveProgrammeNo(pobj);
break;
case "submitIcpProgramme"://icp方案提交
opResult = await this.aliyunqcSve.submitIcpProgramme(pobj);
break;
// case "submitIcpMaterial"://icp材料提交
// opResult = await this.aliyunqcSve.submitIcpMaterial(pobj);
// break;
case "acceptIcpPartnerNotification"://icp通知状态变更
opResult = await this.aliyunqcSve.acceptIcpPartnerNotification(pobj);
break;
case "abolishIcpProgramme"://服务商icp方案关闭
opResult = await this.aliyunqcSve.abolishIcpProgramme(pobj);
break;
case "getIcpProgrammeDetail"://获取icp方案
opResult = await this.aliyunqcSve.getIcpProgrammeDetail(pobj);
break;
case "getNeedSolutionDetailByUser"://获取方案详情
opResult = await this.aliyunqcSve.getNeedSolutionDetailByUser(pobj);
break;
case "receiveIcpStatusNotify"://接收渠道方案状态变更通知2.3
opResult = await this.aliyunqcSve.receiveIcpStatusNotify(pobj);
break;
case "receiveIcpFeedback"://接收icp用户方案反馈2.2
opResult = await this.aliyunqcSve.receiveIcpFeedback(pobj);
break;
case "getIcpProgrammeDetail"://获取方案详情(内部调用)
opResult = await this.aliyunqcSve.getIcpProgrammeDetail(pobj);
break;
case "getProgrammeInfoByChannelNeedNo"://获取需求方案列表
opResult = await this.aliyunqcSve.getProgrammeInfoByChannelNeedNo(pobj);
break;
case "serviceProviderSubmitMaterial"://交付商提交材料信息
opResult = await this.aliyunqcSve.serviceProviderSubmitMaterial(pobj);
break;
case "serviceProviderNotification"://交付商通知状态变更
opResult = await this.aliyunqcSve.serviceProviderNotification(pobj);
break;
case "closeOrderDelivery"://交付商关闭交付单
opResult = await this.aliyunqcSve.closeOrderDelivery(pobj);
break;
default:
opResult = system.getResult(null, "action_type参数错误");
break;
}
return opResult;
}
}
module.exports = QcAPI;
\ No newline at end of file
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;
...@@ -73,7 +73,7 @@ module.exports = { ...@@ -73,7 +73,7 @@ module.exports = {
"push_chance_type": { "wts": "未推送", "yts": "已推送", "ygj": "已跟进", "ycd": "已成单", "ygb": "已关闭" }, "push_chance_type": { "wts": "未推送", "yts": "已推送", "ygj": "已跟进", "ycd": "已成单", "ygb": "已关闭" },
"policy_type": { 'fzbt': '租金减免', 'jrdk': '金融贷款', 'zdfc': '行政措施', 'ssjm': '税收优惠', 'rlzy': '人力资源' }, "policy_type": { 'fzbt': '租金减免', 'jrdk': '金融贷款', 'zdfc': '行政措施', 'ssjm': '税收优惠', 'rlzy': '人力资源' },
"customer_intention": { "dgj": "待跟进", "yyx": "有意向", "wyx": "无意向" }, "customer_intention": { "dgj": "待跟进", "yyx": "有意向", "wyx": "无意向" },
"solution_status": { "dqr": "待确认", "ywc": "已完成", "yzf": "已作废" }, "solution_status": { "dqr": "待确认","ybh":"用户驳回", "ywc": "已完成", "yzf": "已作废" },
}, },
} }
......
...@@ -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,18 +207,25 @@ class OrderInfoService extends ServiceBase { ...@@ -221,18 +207,25 @@ class OrderInfoService extends ServiceBase {
* @param orderNo * @param orderNo
*/ */
addOrderDelivery(data, orderNo) { addOrderDelivery(data, orderNo) {
try{
var sql = "INSERT INTO `c_order_delivery` (`sourceOrderNo`,`deliveryContent`) VALUE('" + var sql = "INSERT INTO `c_order_delivery` (`sourceOrderNo`,`deliveryContent`) VALUE('" +
orderNo + "','" + JSON.stringify(data) + "')"; orderNo + "','" + JSON.stringify(data) + "')";
this.customQuery(sql); 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) {
try{
var packagingTmResult = await this.packagingTmReDeliveryData(pobj, pobj.actionBody); var packagingTmResult = await this.packagingTmReDeliveryData(pobj, pobj.actionBody);
if (packagingTmResult.status != 0) { if (packagingTmResult.status != 0) {
return packagingTmResult; return packagingTmResult;
...@@ -243,6 +236,9 @@ class OrderInfoService extends ServiceBase { ...@@ -243,6 +236,9 @@ class OrderInfoService extends ServiceBase {
sql = sql.replace('\n', ''); sql = sql.replace('\n', '');
const result = await this.customUpdate(sql); const result = await this.customUpdate(sql);
return system.getResultSuccess(); return system.getResultSuccess();
}catch (e) {
return system.getResultFail();
}
} }
//申请信息校验 //申请信息校验
...@@ -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}'`;
...@@ -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');
} }
try{
let orderSql = `select channelUserId from c_order_info where orderNo = '${actionBody.orderNo}'`; let orderSql = `select channelUserId from c_order_info where orderNo = '${actionBody.orderNo}'`;
let list = await this.customQuery(orderSql); let list = await this.customQuery(orderSql);
if (!list || list.length == 0) { if (!list || list.length == 0) {
return system.getResult(null, "订单数据为空,30200"); return system.getResult(null, "订单数据为空,30200");
} }
let orderItem = list[0]; let orderItem = list[0];
let data = {
let officialData = {
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(officialData,""); await this.officialDao.create(data);
return system.getResultSuccess();
}catch (e) {
return system.getResultFail();
}
} }
} }
......
...@@ -629,8 +629,8 @@ class OrderInfoService extends ServiceBase { ...@@ -629,8 +629,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,
......
...@@ -2,12 +2,14 @@ const uuidv4 = require('uuid/v4'); ...@@ -2,12 +2,14 @@ const uuidv4 = require('uuid/v4');
const system = require("../../../system"); const system = require("../../../system");
const ServiceBase = require("../../sve.base"); const ServiceBase = require("../../sve.base");
const settings = require("../../../../config/settings"); const settings = require("../../../../config/settings");
var moment = require('moment')
class NeedinfoService extends ServiceBase { class NeedinfoService extends ServiceBase {
constructor() { constructor() {
super("dbneed", ServiceBase.getDaoName(NeedinfoService)); super("dbneed", ServiceBase.getDaoName(NeedinfoService));
this.execlient = system.getObject("util.execClient"); this.execlient = system.getObject("util.execClient");
this.needsolutionSve = system.getObject("service.dbneed.needsolutionSve"); this.needsolutionSve = system.getObject("service.dbneed.needsolutionSve");
this.needsolutionDao = system.getObject("db.dbneed.needsolutionDao"); this.needsolutionDao = system.getObject("db.dbneed.needsolutionDao");
this.needinfoDao = system.getObject("db.dbneed.needinfoDao");
} }
async getItemByNeedNo(pobj) { async getItemByNeedNo(pobj) {
var item = await this.dao.getItemByNeedNo(pobj.actionBody.needNo); var item = await this.dao.getItemByNeedNo(pobj.actionBody.needNo);
...@@ -172,6 +174,41 @@ class NeedinfoService extends ServiceBase { ...@@ -172,6 +174,41 @@ class NeedinfoService extends ServiceBase {
return system.getResultSuccess(item); return system.getResultSuccess(item);
} }
async writeCommunicationLog(pobj,actionBody){
// 查询需求沟通记录
actionBody.Note = ["noteTime",moment().format("YYYY-MM-DD HH:mm:ss"),"note",actionBody.Note];
let needRes = await this.findOne({channelNeedNo:actionBody.BizId});
// 没有需求单直接返回
if(!needRes) {
return system.getResult("没有这个需求单");
}
// 有需求单但没有沟通记录 直接set
if(!needRes.followContent) {
var sql = "update n_need_info set followContent=JSON_OBJECT(:followContent) where channelNeedNo=:BizId"
var paramWhere = {
followContent: actionBody.Note,
BizId: actionBody.BizId
};
var updateRes = await this.customUpdate(sql,paramWhere);
if(updateRes[1]) {
return system.getResultSuccess();
}
return system.getResult("添加记录失败");
// 有需求单有沟通记录 json_array_append
} else {
var sql = "update n_need_info set followContent=json_array_append(followContent, '$', JSON_OBJECT(:Note)) where channelNeedNo=:BizId"
// var sql = "update n_need_info set followContent=json_array_append(followContent, '$', "+ "\"" + JSON.stringify(actionBody.Note) + "\""+") where channelNeedNo="+ "\"" +actionBody.BizId +"\"" +" "
var paramWhere = {
Note: actionBody.Note,
BizId: actionBody.BizId
};
var updateRes = await this.customUpdate(sql,paramWhere);
if(updateRes[1]) {
return system.getResultSuccess();
}
return system.getResult("添加记录失败");
}
}
} }
module.exports = NeedinfoService; module.exports = NeedinfoService;
......
...@@ -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);
} }
......
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