|
@@ -639,7 +639,7 @@ func SingleParticipateList(in *bxcore.ParticipateListReq, conditionSql string) (
|
|
|
count := IC.BaseMysql.CountBySql(countSql, in.PositionId)
|
|
|
if count > 0 {
|
|
|
data.Count = count
|
|
|
- listSql := fmt.Sprintf(singlePersonSql, " pug.update_date,pt.*,pbr.create_date ")
|
|
|
+ listSql := fmt.Sprintf(singlePersonSql, " pt.*,pbr.create_date ")
|
|
|
//分页
|
|
|
listSql += fmt.Sprintf(` LIMIT %d,%d`, in.PageNum, in.PageSize)
|
|
|
list := IC.BaseMysql.SelectBySql(listSql, in.PositionId)
|
|
@@ -696,13 +696,20 @@ func AdminParticipateList(in *bxcore.ParticipateListReq, conditionSql string) (d
|
|
|
Count: 0,
|
|
|
List: []*bxcore.ParticipateList{},
|
|
|
}
|
|
|
- adminSql := `SELECT %s FROM (SELECT pu.ent_id, pu.project_id, GROUP_CONCAT(pu.ent_user_id SEPARATOR ',') ent_user_id, MAX(pu.update_date) update_date,MAX(pu.state) state FROM ` + ParticipateUserTable + ` pu WHERE pu.ent_id = ? AND NOT EXISTS ( SELECT 1 FROM ` + ParticipateUserTable + ` WHERE project_id = pu.project_id AND state > pu. state ) GROUP BY pu.project_id ) pug LEFT JOIN project pt ON pug.project_id = pt.id LEFT JOIN (SELECT project_id,ent_id,MAX(create_date) AS create_date FROM participate_bid_records GROUP BY project_id,ent_id) pbr ON pbr.project_id = pug.project_id AND pbr.ent_id = pug.ent_id WHERE 1=1 `
|
|
|
+ adminSql := `SELECT %s FROM (SELECT pu.ent_id, pu.project_id, GROUP_CONCAT(pu.ent_user_id SEPARATOR ',') ent_user_id %s FROM ` + ParticipateUserTable + ` pu WHERE pu.ent_id = ? %s GROUP BY pu.project_id ) pug LEFT JOIN project pt ON pug.project_id = pt.id LEFT JOIN (SELECT project_id,ent_id,MAX(create_date) AS create_date FROM participate_bid_records GROUP BY project_id,ent_id) pbr ON pbr.project_id = pug.project_id AND pbr.ent_id = pug.ent_id WHERE 1=1 `
|
|
|
+ maxStateSql := ``
|
|
|
+ stateSql := ``
|
|
|
+ if in.EntUserIds == "" {
|
|
|
+ maxStateSql = `,MAX(pu.state) state`
|
|
|
+ stateSql = `AND NOT EXISTS ( SELECT 1 FROM ` + ParticipateUserTable + ` WHERE project_id = pu.project_id AND state > pu. state )`
|
|
|
+ }
|
|
|
+ adminSql = fmt.Sprintf(adminSql, "%s", maxStateSql, stateSql)
|
|
|
adminCountSql := fmt.Sprintf(adminSql, "COUNT(pt.id)") + conditionSql
|
|
|
log.Println(adminCountSql)
|
|
|
count := IC.BaseMysql.CountBySql(adminCountSql, in.EntId)
|
|
|
if count > 0 {
|
|
|
data.Count = count
|
|
|
- adminListSql := fmt.Sprintf(adminSql, " pt.*, pug.ent_user_id,pug.update_date,pbr.create_date ") + conditionSql + fmt.Sprintf(" LIMIT %d,%d", in.PageNum, in.PageSize)
|
|
|
+ adminListSql := fmt.Sprintf(adminSql, " pt.*, pug.ent_user_id,pbr.create_date ") + conditionSql + fmt.Sprintf(" LIMIT %d,%d", in.PageNum, in.PageSize)
|
|
|
list := IC.BaseMysql.SelectBySql(adminListSql, in.EntId)
|
|
|
if list != nil && len(*list) > 0 {
|
|
|
for _, v := range *list {
|
|
@@ -740,7 +747,7 @@ func AdminParticipateList(in *bxcore.ParticipateListReq, conditionSql string) (d
|
|
|
BidOpenTime: bidOpenTime,
|
|
|
UpdateStatusTime: updateStatusTime,
|
|
|
//UpdateStatusCon: GetParticipateContent("e", in.EntId, MC.ObjToString(v["id"])), //查询最后一次 投标状态更新
|
|
|
- Participants: GetParticipateUserName(MC.ObjToString(v["ent_user_id"])), //参标人信息
|
|
|
+ Participants: GetParticipateUserName(MC.ObjToString(v["id"]), MC.ObjToString(v["ent_user_id"]), in.EntUserIds != ""), //参标人信息
|
|
|
})
|
|
|
}
|
|
|
return data, nil
|
|
@@ -784,10 +791,16 @@ func GetParticipateContent(s string, id int64, projectId string) string {
|
|
|
}
|
|
|
|
|
|
// 根据ent_user_id 获取参标人昵称,企业管理员现在都是“我”
|
|
|
-func GetParticipateUserName(entUserId string) string {
|
|
|
- if entUserId != "" {
|
|
|
+func GetParticipateUserName(projectId, entUserIdsFromData string, b bool) string {
|
|
|
+ if entUserIdsFromData != "" {
|
|
|
var userNames []string
|
|
|
- for _, v := range strings.Split(entUserId, ",") {
|
|
|
+ for _, v := range strings.Split(entUserIdsFromData, ",") {
|
|
|
+ if b {
|
|
|
+ //已终止参标
|
|
|
+ if c := IC.BaseMysql.CountBySql(`SELECT count(id) FROM `+ParticipateUserTable+` WHERE project_id = ? AND ent_user_id = ? AND state <0`, projectId, v); c > 0 {
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ }
|
|
|
entUserInfos := IC.MainMysql.SelectBySql(`SELECT * FROM entniche_user WHERE id = ?`, v)
|
|
|
if entUserInfos != nil && len(*entUserInfos) > 0 {
|
|
|
entUserInfo := (*entUserInfos)[0]
|