|
@@ -9,6 +9,7 @@ import (
|
|
|
contractService "hongze/hongze_mobile_admin/services/contract"
|
|
|
"hongze/hongze_mobile_admin/utils"
|
|
|
"rdluck_tools/paging"
|
|
|
+ "strings"
|
|
|
)
|
|
|
|
|
|
//合同模块
|
|
@@ -82,6 +83,7 @@ func (this *ContractCommon) Detail() {
|
|
|
// @router /company_list [get]
|
|
|
func (this *ContractCommon) CompanyList() {
|
|
|
sysUser := this.AdminWx
|
|
|
+
|
|
|
keyword := this.GetString("Keyword")
|
|
|
//搜索关键字
|
|
|
if keyword == "" {
|
|
@@ -91,11 +93,7 @@ func (this *ContractCommon) CompanyList() {
|
|
|
status := this.GetString("Status")
|
|
|
companyNameList := make([]string, 0)
|
|
|
|
|
|
- sellerId := 0
|
|
|
- if sysUser.RoleTypeCode != utils.ROLE_TYPE_CODE_COMPLIANCE {
|
|
|
- sellerId = this.AdminWx.AdminId
|
|
|
- }
|
|
|
- list, err := contract.GetCompanyNameList(sellerId, keyword, status)
|
|
|
+ list, err := contract.GetCompanyNameList(this.AdminWx.AdminId, keyword, status)
|
|
|
if err != nil {
|
|
|
this.FailWithMessage("获取客户名称列表失败!", "获取客户名称列表失败,ERR:"+err.Error())
|
|
|
return
|
|
@@ -106,40 +104,39 @@ func (this *ContractCommon) CompanyList() {
|
|
|
}
|
|
|
|
|
|
//审批列表中(跟自己有关联的)
|
|
|
- //childCondition := ""
|
|
|
- //condition := ""
|
|
|
- //childPars := make([]interface{}, 0)
|
|
|
- //pars := make([]interface{}, 0)
|
|
|
- //if status != "" {
|
|
|
- // condition += `and c.status=? `
|
|
|
- // pars = append(pars, status)
|
|
|
- //}
|
|
|
- ////归属
|
|
|
- ////如果不是合规,那么只能查看跟自己有关联的
|
|
|
- //if sysUser.RoleTypeCode != utils.ROLE_TYPE_CODE_COMPLIANCE {
|
|
|
- // if status == "待审批" {
|
|
|
- // condition += ` AND ((c.seller_id = ? and a.start_node_id = a.curr_node_id) OR (d.approve_user_id = ? )) and d.status="待审批" `
|
|
|
- // } else {
|
|
|
- // condition += ` AND (c.seller_id = ? or d.approve_user_id = ?)`
|
|
|
- // }
|
|
|
- // pars = append(pars, sysUser.AdminId, sysUser.AdminId)
|
|
|
- //}
|
|
|
- //
|
|
|
- //condition += `and (company_name like '%` + keyword + `%' or credit_code like '%` + keyword + `%')`
|
|
|
- //
|
|
|
- //list2, err := contract_approval.GetCompanyNameListV2(childCondition, condition, childPars, pars)
|
|
|
- //if err != nil {
|
|
|
- // this.FailWithMessage("获取客户名称列表失败!", "获取客户名称列表失败,ERR:"+err.Error())
|
|
|
- // return
|
|
|
- //}
|
|
|
- //for _, v := range list2 {
|
|
|
- // if !strings.Contains(strings.Join(companyNameList, ","), v.CompanyName) {
|
|
|
- // companyNameList = append(companyNameList, v.CompanyName)
|
|
|
- // }
|
|
|
- //}
|
|
|
+ childCondition := ""
|
|
|
+ condition := ""
|
|
|
+ childPars := make([]interface{}, 0)
|
|
|
+ pars := make([]interface{}, 0)
|
|
|
+ if status != "" {
|
|
|
+ condition += `and c.status=? `
|
|
|
+ pars = append(pars, status)
|
|
|
+ }
|
|
|
+ //归属
|
|
|
+ //如果不是合规,那么只能查看跟自己有关联的
|
|
|
+ if status == "待审批" {
|
|
|
+ condition += ` AND ((c.seller_id = ? and a.start_node_id = a.curr_node_id) OR (d.approve_user_id = ? )) and d.status="待审批" `
|
|
|
+ } else {
|
|
|
+ condition += ` AND (c.seller_id = ? or (d.approve_user_id = ? and c.status != "已撤回") )`
|
|
|
+ }
|
|
|
+ pars = append(pars, sysUser.AdminId, sysUser.AdminId)
|
|
|
+
|
|
|
+ condition += `and (company_name like '%` + keyword + `%' or credit_code like '%` + keyword + `%')`
|
|
|
+
|
|
|
+ list2, err := contract_approval.GetCompanyNameListV2(childCondition, condition, childPars, pars)
|
|
|
+ if err != nil {
|
|
|
+ this.FailWithMessage("获取客户名称列表失败!", "获取客户名称列表失败,ERR:"+err.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+ for _, v := range list2 {
|
|
|
+ if !strings.Contains(strings.Join(companyNameList, ","), v.CompanyName) {
|
|
|
+ companyNameList = append(companyNameList, v.CompanyName)
|
|
|
+ }
|
|
|
+ }
|
|
|
this.OkDetailed(companyNameList, "获取成功")
|
|
|
}
|
|
|
|
|
|
+// List
|
|
|
// @Title 合同列表
|
|
|
// @Description 合同列表接口
|
|
|
// @Param ContractType query string false "合同类型,枚举值:'新签合同','续约合同','补充协议'"
|
|
@@ -149,6 +146,7 @@ func (this *ContractCommon) CompanyList() {
|
|
|
// @Param ModifyEndTime query string false "服务更新时间的选择结束时间,格式:2021-05-26 23:59:59"
|
|
|
// @Param SellerId query string false "选择的销售id"
|
|
|
// @Param Keyword query string false "搜索关键字"
|
|
|
+// @Param KeywordEq query string false "搜索关键字(全等)"
|
|
|
// @Success 200 {object} contract.ContractListResp
|
|
|
// @router /list [get]
|
|
|
func (this *ContractCommon) List() {
|
|
@@ -161,6 +159,7 @@ func (this *ContractCommon) List() {
|
|
|
modifyEndTime := this.GetString("ModifyEndTime")
|
|
|
sellerIds := this.GetString("SellerId")
|
|
|
keyword := this.GetString("Keyword")
|
|
|
+ keywordEq := this.GetString("KeywordEq")
|
|
|
|
|
|
condition := ""
|
|
|
pars := make([]interface{}, 0)
|
|
@@ -201,6 +200,11 @@ func (this *ContractCommon) List() {
|
|
|
if keyword != "" {
|
|
|
condition += ` AND (contract_code LIKE '%` + keyword + `%' OR company_name LIKE '%` + keyword + `%' OR credit_code LIKE '%` + keyword + `%' ) `
|
|
|
}
|
|
|
+ //关键字(全等)
|
|
|
+ if keywordEq != "" {
|
|
|
+ condition += ` AND c.company_name =? `
|
|
|
+ pars = append(pars, keywordEq)
|
|
|
+ }
|
|
|
|
|
|
pageSize, _ := this.GetInt("PageSize")
|
|
|
currentIndex, _ := this.GetInt("CurrentIndex")
|
|
@@ -234,6 +238,74 @@ func (this *ContractCommon) List() {
|
|
|
}, "获取成功")
|
|
|
}
|
|
|
|
|
|
+// CompanyListBySeal
|
|
|
+// @Title 根据客户名称获取已存在合同系统中客户名称列表
|
|
|
+// @Description 获取合同详情接口
|
|
|
+// @Param CompanyName query string true "客户名称"
|
|
|
+// @Param Keyword query string true "关键字:客户名称、社会信用码"
|
|
|
+// @Param Status query string true "合同状态"
|
|
|
+// @Success 200 {object} []string
|
|
|
+// @router /companyListBySeal [get]
|
|
|
+func (this *ContractCommon) CompanyListBySeal() {
|
|
|
+ sysUser := this.AdminWx
|
|
|
+ keyword := this.GetString("Keyword")
|
|
|
+ //搜索关键字
|
|
|
+ if keyword == "" {
|
|
|
+ this.FailWithMessage("搜索关键字必传!", "搜索关键字必传!")
|
|
|
+ return
|
|
|
+ }
|
|
|
+ status := this.GetString("Status")
|
|
|
+ companyNameList := make([]string, 0)
|
|
|
+
|
|
|
+ sellerId := 0
|
|
|
+ if sysUser.RoleTypeCode != utils.ROLE_TYPE_CODE_COMPLIANCE {
|
|
|
+ sellerId = this.AdminWx.AdminId
|
|
|
+ }
|
|
|
+ list, err := contract.GetCompanyNameList(sellerId, keyword, status)
|
|
|
+ if err != nil {
|
|
|
+ this.FailWithMessage("获取客户名称列表失败!", "获取客户名称列表失败,ERR:"+err.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ for _, v := range list {
|
|
|
+ companyNameList = append(companyNameList, v.CompanyName)
|
|
|
+ }
|
|
|
+
|
|
|
+ //审批列表中(跟自己有关联的)
|
|
|
+ //childCondition := ""
|
|
|
+ //condition := ""
|
|
|
+ //childPars := make([]interface{}, 0)
|
|
|
+ //pars := make([]interface{}, 0)
|
|
|
+ //if status != "" {
|
|
|
+ // condition += `and c.status=? `
|
|
|
+ // pars = append(pars, status)
|
|
|
+ //}
|
|
|
+ ////归属
|
|
|
+ ////如果不是合规,那么只能查看跟自己有关联的
|
|
|
+ //if sysUser.RoleTypeCode != utils.ROLE_TYPE_CODE_COMPLIANCE {
|
|
|
+ // if status == "待审批" {
|
|
|
+ // condition += ` AND ((c.seller_id = ? and a.start_node_id = a.curr_node_id) OR (d.approve_user_id = ? )) and d.status="待审批" `
|
|
|
+ // } else {
|
|
|
+ // condition += ` AND (c.seller_id = ? or d.approve_user_id = ?)`
|
|
|
+ // }
|
|
|
+ // pars = append(pars, sysUser.AdminId, sysUser.AdminId)
|
|
|
+ //}
|
|
|
+ //
|
|
|
+ //condition += `and (company_name like '%` + keyword + `%' or credit_code like '%` + keyword + `%')`
|
|
|
+ //
|
|
|
+ //list2, err := contract_approval.GetCompanyNameListV2(childCondition, condition, childPars, pars)
|
|
|
+ //if err != nil {
|
|
|
+ // this.FailWithMessage("获取客户名称列表失败!", "获取客户名称列表失败,ERR:"+err.Error())
|
|
|
+ // return
|
|
|
+ //}
|
|
|
+ //for _, v := range list2 {
|
|
|
+ // if !strings.Contains(strings.Join(companyNameList, ","), v.CompanyName) {
|
|
|
+ // companyNameList = append(companyNameList, v.CompanyName)
|
|
|
+ // }
|
|
|
+ //}
|
|
|
+ this.OkDetailed(companyNameList, "获取成功")
|
|
|
+}
|
|
|
+
|
|
|
// ListBySeal
|
|
|
// @Title 合同列表
|
|
|
// @Description 合同列表接口
|
|
@@ -244,6 +316,7 @@ func (this *ContractCommon) List() {
|
|
|
// @Param ModifyEndTime query string false "服务更新时间的选择结束时间,格式:2021-05-26 23:59:59"
|
|
|
// @Param SellerId query string false "选择的销售id"
|
|
|
// @Param Keyword query string false "搜索关键字"
|
|
|
+// @Param KeywordEq query string false "搜索关键字(全等)"
|
|
|
// @Success 200 {object} contract.ContractListResp
|
|
|
// @router /listBySeal [get]
|
|
|
func (this *ContractCommon) ListBySeal() {
|
|
@@ -257,6 +330,7 @@ func (this *ContractCommon) ListBySeal() {
|
|
|
modifyEndTime := this.GetString("ModifyEndTime")
|
|
|
sellerIds := this.GetString("SellerId")
|
|
|
keyword := this.GetString("Keyword")
|
|
|
+ keywordEq := this.GetString("KeywordEq")
|
|
|
|
|
|
condition := ""
|
|
|
pars := make([]interface{}, 0)
|
|
@@ -299,6 +373,11 @@ func (this *ContractCommon) ListBySeal() {
|
|
|
if keyword != "" {
|
|
|
condition += ` AND (contract_code LIKE '%` + keyword + `%' OR company_name LIKE '%` + keyword + `%' OR credit_code LIKE '%` + keyword + `%' ) `
|
|
|
}
|
|
|
+ //关键字(全等)
|
|
|
+ if keywordEq != "" {
|
|
|
+ condition += ` AND c.company_name =? `
|
|
|
+ pars = append(pars, keywordEq)
|
|
|
+ }
|
|
|
|
|
|
pageSize, _ := this.GetInt("PageSize")
|
|
|
currentIndex, _ := this.GetInt("CurrentIndex")
|
|
@@ -332,6 +411,7 @@ func (this *ContractCommon) ListBySeal() {
|
|
|
}, "获取成功")
|
|
|
}
|
|
|
|
|
|
+// ListV2
|
|
|
// @Title 合同列表(包含待提交的)
|
|
|
// @Description 合同列表接口(包含待提交的)
|
|
|
// @Param ContractType query string false "合同类型,枚举值:'新签合同','续约合同','补充协议'"
|
|
@@ -341,6 +421,7 @@ func (this *ContractCommon) ListBySeal() {
|
|
|
// @Param ModifyEndTime query string false "服务更新时间的选择结束时间,格式:2021-05-26 23:59:59"
|
|
|
// @Param SellerId query string false "选择的销售id"
|
|
|
// @Param Keyword query string false "搜索关键字"
|
|
|
+// @Param KeywordEq query string false "搜索关键字(全等)"
|
|
|
// @Success 200 {object} contract.ContractListRespV2
|
|
|
// @router /listV2 [get]
|
|
|
func (this *ContractCommon) ListV2() {
|
|
@@ -355,6 +436,7 @@ func (this *ContractCommon) ListV2() {
|
|
|
modifyEndTime := this.GetString("ModifyEndTime")
|
|
|
sellerIds := this.GetString("SellerId")
|
|
|
keyword := this.GetString("Keyword")
|
|
|
+ keywordEq := this.GetString("KeywordEq")
|
|
|
|
|
|
childCondition := ""
|
|
|
condition := ""
|
|
@@ -438,6 +520,13 @@ func (this *ContractCommon) ListV2() {
|
|
|
condition += ` AND (c.contract_code LIKE '%` + keyword + `%' OR c.company_name LIKE '%` + keyword + `%' OR c.credit_code LIKE '%` + keyword + `%' ) `
|
|
|
unionCondition += ` AND (c.contract_code LIKE '%` + keyword + `%' OR c.company_name LIKE '%` + keyword + `%' OR c.credit_code LIKE '%` + keyword + `%' ) `
|
|
|
}
|
|
|
+ //关键字(全等)
|
|
|
+ if keywordEq != "" {
|
|
|
+ condition += ` AND c.company_name =? `
|
|
|
+ pars = append(pars, keywordEq)
|
|
|
+ unionCondition += ` AND c.company_name =? `
|
|
|
+ unionPars = append(unionPars, keywordEq)
|
|
|
+ }
|
|
|
|
|
|
pageSize, _ := this.GetInt("PageSize")
|
|
|
currentIndex, _ := this.GetInt("CurrentIndex")
|