Commit 48cd9398 by 王栋源

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

parents 2b276cd4 c2614602
......@@ -25,9 +25,15 @@ class FgbusinesschanceAPI extends APIBase {
case "create": //创建复购商机
opResult = await this.fgbusinesschanceSve.create(pobj, pobj.actionBody);
break;
// case "getInfo": //获取商机
// opResult = await this.orderinfoSve.getInfo(pobj, pobj.actionBody);
// break;
case "createOrderRefundFq":
opResult = await this.fgbusinesschanceSve.createOrderRefundFq(pobj, pobj.actionBody);
break;
case "createOnlineProductClassificiationFq":
opResult = await this.fgbusinesschanceSve.createOnlineProductClassificiationFq(pobj, pobj.actionBody);
break;
case "createOrderInfoAndPayFq":
opResult = await this.fgbusinesschanceSve.createOrderInfoAndPayFq(pobj, pobj.actionBody);
break;
default:
opResult = system.getResult(null, "action_type参数错误");
break;
......
......@@ -8,14 +8,6 @@ class FgbusinesschancService extends ServiceBase {
super("dbcorder", "orderinfoDao");
}
//var sql = "select * from c_delivery_official_flow where sourceOrderNo IN(:sourceOrderNo)";
// var paramWhere = { sourceOrderNo: actionBody.sourceOrderNoList };
// var list = await this.customQuery(sql, paramWhere);
// putOrderDelivery(data, orderNo) {//修改交付信息
// var sql = "UPDATE `c_order_delivery` SET deliveryContent ='" + JSON.stringify(data) + "' where sourceOrderNo='" + orderNo + "'";
// sql = sql.replace('\n', '');
// this.customQuery(sql);
// }
async create(req, actionBody) {
var sql = "INSERT INTO `fg_businesschance` (`companyId` ,`crm_company_name`,`standard_company_name`,`businessId`,`created_at` ) VALUE (:companyId,:crm_company_name,:standard_company_name,:businessId,:created_at)";
await this.customInsert(sql, {
......@@ -27,19 +19,93 @@ class FgbusinesschancService extends ServiceBase {
});
return system.getResultSuccess();
};
// async getInfo(req, actionBody) {
// let sql = "select * from `fg_businesschance` where businessId=:businessId";
// var result = system.getResultSuccess();
// result.data = await this.customQuery(sql, {
// businessId: actionBody.businessId
// });
// return result
// };
// async updateStatus(req, actionBody) {
// var sql = "UPDATE `fg_businesschance` SET status=:status, stateName=:stateName where businessId=:businessId";
// await this.customUpdate(sql, actionBody);
// return system.getResultSuccess();
// }
// 创建order_refund_fq 记录
async createOrderRefundFq(req, actionBody) {
let sql = `INSERT INTO order_refund_fq (${Object.keys(actionBody).join()}) VALUE (:${Object.keys(actionBody).join(",:")})`;
await this.customInsert(sql, actionBody);
return system.getResultSuccess();
}
// 创建 online_product_classificiation_fq 记录
async createOnlineProductClassificiationFq(req, actionBody) {
let selectSql = `SELECT * FROM online_product_classificiation_fq WHERE product_id=:product_id`;
var list = await this.customQuery(selectSql, {
product_id: actionBody.product_id
});
let sql;
if (!list || list.length === 0) {
sql = `INSERT INTO online_product_classificiation_fq (${Object.keys(actionBody).join()}) VALUE (:${Object.keys(actionBody).join(",:")}) `;
await this.customInsert(sql, actionBody);
} else {
let values = [];
Object.keys(actionBody).forEach((item, index) => {
values.push(`${item}=:${item}`);
});
sql = `UPDATE online_product_classificiation_fq SET ${values.join()} WHERE product_id=:product_id`
await this.customUpdate(sql, actionBody);
}
return system.getResultSuccess();
}
// 创建 order_info_fq、pay_fq
async createOrderInfoAndPayFq(req, actionBody) {
let sql = `SELECT * FROM order_info_fq WHERE order_pkid =:order_pkid`;
let list = await this.customQuery(sql, {
order_pkid: actionBody.orderInfo.order_pkid
});
if (!list || list.length === 0) {
// 插入 order_info_fq
let data = {};
let keys = [
"order_pkid", "order_id",
"produce_first_type_pkid", "produce_first_type_name",
"produce_second_type_pkid", "produce_second_type_name",
"product_id", "product_name", "produce_price", "order_price",
"order_pay", "order_add_time", "order_update_time", "account_id",
"account_name", "account_region_province", "account_region_city",
"account_company_name", "owner_id", "owner_name", "supplier_id",
"ownership_company", "source", "source_type", "contract_number",
"contract_amount"];
keys.forEach((item, index) => {
if (actionBody.orderInfo[item]) {
data[item] = actionBody.orderInfo[item]
}
})
sql = `INSERT INTO order_info_fq (${Object.keys(data).join()}) VALUE (:${Object.keys(data).join(",:")}) `;
await this.customInsert(sql, data);
}
sql = `SELECT * FROM pay_fq WHERE order_no =:order_no`;
list = await this.customQuery(sql, {
order_no: actionBody.payInfo.order_no
});
if (!list || list.length === 0) {
// 插入 pay_fq
let data = {};
let keys = [
"order_no", "amount",
"pay_time", "pay_way_id",
"pay_way_name", "pay_way_type",
"pay_period", "transaction_id",
"transaction_no", "creator_id",
"creator", "create_time",
"set_of_books_id", "set_of_books_name",
"owner_id", "owner_name", "supplier_id",
"ownership_company", "channel_source",
"remark", "payment_item_id"
];
keys.forEach((item, index) => {
if (actionBody.payInfo[item]) {
data[item] = actionBody.payInfo[item]
}
})
sql = `INSERT INTO pay_fq (${Object.keys(data).join()}) VALUE (:${Object.keys(data).join(",:")}) `;
await this.customInsert(sql, data);
}
return system.getResultSuccess();
}
}
module.exports = FgbusinesschancService;
\ No newline at end of file
......@@ -80,10 +80,16 @@ class LogoOrderService {
var logodownRes = await this.getLogoDownUrl({
"id": deliveryContent.logo_id,
"title": deliveryContent.title,
"subtitle": deliveryContent.subtitle
"subtitle": deliveryContent.subtitle || ""
});
if(logodownRes && logodownRes.status==0 && logodownRes.data && logodownRes.data.down_url){
deliveryContent.down_url = logodownRes.data.down_url;
if(deliveryContent.color_description){
deliveryContent.color_description = deliveryContent.color_description.replace(/\"/g,"\\\"");;
}
if(deliveryContent.font_description){
deliveryContent.font_description = deliveryContent.font_description.replace(/\"/g,"\\\"");;
}
this.putOrderDelivery(deliveryContent,ab.orderNo);
return system.getResultSuccess(logodownRes.data.down_url);
}else{
......@@ -131,21 +137,27 @@ class LogoOrderService {
if(!ab.title){
return system.getResultFail(-105,"品牌名称不能为空");
}
if(!ab.subtitle){
return system.getResultFail(-106,"品牌标语不能为空");
}
// if(!ab.subtitle){
// return system.getResultFail(-106,"品牌标语不能为空");
// }
if(!ab.profession){
return system.getResultFail(-107,"行业名称不能为空");
}
if (!ab.description) {
return system.getResultFail(-108, "描述信息不能为空");
}
// if (!ab.description) {
// return system.getResultFail(-108, "描述信息不能为空");
// }
if (!ab.pic_url) {
return system.getResultFail(-109, "图标链接不能为空");
}
if (!ab.itemCode) {
return system.getResultFail(-110, "产品编码不能为空");
}
if(ab.color_description){
ab.color_description = ab.color_description.replace(/\"/g,"\\\"");;
}
if(ab.font_description){
ab.font_description = ab.font_description.replace(/\"/g,"\\\"");;
}
this.addCollectInfo(appInfo.uapp_id,userInfo.channel_userid,ab);
return system.getResultSuccess();
}
......
......@@ -329,18 +329,18 @@ class OrderInfoService extends ServiceBase {
return system.getResult(null, "logo_Id不能为空,20150");
}
deliveryData.logo_id = deliveryData.logo_id.toString();
if (!deliveryData.description) {
return system.getResult(null, "描述信息不能为空,20180");
}
// if (!deliveryData.description) {
// return system.getResult(null, "描述信息不能为空,20180");
// }
if (!deliveryData.pic_url) {
return system.getResult(null, "图标链接不能为空,20183");
}
if (!deliveryData.title) {
return system.getResult(null, "品牌名称不能为空,20184");
}
if (!deliveryData.subtitle) {
return system.getResult(null, "品牌标语不能为空,20183");
}
// if (!deliveryData.subtitle) {
// return system.getResult(null, "品牌标语不能为空,20183");
// }
return system.getResultSuccess(deliveryData);
}
async createLogoOrder(pobj) {
......@@ -348,6 +348,12 @@ class OrderInfoService extends ServiceBase {
if (packagingTmResult.status != 0) {
return packagingTmResult;
}
if(pobj.actionBody.deliveryData.color_description){
pobj.actionBody.deliveryData.color_description = pobj.actionBody.deliveryData.color_description.replace(/\"/g,"\\\"");;
}
if(pobj.actionBody.deliveryData.font_description){
pobj.actionBody.deliveryData.font_description = pobj.actionBody.deliveryData.font_description.replace(/\"/g,"\\\"");;
}
pobj.actionBody.deliveryData.itemCode="znlogosjcp";
var sql = "SELECT * FROM "+
"( SELECT sourceOrderNo FROM `c_order_delivery` WHERE deliveryContent -> '$.logo_id' = "+ pobj.actionBody.deliveryData.logo_id+
......
......@@ -73,9 +73,9 @@ class NeedsolutionService extends ServiceBase {
if(!solution.companyCategory){
return system.getResultFail(-108,"纳税人类型不能为空");
}
if(!solution.companyType){
return system.getResultFail(-109,"公司性质不能为空");
}
// if(!solution.companyType){
// return system.getResultFail(-109,"公司性质不能为空");
// }
if(!solution.orgType){
return system.getResultFail(-110,"组织类型不能为空");
}
......
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