Commit d9b9ebc3 by 庄冰

policy notes

parent 0b9c9acc
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));
......@@ -47,7 +46,7 @@ class PolicyinfoService extends ServiceBase {
}
async addPolicyByExcel(){
var workbook = xl.readFile("policy6.xls")
var workbook = xl.readFile("policy6.xls");
const sheetNames = workbook.SheetNames; // 返回 ['sheet1', 'sheet2']
const worksheet = workbook.Sheets[sheetNames[0]];
var dataa =xl.utils.sheet_to_json(worksheet);
......
......@@ -58,38 +58,52 @@ class PolicyneedService extends ServiceBase {
"policy.policyLinkUrl,policy.policyDate,policy.policyProvince,policy.policyCity 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+"' ";
var sqlCount ="select count(1) as dataCount 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+"' ";
if(user.channel_userid=="18611219500"){
sql=sql+" or popularizeUserCode is null or popularizeUserCode='' ";
sqlCount=sqlCount+" or popularizeUserCode is null or popularizeUserCode='' ";
}
sql=sql+" )) as need "+
"LEFT JOIN "+
"(select id, policyNo,policyName,policyType,policyTypeName,policySource,policyLinkUrl,"+
"policyDate,policyProvince,policyCity from b_policy_info) as policy "+
"on need.policy_id=policy.id where 1=1 ";
sqlCount=sqlCount+" )) as need "+
"LEFT JOIN "+
"(select id, policyNo,policyName,policyType,policyTypeName,policySource,policyLinkUrl,"+
"policyDate,policyProvince,policyCity 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+"%'";
sqlCount=sqlCount+" and policyName like '%"+obj.policyName+"%'";
}
if(obj.policyProvince){
sql=sql+" and policyProvince ='"+obj.policyProvince+"'";
sqlCount=sqlCount+" and policyProvince ='"+obj.policyProvince+"'";
if(obj.policyCity){
sql=sql+" and policyCity ='"+obj.policyCity+"'";
sqlCount=sqlCount+" and policyCity ='"+obj.policyCity+"'";
}
}
if(obj.policyType){
sql=sql+" and policyType = '"+obj.policyType+"'";
sqlCount=sqlCount+" and policyType = '"+obj.policyType+"'";
}
if(obj.customerIntention){
sql=sql+" and customerIntention = '"+obj.customerIntention+"'";
sqlCount=sqlCount+" 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 " +
" uapp_id="+app.uapp_id+" and (popularizeUserCode='"+user.channel_userid+"'";
if(user.channel_userid=="18611219500"){
sqlCount=sqlCount+" or popularizeUserCode is null or popularizeUserCode='' ";
}
sqlCount = sqlCount + ")";
// var sqlCount = "SELECT count(1) as dataCount FROM b_policy_need where " +
// " uapp_id="+app.uapp_id+" and (popularizeUserCode='"+user.channel_userid+"'";
// if(user.channel_userid=="18611219500"){
// sqlCount=sqlCount+" or popularizeUserCode is null or popularizeUserCode='' ";
// }
// sqlCount = sqlCount + ")";
var tmpResult = await this.customQuery(sql,{});
var tmpResultCount = await this.customQuery(sqlCount,{});
// if (!tmpResult || tmpResult.length == 0) {
......@@ -133,7 +147,8 @@ class PolicyneedService extends ServiceBase {
if(policyneed.opNotes){
var notes = JSON.parse(policyneed.opNotes);
var noteList = notes.data;
noteList.push(noteparam);
// noteList.push(noteparam);
noteList.splice(0,0,noteparam);
paramObj["opNotes"] = JSON.stringify({data:noteList});
}else{
paramObj["opNotes"] = JSON.stringify({data:[noteparam]});
......
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