Commit 91793771 by 兰国旗

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

parents 67b5742f e1efe0c6
...@@ -115,6 +115,9 @@ class OrderAPI extends APIBase { ...@@ -115,6 +115,9 @@ class OrderAPI extends APIBase {
case "receiveAliTmOrder"://接收阿里商标订单 case "receiveAliTmOrder"://接收阿里商标订单
opResult = await this.orderinfoSve.receiveAliTmOrder(pobj); opResult = await this.orderinfoSve.receiveAliTmOrder(pobj);
break; break;
case "receiveAliTmStatus"://接收阿里商标状态
opResult = await this.orderinfoSve.receiveAliTmStatus(pobj);
break;
case "receiveAliTmOrderRefund"://接收阿里商标订单退款信息 case "receiveAliTmOrderRefund"://接收阿里商标订单退款信息
opResult = await this.orderinfoSve.receiveAliTmOrderRefund(pobj); opResult = await this.orderinfoSve.receiveAliTmOrderRefund(pobj);
break; break;
......
...@@ -1298,22 +1298,22 @@ class OrderInfoService extends ServiceBase { ...@@ -1298,22 +1298,22 @@ class OrderInfoService extends ServiceBase {
*/ */
async getOrdersStatisticsByUappId(pobj) { async getOrdersStatisticsByUappId(pobj) {
let ac = pobj.actionBody; let ac = pobj.actionBody;
let sql = `SELECT uapp_id,count(*) count,DATE_FORMAT(created_at,'%Y-%m-%d') time FROM c_order_info WHERE deleted_at is null `; let sql = `SELECT a.uapp_id,count(*) count,DATE_FORMAT(a.created_at,'%Y-%m-%d') time FROM c_order_info a INNER JOIN c_order_product b ON a.orderNo = b.sourceOrderNo WHERE a.deleted_at is null `;
let whereParam = {}; let whereParam = {};
if (ac.start && ac.end) { if (ac.start && ac.end) {
sql += ` AND created_at >= :start AND created_at <= :end`; sql += ` AND a.created_at >= :start AND a.created_at <= :end`;
whereParam.start = ac.start; whereParam.start = ac.start;
whereParam.end = ac.end; whereParam.end = ac.end;
} }
if (ac.type_code) { if(ac.pathName){
sql += ` AND typeCode = :type_code`; sql += ` AND b.pathName = :pathName`;
whereParam.type_code = ac.type_code; whereParam.pathName = ac.pathName;
} }
if (ac.status) { if (ac.status) {
sql += ` AND orderStatus = :status`; sql += ` AND orderStatus = :status`;
whereParam.status = ac.status; whereParam.status = ac.status;
} }
sql += ` GROUP BY uapp_id,DATE_FORMAT(created_at,'%Y-%m-%d') ORDER BY created_at ASC` sql += ` GROUP BY a.uapp_id,DATE_FORMAT(a.created_at,'%Y-%m-%d') ORDER BY a.created_at ASC`
let result = await this.customQuery(sql, whereParam); let result = await this.customQuery(sql, whereParam);
return system.getResultSuccess(result); return system.getResultSuccess(result);
} }
...@@ -1325,14 +1325,14 @@ class OrderInfoService extends ServiceBase { ...@@ -1325,14 +1325,14 @@ class OrderInfoService extends ServiceBase {
*/ */
async getOrdersStatisticsByProduct(pobj) { async getOrdersStatisticsByProduct(pobj) {
let ac = pobj.actionBody; let ac = pobj.actionBody;
let sql = `SELECT b.channelItemName typeCode,a.uapp_id,count( DISTINCT(a.orderNo)) count FROM c_order_info a left join c_order_product b on a.orderNo = b.sourceOrderNo WHERE a.deleted_at is null and b.itemCode is not null `; let sql = `SELECT b.pathName,a.uapp_id,count( DISTINCT(a.orderNo)) count FROM c_order_info a left join c_order_product b on a.orderNo = b.sourceOrderNo WHERE a.deleted_at is null and b.pathName is not null `;
let whereParams = {}; let whereParams = {};
if (ac.start && ac.end) { if (ac.start && ac.end) {
sql += ` and a.created_at >= :start and a.created_at <= :end `; sql += ` and a.created_at >= :start and a.created_at <= :end `;
whereParams.start = ac.start; whereParams.start = ac.start;
whereParams.end = ac.end; whereParams.end = ac.end;
} }
sql += ` GROUP BY b.channelItemName,a.uapp_id`; sql += ` GROUP BY b.pathName,a.uapp_id`;
let result = await this.customQuery(sql, whereParams); let result = await this.customQuery(sql, whereParams);
return system.getResultSuccess(result); return system.getResultSuccess(result);
} }
...@@ -1355,9 +1355,9 @@ class OrderInfoService extends ServiceBase { ...@@ -1355,9 +1355,9 @@ class OrderInfoService extends ServiceBase {
sql1 += ` and a.uapp_id = :uapp_id`; sql1 += ` and a.uapp_id = :uapp_id`;
whereParams.uapp_id = ab.uapp_id; whereParams.uapp_id = ab.uapp_id;
} }
if (ab.type_code) { if (ab.pathName) {
sql1 += ` and b.itemCode = :type_code`; sql1 += ` and b.pathName = :pathName`;
whereParams.type_code = ab.type_code; whereParams.pathName = ab.pathName;
} }
let totalRet1 = await this.customQuery(sql1, whereParams); let totalRet1 = await this.customQuery(sql1, whereParams);
if (ab.startLast && ab.endLast) { if (ab.startLast && ab.endLast) {
...@@ -1394,9 +1394,10 @@ class OrderInfoService extends ServiceBase { ...@@ -1394,9 +1394,10 @@ class OrderInfoService extends ServiceBase {
a.id, a.id,
a.channelOrderNo, a.channelOrderNo,
d.app_name, d.app_name,
b.itemName, b.pathName,
a.totalSum, a.totalSum,
a.orderStatusName, a.orderStatusName,
a.notes,
c.contactName, c.contactName,
c.mobile, c.mobile,
a.isPushNum, a.isPushNum,
...@@ -1427,10 +1428,10 @@ class OrderInfoService extends ServiceBase { ...@@ -1427,10 +1428,10 @@ class OrderInfoService extends ServiceBase {
totalSql += ` and a.orderStatus = :status`; totalSql += ` and a.orderStatus = :status`;
whereParams.status = ab.status; whereParams.status = ab.status;
} }
if (ab.type_code) { if (ab.pathName) {
listSql += ` and b.itemCode = :type_code`; listSql += ` and b.pathName = :pathName`;
totalSql += ` and b.itemCode = :type_code`; totalSql += ` and b.pathName = :pathName`;
whereParams.type_code = ab.type_code; whereParams.pathName = ab.pathName;
} }
if (ab.fuzzy_code) { if (ab.fuzzy_code) {
listSql += ` and ( a.orderNo like :fuzzy_code or a.channelOrderNo like :fuzzy_code or c.mobile like :fuzzy_code)`; listSql += ` and ( a.orderNo like :fuzzy_code or a.channelOrderNo like :fuzzy_code or c.mobile like :fuzzy_code)`;
...@@ -2290,22 +2291,17 @@ class OrderInfoService extends ServiceBase { ...@@ -2290,22 +2291,17 @@ class OrderInfoService extends ServiceBase {
const tx_product = platformConfig.config.pdict.tx_product; const tx_product = platformConfig.config.pdict.tx_product;
let arr = pobj.actionBody.ordersArr; let arr = pobj.actionBody.ordersArr;
let uapp_id = pobj.actionBody.uapp_id; let uapp_id = pobj.actionBody.uapp_id;
/*{
number:"N202102251259eaduJjc",需求号 || 订单号
status:"待处理,提交方案,已成单等" //单子状态
companyName:"公司名称",//公司名称
createdAt:"2021-02-25 10:30:11",创建时间
area:"扬州",//区域
productType:"公司注册",//产品名称
personName:"联系人",
personMobile:"联系人电话",
price:"8.80" //价格 ps: 订单会有这个字段
}*/
let sql = 'select channelOrderNo from c_order_info where uapp_id = :uapp_id'; let sql = 'select channelOrderNo from c_order_info where uapp_id = :uapp_id';
let whereParam = { let whereParam = {
uapp_id: uapp_id uapp_id: uapp_id
} }
let ret = await this.customQuery(sql, whereParam); let ret = await this.customQuery(sql, whereParam);
let productSql = `select path_name,item_name from center_app.p_product where uapp_id = 53`;
let rtn = await this.customQuery(productSql);
let dict = {};
rtn.forEach(item =>{
dict[item.item_name] = item.path_name;
})
let existIds = ret.map(item => { let existIds = ret.map(item => {
return item.channelOrderNo; return item.channelOrderNo;
}) })
...@@ -2364,7 +2360,9 @@ class OrderInfoService extends ServiceBase { ...@@ -2364,7 +2360,9 @@ class OrderInfoService extends ServiceBase {
price: order.price,//定价 price: order.price,//定价
quantity: 1,// 订单数量(即产品的倍数,默认值为1) quantity: 1,// 订单数量(即产品的倍数,默认值为1)
opPayType: "10",// 操作付款类型:00: 创建订单, 10: 补单 opPayType: "10",// 操作付款类型:00: 创建订单, 10: 补单
created_at: order.createdAt created_at: order.createdAt,
pathName:dict[order.productType],
pathCode: tx_product[order.productType]
}; };
productsArr.push(orderProductObj); productsArr.push(orderProductObj);
} }
...@@ -2613,7 +2611,7 @@ class OrderInfoService extends ServiceBase { ...@@ -2613,7 +2611,7 @@ class OrderInfoService extends ServiceBase {
ab.channelNeedNo = ab.needNo; ab.channelNeedNo = ab.needNo;
ab.channelUserId = userInfo.channel_userid; ab.channelUserId = userInfo.channel_userid;
ab.ownerUserId = userInfo.channel_userid; ab.ownerUserId = userInfo.channel_userid;
ab.payTime = ab.payTime; ab.payTime = ab.payTime || new Date();
ab.orderStatus = 2; ab.orderStatus = 2;
ab.totalSum = ab.price; ab.totalSum = ab.price;
ab.payTotalSum = ab.price; ab.payTotalSum = ab.price;
...@@ -2646,12 +2644,50 @@ class OrderInfoService extends ServiceBase { ...@@ -2646,12 +2644,50 @@ class OrderInfoService extends ServiceBase {
} }
orderInfo.refundSum = pobj.actionBody.refundSum || orderInfo.payTotalSum; orderInfo.refundSum = pobj.actionBody.refundSum || orderInfo.payTotalSum;
orderInfo.orderStatus = 16; orderInfo.orderStatus = 16;
orderInfo.refundTime = pobj.actionBody.refundTime; orderInfo.refundTime = pobj.actionBody.refundTime || new Date();
await this.dao.update(orderInfo); await this.dao.update(orderInfo);
return system.getResultSuccess(); return system.getResultSuccess();
} }
/**
* 接收阿里商标状态信息
* @param {*} pobj
*/
async receiveAliTmStatus(pobj) {
if (!pobj || !pobj.actionBody) {
return system.getResult(null, "订单参数不能为空,100100");
}
if (!pobj.appInfo) {
return system.getResult(null, "未知用应信息,100200");
}
if (!pobj.userInfo) {
return system.getResult(null, "未知用户信息,100300");
}
if (!pobj.actionBody.channelOrderNo) {
return system.getResult(null, "阿里订单号不能为空,100110");
}
if (!pobj.actionBody.orderStatus) {
return system.getResult(null, "订单状态不能为空,100110");
}
var orderInfo = await this.dao.model.findOne({
attributes: ["id", "channelOrderNo"],
where: {channelOrderNo: pobj.actionBody.channelOrderNo, uapp_id: pobj.appInfo.uapp_id}, raw: true
});
if (!orderInfo || !orderInfo.id) {
return system.getResult(null, "阿里订单号:" + pobj.actionBody.channelOrderNo + "的订单不存在,100140");
}
if(pobj.actionBody.orderStatus == 8){//已完成
orderInfo.orderStatus = 8;
await this.dao.update(orderInfo);
return system.getResultSuccess();
}else{
return system.getResult(null, "订单状态有误");
}
}
/*** /***
* 处理渠道退款 * 处理渠道退款
* @param pobj * @param pobj
......
...@@ -392,7 +392,7 @@ class NeedsolutionService extends ServiceBase { ...@@ -392,7 +392,7 @@ class NeedsolutionService extends ServiceBase {
return system.getResultFail(-105, "该方案需求状态为" + needinfo.statusName + ",不能执行此操作"); return system.getResultFail(-105, "该方案需求状态为" + needinfo.statusName + ",不能执行此操作");
} }
if (ns.status != "dqr") { if (ns.status != "dqr") {
return system.getResultFail(-103, "方案状态错误,只能废弃待确认方案"); return system.getResultFail(-103, "方案状态错误,只能废弃待确认方案-1");
} }
await this.dao.update({ id: ns.id, status: "yzf" });//方案废弃 await this.dao.update({ id: ns.id, status: "yzf" });//方案废弃
//获取方案信息 //获取方案信息
...@@ -428,7 +428,7 @@ class NeedsolutionService extends ServiceBase { ...@@ -428,7 +428,7 @@ class NeedsolutionService extends ServiceBase {
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 == "ywc") { if (fa.status == "ywc") {
return system.getResultFail(-103, "方案状态错误,不能废弃已完成方案"); return system.getResultFail(-103, "方案状态错误,不能废弃已完成方案-1");
} }
} }
await this.dao.model.update({ status: "yzf",isInvalid:1 }, { where: { needNo: needinfo.needNo } });//方案废弃 await this.dao.model.update({ status: "yzf",isInvalid:1 }, { where: { needNo: needinfo.needNo } });//方案废弃
...@@ -990,7 +990,7 @@ class NeedsolutionService extends ServiceBase { ...@@ -990,7 +990,7 @@ class NeedsolutionService extends ServiceBase {
return system.getResultFail(-105, "该方案需求状态为" + needinfo.statusName + ",不能执行此操作"); return system.getResultFail(-105, "该方案需求状态为" + needinfo.statusName + ",不能执行此操作");
} }
if (ns.status != "dqr") { if (ns.status != "dqr") {
return system.getResultFail(-103, "方案状态错误,只能废弃待确认方案"); return system.getResultFail(-103, "方案状态错误,只能废弃待确认方案-2");
} }
var solutionContent = ns.solutionContent; var solutionContent = ns.solutionContent;
if (!solutionContent.status || ["USER_UPLOADED", "MATERIAL_UNCONFIRM", "USER_CONFIRMED", "ACCOUNT_REGISTERED", "MATERIAL_SUBMITTED"].indexOf(solutionContent.status) < 0) { if (!solutionContent.status || ["USER_UPLOADED", "MATERIAL_UNCONFIRM", "USER_CONFIRMED", "ACCOUNT_REGISTERED", "MATERIAL_SUBMITTED"].indexOf(solutionContent.status) < 0) {
...@@ -1035,7 +1035,7 @@ class NeedsolutionService extends ServiceBase { ...@@ -1035,7 +1035,7 @@ class NeedsolutionService extends ServiceBase {
return system.getResultFail(-105, "该方案需求状态为" + needinfo.statusName + ",不能执行此操作"); return system.getResultFail(-105, "该方案需求状态为" + needinfo.statusName + ",不能执行此操作");
} }
if (ns.status != "dqr" && ns.status != "yzf") { if (ns.status != "dqr" && ns.status != "yzf") {
return system.getResultFail(-103, "方案状态错误,不能作废已完成方案"); return system.getResultFail(-103, "方案状态错误,不能作废已完成方案-1");
} }
var solutionContent = ns.solutionContent; var solutionContent = ns.solutionContent;
//方案流程列表 //方案流程列表
......
...@@ -97,7 +97,7 @@ class AliyunQcService { ...@@ -97,7 +97,7 @@ class AliyunQcService {
}); });
if (ns && ns.id) { if (ns && ns.id) {
if (ns.status == "ywc") { if (ns.status == "ywc") {
return system.getResultFail(-103, "方案状态错误,不能废弃已完成方案"); return system.getResultFail(-103, "方案状态错误,不能废弃已完成方案-3");
} }
var flowStatus = ns.solutionContent && ns.solutionContent.status ? ns.solutionContent.status : ""; var flowStatus = ns.solutionContent && ns.solutionContent.status ? ns.solutionContent.status : "";
if (flowStatus && ["GXB_REFUSE", "CLOSE"].indexOf(flowStatus) < 0) { if (flowStatus && ["GXB_REFUSE", "CLOSE"].indexOf(flowStatus) < 0) {
...@@ -370,7 +370,7 @@ class AliyunQcService { ...@@ -370,7 +370,7 @@ class AliyunQcService {
// } // }
var solutionContent = ns.solutionContent; var solutionContent = ns.solutionContent;
if (!solutionContent.status || ["USER_UPLOADED", "MATERIAL_UNCONFIRM", "USER_CONFIRMED", "ACCOUNT_REGISTERED", "MATERIAL_SUBMITTED"].indexOf(solutionContent.status) < 0) { if (!solutionContent.status || ["USER_UPLOADED", "MATERIAL_UNCONFIRM", "USER_CONFIRMED", "ACCOUNT_REGISTERED", "MATERIAL_SUBMITTED"].indexOf(solutionContent.status) < 0) {
return system.getResultFail(-302, "方案流程状态错误,不能执行此操作"); return system.getResultFail(-302, "方案流程状态错误,不能执行此操作-1");
} }
solutionContent.serviceProviderNote = ab.Note; solutionContent.serviceProviderNote = ab.Note;
var solutionFlowList = solutionContent.solutionFlowList || []; var solutionFlowList = solutionContent.solutionFlowList || [];
...@@ -717,7 +717,7 @@ class AliyunQcService { ...@@ -717,7 +717,7 @@ class AliyunQcService {
}); });
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") {//⽤户已确认 } else if (ab.status == "4") {//⽤户已确认,3为资料未确认(暂时不用做处理)
if (solutionContent.status != "MATERIAL_UNCONFIRM") { if (solutionContent.status != "MATERIAL_UNCONFIRM") {
return system.getResultFail(-113, "操作失败,服务商递交⽂件后才能执行此操作"); return system.getResultFail(-113, "操作失败,服务商递交⽂件后才能执行此操作");
} }
...@@ -733,7 +733,7 @@ class AliyunQcService { ...@@ -733,7 +733,7 @@ class AliyunQcService {
solutionContent.status = "CLOSE"; solutionContent.status = "CLOSE";
solutionContent.statusName = this.icpSolutionStatusReference.CLOSE; solutionContent.statusName = this.icpSolutionStatusReference.CLOSE;
} else { } else {
return system.getResultFail(-110, "状态错误"); return system.getResultFail(-110, "状态错误-2");
} }
solutionContent.solutionFlowList = solutionFlowList; solutionContent.solutionFlowList = solutionFlowList;
...@@ -1078,7 +1078,7 @@ class AliyunQcService { ...@@ -1078,7 +1078,7 @@ class AliyunQcService {
solutionContent.status = "ABC_CLOSE_PRODUCE"; solutionContent.status = "ABC_CLOSE_PRODUCE";
solutionContent.statusName = this.ediSolutionStatusReference.ABC_CLOSE_PRODUCE; solutionContent.statusName = this.ediSolutionStatusReference.ABC_CLOSE_PRODUCE;
} else { } else {
return system.getResultFail(-110, "状态错误"); return system.getResultFail(-110, "状态错误-3");
} }
solutionContent.solutionFlowList = solutionFlowList; solutionContent.solutionFlowList = solutionFlowList;
......
...@@ -152,7 +152,7 @@ class BaiduQcService { ...@@ -152,7 +152,7 @@ class BaiduQcService {
solutionContent.status = "CLOSE"; solutionContent.status = "CLOSE";
solutionContent.statusName = this.icpSolutionStatusReference.CLOSE; solutionContent.statusName = this.icpSolutionStatusReference.CLOSE;
} else { } else {
return system.getResultFail(-110, "状态错误"); return system.getResultFail(-110, "状态错误-4");
} }
solutionContent.solutionFlowList = solutionFlowList; solutionContent.solutionFlowList = solutionFlowList;
......
...@@ -85,7 +85,7 @@ class BaseQcService { ...@@ -85,7 +85,7 @@ class BaseQcService {
if (ns && ns.id) { if (ns && ns.id) {
if (ns.status == "ywc") { if (ns.status == "ywc") {
return system.getResultFail(-103, "方案状态错误,不能废弃已完成方案"); return system.getResultFail(-103, "方案状态错误,不能废弃已完成方案-2");
} }
var flowStatus = ns.solutionContent && ns.solutionContent.status ? ns.solutionContent.status : ""; var flowStatus = ns.solutionContent && ns.solutionContent.status ? ns.solutionContent.status : "";
if (flowStatus && [ if (flowStatus && [
...@@ -1130,7 +1130,7 @@ class BaseQcService { ...@@ -1130,7 +1130,7 @@ class BaseQcService {
solutionContent.status = "ABC_CLOSE_PRODUCE"; solutionContent.status = "ABC_CLOSE_PRODUCE";
solutionContent.statusName = this.ediSolutionStatusReference.ABC_CLOSE_PRODUCE; solutionContent.statusName = this.ediSolutionStatusReference.ABC_CLOSE_PRODUCE;
} else { } else {
return system.getResultFail(-110, "状态错误"); return system.getResultFail(-110, "状态错误-1");
} }
solutionContent.solutionFlowList = solutionFlowList; solutionContent.solutionFlowList = solutionFlowList;
......
...@@ -576,7 +576,7 @@ class NcService { ...@@ -576,7 +576,7 @@ class NcService {
// var newFlowStatus = []; // var newFlowStatus = [];
if (ns && ns.id) { if (ns && ns.id) {
if (ns.status == "ywc") { if (ns.status == "ywc") {
return system.getResultFail(-103, "方案状态错误,不能废弃已完成方案"); return system.getResultFail(-103, "方案状态错误,不能废弃已完成方案-4");
} }
var flowStatus = ns.solutionContent && ns.solutionContent.status ? ns.solutionContent.status : ""; var flowStatus = ns.solutionContent && ns.solutionContent.status ? ns.solutionContent.status : "";
if (flowStatus && ["NOT_ACCEPTED","CLOSE"].indexOf(flowStatus) < 0) { if (flowStatus && ["NOT_ACCEPTED","CLOSE"].indexOf(flowStatus) < 0) {
......
...@@ -338,7 +338,7 @@ class RegCenterOrderService{ ...@@ -338,7 +338,7 @@ class RegCenterOrderService{
solutionContent.status = "CLOSE"; solutionContent.status = "CLOSE";
solutionContent.statusName = this.regSolutionStatus.CLOSE; solutionContent.statusName = this.regSolutionStatus.CLOSE;
} else { } else {
return system.getResultFail(-110, "状态错误"); return system.getResultFail(-110, "状态错误-5");
} }
solutionContent.solutionFlowList = solutionFlowList; solutionContent.solutionFlowList = solutionFlowList;
......
var settings={ var settings={
redis:{ redis:{
host: "39.107.234.14", host: "59.110.125.77",
port: 6379, port: 30479,
password: "123123", password: "havzMSYc3aBZXOjpG3",
db:9, db: 5,
}, },
database:{ database:{
dbname : "center_order", dbname : "center_order",
......
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