|
@@ -17,7 +17,9 @@ import (
|
|
|
)
|
|
|
|
|
|
var (
|
|
|
- PartTable = "participate"
|
|
|
+ PartTable = "participate"
|
|
|
+ ParticipateBidRecordsTable = "participate_bid_records"
|
|
|
+ ParticipateUserTable = "participate_user" // 参标用户表
|
|
|
)
|
|
|
|
|
|
//划转参标信息
|
|
@@ -601,3 +603,84 @@ func GetParticipateUserName(entUserId string) string {
|
|
|
}
|
|
|
return ""
|
|
|
}
|
|
|
+
|
|
|
+// GetBidContentEnt 企业版 获取投标状态更新内容
|
|
|
+func GetBidContentEnt(projectId string, entId int64) *[]map[string]interface{} {
|
|
|
+ // record_type '默认0:参标、划转、取消参标;1:投标状态更新存储'
|
|
|
+ query := "SELECT * FROM " + ParticipateBidRecordsTable + " where project_id=? and ent_id=? and record_type=1 order by create_date desc limit 1; "
|
|
|
+ return IC.BaseMysql.SelectBySql(query, projectId, entId)
|
|
|
+}
|
|
|
+
|
|
|
+// GetBidContentPersonal 个人版 获取投标状态更新内容
|
|
|
+func GetBidContentPersonal(projectId string, positionId int64) *[]map[string]interface{} {
|
|
|
+ query := "SELECT * FROM " + ParticipateBidRecordsTable + " where project_id=? and position_id=? and record_type=1 order by create_date desc limit 1;"
|
|
|
+ return IC.BaseMysql.SelectBySql(query, projectId, positionId)
|
|
|
+}
|
|
|
+
|
|
|
+// UpdateBidContent 更新投标状态信息以及操作记录
|
|
|
+func UpdateBidContent(recordData map[string]interface{}) (flag bool) {
|
|
|
+ r2 := IC.BaseMysql.Insert(ParticipateBidRecordsTable, recordData)
|
|
|
+ return r2 > 0
|
|
|
+}
|
|
|
+
|
|
|
+// InsertBidContent 新增投标状态信息及操作记录
|
|
|
+func InsertBidContent(recordData map[string]interface{}) (flag bool) {
|
|
|
+ r2 := IC.BaseMysql.Insert(ParticipateBidRecordsTable, recordData)
|
|
|
+ return r2 > 0
|
|
|
+}
|
|
|
+
|
|
|
+// GetBidRecordsEnt 获取操作记录列表企业
|
|
|
+func GetBidRecordsEnt(projectId string, entId, page, pageSize int64) (rs *[]map[string]interface{}, total int64) {
|
|
|
+ query := "SELECT * FROM " + ParticipateBidRecordsTable + " where project_id=? and ent_id=? order by create_date desc limit ?,?"
|
|
|
+ countQuery := "SELECT count(id) FROM " + ParticipateBidRecordsTable + " where project_id=? and ent_id=? ;"
|
|
|
+ rs = IC.BaseMysql.SelectBySql(query, projectId, entId, (page-1)*pageSize, pageSize)
|
|
|
+ total = IC.BaseMysql.CountBySql(countQuery, projectId, entId)
|
|
|
+ return rs, total
|
|
|
+}
|
|
|
+
|
|
|
+// GetBidRecordsPersonal 获取操作记录列表个人
|
|
|
+func GetBidRecordsPersonal(projectId string, positionId, page, pageSize int64) (rs *[]map[string]interface{}, total int64) {
|
|
|
+ query := "SELECT * FROM " + ParticipateBidRecordsTable + " where project_id=? and position_id=? order by create_date desc limit ?,?;"
|
|
|
+ countQuery := "SELECT count(id) FROM " + ParticipateBidRecordsTable + " where project_id=? and position_id=? ;"
|
|
|
+ rs = IC.BaseMysql.SelectBySql(query, projectId, positionId, (page-1)*pageSize, pageSize)
|
|
|
+ total = IC.BaseMysql.CountBySql(countQuery, projectId, positionId)
|
|
|
+ return rs, total
|
|
|
+}
|
|
|
+
|
|
|
+// GetUserMap 查询用户id的姓名
|
|
|
+func GetUserMap(userIds string) (rs *[]map[string]interface{}) {
|
|
|
+ query := fmt.Sprintf("select id,name from entniche_user where id in (%s)", userIds)
|
|
|
+ rs = IC.MainMysql.SelectBySql(query)
|
|
|
+ return rs
|
|
|
+}
|
|
|
+
|
|
|
+// CheckParticipateManager 验证项目id是否是该管理员企业下的参标项目
|
|
|
+func CheckParticipateManager(projectId string, entId int64, valid bool) (flag bool) {
|
|
|
+ stateStr := "" // 是否需要验证是正在参标
|
|
|
+ if valid {
|
|
|
+ stateStr = " and state=0"
|
|
|
+ }
|
|
|
+ query := "SELECT count(id) FROM " + ParticipateUserTable + " where project_id=? and ent_id=?" + stateStr
|
|
|
+ return IC.BaseMysql.CountBySql(query, projectId, entId) > 0
|
|
|
+}
|
|
|
+
|
|
|
+// CheckParticipateEntUser 验证项目id是否是该企业用户参标的项目
|
|
|
+func CheckParticipateEntUser(projectId string, entUserId int64, valid bool) (flag bool) {
|
|
|
+ stateStr := "" // 是否需要验证是正在参标
|
|
|
+ if valid {
|
|
|
+ stateStr = " and state=0"
|
|
|
+ }
|
|
|
+ query := "SELECT count(id) FROM " + ParticipateUserTable + " where project_id=? and ent_user_id=?" + stateStr
|
|
|
+ return IC.BaseMysql.CountBySql(query, projectId, entUserId) > 0
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+// CheckParticipatePersonal 查询项目id是否是该用户参标项目
|
|
|
+func CheckParticipatePersonal(projectId string, positionId int64, valid bool) (flag bool) {
|
|
|
+ stateStr := "" // 是否需要验证是正在参标 终止参标的用户还能查看记录,但是不能更新状态
|
|
|
+ if valid {
|
|
|
+ stateStr = " and state=0"
|
|
|
+ }
|
|
|
+ query := "SELECT count(id) FROM " + ParticipateUserTable + " where project_id=? and position_id=?" + stateStr
|
|
|
+ return IC.BaseMysql.CountBySql(query, projectId, positionId) > 0
|
|
|
+}
|