Commit 2c7367f6 by linboxuan

tmBatchUpload update

parent 9170d35a
......@@ -177,40 +177,35 @@ class TrademarktransactionService extends ServiceBase {
* {
"status": 1,
"message": "success",
"data": [
{
"id": 175625,
"code": "123123",
"name": "商标名字",//商标名称 这个是es真实的商标名字
"channel_code": "18",
"channel_name": "ali",
"excelName": "商标名字",// 上传时的商标名
"tm_applier": "18",
"ncl_one_code": "ali",
"business_quoted_price": "123",
"platform_quoted_price": "123",
"pic_url": "123",
"publish_status_name": "审核中",
"publish_status": "audit",
"tm_group": "123",
"tm_service_item": "123",
"tm_introduction": "123",
"tm_start_day": "0122-12-31T15:54:17.000Z",
"tm_end_day": "0122-12-31T15:54:17.000Z",
"contacts": "13911391996",
"mobile": "13911391996",
"notes": "13911391996",
"op_notes": "13911391996",
"trademark_type_name": "普通商标",
"trademark_type": "ordinary",
"tm_regist_day": "123",
"tm_ncl_third": "123",
"created_at": "2020-09-03T08:43:35.602Z",
"updated_at": "2020-09-03T08:43:35.602Z",
"version": 0
}
],
"requestId": "8e1f04d0-edc1-11ea-8143-5f78fb49f643"
"data": {
"tm": [
{
"id": 175706,
"code": "224262441",
"name": "阿里",
"channel_code": 10,
"channel_name": "公司宝",
"tm_applier": "公司宝",
"ncl_one_code": "31",
"business_quoted_price": "12341",
"pic_url": null,
"publish_status": "audit",
"tm_service_item": "",
"tm_start_day": null,
"tm_end_day": null,
"contacts": "1234",
"mobile": "1324",
"trademark_type_name": "普通商标",
"trademark_type": "ordinary",
"tm_regist_day": "",
"created_at": "2020-09-09T09:05:53.482Z",
"updated_at": "2020-09-09T09:05:53.482Z",
"version": 0
}
],
"successCount": 1
},
"requestId": "a9fb7670-f27b-11ea-8a62-1d06e253dc40"
}
* @apiErrorExample {json} 失败示例:
* {"error": ""}
......@@ -227,8 +222,35 @@ class TrademarktransactionService extends ServiceBase {
let objlist = await this.addbaseinfo(actionbody.tm);
// console.log(objlist);
// console.log("-------------------------")
// 2020 0909 lin 新增功能 查询code是否存在如果价格 高于之前的code 就价格异常
// count作为插入成功数量
var count = 0;
for(var i = 0;i < objlist.length;i++) {
var tmInfo = await this.dao.model.findOne({
where: {
channel_code: objlist[i].channel_code,
code: objlist[i].code,
},
attributes: [
"id",
"business_quoted_price"
],
raw: true
});
if(tmInfo) {
if(tmInfo.business_quoted_price < objlist[i].business_quoted_price) {
objlist[i]["publish_status"] = "fail"
continue;
}
}
count++;
}
let res = await this.dao.model.bulkCreate(objlist);
return system.getResultSuccess(res);
var data = {
tm : res,
successCount: count
}
return system.getResultSuccess(data);
}
/**
......
......@@ -30,7 +30,7 @@ module.exports = {
"330":"已作废"},
need_status:{1:"已提交",2:"待顾问反馈",3:"待用户确认",4:"已完成",5:"已关闭"},
license_type:{"1":"ICP资质",2:"EDI资质"},
publish_status: {"audit": "审核中", "uppershelf": "上架", "lowershelf": "下架", "haltsales":"停售","oversales":"已出售","addbaseinfo":"待补充信息"},// 剩余几个人是什么?fail,success
publish_status: {"audit": "审核中", "uppershelf": "上架", "lowershelf": "下架", "haltsales":"停售","oversales":"已出售","addbaseinfo":"待补充信息","fail":"发布失败"},// 剩余几个人是什么?fail,success
trademark_type: {"ordinary":"普通商标","specialoffer":"特价","highquality":"精品","hot":"热门","recommended":"推荐"}
}
}
\ 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