Commit b2ab1870 by wkliang

use ent deliver

parent a59ddef7
var system = require("../../../system")
const CtlBase = require("../../ctl.base");
class DeliverybillCtl extends CtlBase {
constructor() {
super("rejreex", CtlBase.getServiceName(DeliverybillCtl));
}
async test () {
console.log('test------')
return system.getResult('test')
}
async createDeliver(pobj, qobj, req) { // 接收中台推送?
await this.service.createDeliver(pobj)
}
async findAndCountAll(pobj, qobj, req) {
try {
let result = await this.service.getList(pobj)
return system.getResultSuccess(result)
} catch (error) {
return system.getResultFail(error.message)
}
}
}
module.exports = DeliverybillCtl;
......@@ -23,7 +23,6 @@ class TrademarkcaseCtl extends CtlBase {
async getCase (pobj, qobj, req) {
try {
console.log(pobj)
let caseId = pobj.caseId
let result = await this.service.getCase(caseId)
return system.getResultSuccess(result)
......@@ -44,6 +43,15 @@ class TrademarkcaseCtl extends CtlBase {
}
}
async createOffical(pobj, qobj, req) {
try {
let result = await this.service.createOffical(pobj)
return system.getResultSuccess(result)
} catch (error) {
return system.getResultFail(error.message)
}
}
async pushQfTest(pobj, qobj, req) {
return await this.service.pushQf(pobj.id)
}
......
......@@ -15,7 +15,7 @@ class DbFactory {
this.initModels();
this.initRelations();
}
async initModels() {
async initModels () {
var self = this;
var modelpath = path.normalize(path.join(__dirname, '../..')) + "/models/";
var models = glob.sync(modelpath + "/**/*.js");
......@@ -26,12 +26,12 @@ class DbFactory {
});
console.log("init models....");
}
async initRelations() {
async initRelations () {
this.db.models.dataauth.belongsTo(this.db.models.user, { constraints: false, });
/*建立用户和角色之间的关系*/
this.db.models.user.belongsToMany(this.db.models.role, { as: "Roles", through: 'p_userrole', constraints: false, });
this.db.models.role.belongsToMany(this.db.models.user, { as: "Users", through: 'p_userrole', constraints: false, });
/*组织机构自引用*/
//this.db.models.org.belongsTo(this.db.models.org,{constraints: false,});
//this.db.models.org.hasMany(this.db.models.org,{constraints: false,});
......@@ -59,9 +59,13 @@ class DbFactory {
this.db.models.user.belongsTo(this.db.models.company, { constraints: false, });
this.db.models.role.belongsTo(this.db.models.company, { constraints: false, });
// this.db.models.org.belongsTo(this.db.models.company,{constraints: false,});
// 交付单关联材料
this.db.models.trademarkcase.belongsTo(this.db.models.deliverybill, { foreignKey: 'deliverId', constraints: false })
this.db.models.deliverybill.hasOne(this.db.models.trademarkcase, { foreignKey: 'deliverId', constraints: false })
}
//async getCon(){,用于使用替换table模型内字段数据使用
getCon() {
getCon () {
var that = this;
// await this.db.authenticate().then(()=>{
// console.log('Connection has been established successfully.');
......
const system = require("../../../system");
const Dao = require("../../dao.base");
class CacheinfoDao extends Dao {
constructor() {
super(Dao.getModelName(CacheinfoDao));
}
// extraWhere(qobj, qw, qc) {//根据业务员id获取商机信息的组装条件
// qc.raw = true;
// qc.where.business_type = qc.where.business_type || {
// [this.db.Op.notIn]: ["ICP", "EDI"]
// }
// if(qobj.bizpath && qobj.bizpath!=""){
// if(qobj.bizpath.indexOf("myChance")>0){//说明是从商机列表过来的
// qw["salesman_id"]=qobj.userid;
// }
// }
// return qw;
// }
/*根据订单id获取缓存信息详情*/
async findInfoByDeliverId(qobj){
var qcwhere = {"deliver_id":qobj.deliverNumber};
return await this.findOne(qcwhere);
}
/*更加订单id更新缓存信息*/
async updateInfoByDeliverId(qobj,t){
var setobj = {"cache_info":qobj.cacheInfo};
var whereobj = {"deliver_id":qobj.deliverNumber};
return await this.updateByWhere(setobj,whereobj,t);
}
/*插入缓存信息*/
async insertInfo(qobj,t){
var obj = {
"deliver_id":qobj.deliverNumber,
"cache_info":qobj.cacheInfo
};
return await this.create(obj,t);
}
}
module.exports = CacheinfoDao;
const system = require("../../../system");
const Dao = require("../../dao.base");
class DeliverybillDao extends Dao {
constructor() {
super(Dao.getModelName(DeliverybillDao));
}
extraModelFilter(pobj) {
return { "key": "include", "value": { model: this.db.models.settlebill, raw: true, attributes: ['memo'] } };
}
extraWhere(qobj, qw, qc) {//根据业务员id获取交付单信息的组装条件
// qc.order.unshift(['v_noticeDate', 'DESC'])
// switch (qobj.bizpath) {
// case '/dealaskfor/examine':
// qw.tradeStatus = '待审核'
// break
// case '/dealaskfor/refer':
// qw.tradeStatus = '申请递交中'
// break
// case '/myaskfor/pendingservice':
// qw.tradeStatus = '待完善材料'
// break
// case '/rejaskmanage/officalManager':
// qw.offical = { [this.db.Op.ne]: null }
// break
// }
qc.raw = true;
return qw;
}
/*根据交付单编号获取订单详情*/
async findInfoByDeliverCode(qobj) {
var qcwhere = { "delivery_code": qobj.deliverNumber };
return await this.findOne(qcwhere);
}
/*根据交付单编号更新状态信息*/
async updateStatusByDeliverCode(qobj, t) {
var setobj = { "delivery_status": qobj.deliverStatus };
if (qobj.statusReason && qobj.statusReason != 'undefined') {
setobj.close_reason = qobj.statusReason;
}
else {
setobj.close_reason = "";
}
var whereobj = { "delivery_code": qobj.deliverNumber };
var rs = await this.findOne(whereobj);
if (rs && rs != 'undefined') {
if (qobj.deliverStatus == "collecting" || qobj.deliverStatus == "received" || qobj.deliverStatus == "paid") {
rs.delivery_info.payStatus = "待交付";
}
else if (qobj.deliverStatus == "closed") {
rs.delivery_info.payStatus = "已关闭";
}
else {
rs.delivery_info.payStatus = "已交付";
}
setobj.delivery_info = rs.delivery_info;
}
return await this.updateByWhere(setobj, whereobj, t);
}
/*更新业务员信息*/
async updateSalesmanInfoByDeliverCode(qobj, t) {
var setobj = {};
if (qobj.salesmanId && qobj.salesmanId != 'undefined') {
setobj.salesman_id = qobj.salesmanId;
};
if (qobj.salesmanName && qobj.salesmanName != 'undefined') {
setobj.salesman_name = qobj.salesmanName;
};
if (qobj.salesmanOpcode && qobj.salesmanOpcode != 'undefined') {
setobj.salesman_opcode = qobj.salesmanOpcode;
};
if (qobj.salesmanPhone && qobj.salesmanPhone != 'undefined') {
setobj.salesman_phone = qobj.salesmanPhone;
};
if (qobj.facilitatorId && qobj.facilitatorId != 'undefined') {
setobj.facilitator_id = qobj.facilitatorId;
};
if (qobj.facilitatorName && qobj.facilitatorName != 'undefined') {
setobj.facilitator_name = qobj.facilitatorName;
};
var whereobj = { "delivery_code": qobj.deliverNumber };
return await this.updateByWhere(setobj, whereobj, t);
}
/*根据交付单更新交付材料信息*/
async updateInfoByDeliverCode(qobj, t) {//公司注册、云上园区注册时填写交付材料
var whereobj = { "delivery_code": qobj.deliverNumber };
var setobj = { "delivery_info": qobj.baseInfo };
if (qobj.deliverStatus && qobj.deliverStatus != 'undefined') {
setobj.delivery_status = qobj.deliverStatus;
}
if (qobj.statusReason && qobj.statusReason != 'undefined') {
setobj.close_reason = qobj.statusReason;
}
else {
setobj.close_reason = "";
}
return await this.updateByWhere(setobj, whereobj, t);
}
/*插入交付单信息*/
async insertInfo(qobj, t) {//到时候看交付单信息后再确定
var obj = {
"delivery_code": qobj.deliverNumber,
"delivery_status": qobj.deliverStatus,
"delivery_info": qobj.baseInfo
};
if (qobj.businessMode && qobj.businessMode != 'undefined') {
obj.demand_code = qobj.businessMode;
}
if (qobj.schemeNumber && qobj.schemeNumber != 'undefined') {
obj.scheme_number = qobj.schemeNumber;
}
if (qobj.businessName && qobj.businessName != 'undefined') {
obj.product_name = qobj.businessName;
}
if (qobj.businessType && qobj.businessType != 'undefined') {
obj.product_code = qobj.businessType;
}
if (qobj.txOrderNum && qobj.txOrderNum != 'undefined') {
obj.master_source_number = qobj.txOrderNum;
}
if (qobj.channelSource && qobj.channelSource != 'undefined') {
obj.source_name = qobj.channelSource;
}
if (qobj.channelNumber && qobj.channelNumber != 'undefined') {
obj.source_number = qobj.channelNumber;
}
if (qobj.skuCode && qobj.skuCode != 'undefined') {
obj.sku_code = qobj.skuCode;
}
if (qobj.serviceCode && qobj.serviceCode != 'undefined') {
obj.service_address = qobj.serviceCode;
}
if (qobj.servicerCode && qobj.servicerCode != 'undefined') {
obj.facilitator_id = qobj.servicerCode;
}
if (qobj.servicerName && qobj.servicerName != 'undefined') {
obj.facilitator_name = qobj.servicerName;
}
if (qobj.clerkName && qobj.clerkName != 'undefined') {
obj.salesman_name = qobj.clerkName;
}
if (qobj.clerkPhone && qobj.clerkPhone != 'undefined') {
obj.salesman_phone = qobj.clerkPhone
}
if (qobj.clerkOpcode && qobj.clerkOpcode != 'undefined') {
obj.salesman_opcode = qobj.clerkOpcode;
}
if (qobj.clerkId && qobj.clerkId != 'undefined') {
obj.salesman_id = qobj.clerkId;
}
if (qobj.sellingPrice && qobj.sellingPrice != 'undefined') {
obj.selling_price = qobj.sellingPrice;
}
if (qobj.costPrice && qobj.costPrice != 'undefined') {
obj.cost_price = qobj.costPrice;
}
if (qobj.statusReason && qobj.statusReason != 'undefined') {
obj.close_reason = qobj.statusReason;
}
return await this.create(obj, t);
}
}
module.exports = DeliverybillDao;
const system = require("../../../system");
const Dao = require("../../dao.base");
class MaterialDao extends Dao {
constructor() {
super(Dao.getModelName(MaterialDao));
}
/*根据交付单编号获取注册材料信息详情*/
async findInfoByDeliverNumber(qobj) {
var qcwhere = { "delivery_code": qobj.deliverNumber };
return await this.findOne(qcwhere);
}
/* 根据id更新zip信息 */
async updateZipById(qobj, t) {
try{
var whereobj = { "id": qobj.id };
var setobj= {
"is_download":1,
"download_url":qobj.url
};
return await this.updateByWhere(setobj, whereobj, t);
}
catch(error){
console.log("error----------" + error);
return error;
}
}
/*根据交付单编号更新交材料详情*/
async updateInfoByDeliverNumber(qobj, t) {
var whereobj = { "delivery_code": qobj.deliverNumber };
var setobj = {};
if (qobj.companyInfo && qobj.companyInfo != 'undefined') {
setobj.company_info = qobj.companyInfo;
}
if (qobj.registeredInfo && qobj.registeredInfo != 'undefined') {
setobj.registered_info = qobj.registeredInfo;
}
if (qobj.contributionInfo && qobj.contributionInfo != 'undefined') {
setobj.contribution_info = qobj.contributionInfo;
}
if (qobj.positionInfo && qobj.positionInfo != 'undefined') {
setobj.position_info = qobj.positionInfo;
}
if (qobj.managerInfo && qobj.managerInfo != 'undefined') {
setobj.position_info = qobj.managerInfo;
}
if (qobj.regInfo && qobj.regInfo != 'undefined') {
setobj.file_info = qobj.regInfo;
}
if (qobj.expressInfo && qobj.expressInfo != 'undefined') {
setobj.express_info = qobj.expressInfo;
}
return await this.updateByWhere(setobj, whereobj, t);
}
/*插入注册材料信息*/
async insertInfo(pobj, t) {//公司注册,云上园区注册时的信息
var obj = {
"delivery_code": pobj.deliverNumber
};
if (pobj.deliverId && pobj.deliverId != 'undefined') {
obj["delivery_id"] = pobj.deliverId;
}
if (pobj.companyInfo && pobj.companyInfo != 'undefined') {
obj.company_info = pobj.companyInfo;
}
if (pobj.registeredInfo && pobj.registeredInfo != 'undefined') {
obj.registered_info = pobj.registeredInfo;
}
if (pobj.positionInfo && pobj.positionInfo != 'undefined') {
obj.position_info = pobj.positionInfo;
}
if (pobj.regInfo && pobj.regInfo != 'undefined') {
obj.file_info = pobj.regInfo;
}
if (pobj.expressInfo && pobj.expressInfo != 'undefined') {
obj.express_info = pobj.expressInfo;
}
return await this.create(obj, t);
}
}
module.exports = MaterialDao;
const system = require("../../../system");
const Dao = require("../../dao.base");
class SalesmanhisDao extends Dao {
constructor() {
super(Dao.getModelName(SalesmanhisDao));
}
/*插入状态信息信息*/
async insertInfo(qobj,t){
var obj = {
"flow_type":qobj.flowType,
"flow_id":qobj.flowId,
"flow_code":qobj.flowCode,
"salesman_info":qobj.salesmanInfo
};
return await this.create(obj,t);
}
}
module.exports = SalesmanhisDao;
const system = require("../../../system");
const Dao = require("../../dao.base");
class SchemeDao extends Dao {
constructor() {
super(Dao.getModelName(SchemeDao));
}
/*根据商机编号获取方案信息详情*/
async findInfoByDemandCode(qobj){
var qcwhere = {"demand_code":qobj.businessMode};
return await this.findOne(qcwhere);
}
/*根据方案编号更新方案状态及原因*/
async updateStatusByDemandCode(qobj,t){
var setobj = {"scheme_status":qobj.currentStatus};
if (qobj.statusReason && qobj.statusReason != 'undefined'){
setobj["reject_reason"] = qobj.statusReason;
}
else{
setobj["reject_reason"] = "";
}
var whereobj = {"demand_code":qobj.businessMode};
return await this.updateByWhere(setobj,whereobj,t);
}
/*根据商机编号更新方案详情*/
async updateInfoByDemandCode(qobj,t){
var whereobj = {"demand_code":qobj.businessMode};
var setobj = {"scheme_info":qobj.baseInfo,"scheme_status":qobj.currentStatus};
if (qobj.schemeNumber && qobj.schemeNumber != 'undefined'){
setobj.scheme_number = qobj.schemeNumber;
}
if (qobj.statusReason && qobj.statusReason != 'undefined'){
setobj.reject_reason = qobj.statusReason;
}
else{
setobj.reject_reason = "";
}
return await this.updateByWhere(setobj,whereobj,t);
}
/*根据方案编号更新方案编号*/
async updateSchemeNumberByDemandCode(qobj,t){
var setobj = {"scheme_number":qobj.schemeNumber};
var whereobj = {"demand_code":qobj.businessMode};
return await this.updateByWhere(setobj,whereobj,t);
}
/*插入方案信息*/
async insertInfo(qobj,t){
var obj = {
"demand_code":qobj.businessMode,
"scheme_info":qobj.baseInfo
};
if (qobj.currentStatus && qobj.currentStatus != 'undefined'){
obj["scheme_status"] = qobj.currentStatus;
}
if (qobj.schemeNumber && qobj.schemeNumber != 'undefined'){
obj["scheme_number"] = qobj.schemeNumber;
}
if (qobj.statusReason && qobj.statusReason != 'undefined'){
obj["reject_reason"] = qobj.statusReason;
}
if (qobj.memoInfo && qobj.memoInfo != 'undefined'){
obj["remark_info"] = qobj.memoInfo;
}
if (qobj.businessId && qobj.businessId != 'undefined'){
obj["bizopt_id"] = qobj.businessId;
}
if (qobj.servicerCode && qobj.servicerCode != 'undefined'){
obj["facilitator_id"] = qobj.servicerCode;
}
if (qobj.servicerName && qobj.servicerName != 'undefined'){
obj["facilitator_name"] = qobj.servicerName;
}
if (qobj.clerkOpcode && qobj.clerkOpcode != 'undefined'){
obj["salesman_opcode"] = qobj.clerkOpcode;
}
if (qobj.clerkId && qobj.clerkId != 'undefined'){
obj["salesman_id"] = qobj.clerkId;
}
if (qobj.clerkName && qobj.clerkName != 'undefined'){
obj["salesman_name"] = qobj.clerkName;
}
if (qobj.clerkPhone && qobj.clerkPhone != 'undefined'){
obj["salesman_phone"] = qobj.clerkPhone;
}
return await this.create(obj,t);
}
}
module.exports = SchemeDao;
const system = require("../../../system");
const Dao = require("../../dao.base");
class SettlebillDao extends Dao {
constructor() {
super(Dao.getModelName(SettlebillDao));
}
extraWhere(qobj, qw, qc) {//根据业务员id获取交付单信息的组装条件
//qc.raw = true;
//检查查询的用户所属公司是否是平台运营公司-1,如果是则不添加公司查询条件, 不添加路径条件,返回所有数据
if (qobj.company_id == 1) {
return qw
} else {
//需要添加公司查询条件
qw["facilitator_id"] = Number(qobj.company_id)
}
return qw;
}
}
module.exports = SettlebillDao;
const system = require("../../../system");
const Dao = require("../../dao.base");
class StatuslogDao extends Dao {
constructor() {
super(Dao.getModelName(StatuslogDao));
}
/*插入状态信息信息*/
async insertInfo(qobj,t){
var obj = {
"flow_type":qobj.flowType,
"flow_id":qobj.flowId,
"status_code":qobj.statusCode
};
if (qobj.statusReason && qobj.statusReason != 'undefined'){
obj.status_reason = qobj.statusReason;
}
else{
obj.status_reason = "";
}
if (qobj.clerkName && qobj.clerkName != 'undefined'){
obj.salesman_name = qobj.clerkName;
}
if (qobj.clerkId && qobj.clerkId != 'undefined'){
obj.salesman_id = qobj.clerkId;
}
return await this.create(obj,t);
}
}
module.exports = StatuslogDao;
......@@ -5,10 +5,10 @@ class TrademarkcaseDao extends Dao {
super(Dao.getModelName(TrademarkcaseDao));
}
extraWhere (qobj, qw, qc, linkAttrs) {
// console.log("qobj", qobj)
// console.log("qw", qw)
// console.log("qc", qc)
// console.log("linkarr", linkAttrs)
console.log("qobj", qobj)
console.log("qw", qw)
console.log("qc", qc)
console.log("linkarr", linkAttrs)
console.log(qobj.bizpath)
qc.order.unshift(['v_noticeDate', 'DESC'])
switch (qobj.bizpath) {
......
/* jshint indent: 2 */
module.exports = function (sequelize, DataTypes) {
return sequelize.define('tmrejaskcase', {
schemeNumber: DataTypes.STRING,
askforId: DataTypes.STRING,
tradeType: DataTypes.STRING,
tradeImg: DataTypes.STRING,
tradeStatus: DataTypes.STRING,
returnReason: DataTypes.STRING,
usccode: DataTypes.STRING,
agentName: DataTypes.STRING,
trademarkRejInfo: DataTypes.JSON,
applicant: DataTypes.JSON,
askForData: DataTypes.JSON,
supData: DataTypes.JSON,
offical: DataTypes.JSON,
recDate: DataTypes.DATE,
askforDate: DataTypes.DATE,
v_noticeDate: DataTypes.DATE,
v_applicantName: DataTypes.STRING,
caStatus: DataTypes.STRING,
rejStatus: DataTypes.STRING,
schemeId: DataTypes.INTEGER,
}, {
paranoid: true,
underscored: true,
timestamps: true,
version: true,
freezeTableName: true,
tableName: 'tmrejask_case'
});
};
......@@ -19,7 +19,8 @@ module.exports = function (sequelize, DataTypes) {
recDate: DataTypes.DATE,
askforDate: DataTypes.DATE,
caStatus: DataTypes.STRING,
rejStatus: DataTypes.STRING
rejStatus: DataTypes.STRING,
deliverId: DataTypes.STRING
}, {
paranoid: true,
underscored: true,
......
const system = require("../../../system");
const ServiceBase = require("../../sve.base");
const settings = require('../../../../config/settings')
class DeliverybillService extends ServiceBase {
constructor() {
super("rejreex", ServiceBase.getDaoName(DeliverybillService))
this.restClient = system.getObject("util.restClient")
this.tmDao = system.getObject("db.rejreex.trademarkcaseDao")
this.tkurl = settings.qftkurl()
this.qfurl = settings.qifuurl()
}
async createDeliver (params) {
let tmData = params.delivery_info
return await this.db.transaction(async t => {
// 交付单表
let res = await this.dao.insertInfo(params)
// 商标关联表
tmData.deliverId = res.id
tmData.deliveryCode = params.delivery_code
await this.tmDao.create(tmData)
// 状态日志?
})
}
async updateStatusByDeliverCode (qobj) {//* 根据交付单编号更新交付单状态 */
var self = this;
return self.db.transaction(async function (t) {
return await self.dao.updateStatusByDeliverCode(qobj, t);
});
}
/*更新业务员信息*/
async updateSalesmanInfoByDeliverCode (qobj) {
var self = this;
return self.db.transaction(async function (t) {
return await self.dao.updateSalesmanInfoByDeliverCode(qobj, t);
});
}
async updateInfoByDeliverCode (qobj) {//*更新交付单信息 */
console.log("--------------------------------------------------------------------------------------------------------------------------------------");
var self = this;
return self.db.transaction(async function (t) {
let res = await this.dao.findOne({ delivery_code: qobj.deliverNumber })
await self.tmDao.update(qobj.tmData, { deliverId: res.id })
return await self.dao.updateInfoByDeliverCode(qobj, t);
});
}
async getList (pobj) {
console.log(pobj)
let parentWhere = {}
let childWhere = pobj.search
if (pobj.opath && pobj.opath != "") {
if(pobj.opath == '???') {
parentWhere.salesman_id = pobj.userid
}
}
switch (pobj.bizpath) {
case '/dealaskfor/examine':
childWhere.tradeStatus = '待审核'
break
case '/dealaskfor/refer':
childWhere.tradeStatus = '申请递交中'
break
case '/myaskfor/pendingservice':
childWhere.tradeStatus = '待完善材料'
break
case '/rejaskmanage/officalManager':
childWhere.offical = { [this.db.Op.ne]: null }
break
}
let query = {
where: parentWhere,
include: [{
model: this.tmDao.model,
where: childWhere
}],
order: [[this.tmDao.model, 'v_noticeDate', 'DESC']],
offset: (pobj.pageInfo.pageNo - 1) * pobj.pageInfo.pageSize,
limit: pobj.pageInfo.pageSize,
}
let result = await this.dao.model.findAndCountAll(query)
return result
}
}
module.exports = DeliverybillService;
......@@ -4,8 +4,6 @@ const settings = require('../../../../config/settings')
class TrademarkcaseService extends ServiceBase {
constructor() {
super("rejreex", ServiceBase.getDaoName(TrademarkcaseService))
this.agentDao = system.getObject("db.rejreex.agentDao")
this.applicantDao = system.getObject('db.rejreex.applicantDao')
this.restClient = system.getObject("util.restClient")
this.tkurl = settings.qftkurl()
this.qfurl = settings.qifuurl()
......@@ -36,12 +34,21 @@ class TrademarkcaseService extends ServiceBase {
}
if (params.usccode && params.applicant && params.applicant.applicantName) {
let sql = ""
sql = `UPDATE trademarkcase SET applicant=json_set(applicant, '$.applicantName', "${params.applicant.applicantName}"), ${params.tradeType ? `tradeType=${params.tradeType}` : ""}, ${params.usccode ? `usccode="${params.usccode}"` : ""}, ${params.agentName ? `agentName="${params.agentName}"` : ""}, ${params.askforId ? `askforId="${params.askforId}"` : ""} WHERE id = ${params.id};`
// this.pushQf(params.id)
if(dt.applicant) {
sql = `UPDATE tmrejask_info SET applicant=json_set(applicant, '$.applicantName', "${params.applicant.applicantName}"), ${params.tradeType ? `tradeType=${params.tradeType}` : ""}, ${params.usccode ? `usccode="${params.usccode}"` : ""}, ${params.agentName ? `agentName="${params.agentName}"` : ""}, ${params.askforId ? `askforId="${params.askforId}"` : ""} WHERE id = ${params.id};`
} else {
sql = `UPDATE tmrejask_info SET applicant=json_object(applicant, '$.applicantName', "${params.applicant.applicantName}"), ${params.tradeType ? `tradeType=${params.tradeType}` : ""}, ${params.usccode ? `usccode="${params.usccode}"` : ""}, ${params.agentName ? `agentName="${params.agentName}"` : ""}, ${params.askforId ? `askforId="${params.askforId}"` : ""} WHERE id = ${params.id};`
}
return await this.dao.customExecAddOrPutSql(sql);
} else {
// this.pushQf(params.id)
return await this.dao.update(params)
} else {
let res = await this.dao.update(params)
if (params.tradeStatus) {
if (['待完善材料', '已接单'].indexOf(params.tradeStatus) == -1) {
this.pushQf(params.id)
}
}
return res
}
} else {
if (params.askForData && params.askForData.rmLicense) {
......@@ -56,7 +63,14 @@ class TrademarkcaseService extends ServiceBase {
}
}
async createOffical (data) {
let res = await this.dao.update(data)
this.pushOff(data.id)
return res
}
async getCase (id) {
console.log(this.dao)
let query = {
where: {
caseId: id
......@@ -103,6 +117,44 @@ class TrademarkcaseService extends ServiceBase {
}
}
async pushOff (id) {
let tmpdata = await this.dao.findOne({ id })
let reqdata =
{
orderNo: tmpdata.orderId,
officialData: {
askforId: tmpdata.askforId,
tradeType: tmpdata.tradeType,
tradeImg: tmpdata.tradeImg,
applicantName: tmpdata.applicant.applicantName,
fileType: tmpdata.offical.otype,//官文类型
received_at: tmpdata.offical.oDate,
dir: tmpdata.offical.dir
}
}
let req = {
actionType: "getAppTokenByHosts",
actionBody: {}
}
let tkurl = this.tkurl
let tokenData = await this.restClient.execPost(req, tkurl)
console.log(tokenData)
tokenData = JSON.parse(tokenData.stdout)
if (tokenData.status == 0) {
let token = tokenData.data.token
console.log(token)
let qfurl = this.qfurl
req.actionType = "addOfficial"
req.actionBody = reqdata
let res = await this.restClient.execPostWithToken(req, qfurl, token)
console.log(res)
return res
} else {
return "--"
}
}
orgdata (data) {
let datat = {}
datat.orderNo = data.orderId
......
......@@ -42,7 +42,7 @@ class RejcbService extends ServiceBase {
datatmp.mobile = "13693797152"
let step1 = {}
step1.regNum = data[i].askforId.trim() || ""
step1.regNum = data[i].askforId ? data[i].askforId.trim() : ""
step1.intClsId = [`${parseInt(data[i].tradeType)}`] || ""
step1.ifSplit = data[i].askForData.division == 1 ? "ifSplit1" : "ifSplit2"
if (data[i].askForData.division) {
......@@ -57,9 +57,9 @@ class RejcbService extends ServiceBase {
datatmp.step1 = step1
let step2 = {}
step2.appGjdq = data[i].applicant.country.trim() || ""
step2.dlsqrLx = data[i].applicant.applicantType.trim() || ""
step2.certCode = data[i].usccode.trim() || ""
step2.appGjdq = data[i].applicant.country ? data[i].applicant.country.trim() : ""
step2.dlsqrLx = data[i].applicant.applicantType ? data[i].applicant.applicantType.trim() : ""
step2.certCode = data[i].usccode ? data[i].usccode.trim() : ""
switch (data[i].caseId) {
case 'TESTCBSELECT01':
step2.isChangeName = "select1"
......@@ -92,10 +92,10 @@ class RejcbService extends ServiceBase {
break
}
step2.appCnAddr = data[i].applicant.addr.trim() || ""
step2.appContactZip = data[i].applicant.mailCode.trim() || ""
step2.appContactPerson = data[i].applicant.contactsName.trim() || ""
step2.appContactTel = data[i].applicant.tel.trim() || ""
step2.appCnAddr = data[i].applicant.addr ? data[i].applicant.addr.trim() : ""
step2.appContactZip = data[i].applicant.mailCode ? data[i].applicant.mailCode.trim() : ""
step2.appContactPerson = data[i].applicant.contactsName ? data[i].applicant.contactsName.trim() : ""
step2.appContactTel = data[i].applicant.tel ? data[i].applicant.tel.trim() : ""
step2.agentContactPerson = '张飞龙'
step2.agentPerson = '张飞龙'
step2.agentContactTel = '01084927588'
......
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