Commit aa5dea7e by wkliang

fix

parent 04bf6a69
......@@ -4,17 +4,17 @@ var settings = require("../../../../config/settings");
const axios = require("axios");
const { getResult } = require("../../../system");
class Zzzd extends WEBBase {
constructor() {
class Zzzd extends WEBBase {
constructor () {
super();
this.restClient = system.getObject("util.restClient");
this.redisClient = system.getObject("util.redisClient");
this.zzzApi = {
"industryOne":"/gsb/api/industry_one", //一级大类列表
"industryTwo":"/gsb/api/industry_two", //二级大类列表
"getQualificationByIndustry":"/gsb/api/qualifications", //根据行业ID 查询所有相关的资质
"recommendationBusiness":"/gsb/api/recommendation_business", //立即查看结果
"phoneNumber":"/gsb/api/phone_number", //免费咨询
"industryOne": "/gsb/api/industry_one", //一级大类列表
"industryTwo": "/gsb/api/industry_two", //二级大类列表
"getQualificationByIndustry": "/gsb/api/qualifications", //根据行业ID 查询所有相关的资质
"recommendationBusiness": "/gsb/api/recommendation_business", //立即查看结果
"phoneNumber": "/gsb/api/phone_number", //免费咨询
}
this.utilsDiagnosisSve = system.getObject("service.utilsSve.utilsDiagnosisSve");
}
......@@ -24,7 +24,7 @@ class Zzzd extends WEBBase {
* action_type 执行的类型
* action_body 执行的参数
*/
async springBoard(pobj, qobj, req) {
async springBoard (pobj, qobj, req) {
if (!pobj.actionProcess) {
return system.getResult(null, "actionProcess参数不能为空");
}
......@@ -34,51 +34,51 @@ class Zzzd extends WEBBase {
var result = await this.opActionProcess(pobj, pobj.actionType, req);
return result;
}
async opActionProcess(pobj, action_type, req) {
async opActionProcess (pobj, action_type, req) {
pobj.requestId = req.requestId;
var opResult = null;
switch (action_type) {
case "getIndustries": //获取一级大类列表
try {
console.log(`获取一级大类列表 参数:` + JSON.stringify(pobj.actionBody));
if(!pobj.actionBody.platformCode) {
return system.getResult(null,`平台ID不能为空`)
if (!pobj.actionBody.platformCode) {
return system.getResult(null, `平台ID不能为空`)
}
// 2020 0807 林 修改 rediskey 增加platformCode 平台ID必填参数
let _industryOne =await this.redisClient.get("industryOne" + pobj.actionBody.platformCode);
if(_industryOne){
let _industryOne = await this.redisClient.get("industryOne" + pobj.actionBody.platformCode);
if (_industryOne) {
opResult = system.getResult(JSON.parse(_industryOne));
console.log("redis数据:" + _industryOne);
}else{
opResult =await this.restPostUrl(pobj.actionBody,settings.zzzdUrl()+this.zzzApi.industryOne);
await this.redisClient.setWithEx("industryOne",JSON.stringify(opResult.data),45*60);
} else {
opResult = await this.restPostUrl(pobj.actionBody, settings.zzzdUrl() + this.zzzApi.industryOne);
await this.redisClient.setWithEx("industryOne", JSON.stringify(opResult.data), 45 * 60);
console.log(`获取一级大类列表 结果` + JSON.stringify(opResult));
}
}catch (e) {
} catch (e) {
console.log(e);
return system.getResult(null, `系统错误`);
}
break;
case "getSecondIndustries": //获取二级大类列表
console.log(`获取二级大类列表 参数:` + JSON.stringify(pobj.actionBody));
if(!pobj.actionBody.industryId){
return system.getResult(null,`一级行业ID不能为空`)
if (!pobj.actionBody.industryId) {
return system.getResult(null, `一级行业ID不能为空`)
}
if(!pobj.actionBody.platformCode) {
return system.getResult(null,`平台ID不能为空`)
if (!pobj.actionBody.platformCode) {
return system.getResult(null, `平台ID不能为空`)
}
try {
// await this.redisClient.delete(`industryTwo:${pobj.actionBody.industryId}`);
let _industryTwo =await this.redisClient.get(`industryTwo:${pobj.actionBody.industryId}` + pobj.actionBody.platformCode);
if(_industryTwo){
let _industryTwo = await this.redisClient.get(`industryTwo:${pobj.actionBody.industryId}` + pobj.actionBody.platformCode);
if (_industryTwo) {
opResult = system.getResult(JSON.parse(_industryTwo));
console.log("redis数据:" + _industryTwo);
}else{
opResult =await this.restPostUrl(pobj.actionBody,settings.zzzdUrl()+this.zzzApi.industryTwo);
await this.redisClient.setWithEx(`industryTwo:${pobj.actionBody.industryId}`,JSON.stringify(opResult.data),45*60);
} else {
opResult = await this.restPostUrl(pobj.actionBody, settings.zzzdUrl() + this.zzzApi.industryTwo);
await this.redisClient.setWithEx(`industryTwo:${pobj.actionBody.industryId}`, JSON.stringify(opResult.data), 45 * 60);
console.log(`获取二级大类列表 结果` + JSON.stringify(opResult));
}
}catch (e) {
} catch (e) {
console.log(e);
return system.getResult(null, `系统错误`);
}
......@@ -86,93 +86,93 @@ class Zzzd extends WEBBase {
case "getQualificationByIndustry": //根据行业获取资质
try {
console.log(`根据行业获取资质 参数:` + JSON.stringify(pobj.actionBody));
if(!pobj.actionBody.hasOwnProperty("isImports")){
return system.getResult(null,`参数错误 是否进口不能为空`)
if (!pobj.actionBody.hasOwnProperty("isImports")) {
return system.getResult(null, `参数错误 是否进口不能为空`)
}
if(!pobj.actionBody.hasOwnProperty("storeTypeId") &&!pobj.actionBody.storeTypeId ){
return system.getResult(null,`参数错误 店铺类型ID不能为空`)
if (!pobj.actionBody.hasOwnProperty("storeTypeId") && !pobj.actionBody.storeTypeId) {
return system.getResult(null, `参数错误 店铺类型ID不能为空`)
}
if(!pobj.actionBody.industryId){
return system.getResult(null,`一级行业ID不能为空`)
if (!pobj.actionBody.industryId) {
return system.getResult(null, `一级行业ID不能为空`)
}
if(!pobj.actionBody.secondIndustry && pobj.actionBody.secondIndustry.length>0){
return system.getResult(null,`二级行业不能为空`)
if (!pobj.actionBody.secondIndustry && pobj.actionBody.secondIndustry.length > 0) {
return system.getResult(null, `二级行业不能为空`)
}
opResult = await this.restPostUrl(pobj.actionBody,settings.zzzdUrl()+this.zzzApi.getQualificationByIndustry );
opResult = await this.restPostUrl(pobj.actionBody, settings.zzzdUrl() + this.zzzApi.getQualificationByIndustry);
console.log(`根据行业获取资质 结果` + JSON.stringify(opResult));
}catch (e) {
} catch (e) {
console.log(e);
return system.getResult(null, `系统错误`);
}
break;
case "check": //立即查看结果
if(!pobj.actionBody.industryId){
return system.getResult(null,`行业ID不能为空`)
if (!pobj.actionBody.industryId) {
return system.getResult(null, `行业ID不能为空`)
}
if(!pobj.actionBody.mobile){
if (!pobj.actionBody.mobile) {
return system.getResult(null, `电话不能为空`);
}
if(!pobj.actionBody.enterprise){
if (!pobj.actionBody.enterprise) {
return system.getResult(null, `企业名称不能为空`);
}
if(!pobj.actionBody.data){
if (!pobj.actionBody.data) {
return system.getResult(null, `资质列表不能为空`);
}
try {
opResult =await this.restPostUrl(pobj.actionBody,settings.zzzdUrl()+this.zzzApi.recommendationBusiness);
opResult = await this.restPostUrl(pobj.actionBody, settings.zzzdUrl() + this.zzzApi.recommendationBusiness);
// console.log(`根据行业获取资质 结果` + JSON.stringify(opResult));
}catch (e) {
} catch (e) {
console.log(e);
return system.getResult(null, `系统错误` +JSON.stringify(e));
return system.getResult(null, `系统错误` + JSON.stringify(e));
}
break;
case "counselling": //免费咨询
if(!pobj.actionBody.id){
return system.getResult(null,`业务ID不能为空`)
if (!pobj.actionBody.id) {
return system.getResult(null, `业务ID不能为空`)
}
if(!pobj.actionBody.mobile){
if (!pobj.actionBody.mobile) {
return system.getResult(null, `电话不能为空`);
}
pobj.actionBody.enterprise = pobj.actionBody.enterprise ? pobj.actionBody.enterprise :"";
pobj.actionBody.enterprise = pobj.actionBody.enterprise ? pobj.actionBody.enterprise : "";
try {
console.log("免费参数"+JSON.stringify(pobj));
opResult = await this.restPostUrl(pobj.actionBody, settings.zzzdUrl()+this.zzzApi.phoneNumber);
console.log("免费参数" + JSON.stringify(pobj));
opResult = await this.restPostUrl(pobj.actionBody, settings.zzzdUrl() + this.zzzApi.phoneNumber);
console.log(`根据行业获取资质 结果` + JSON.stringify(opResult));
}catch (e) {
} catch (e) {
console.log(e);
return system.getResult(null, `系统错误`);
}
break;
case "uploadBusiness":
if(!pobj.actionBody.picUrl) {
return system.getResult(null,`-zzzd03 图片地址不能为空`);
if (!pobj.actionBody.picUrl) {
return system.getResult(null, `-zzzd03 图片地址不能为空`);
}
if(!pobj.actionBody.identityCardNo) {
return system.getResult(null,`-zzzd04 身份证号不能为空`);
if (!pobj.actionBody.identityCardNo) {
return system.getResult(null, `-zzzd04 身份证号不能为空`);
}
var reqParam = {
bl_url:pobj.actionBody.picUrl
bl_url: pobj.actionBody.picUrl
}
// 分析营业执照
var result = await this.restPostUrl(reqParam, settings.businessDistinguishUrl() + "gsb/businessLicenseUrlApi");
if(result.status != 1) {
if (result.status != 1) {
return getResult(null, "-zzzd01" + result.msg)
}
// 判断 如果四要素有空 则 不请求 并返回营业执照解析失败
if(result.data.legal_person == "无") {
return system.getResult(null,"-zzzd06 审核不通过,原因:营业执照法人名字分析失败");
if (result.data.legal_person == "无") {
return system.getResult(null, "-zzzd06 审核不通过,原因:营业执照法人名字分析失败");
}
// 这里写死判断,如果等于测试的营业执照 不走判断地址 因为测试营业执照分析不出地址
// https://gsb-zc.oss-cn-beijing.aliyuncs.com//zc_958415948076283422020615.jpg
if(result.data.credit_code == "92410204MA47NYPD41") {
if (result.data.credit_code == "92410204MA47NYPD41") {
result.data.company_name = "开封市鼓楼区任我行科技技术服务部"
} else {
if(result.data.company_name == "无") {
return system.getResult(null,"-zzzd05 审核不通过,原因:营业执照组织机构名称分析失败");
if (result.data.company_name == "无") {
return system.getResult(null, "-zzzd05 审核不通过,原因:营业执照组织机构名称分析失败");
}
}
if(result.data.credit_code == "无" && result.data.reg_number == "无") {
return system.getResult(null,"-zzzd07 审核不通过,原因:营业执照社会信用代码或注册号分析失败");
if (result.data.credit_code == "无" && result.data.reg_number == "无") {
return system.getResult(null, "-zzzd07 审核不通过,原因:营业执照社会信用代码或注册号分析失败");
}
// 请求四要素验证
var fourFactorsReqParam = {
......@@ -180,16 +180,16 @@ class Zzzd extends WEBBase {
legalRepIdNo: pobj.actionBody.identityCardNo, // 法人身份证号
legalRepName: result.data.legal_person, // 法人名字
name: result.data.company_name, // 组织机构证件(如营业执照)上的组织机构名称
orgCode: result.data.credit_code != "无" ? result.data.credit_code : result.data.reg_number// 组织机构证件号,支持统一社会信用代码号和工商注册号(部分个体工商户)
orgCode: result.data.credit_code != "无" ? result.data.credit_code : result.data.reg_number// 组织机构证件号,支持统一社会信用代码号和工商注册号(部分个体工商户)
}
var fourFactorsCompareResult = await this.restPostUrl(fourFactorsReqParam, settings.fourFactorsUrl() + "auth/organize/fourFactors/compare");
// 请求失败
if(fourFactorsCompareResult.code != 0) {
return system.getResult(null,"-zzzd08" + fourFactorsCompareResult.msg);
if (fourFactorsCompareResult.code != 0) {
return system.getResult(null, "-zzzd08" + fourFactorsCompareResult.msg);
}
// 验证失败
if(fourFactorsCompareResult.data.state != 1) {
return system.getResult(null,"-zzzd09" + fourFactorsCompareResult.msg);
if (fourFactorsCompareResult.data.state != 1) {
return system.getResult(null, "-zzzd09" + fourFactorsCompareResult.msg);
}
// 记录检测结果 用来做检测记录用???暂时未做,表已建好在center-order/c_zzzd_test_business
......@@ -205,6 +205,13 @@ class Zzzd extends WEBBase {
case "enterpriseInfo":
opResult = await this.utilsDiagnosisSve.enterpriseInfo(pobj, pobj.actionBody);
break;
case 'getNeedListUser': // 需求列表 20 08 12 liang
pobj.actionType = 'getNeedList'
opResult = await this.utilsDiagnosisSve.opNeedList(pobj, pobj.actionBody, req);
break
case 'getNeedDetail': // 需求详情 20 08 12 liang
opResult = await this.utilsDiagnosisSve.getItemByNeedNo(pobj);
break
default:
opResult = system.getResult(null, "action_type参数错误");
break;
......
......@@ -6,7 +6,7 @@ const { json } = require("sequelize");
// 2020 0807 lin 新增 诊断宝相关
// 接口文档地址:
class UtilsDiagnosisService extends AppServiceBase {
constructor() {
constructor () {
super();
this.centerOrderUrl = settings.centerOrderUrl();
}
......@@ -16,9 +16,9 @@ class UtilsDiagnosisService extends AppServiceBase {
* @param {*} pobj
* @param {*} actionBody
*/
async manualEvaluation(pobj, actionBody) {
async manualEvaluation (pobj, actionBody) {
var reqUrl = this.centerOrderUrl + "action/diagnosis/springBoard";
var manualEvaluationResult =await this.restPostUrl(pobj,reqUrl);
var manualEvaluationResult = await this.restPostUrl(pobj, reqUrl);
return manualEvaluationResult;
}
/**
......@@ -26,9 +26,9 @@ class UtilsDiagnosisService extends AppServiceBase {
* @param {*} pobj
* @param {*} actionBody
*/
async diagnosisInfo(pobj, actionBody) {
async diagnosisInfo (pobj, actionBody) {
var reqUrl = this.centerOrderUrl + "action/diagnosis/springBoard";
var diagnosisInfoResult =await this.restPostUrl(pobj,reqUrl);
var diagnosisInfoResult = await this.restPostUrl(pobj, reqUrl);
return diagnosisInfoResult;
}
/**
......@@ -36,9 +36,9 @@ class UtilsDiagnosisService extends AppServiceBase {
* @param {*} pobj
* @param {*} actionBody
*/
async enterpriseInfo(pobj, actionBody) {
async enterpriseInfo (pobj, actionBody) {
var reqUrl = this.centerOrderUrl + "action/diagnosis/springBoard";
var enterpriseInfoResult =await this.restPostUrl(pobj,reqUrl);
var enterpriseInfoResult = await this.restPostUrl(pobj, reqUrl);
return enterpriseInfoResult;
}
/**
......@@ -46,9 +46,9 @@ class UtilsDiagnosisService extends AppServiceBase {
* @param {*} pobj
* @param {*} actionBody
*/
async needInfo(pobj, actionBody) {
async needInfo (pobj, actionBody) {
var reqUrl = this.centerOrderUrl + "action/diagnosis/springBoard";
var enterpriseInfoResult =await this.restPostUrl(pobj,reqUrl);
var enterpriseInfoResult = await this.restPostUrl(pobj, reqUrl);
return enterpriseInfoResult;
}
/**
......@@ -56,9 +56,31 @@ class UtilsDiagnosisService extends AppServiceBase {
* @param {*} pobj
* @param {*} actionBody
*/
async needDetail(pobj, actionBody) {
async needDetail (pobj, actionBody) {
var reqUrl = this.centerOrderUrl + "action/diagnosis/springBoard";
var enterpriseInfoResult =await this.restPostUrl(pobj,reqUrl);
var enterpriseInfoResult = await this.restPostUrl(pobj, reqUrl);
return enterpriseInfoResult;
}
/**
* @description
* @author liangwk
* @param {*} pobj
* @param {*} actionBody
* @param {*} req
* @returns
* @memberof UtilsDiagnosisService
*/
async opNeedList (pobj) {
var reqUrl = this.centerOrderUrl + "action/diagnosis/springBoard";
var enterpriseInfoResult = await this.restPostUrl(pobj, reqUrl);
return enterpriseInfoResult;
}
async getItemByNeedNo (pobj) {
var reqUrl = this.centerOrderUrl + "action/diagnosis/springBoard";
var enterpriseInfoResult = await this.restPostUrl(pobj, reqUrl);
return enterpriseInfoResult;
}
}
......
......@@ -244,7 +244,7 @@ module.exports = function (app) {
"submitProgramme", "getProgrammeListByUser", "getProgrammeInfoByNeedNo", "abolishProgramme", "getAliPayInfo",
"getPaidLogoListByUser","getCollectibleLogoListByUser","collectLogo","getLogoMaterial","cancelCollectLogo","icpNotify","createName","getNameDetail","orderConfirm",
"orderTotalSum", "collect", "reg", "orderCheck","getReOrderList","getOfficalList","addReviewList","opSubmitNeed","opNeedClose","opNeedList","opNeedDetailByChannelNo",
"manualEvaluation"
"manualEvaluation", 'getNeedListUser'
];
if (lst.indexOf(req.body.actionType) >= 0) {
var userpin = req.headers["userpin"] || "";
......
......@@ -3,6 +3,8 @@
2. [人工评估-开始入职评估](#manualEvaluation)
3. [个人中心-诊断列表](#diagnosisInfo)
4. [个人中心-企业信息](#enterpriseInfo)
5. [需求列表](#getNeedListUser)
6. [需求详情](#getNeedDetail)
## **<a name="uploadBusiness"> 四要素诊断</a>**
[返回到目录](#menu)
......@@ -144,4 +146,34 @@
"data": null,
"requestId": "837ea5c284074d568fa198f7f259088a"
}
```
## **<a name="getNeedListUser"> 需求列表</a>**
[返回到目录](#menu)
##### URL
[/web/zzzd/zzzd/springBoard]
#### 参数格式 `JSON`
#### HTTP请求方式 `POST`
#### 渠道执行的类型 actionType:enterpriseInfo
``` javascript
{
"status": "状态", // 目前枚举和原型不同 不建议筛选
"needNo": "", // 需求单号
"publishName": "", // 联系人姓名
"publishMobile": "", // 联系人电话
"updatedAt": [], // 更新时间 两个日期
"pageNo": 1, // 页数
"pageSize": 10 // 每页条数
}
```
#### 返回结果
``` javascript
// 等待填写
{
"status": 0,
"msg": "success",
"data": null,
"requestId": "837ea5c284074d568fa198f7f259088a"
}
```
\ 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