Commit d6392ca1 by linboxuan

tmBatchUpload update

parent ef0b68db
...@@ -33,7 +33,10 @@ module.exports = (db, DataTypes) => { ...@@ -33,7 +33,10 @@ module.exports = (db, DataTypes) => {
// this.setDataValue("tm_status_name", uiconfig.config.pdict.tm_company_type[val]); // this.setDataValue("tm_status_name", uiconfig.config.pdict.tm_company_type[val]);
// } // }
// }, // },
publish_status_name:DataTypes.STRING(50),//商标发布状态名称 publish_status_name:{
type:DataTypes.STRING(50),
defaultValue: "审核中",
},//商标发布状态名称
publish_status:{ publish_status:{
type: DataTypes.ENUM, type: DataTypes.ENUM,
values: Object.keys(PDICT.publish_status), values: Object.keys(PDICT.publish_status),
...@@ -52,7 +55,10 @@ module.exports = (db, DataTypes) => { ...@@ -52,7 +55,10 @@ module.exports = (db, DataTypes) => {
mobile:DataTypes.STRING(50),//联系电话 mobile:DataTypes.STRING(50),//联系电话
notes: DataTypes.STRING,//备注 1 notes: DataTypes.STRING,//备注 1
op_notes: DataTypes.STRING(50),//操作备注 1 op_notes: DataTypes.STRING(50),//操作备注 1
trademark_type_name: DataTypes.STRING(50),// 商标类型 trademark_type_name: {
type:DataTypes.STRING(50),
defaultValue: "普通商标",
},// 商标类型
trademark_type:{//{"ordinary":"普通商标","specialoffer":"特价","highquality":"精品","hot":"热门","recommended":"推荐"} trademark_type:{//{"ordinary":"普通商标","specialoffer":"特价","highquality":"精品","hot":"热门","recommended":"推荐"}
type: DataTypes.ENUM, type: DataTypes.ENUM,
values: Object.keys(PDICT.trademark_type), values: Object.keys(PDICT.trademark_type),
......
...@@ -243,6 +243,8 @@ class TrademarktransactionService extends ServiceBase { ...@@ -243,6 +243,8 @@ class TrademarktransactionService extends ServiceBase {
continue; continue;
} }
} }
// 2020 0910 lin 新增 platform_quoted_price = business_quoted_price * 1.2 + 1000
objlist[i].platform_quoted_price = Number(objlist[i].business_quoted_price) * 1.2 + 1000;
count++; count++;
} }
let res = await this.dao.model.bulkCreate(objlist); let res = await this.dao.model.bulkCreate(objlist);
...@@ -429,6 +431,112 @@ class TrademarktransactionService extends ServiceBase { ...@@ -429,6 +431,112 @@ class TrademarktransactionService extends ServiceBase {
var tmDetail = await this.dao.findById(actionBody.tmId); var tmDetail = await this.dao.findById(actionBody.tmId);
return system.getResultSuccess(tmDetail); return system.getResultSuccess(tmDetail);
} }
/**
* @api {post} /tmtransaction/action/trademarktransaction/springBoard 标原批量上下架
* @apiGroup 标源管理
* @apiParamExample {json} 请求参数
* {
"actionType": "tmStatusUpdate",
"actionBody": {
tm:[
{
id:1,
code:1,
platform_quoted_price:1200
},{
id:2,
code;2,
platform_quoted_price:1200
}
],
status:"uppershelf/lowershelf"
}
}
* @apiSuccessExample {json} 成功示例:
* {
"status": 1,
"message": "success",
"data": {
"id": 175624,
"code": "123123",//唯一码 商标号
"name": "商标名字",//商标名称
"channel_code": "18",// 2020 0901 lin 新增 渠道号
"channel_name": null,// 2020 0901 lin 新增 渠道名字
"excelName": "123",//上传时的商标名
"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",//备注 1
"op_notes": "13911391996",//操作备注 1
"trademark_type_name": "普通商标",
"trademark_type": "ordinary",// 商标类型
"tm_regist_day": "123",
"tm_ncl_third": "123",
"created_at": "2020-09-03T03:08:24.000Z",
"updated_at": "2020-09-03T03:08:24.000Z",
"deleted_at": null,
"version": 0
},
"requestId": "164bce10-edbd-11ea-b4a6-c1bbab30b7b2"
}
* @apiErrorExample {json} 失败示例:
* {"error": ""}
*/
async tmStatusUpdate(pobj, actionBody) {
if (!pobj || !pobj.actionBody || !pobj.actionBody.tm) {
return system.getResultFail(-103, "参数错误");
}
if(actionBody.tm.length == 0) {
return system.getResultFail(-110, "标源id为空");
}
switch (actionBody.status) {
// 如果下架 全部下架
case "lowershelf" :
for(var i = 0;i <actionBody.tm.length;i++) {
actionBody.tm[i].publish_status = "lowershelf"
}
var tmUpdateResult = await this.dao.model.bulkCreate(actionBody.tm,{updateOnDuplicate:true})
break;
case "uppershelf":
var tmUpdateResult = []
// 如果上架 去查询code相同并上架的标源,价格低于,则上。否失败
for(var i = 0;i <actionBody.tm.length;i++) {
var tmInfo = await this.dao.model.findOne({
where: { code:actionBody.tm[i].code, publish_status:"uppershelf" },
attributes: [
"id",
"platform_quoted_price"
],
raw: true
});
if(actionBody.tm[i].platform_quoted_price < tmInfo.platform_quoted_price) {
//修改之前的为下架
tmInfo.publish_status = "lowershelf";
await this.dao.model.update(tmInfo)
//修改需要上架的
actionBody.tm[i].publish_status = "uppershelf";
await this.dao.model.update(actionBody.tm[i])
}
// 否则失败 暂时不做处理
}
break;
default:
return system.getResultFail(-111, "修改状态错误");
}
return system.getResultSuccess(tmUpdateResult);
}
/** /**
* @api {post} /tmtransaction/action/trademarktransaction/springBoard 修改 * @api {post} /tmtransaction/action/trademarktransaction/springBoard 修改
* @apiGroup 标源管理 * @apiGroup 标源管理
...@@ -477,7 +585,7 @@ class TrademarktransactionService extends ServiceBase { ...@@ -477,7 +585,7 @@ class TrademarktransactionService extends ServiceBase {
if (!pobj || !pobj.actionBody) { if (!pobj || !pobj.actionBody) {
return system.getResultFail(-106, "参数错误"); return system.getResultFail(-106, "参数错误");
} }
var res = this.dao.update(actionBody) var res = await this.dao.update(actionBody)
return system.getResultSuccess(res); return system.getResultSuccess(res);
} }
/** /**
......
...@@ -45,7 +45,7 @@ define({ "api": [ ...@@ -45,7 +45,7 @@ define({ "api": [
"examples": [ "examples": [
{ {
"title": "请求参数", "title": "请求参数",
"content": "{\n \t\"actionType\": \"tmInfo\",\n \t\"actionBody\": {\n \"channel_code\": \"18\"// 必填 渠道码 从中台权限获取到\n \"pageSize\":10,// 每页数量\n \"pageNumber\":4,// 页\n \"excelName\": \"商标名字\",// 商标名字 注意这里 name修改为execlName\n \"code\": \"商标号\",\n \"channel_name\": \"申请主体\"\n \"stdate\":\"2020-09-02 11:30:11\",// 专用期限 需要同时传参\n\t\t \"endate\":\"2020-09-02 11:35:11\"\n \t}\n }", "content": "{\n \t\"actionType\": \"tmInfo\",\n \t\"actionBody\": {\n \"channel_code\": \"18\"// 必填 渠道码 从中台权限获取到\n \"pageSize\":10,// 每页数量\n \"pageNumber\":4,// 页\n \"excelName\": \"商标名字\",// 商标名字 注意这里 name修改为execlName\n \"code\": \"商标号\",\n \"channel_name\": \"申请主体\"\n \"stdate\":\"2020-09-02 11:30:11\",// 专用期限 需要同时传参\n \"endate\":\"2020-09-02 11:35:11\",\n \"tmList\":[\"175672\",\"175673\"]\n \t}\n }",
"type": "json" "type": "json"
} }
] ]
......
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
"examples": [ "examples": [
{ {
"title": "请求参数", "title": "请求参数",
"content": "{\n \t\"actionType\": \"tmInfo\",\n \t\"actionBody\": {\n \"channel_code\": \"18\"// 必填 渠道码 从中台权限获取到\n \"pageSize\":10,// 每页数量\n \"pageNumber\":4,// 页\n \"excelName\": \"商标名字\",// 商标名字 注意这里 name修改为execlName\n \"code\": \"商标号\",\n \"channel_name\": \"申请主体\"\n \"stdate\":\"2020-09-02 11:30:11\",// 专用期限 需要同时传参\n\t\t \"endate\":\"2020-09-02 11:35:11\"\n \t}\n }", "content": "{\n \t\"actionType\": \"tmInfo\",\n \t\"actionBody\": {\n \"channel_code\": \"18\"// 必填 渠道码 从中台权限获取到\n \"pageSize\":10,// 每页数量\n \"pageNumber\":4,// 页\n \"excelName\": \"商标名字\",// 商标名字 注意这里 name修改为execlName\n \"code\": \"商标号\",\n \"channel_name\": \"申请主体\"\n \"stdate\":\"2020-09-02 11:30:11\",// 专用期限 需要同时传参\n \"endate\":\"2020-09-02 11:35:11\",\n \"tmList\":[\"175672\",\"175673\"]\n \t}\n }",
"type": "json" "type": "json"
} }
] ]
......
...@@ -9,7 +9,7 @@ define({ ...@@ -9,7 +9,7 @@ define({
"apidoc": "0.3.0", "apidoc": "0.3.0",
"generator": { "generator": {
"name": "apidoc", "name": "apidoc",
"time": "2020-09-09T09:09:34.947Z", "time": "2020-09-09T09:42:23.263Z",
"url": "https://apidocjs.com", "url": "https://apidocjs.com",
"version": "0.25.0" "version": "0.25.0"
} }
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
"apidoc": "0.3.0", "apidoc": "0.3.0",
"generator": { "generator": {
"name": "apidoc", "name": "apidoc",
"time": "2020-09-09T09:09:34.947Z", "time": "2020-09-09T09:42:23.263Z",
"url": "https://apidocjs.com", "url": "https://apidocjs.com",
"version": "0.25.0" "version": "0.25.0"
} }
......
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