Commit 20290efc by wkliang

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

parents 386179e7 ec55acae
var APIBase = require("../../api.base");
var system = require("../../../system");
var settings = require("../../../../config/settings");
class DiagnosisAPI extends APIBase {
constructor() {
super();
this.diagnosisSve = system.getObject("service.dbneed.diagnosisSve");
}
/**
* 接口跳转-POST请求
* action_type 执行的类型
* action_body 执行的参数
*/
async springBoard(pobj, qobj, req) {
if (!pobj.actionType) {
return system.getResult(null, "actionType参数不能为空");
}
var result = await this.opActionProcess(pobj, pobj.actionType, req);
return result;
}
async opActionProcess(pobj, action_type, req) {
var opResult = null;
switch (action_type) {
case "manualEvaluation"://提交需求 2020 0807 lin 新增
opResult = await this.diagnosisSve.manualEvaluation(pobj, pobj.actionBody, req);
break;
default:
opResult = system.getResult(null, "action_type参数错误");
break;
}
return opResult;
}
}
module.exports = DiagnosisAPI;
\ No newline at end of file
const Dao = require("../../dao.base");
class diagnosisDao extends Dao {
constructor() {
super(Dao.getModelName(diagnosisDao));
}
}
module.exports = diagnosisDao;
\ No newline at end of file
const Dao = require("../../dao.base");
class diagnosisneedinfoDao extends Dao {
constructor () {
super('needinfo');
}
async findAndCountAll (query) {
console.log(this.model)
return await this.model.findAndCountAll(query)
}
async update (param, id) {
return await this.model.update(param, { where: { id } })
}
}
module.exports = diagnosisneedinfoDao;
\ No newline at end of file
......@@ -2,11 +2,11 @@ const system = require("../../../system");
const settings = require("../../../../config/settings");
const uiconfig = system.getUiConfig2(settings.appKey);
module.exports = (db, DataTypes) => {
return db.define("needinfo", {
return db.define("diagnosis", {
uapp_id: DataTypes.INTEGER,
channelUserId: DataTypes.STRING(128), //渠道用户唯一码
channel_user_id: DataTypes.STRING(128), //渠道用户唯一码
diagnosisNo: DataTypes.STRING(128), //诊断单号/申请编号
corporateNname: DataTypes.INTEGER,//公司名称
corporateName: DataTypes.INTEGER,//公司名称
publishName: DataTypes.STRING,//联系人名字
publishMobile: DataTypes.STRING(50),//联系人手机号
corporateType: { //店铺类型 电商诊断:qjd/zmd/zyd,直播诊断:qy/gtgsh/mbfqy/flfw
......@@ -51,7 +51,7 @@ module.exports = (db, DataTypes) => {
industryPic: DataTypes.JSON,// 行业资质json {}
notes: DataTypes.STRING,//备注
status: { //状态 后台用 dcl/gtz/dqrfa/ygb/ywc
//wts未推送,yts已推送,ygj已跟进,ycd已成单
// 2020 0811 lin 修改 目标枚举只有dcl 待处理,ywc已完成
type: DataTypes.ENUM,
values: Object.keys(uiconfig.config.pdict.diagnosis_status),
set: function (val) {
......
const uuidv4 = require('uuid/v4');
const system = require("../../../system");
const ServiceBase = require("../../sve.base");
const settings = require("../../../../config/settings");
var moment = require('moment')
class DiagnosisService extends ServiceBase {
constructor() {
super("dbneed", ServiceBase.getDaoName(DiagnosisService));
this.diagnosisDao = system.getObject("db.dbneed.diagnosisDao");
}
async manualEvaluation(pobj) {
var actionBody = pobj.actionBody;
var diagnosisNeedNo = await this.getBusUid("n");
if (!actionBody.mobile) {
return system.getResultFail(-5004, "联系电话不能为空");
}
if (!actionBody.enterprise) {
return system.getResultFail(-5005, "企业名称不能为空");
}
if (!actionBody.corporateType) {
return system.getResultFail(-5005, "店铺类型不能为空");
}
if (!actionBody.diagnosisType) {
return system.getResultFail(-5005, "诊断类型不能为空");
}
var nobj = {
uapp_id: pobj.appInfo.uapp_id,
diagnosisNo: diagnosisNeedNo, // uuid
channelUserId: pobj.userInfo.channel_userid, // 用户id
corporateName: actionBody.enterprise, // 公司名称
publishMobile: actionBody.mobile, // 联系电话
corporateType: actionBody.corporateType, // 店铺类型
diagnosisType: actionBody.diagnosisType, // 诊断类型
diagnosisMode: actionBody.diagnosisMode, // 诊断方式,这里由channel项目调用带参数
diagnosisResult: "rgshz", // 创建订单时 人工审核中 前台用
status: "dcl", // 创建订单时 待处理 后台用
qualificationsPic: actionBody.qualificationsPic,
brandPic: actionBody.brandPic,
industryPic: actionBody.industryPic
}
await this.dao.create(nobj);
return system.getResultSuccess();
}
}
module.exports = DiagnosisService;
\ No newline at end of file
......@@ -88,9 +88,9 @@ class NeedinfoService extends ServiceBase {
channelTypeName: actionBody.channel_type_name,
status: "wts"
}
if(nobj.channelTypeCode==7||nobj.channelTypeCode==5){
nobj.province=nobj.city,
nobj.city="";
if (nobj.channelTypeCode == 7 || nobj.channelTypeCode == 5) {
nobj.province = nobj.city,
nobj.city = "";
}
await this.dao.create(nobj);
return system.getResultSuccess();
......@@ -131,9 +131,9 @@ class NeedinfoService extends ServiceBase {
channelTypeName: actionBody.channel_type_name,
status: "wts"
}
if(nobj.channelTypeCode==7||nobj.channelTypeCode==5){
nobj.province=nobj.city,
nobj.city="";
if (nobj.channelTypeCode == 7 || nobj.channelTypeCode == 5) {
nobj.province = nobj.city,
nobj.city = "";
}
await this.dao.create(nobj);
return system.getResultSuccess();
......@@ -162,48 +162,49 @@ class NeedinfoService extends ServiceBase {
}
async getItemByChannelSolutionNo(pobj){
var solutionitem = await this.needsolutionDao.findOne({channelSolutionNo: pobj.actionBody.bizId});
async getItemByChannelSolutionNo(pobj) {
var solutionitem = await this.needsolutionDao.findOne({ channelSolutionNo: pobj.actionBody.bizId });
if (!solutionitem) {
return system.getResult(null, "需求数据为空,30210");
}
var item = await this.dao.getItemByNeedNo(solutionitem.needNo);
item.solutionProvince = solutionitem.solutionContent.solution.Area;
if (!item) {
return system.getResult(null, "需求数据为空,30210");
}
return system.getResultSuccess(item);
}
async writeCommunicationLog(pobj,actionBody){
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});
actionBody.Note = ["noteTime", moment().format("YYYY-MM-DD HH:mm:ss"), "note", actionBody.Note];
let needRes = await this.findOne({ channelNeedNo: actionBody.BizId });
// 没有需求单直接返回
if(!needRes) {
if (!needRes) {
return system.getResult("没有这个需求单");
}
}
// 有需求单但没有沟通记录 直接set
if(!needRes.followContent) {
if (!needRes.followContent) {
var sql = "update n_need_info set followContent=JSON_OBJECT(:followContent) where channelNeedNo=:BizId"
var paramWhere = {
var paramWhere = {
followContent: actionBody.Note,
BizId: actionBody.BizId
};
var updateRes = await this.customUpdate(sql,paramWhere);
if(updateRes[1]) {
var updateRes = await this.customUpdate(sql, paramWhere);
if (updateRes[1]) {
return system.getResultSuccess();
}
return system.getResult("添加记录失败");
// 有需求单有沟通记录 json_array_append
// 有需求单有沟通记录 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 = {
var paramWhere = {
Note: actionBody.Note,
BizId: actionBody.BizId
};
var updateRes = await this.customUpdate(sql,paramWhere);
if(updateRes[1]) {
var updateRes = await this.customUpdate(sql, paramWhere);
if (updateRes[1]) {
return system.getResultSuccess();
}
return system.getResult("添加记录失败");
......
......@@ -50,7 +50,7 @@ class NeedinfoService extends ServiceBase {
async opNeedList(pobj, actionBody, req) {
// 时间段,分页,排序,需求状态 条件展示未做
console.log(pobj);
console.log(actionBody);
console.log(pobj.actionBody);
var sobj = {
search: {
channelUserId: pobj.userInfo.channel_userid
......
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