|
@@ -273,14 +273,85 @@ func (rg *ContractController) ServiceDetail(c *gin.Context) {
|
|
|
resp.OkData("获取成功", contractDetail, c)
|
|
|
}
|
|
|
|
|
|
+// SealList
|
|
|
+// @Title 权益搜索合规合同
|
|
|
+// @Description 权益搜索合规合同
|
|
|
+// @Param keyword query string false "关键词"
|
|
|
+// @Success 200 {object} crm.ContractSearchListResp
|
|
|
+// @router /crm/contract/seal_list [get]
|
|
|
+func (rg *ContractController) SealList(c *gin.Context) {
|
|
|
+ var req crm.ContractSearchListReq
|
|
|
+ if e := c.BindQuery(&req); e != nil {
|
|
|
+ err, ok := e.(validator.ValidationErrors)
|
|
|
+ if !ok {
|
|
|
+ resp.FailData("参数解析失败", "Err:"+e.Error(), c)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ resp.FailData("参数解析失败", err.Translate(global.Trans), c)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ keyword := req.Keyword
|
|
|
+ if keyword == "" {
|
|
|
+ resp.FailMsg("获取失败", "合同编号不能为空", c)
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ if !utils.CheckRaiContractCode(keyword) {
|
|
|
+ resp.FailMsg("获取失败", "合同编号不符合规范", c)
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ cond := ``
|
|
|
+ pars := make([]interface{}, 0)
|
|
|
+ kw := "%" + req.Keyword + "%"
|
|
|
+ cond += ` code LIKE ? `
|
|
|
+ pars = append(pars, kw)
|
|
|
+ if req.ProductId > 0 {
|
|
|
+ cond += ` product_id = ?`
|
|
|
+ pars = append(pars, req.ProductId)
|
|
|
+ }
|
|
|
+ page := new(base.Page)
|
|
|
+ page.SetPageSize(req.PageSize)
|
|
|
+ page.SetCurrent(req.Current)
|
|
|
+ page.AddOrderItem(base.OrderItem{Column: "create_time", Asc: false})
|
|
|
+
|
|
|
+ ob := new(crm.Seal)
|
|
|
+ total, list, e := ob.PageList(page, cond, pars)
|
|
|
+ if e != nil {
|
|
|
+ resp.FailMsg("获取失败", "获取合同列表失败, Err: "+e.Error(), c)
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ respList := make([]*crm.ContractSearchListResp, 0)
|
|
|
+ for i := range list {
|
|
|
+ respItem := &crm.ContractSearchListResp{
|
|
|
+ ContractId: list[i].SealId,
|
|
|
+ ContractCode: list[i].Code,
|
|
|
+ ProductId: list[i].ProductId,
|
|
|
+ CompanyName: list[i].CompanyName,
|
|
|
+ SellerId: list[i].UserId,
|
|
|
+ SellerName: list[i].UserName,
|
|
|
+ StartDate: utils.TimeTransferString(utils.FormatDate, list[i].StartDate),
|
|
|
+ EndDate: utils.TimeTransferString(utils.FormatDate, list[i].EndDate),
|
|
|
+ }
|
|
|
+ respItem.ContractBusinessTypeInt = 2
|
|
|
+ respList = append(respList, respItem)
|
|
|
+ }
|
|
|
+ page.SetTotal(total)
|
|
|
+ baseData := new(base.BaseData)
|
|
|
+ baseData.SetPage(page)
|
|
|
+ baseData.SetList(respList)
|
|
|
+ resp.OkData("获取成功", baseData, c)
|
|
|
+}
|
|
|
+
|
|
|
// SealDetail
|
|
|
// @Title 获取合同的套餐及品种权限
|
|
|
// @Description 获取合同的套餐及品种权限
|
|
|
-// @Param ContractCode query string true "合同编号"
|
|
|
+// @Param ContractId query int true "合同ID"
|
|
|
// @Success 200 {object} crm.ContractDetail
|
|
|
// @router /crm/contract/seal_detail [get]
|
|
|
func (rg *ContractController) SealDetail(c *gin.Context) {
|
|
|
- var req crm.SealServiceDetailReq
|
|
|
+ var req crm.ContractServiceDetailReq
|
|
|
if e := c.BindQuery(&req); e != nil {
|
|
|
err, ok := e.(validator.ValidationErrors)
|
|
|
if !ok {
|
|
@@ -291,7 +362,7 @@ func (rg *ContractController) SealDetail(c *gin.Context) {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- contractDetail, e := crmService.GetSealDetail(req.ContractCode)
|
|
|
+ contractDetail, e := crmService.GetSealDetail(req.ContractId)
|
|
|
if e != nil {
|
|
|
global.LOG.Error(e.Error())
|
|
|
resp.FailMsg("获取失败", "获取合同套餐及品种信息失败, Err: "+e.Error(), c)
|