|
@@ -49,13 +49,13 @@ func TransferParticipateInfo(projectId string, in *bxcore.ParticipateActionReq)
|
|
|
//保存或更新新跟踪人
|
|
|
if !IC.BaseMysql.ExecTx("划转参标信息", func(tx *sql.Tx) bool {
|
|
|
var (
|
|
|
- b1 = true
|
|
|
- b2, b3 bool
|
|
|
- now = time.Now()
|
|
|
- content = "%s划转给%s%s"
|
|
|
- lastNotes = ",保留原参标人"
|
|
|
- fromUserNames []string
|
|
|
- ids []int
|
|
|
+ b1 = true
|
|
|
+ b2, b3 bool
|
|
|
+ now = time.Now()
|
|
|
+ content = "%s划转给%s%s"
|
|
|
+ lastNotes = ",保留原参标人"
|
|
|
+ fromEntUserNames, toEntUserNames, toEntUserIds []string
|
|
|
+ ids []int
|
|
|
)
|
|
|
partInfo := IC.BaseMysql.SelectBySqlByTx(tx, "SELECT id,position_id FROM "+ParticipateUserTable+" WHERE project_id = ? AND ent_id = ? AND state > -1", projectId, in.EntId)
|
|
|
if partInfo == nil || len(*partInfo) == 0 {
|
|
@@ -67,11 +67,11 @@ func TransferParticipateInfo(projectId string, in *bxcore.ParticipateActionReq)
|
|
|
positionId := MC.Int64All(v["position_id"])
|
|
|
userInfo := IC.Middleground.UserCenter.IdentityByPositionId(positionId)
|
|
|
if userInfo.EntUserName != "" {
|
|
|
- fromUserNames = append(fromUserNames, userInfo.EntUserName)
|
|
|
+ fromEntUserNames = append(fromEntUserNames, userInfo.EntUserName)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- if len(fromUserNames) == 0 {
|
|
|
+ if len(fromEntUserNames) == 0 {
|
|
|
logx.Info("原参标人信息查询有误")
|
|
|
return false
|
|
|
}
|
|
@@ -89,48 +89,62 @@ func TransferParticipateInfo(projectId string, in *bxcore.ParticipateActionReq)
|
|
|
"update_date": date.FormatDate(&now, date.Date_Full_Layout),
|
|
|
})
|
|
|
}
|
|
|
- //查询划转人信息
|
|
|
- entUserId, _ := strconv.ParseInt(in.ToEntUserId, 10, 64)
|
|
|
- userInfo := IC.Middleground.UserCenter.IdentityByEntUserId(entUserId)
|
|
|
- positionId := userInfo.PositionId
|
|
|
- content = fmt.Sprintf(content, strings.Join(fromUserNames, ","), userInfo.EntUserName, lastNotes)
|
|
|
+ //移动端 划转对象是多选
|
|
|
+ //划转对象entuserid 解密
|
|
|
+ for _, toEntUserId := range strings.Split(in.ToEntUserId, ",") {
|
|
|
+ toEntUserId = encrypt.SE.Decode4HexByCheck(toEntUserId)
|
|
|
+ if toEntUserId == "" {
|
|
|
+ logx.Info("划转对象不能为空", in.ProjectIds, in.EntId)
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ //查询划转人信息
|
|
|
+ entUserId, _ := strconv.ParseInt(toEntUserId, 10, 64)
|
|
|
+ userInfo := IC.Middleground.UserCenter.IdentityByEntUserId(entUserId)
|
|
|
+ positionId := userInfo.PositionId
|
|
|
+ //保存参标--participate_user
|
|
|
+ //查看是否参标过当前项目
|
|
|
+ if c := IC.BaseMysql.CountBySql("SELECT count(id) FROM "+ParticipateUserTable+" WHERE position_id = ? AND project_id = ? AND ent_id = ?", positionId, projectId, in.EntId); c > 0 {
|
|
|
+ //更新
|
|
|
+ b3 = IC.BaseMysql.UpdateByTx(tx, ParticipateUserTable, map[string]interface{}{
|
|
|
+ "position_id": positionId,
|
|
|
+ "project_id": projectId,
|
|
|
+ "ent_id": in.EntId,
|
|
|
+ }, map[string]interface{}{
|
|
|
+ "state": 0,
|
|
|
+ "mark": 1, //0:参标;1:被划入;-1:终止参标;-2:被划走
|
|
|
+ "update_date": date.FormatDate(&now, date.Date_Full_Layout),
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ //保存
|
|
|
+ b3 = IC.BaseMysql.InsertByTx(tx, ParticipateUserTable, map[string]interface{}{
|
|
|
+ "ent_id": in.EntId,
|
|
|
+ "ent_user_id": entUserId,
|
|
|
+ "position_id": positionId,
|
|
|
+ "project_id": projectId,
|
|
|
+ "user_id": in.MgoUserId,
|
|
|
+ "state": 0,
|
|
|
+ "mark": 1, //0:参标;1:被划入;-1:终止参标;-2:被划走
|
|
|
+ "create_date": date.FormatDate(&now, date.Date_Full_Layout),
|
|
|
+ "update_date": date.FormatDate(&now, date.Date_Full_Layout),
|
|
|
+ }) > 0
|
|
|
+ }
|
|
|
+ if b3 {
|
|
|
+ toEntUserIds = append(toEntUserIds, toEntUserId)
|
|
|
+ toEntUserNames = append(toEntUserNames, userInfo.EntUserName)
|
|
|
+ }
|
|
|
+ }
|
|
|
//划转记录
|
|
|
b2 = IC.BaseMysql.InsertByTx(tx, ParticipateBidRecordsTable, map[string]interface{}{
|
|
|
- "ent_id": in.EntId,
|
|
|
- "ent_user_id": entUserId,
|
|
|
- "position_id": positionId,
|
|
|
- "project_id": projectId,
|
|
|
- "record_type": 0,
|
|
|
- "record_content": content,
|
|
|
- "create_date": date.FormatDate(&now, date.Date_Full_Layout),
|
|
|
+ "ent_id": in.EntId,
|
|
|
+ "ent_user_id": in.EntUserId,
|
|
|
+ "position_id": in.PositionId,
|
|
|
+ "project_id": projectId,
|
|
|
+ "record_type": 0,
|
|
|
+ "transfer_ent_user_id": strings.Join(toEntUserIds, ","),
|
|
|
+ "record_content": fmt.Sprintf(content, strings.Join(fromEntUserNames, "、"), strings.Join(toEntUserNames, "、"), lastNotes),
|
|
|
+ "create_date": date.FormatDate(&now, date.Date_Full_Layout),
|
|
|
}) > 0
|
|
|
- //保存参标--participate_user
|
|
|
- //查看是否参标过当前项目
|
|
|
- if c := IC.BaseMysql.CountBySql("SELECT count(id) FROM "+ParticipateUserTable+" WHERE position_id = ? AND project_id = ? AND ent_id = ?", positionId, projectId, in.EntId); c > 0 {
|
|
|
- //更新
|
|
|
- b3 = IC.BaseMysql.UpdateByTx(tx, ParticipateUserTable, map[string]interface{}{
|
|
|
- "position_id": positionId,
|
|
|
- "project_id": projectId,
|
|
|
- "ent_id": in.EntId,
|
|
|
- }, map[string]interface{}{
|
|
|
- "state": 0,
|
|
|
- "mark": 1, //0:参标;1:被划入;-1:终止参标;-2:被划走
|
|
|
- "update_date": date.FormatDate(&now, date.Date_Full_Layout),
|
|
|
- })
|
|
|
- } else {
|
|
|
- //保存
|
|
|
- b3 = IC.BaseMysql.InsertByTx(tx, ParticipateUserTable, map[string]interface{}{
|
|
|
- "ent_id": in.EntId,
|
|
|
- "ent_user_id": entUserId,
|
|
|
- "position_id": positionId,
|
|
|
- "project_id": projectId,
|
|
|
- "user_id": in.MgoUserId,
|
|
|
- "state": 0,
|
|
|
- "mark": 1, //0:参标;1:被划入;-1:终止参标;-2:被划走
|
|
|
- "create_date": date.FormatDate(&now, date.Date_Full_Layout),
|
|
|
- "update_date": date.FormatDate(&now, date.Date_Full_Layout),
|
|
|
- }) > 0
|
|
|
- }
|
|
|
+
|
|
|
return b1 && b2 && b3
|
|
|
}) {
|
|
|
logx.Info(in.PositionId, "---终止---", projectId)
|