Commit 49e9d4df by wkliang

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

parents fffd6693 d27e0830
......@@ -22,9 +22,15 @@ class DiagnosisAPI extends APIBase {
async opActionProcess (pobj, action_type, req) {
var opResult = null;
switch (action_type) {
case "manualEvaluation"://提交需求 2020 0807 lin 新增
case "manualEvaluation":
opResult = await this.diagnosisSve.manualEvaluation(pobj, pobj.actionBody, req);
break;
case "diagnosisInfo":
opResult = await this.diagnosisSve.diagnosisInfo(pobj, pobj.actionBody, req);
break;
case "enterpriseInfo":
opResult = await this.diagnosisSve.enterpriseInfo(pobj, pobj.actionBody, req);
break;
case 'getNeedList': // 需求列表 20 08 12 liang
opResult = await this.needSve.opNeedList(pobj, pobj.actionBody, req);
break
......
......@@ -11,5 +11,19 @@ class diagnosisDao extends Dao {
return await this.model.update(param, { where: { id } })
}
<<<<<<< HEAD
async findOneOrderByCreateAt (uid) {
return await this.model.findOne({
where: {
channel_user_Id: uid
},
order: [
["updated_at", "desc"]
],
raw: true
});
}
=======
>>>>>>> 54e1b2abd183bb4b792de95cff06b721a760daa4
}
module.exports = diagnosisDao;
\ No newline at end of file
......@@ -45,7 +45,9 @@ module.exports = (db, DataTypes) => {
}
},
diagnosis_result_name: DataTypes.STRING,//诊断结果名字 通过/未通过/人工审核中 --暂不用
diagnosis_result_data: DataTypes.JSON, // 智能诊断结果返回值 人工目前没用到
status_name: DataTypes.STRING,//状态 dcl/gtz/dqrfa/ygb/ywc
main_class: DataTypes.STRING,// 主营类目(一级分类-二级分类)
qualifications_pic: DataTypes.JSON,// 基础资质json {}
brand_pic: DataTypes.JSON,// 品牌资质json {}
industry_pic: DataTypes.JSON,// 行业资质json {}
......
......@@ -6,8 +6,8 @@ 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");
......@@ -34,12 +34,63 @@ class DiagnosisService extends ServiceBase {
diagnosis_mode: actionBody.diagnosisMode, // 诊断方式,这里由channel项目调用带参数
diagnosis_result: "rgshz", // 创建订单时 人工审核中 前台用
status: "dcl", // 创建订单时 待处理 后台用
main_class = actionBody.mainClass,// 运营后台-诊断详情-主营类目
qualifications_pic: actionBody.qualificationsPic,
brand_pic: actionBody.brandPic,
industry_pic: actionBody.industryPic
}
if(actionBody.diagnosisMode == "zn") {
nobj.diagnosis_result = actionBody.checkResult.data.isPass == false ? "wtg" : "tg";
nobj.status = "ywc"
nobj.diagnosis_result_data = actionBody.checkResult;// 诊断方式为智能时 channel会传来诊断结果,记录快照
}
await this.dao.create(nobj);
return system.getResultSuccess();
}
async diagnosisInfo(pobj) {
var actionBody = pobj.actionBody;
let query = {
offset: ((actionBody.page - 1) * actionBody.pageSize) || 0,
limit: actionBody.pageSize || 10,
attributes: [
"diagnosis_no",// 申请编号
"corporate_name",// 公司名称
"publish_mobile",// 联系人手机号
"diagnosis_type_name",// 诊断类型
"diagnosis_mode_name",// 诊断方式
"diagnosis_result_name",// 诊断结果
"updated_at"],// 修改时间
order: [
["updated_at", "desc"]
]
}
let where = {}
if (actionBody.diagnosisNo) {
where.diagnosis_no = { [this.db.Op.like]: `%${actionBody.diagnosis_no}%` }
}
if (actionBody.status) {
where.status = actionBody.status
}
if (actionBody.publishName) {
where.publish_name = { [this.db.Op.like]: `%${actionBody.publish_name}%` }
}
if (actionBody.stdate && actionBody.endate) {
where.updatedAt = { [this.db.Op.between]: [actionBody.stdate, actionBody.endate]}
}
if (actionBody.corporateType) {
where.corporate_type = actionBody.corporateType
}
if (Object.keys(where).length > 0) {
query.where = where
}
let res = await this.dao.findAndCountAll(query)
return system.getResultSuccess(res);
}
async enterpriseInfo(pobj) {
let diagnosisResult = await this.dao.findOneOrderByCreateAt(pobj.userInfo.channel_userid)
return system.getResultSuccess(diagnosisResult);
}
}
module.exports = DiagnosisService;
\ 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