|
@@ -1,9 +1,13 @@
|
|
|
package cygx
|
|
|
|
|
|
import (
|
|
|
+ "fmt"
|
|
|
+ "github.com/rdlucklib/rdluck_tools/paging"
|
|
|
"hongze/hz_crm_api/controllers"
|
|
|
"hongze/hz_crm_api/models"
|
|
|
+ "hongze/hz_crm_api/models/company"
|
|
|
"hongze/hz_crm_api/models/cygx"
|
|
|
+ "hongze/hz_crm_api/utils"
|
|
|
"strings"
|
|
|
)
|
|
|
|
|
@@ -47,9 +51,9 @@ func (this *RaiServeCoAntroller) TypeList() {
|
|
|
// @Title 标签搜索
|
|
|
// @Description 标签搜索接口
|
|
|
// @Param KeyWord query string false "搜索关键词"
|
|
|
-// @Success 200 {object} cygx.ActivityCcustomerTypeList
|
|
|
+// @Success 200 {object} cygx.RaiServeTagListResp
|
|
|
// @router /rai_serve/search_tag [get]
|
|
|
-func (this *RaiServeCoAntroller) List() {
|
|
|
+func (this *RaiServeCoAntroller) SearchTag() {
|
|
|
br := new(models.BaseResponse).Init()
|
|
|
defer func() {
|
|
|
this.Data["json"] = br
|
|
@@ -89,7 +93,6 @@ func (this *RaiServeCoAntroller) List() {
|
|
|
return
|
|
|
}
|
|
|
for _, v := range listChartPermission {
|
|
|
-
|
|
|
item := new(cygx.RaiServeTagResp)
|
|
|
item.TagType = 3
|
|
|
item.TagId = v.ChartPermissionId
|
|
@@ -106,3 +109,236 @@ func (this *RaiServeCoAntroller) List() {
|
|
|
br.Msg = "获取成功"
|
|
|
br.Data = resp
|
|
|
}
|
|
|
+
|
|
|
+// @Title 权益服务统计列表
|
|
|
+// @Description 权益服务统计列表接口
|
|
|
+// @Param PageSize query int true "每页数据条数"
|
|
|
+// @Param CurrentIndex query int true "当前页页码,从1开始"
|
|
|
+// @Param SellerId query string false "销售id"
|
|
|
+// @Param ShareSellerId query string false "共享销售ID"
|
|
|
+// @Param ServeTypeId int int false "服务类型ID"
|
|
|
+// @Param TagType int string false "标签类型"
|
|
|
+// @Param TagId int string false "标签ID"
|
|
|
+// @Param Status query string false "客户状态,正式、未续约(除了正式之外的所有)"
|
|
|
+// @Param SortType query string true "如何排序,是正序还是倒序,枚举值:`asc 正序`,`desc 倒叙`"
|
|
|
+// @Param IsExport query bool false "是否导出excel,默认是false"
|
|
|
+// @Success 200 {object} cygx.RaiServeTagListResp
|
|
|
+// @router /rai_serve/list [get]
|
|
|
+func (this *RaiServeCoAntroller) List() {
|
|
|
+ br := new(models.BaseResponse).Init()
|
|
|
+ defer func() {
|
|
|
+ this.Data["json"] = br
|
|
|
+ this.ServeJSON()
|
|
|
+ }()
|
|
|
+ sysUser := this.SysUser
|
|
|
+ if sysUser == nil {
|
|
|
+ br.Msg = "请登录"
|
|
|
+ br.ErrMsg = "请登录,SysUser Is Empty"
|
|
|
+ br.Ret = 408
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ pageSize, _ := this.GetInt("PageSize")
|
|
|
+ currentIndex, _ := this.GetInt("CurrentIndex")
|
|
|
+ status := this.GetString("Status")
|
|
|
+ sellerId := this.GetString("SellerId")
|
|
|
+ shareSellerId := this.GetString("ShareSellerId")
|
|
|
+ sortType := this.GetString("SortType")
|
|
|
+ tagType, _ := this.GetInt("TagType")
|
|
|
+ tagId, _ := this.GetInt("TagId")
|
|
|
+ serveTypeId, _ := this.GetInt("ServeTypeId")
|
|
|
+ isExport, _ := this.GetBool("IsExport")
|
|
|
+ resp := new(cygx.CygxRaiServeCompanyListResp)
|
|
|
+
|
|
|
+ var startSize int
|
|
|
+ if pageSize <= 0 {
|
|
|
+ pageSize = utils.PageSize20
|
|
|
+ }
|
|
|
+ if currentIndex <= 0 {
|
|
|
+ currentIndex = 1
|
|
|
+ }
|
|
|
+ startSize = utils.StartIndex(currentIndex, pageSize)
|
|
|
+ var condition string
|
|
|
+ var sortStr string
|
|
|
+ var pars []interface{}
|
|
|
+
|
|
|
+ if status != "" {
|
|
|
+ if status == "正式" {
|
|
|
+ condition = " AND status = '正式' "
|
|
|
+ } else {
|
|
|
+ condition = " AND status != '正式' "
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if sellerId != "" {
|
|
|
+ condition = " AND seller_id IN (?) "
|
|
|
+ pars = append(pars, sellerId)
|
|
|
+ }
|
|
|
+
|
|
|
+ if shareSellerId != "" {
|
|
|
+ condition = " AND share_seller_id IN (?) "
|
|
|
+ pars = append(pars, shareSellerId)
|
|
|
+ }
|
|
|
+
|
|
|
+ if sortType != "" {
|
|
|
+ if sortType == "asc" {
|
|
|
+ sortStr = " ORDER BY money ASC "
|
|
|
+ } else if sortType == "desc" {
|
|
|
+ sortStr = " ORDER BY money DESC "
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ sortStr = " ORDER BY end_date DESC "
|
|
|
+ }
|
|
|
+
|
|
|
+ total, err := cygx.GetCygxRaiServeCompanyCount(condition, pars)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取失败"
|
|
|
+ br.ErrMsg = "获取失败,GetCygxRaiServeCompanyCountErr:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ listRaiServeCompany, err := cygx.GetCygxRaiServeCompanyList(condition+sortStr, pars, startSize, pageSize)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取失败"
|
|
|
+ br.ErrMsg = "获取失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ switch tagType {
|
|
|
+ case 1:
|
|
|
+ fmt.Println(tagId)
|
|
|
+ case 2:
|
|
|
+ case 3:
|
|
|
+
|
|
|
+ }
|
|
|
+ if serveTypeId > 0 {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ if isExport {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ for _, v := range listRaiServeCompany {
|
|
|
+ item := new(cygx.CygxRaiServeCompanyResp)
|
|
|
+ item.CompanyId = v.CompanyId
|
|
|
+ item.CompanyName = v.CompanyName
|
|
|
+ item.Money = v.Money
|
|
|
+ item.ServeCoverageRate = v.ServeCoverageRate + "%"
|
|
|
+ item.SellerId = v.SellerId
|
|
|
+ item.SellerName = v.SellerName
|
|
|
+ item.StartDate = v.StartDate
|
|
|
+ item.StartDate = v.StartDate
|
|
|
+ item.EndDate = v.EndDate
|
|
|
+ item.ShareSeller = v.ShareSeller
|
|
|
+ item.ShareSellerId = v.ShareSellerId
|
|
|
+ item.Status = v.Status
|
|
|
+ item.PermissionName = v.PermissionName
|
|
|
+ item.ThisWeekAmount = 99
|
|
|
+ item.LastWeekAmount = 99
|
|
|
+ item.TwoWeekAmount = 99
|
|
|
+ item.ThreeWeekAmount = 99
|
|
|
+ resp.List = append(resp.List, item)
|
|
|
+ }
|
|
|
+
|
|
|
+ page := paging.GetPaging(currentIndex, pageSize, total)
|
|
|
+
|
|
|
+ resp.Paging = page
|
|
|
+ br.Ret = 200
|
|
|
+ br.Success = true
|
|
|
+ br.Msg = "获取成功"
|
|
|
+ br.Data = resp
|
|
|
+}
|
|
|
+
|
|
|
+// @Title 近四周覆盖率
|
|
|
+// @Description 近四周覆盖率接口
|
|
|
+// @Param CompanyId query int false "公司ID"
|
|
|
+// @Success 200 {object} cygx.RaiServeTagListResp
|
|
|
+// @router /rai_serve/coverage_rate [get]
|
|
|
+func (this *RaiServeCoAntroller) CoverageRate() {
|
|
|
+ br := new(models.BaseResponse).Init()
|
|
|
+ defer func() {
|
|
|
+ this.Data["json"] = br
|
|
|
+ this.ServeJSON()
|
|
|
+ }()
|
|
|
+ sysUser := this.SysUser
|
|
|
+ if sysUser == nil {
|
|
|
+ br.Msg = "请登录"
|
|
|
+ br.ErrMsg = "请登录,SysUser Is Empty"
|
|
|
+ br.Ret = 408
|
|
|
+ return
|
|
|
+ }
|
|
|
+ companyId := this.GetString("CompanyId")
|
|
|
+ fmt.Println(companyId)
|
|
|
+ resp := new(cygx.RaiServeCoverageRateResp)
|
|
|
+ resp.List = []string{"22%", "33%", "44%", "55%"}
|
|
|
+ br.Ret = 200
|
|
|
+ br.Success = true
|
|
|
+ br.Msg = "获取成功"
|
|
|
+ br.Data = resp
|
|
|
+}
|
|
|
+
|
|
|
+// @Title 明细列表
|
|
|
+// @Description 明细列表接口
|
|
|
+// @Param CompanyId query int false "公司ID"
|
|
|
+// @Param TagType query int false "标签类型"
|
|
|
+// @Param TagId query int false "标签ID"
|
|
|
+// @Param ServeTypeId int int false "服务类型ID"
|
|
|
+// @Param WhatWeek query int false "哪一周 ,1:本周、2:上周、3:上上周、4上三周"
|
|
|
+// @Success 200 {object} cygx.RaiServeTagListResp
|
|
|
+// @router /rai_serve/bill_list [get]
|
|
|
+func (this *RaiServeCoAntroller) BillList() {
|
|
|
+ br := new(models.BaseResponse).Init()
|
|
|
+ defer func() {
|
|
|
+ this.Data["json"] = br
|
|
|
+ this.ServeJSON()
|
|
|
+ }()
|
|
|
+ sysUser := this.SysUser
|
|
|
+ if sysUser == nil {
|
|
|
+ br.Msg = "请登录"
|
|
|
+ br.ErrMsg = "请登录,SysUser Is Empty"
|
|
|
+ br.Ret = 408
|
|
|
+ return
|
|
|
+ }
|
|
|
+ companyId, _ := this.GetInt("CompanyId")
|
|
|
+ tagType, _ := this.GetInt("TagType")
|
|
|
+ tagId, _ := this.GetInt("TagId")
|
|
|
+ serveTypeId, _ := this.GetInt("ServeTypeId")
|
|
|
+ if companyId == 0 {
|
|
|
+ br.Msg = "请选择对应公司ID"
|
|
|
+ return
|
|
|
+ }
|
|
|
+ companyInfo, err := company.GetCompanyById(companyId)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取失败"
|
|
|
+ br.ErrMsg = "获取失败,GetCompanyById:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ var condition string
|
|
|
+ var pars []interface{}
|
|
|
+ condition = " AND company_id = ? "
|
|
|
+ pars = append(pars, companyId)
|
|
|
+ if serveTypeId > 0 {
|
|
|
+ condition += " AND serve_type_id = ? "
|
|
|
+ pars = append(pars, serveTypeId)
|
|
|
+ }
|
|
|
+ switch tagType {
|
|
|
+ case 1:
|
|
|
+ fmt.Println(tagId)
|
|
|
+ case 2:
|
|
|
+ case 3:
|
|
|
+
|
|
|
+ }
|
|
|
+ list, err := cygx.GetCygxRaiServeBillRespList(condition, pars)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取失败"
|
|
|
+ br.ErrMsg = "获取失败,GetCygxRaiServeCompanyCountErr:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ resp := new(cygx.CygxRaiServeBillListResp)
|
|
|
+ resp.CompanyName = companyInfo.CompanyName
|
|
|
+ resp.List = list
|
|
|
+ br.Ret = 200
|
|
|
+ br.Success = true
|
|
|
+ br.Msg = "获取成功"
|
|
|
+ br.Data = resp
|
|
|
+}
|