|
@@ -2,6 +2,7 @@ package cygx
|
|
|
|
|
|
import (
|
|
|
"encoding/json"
|
|
|
+ "github.com/rdlucklib/rdluck_tools/paging"
|
|
|
"hongze/hz_crm_api/controllers"
|
|
|
"hongze/hz_crm_api/models"
|
|
|
"hongze/hz_crm_api/models/company"
|
|
@@ -17,6 +18,58 @@ type EnterScoreController struct {
|
|
|
controllers.BaseAuthController
|
|
|
}
|
|
|
|
|
|
+// @Title X试用类客户检索
|
|
|
+// @Description X试用类客户检索接口
|
|
|
+// @Param KeyWord query string true "搜索关键词"
|
|
|
+// @Success 200 {object} company.CompanyNameAndIdListResp
|
|
|
+// @router /enterScore/company/searchlist [get]
|
|
|
+func (this *EnterScoreController) CompanySearchList() {
|
|
|
+ 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
|
|
|
+ }
|
|
|
+ keyWord := this.GetString("KeyWord")
|
|
|
+ keyWord = strings.Trim(keyWord, " ")
|
|
|
+ keyWord = strings.Replace(keyWord, "'", "", -1)
|
|
|
+
|
|
|
+ resp := new(company.CompanyNameAndIdListResp)
|
|
|
+ var companyCondition string
|
|
|
+ var companypars []interface{}
|
|
|
+ var listResp []*company.CompanyNameAndId
|
|
|
+ companyCondition += ` AND b.product_name = ? `
|
|
|
+ companypars = append(companypars, "权益")
|
|
|
+ companyCondition += ` AND b.status = ? `
|
|
|
+ companypars = append(companypars, "永续")
|
|
|
+
|
|
|
+ if keyWord != "" {
|
|
|
+ companyCondition += ` AND a.company_name LIKE '%` + keyWord + `%' `
|
|
|
+ }
|
|
|
+ companyList, err := company.GetCompanyIdListByproductName(companyCondition, companypars)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取失败"
|
|
|
+ br.ErrMsg = "获取失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if len(companyList) == 0 {
|
|
|
+ listResp = make([]*company.CompanyNameAndId, 0)
|
|
|
+ } else {
|
|
|
+ listResp = companyList
|
|
|
+ }
|
|
|
+ resp.List = listResp
|
|
|
+ br.Ret = 200
|
|
|
+ br.Success = true
|
|
|
+ br.Msg = "获取成功"
|
|
|
+ br.Data = resp
|
|
|
+}
|
|
|
+
|
|
|
// @Title 详情
|
|
|
// @Description 获取详情接口
|
|
|
// @Param EnterScoreId query int true "录分ID"
|
|
@@ -393,3 +446,132 @@ func (this *EnterScoreController) EnterScoreUpdate() {
|
|
|
br.IsAddLog = true
|
|
|
br.Msg = "操作成功"
|
|
|
}
|
|
|
+
|
|
|
+// @Title 列表
|
|
|
+// @Description 列表接口
|
|
|
+// @Param PageSize query int true "每页数据条数"
|
|
|
+// @Param CurrentIndex query int true "当前页页码,从1开始"
|
|
|
+// @Param KeyWord query string true "搜索关键词"
|
|
|
+// @Param AdminId query string true "销售id,多个用英文逗号隔开,空字符串为全部"
|
|
|
+// @Success 200 {object} cygx.GetCygxEnterScoreListRep
|
|
|
+// @router /enterScore/list [get]
|
|
|
+func (this *EnterScoreController) EnterScoreList() {
|
|
|
+ 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")
|
|
|
+ keyWord := this.GetString("KeyWord")
|
|
|
+ adminId := this.GetString("AdminId")
|
|
|
+
|
|
|
+ var startSize int
|
|
|
+ if pageSize <= 0 {
|
|
|
+ pageSize = utils.PageSize20
|
|
|
+ }
|
|
|
+ if currentIndex <= 0 {
|
|
|
+ currentIndex = 1
|
|
|
+ }
|
|
|
+
|
|
|
+ startSize = utils.StartIndex(currentIndex, pageSize)
|
|
|
+ var condition string
|
|
|
+ var pars []interface{}
|
|
|
+ if keyWord != "" {
|
|
|
+ condition += ` AND company_name LIKE '%` + keyWord + `%' `
|
|
|
+ }
|
|
|
+ if adminId != "" {
|
|
|
+ condition += ` AND seller_id IN (` + adminId + `) `
|
|
|
+ }
|
|
|
+ total, err := cygx.GetCygxEnterScoreCount(condition, pars)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取失败"
|
|
|
+ br.ErrMsg = "获取失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ list, err := cygx.GetCygxEnterScoreList(condition, pars, startSize, pageSize)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取失败"
|
|
|
+ br.ErrMsg = "获取失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ resp := new(cygx.GetCygxEnterScoreListRep)
|
|
|
+ if len(list) == 0 {
|
|
|
+ resp.List = make([]*cygx.EnterScoreListResp, 0)
|
|
|
+ } else {
|
|
|
+ for _, v := range list {
|
|
|
+ item := new(cygx.EnterScoreListResp)
|
|
|
+ item.EnterScoreId = v.EnterScoreId
|
|
|
+ item.CompanyId = v.CompanyId
|
|
|
+ item.CompanyName = v.CompanyName
|
|
|
+ item.Quarter = strings.Split(v.Quarter, ",")
|
|
|
+ item.EnterScoreType = v.EnterScoreType
|
|
|
+ item.Ranking = v.Ranking
|
|
|
+ item.IsMergeScoring = v.IsMergeScoring
|
|
|
+ item.SecuritiesFirmsName = v.SecuritiesFirmsName
|
|
|
+ item.ProportionTotal = v.ProportionTotal
|
|
|
+ item.EnterScoreId = v.EnterScoreId
|
|
|
+ item.SellerId = v.SellerId
|
|
|
+ item.SellerName = v.SellerName
|
|
|
+ item.CreateTime = v.CreateTime.Format(utils.FormatDateTime)
|
|
|
+ item.ModifyTime = v.ModifyTime.Format(utils.FormatDateTime)
|
|
|
+ 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 request body cygx.UpdateEnterScoreReq true "type json string"
|
|
|
+// @Success 200 {object} "保存成功"
|
|
|
+// @router /enterScore/delete [post]
|
|
|
+func (this *EnterScoreController) EnterScoreDelete() {
|
|
|
+ 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
|
|
|
+ }
|
|
|
+ var req cygx.EnterScoreIdReq
|
|
|
+ err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "参数解析异常!"
|
|
|
+ br.ErrMsg = "参数解析失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ enterScoreId := req.EnterScoreId
|
|
|
+ if enterScoreId == 0 {
|
|
|
+ br.Msg = "参数错误!"
|
|
|
+ br.ErrMsg = "参数错误,EnterScoreId 不能为0"
|
|
|
+ return
|
|
|
+ }
|
|
|
+ err = cygx.DeleteEnterScore(enterScoreId)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "删除失败"
|
|
|
+ br.ErrMsg = "操作失败Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ br.Ret = 200
|
|
|
+ br.Success = true
|
|
|
+ br.IsAddLog = true
|
|
|
+ br.Msg = "删除成功"
|
|
|
+}
|