Commit 777398b1 by linboxuan

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

parents 9ab878d1 95d26173
...@@ -5,6 +5,7 @@ class OrderAPI extends APIBase { ...@@ -5,6 +5,7 @@ class OrderAPI extends APIBase {
constructor() { constructor() {
super(); super();
this.orderinfoSve = system.getObject("service.dbcorder.orderinfoSve"); this.orderinfoSve = system.getObject("service.dbcorder.orderinfoSve");
this.usuallycontactsSve = system.getObject("service.dbcorder.usuallycontactsSve");
} }
/** /**
* 接口跳转-POST请求 * 接口跳转-POST请求
...@@ -33,6 +34,18 @@ class OrderAPI extends APIBase { ...@@ -33,6 +34,18 @@ class OrderAPI extends APIBase {
case "getAllNcl": case "getAllNcl":
opResult = await this.orderinfoSve.getAllNcl(pobj); opResult = await this.orderinfoSve.getAllNcl(pobj);
break; break;
case "addUsuallyContacts"://增加常用联系人,申请人
opResult = await this.usuallycontactsSve.addContacts(pobj,pobj.actionBody);
break;
case "delUsuallyContacts"://删除常用联系人,申请人
opResult = await this.usuallycontactsSve.delContacts(pobj,pobj.actionBody);
break;
case "updateUsuallyContacts"://修改常用联系人,申请人
opResult = await this.usuallycontactsSve.updateContacts(pobj,pobj.actionBody);
break;
case "getUsuallyContacts"://查询常用联系人,申请人
opResult = await this.usuallycontactsSve.getContacts(pobj,pobj.actionBody);
break;
default: default:
opResult = system.getResult(null, "action_type参数错误"); opResult = system.getResult(null, "action_type参数错误");
break; break;
......
const system = require("../../../system");
const Dao = require("../../dao.base");
class UsuallyContactsDao extends Dao {
constructor() {
super(Dao.getModelName(UsuallyContactsDao));
}
async getItemByOrderNo(orderNo, uapp_id) {
return await this.model.findOne({
where: {
sourceOrderNo: orderNo
},
attributes: [
"id",
"contactName",
"mobile",
"tel",
"email",
"fax"],
raw: true
});
}
}
module.exports = UsuallyContactsDao;
module.exports = (db, DataTypes) => {
return db.define("usuallycontacts", {
uapp_id :DataTypes.INTEGER, //
channel_user_id :DataTypes.STRING,
contact_name :DataTypes.STRING,
contacts_content :DataTypes.JSON,
type :DataTypes.STRING
}, {
paranoid: true,//假的删除
underscored: true,
version: true,
freezeTableName: true,
timestamps: true,
updatedAt: false,
//freezeTableName: true,
// define the table's name
tableName: 'c_usually_contacts',
validate: {
},
indexes: [
]
});
}
const system = require("../../../system");
const ServiceBase = require("../../sve.base");
class UsuallyContactsService extends ServiceBase {
constructor() {
super("dbcorder", ServiceBase.getDaoName(UsuallyContactsService));
}
//添加常用联系人、申请人
async addContacts(pobj,actionBody){
if (!actionBody.channel_user_id) {
return system.getResultFail(-1, "渠道用户id不能为空");
}
if(!actionBody.contacts){
return system.getResultFail(-1,'用户信息不能为空');
}
if(!actionBody.type){
return system.getResultFail(-1,'类型不能为空');
}
let params = {
channel_user_id:actionBody.channel_user_id,
uapp_id:pobj.appInfo.uapp_id,
type:actionBody.type,
contact_name:actionBody.contacts.contacts || actionBody.contacts.name
}
let item = await this.findOne(params);
if(item){
return system.getResultFail(-1,'联系人已存在,请勿重复添加')
}
let contactsInfo = {
uapp_id: pobj.appInfo.uapp_id,
channel_user_id:actionBody.channel_user_id,
contact_name:actionBody.contacts.name || actionBody.contacts.contacts,
contacts_content:actionBody.contacts,
type:actionBody.type
}
let result = await this.create(contactsInfo);
return system.getResultSuccess({id:result.id});
}
//删除常用联系人、申请人
async delContacts(pobj,actionBody){
let params = {
id:actionBody.id,
uapp_id:pobj.appInfo.uapp_id
}
await this.delete(params);
return system.getResultSuccess();
}
//修改常用联系人、申请人
async updateContacts(pobj,actionBody){
if(!actionBody.id){
return system.getResultFail(-1,'id 不能为空');
}
if(!actionBody.channel_user_id){
return system.getResultFail(-1,'id 不能为空');
}
if(Object.keys(actionBody.contacts).length<0){
return system.getResultFail(-1,'信息不能为空');
}
let obj = {
id:actionBody.id,
uapp_id:pobj.appInfo.uapp_id,
channel_user_id:actionBody.channel_user_id
}
let setParams = {
contact_name :actionBody.contacts.contacts || actionBody.contacts.name,
contacts_content:actionBody.contacts
}
let result = await this.updateByWhere(setParams, {where:obj});
return system.getResultSuccess();
}
//查询常用联系人、申请人
async getContacts(pobj,actionBody){
let sql = `select id,channel_user_id,contact_name,contacts_content,type from c_usually_contacts where uapp_id = :uapp_id and channel_user_id = :channel_user_id and type = :type`;
if(!actionBody.type){
return system.getResultFail(-1,'type 不能为空')
}
if(!actionBody.channel_user_id){
return system.getResultFail(-1,'type 不能为空')
}
let paramsWhere = {
uapp_id : pobj.appInfo.uapp_id,
channel_user_id: actionBody.channel_user_id,
type:actionBody.type
}
if(actionBody.contact_name){
sql += ` and contact_name = :contact_name`;
paramsWhere['contact_name'] = actionBody.contact_name;
}
sql += ` and deleted_at is null`
let result = await this.customQuery(sql,paramsWhere);
return system.getResult(result);
}
}
module.exports = UsuallyContactsService;
...@@ -55,8 +55,7 @@ class AliyunQcService { ...@@ -55,8 +55,7 @@ class AliyunQcService {
604: "⼯商部已受理", 604: "⼯商部已受理",
605: "⼯商部不予受理", 605: "⼯商部不予受理",
606: "⼯商部通过", 606: "⼯商部通过",
607: "⼯商部未通过", 607: "⼯商部未通过"
608: "用户驳回"
}; };
//(文网文状态2020-9-26) //(文网文状态2020-9-26)
this.wangwenSolutionStatusReference = { this.wangwenSolutionStatusReference = {
...@@ -1035,13 +1034,14 @@ class AliyunQcService { ...@@ -1035,13 +1034,14 @@ class AliyunQcService {
* (文网文)2020-9-26 * (文网文)2020-9-26
*/ */
async serviceSubmitOption(pobj) { async serviceSubmitOption(pobj) {
console.log(pobj)
var ab = pobj.actionBody; var ab = pobj.actionBody;
var user = pobj.userInfo; var user = pobj.userInfo;
if (!user || !user.id) { if (!user || !user.id) {
return system.getResultFail(-100, "未知用户"); return system.getResultFail(-100, "未知用户");
} }
if (!ab.solutionNo) { if (!ab.channelNeedNo) {
return system.getResultFail(-101, "方案编号不能为空"); return system.getResultFail(-101, "需求编号不能为空");
} }
if (!ab.ApplicationStatus) { if (!ab.ApplicationStatus) {
return system.getResultFail(-102, "通知状态不能为空"); return system.getResultFail(-102, "通知状态不能为空");
...@@ -1052,7 +1052,7 @@ class AliyunQcService { ...@@ -1052,7 +1052,7 @@ class AliyunQcService {
//获取方案信息 //获取方案信息
var needsolutioninfo = await this.needsolutionDao.model.findOne({ var needsolutioninfo = await this.needsolutionDao.model.findOne({
attributes: ["id", "status", "solutionContent", "needNo"], attributes: ["id", "status", "solutionContent", "needNo"],
where: { solutionNo: ab.solutionNo }, raw: true where: { channelNeedNo: ab.channelNeedNo }, raw: true
}); });
if (!needsolutioninfo || !needsolutioninfo.id) { if (!needsolutioninfo || !needsolutioninfo.id) {
return system.getResultFail(-400, "未知方案"); return system.getResultFail(-400, "未知方案");
...@@ -1250,6 +1250,11 @@ class AliyunQcService { ...@@ -1250,6 +1250,11 @@ class AliyunQcService {
if (!solution.companyLocation) { if (!solution.companyLocation) {
return system.getResultFail(-107, "区域不能为空"); return system.getResultFail(-107, "区域不能为空");
} }
if (!solution.solutionPrice) {
return system.getResultFail(-108, "办理价格不能为空");
}else{
solution.solutionPrice = solution.solutionPrice / 100;
}
var solutionFlowList = ab.solutionContent.solutionFlowList || []; var solutionFlowList = ab.solutionContent.solutionFlowList || [];
solutionFlowList.push({ solutionFlowList.push({
status: "SOLUTION_SUBMIT", statusName: this.wangwenSolutionStatusReference.SOLUTION_SUBMIT, updated_at: new Date() status: "SOLUTION_SUBMIT", statusName: this.wangwenSolutionStatusReference.SOLUTION_SUBMIT, updated_at: new Date()
......
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