|
@@ -371,37 +371,37 @@ func GetIncomeList(condition string, pars []interface{}, startSize, pageSize int
|
|
|
|
|
|
// 增量客户统计报表列表数据结构
|
|
|
type IncrementalList struct {
|
|
|
- CompanyContractId int `description:"合同id"`
|
|
|
- ContractType string `description:"合同类型"`
|
|
|
- CompanyId int `description:"企业客户id"`
|
|
|
- CompanyName string `description:"企业客户名称"`
|
|
|
- ProductId int `description:"产品id"`
|
|
|
- ProductName string `description:"产品名称"`
|
|
|
- CompanyProductId int `description:"客户购买产品授权id"`
|
|
|
- ContractCode string `description:"合同编码"`
|
|
|
- StartDate string `description:"合同开始日期"`
|
|
|
- EndDate string `description:"合同结束日期"`
|
|
|
- Money float64 `description:"合同金额"`
|
|
|
- PayMethod string `description:"付款方式"`
|
|
|
- PayChannel string `description:"付款渠道"`
|
|
|
- ImgUrl string `description:"合同图片"`
|
|
|
- CreateTime string `description:"合同创建时间"`
|
|
|
- ModifyTime string `description:"合同修改时间"`
|
|
|
- Status string `description:"合同审批状态,0:待审批,1:已审批;默认:1"`
|
|
|
- RegionType string `description:"企业客户所属区域;可选范围:国内,海外"`
|
|
|
- SellerId int `description:"归属销售id"`
|
|
|
- SellerName string `description:"归属销售名称"`
|
|
|
- ExpireDay string `description:"剩余可用天数"`
|
|
|
- PermissionList []*company.CompanyReportPermission `description:"产品权限"`
|
|
|
- Count int `json:"-" description:"合同数"`
|
|
|
- RenewalReason string `description:"未续约说明"`
|
|
|
- RenewalTodo string `description:"未续约说明中的待办事项说明"`
|
|
|
- PackageDifference string `description:"和上一份合同的区别"`
|
|
|
- AscribeContent string `description:"归因标签说明"`
|
|
|
- IsShowNoRenewedNote bool `description:"是否展示未续约备注按钮"`
|
|
|
- Content string `description:"归因内容说明"`
|
|
|
- PermissionName string `description:"权限名"`
|
|
|
- CompanyContractIdGroup string `description:"表company_contract合并的 company_contract_id"`
|
|
|
+ CompanyContractId int `description:"合同id"`
|
|
|
+ ContractType string `description:"合同类型"`
|
|
|
+ CompanyId int `description:"企业客户id"`
|
|
|
+ CompanyName string `description:"企业客户名称"`
|
|
|
+ ProductId int `description:"产品id"`
|
|
|
+ ProductName string `description:"产品名称"`
|
|
|
+ CompanyProductId int `description:"客户购买产品授权id"`
|
|
|
+ ContractCode string `description:"合同编码"`
|
|
|
+ StartDate string `description:"合同开始日期"`
|
|
|
+ EndDate string `description:"合同结束日期"`
|
|
|
+ Money float64 `description:"合同金额"`
|
|
|
+ PayMethod string `description:"付款方式"`
|
|
|
+ PayChannel string `description:"付款渠道"`
|
|
|
+ ImgUrl string `description:"合同图片"`
|
|
|
+ CreateTime string `description:"合同创建时间"`
|
|
|
+ ModifyTime string `description:"合同修改时间"`
|
|
|
+ Status string `description:"合同审批状态,0:待审批,1:已审批;默认:1"`
|
|
|
+ RegionType string `description:"企业客户所属区域;可选范围:国内,海外"`
|
|
|
+ SellerId int `description:"归属销售id"`
|
|
|
+ SellerName string `description:"归属销售名称"`
|
|
|
+ ExpireDay string `description:"剩余可用天数"`
|
|
|
+ PermissionList []*company.CompanyReportPermission `description:"产品权限"`
|
|
|
+ Count int `json:"-" description:"合同数"`
|
|
|
+ RenewalReason string `description:"未续约说明"`
|
|
|
+ RenewalTodo string `description:"未续约说明中的待办事项说明"`
|
|
|
+ PackageDifference string `description:"和上一份合同的区别"`
|
|
|
+ AscribeContent string `description:"归因标签说明"`
|
|
|
+ IsShowNoRenewedNote bool `description:"是否展示未续约备注按钮"`
|
|
|
+ Content string `description:"归因内容说明"`
|
|
|
+ PermissionName string `description:"权限名"`
|
|
|
+ //CompanyContractIdGroup string `description:"表company_contract合并的 company_contract_id"`
|
|
|
}
|
|
|
|
|
|
// GetIncrementalNewCompanyCount 获取增量客户报表列表统计数据(根据合同来展示)
|
|
@@ -862,3 +862,34 @@ func GetIncrementalCompanyMergeList(condition string, pars []interface{}, startS
|
|
|
_, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items)
|
|
|
return
|
|
|
}
|
|
|
+
|
|
|
+// GetIncrementalCompanyListByOperationRecordMerge 未续约合同
|
|
|
+func GetIncrementalCompanyListByOperationRecordMerge(condition string, pars []interface{}, startSize, pageSize int) (items []*IncrementalList, err error) {
|
|
|
+ o := orm.NewOrm()
|
|
|
+
|
|
|
+ ////查询出最大id
|
|
|
+ //sql1 := `SELECT max(id) id FROM company_operation_record a
|
|
|
+ // RIGHT JOIN company b ON a.company_id = b.company_id
|
|
|
+ // JOIN company_product c ON b.company_id = c.company_id
|
|
|
+ // AND a.product_id = c.product_id
|
|
|
+ //WHERE 1 = 1 `
|
|
|
+ //if condition != "" {
|
|
|
+ // sql1 += condition
|
|
|
+ //}
|
|
|
+ //sql1 += ` GROUP BY a.company_id, a.product_id `
|
|
|
+
|
|
|
+ //查询真正的数据
|
|
|
+ sql := `SELECT a.company_contract_id,a.contract_type ,a.company_product_id ,a.contract_code ,a.pay_method ,a.pay_channel ,a.package_difference ,a.company_id, a.start_date, a.end_date, a.money, b.company_name, c.seller_id, c.seller_name, a.product_id, a.product_name, a.create_time, b.region_type, c.renewal_reason, c.renewal_todo, c.status FROM company_contract a
|
|
|
+ RIGHT JOIN company b ON a.company_id = b.company_id
|
|
|
+ JOIN company_product c ON b.company_id = c.company_id
|
|
|
+ AND a.product_id = c.product_id where 1=1 `
|
|
|
+ //where a.id in (` + sql1 + `) order by create_time DESC,company_id DESC limit ?,?`
|
|
|
+ // _, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items)
|
|
|
+
|
|
|
+ if condition != "" {
|
|
|
+ sql += condition
|
|
|
+ }
|
|
|
+ sql += ` group by a.company_contract_id order by start_date desc,company_id desc limit ?,?`
|
|
|
+ _, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items)
|
|
|
+ return
|
|
|
+}
|