Commit cbd0fac8 by 王栋源

wdy

parents 1f8d0bbc 96ef4a91
......@@ -22,7 +22,7 @@ class APIBase {
async doexec(gname, methodname, pobj, query, req) {
req.requestId = this.getUUID();
try {
// //验证accesskey或验签
//验证accesskey或验签
var isPassResult = await this.checkAcck(gname, methodname, pobj, query, req);
if (isPassResult.status != 0) {
isPassResult.requestId = "";
......
......@@ -4,7 +4,6 @@ var settings = require("../../../../config/settings");
class OrderAPI extends APIBase {
constructor() {
super();
this.utilsProductSve = system.getObject("service.utilsSve.utilsProductSve");
}
/**
* 接口跳转-POST请求
......@@ -24,9 +23,9 @@ class OrderAPI extends APIBase {
}
async opActionProcess(pobj, action_type, req) {
var opResult = null;
switch (action_type) {
case "getCAProductListByTypeCode"://创建订单
opResult = await this.utilsProductSve.findByTypeCode(pobj, pobj.actionBody);
switch (action_type) {
case "addOrder"://创建订单
opResult = await this.addOrder(pobj, pobj.actionBody);
break;
default:
opResult = system.getResult(null, "action_type参数错误");
......@@ -34,6 +33,36 @@ class OrderAPI extends APIBase {
}
return opResult;
}
async addOrder(pobj, actionBody) {
if (!actionBody.product_info) {
return system.getResult(null, "产品信息有误,20010");
}
var interface_info = actionBody.product_info.interface_info;
if (!interface_info) {
return system.getResult(null, "产品接口信息有误,20030");
}
if (!interface_info.interface_type) {
return system.getResult(null, "产品接口类型信息有误,20050");
}
if (!interface_info.interface_url) {
return system.getResult(null, "产品接口地址信息有误,20080");
}
var opResult = null;
if (interface_info.interface_type == "bd") {
if (!interface_info.params) {
return system.getResult(null, "产品接口参数信息有误,20110");
}//操作的方法名称
var invokeObj = system.getObject(interface_info.interface_url);
if (!invokeObj[interface_info.params]) {
return system.getResult(null, "产品接口参数方法信息有误,20130");
}
opResult = await invokeObj[interface_info.params].apply(invokeObj, pobj);
}
else if (interface_info.interface_type == "yc") {
}
return opResult;
}
}
module.exports = OrderAPI;
\ No newline at end of file
var APIBase = require("../../api.base");
var system = require("../../../system");
var settings = require("../../../../config/settings");
class PolicyAPI extends APIBase {
constructor() {
super();
// this.utilsProductSve = system.getObject("service.utilsSve.utilsProductSve");
this.policyinfoSve = system.getObject("service.dbpolicy.policyinfoSve");
this.policyneedSve = system.getObject("service.dbpolicy.policyneedSve");
}
/**
* 接口跳转-POST请求
* action_process 执行的流程
* action_type 执行的类型
* action_body 执行的参数
*/
async springBoard(pobj, qobj, req) {
// if (!pobj.userInfo) {
// return system.getResult(system.noLogin, "user no login!");
// }
if (!pobj.actionType) {
return system.getResult(null, "actionType参数不能为空");
}
if(pobj.actionType=='getPolicyNeedList' || pobj.actionType=='submitPolicyNeedNotes' ){
if (!pobj.userInfo) {
return system.getResult(system.noLogin, "user no login!");
}
if (!pobj.appInfo) {
return system.getResult(system.noLogin, "app is null!");
}
}
var result = await this.opActionProcess(pobj, pobj.actionType, req);
return result;
}
async opActionProcess(pobj, action_type, req) {
var opResult = null;
switch (action_type) {
case "policyQuery"://政策检索
opResult = await this.policyinfoSve.policyQuery(pobj);
break;
case "submitPolicyNeed"://政策申请提报
// opResult = system.getResult(null, "接口开发中");
opResult = this.policyneedSve.submitPolicyNeed(pobj);
break;
case "getPolicyNeedList"://获取政策申请列表
// opResult = system.getResult(null, "接口开发中");
opResult = this.policyneedSve.getPolicyNeedList(pobj);
break;
case "submitPolicyNeedNotes"://申请信息备注提交
opResult = this.policyneedSve.submitPolicyNeedNotes(pobj);
break;
default:
opResult = system.getResult(null, "action_type参数错误");
break;
}
return opResult;
}
}
module.exports = PolicyAPI;
\ No newline at end of file
const system = require("../../../system");
const Dao = require("../../dao.base");
class PolicyinfoDao extends Dao {
constructor() {
super(Dao.getModelName(PolicyinfoDao));
}
}
module.exports = PolicyinfoDao;
const system = require("../../../system");
const Dao = require("../../dao.base");
class PolicyneedDao extends Dao {
constructor() {
super(Dao.getModelName(PolicyneedDao));
}
}
module.exports = PolicyneedDao;
......@@ -28,7 +28,7 @@ module.exports = {
//订单类型
"order_type": { "zzdd": "自主订单", "dkxd": "代客下单" },
//订单付款状态
"order_pay_status": { "dfk": "待付款", "zfpz": "已上传支付凭证", "yfk": "已付款", "bfyfk": "部分已付款", "ddqx": "订单取消", "tkclz": "退款处理中", "bfytk": "部分已退款", "ytk": "已退款", "zfshbtg": "支付审核不通过" },
"order_status": { 1: "待付款", 2: "已付款", 4: "待服务", 8: "已完成" },
//帐户类型( 支付类型)
"pay_account_type": { "cash": "现金", "bank": "银行", "wx": "微信", "alipay": "支付宝", "other": "其它" },
//订单服务付款状态
......@@ -70,6 +70,8 @@ module.exports = {
"direction_type": { "sr": "收", "zc": "支" },
"push_return_type": { "0": "推送失败", "1": "推送成功" },
"push_chance_type": { "wts": "未推送", "yts": "已推送", "ygj": "已跟进", "ycd": "已成单" },
"policy_type":{'fzbt':'租金减免','jrdk':'金融贷款','zdfc':'扶持措施','ssjm':'税收优惠','rlzy':'人力资源'},
"customer_intention":{"dgj":"待跟进","yyx":"有意向","wyx":"无意向"},
},
}
}
\ No newline at end of file
......@@ -14,15 +14,14 @@ module.exports = (db, DataTypes) => {
payTime :DataTypes.DATE,// 渠道有支付时间则用渠道的支付时间
quantity :DataTypes.INTEGER,// 订单数量(即产品的倍数,默认值为1)
serviceQuantity :DataTypes.INTEGER,// 订单服务数量(即与订单数量相对应)
orderPayStatusName :DataTypes.STRING(50),//
orderPayStatus :{
type: DataTypes.ENUM,
values: Object.keys(uiconfig.config.pdict.order_pay_status),
orderStatusName :DataTypes.STRING(50),//
orderStatus :{
type: DataTypes.INTEGER,
set: function (val) {
this.setDataValue("orderPayStatus", val);
this.setDataValue("orderPayStatusName", uiconfig.config.pdict.order_pay_status[val]);
this.setDataValue("orderStatus", val);
this.setDataValue("orderStatusName", uiconfig.config.pdict.order_status[val]);
}
},// 订单付款状态dfk: 待付款, zfpz: 已上传支付凭证, yfk: 已付款, bfyfk: 部分已付款, ddqx: 订单取消, tkclz: 退款处理中, bfytk: 部分已退款, ytk: 已退款,zfshbtg:支付审核不通过
},// 订单状态dfk: 1: 待付款, 2: 已付款, 4: 待服务, 8: 已完成
totalSum :DataTypes.DECIMAL(12, 2),// 订单总额(产品价格×优惠费率×订单件数)
payTotalSum :DataTypes.DECIMAL(12, 2),// 订单付款总额
refundSum :DataTypes.DECIMAL(12, 2),// 退款金额
......
......@@ -6,7 +6,7 @@ module.exports = (db, DataTypes) => {
uapp_id: DataTypes.INTEGER,//
sourceOrderNo :DataTypes.STRING(64),//来源单号
productType_id :DataTypes.INTEGER,//产品类型Id
productOneType_id :DataTypes.INTEGER,//产品大类Id
pathCode :DataTypes.STRING(512), //产品类型编码路径,如:1/2
itemCode :DataTypes.STRING(64),//产品编码
itemName :DataTypes.STRING(100),//产品名称
channelItemCode :DataTypes.STRING(100),// 渠道产品编码
......
const system = require("../../../system");
const settings = require("../../../../config/settings");
const uiconfig = system.getUiConfig2(settings.appKey);
module.exports = (db, DataTypes) => {
return db.define("customercontacts", {
app_id :DataTypes.INTEGER, //
customerinfo_id :DataTypes.INTEGER, //
deliveryOrderNo :DataTypes.STRING(64), // 交付订单号
mobile :DataTypes.STRING(20), //
email :DataTypes.STRING(50), //
tel :DataTypes.STRING(20), //
fax :DataTypes.STRING(50), //
name :DataTypes.STRING(1000), // 联系人
code :DataTypes.STRING(100), // 暂时没有用
}, {
paranoid: false,//假的删除
underscored: true,
version: true,
freezeTableName: true,
timestamps: true,
updatedAt: false,
//freezeTableName: true,
// define the table's name
tableName: 'b_customercontacts',
validate: {
},
indexes: [
]
});
}
const system = require("../../../system");
const settings = require("../../../../config/settings");
const uiconfig = system.getUiConfig2(settings.appKey);
module.exports = (db, DataTypes) => {
return db.define("customerinfo", {
customerTypeName :DataTypes.STRING(50), //
customerType : {
type: DataTypes.ENUM,
values: Object.keys(uiconfig.config.pdict.customer_type),
set: function (val) {
this.setDataValue("customerType", val);
this.setDataValue("customerTypeName", uiconfig.config.pdict.customer_type[val]);
},
defaultValue: "0",
}, //申请企业类型: ent:企业,person:个人
identityCardPic :DataTypes.STRING(500), // 身份证图片
identityCardPdf :DataTypes.STRING(500), // 身份证pdf
businessLicensePic :DataTypes.STRING(500), // 营业执照图片
businessLicensePdf :DataTypes.STRING(500), // 营业执照pdf
name :DataTypes.STRING(1000), // 公司名称或个人名称
code :DataTypes.STRING(100), // 公司统一社会代码
app_id :DataTypes.INTEGER, //
deliveryOrderNo :DataTypes.STRING(64), // 交付订单号
applyAddr :DataTypes.STRING, // 申请地址
applyArea :DataTypes.STRING(50), // 存储省市编码
province :DataTypes.STRING(50), // 省
city :DataTypes.STRING(50), // 市
identityCardNo :DataTypes.STRING(50), // 身份证号
notes :DataTypes.STRING, // 备注
createuser_id :DataTypes.INTEGER, //
updateuser_id :DataTypes.INTEGER, //
owner_id :DataTypes.INTEGER, // 拥有者
zipCode :DataTypes.STRING(20), //
}, {
paranoid: false,//假的删除
underscored: true,
version: true,
freezeTableName: true,
timestamps: true,
updatedAt: false,
//freezeTableName: true,
// define the table's name
tableName: 'b_customerinfo',
validate: {
},
indexes: [
]
});
}
const system = require("../../../system");
const settings = require("../../../../config/settings");
const uiconfig = system.getUiConfig2(settings.appKey);
module.exports = (db, DataTypes) => {
return db.define("order", {
app_id :DataTypes.INTEGER,//
orderNo :DataTypes.STRING(64),// 订单号
channelServiceNo :DataTypes.STRING(64),// 渠道服务单号
channelOrderNo :DataTypes.STRING(1024),// 渠道订单号列表,多个以,隔开
itemCode :DataTypes.STRING(64),//
itemName :DataTypes.STRING(100),//
channelItemCode :DataTypes.STRING(64),// 渠道产品编码
channelItemName :DataTypes.STRING,// 渠道产品名称
payTime :DataTypes.DATE,// 渠道有支付时间则用渠道的支付时间
salesNum :DataTypes.INTEGER,// 项目订单数量(即服务项目的倍数,默认值为1)
salesDiliverNum :DataTypes.INTEGER,// 项目订单交付数量(即与项目订单数量相对应)
minitermNum :DataTypes.INTEGER,// 订单小项数量
minitermDiliverNum :DataTypes.INTEGER,// 订单小项交付数量
orderType :{
type: DataTypes.ENUM,
values: Object.keys(uiconfig.config.pdict.order_type),
},// 订单类型,zzdd: 自主订单,dkxd: 代客下单
orderPayStatusName: DataTypes.STRING(50),//
orderPayStatus :{
type: DataTypes.ENUM,
values: Object.keys(uiconfig.config.pdict.order_pay_status),
set: function (val) {
this.setDataValue("orderPayStatus", val);
this.setDataValue("orderPayStatusName", uiconfig.config.pdict.order_pay_status[val]);
}
},// 订单付款状态dfk: 待付款, zfpz: 已上传支付凭证, yfk: 已付款, ddqx: 订单取消, tkclz: 退款处理中, bfytk: 部分已退款, ytk: 已退款,zfshbtg:支付审核不通过
totalServiceCharge :DataTypes.DECIMAL(12, 2),// 服务费总额(产品配置的服务费*订单件数)
totalPublicExpense :DataTypes.DECIMAL(12, 2),// 官费总额(产品配置的官费*订单件数)
totalDiscounts :DataTypes.DECIMAL(12, 2),// 优惠总额((服务费总额+官费总额)-订单总额(产品价格×优惠费率×订单件数)>0则有优惠额度)
totalTaxes :DataTypes.DECIMAL(12, 2),// 税费总额(订单总额-(订单总额/(1+产品费率)))
totalSum :DataTypes.DECIMAL(12, 2),// 订单总额(产品价格×优惠费率×订单件数)
refundSum :DataTypes.DECIMAL(12, 2),// 退款金额
totalProfitSum :DataTypes.DECIMAL(12, 2),// 订单毛利润总额(订单总额-官费总额)
pfProfitSum :DataTypes.DECIMAL(12, 2),// 订单平台毛利润总额(订单毛利润总额-订单渠道分成毛利润总额)
channelProfitSum :DataTypes.DECIMAL(12, 2),// 订单渠道分成毛利润总额((订单总额-官费总额)*渠道利润分成比率)
pfSettleProfit :DataTypes.DECIMAL(12, 2),// 平台结算渠道利润,0否,1是
opNotes :DataTypes.STRING,// 备注
notes :DataTypes.STRING,// 备注
appPayType :{
type: DataTypes.ENUM,
values: Object.keys(uiconfig.config.pdict.app_pay_type),
},// 支付类型:00第三方支付,10平台代收款
createuser_id :DataTypes.INTEGER,//
updateuser_id :DataTypes.INTEGER,//
owner_id :DataTypes.INTEGER,//
creator :DataTypes.STRING(100),//
updator :DataTypes.STRING(100),//
owner :DataTypes.STRING(100),//
ownerMoblie :DataTypes.STRING(20),//
invoiceApplyStatus :DataTypes.STRING(10),// 发票状态:00: 未申请, 10: 已申请,20:已开票
channelUserId :DataTypes.STRING(64), // 渠道用户ID
needNo :DataTypes.STRING(64), // 需求单号
needNoOrderNo :DataTypes.STRING(64), // 需求订单号
sourceType: DataTypes.STRING(10),//来源类型:00订单,10需求需要用户确认方案
picUrl :DataTypes.STRING(500),// 产品图片地址
productType_id :DataTypes.INTEGER, //产品类型Id
productOneType_id :DataTypes.INTEGER, //产品大类Id
serviceItemSnapshot :DataTypes.TEXT, //产品快照
buyerMoblie :DataTypes.STRING(64), // 买家手机号
}, {
paranoid: false,//假的删除
underscored: true,
version: true,
freezeTableName: true,
timestamps: true,
updatedAt: false,
//freezeTableName: true,
// define the table's name
tableName: 'b_order',
validate: {
},
indexes: [
]
});
}
const system = require("../../../system");
const settings = require("../../../../config/settings");
const uiconfig = system.getUiConfig2(settings.appKey);
module.exports = (db, DataTypes) => {
return db.define("orderflow", {
sourceOrderNo: DataTypes.STRING(64), // 来源单号
opContent: DataTypes.STRING(1024), // 操作描述
app_id: DataTypes.INTEGER, //
notes: DataTypes.STRING, // 备注
createuser_id: DataTypes.INTEGER, //
isShow: {//是否显示
type: DataTypes.BOOLEAN,
defaultValue: false,
},
}, {
paranoid: false,//假的删除
underscored: true,
version: true,
freezeTableName: true,
timestamps: true,
updatedAt: false,
//freezeTableName: true,
// define the table's name
tableName: 'b_orderflow',
validate: {
},
indexes: [
]
});
}
const system = require("../../../system");
const settings = require("../../../../config/settings");
const uiconfig = system.getUiConfig2(settings.appKey);
module.exports = (db, DataTypes) => {
return db.define("ordertmproduct", {
app_id: DataTypes.INTEGER,//
productType_id: DataTypes.INTEGER,//产品类型Id
productOneType_id: DataTypes.INTEGER,//产品大类Id
itemCode: DataTypes.STRING(64),//产品编码
itemName: DataTypes.STRING(100),//产品名称
tmName: DataTypes.STRING(1000),//商标名称
tmType: {
type: DataTypes.ENUM,
values: Object.keys(uiconfig.config.pdict.tm_type),
},//p:普通商标,j:集体商标,z:证明商标,t:特殊商标
tmFormTypeName: DataTypes.STRING(50),//
tmFormType: {
type: DataTypes.ENUM,
values: Object.keys(uiconfig.config.pdict.tm_form_type),
set: function (val) {
this.setDataValue("tmFormType", val);
this.setDataValue("tmFormTypeName", uiconfig.config.pdict.tm_form_type[val]);
}
},//商标类型形式:1:立体,3:字,4:图,5:字图,6:颜色,7:彩色
nclOneCodes: DataTypes.STRING,//尼斯大类列表:格式以,隔开
payStatusName: DataTypes.STRING(50),//
payStatus: {
type: DataTypes.ENUM,
values: Object.keys(uiconfig.config.pdict.order_service_pay_status),
set: function (val) {
this.setDataValue("payStatus", val);
this.setDataValue("payStatusName", uiconfig.config.pdict.order_service_pay_status[val]);
}
},//支付状态:dfk:待付款,yzf:已支付
deliveryStatusName: DataTypes.STRING(50),//
deliveryStatus: {
type: DataTypes.ENUM,
values: Object.keys(uiconfig.config.pdict.delivery_status),
set: function (val) {
this.setDataValue("deliveryStatus", val);
this.setDataValue("deliveryStatusName", uiconfig.config.pdict.delivery_status[val]);
}
},//商标交付状态:dsccl:待上传材料,dsh:待审核,ddj:待递交, ydj: 已递交,ywc:已完成
appDataOpType: {
type: DataTypes.ENUM,
values: Object.keys(uiconfig.config.pdict.app_data_op_type),
},//应用数据操作类型:00独立,10全委托,20部分委托
sourceOrderNo: DataTypes.STRING(64),//来源单号
deliveryOrderNo: DataTypes.STRING(64),//交付订单号
channelServiceNo: DataTypes.STRING(64),//渠道服务单号
channelOrderNo: DataTypes.STRING(1024),//渠道订单号列表,多个以,隔开
needNo: DataTypes.STRING(64),//需求单号
needNoOrderNo :DataTypes.STRING(64), // 需求订单号
sourceType: DataTypes.STRING(10),//来源类型:00订单,10需求需要用户确认方案
picUrl: DataTypes.STRING(500), //商标图样
colorizedPicUrl: DataTypes.STRING(500),//商标彩色图样
gzwtsUrl: DataTypes.STRING(500), //盖章委托书
sywjUrl: DataTypes.STRING(500), //声音文件
smwjUrl: DataTypes.STRING(500), //说明文件
channelUserId: DataTypes.STRING(64),//渠道用户ID
notes: DataTypes.STRING(255),//备注
createuser_id: DataTypes.INTEGER,//
updateuser_id: DataTypes.INTEGER,//
auditor_id: DataTypes.INTEGER,//
createuser: DataTypes.STRING(100),//
updateuser: DataTypes.STRING(100),//
auditor: DataTypes.STRING(100),//
nclOneCount: DataTypes.INTEGER, // 尼斯大类数量
nclCount: DataTypes.INTEGER, // 尼斯数量
}, {
paranoid: false,//假的删除
underscored: true,
version: true,
freezeTableName: true,
timestamps: true,
updatedAt: false,
//freezeTableName: true,
// define the table's name
tableName: 'b_order_tm_product',
validate: {
},
indexes: [
]
});
}
const system = require("../../../system");
const settings = require("../../../../config/settings");
const uiconfig = system.getUiConfig2(settings.appKey);
module.exports = (db, DataTypes) => {
var base = require("../../basemodel/voucherbase")(db, DataTypes);
return db.define("receiptvoucher", Object.assign({//收款单:
//基类 code: 收款单号(自动生成)
//基类 creator: 创建者
//基类 updator:/更新者
//基类 auditor: 审核者
//基类 opNotes: 操作备注
//基类 auditStatusName: //审核状态名称
//基类 auditStatus: //审核状态:ENUM=audit_status,"dsh": "待审核", "btg": "不通过", "tg": "通过"
//基类 sourceTypeName: //来源类型名称
//基类 sourceType: //来源类型:ENUM=source_type,"order": "订单","expensevoucher": "费用单","receiptvoucher": "收款单","refundvoucher": "退款单", "trademark": "商标单"
//基类 sourceOrderNo: DataTypes.STRING,//来源单号(如:订单号等)
//基类 channelServiceNo //渠道服务单号
createapp_id: DataTypes.INTEGER,//
payuser_id: DataTypes.INTEGER,//
busPayOrderCode: DataTypes.STRING(100),//业务支付订单号
payOrderNo: DataTypes.STRING, //支付凭证流水单号,如:微信支付凭证单号
receiptTypeName: DataTypes.STRING,
receiptType: {//收款类型,"sk": "收款","csrz": "初始入账" ,"ptdsk": "平台代收款"
type: DataTypes.ENUM,
values: Object.keys(uiconfig.config.pdict.receipt_type),
set: function (val) {
this.setDataValue("receiptType", val);
this.setDataValue("receiptTypeName", uiconfig.config.pdict.receipt_type[val]);
}
},
accountType: {
//帐户类型( 支付类型):"cash": "现金", "bank": "银行" ,"wx":"微信","alipay":"支付宝","other":"其它"
type: DataTypes.ENUM,
values: Object.keys(uiconfig.config.pdict.pay_account_type),
set: function (val) {
this.setDataValue("accountType", val);
this.setDataValue("accountTypeName", uiconfig.config.pdict.pay_account_type[val]);
},
defaultValue: "other",
},
accountTypeName: {//帐户类型名称
type: DataTypes.STRING,
defaultValue: "其它",
},
payDate: DataTypes.DATE,//支付时间
totalSum: DataTypes.DECIMAL(12, 3),//订单总额(平台费用+服务费+官费+发票税费+个人利润+平台利润)
certifyFileUrl: DataTypes.STRING(500), //证明文件Url
notes: DataTypes.STRING,//备注
itemCode: DataTypes.STRING(100),//项目操作码
itemName: DataTypes.STRING(100),//项目名称
buyerOpenId: DataTypes.STRING,//用户在商户appid下的唯一标识或买家在支付宝的用户id
passTradeNo: DataTypes.STRING,//通道的统一订单号
buyerAliLogonId: DataTypes.STRING,//买家支付宝账号
}, base), {
paranoid: true,//假的删除
underscored: true,
version: true,
freezeTableName: true,
//freezeTableName: true,
// define the table's name
tableName: 'b_receiptvoucher',
validate: {
}
});
}
const system = require("../../../system");
const settings = require("../../../../config/settings");
const uiconfig = system.getUiConfig2(settings.appKey);
module.exports = (db, DataTypes) => {
return db.define("policyinfo", {
uapp_id :DataTypes.INTEGER,//
policyNo :DataTypes.STRING(64),// 政策编号
policyName :DataTypes.STRING(255),// 政策名称
policySource :DataTypes.STRING(255),// 政策出处
policyLinkUrl :DataTypes.STRING(255),// 政策链接
policyProvince :DataTypes.STRING(100),// 所属省份
policyCity :DataTypes.STRING(100),// 所属城市
policyContent :DataTypes.TEXT('long'),// 政策内容
policyDate :DataTypes.DATE,// 政策日期
policyTypeName: DataTypes.STRING(100),//
policyType :{
type: DataTypes.ENUM,
values: Object.keys(uiconfig.config.pdict.policy_type),
set: function (val) {
this.setDataValue("policyType", val);
this.setDataValue("policyTypeName", uiconfig.config.pdict.policy_type[val]);
}
},//政策类型 'zh':'综合','fzbt':'房租补贴','jrdk':'金融贷款','zdfc':'重点扶持','ssjm':'税收减免',
opNotes :DataTypes.STRING,// 备注
}, {
paranoid: false,//假的删除
underscored: true,
version: true,
freezeTableName: true,
timestamps: true,
updatedAt: false,
//freezeTableName: true,
// define the table's name
tableName: 'b_policy_info',
validate: {
},
indexes: [
]
});
}
const system = require("../../../system");
const settings = require("../../../../config/settings");
const uiconfig = system.getUiConfig2(settings.appKey);
module.exports = (db, DataTypes) => {
return db.define("policyneed", {
uapp_id :DataTypes.INTEGER,//
contacts :DataTypes.STRING(64),// 联系人
company :DataTypes.STRING(255),// 公司名称
industry :DataTypes.STRING(100),// 行业名称
region :DataTypes.STRING(100),// 地区
mobile :DataTypes.STRING(100),// 联系电话
policy_id :DataTypes.INTEGER,// 政策id
policySnapshot :DataTypes.TEXT('long'),// 政策快照
applyDate :DataTypes.DATE,// 申请日期
opNotes :DataTypes.TEXT('long'),// 备注
createUserId :DataTypes.INTEGER,// 创建用户id
popularizeUserId :DataTypes.INTEGER,// 推广人id,即业务员id
popularizeUserCode :DataTypes.STRING(64),// 推广人帐号
customerIntentionName: DataTypes.STRING(100),// 客户意向
customerIntention :{// "customer_intention":{"dgj":"待跟进","yyx":"有意向","wyx":"无意向"},
type: DataTypes.ENUM,
values: Object.keys(uiconfig.config.pdict.customer_intention),
set: function (val) {
this.setDataValue("customerIntention", val);
this.setDataValue("customerIntentionName", uiconfig.config.pdict.customer_intention[val]);
}
},
}, {
paranoid: false,//假的删除
underscored: true,
version: true,
freezeTableName: true,
timestamps: true,
updatedAt: false,
//freezeTableName: true,
// define the table's name
tableName: 'b_policy_need',
validate: {
},
indexes: [
]
});
}
const system = require("../../../system");
const ServiceBase = require("../../sve.base");
var xl = require('xlsx');
var fs = require('fs');
class PolicyinfoService extends ServiceBase {
constructor() {
super("dbpolicy", ServiceBase.getDaoName(PolicyinfoService));
}
//政策检索
async policyQuery(pobj){
var obj = pobj.actionBody;
var app = pobj.appInfo;
var paramObj={uapp_id:app.uapp_id};
var attributes =["id","policyType","policyTypeName","policyDate","policyContent","policyCity","policyProvince",
"policyLinkUrl","policySource","policyName","policyNo"];
if(obj){
if(obj.policyProvince){
paramObj["policyProvince"]=obj.policyProvince;
if(obj.policyCity){
paramObj["policyCity"]=obj.policyCity;
}
}
if(obj.policyName){
paramObj["policyName"]={ [this.db.Op.like]: "%" + obj.policyName + "%" };
}
console.log(paramObj);
}
var result = {};
//"policy_type":{'fzbt':'租金减免','jrdk':'金融贷款','zdfc':'扶持措施','ssjm':'税收优惠','rlzy':'人力资源'},
result["rlzy"]=await this.findByParams("rlzy",paramObj,attributes);
result["fzbt"]=await this.findByParams("fzbt",paramObj,attributes);
result["jrdk"]=await this.findByParams("jrdk",paramObj,attributes);
result["zdfc"]=await this.findByParams("zdfc",paramObj,attributes);
result["ssjm"]=await this.findByParams("ssjm",paramObj,attributes);
return system.getResultSuccess(result);
}
async findByParams(type,paramObj,attributes){
paramObj.policyType=type;
return await this.dao.model.findAll({
where:paramObj,raw:true,attributes:attributes
});
}
async addPolicyByExcel(){
var workbook = xl.readFile("policy.xlsx")
const sheetNames = workbook.SheetNames; // 返回 ['sheet1', 'sheet2']
const worksheet = workbook.Sheets[sheetNames[0]];
var dataa =xl.utils.sheet_to_json(worksheet);
var arr = [];
var that=this;
await this.db.transaction(async function (t) {
for(var i=0;i<dataa.length;i++){
var data = dataa[i];
var pobj = {
uapp_id:26,policyNo:data['政策编号'],policyName:data['政策名称'],
policySource:data['政策出处'],policyLinkUrl:data['政策链接'],
policyProvince:data['所属省份'],policyCity:data['所属城市'],
policyTypeName:data['政策类型']};
if(data['政策类型']){
var policy_type ={'租金减免':'fzbt','金融贷款':'jrdk','扶持措施':'zdfc','税收优惠':'ssjm','人力资源':'rlzy'};
var typename = data['政策类型'];
if(policy_type[typename]){
pobj["policyType"]=policy_type[typename];
}
}
if(pobj.policyNo){
var a = await that.dao.create(pobj,t);
arr.push(a);
}
}
})
console.log(arr.length,"###################################");
}
}
module.exports = PolicyinfoService;
// var task = new PolicyinfoService();
// task.addPolicyByExcel().then(d=>{
// console.log("----------end-------------------------");
// })
const system = require("../../../system");
const ServiceBase = require("../../sve.base");
class PolicyneedService extends ServiceBase {
constructor() {
super("dbpolicy", ServiceBase.getDaoName(PolicyneedService));
this.policyinfoDao = system.getObject("db.dbpolicy.policyinfoDao");
}
//提交政策需求
async submitPolicyNeed(pobj){
var user = pobj.userInfo;
var app = pobj.appInfo;
var obj = pobj.actionBody;
var paramObj={uapp_id:app.uapp_id};
if(!obj.contacts){
return system.getResult(null, "联系人不能为空");
}
if(!obj.mobile){
return system.getResult(null, "联系电话不能为空");
}
if(obj.policy_id){
var policyinfo = await this.policyinfoDao.model.findOne({
where:{id:obj.policy_id},raw:true
});
if(policyinfo && policyinfo.id){
paramObj["policySnapshot"] = JSON.stringify(policyinfo);
paramObj["policy_id"] = obj.policy_id;
// paramObj["policyName"] = policyinfo.policyName;
}
}
paramObj["contacts"] = obj.contacts;
paramObj["mobile"] = obj.mobile;
paramObj["company"] = obj.company;
paramObj["industry"] = obj.industry;
paramObj["region"] = obj.region;
paramObj["applyDate"] = new Date();
if(obj.popularizeUserCode){
paramObj["popularizeUserCode"] = obj.popularizeUserCode;
}
var policyNeed = await this.dao.create(paramObj);
return system.getResultSuccess();
}
//需求列表
async getPolicyNeedList(pobj){
var user = pobj.userInfo;
var app = pobj.appInfo;
var obj = pobj.actionBody || {};
if(!user || !user.channel_userid){
return system.getResult(null, "未知用户");
}
var pageSize = Number(obj.pageSize || 20);
var pageIndex = Number(obj.pageIndex || 1);
var from = pageIndex == 1 ? 0 : Number((pageIndex - 1) * pageSize);
if (pageSize > 50) {
pageSize = 50;
}
var sql ="select * from "+
"(select id,uapp_id,contacts,customerIntention,customerIntentionName,company,industry,region,mobile,policy_id,applyDate,opNotes,popularizeUserCode "+
"from b_policy_need where uapp_id="+app.uapp_id+" and popularizeUserCode='"+user.channel_userid+"') as need "+
"LEFT JOIN "+
"(select id, policyNo,policyName,policyType,policyTypeName,policySource,policyLinkUrl,"+
"policyDate,policyProvince,policyCity,policyContent from b_policy_info) as policy "+
"on need.policy_id=policy.id where 1=1 ";
// var sql = "SELECT * from b_policy_need where popularizeUserCode='"+user.channel_userid+"' and uapp_id="+app.uapp_id;
if(obj.policyName){
sql=sql+" and policyName like '%"+obj.policyName+"%'";
}
if(obj.policyProvince){
sql=sql+" and policyProvince ='"+obj.policyProvince+"'";
if(obj.policyCity){
sql=sql+" and policyCity ='"+obj.policyCity+"'";
}
}
if(obj.policyType){
sql=sql+" and policyType = '"+obj.policyType+"'";
}
if(obj.customerIntention){
sql=sql+" and customerIntention = '"+obj.customerIntention+"'";
}
sql=sql+" order by need.id desc LIMIT " + pageSize + " OFFSET " + from + "";
console.log(sql);
var sqlCount = "SELECT count(1) as dataCount FROM b_policy_need where " +
" popularizeUserCode='"+user.channel_userid+"' and uapp_id="+app.uapp_id;
var tmpResult = await this.customQuery(sql,{});
var tmpResultCount = await this.customQuery(sqlCount,{});
// if (!tmpResult || tmpResult.length == 0) {
// return system.getResultSuccess(null, "暂无数据");
// }
var result = system.getResultSuccess(tmpResult);
result.dataCount = tmpResultCount && tmpResultCount.length > 0 ? tmpResultCount[0].dataCount : 0;
return result;
}
//需求备注提交
async submitPolicyNeedNotes(pobj){
var user = pobj.userInfo;
var app = pobj.appInfo;
var obj = pobj.actionBody || {};
if(!user || !user.channel_userid){
return system.getResult(null, "未知用户");
}
if(!obj.needId){
return system.getResult(null, "需求id不能为空");
}
if(!obj.customerIntention){
return system.getResult(null, "客户意向不能为空");
}
if(!obj.intentionContent){
return system.getResult(null, "意向内容不能为空");
}
var policyneed = await this.dao.model.findOne({
where:{id:obj.needId,uapp_id:app.uapp_id},
raw:true
});
if(!policyneed || !policyneed.id){
return system.getResult(null, "未知政策需求");
}
if(policyneed.popularizeUserCode != user.channel_userid){
return system.getResult(null, "非法操作,只能修改本人数据");
}
var paramObj={id:obj.needId,customerIntention:obj.customerIntention};
var noteparam={customerIntention:obj.customerIntention,intentionContent:obj.intentionContent,submitDate:new Date()};
if(policyneed.opNotes){
var notes = JSON.parse(policyneed.opNotes);
var noteList = notes.data;
noteList.push(noteparam);
paramObj["opNotes"] = JSON.stringify({data:noteList});
}else{
paramObj["opNotes"] = JSON.stringify({data:[noteparam]});
}
var newPolicyNeed = await this.dao.update(paramObj);
return system.getResultSuccess();
}
}
module.exports = PolicyneedService;
......@@ -3,7 +3,7 @@ var settings={
host: "43.247.184.32",
port: 8967,
password: "Gongsibao2018",
db:8,
db:9,
},
database:{
dbname : "center_order",
......
......@@ -4,11 +4,11 @@ var ENVINPUT = {
DB_PORT: process.env.DB_PORT,
DB_USER: process.env.DB_USER,
DB_PWD: process.env.DB_PWD,
DB_NAME: process.env.CENTER_CHANNEL_DB_NAME,
DB_NAME: process.env.CENTER_ORDER_DB_NAME,
REDIS_HOST: process.env.REDIS_HOST,
REDIS_PORT: process.env.REDIS_PORT,
REDIS_PWD: process.env.REDIS_PWD,
REDIS_DB: process.env.CENTER_CHANNEL_REDIS_DB,
REDIS_DB: process.env.CENTER_ORDER_REDIS_DB,
APP_ENV: process.env.APP_ENV ? process.env.APP_ENV : "dev"
};
var settings = {
......@@ -16,7 +16,7 @@ var settings = {
appKey: "201911061250",
secret: "f99d413b767f09b5dff0b3610366cc46",
salt: "%iatpD1gcxz7iF#B",
cacheprefix: "centerChannel",
cacheprefix: "centerOrder",
usertimeout: 3600,//单位秒
basepath: path.normalize(path.join(__dirname, '../..')),
port: process.env.NODE_PORT || 4011,
......
示例:----------------------------------开始--------------------------------------------------------------------
示例:----------------------------------开始--------------------------------------------------------------------
......@@ -10,4 +10,49 @@ ALTER TABLE c_app_product ADD COLUMN pushServiceItemCode VARCHAR(100) DEFAULT NU
ALTER TABLE b_order ADD COLUMN needNoOrderNo VARCHAR(64) DEFAULT NULL COMMENT '需求订单号';
ALTER TABLE b_order_tm_product ADD COLUMN needNoOrderNo VARCHAR(64) DEFAULT NULL COMMENT '需求订单号';
ALTER TABLE b_order_tm_product modify COLUMN deliveryStatus ENUM('dqrfa','fabtg','dfwsfw','dsccl','dsh','ddj','ydj','ywc') DEFAULT 'dfwsfw';
\ No newline at end of file
ALTER TABLE b_order_tm_product modify COLUMN deliveryStatus ENUM('dqrfa','fabtg','dfwsfw','dsccl','dsh','ddj','ydj','ywc') DEFAULT 'dfwsfw';
2020-02-10 zhuangbing
DROP TABLE IF EXISTS `b_policy_info`;
CREATE TABLE `b_policy_info` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`uapp_id` int(11) NULL DEFAULT NULL,
`policyNo` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '政策编号',
`policyName` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '政策名称',
`policyType` enum('rlzy','fzbt','jrdk','zdfc','ssjm') CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT 'zh' COMMENT '政策类型 \'rlzy\':\'人力资源\',\'fzbt\':\'房租补贴\',\'jrdk\':\'金融贷款\',\'zdfc\':\'重点扶持\',\'ssjm\':\'税收减免\'',
`policyTypeName` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '政策类型名称',
`policySource` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '政策出处',
`policyLinkUrl` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '政策链接',
`policyDate` datetime(0) NULL DEFAULT NULL COMMENT '政策日期',
`policyProvince` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '所属省份',
`policyCity` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '所属城市',
`policyContent` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '政策内容',
`opNotes` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '操作备注',
`created_at` datetime(0) NOT NULL,
`updated_at` datetime(0) NULL DEFAULT NULL,
`deleted_at` datetime(0) NULL DEFAULT NULL,
`version` int(11) NOT NULL DEFAULT 0,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 14 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
DROP TABLE IF EXISTS `b_policy_need`;
CREATE TABLE `b_policy_need` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`uapp_id` int(11) NULL DEFAULT NULL,
`contacts` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '联系人',
`company` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '公司名称',
`industry` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '行业名称',
`region` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '地区',
`mobile` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '联系电话',
`policy_id` int(11) NULL DEFAULT NULL COMMENT '政策id',
`policySnapshot` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '政策快照',
`applyDate` datetime(0) NULL DEFAULT NULL COMMENT '申请日期',
`opNotes` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '操作备注',
`created_at` datetime(0) NOT NULL,
`updated_at` datetime(0) NULL DEFAULT NULL,
`deleted_at` datetime(0) NULL DEFAULT NULL,
`version` int(11) NOT NULL DEFAULT 0,
`createUserId` int(11) NULL DEFAULT NULL COMMENT '创建用户id',
`popularizeUserId` int(11) NULL DEFAULT NULL COMMENT '推广人id,即业务员id',
`popularizeUserCode` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '推广人帐号',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 14 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
\ 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