Commit fbc9262c by 庄冰

policy

parent 0fa46c5b
...@@ -36,7 +36,8 @@ class PolicyAPI extends APIBase { ...@@ -36,7 +36,8 @@ class PolicyAPI extends APIBase {
opResult = await this.policyinfoSve.policyQuery(pobj); opResult = await this.policyinfoSve.policyQuery(pobj);
break; break;
case "submitPolicyNeed"://政策申请提报 case "submitPolicyNeed"://政策申请提报
opResult = system.getResult(null, "接口开发中"); // opResult = system.getResult(null, "接口开发中");
opResult = this.policyneedSve.submitPolicyNeed(pobj);
break; break;
case "getPolicyNeedList"://获取政策申请列表 case "getPolicyNeedList"://获取政策申请列表
opResult = system.getResult(null, "接口开发中"); opResult = system.getResult(null, "接口开发中");
......
...@@ -14,7 +14,8 @@ module.exports = (db, DataTypes) => { ...@@ -14,7 +14,8 @@ module.exports = (db, DataTypes) => {
applyDate :DataTypes.DATE,// 申请日期 applyDate :DataTypes.DATE,// 申请日期
opNotes :DataTypes.TEXT('long'),// 备注 opNotes :DataTypes.TEXT('long'),// 备注
createUserId :DataTypes.INTEGER,// 创建用户id createUserId :DataTypes.INTEGER,// 创建用户id
popularizeUserId :DataTypes.INTEGER,// 推广人id,即业务员id popularizeUserId :DataTypes.INTEGER,// 推广人id,即业务员id
popularizeUserCode :DataTypes.STRING(64),// 推广人帐号
}, { }, {
paranoid: false,//假的删除 paranoid: false,//假的删除
underscored: true, underscored: true,
......
...@@ -10,7 +10,7 @@ class PolicyinfoService extends ServiceBase { ...@@ -10,7 +10,7 @@ class PolicyinfoService extends ServiceBase {
var obj = pobj.actionBody; var obj = pobj.actionBody;
var app = pobj.appInfo; var app = pobj.appInfo;
var paramObj={uapp_id:app.uapp_id}; var paramObj={uapp_id:app.uapp_id};
var attributes =["policyType","policyTypeName","policyDate","policyContent","policyCity","policyProvince", var attributes =["id","policyType","policyTypeName","policyDate","policyContent","policyCity","policyProvince",
"policyLinkUrl","policySource","policyName","policyNo"]; "policyLinkUrl","policySource","policyName","policyNo"];
if(obj){ if(obj){
if(obj.policyProvince){ if(obj.policyProvince){
......
...@@ -3,6 +3,40 @@ const ServiceBase = require("../../sve.base"); ...@@ -3,6 +3,40 @@ const ServiceBase = require("../../sve.base");
class PolicyneedService extends ServiceBase { class PolicyneedService extends ServiceBase {
constructor() { constructor() {
super("dbpolicy", ServiceBase.getDaoName(PolicyneedService)); 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["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();
} }
} }
module.exports = PolicyneedService; module.exports = PolicyneedService;
示例:----------------------------------开始-------------------------------------------------------------------- 示例:----------------------------------开始--------------------------------------------------------------------
...@@ -53,5 +53,6 @@ CREATE TABLE `b_policy_need` ( ...@@ -53,5 +53,6 @@ CREATE TABLE `b_policy_need` (
`version` int(11) NOT NULL DEFAULT 0, `version` int(11) NOT NULL DEFAULT 0,
`createUserId` int(11) NULL DEFAULT NULL COMMENT '创建用户id', `createUserId` int(11) NULL DEFAULT NULL COMMENT '创建用户id',
`popularizeUserId` int(11) NULL DEFAULT NULL COMMENT '推广人id,即业务员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 PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 14 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic; ) 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