Commit b7eb132f by 宋毅

tj

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