|
@@ -44,13 +44,14 @@ func (this *Action) Save() {
|
|
status, _ := this.GetInteger("status")
|
|
status, _ := this.GetInteger("status")
|
|
i_type, _ := this.GetInteger("type")
|
|
i_type, _ := this.GetInteger("type")
|
|
customer_str := this.GetString("c_id")
|
|
customer_str := this.GetString("c_id")
|
|
|
|
+ time_i, _ := this.GetInt("time")
|
|
now := time.Now().Unix()
|
|
now := time.Now().Unix()
|
|
- if projectid_str != "" && customer_str != "" && status != 0 && i_type != 0 && this.GetString("time") != "" {
|
|
|
|
|
|
+ if projectid_str != "" && customer_str != "" && status != 0 && i_type != 0 && time_i != 0 {
|
|
projectid := qutil.Int64All(qutil.SE.Decode4HexByCheck(projectid_str))
|
|
projectid := qutil.Int64All(qutil.SE.Decode4HexByCheck(projectid_str))
|
|
customerid := qutil.Int64All(qutil.SE.Decode4HexByCheck(customer_str))
|
|
customerid := qutil.Int64All(qutil.SE.Decode4HexByCheck(customer_str))
|
|
euc := util.Mysql.FindOne("entniche_user_customer", map[string]interface{}{
|
|
euc := util.Mysql.FindOne("entniche_user_customer", map[string]interface{}{
|
|
"customer_id": customerid,
|
|
"customer_id": customerid,
|
|
- "user_id": this.GetSession("entUserId").(string),
|
|
|
|
|
|
+ "user_id": this.GetSession("entUserId"),
|
|
}, "type,timestamp", "")
|
|
}, "type,timestamp", "")
|
|
dis_type := (*euc)["type"]
|
|
dis_type := (*euc)["type"]
|
|
dis_time := (*euc)["timestamp"]
|
|
dis_time := (*euc)["timestamp"]
|
|
@@ -58,18 +59,20 @@ func (this *Action) Save() {
|
|
"project_id": projectid,
|
|
"project_id": projectid,
|
|
"dis_type": dis_type,
|
|
"dis_type": dis_type,
|
|
"dis_time": dis_time,
|
|
"dis_time": dis_time,
|
|
- "user_id": this.GetSession("entUserId").(string),
|
|
|
|
|
|
+ "user_id": this.GetSession("entUserId"),
|
|
"status": status,
|
|
"status": status,
|
|
"type": i_type,
|
|
"type": i_type,
|
|
"address": this.GetString("address"),
|
|
"address": this.GetString("address"),
|
|
"content": this.GetString("content"),
|
|
"content": this.GetString("content"),
|
|
"person": this.GetString("person"),
|
|
"person": this.GetString("person"),
|
|
"phone": this.GetString("phone"),
|
|
"phone": this.GetString("phone"),
|
|
- "time": this.GetString("time"),
|
|
|
|
|
|
+ "time": qutil.FormatDateByInt64(&time_i, qutil.Date_Full_Layout),
|
|
"createtime": qutil.FormatDateByInt64(&now, qutil.Date_Full_Layout),
|
|
"createtime": qutil.FormatDateByInt64(&now, qutil.Date_Full_Layout),
|
|
})
|
|
})
|
|
if i > 0 {
|
|
if i > 0 {
|
|
result["error_code"] = 0
|
|
result["error_code"] = 0
|
|
|
|
+ } else {
|
|
|
|
+ log.Println("保存信息有误")
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
result["error_msg"] = "缺少参数"
|
|
result["error_msg"] = "缺少参数"
|
|
@@ -145,7 +148,7 @@ func (this *Action) ListInfo() {
|
|
// this.SetSession("entUserId", "954")
|
|
// this.SetSession("entUserId", "954")
|
|
if this.Method() == "POST" {
|
|
if this.Method() == "POST" {
|
|
if this.GetSession("entUserId") != nil {
|
|
if this.GetSession("entUserId") != nil {
|
|
- entUserId, _ := this.GetSession("entUserId").(string)
|
|
|
|
|
|
+ entUserId := strconv.FormatFloat(this.GetSession("entUserId").(float64), 'f', 0, 64)
|
|
//客户id
|
|
//客户id
|
|
customer_str := this.GetString("c_id")
|
|
customer_str := this.GetString("c_id")
|
|
//员工查询或管理员查询
|
|
//员工查询或管理员查询
|
|
@@ -166,8 +169,10 @@ INNER JOIN entniche_department c ON (c.id = b.dept_id)
|
|
return_sql += ` AND a.user_id = ` + entUserId
|
|
return_sql += ` AND a.user_id = ` + entUserId
|
|
}
|
|
}
|
|
track_sql += ` ORDER BY a.createtime DESC`
|
|
track_sql += ` ORDER BY a.createtime DESC`
|
|
|
|
+ log.Println("track_sql:", track_sql)
|
|
track_Res := util.Mysql.SelectBySql(track_sql)
|
|
track_Res := util.Mysql.SelectBySql(track_sql)
|
|
return_sql += ` ORDER BY a.createtime DESC`
|
|
return_sql += ` ORDER BY a.createtime DESC`
|
|
|
|
+ log.Println("return_sql:", return_sql)
|
|
return_Res := util.Mysql.SelectBySql(return_sql)
|
|
return_Res := util.Mysql.SelectBySql(return_sql)
|
|
var _trackArr = []*trackInfo{}
|
|
var _trackArr = []*trackInfo{}
|
|
if track_Res != nil {
|
|
if track_Res != nil {
|
|
@@ -239,8 +244,8 @@ func (this *Action) ListReport() error {
|
|
log.Println(entId, "---", ym)
|
|
log.Println(entId, "---", ym)
|
|
if ym != 0 && entId != 0 {
|
|
if ym != 0 && entId != 0 {
|
|
// this.SetSession("entUserId", "954")
|
|
// this.SetSession("entUserId", "954")
|
|
- entUserId, _ := this.GetSession("entUserId").(string)
|
|
|
|
- if entUserId != "" {
|
|
|
|
|
|
+ // entUserId := strconv.FormatFloat(this.GetSession("entUserId").(float64), 'f', 0, 64)
|
|
|
|
+ if this.GetSession("entUserId") != nil {
|
|
//查询月和周的跟踪报告信息
|
|
//查询月和周的跟踪报告信息
|
|
list, ok := util.MQFW.Find("enttrack_statistic", map[string]interface{}{
|
|
list, ok := util.MQFW.Find("enttrack_statistic", map[string]interface{}{
|
|
"entid": entId,
|
|
"entid": entId,
|
|
@@ -294,16 +299,14 @@ func (this *Action) ListReport() error {
|
|
}
|
|
}
|
|
|
|
|
|
//跟踪报告详情
|
|
//跟踪报告详情
|
|
-
|
|
|
|
-func (this *Action) Detail() {
|
|
|
|
|
|
+func (this *Action) DetailReport() {
|
|
defer qutil.Catch()
|
|
defer qutil.Catch()
|
|
result := map[string]interface{}{
|
|
result := map[string]interface{}{
|
|
"error_code": -1,
|
|
"error_code": -1,
|
|
}
|
|
}
|
|
if this.Method() == "POST" {
|
|
if this.Method() == "POST" {
|
|
// this.SetSession("entUserId", "954")
|
|
// this.SetSession("entUserId", "954")
|
|
- entUserId, _ := this.GetSession("entUserId").(string)
|
|
|
|
- if entUserId != "" {
|
|
|
|
|
|
+ if this.GetSession("entUserId") != nil {
|
|
start, _ := this.GetInt("startdate")
|
|
start, _ := this.GetInt("startdate")
|
|
end, _ := this.GetInt("enddate")
|
|
end, _ := this.GetInt("enddate")
|
|
entId := this.GetString("entId")
|
|
entId := this.GetString("entId")
|
|
@@ -343,17 +346,31 @@ func (this *Action) Detail() {
|
|
"createtime": v["createtime"],
|
|
"createtime": v["createtime"],
|
|
})
|
|
})
|
|
} else {
|
|
} else {
|
|
|
|
+ finishData := util.Mysql.SelectBySql(`SELECT a.project_id,COUNT(a.project_id) AS pct,c.id AS customer_id FROM entniche_project_track a INNER JOIN entniche_project b ON (b.id=a.project_id)INNER JOIN entniche_customer c ON (c.id=b.customer_id) WHERE a.status = '1' AND c.ent_id=? AND a.createtime >= ? AND a.createtime <= ? GROUP BY a.project_id`, i_entId, qutil.FormatDateByInt64(&start, qutil.Date_Full_Layout), qutil.FormatDateByInt64(&end, qutil.Date_Full_Layout))
|
|
|
|
+ var ccount_finished int64 = 0
|
|
|
|
+ var pcount_finished int64 = 0
|
|
|
|
+ if finishData != nil && len(*finishData) > 0 {
|
|
|
|
+ cusIsexsits := map[int64]bool{}
|
|
|
|
+ for _, fv := range *finishData {
|
|
|
|
+ pcount_finished += fv["pct"].(int64)
|
|
|
|
+ if !cusIsexsits[fv["customer_id"].(int64)] {
|
|
|
|
+ cusIsexsits[fv["customer_id"].(int64)] = true
|
|
|
|
+ ccount_finished++
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
//每周或每月统计
|
|
//每周或每月统计
|
|
- data["customertotal"] = v["customertotal"] //"客户总数"
|
|
|
|
- data["ccount_new"] = v["customer"] //"新增客户数"
|
|
|
|
- data["ccount_finished"] = v["customertotal"] //"成单客户数"
|
|
|
|
- data["projecttotal"] = v["projecttotal"] //"项目总数"
|
|
|
|
- data["pcount_new"] = v["project"] //"新增项目数"
|
|
|
|
- data["pcount_finished"] = v["customertotal"] //"成单项目数据"
|
|
|
|
|
|
+ data["customertotal"] = v["customertotal"] //"客户总数"
|
|
|
|
+ data["ccount_new"] = v["customer"] //"新增客户数"
|
|
|
|
+ data["ccount_finished"] = ccount_finished //"成单客户数"
|
|
|
|
+ data["projecttotal"] = v["projecttotal"] //"项目总数"
|
|
|
|
+ data["pcount_new"] = v["project"] //"新增项目数"
|
|
|
|
+ data["pcount_finished"] = pcount_finished //"成单项目数据"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
data["details"] = details
|
|
data["details"] = details
|
|
result["data"] = data
|
|
result["data"] = data
|
|
|
|
+ result["error_code"] = 0
|
|
} else {
|
|
} else {
|
|
result["error_msg"] = "暂无数据"
|
|
result["error_msg"] = "暂无数据"
|
|
result["error_code"] = 0
|
|
result["error_code"] = 0
|
|
@@ -382,8 +399,7 @@ func (this *Action) Starttime() {
|
|
// log.Println(qutil.SE.Encode2HexByCheck(entId))
|
|
// log.Println(qutil.SE.Encode2HexByCheck(entId))
|
|
if entId != "" {
|
|
if entId != "" {
|
|
// this.SetSession("entUserId", "954")
|
|
// this.SetSession("entUserId", "954")
|
|
- entUserId, _ := this.GetSession("entUserId").(string)
|
|
|
|
- if entUserId != "" {
|
|
|
|
|
|
+ if this.GetSession("entUserId") != nil {
|
|
i_entId := qutil.Int64All(qutil.SE.Decode4HexByCheck(entId))
|
|
i_entId := qutil.Int64All(qutil.SE.Decode4HexByCheck(entId))
|
|
list, _ := util.MQFW.Find("enttrack_statistic", map[string]interface{}{
|
|
list, _ := util.MQFW.Find("enttrack_statistic", map[string]interface{}{
|
|
"entid": i_entId,
|
|
"entid": i_entId,
|