作者 陈志颖

fix:已过期竞标任务重新编辑发布

... ... @@ -650,3 +650,4 @@
BodyData:{}
2020/11/23 17:18:21.768 [D] [server.go:2843] <====Send RequestId:GET./cash-pool/activity/?companyId=358&offset=0&limit=20&isEnd=true.1606123101682637000 BodyData:{"code":0,"data":{"activities":[],"count":0},"msg":"ok"}
2020/11/23 17:18:21.768 [D] [server.go:1925] | 127.0.0.1| 200 | 86.366848ms| match| GET  /cash-pool/activity/ r:/cash-pool/activity/
2020/11/23 17:40:41.529 [I] [???:0] http server Running on http://:8082
... ...
... ... @@ -224,9 +224,7 @@ func (status *UnReleasedStatus) RejectReceiver(task *Task) error {
type UnClaimedStatus struct{}
// 待领取任务开放编辑
func (status *UnClaimedStatus) Update(task *Task, data map[string]interface{}) error {
//return fmt.Errorf("待领取的任务不允许编辑")
if taskName, ok := data["taskName"]; ok {
task.TaskName = taskName.(string)
}
... ... @@ -638,15 +636,86 @@ func (status *UnConfirmedStatus) RejectReceiver(task *Task) error {
return nil
}
// TODO 已过期任务
// TODO 已过期任务支持编辑
type ExpiredStatus struct{}
func (status ExpiredStatus) Update(task *Task, data map[string]interface{}) error {
panic("implement me")
if taskName, ok := data["taskName"]; ok {
task.TaskName = taskName.(string)
}
if referenceResourceType, ok := data["referenceResourceType"]; ok {
task.ReferenceResource.ReferenceResourceType = referenceResourceType.(int)
}
if referenceResourceItems, ok := data["referenceResourceItems"]; ok {
task.ReferenceResource.ReferenceResourceItems = referenceResourceItems.([]*ReferenceResourceItem)
}
if projectBelong, ok := data["projectBelong"]; ok {
task.ProjectBelong = projectBelong.(int)
}
if customerValues, ok := data["customerValues"]; ok {
task.CustomerValues = customerValues.([]int)
}
if taskNature, ok := data["taskNature"]; ok {
task.TaskNature = taskNature.(int)
}
if suMoney, ok := data["suMoney"]; ok {
task.SuMoney = suMoney.(float64)
}
if minSuMoney, ok := data["minSuMoney"]; ok {
task.MinSuMoney = minSuMoney.(float64)
}
if maxSuMoney, ok := data["maxSuMoney"]; ok {
task.MaxSuMoney = maxSuMoney.(float64)
}
if task.TaskType == TASK_TYPE_BID {
if bidStartTime, ok := data["bidStartTime"]; ok {
task.BidInfo.BidStartTime = bidStartTime.(time.Time)
}
if bidEndTime, ok := data["bidEndTime"]; ok {
task.BidInfo.BidEndTime = bidEndTime.(time.Time)
}
if isRemind, ok := data["isRemind"]; ok {
task.BidInfo.IsRemind = isRemind.(bool)
}
}
if acceptanceStandard, ok := data["acceptanceStandard"]; ok {
task.AcceptanceStandard = acceptanceStandard.(string)
}
if taskDescription, ok := data["taskDescription"]; ok {
task.TaskDescription = taskDescription.(string)
}
if taskPictureUrls, ok := data["taskPictureUrls"]; ok {
task.TaskPictureUrls = taskPictureUrls.([]string)
}
if isRewardTake, ok := data["isRewardTake"]; ok {
task.IsRewardTake = isRewardTake.(bool)
}
if task.TaskType == TASK_TYPE_DESIGNATE {
if plannedCompletionTime, ok := data["plannedCompletionTime"]; ok {
task.PlannedCompletionTime = plannedCompletionTime.(time.Time)
}
if assignedPerson, ok := data["assignedPerson"]; ok {
task.AssignedPerson = assignedPerson.(*EmployeeInfo)
if task.AssignedPerson.Uid == 0 {
task.AssignedPerson = nil
}
}
}
return nil
}
func (status ExpiredStatus) Release(task *Task) error {
panic("implement me")
currentTime := time.Now()
task.ReleaseTime = currentTime
if task.TaskType == TASK_TYPE_BID {
task.ReceiveTime = currentTime
task.TaskStatus = TASK_STATUS_UNDERWAY
task.CurrentStatus = &UnderwayStatus{}
} else {
task.TaskStatus = TASK_STATUS_UNCLAIMED
task.CurrentStatus = &UnClaimedStatus{}
}
return nil
}
func (status ExpiredStatus) Rob(task *Task, receiver *EmployeeInfo) error {
... ...
... ... @@ -150,7 +150,7 @@ func (dao *EmployeeDao) CalculateSystemSuMoney(companyId int64) (map[string] int
if err := tx.Model(suMoneyTransactionRecordModel).Join("JOIN employees AS e ON e.uid = (su_money_transaction_record.employee->>'uid')::bigint").
ColumnExpr("sum(su_money_transaction_record.su_money) AS system_exchanged_su_money").
Where("e.company_id = ?", companyId).
Where("e.status = ?", 1).
//Where("e.status = ?", 1).
Where(`su_money_transaction_record.record_type = ?`, domain.SU_MONEY_TRANSACTION_RECORD_TYPE_EXCHANGE_CASH).
Select(&systemExchangedSuMoney); err != nil {
return nil, err
... ... @@ -159,7 +159,7 @@ func (dao *EmployeeDao) CalculateSystemSuMoney(companyId int64) (map[string] int
if err := tx.Model(suMoneyTransactionRecordModel).Join("JOIN employees AS e ON e.uid = (su_money_transaction_record.employee->>'uid')::bigint").
ColumnExpr("sum(su_money_transaction_record.su_money) AS system_exchanged_su_money").
Where("e.company_id = ?", companyId).
Where("e.status = ?", 1).
//Where("e.status = ?", 1).
Where(`su_money_transaction_record.record_type = ?`, domain.SU_MONEY_TRANSACTION_RECORD_TYPE_EXCHANGE_CASH_RESTORE).
Select(&systemExchangedSuMoneyRestore); err != nil {
return nil, err
... ...