Commit f2d91310 by 王栋源

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

parents 363efa33 288118de
var APIBase = require("../../api.base");
var system = require("../../../system");
var settings = require("../../../../config/settings");
class IcpAPI extends APIBase {
constructor() {
super();
// this.utilsProductSve = system.getObject("service.utilsSve.utilsProductSve");
this.needsolutionSve = system.getObject("service.dbneed.needsolutionSve");
this.needinfoSve = system.getObject("service.dbneed.needinfoSve");
this.orderinfoSve = system.getObject("service.dbcorder.orderinfoSve");
}
/**
* 接口跳转-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 "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 "updateStausByRefundOrder"://修改退款方案状态
// opResult = await this.needsolutionSve.updateStausByRefundOrder(pobj);
// break;
default:
opResult = system.getResult(null, "action_type参数错误");
break;
}
return opResult;
}
}
module.exports = IcpAPI;
\ No newline at end of file
......@@ -60,6 +60,9 @@ class OrderAPI extends APIBase {
opResult = await this.orderinfoSve.putReceiptVoucherInfo(pobj, pobj.actionBody);
break;
//--------------------------------支付相关接口------------结束
case "tmConfirm"://商标方案确认
opResult = await this.orderinfoSve.tmConfirm(pobj);
break;
default:
opResult = system.getResult(null, "action_type参数错误");
break;
......
......@@ -6,9 +6,18 @@ class InternalCallsNotify extends APIBase {
constructor() {
super();
this.orderinfoSve = system.getObject("service.dbcorder.orderinfoSve");
this.internalCallsNotifySve = system.getObject("service.dbcorder.internalCallsNotifySve");
}
async updateTmStatus(pobj, qobj, req) {
return await this.orderinfoSve.updateTmStatus(pobj);
}
//接收辅助、担保商标注册信息
async nbtzreceiveAssistTmData(pobj, qobj, req) {
return await this.internalCallsNotifySve.receiveAssistTmData(pobj);
}
//接收辅助、担保商标注册修改信息
async nbtzreceiveEditAssistTmData(pobj, qobj, req) {
return await this.internalCallsNotifySve.receiveEditAssistTmData(pobj);
}
}
module.exports = InternalCallsNotify;
\ No newline at end of file
......@@ -11,5 +11,9 @@ class OpPayOrder extends APIBase {
var result = await this.orderinfoSve.opOrderPayCallBackTl(pobj, pobj.appInfo);
return result;
}
async receivePayCallBackNotifyByAliDing(pobj, qobj, req) {
var result = await this.orderinfoSve.opOrderPayCallBackAliDing(pobj, pobj.appInfo);
return result;
}
}
module.exports = OpPayOrder;
\ No newline at end of file
......@@ -22,7 +22,8 @@ class OrderProductDao extends Dao {
"payAfterJumpPcUrl",
"picUrl",
"price",
"quantity"],
"quantity",
"serviceItemSnapshot"],
raw: true
});
}
......
......@@ -28,7 +28,7 @@ module.exports = {
//订单类型
"order_type": { "zzdd": "自主订单", "dkxd": "代客下单" },
//订单付款状态
"order_status": { 1: "待付款", 2: "已付款", 4: "服务中", 8: "已完成", 16: "待推送", 32: "已退款", 64: "已作废" },
"order_status": { 1: "待付款", 2: "已付款", 4: "服务中", 8: "已完成", 16: "已退款", 32: "已作废" },
//帐户类型( 支付类型)
"pay_account_type": { "cash": "现金", "bank": "银行", "wx": "微信", "alipay": "支付宝", "other": "其它" },
//订单服务付款状态
......@@ -69,10 +69,10 @@ module.exports = {
//凭单类型
"direction_type": { "sr": "收", "zc": "支" },
"push_return_type": { "0": "推送失败", "1": "推送成功" },
"push_chance_type": { "wts": "未推送", "yts": "已推送", "ygj": "已跟进", "ycd": "已成单","ygb" :"已关闭"},
"policy_type":{'fzbt':'租金减免','jrdk':'金融贷款','zdfc':'行政措施','ssjm':'税收优惠','rlzy':'人力资源'},
"customer_intention":{"dgj":"待跟进","yyx":"有意向","wyx":"无意向"},
"solution_status":{"dqr":"待确认","ywc":"已完成","yzf":"已作废"},
"push_chance_type": { "wts": "未推送", "yts": "已推送", "ygj": "已跟进", "ycd": "已成单", "ygb": "已关闭" },
"policy_type": { 'fzbt': '租金减免', 'jrdk': '金融贷款', 'zdfc': '行政措施', 'ssjm': '税收优惠', 'rlzy': '人力资源' },
"customer_intention": { "dgj": "待跟进", "yyx": "有意向", "wyx": "无意向" },
"solution_status": { "dqr": "待确认", "ywc": "已完成", "yzf": "已作废" },
},
}
......
......@@ -22,7 +22,7 @@ module.exports = (db, DataTypes) => {
this.setDataValue("orderStatus", val);
this.setDataValue("orderStatusName", uiconfig.config.pdict.order_status[val]);
}
},// 订单状态: 1: 待付款, 2: 已付款,4: 服务中, 8: 已完成, 16: 待推送, 32: 已退款, 64: 已作废
},// 订单状态: 1: 待付款, 2: 已付款, 4: 服务中, 8: 已完成, 16: 已退款, 32: 已作废
totalSum :DataTypes.DECIMAL(12, 2),// 订单总额(产品价格×优惠费率×订单件数)
payTotalSum :DataTypes.DECIMAL(12, 2),// 订单付款总额
refundSum :DataTypes.DECIMAL(12, 2),// 退款金额
......@@ -36,6 +36,7 @@ module.exports = (db, DataTypes) => {
invoiceApplyStatus :DataTypes.STRING(10),// 发票状态:00: 未申请, 10: 已申请,20:已开票
opNotes :DataTypes.STRING,// 备注
notes :DataTypes.STRING,// 备注
isSolution :DataTypes.INTEGER,// 是否有方案,0无,1有
}, {
paranoid: true,//假的删除
underscored: true,
......
const system = require("../../../system");
const uuidv4 = require('uuid/v4');
//内部通知调用
class InternalCallsNotifyService {
constructor() {
this.orderinfoDao = system.getObject("db.dbcorder.orderinfoDao");
this.delivery_status={
"dqrfa": "待确认方案",
"fabtg": "方案不通过",
"dfwsfw": "待服务",
"dsccl": "待上传材料",
"dsh": "待审核",
"ddj": "待递交",
"ydj": "已递交",
"ywc": "已完成"
};
this.statusContrast={
"WAITCONFIRM":{name:"待确认方案",value:"dqrfa"},
"CONFIRMFAIL":{name:"方案不通过",value:"fabtg"},
"READY":{name:"待上传材料",value:"dsccl"},
"WAITCOMMIT":{name:"待递交",value:"ddj"},
"WAITARTIFICIALEXAMINE":{name:"待审核",value:"dsh"},
"DOCFINISH": {name:"待审核",value:"dsh"},
"AWAITCHECK": {name:"待审核",value:"dsh"},
"COMMITED": {name:"已递交",value:"ydj"},
"ROBOT": {name:"已递交",value:"ydj"},
"ROBOTPAY": {name:"已递交",value:"ydj"},
"RECVCOMMIT": {name:"已递交",value:"ydj"},
};
}
//接收辅助、担保商标注册信息
async receiveAssistTmData(pobj){
var checkRes = await this.checkParams(pobj);
if(checkRes.status==0){
var deliveryData = await this.packagingTmDeliveryData(pobj,null);
//获取交付信息
var orderdeliveryRes = await this.getOrderDelivery(pobj.sourceOrderNo,pobj.serviceNo);
if(orderdeliveryRes && orderdeliveryRes.length>0){
return system.getResult(null,"保存商标订单交付信息失败,存在重复交付信息,不能重复提交,10300");
}
this.addOrderDelivery(deliveryData,deliveryData.sourceOrderNo);
await this.orderinfoDao.model.update({isSolution:1}, { where: { orderNo: pobj.sourceOrderNo }});
return system.getResultSuccess();
}else{
return checkRes;
}
}
//接收辅助、担保商标注册修改信息
async receiveEditAssistTmData(pobj){
var checkRes = await this.checkParams(pobj);
if(checkRes.status==0){
//获取交付信息
var orderdeliveryRes = await this.getOrderDelivery(pobj.sourceOrderNo,pobj.serviceNo);
if(!orderdeliveryRes || orderdeliveryRes.length<1){
return system.getResult(null,"未知交付信息,10150");
}
var orderdelivery = orderdeliveryRes[0];
var deliveryData = await this.packagingTmDeliveryData(pobj,orderdelivery.deliveryContent);
this.putOrderDelivery(deliveryData,deliveryData.sourceOrderNo,deliveryData.serviceNo);
await this.orderinfoDao.model.update({isSolution:1}, { where: { orderNo: pobj.sourceOrderNo }});
return system.getResultSuccess();
}else{
return checkRes;
}
}
//-----------------------------------------------------------------------------------------------------
async checkParams(pobj){//参数校验
if (!pobj.serviceNo) {
return system.getResult(null, "业务单号不能为空不能为空,10100");
}
if (!pobj.sourceOrderNo) {
return system.getResult(null, "来源单号不能为空,10110");
}
var orderinfo = await this.orderinfoDao.model.findOne({
where:{orderNo:pobj.sourceOrderNo},raw:true
});
if(!orderinfo || !orderinfo.id){
return system.getResult(null, "未知订单,10120");
}
if (!pobj.tm) {
return system.getResult(null, "商标信息不能为空,10130");
}
if (!pobj.nclones) {
return system.getResult(null, "商品/服务项不能为空,10140");
}
if (!pobj.tm) {
return system.getResult(null, "商标信息不能为空,10150");
}
if (!pobj.tm.tmFormType) {
return system.getResult(null, "商标类型不能为空,10160");
}
if (pobj.tm.tmFormType == "4") {
pobj.tm.tmName = "图形";
}
if (!pobj.tm.tmName) {
return system.getResult(null, "商标名称不能为空,10170");
}
if (!pobj.tm.picUrl) {
return system.getResult(null, "商标图样不能为空,10180");
}
if (!pobj.apply) {
return system.getResult(null, "申请信息不能为空,10190");
}
if (!pobj.apply.code) {
return system.getResult(null, "申请统一社会信用代码不能为空,10200");
}
if (!pobj.apply.zipCode) {
return system.getResult(null, "申请邮编不能为空,10210");
}
if (!pobj.apply.customerType) {
return system.getResult(null, "申请人类型不能为空,10220");
}
if (pobj.apply.customerType != "ent" && pobj.apply.customerType != "person") {
return system.getResult(null, "申请人类型错误,10230");
}
if (!pobj.orderContact) {
return system.getResult(null, "联系人信息不能为空,10240");
}
if (!pobj.orderContact.contactName) {
return system.getResult(null, "联系人姓名不能为空,10250");
}
if (!pobj.orderContact.mobile) {
return system.getResult(null, "联系人手机号不能为空,10260");
}
return system.getResultSuccess(pobj);
}
async packagingTmDeliveryData(pobj,deliveryData) {//重新组装商标交付信息
var deliveryStatusList = [];
if(deliveryData && deliveryData.deliveryStatusList){
deliveryStatusList = deliveryData.deliveryStatusList;
}
var nclOne = pobj.nclones[0];
if(nclOne.tmStatus){
var deliveryStatusObj = this.statusContrast[nclOne.tmStatus];
if(deliveryStatusObj && deliveryStatusObj.value){
var deliveryStatus = deliveryStatusObj.value;
var deliveryStatusName = deliveryStatusObj.name;
deliveryStatusList.push({
deliveryStatus: deliveryStatus,
deliveryStatusName: deliveryStatusName,
deliveryUpdated: new Date()
});
pobj.deliveryStatus = deliveryStatus;
pobj.deliveryStatusName = deliveryStatusName;
}else{
deliveryStatusList.push({
deliveryStatus: nclOne.tmStatus,
deliveryStatusName: nclOne.tmStatus,
deliveryUpdated: new Date()
});
}
}
pobj.deliveryStatusList = deliveryStatusList;
pobj.opNotes = ""; //操作备注
return pobj;
}
putOrderDelivery(data, orderNo, channelOrderNo) {//修改交付信息
var sql = "UPDATE `c_order_delivery` SET deliveryContent ='" + JSON.stringify(data) + "' where sourceOrderNo='" + orderNo + "'";
sql = sql + " and deliveryContent->'$.serviceNo' = '"+channelOrderNo+"'";
this.orderinfoDao.customUpdate(sql);
}
addOrderDelivery(data, orderNo) {//新增交付信息
var sql = "INSERT INTO `c_order_delivery` (`sourceOrderNo`,`deliveryContent`) VALUE('" +
orderNo + "','" + JSON.stringify(data) + "')";
this.orderinfoDao.customQuery(sql);
}
async getOrderDelivery(orderNo,channelOrderNo) {//查询交付信息
var sql = "select * from `c_order_delivery` where sourceOrderNo='" + orderNo + "'";
sql = sql + " and deliveryContent->'$.serviceNo' = '"+channelOrderNo+"'";
return await this.orderinfoDao.customQuery(sql);
}
//----------------------------------------------------------------------------------------------------------
}
module.exports = InternalCallsNotifyService;
\ No newline at end of file
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