Commit 4e6cf107 by 庄冰

policy notes

parent b739a44e
......@@ -47,7 +47,7 @@ class PolicyAPI extends APIBase {
opResult = this.policyneedSve.getPolicyNeedList(pobj);
break;
case "submitPolicyNeedNotes"://申请信息备注提交
opResult = system.getResult(null, "接口开发中");
opResult = this.policyneedSve.submitPolicyNeedNotes(pobj);
break;
default:
opResult = system.getResult(null, "action_type参数错误");
......
......@@ -24,7 +24,7 @@ class PolicyneedService extends ServiceBase {
if(policyinfo && policyinfo.id){
paramObj["policySnapshot"] = JSON.stringify(policyinfo);
paramObj["policy_id"] = obj.policy_id;
paramObj["policyName"] = policyinfo.policyName;
// paramObj["policyName"] = policyinfo.policyName;
}
}
paramObj["contacts"] = obj.contacts;
......@@ -90,5 +90,47 @@ class PolicyneedService extends ServiceBase {
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;
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