|
@@ -2,6 +2,7 @@ package service
|
|
|
|
|
|
import (
|
|
|
"app.yhyue.com/moapp/jybase/common"
|
|
|
+ "app.yhyue.com/moapp/jybase/encrypt"
|
|
|
"app.yhyue.com/moapp/jypkg/ent/util"
|
|
|
T "bp.jydev.jianyu360.cn/CRM/application/api/common"
|
|
|
"bp.jydev.jianyu360.cn/CRM/application/api/internal/types"
|
|
@@ -25,42 +26,43 @@ type ProjectData struct {
|
|
|
}
|
|
|
|
|
|
type ProjectEntry struct {
|
|
|
- ProjectId string `ch:"project_id"`
|
|
|
- ProjectName string `ch:"project_name"`
|
|
|
- BusinessType string `ch:"business_type"`
|
|
|
- Buyer string `ch:"buyer"`
|
|
|
- BuyerId string `ch:"buyer_id"`
|
|
|
- Area string `ch:"area"`
|
|
|
- City string `ch:"city"`
|
|
|
- District string `ch:"district"`
|
|
|
- ZbTime int64 `ch:"zbtime"`
|
|
|
- EndTime int64 `ch:"endtime"`
|
|
|
- ProjectMoney decimal.Decimal `ch:"project_money"`
|
|
|
- InfoId string `ch:"info_id"`
|
|
|
- IsHandle int `json:"IsHandle"`
|
|
|
- IsIgnore int `json:"IsIgnore"`
|
|
|
- IsCreate int `json:"IsCreate"`
|
|
|
- MyConn bool `json:"MyConn"`
|
|
|
- ConnType int `json:"ConnType"`
|
|
|
- HighSuccess bool `json:"HighSuccess"`
|
|
|
- BId string `json:"BId"`
|
|
|
- BName string `json:"BName"`
|
|
|
- RelationShip string `json:"RelationShip"`
|
|
|
- SourceType string `json:"SourceType"` // firstparty:甲方 supplier:供应商 adiffb:同甲异业 middleman:中间人 agency:招标代理机构
|
|
|
- Person string `json:"Person"`
|
|
|
- Num int `json:"Num"`
|
|
|
- FocusId string `json:"FocusId"`
|
|
|
+ ProjectId string `ch:"project_id"`
|
|
|
+ ProjectName string `ch:"project_name"`
|
|
|
+ BusinessType string `ch:"business_type"`
|
|
|
+ Buyer string `ch:"buyer"`
|
|
|
+ BuyerId string `ch:"buyer_id"`
|
|
|
+ Area string `ch:"area"`
|
|
|
+ City string `ch:"city"`
|
|
|
+ District string `ch:"district"`
|
|
|
+ ZbTime int64 `ch:"zbtime"`
|
|
|
+ EndTime int64 `ch:"endtime"`
|
|
|
+ ProjectMoney decimal.Decimal `ch:"project_money"`
|
|
|
+ InfoId string `ch:"info_id"`
|
|
|
+ InformationId string `ch:"information_id"`
|
|
|
+ InfoIds string `ch:"info_ids"`
|
|
|
+ Href string `json:"Href"`
|
|
|
+ IsHandle int `json:"IsHandle"`
|
|
|
+ IsIgnore int `json:"IsIgnore"`
|
|
|
+ IsCreate int `json:"IsCreate"`
|
|
|
+ MyConn bool `json:"MyConn"`
|
|
|
+ ConnType int `json:"ConnType"`
|
|
|
+ HighSuccess bool `json:"HighSuccess"`
|
|
|
+ BId string `json:"BId"`
|
|
|
+ BName string `json:"BName"`
|
|
|
+ RelationShip string `json:"RelationShip"`
|
|
|
+ SourceType string `json:"SourceType"` // firstparty:甲方 supplier:供应商 adiffb:同甲异业 middleman:中间人 agency:招标代理机构
|
|
|
+ Person string `json:"Person"`
|
|
|
+ Num int `json:"Num"`
|
|
|
+ FocusId string `json:"FocusId"`
|
|
|
}
|
|
|
|
|
|
func GetProjectList(req *types.ProjectListReq) (resultList []*ProjectEntry, hasNextPage bool, total int) {
|
|
|
-
|
|
|
buyerM := BuyerList(req.PartyA, req.Supplier, req.Heterotophy, req.Intermediary, req.Agency, req.PositionId)
|
|
|
mmp := MonitorStatus(req.UserId) // 项目监控
|
|
|
buyerArr := make([]string, len(*buyerM))
|
|
|
for b := range *buyerM {
|
|
|
buyerArr = append(buyerArr, b)
|
|
|
}
|
|
|
-
|
|
|
preSales := preSalesStatus(req.PositionId)
|
|
|
isSqlPage := false
|
|
|
if req.SaleStatus == "0" {
|
|
@@ -76,7 +78,7 @@ func GetProjectList(req *types.ProjectListReq) (resultList []*ProjectEntry, hasN
|
|
|
project := ProjectEntry{}
|
|
|
_ = rows.ScanStruct(&project)
|
|
|
//project.ProjectId = encrypt.CommonEncodeArticle("content", project.ProjectId)
|
|
|
- project.ProjectId = util.EncodeId(project.ProjectId)
|
|
|
+ //project.ProjectId = util.EncodeId(project.ProjectId)
|
|
|
resultList = append(resultList, &project)
|
|
|
}
|
|
|
|
|
@@ -172,9 +174,9 @@ func getQuerySql(req *types.ProjectListReq, isPage bool, buyerArr []string) (cou
|
|
|
if req.SubClass != "" {
|
|
|
arr := []string{}
|
|
|
for _, v := range strings.Split(req.SubClass, ",") {
|
|
|
- arr = append(arr, fmt.Sprintf("'%s'", v))
|
|
|
+ arr = append(arr, fmt.Sprintf("has(a.subclass, '%s')", v))
|
|
|
}
|
|
|
- querys = append(querys, fmt.Sprintf(" a.subclass in (%s) ", strings.Join(regionArr, ",")))
|
|
|
+ querys = append(querys, arr...)
|
|
|
}
|
|
|
// 项目金额
|
|
|
if req.Amount != "" && strings.Contains(req.Amount, "-") {
|
|
@@ -192,12 +194,12 @@ func getQuerySql(req *types.ProjectListReq, isPage bool, buyerArr []string) (cou
|
|
|
//物业业态
|
|
|
if req.PropertyForm != "" {
|
|
|
arr := []string{}
|
|
|
- for _, v := range strings.Split(req.PropertyForm, ",") {
|
|
|
- arr = append(arr, fmt.Sprintf("'%s'", v))
|
|
|
+ for _, v := range strings.Split(req.SubClass, ",") {
|
|
|
+ arr = append(arr, fmt.Sprintf("has(a.property_form, '%s')", v))
|
|
|
}
|
|
|
- querys = append(querys, fmt.Sprintf(" a.property_form in (%s) ", strings.Join(arr, ",")))
|
|
|
+ querys = append(querys, arr...)
|
|
|
}
|
|
|
- findSql = "select a.project_id, a.project_name, a.business_type, a.buyer, a.buyer_id, a.area, a.city, a.district, a.zbtime, a.endtime, a.project_money, a.info_id "
|
|
|
+ findSql = "select a.project_id, a.project_name, a.business_type, a.buyer, a.buyer_id, a.area, a.city, a.district, a.zbtime, a.endtime, a.project_money, a.info_id, a.information_id, a.info_ids "
|
|
|
if len(querys) > 0 {
|
|
|
countSql = fmt.Sprintf("select count(1) from %s a where %s ", "information.transaction_info", strings.Join(querys, " and "))
|
|
|
findSql = fmt.Sprintf("%s from %s a where %s order by zbtime", findSql, "information.transaction_info", strings.Join(querys, " and "))
|
|
@@ -294,6 +296,11 @@ func moreInfo(req *types.ProjectListReq, list []*ProjectEntry) (result []*Projec
|
|
|
}
|
|
|
}
|
|
|
for _, m := range list {
|
|
|
+ // 补充跳转链接
|
|
|
+ if m.BusinessType == "采购意向" || m.BusinessType == "招标项目" {
|
|
|
+ m.Href = fmt.Sprintf("/article/content/%s.html", encrypt.CommonEncodeArticle("content", m.ProjectId))
|
|
|
+ }
|
|
|
+ m.ProjectId = util.EncodeId(m.ProjectId)
|
|
|
// 人脉、人脉所在单位项目 conn_type: 1 人脉可转介绍项目; conn_type: 2 人脉所在单位项目
|
|
|
if connMap[m.BuyerId] == 1 {
|
|
|
m.MyConn = true // 我的人脉
|