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 {
async opActionProcess(pobj, action_type, req) {
var opResult = null;
switch (action_type) {
case "submitIcpProgramme"://icp方案提交
opResult = await this.needsolutionSve.submitIcpProgramme(pobj);
break;
case "submitIcpMaterial"://icp材料提交
opResult = await this.needsolutionSve.submitIcpMaterial(pobj);
break;
case "acceptIcpPartnerNotification"://icp通知状态变更
opResult = await this.needsolutionSve.acceptIcpPartnerNotification(pobj);
break;
case "abolishIcpProgramme"://服务商icp方案关闭
opResult = await this.needsolutionSve.abolishIcpProgramme(pobj);
break;
case "getIcpProgrammeDetail"://获取icp方案
opResult = await this.needsolutionSve.getIcpProgrammeDetail(pobj);
break;
case "getNeedSolutionDetailByUser"://获取方案详情
opResult = await this.needsolutionSve.getNeedSolutionDetailByUser(pobj);
break;
case "receiveIcpStatusNotify"://接收渠道方案状态变更通知
opResult = await this.needsolutionSve.receiveIcpStatusNotify(pobj);
break;
case "receiveIcpFeedback"://接收icp用户方案反馈
opResult = await this.needsolutionSve.receiveIcpFeedback(pobj);
break;
case "getIcpProgrammeDetail"://获取方案详情(内部调用)
opResult = await this.needsolutionSve.getIcpProgrammeDetail(pobj);
break;
case "getProgrammeInfoByChannelNeedNo"://获取需求方案列表
opResult = await this.needsolutionSve.getProgrammeInfoByChannelNeedNo(pobj);
break;
// case "submitIcpProgramme"://icp方案提交
// opResult = await this.needsolutionSve.submitIcpProgramme(pobj);
// break;
// case "submitIcpMaterial"://icp材料提交
// opResult = await this.needsolutionSve.submitIcpMaterial(pobj);
// break;
// case "acceptIcpPartnerNotification"://icp通知状态变更
// opResult = await this.needsolutionSve.acceptIcpPartnerNotification(pobj);
// break;
// case "abolishIcpProgramme"://服务商icp方案关闭
// opResult = await this.needsolutionSve.abolishIcpProgramme(pobj);
// break;
// case "getIcpProgrammeDetail"://获取icp方案
// opResult = await this.needsolutionSve.getIcpProgrammeDetail(pobj);
// break;
// case "getNeedSolutionDetailByUser"://获取方案详情
// opResult = await this.needsolutionSve.getNeedSolutionDetailByUser(pobj);
// break;
// case "receiveIcpStatusNotify"://接收渠道方案状态变更通知
// opResult = await this.needsolutionSve.receiveIcpStatusNotify(pobj);
// break;
// case "receiveIcpFeedback"://接收icp用户方案反馈
// opResult = await this.needsolutionSve.receiveIcpFeedback(pobj);
// break;
// case "getIcpProgrammeDetail"://获取方案详情(内部调用)
// opResult = await this.needsolutionSve.getIcpProgrammeDetail(pobj);
// break;
// case "getProgrammeInfoByChannelNeedNo"://获取需求方案列表
// opResult = await this.needsolutionSve.getProgrammeInfoByChannelNeedNo(pobj);
// break;
default:
opResult = system.getResult(null, "action_type参数错误");
break;
......
......@@ -36,9 +36,9 @@ class QcAPI extends APIBase {
case "submitIcpProgramme"://icp方案提交
opResult = await this.aliyunqcSve.submitIcpProgramme(pobj);
break;
case "submitIcpMaterial"://icp材料提交
opResult = await this.aliyunqcSve.submitIcpMaterial(pobj);
break;
// case "submitIcpMaterial"://icp材料提交
// opResult = await this.aliyunqcSve.submitIcpMaterial(pobj);
// break;
case "acceptIcpPartnerNotification"://icp通知状态变更
opResult = await this.aliyunqcSve.acceptIcpPartnerNotification(pobj);
break;
......@@ -51,10 +51,10 @@ class QcAPI extends APIBase {
case "getNeedSolutionDetailByUser"://获取方案详情
opResult = await this.aliyunqcSve.getNeedSolutionDetailByUser(pobj);
break;
case "receiveIcpStatusNotify"://接收渠道方案状态变更通知
case "receiveIcpStatusNotify"://接收渠道方案状态变更通知2.3
opResult = await this.aliyunqcSve.receiveIcpStatusNotify(pobj);
break;
case "receiveIcpFeedback"://接收icp用户方案反馈
case "receiveIcpFeedback"://接收icp用户方案反馈2.2
opResult = await this.aliyunqcSve.receiveIcpFeedback(pobj);
break;
case "getIcpProgrammeDetail"://获取方案详情(内部调用)
......@@ -73,7 +73,12 @@ class QcAPI extends APIBase {
case "closeOrderDelivery"://交付商关闭交付单
opResult = await this.aliyunqcSve.closeOrderDelivery(pobj);
break;
case "abolishIcpProgrammeByNeed"://前端关闭ICP需求及方案
opResult = await this.aliyunqcSve.abolishIcpProgrammeByNeed(pobj);
break;
case "receiveIcpConfirmUrl"://前端关闭ICP需求及方案
opResult = await this.aliyunqcSve.receiveIcpConfirmUrl(pobj);
break;
default:
opResult = system.getResult(null, "action_type参数错误");
break;
......
const system = require("../../../system");
const Dao = require("../../dao.base");
class OrderdeliveryofficialDao extends Dao {
class OrderOfficialDao extends Dao {
constructor() {
super(Dao.getModelName(OrderdeliveryofficialDao));
super(Dao.getModelName(OrderOfficialDao));
}
}
module.exports = OrderdeliveryofficialDao;
module.exports = OrderOfficialDao;
......@@ -2,8 +2,8 @@ const system = require("../../../system");
const settings = require("../../../../config/settings");
const uiconfig = system.getUiConfig2(settings.appKey);
module.exports = (db, DataTypes) => {
return db.define("orderOfficial", {
sourceNo: DataTypes.STRING(128), // 订单号
return db.define("orderofficial", {
serviceNo: DataTypes.STRING(128), // 订单号
channelUserId: DataTypes.STRING(128), // 用户id
officialInfo: DataTypes.JSON // 官文信息
}, {
......@@ -12,7 +12,7 @@ module.exports = (db, DataTypes) => {
version: true,
freezeTableName: true,
timestamps: true,
updatedAt: true,
updated_at: true,
tableName: 'c_delivery_official',
validate: {
......
......@@ -21,6 +21,7 @@ module.exports = (db, DataTypes) => {
},
statusName: DataTypes.STRING(50), //状态名称
createUserId: DataTypes.INTEGER, //创建者id
isInvalid:DataTypes.INTEGER, //是否废弃的无效的方案
}, {
paranoid: true,//假的删除
underscored: true,
......
const system = require("../../../system");
const settings = require("../../../../config/settings");
const uiconfig = system.getUiConfig2(settings.appKey);
const ServiceBase = require("../../sve.base");
const uuidv4 = require('uuid/v4');
class OrderInfoService extends ServiceBase {
constructor() {
......@@ -11,7 +9,7 @@ class OrderInfoService extends ServiceBase {
this.orderproductDao = system.getObject("db.dbcorder.orderproductDao");
this.ordercontactsDao = system.getObject("db.dbcorder.ordercontactsDao");
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();
}
......@@ -180,23 +178,12 @@ class OrderInfoService extends ServiceBase {
const applyUser = actionBody.deliveryData.applyUser;
//复审证据材料
const askForData = actionBody.deliveryData.askForData;
//商标驳回信息
const trademarkRejInfo = actionBody.deliveryData.trademarkRejInfo;
//补充材料
const supData = actionBody.deliveryData.supData;
//申请信息校验
let re1 = await this.checkApply(apply);
if (re1.status != 0) {
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) {
var deliveryStatusName = "待完善材料";
var recDate = "";
......@@ -206,7 +193,6 @@ class OrderInfoService extends ServiceBase {
var recDate = deliveryData.reDate || "";
var askforDate = deliveryData.askforDate || "";
}
pobj.actionBody.deliveryData.deliveryStatusName = deliveryStatusName;
pobj.actionBody.deliveryData.reDate = recDate;
pobj.actionBody.deliveryData.askforDate = askforDate;
......@@ -221,18 +207,25 @@ class OrderInfoService extends ServiceBase {
* @param orderNo
*/
addOrderDelivery(data, orderNo) {
try{
var sql = "INSERT INTO `c_order_delivery` (`sourceOrderNo`,`deliveryContent`) VALUE('" +
orderNo + "','" + JSON.stringify(data) + "')";
this.customQuery(sql);
return system.getResultSuccess();
}catch (e) {
return system.getResultFail();
}
}
/**
* 修改交付信息并推送到交付中心
* 修改交付信息
* @param pobj
* @param actionBody
* @returns {Promise<{msg: *, data: (*|null), status: number}>}
*/
async submitReview(pobj, actionBody) {
try{
var packagingTmResult = await this.packagingTmReDeliveryData(pobj, pobj.actionBody);
if (packagingTmResult.status != 0) {
return packagingTmResult;
......@@ -243,6 +236,9 @@ class OrderInfoService extends ServiceBase {
sql = sql.replace('\n', '');
const result = await this.customUpdate(sql);
return system.getResultSuccess();
}catch (e) {
return system.getResultFail();
}
}
//申请信息校验
......@@ -271,29 +267,6 @@ class OrderInfoService extends ServiceBase {
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
......@@ -325,7 +298,7 @@ class OrderInfoService extends ServiceBase {
}
if(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){
sql += ` and json_extract(deliveryContent,'$.deliveryStatusName')='${actionBody.status}'`;
......@@ -335,8 +308,8 @@ class OrderInfoService extends ServiceBase {
if (actionBody.startTime && actionBody.entTime) {
var startTime = actionBody.startTime.trim() + " 00:00:00";
var endTime = actionBody.entTime + " 23:59:59";
sql += ` and json_extract(deliveryContent,'$.deliveryUpdated') between '${startTime}' and '${endTime}'`;
sqlCount += ` 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 json_extract(deliveryContent,'$.deliveryUpdated') <= '${endTime}'`;
}
sql += ` order by i.id desc LIMIT ${pageSize} OFFSET ${from}`;
......@@ -367,7 +340,7 @@ class OrderInfoService extends ServiceBase {
let pageIndex = Number(actionBody.pageIndex || 1);
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}`
if (pobj.userInfo.channel_userid) {
......@@ -375,8 +348,8 @@ class OrderInfoService extends ServiceBase {
sqlCount += ` and o.channelUserId='${pobj.userInfo.channel_userid}'`;
}
if (actionBody.orderNo) {
sql += ` and serviceNo='${actionBody.orderNo}'`;
sqlCount += ` and serviceNo='${actionBody.orderNo}'`;
sql += ` and o.serviceNo='${actionBody.orderNo}'`;
sqlCount += ` and o.serviceNo='${actionBody.orderNo}'`;
}
if (actionBody.askforId) {
sql += ` and json_extract(officialInfo,'$.askforId')='${actionBody.askforId}'`;
......@@ -392,8 +365,8 @@ class OrderInfoService extends ServiceBase {
}
if (actionBody.startTime && actionBody.entTime) {
var startTime = actionBody.startTime.trim() + " 00:00:00";
var endTime = actionBody.entTime + " 23:59:59";
var startTime = actionBody.startTime.trim();
var endTime = actionBody.entTime;
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}'`;
}
......@@ -421,21 +394,26 @@ class OrderInfoService extends ServiceBase {
if(!actionBody.orderNo){
return system.getResult(null,'orderNo can not be empty');
}
try{
let orderSql = `select channelUserId from c_order_info where orderNo = '${actionBody.orderNo}'`;
let list = await this.customQuery(orderSql);
if (!list || list.length == 0) {
return system.getResult(null, "订单数据为空,30200");
}
let orderItem = list[0];
let officialData = {
let data = {
serviceNo: actionBody.orderNo,
channelUserId:orderItem.channelUserId,
officialInfo: JSON.parse(actionBody.officialData),
officialInfo: actionBody.officialData,
created_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();
}
}
}
......
......@@ -246,7 +246,7 @@ class OrderInfoService extends ServiceBase {
quantity: actionBody.quantity,// 订单数量(即产品的倍数,默认值为1)
opPayType: "00",// 操作付款类型:00: 创建订单, 10: 补单
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 orderReceiptVoucherObj = {
......@@ -525,12 +525,17 @@ class OrderInfoService extends ServiceBase {
return await self.db.transaction(async function (t) {
var orderNo = await self.getBusUid("ot" + pobj.appInfo.uapp_id);
if (pobj.actionBody.channelOrder && pobj.actionBody.channelOrder.channelOrderNo) {
var count = await self.dao.findCount({ where: { channelOrderNo: pobj.actionBody.channelOrder.channelOrderNo } });
if (count > 0) {
return system.getResultFail(-1, "订单不能重复创建s");
}
var rtn = await self.dao.findOne({ channelOrderNo: pobj.actionBody.channelOrder.channelOrderNo }, t);
if (rtn) {
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);
}
return system.getResultSuccess({
orderNo: orderNo,
channelServiceNo: pobj.actionBody.channelOrder.channelServiceNo || orderNo,
......@@ -541,7 +546,7 @@ class OrderInfoService extends ServiceBase {
}
async createH5Order(pobj){
async createH5Order(pobj) {
var self = this;
if (!pobj.actionBody.registerData) {
return system.getResult(null, "注册信息为空");
......@@ -625,8 +630,8 @@ class OrderInfoService extends ServiceBase {
orderStatus: 2
}
var item = await self.createOrder(pobj, orderNo, t);
needsolutioninfo.status = "ywc";
await self.needsolutionDao.update(needsolutioninfo, t);
// needsolutioninfo.status = "ywc";
await self.needsolutionDao.update({ id: needsolutioninfo.id, status: "dqr" }, t);
self.addOrderDelivery(pobj.actionBody.deliveryData, orderNo);
return system.getResultSuccess({
orderNo: orderNo,
......@@ -1086,15 +1091,15 @@ class OrderInfoService extends ServiceBase {
var list = await this.customQuery(sql, paramWhere);
// 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") {
if (list[i]["deliveryContent"]["deliveryStatus"] != "dqrfa" && list[i]["deliveryContent"]["deliveryStatus"] != "fabtg") {
list[i]["isDetail"] = 1;
delete list[i]["deliveryContent"];
continue;
......@@ -1518,16 +1523,16 @@ class OrderInfoService extends ServiceBase {
if (deliveryInfoResult && deliveryInfoResult.status == 0) {
resultParams.delivery_content = deliveryInfoResult.data;
// 2020 0717 lin新增 在回调处增加客户销售分布地区统计
if(deliveryInfoResult.data.apply) {
if(deliveryInfoResult.data.apply.applyAddr) {
if (deliveryInfoResult.data.apply) {
if (deliveryInfoResult.data.apply.applyAddr) {
var applyAddr = deliveryInfoResult.data.apply.applyAddr
// 获取地址数组 该setting数组 与orderRegion province相同
var addArr = settings.addArr();
for(var i = 0;i < addArr.length;i++) {
if(applyAddr.indexOf(addArr[i]) >= 0 ){
for (var i = 0; i < addArr.length; i++) {
if (applyAddr.indexOf(addArr[i]) >= 0) {
var sql = "update c_order_region set count=count+1 where province=:province";
// 修改条件 省名字相同,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 = {
count: sequelize.literal('count+1')
}
......
......@@ -413,7 +413,7 @@ class NeedsolutionService extends ServiceBase {
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();
}
......@@ -474,7 +474,7 @@ class NeedsolutionService extends ServiceBase {
// return system.getResultFail(-102,"状态不能为空");
// }
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) {
return system.getResultFail(-400, "未知方案");
......@@ -493,7 +493,7 @@ class NeedsolutionService extends ServiceBase {
}
await this.dao.update(needsolutioninfo);
var ns = await this.dao.model.findOne({
where: { channelSolutionNo: ab.channelSolutionNo }, raw: true
where: { id: needsolutioninfo.id }, raw: true
});
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