Commit b7eb132f by 宋毅

tj

parent f7956abd
File mode changed from 100644 to 100755
...@@ -23,7 +23,9 @@ class APIBase { ...@@ -23,7 +23,9 @@ class APIBase {
"NeedDetail": "needDetail", "NeedDetail": "needDetail",
"GetOrderListByStatus": "getOrderListByStatus", "GetOrderListByStatus": "getOrderListByStatus",
"GetQualificationCertificateListByUserAndType": "getQualificationCertificateListByUserAndType", "GetQualificationCertificateListByUserAndType": "getQualificationCertificateListByUserAndType",
"GetQualificationCertificateDetail": "getQualificationCertificateDetail" "GetQualificationCertificateDetail": "getQualificationCertificateDetail",
"RefusalSolution": "refusalSolution",
}; };
} }
//-----------------------新的模式------------------开始 //-----------------------新的模式------------------开始
......
...@@ -37,14 +37,12 @@ class Order extends APIBase { ...@@ -37,14 +37,12 @@ class Order extends APIBase {
opResult = system.getResult(null, "contactsMoblie参数错误"); opResult = system.getResult(null, "contactsMoblie参数错误");
return opResult; return opResult;
} }
if (!pobj.actionBody.verificationCode) { if (pobj.actionBody.verificationCode) {
opResult = system.getResult(null, "verificationCode参数错误"); var v = await self.utilsMsgSendSve.getVerificationCode(pobj.actionBody.contactsMoblie);
return opResult; if (v != pobj.actionBody.verificationCode) {
} opResult = system.getResult(null, "验证码错误");
var v = await self.utilsMsgSendSve.getVerificationCode(pobj.actionBody.contactsMoblie); return opResult;
if (v != pobj.actionBody.verificationCode) { }
opResult = system.getResult(null, "验证码错误");
return opResult;
} }
} }
switch (action_type) { switch (action_type) {
......
...@@ -7,7 +7,7 @@ module.exports = (db, DataTypes) => { ...@@ -7,7 +7,7 @@ module.exports = (db, DataTypes) => {
user_id: DataTypes.STRING(100), //user_id 用户id user_id: DataTypes.STRING(100), //user_id 用户id
user_name: DataTypes.STRING(100), //user_name 用户名称 user_name: DataTypes.STRING(100), //user_name 用户名称
solution_content: DataTypes.JSON, //solution_content 方案内容 solution_content: DataTypes.JSON, //solution_content 方案内容
isRefusal: DataTypes.INTEGER, //isRefusal 是否驳回 is_refusal: DataTypes.INTEGER, //is_refusal 是否驳回
refusal_notes: DataTypes.INTEGER, //驳回原因 refusal_notes: DataTypes.INTEGER, //驳回原因
refusal_notes: DataTypes.STRING(255), //驳回/关闭原因 refusal_notes: DataTypes.STRING(255), //驳回/关闭原因
}, { }, {
......
...@@ -50,32 +50,29 @@ class NeedInfoService extends ServiceBase { ...@@ -50,32 +50,29 @@ class NeedInfoService extends ServiceBase {
*/ */
//创建需求 //创建需求
async needSubmit(actionBody) { async needSubmit(actionBody) {
if (!actionBody.contactsMoblie) { if (!actionBody.ContactsMoblie) {
return system.getResultFail(-102, "contactsMoblie cannot be empty"); return system.getResultFail(-102, "contactsMoblie cannot be empty");
} }
if (!actionBody.regionId) { if (!actionBody.RegionId) {
return system.getResultFail(-102, "regionId cannot be empty"); return system.getResultFail(-102, "regionId cannot be empty");
} }
if (!actionBody.regionName) { if (!actionBody.RegionName) {
return system.getResultFail(-102, "regionName cannot be empty"); return system.getResultFail(-102, "regionName cannot be empty");
} }
if (!actionBody.consultType) { if (!actionBody.ConsultType) {
return system.getResultFail(-102, "consultType cannot be empty"); return system.getResultFail(-102, "consultType cannot be empty");
} }
if (!actionBody.consultTypeName) { if (!actionBody.ConsultTypeName) {
return system.getResultFail(-102, "consultTypeName cannot be empty"); return system.getResultFail(-102, "consultTypeName cannot be empty");
} }
if (!actionBody.userId) { if (!actionBody.UserId) {
return system.getResultFail(-102, "userId cannot be empty"); return system.getResultFail(-102, "userId cannot be empty");
} }
if (!actionBody.verificationCode) {
return system.getResultFail(-102, "verificationCode cannot be empty");
}
try { try {
var scobj = { var scobj = {
"region_id": actionBody.regionId, "region_id": actionBody.RegionId,
"regionName": actionBody.regionName, "regionName": actionBody.RegionName,
"path_code": actionBody.consultType "path_code": actionBody.ConsultType
} }
var serviceinfo = await this.dao.findServiceByProductType(scobj); var serviceinfo = await this.dao.findServiceByProductType(scobj);
if (serviceinfo.status < 0) { if (serviceinfo.status < 0) {
...@@ -87,21 +84,21 @@ class NeedInfoService extends ServiceBase { ...@@ -87,21 +84,21 @@ class NeedInfoService extends ServiceBase {
var need_num = await this.getBusUid("n"); var need_num = await this.getBusUid("n");
var datavalue = { var datavalue = {
need_num: need_num, need_num: need_num,
user_id: actionBody.userId, user_id: actionBody.UserId,
contacts_moblie: actionBody.contactsMoblie, contacts_moblie: actionBody.ContactsMoblie,
contacts_name: actionBody.contactsName || "", contacts_name: actionBody.ContactsName || "",
region_id: actionBody.regionId, region_id: actionBody.RegionId,
region_name: actionBody.regionName, region_name: actionBody.RegionName,
consult_type: actionBody.consultType, consult_type: actionBody.ConsultType,
consult_type_name: actionBody.consultTypeName, consult_type_name: actionBody.ConsultTypeName,
notes: actionBody.notes, notes: actionBody.Notes,
servicer_code: actionBody.servicerCode, servicer_code: actionBody.servicerCode,
servicer_name: actionBody.servicerName, servicer_name: actionBody.servicerName,
status: 1 status: 1
} }
if (actionBody.companyName) { if (actionBody.CompanyName) {
datavalue.need_info = { datavalue.need_info = {
companyName: actionBody.companyName companyName: actionBody.CompanyName
}; };
} }
var newneedinfo = await this.create(datavalue); var newneedinfo = await this.create(datavalue);
...@@ -109,7 +106,7 @@ class NeedInfoService extends ServiceBase { ...@@ -109,7 +106,7 @@ class NeedInfoService extends ServiceBase {
return system.getResultFail(-310, "newneedinfo cannot be created"); return system.getResultFail(-310, "newneedinfo cannot be created");
} }
actionBody.needNum = need_num; actionBody.NeedNum = need_num;
//生产者------需求推送 //生产者------需求推送
var pushobj = { var pushobj = {
...@@ -122,7 +119,7 @@ class NeedInfoService extends ServiceBase { ...@@ -122,7 +119,7 @@ class NeedInfoService extends ServiceBase {
identifyCode: "needSubmit" identifyCode: "needSubmit"
} }
}; };
// this.execPostByTimeOut(pushobj, settings.apiconfig.opPushUrl()); this.execPostByTimeOut(pushobj, settings.apiconfig.opPushUrl());
return system.getResultSuccess(); return system.getResultSuccess();
...@@ -151,42 +148,43 @@ class NeedInfoService extends ServiceBase { ...@@ -151,42 +148,43 @@ class NeedInfoService extends ServiceBase {
} }
async needList(searchObj) { async needList(searchObj) {
if (!searchObj.userId) { if (!searchObj.UserId) {
return system.getResultFail(-102, "userId cannot be empty"); return system.getResultFail(-102, "userId cannot be empty");
} }
var sort = [["created_at", 'desc']]; var sort = [["created_at", 'desc']];
if (searchObj.sort) { if (searchObj.Sort) {
if (searchObj.sort.key == "createdAt") { searchObj.Sort=JSON.parse(searchObj.Sort);
searchObj.sort.key = "created_at"; if (searchObj.Sort.key == "createdAt") {
searchObj.Sort.key = "created_at";
} }
sort = [[searchObj.sort.key, searchObj.sort.value]] sort = [[searchObj.Sort.key, searchObj.Sort.value]]
} }
var sobj = { var sobj = {
search: { search: {
user_id: searchObj.userId user_id: searchObj.UserId
}, },
orderInfo: sort, orderInfo: sort,
pageInfo: { pageInfo: {
pageNo: Number(searchObj.pageNo) || 1, pageNo: Number(searchObj.PageNo) || 1,
pageSize: Number(searchObj.pageSize) || 10 pageSize: Number(searchObj.PageSize) || 10
} }
} }
if (searchObj.consultType) { if (searchObj.ConsultType) {
sobj.search.consult_type = searchObj.consultType; sobj.search.consult_type = searchObj.ConsultType;
} }
if (searchObj.status) { if (searchObj.Status) {
sobj.search.status = searchObj.status; sobj.search.status = searchObj.Status;
} }
var r = await this.dao.findAndCountAll(sobj); var r = await this.dao.findAndCountAll(sobj);
return system.getResultSuccess(r); return system.getResultSuccess(r);
} }
async needDetail(searchObj) { async needDetail(searchObj) {
if (!searchObj.needNum) { if (!searchObj.NeedNum) {
return system.getResultFail(-102, "needNum cannot be empty"); return system.getResultFail(-102, "needNum cannot be empty");
} }
var sobj = { var sobj = {
need_num: searchObj.needNum need_num: searchObj.NeedNum
} }
var needInfo = await this.findOne(sobj); var needInfo = await this.findOne(sobj);
if (!needInfo) { if (!needInfo) {
......
...@@ -44,15 +44,15 @@ class NeedSolutionService extends ServiceBase { ...@@ -44,15 +44,15 @@ class NeedSolutionService extends ServiceBase {
if (!needsolution || !needsolution.id) { if (!needsolution || !needsolution.id) {
return system.getResultFail(-301, "方案修改失败,未知方案信息"); return system.getResultFail(-301, "方案修改失败,未知方案信息");
} }
if (needsolution.isRefusal != 1) { if (needsolution.is_refusal != 1) {
return system.getResultFail(-303, "只能修改用户驳回方案"); return system.getResultFail(-303, "只能修改用户驳回方案");
} }
var new_solution_num = await this.getBusUid("NS_"); var new_solution_num = await this.getBusUid("NS_");
var updateObj = {id:needsolution.id,isRefusal:0,solution_num:new_solution_num,solution_content:ab.solutionContent}; var updateObj = { id: needsolution.id, is_refusal: 0, solution_num: new_solution_num, solution_content: ab.solutionContent };
var self = this; var self = this;
return await self.db.transaction(async function (t) { return await self.db.transaction(async function (t) {
await self.dao.update(updateObj,t); await self.dao.update(updateObj, t);
await self.needInfoDao.update({id:needinfo.id,status:"3"},t); await self.needInfoDao.update({ id: needinfo.id, status: "3" }, t);
return system.getResultSuccess(new_solution_num); return system.getResultSuccess(new_solution_num);
}); });
...@@ -66,11 +66,11 @@ class NeedSolutionService extends ServiceBase { ...@@ -66,11 +66,11 @@ class NeedSolutionService extends ServiceBase {
} }
var solution_num = await this.getBusUid("NS_"); var solution_num = await this.getBusUid("NS_");
var createObj = { var createObj = {
solution_num:solution_num, solution_num: solution_num,
need_num:ab.needNum, need_num: ab.needNum,
user_id:needinfo.user_id, user_id: needinfo.user_id,
user_name:needinfo.user_name, user_name: needinfo.user_name,
solution_content:ab.solutionContent solution_content: ab.solutionContent
}; };
var self = this; var self = this;
return await self.db.transaction(async function (t) { return await self.db.transaction(async function (t) {
...@@ -84,28 +84,29 @@ class NeedSolutionService extends ServiceBase { ...@@ -84,28 +84,29 @@ class NeedSolutionService extends ServiceBase {
//驳回方案 //驳回方案
async refusalSolution(actionBody, t) { async refusalSolution(actionBody, t) {
if (!actionBody.needNum) { if (!actionBody.NeedNum) {
return system.getResultFail(-102, "needNum cannot be empty"); return system.getResultFail(-102, "needNum cannot be empty");
} }
if (!actionBody.refusalContent) { if (!actionBody.SolutionNum) {
return system.getResultFail(-102, "refusalContent cannot be empty"); return system.getResultFail(-102, "SolutionNum cannot be empty");
} }
var self = this; var self = this;
return await self.db.transaction(async function (t) { return await self.db.transaction(async function (t) {
var sobj = { var sobj = {
need_num: actionBody.needNum need_num: actionBody.NeedNum
} }
var needInfo = await self.needInfoDao.findOne(sobj, t); var needInfo = await self.needInfoDao.findOne(sobj, t);
if (!needInfo) { if (!needInfo) {
return system.getResultFail(-102, "needInfo is empty"); return system.getResultFail(-102, "needInfo is empty");
} }
sobj.solution_num = actionBody.SolutionNum;
var solutionInfo = await self.dao.findOne(sobj, t); var solutionInfo = await self.dao.findOne(sobj, t);
if (!solutionInfo) { if (!solutionInfo) {
return system.getResultFail(-102, "solutionInfo is empty"); return system.getResultFail(-102, "solutionInfo is empty");
} }
needInfo.dataValues.status = 2; needInfo.dataValues.status = 2;
solutionInfo.dataValues.is_refusal = 0; solutionInfo.dataValues.is_refusal = 1;
solutionInfo.dataValues.solution_content.refusal_content = actionBody.refusalContent solutionInfo.dataValues.solution_content.refusal_content = actionBody.RefusalContent;
await self.needInfoDao.update(needInfo.dataValues, t); await self.needInfoDao.update(needInfo.dataValues, t);
await self.dao.update(solutionInfo.dataValues, t); await self.dao.update(solutionInfo.dataValues, t);
......
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
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