Browse Source

feat:列表 投标状态更新

wangshan 2 years ago
parent
commit
1e8b03d1d8
2 changed files with 33 additions and 17 deletions
  1. 3 3
      jyBXCore/rpc/model/mysql/participateBid.go
  2. 30 14
      jyBXCore/rpc/service/participateBid.go

+ 3 - 3
jyBXCore/rpc/model/mysql/participateBid.go

@@ -656,7 +656,7 @@ func SingleParticipateList(in *bxcore.ParticipateListReq, conditionSql string) (
 					BidEndTime:       bidEndTime,
 					BidOpenTime:      bidOpenTime,
 					UpdateStatusTime: updateStatusTime,
-					UpdateStatusCon:  GetParticipateContent("s", in.PositionId, MC.ObjToString(v["id"])), //查询最后一次 投标状态更新,
+					//UpdateStatusCon:  GetParticipateContent("s", in.PositionId, MC.ObjToString(v["id"])), //查询最后一次 投标状态更新,
 				})
 			}
 			return data, nil
@@ -718,8 +718,8 @@ func AdminParticipateList(in *bxcore.ParticipateListReq, conditionSql string) (d
 					BidEndTime:       bidEndTime,
 					BidOpenTime:      bidOpenTime,
 					UpdateStatusTime: updateStatusTime,
-					UpdateStatusCon:  GetParticipateContent("e", in.EntId, MC.ObjToString(v["id"])), //查询最后一次 投标状态更新
-					Participants:     GetParticipateUserName(MC.ObjToString(v["ent_user_id"])),      //参标人信息
+					//UpdateStatusCon:  GetParticipateContent("e", in.EntId, MC.ObjToString(v["id"])), //查询最后一次 投标状态更新
+					Participants: GetParticipateUserName(MC.ObjToString(v["ent_user_id"])), //参标人信息
 				})
 			}
 			return data, nil

+ 30 - 14
jyBXCore/rpc/service/participateBid.go

@@ -454,36 +454,46 @@ func processRecordStr(oldMap, newMap map[string]interface{}) (recordContent stri
 		actonStr    = "%s%s%s"
 		changeField = []string{}
 		result      = []string{}
-		changeMap   = map[string]interface{}{}
+		afterMap    = map[string]interface{}{}
 	)
 	for k, fieldName := range ParticipateBidContentKey {
 		var (
-			status, value, changeStr string
+			value             interface{}
+			status, changeStr string
 		)
 		switch k {
 		case "bidType":
 			oldv := common.IntAll(oldMap[k])
 			newv := common.IntAll(newMap[k])
-			if oldv == newv { // 没有改变
-				continue
-			}
 			newBidType := BidTypeMap[newv]
 			if newBidType == "" {
 				newBidType = "未选择"
 			}
 			value = newBidType
+			if oldv == newv { // 没有改变
+				afterMap[k] = map[string]interface{}{
+					"status": status,
+					"value":  value,
+				}
+				continue
+			}
+			value = newBidType
 			if oldv == 0 && newv != 0 { // 说明是新增
 				status = "新增"
 				changeStr = fmt.Sprintf(actonStr, fieldName, ": (新增)", newBidType)
 			} else { // 调整
 				status = "调整"
 				changeStr = fmt.Sprintf(actonStr, fieldName, "(调整):", newBidType)
-
 			}
 		case "isWin":
 			oldV := common.IntAll(oldMap[k])
 			newV := common.IntAll(newMap[k])
+			value = WinMap[newV]
 			if oldV == newV { // 没有改变
+				afterMap[k] = map[string]interface{}{
+					"status": status,
+					"value":  value,
+				}
 				continue
 			}
 			status = "调整"
@@ -492,16 +502,21 @@ func processRecordStr(oldMap, newMap map[string]interface{}) (recordContent stri
 				fieldName = fmt.Sprintf("%s%s", "渠道", fieldName)
 			}
 			changeStr = fmt.Sprintf(actonStr, fieldName, "(调整) 为", WinMap[newV])
-			value = WinMap[newV]
 		case "bidStage":
 			bidAction := "%s%s"
 			bidChangeArr := []string{}
 			oldSet := gset.NewFrom(oldMap[k])
 			newSet := gset.NewFrom(newMap[k])
+			value = newMap[k]
 			// 判断相等
 			if oldSet.Equal(newSet) {
+				afterMap[k] = map[string]interface{}{
+					"status": status,
+					"value":  value,
+				}
 				continue
 			}
+			status = "调整"
 			// 差集计算
 			// 取消勾选的
 			cancleSet := oldSet.Diff(newSet)
@@ -513,37 +528,38 @@ func processRecordStr(oldMap, newMap map[string]interface{}) (recordContent stri
 			addSet := newSet.Diff(oldSet)
 			addSet.Iterator(func(v interface{}) bool {
 				bidChangeArr = append(bidChangeArr, fmt.Sprintf(bidAction, "(新增)", v))
-				fmt.Println(v)
 				return true
 			})
 			tmpStr := strings.Join(bidChangeArr, " ")
 			changeStr = fmt.Sprintf(actonStr, fieldName, " :", tmpStr)
-			status = "调整"
-			value = tmpStr
 		default:
 			oldV := common.ObjToString(oldMap[k])
 			newV := common.ObjToString(newMap[k])
+			value = newV
 			if oldV == newV { // 没有变化
+				afterMap[k] = map[string]interface{}{
+					"status": status,
+					"value":  value,
+				}
 				continue
 			}
 			changeStr = fmt.Sprintf(actonStr, fieldName, "(调整)为", fmt.Sprintf("\"%s\"", newV))
 			status = "调整"
-			value = newV
 		}
 		result = append(result, changeStr)
 		changeField = append(changeField, k)
-		changeMap[k] = map[string]interface{}{
+		afterMap[k] = map[string]interface{}{
 			"status": status,
 			"value":  value,
 		}
 	}
-	b, _ := json.Marshal(changeMap)
+	b, _ := json.Marshal(afterMap)
 	recordMap := map[string]interface{}{
 		"content":     strings.Join(result, ";"), // 变更内容 文字描述
 		"before":      oldMap,                    // 变更前
 		"after":       newMap,                    // 变更后
 		"changeField": changeField,               // 涉及变更的字段
-		"changeMap":   string(b),                 // 涉及变更内容
+		"afterMap":    string(b),                 // 涉及变更内容
 	}
 
 	tmp, err := json.Marshal(recordMap)