|
@@ -56,16 +56,17 @@ func (srv ProductTroubleService) SaveProductTrouble(operateInfo *domain.OperateI |
|
@@ -56,16 +56,17 @@ func (srv ProductTroubleService) SaveProductTrouble(operateInfo *domain.OperateI |
56
|
if err != nil {
|
56
|
if err != nil {
|
57
|
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
|
57
|
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
|
58
|
}
|
58
|
}
|
|
|
59
|
+
|
|
|
60
|
+ recordDate, err := time.ParseInLocation("2006-01-02", param.RecordDate, time.Local)
|
|
|
61
|
+ if err != nil {
|
|
|
62
|
+ return nil, application.ThrowError(application.ARG_ERROR, "日期格式错误")
|
|
|
63
|
+ }
|
59
|
var workerUser *domain.User
|
64
|
var workerUser *domain.User
|
60
|
userService := domainService.NewUserService()
|
65
|
userService := domainService.NewUserService()
|
61
|
workerUser, err = userService.User(param.WorkerId)
|
66
|
workerUser, err = userService.User(param.WorkerId)
|
62
|
if err != nil {
|
67
|
if err != nil {
|
63
|
return nil, application.ThrowError(application.ARG_ERROR, "获取员工信息失败,"+err.Error())
|
68
|
return nil, application.ThrowError(application.ARG_ERROR, "获取员工信息失败,"+err.Error())
|
64
|
}
|
69
|
}
|
65
|
- recordDate, err := time.ParseInLocation("2006-01-02", param.RecordDate, time.Local)
|
|
|
66
|
- if err != nil {
|
|
|
67
|
- return nil, application.ThrowError(application.ARG_ERROR, "日期格式错误")
|
|
|
68
|
- }
|
|
|
69
|
var troubleData *domain.ProductTrouble
|
70
|
var troubleData *domain.ProductTrouble
|
70
|
if param.Id > 0 {
|
71
|
if param.Id > 0 {
|
71
|
troubleData, err = productTroubleRepo.FindOne(map[string]interface{}{
|
72
|
troubleData, err = productTroubleRepo.FindOne(map[string]interface{}{
|
|
@@ -109,6 +110,7 @@ func (srv ProductTroubleService) SaveProductTrouble(operateInfo *domain.OperateI |
|
@@ -109,6 +110,7 @@ func (srv ProductTroubleService) SaveProductTrouble(operateInfo *domain.OperateI |
109
|
if err != nil {
|
110
|
if err != nil {
|
110
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
111
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
111
|
}
|
112
|
}
|
|
|
113
|
+
|
112
|
if err := transactionContext.CommitTransaction(); err != nil {
|
114
|
if err := transactionContext.CommitTransaction(); err != nil {
|
113
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
115
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
114
|
}
|
116
|
}
|