|
@@ -31,10 +31,26 @@ func NewParStage(entId, entUserId, positionId int64, projectId string) *ParStage
|
|
}
|
|
}
|
|
|
|
|
|
type StageInfo struct {
|
|
type StageInfo struct {
|
|
- Value string
|
|
|
|
- Date string
|
|
|
|
|
|
+ Name string `json:"name"`
|
|
|
|
+ Value string `json:"value"`
|
|
|
|
+ Date string `json:"date"`
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+var (
|
|
|
|
+ stageMap = []string{
|
|
|
|
+ "参标状态",
|
|
|
|
+ "投标类型",
|
|
|
|
+ "已报名",
|
|
|
|
+ "投标决策",
|
|
|
|
+ "编制投标文件",
|
|
|
|
+ "递交投标文件",
|
|
|
|
+ "中标公示",
|
|
|
|
+ "签合同",
|
|
|
|
+ "已结束",
|
|
|
|
+ "终止参标",
|
|
|
|
+ }
|
|
|
|
+)
|
|
|
|
+
|
|
func (p *ParStage) UpdateStage() {
|
|
func (p *ParStage) UpdateStage() {
|
|
var (
|
|
var (
|
|
recordsMap = map[string]*StageInfo{}
|
|
recordsMap = map[string]*StageInfo{}
|
|
@@ -44,6 +60,7 @@ func (p *ParStage) UpdateStage() {
|
|
}
|
|
}
|
|
now = time.Now()
|
|
now = time.Now()
|
|
createDate string
|
|
createDate string
|
|
|
|
+ lastDate int64 //最新一次更新时间
|
|
entUserIdBool = map[string]bool{}
|
|
entUserIdBool = map[string]bool{}
|
|
positionIdBool = map[string]bool{}
|
|
positionIdBool = map[string]bool{}
|
|
entUserIds, positionIds []string
|
|
entUserIds, positionIds []string
|
|
@@ -73,8 +90,11 @@ func (p *ParStage) UpdateStage() {
|
|
contentStr string
|
|
contentStr string
|
|
entUserId = strconv.FormatInt(gconv.Int64(rv["ent_user_id"]), 10)
|
|
entUserId = strconv.FormatInt(gconv.Int64(rv["ent_user_id"]), 10)
|
|
positionId = strconv.FormatInt(gconv.Int64(rv["position_id"]), 10)
|
|
positionId = strconv.FormatInt(gconv.Int64(rv["position_id"]), 10)
|
|
|
|
+ cdStr = strings.Split(gconv.String(rv["create_date"]), " ")[0]
|
|
|
|
+ cdTime, _ = time.Parse(date.Date_Full_Layout, gconv.String(rv["create_date"]))
|
|
)
|
|
)
|
|
- createDate = strings.Split(gconv.String(rv["create_date"]), " ")[0]
|
|
|
|
|
|
+ lastDate = common.If(cdTime.Unix() > lastDate, cdTime.Unix(), lastDate).(int64)
|
|
|
|
+ createDate = common.If(cdStr != "", cdStr, createDate).(string)
|
|
if ok {
|
|
if ok {
|
|
contentMap = gconv.Map(content)
|
|
contentMap = gconv.Map(content)
|
|
if contentMap["afterMap"] != nil {
|
|
if contentMap["afterMap"] != nil {
|
|
@@ -86,8 +106,9 @@ func (p *ParStage) UpdateStage() {
|
|
values := gconv.SliceStr(bidStage["value"])
|
|
values := gconv.SliceStr(bidStage["value"])
|
|
if len(values) > 0 {
|
|
if len(values) > 0 {
|
|
for _, bv := range values {
|
|
for _, bv := range values {
|
|
- if status == "调整" || recordsMap[fmt.Sprintf("%s(阶段)", bv)].Date == "" {
|
|
|
|
- recordsMap[fmt.Sprintf("%s(阶段)", bv)] = &StageInfo{
|
|
|
|
|
|
+ if status == "调整" || recordsMap[bv].Date == "" {
|
|
|
|
+ recordsMap[bv] = &StageInfo{
|
|
|
|
+ Name: fmt.Sprintf("%s(阶段)", bv),
|
|
Value: state,
|
|
Value: state,
|
|
Date: createDate,
|
|
Date: createDate,
|
|
}
|
|
}
|
|
@@ -99,6 +120,7 @@ func (p *ParStage) UpdateStage() {
|
|
value := gconv.String(bidType["value"])
|
|
value := gconv.String(bidType["value"])
|
|
if value != "" {
|
|
if value != "" {
|
|
recordsMap["投标类型"] = &StageInfo{
|
|
recordsMap["投标类型"] = &StageInfo{
|
|
|
|
+ Name: "投标类型",
|
|
Value: value,
|
|
Value: value,
|
|
Date: createDate,
|
|
Date: createDate,
|
|
}
|
|
}
|
|
@@ -117,6 +139,7 @@ func (p *ParStage) UpdateStage() {
|
|
//参标后 未被 终止参标
|
|
//参标后 未被 终止参标
|
|
if strings.TrimSpace(contentStr) == "参标" {
|
|
if strings.TrimSpace(contentStr) == "参标" {
|
|
recordsMap["参标状态"] = &StageInfo{
|
|
recordsMap["参标状态"] = &StageInfo{
|
|
|
|
+ Name: "参标状态",
|
|
Value: "已参标",
|
|
Value: "已参标",
|
|
Date: createDate,
|
|
Date: createDate,
|
|
}
|
|
}
|
|
@@ -125,6 +148,7 @@ func (p *ParStage) UpdateStage() {
|
|
if strings.Contains(contentStr, "终止参标") {
|
|
if strings.Contains(contentStr, "终止参标") {
|
|
if !isParticipate {
|
|
if !isParticipate {
|
|
recordsMap[contentStr] = &StageInfo{
|
|
recordsMap[contentStr] = &StageInfo{
|
|
|
|
+ Name: "终止参标",
|
|
Value: "已终止",
|
|
Value: "已终止",
|
|
Date: createDate,
|
|
Date: createDate,
|
|
}
|
|
}
|
|
@@ -144,8 +168,23 @@ func (p *ParStage) UpdateStage() {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if recordsMap != nil {
|
|
if recordsMap != nil {
|
|
|
|
+ var stages []*StageInfo
|
|
|
|
+ for _, v := range stageMap {
|
|
|
|
+ records := recordsMap[v]
|
|
|
|
+ if records == nil {
|
|
|
|
+ records = &StageInfo{
|
|
|
|
+ Name: v,
|
|
|
|
+ Value: "-",
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ stages = append(stages, &StageInfo{
|
|
|
|
+ Name: records.Name,
|
|
|
|
+ Value: records.Value,
|
|
|
|
+ Date: records.Date,
|
|
|
|
+ })
|
|
|
|
+ }
|
|
// 转换结构体数组为JSON字符串
|
|
// 转换结构体数组为JSON字符串
|
|
- jsonData, err := json.Marshal(recordsMap)
|
|
|
|
|
|
+ jsonData, err := json.Marshal(stages)
|
|
if err != nil {
|
|
if err != nil {
|
|
fmt.Println("Failed to marshal struct array to JSON:", err)
|
|
fmt.Println("Failed to marshal struct array to JSON:", err)
|
|
return
|
|
return
|
|
@@ -160,7 +199,7 @@ func (p *ParStage) UpdateStage() {
|
|
updateSelectSlq = fmt.Sprintf("%s%s", updateSelectSlq, add)
|
|
updateSelectSlq = fmt.Sprintf("%s%s", updateSelectSlq, add)
|
|
}
|
|
}
|
|
if s := IC.BaseMysql.SelectBySql(updateSelectSlq, p.EntId, p.ProjectId); len(*s) > 0 {
|
|
if s := IC.BaseMysql.SelectBySql(updateSelectSlq, p.EntId, p.ProjectId); len(*s) > 0 {
|
|
- updateInsertMap["update_date"] = createDate
|
|
|
|
|
|
+ updateInsertMap["update_date"] = date.FormatDateByInt64(&lastDate, date.Date_Short_Layout)
|
|
if ok := IC.BaseMysql.Update(ParticipateStage, map[string]interface{}{
|
|
if ok := IC.BaseMysql.Update(ParticipateStage, map[string]interface{}{
|
|
"id": gconv.Int64((*s)[0]["id"]),
|
|
"id": gconv.Int64((*s)[0]["id"]),
|
|
}, updateInsertMap); !ok {
|
|
}, updateInsertMap); !ok {
|
|
@@ -168,7 +207,7 @@ func (p *ParStage) UpdateStage() {
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
updateInsertMap["create_date"] = date.FormatDate(&now, date.Date_Full_Layout)
|
|
updateInsertMap["create_date"] = date.FormatDate(&now, date.Date_Full_Layout)
|
|
- updateInsertMap["update_date"] = createDate
|
|
|
|
|
|
+ updateInsertMap["update_date"] = date.FormatDateByInt64(&lastDate, date.Date_Short_Layout)
|
|
if i := IC.BaseMysql.Insert(ParticipateStage, updateInsertMap); i == 0 {
|
|
if i := IC.BaseMysql.Insert(ParticipateStage, updateInsertMap); i == 0 {
|
|
log.Println("参标操作记录 插入异常:", updateInsertMap)
|
|
log.Println("参标操作记录 插入异常:", updateInsertMap)
|
|
}
|
|
}
|