正在显示
10 个修改的文件
包含
249 行增加
和
26 行删除
@@ -173,3 +173,11 @@ func CreateRewardRuleRepository(options map[string]interface{}) (domain.RewardRu | @@ -173,3 +173,11 @@ func CreateRewardRuleRepository(options map[string]interface{}) (domain.RewardRu | ||
173 | } | 173 | } |
174 | return repository.NewRewardRuleRepository(transactionContext) | 174 | return repository.NewRewardRuleRepository(transactionContext) |
175 | } | 175 | } |
176 | + | ||
177 | +func CreateProductTroubleRepository(options map[string]interface{}) (domain.ProductTroubleRepository, error) { | ||
178 | + var transactionContext *pg.TransactionContext | ||
179 | + if value, ok := options["transactionContext"]; ok { | ||
180 | + transactionContext = value.(*pg.TransactionContext) | ||
181 | + } | ||
182 | + return repository.NewProductTroubleRepository(transactionContext) | ||
183 | +} |
1 | package command | 1 | package command |
2 | 2 | ||
3 | //创建事故记录 | 3 | //创建事故记录 |
4 | -type CreatedProductTroubleCommand struct{} | 4 | +type SaveProductTroubleCommand struct { |
5 | + Id int `json:"id"` //id | ||
6 | + WorkshopId int `json:"workshopId" valid:"Required"` //车间id | ||
7 | + LineId int `json:"lineId" valid:"Required"` //生产线ID | ||
8 | + SectionId int `json:"sectionId" valid:"Required"` //工段ID | ||
9 | + WorkerId int `json:"workerId"` //员工id | ||
10 | + Remark string `json:"remark"` //备注 | ||
11 | + AmountLoss float64 `json:"amountLoss"` // 损失的金额 | ||
12 | + Types int `json:"types"` // 事故类型 1 安全事故 ,2 质量事故, 3 金属事故 ,4 非金属事故 | ||
13 | + RecordDate string `json:"recordDate"` // 事故发生的日期 | ||
14 | +} |
1 | +package dto | ||
2 | + | ||
3 | +type ProductTroubleInfo struct { | ||
4 | + Id int `json:"id"` //id | ||
5 | + WorkshopId int `json:"workshopId"` //车间id | ||
6 | + WorkshopName string `json:"workshopName"` // | ||
7 | + LineId int `json:"lineId"` //生产线ID | ||
8 | + LineName string `json:"lineName"` // | ||
9 | + SectionId int `json:"sectionId"` //工段ID | ||
10 | + SectionName string `json:"sectionName"` // | ||
11 | + Remark string `json:"remark"` //备注 | ||
12 | + ProductDate string `json:"productDate"` //日期 | ||
13 | + AmountLoss float64 `json:"amountLoss"` //损失的金额 | ||
14 | + Types int `json:"types"` //事故类型 | ||
15 | +} |
1 | package service | 1 | package service |
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | + "time" | ||
5 | + | ||
4 | "github.com/linmadan/egglib-go/core/application" | 6 | "github.com/linmadan/egglib-go/core/application" |
5 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application/factory" | 7 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application/factory" |
6 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application/productTrouble/command" | 8 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application/productTrouble/command" |
9 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application/productTrouble/dto" | ||
10 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/domain" | ||
11 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/domainService" | ||
7 | ) | 12 | ) |
8 | 13 | ||
9 | // 事故管理 | 14 | // 事故管理 |
@@ -14,7 +19,7 @@ func NewProductTroubleService(options map[string]interface{}) *ProductTroubleSer | @@ -14,7 +19,7 @@ func NewProductTroubleService(options map[string]interface{}) *ProductTroubleSer | ||
14 | return newService | 19 | return newService |
15 | } | 20 | } |
16 | 21 | ||
17 | -func (srv ProductTroubleService) SaveProductTrouble(param *command.CreatedProductTroubleCommand) (map[string]interface{}, error) { | 22 | +func (srv ProductTroubleService) SaveProductTrouble(operateInfo *domain.OperateInfo, param *command.SaveProductTroubleCommand) (map[string]interface{}, error) { |
18 | transactionContext, err := factory.CreateTransactionContext(nil) | 23 | transactionContext, err := factory.CreateTransactionContext(nil) |
19 | if err != nil { | 24 | if err != nil { |
20 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | 25 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) |
@@ -26,15 +31,76 @@ func (srv ProductTroubleService) SaveProductTrouble(param *command.CreatedProduc | @@ -26,15 +31,76 @@ func (srv ProductTroubleService) SaveProductTrouble(param *command.CreatedProduc | ||
26 | transactionContext.RollbackTransaction() | 31 | transactionContext.RollbackTransaction() |
27 | }() | 32 | }() |
28 | 33 | ||
34 | + productTroubleRepo, _ := factory.CreateProductTroubleRepository(map[string]interface{}{ | ||
35 | + "transactionContext": transactionContext, | ||
36 | + }) | ||
37 | + workShopRepo, _ := factory.CreateWorkshopRepository(map[string]interface{}{ | ||
38 | + "transactionContext": transactionContext, | ||
39 | + }) | ||
40 | + //获取车间数据 | ||
41 | + workShopData, err := workShopRepo.FindOne(map[string]interface{}{ | ||
42 | + "workshopId": param.WorkshopId, | ||
43 | + }) | ||
44 | + if err != nil { | ||
45 | + return nil, application.ThrowError(application.ARG_ERROR, "车间数据不能存在"+err.Error()) | ||
46 | + } | ||
47 | + if workShopData.CompanyId != operateInfo.CompanyId { | ||
48 | + return nil, application.ThrowError(application.ARG_ERROR, "车间数据填写错误") | ||
49 | + } | ||
50 | + workStation, err := workShopData.FindWorkStation(param.WorkshopId, param.LineId, param.WorkshopId) | ||
51 | + if err != nil { | ||
52 | + return nil, application.ThrowError(application.ARG_ERROR, err.Error()) | ||
53 | + } | ||
54 | + var workerUser *domain.User | ||
55 | + userService := domainService.NewUserService() | ||
56 | + workerUser, err = userService.User(param.WorkerId) | ||
57 | + if err != nil { | ||
58 | + return nil, application.ThrowError(application.ARG_ERROR, "获取员工信息失败,"+err.Error()) | ||
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 | + } | ||
64 | + var troubleData *domain.ProductTrouble | ||
65 | + if param.Id > 0 { | ||
66 | + troubleData, err = productTroubleRepo.FindOne(map[string]interface{}{ | ||
67 | + "id": param.Id, | ||
68 | + }) | ||
69 | + if err != nil { | ||
70 | + return nil, application.ThrowError(application.ARG_ERROR, "事故数据填写错误") | ||
71 | + } | ||
72 | + } else { | ||
73 | + troubleData = &domain.ProductTrouble{ | ||
74 | + CompanyId: operateInfo.CompanyId, | ||
75 | + OrgId: operateInfo.OrgId, | ||
76 | + CreatedAt: time.Now(), | ||
77 | + ApproveStatus: domain.TroubleWaitApprove, | ||
78 | + } | ||
79 | + } | ||
80 | + | ||
81 | + troubleData.AmountLoss = param.AmountLoss | ||
82 | + troubleData.ProductWorker = *workerUser | ||
83 | + troubleData.RecordData = recordDate | ||
84 | + troubleData.Remark = param.Remark | ||
85 | + troubleData.UpdatedAt = time.Now() | ||
86 | + troubleData.WorkStation = *workStation | ||
87 | + err = troubleData.SetTypes(param.Types) | ||
88 | + if err != nil { | ||
89 | + return nil, application.ThrowError(application.ARG_ERROR, err.Error()) | ||
90 | + } | ||
91 | + _, err = productTroubleRepo.Save(troubleData) | ||
92 | + if err != nil { | ||
93 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
94 | + } | ||
29 | if err := transactionContext.CommitTransaction(); err != nil { | 95 | if err := transactionContext.CommitTransaction(); err != nil { |
30 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | 96 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) |
31 | } | 97 | } |
32 | return map[string]interface{}{ | 98 | return map[string]interface{}{ |
33 | - "id": 0, | 99 | + "id": troubleData.Id, |
34 | }, nil | 100 | }, nil |
35 | } | 101 | } |
36 | 102 | ||
37 | -func (srv ProductTroubleService) GetProductTrouble(id int64) (map[string]interface{}, error) { | 103 | +func (srv ProductTroubleService) GetProductTrouble(id int) (*dto.ProductTroubleInfo, error) { |
38 | transactionContext, err := factory.CreateTransactionContext(nil) | 104 | transactionContext, err := factory.CreateTransactionContext(nil) |
39 | if err != nil { | 105 | if err != nil { |
40 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | 106 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) |
@@ -46,12 +112,33 @@ func (srv ProductTroubleService) GetProductTrouble(id int64) (map[string]interfa | @@ -46,12 +112,33 @@ func (srv ProductTroubleService) GetProductTrouble(id int64) (map[string]interfa | ||
46 | transactionContext.RollbackTransaction() | 112 | transactionContext.RollbackTransaction() |
47 | }() | 113 | }() |
48 | 114 | ||
115 | + productTroubleRepo, _ := factory.CreateProductTroubleRepository(map[string]interface{}{ | ||
116 | + "transactionContext": transactionContext, | ||
117 | + }) | ||
118 | + troubleData, err := productTroubleRepo.FindOne(map[string]interface{}{ | ||
119 | + "id": id, | ||
120 | + }) | ||
121 | + if err != nil { | ||
122 | + return nil, application.ThrowError(application.ARG_ERROR, "事故数据不存在,"+err.Error()) | ||
123 | + } | ||
49 | if err := transactionContext.CommitTransaction(); err != nil { | 124 | if err := transactionContext.CommitTransaction(); err != nil { |
50 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | 125 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) |
51 | } | 126 | } |
52 | - return map[string]interface{}{ | ||
53 | - "id": 0, | ||
54 | - }, nil | 127 | + |
128 | + result := dto.ProductTroubleInfo{ | ||
129 | + Id: troubleData.Id, | ||
130 | + WorkshopId: troubleData.WorkStation.WorkshopId, | ||
131 | + WorkshopName: troubleData.WorkStation.WorkshopName, | ||
132 | + LineId: troubleData.WorkStation.LineId, | ||
133 | + LineName: troubleData.WorkStation.LineName, | ||
134 | + SectionId: troubleData.WorkStation.SectionId, | ||
135 | + SectionName: troubleData.WorkStation.SectionName, | ||
136 | + Remark: troubleData.Remark, | ||
137 | + ProductDate: troubleData.RecordData.Format("2006-01-02"), | ||
138 | + AmountLoss: troubleData.AmountLoss, | ||
139 | + Types: int(troubleData.Types), | ||
140 | + } | ||
141 | + return &result, nil | ||
55 | } | 142 | } |
56 | 143 | ||
57 | func (srv ProductTroubleService) DeleteProductTrouble(id int64) error { | 144 | func (srv ProductTroubleService) DeleteProductTrouble(id int64) error { |
@@ -65,14 +152,26 @@ func (srv ProductTroubleService) DeleteProductTrouble(id int64) error { | @@ -65,14 +152,26 @@ func (srv ProductTroubleService) DeleteProductTrouble(id int64) error { | ||
65 | defer func() { | 152 | defer func() { |
66 | transactionContext.RollbackTransaction() | 153 | transactionContext.RollbackTransaction() |
67 | }() | 154 | }() |
68 | - | 155 | + productTroubleRepo, _ := factory.CreateProductTroubleRepository(map[string]interface{}{ |
156 | + "transactionContext": transactionContext, | ||
157 | + }) | ||
158 | + troubleData, err := productTroubleRepo.FindOne(map[string]interface{}{ | ||
159 | + "id": id, | ||
160 | + }) | ||
161 | + if err != nil { | ||
162 | + return application.ThrowError(application.ARG_ERROR, "事故数据不存在,"+err.Error()) | ||
163 | + } | ||
164 | + _, err = productTroubleRepo.Remove(troubleData) | ||
165 | + if err != nil { | ||
166 | + return application.ThrowError(application.ARG_ERROR, err.Error()) | ||
167 | + } | ||
69 | if err := transactionContext.CommitTransaction(); err != nil { | 168 | if err := transactionContext.CommitTransaction(); err != nil { |
70 | return application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | 169 | return application.ThrowError(application.TRANSACTION_ERROR, err.Error()) |
71 | } | 170 | } |
72 | return nil | 171 | return nil |
73 | } | 172 | } |
74 | 173 | ||
75 | -func (srv ProductTroubleService) ApproveProductTrouble(id int64) error { | 174 | +func (srv ProductTroubleService) ApproveProductTrouble(operateInfo *domain.OperateInfo, id int64) error { |
76 | transactionContext, err := factory.CreateTransactionContext(nil) | 175 | transactionContext, err := factory.CreateTransactionContext(nil) |
77 | if err != nil { | 176 | if err != nil { |
78 | return application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | 177 | return application.ThrowError(application.TRANSACTION_ERROR, err.Error()) |
@@ -83,7 +182,31 @@ func (srv ProductTroubleService) ApproveProductTrouble(id int64) error { | @@ -83,7 +182,31 @@ func (srv ProductTroubleService) ApproveProductTrouble(id int64) error { | ||
83 | defer func() { | 182 | defer func() { |
84 | transactionContext.RollbackTransaction() | 183 | transactionContext.RollbackTransaction() |
85 | }() | 184 | }() |
185 | + productTroubleRepo, _ := factory.CreateProductTroubleRepository(map[string]interface{}{ | ||
186 | + "transactionContext": transactionContext, | ||
187 | + }) | ||
188 | + troubleData, err := productTroubleRepo.FindOne(map[string]interface{}{ | ||
189 | + "id": id, | ||
190 | + }) | ||
191 | + if err != nil { | ||
192 | + return application.ThrowError(application.ARG_ERROR, "事故数据不存在,"+err.Error()) | ||
193 | + } | ||
194 | + var approveUser *domain.User | ||
195 | + userService := domainService.NewUserService() | ||
196 | + approveUser, err = userService.User(operateInfo.UserId) | ||
197 | + if err != nil { | ||
198 | + return application.ThrowError(application.ARG_ERROR, "获取审核人信息失败,"+err.Error()) | ||
199 | + } | ||
200 | + err = troubleData.Approve(approveUser) | ||
201 | + if err != nil { | ||
202 | + return application.ThrowError(application.ARG_ERROR, err.Error()) | ||
203 | + } | ||
86 | 204 | ||
205 | + troubleData.UpdatedAt = time.Now() | ||
206 | + _, err = productTroubleRepo.Save(troubleData) | ||
207 | + if err != nil { | ||
208 | + return application.ThrowError(application.ARG_ERROR, err.Error()) | ||
209 | + } | ||
87 | if err := transactionContext.CommitTransaction(); err != nil { | 210 | if err := transactionContext.CommitTransaction(); err != nil { |
88 | return application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | 211 | return application.ThrowError(application.TRANSACTION_ERROR, err.Error()) |
89 | } | 212 | } |
@@ -11,7 +11,7 @@ type ProductTrouble struct { | @@ -11,7 +11,7 @@ type ProductTrouble struct { | ||
11 | CompanyId int `json:"companyId"` //企业id | 11 | CompanyId int `json:"companyId"` //企业id |
12 | OrgId int `json:"orgId"` //组织ID | 12 | OrgId int `json:"orgId"` //组织ID |
13 | WorkStation WorkStation `json:"workStation"` // 工作位置 | 13 | WorkStation WorkStation `json:"workStation"` // 工作位置 |
14 | - ProductWorker *User `json:"productWorker,omitempty"` // 生产工人 | 14 | + ProductWorker User `json:"productWorker,omitempty"` // 生产工人 |
15 | AmountLoss float64 `json:"amountLoss"` // 损失的金额 | 15 | AmountLoss float64 `json:"amountLoss"` // 损失的金额 |
16 | Types TroubleType `json:"types"` // 事故类型 | 16 | Types TroubleType `json:"types"` // 事故类型 |
17 | RecordData time.Time `json:"recordData"` // 事故发生的日期 | 17 | RecordData time.Time `json:"recordData"` // 事故发生的日期 |
@@ -63,7 +63,7 @@ func (m *ProductTrouble) SetTypes(v int) error { | @@ -63,7 +63,7 @@ func (m *ProductTrouble) SetTypes(v int) error { | ||
63 | } | 63 | } |
64 | 64 | ||
65 | // 审核事故数据 | 65 | // 审核事故数据 |
66 | -func (m *ProductTrouble) Approve() error { | 66 | +func (m *ProductTrouble) Approve(approveUser *User) error { |
67 | nowTime := time.Now() | 67 | nowTime := time.Now() |
68 | switch m.ApproveStatus { | 68 | switch m.ApproveStatus { |
69 | case TroubleIsApprove: | 69 | case TroubleIsApprove: |
@@ -71,6 +71,7 @@ func (m *ProductTrouble) Approve() error { | @@ -71,6 +71,7 @@ func (m *ProductTrouble) Approve() error { | ||
71 | default: | 71 | default: |
72 | m.ApproveAt = &nowTime | 72 | m.ApproveAt = &nowTime |
73 | m.ApproveStatus = TroubleIsApprove | 73 | m.ApproveStatus = TroubleIsApprove |
74 | + m.ApproveUser = approveUser | ||
74 | } | 75 | } |
75 | return nil | 76 | return nil |
76 | } | 77 | } |
@@ -13,7 +13,7 @@ type ProductTrouble struct { | @@ -13,7 +13,7 @@ type ProductTrouble struct { | ||
13 | CompanyId int //企业id | 13 | CompanyId int //企业id |
14 | OrgId int //组织ID | 14 | OrgId int //组织ID |
15 | WorkStation domain.WorkStation // 工作位置 | 15 | WorkStation domain.WorkStation // 工作位置 |
16 | - ProductWorker *domain.User // 生产工人 | 16 | + ProductWorker domain.User // 生产工人 |
17 | AmountLoss float64 // 损失的金额 | 17 | AmountLoss float64 // 损失的金额 |
18 | Types int // 事故类型 | 18 | Types int // 事故类型 |
19 | RecordData time.Time // 事故发生的日期 | 19 | RecordData time.Time // 事故发生的日期 |
1 | +package controllers | ||
2 | + | ||
3 | +import ( | ||
4 | + "github.com/linmadan/egglib-go/web/beego" | ||
5 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application/productTrouble/command" | ||
6 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application/productTrouble/query" | ||
7 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/application/productTrouble/service" | ||
8 | +) | ||
9 | + | ||
10 | +type ProductTroubleController struct { | ||
11 | + beego.BaseController | ||
12 | +} | ||
13 | + | ||
14 | +// 创建事故记录 | ||
15 | +func (c *ProductTroubleController) CreatedProductTrouble() { | ||
16 | + srv := service.NewProductTroubleService(nil) | ||
17 | + createCommand := &command.SaveProductTroubleCommand{} | ||
18 | + Must(c.Unmarshal(createCommand)) | ||
19 | + operater := ParseOperateInfo(c.BaseController) | ||
20 | + data, err := srv.SaveProductTrouble(operater, createCommand) | ||
21 | + c.Response(data, err) | ||
22 | +} | ||
23 | + | ||
24 | +// 更新事故记录 | ||
25 | +func (c *ProductTroubleController) UpdateProductTrouble() { | ||
26 | + srv := service.NewProductTroubleService(nil) | ||
27 | + createCommand := &command.SaveProductTroubleCommand{} | ||
28 | + Must(c.Unmarshal(createCommand)) | ||
29 | + id, _ := c.GetInt(":id") | ||
30 | + createCommand.Id = id | ||
31 | + operater := ParseOperateInfo(c.BaseController) | ||
32 | + data, err := srv.SaveProductTrouble(operater, createCommand) | ||
33 | + c.Response(data, err) | ||
34 | +} | ||
35 | + | ||
36 | +// 获取事故记录 | ||
37 | +func (c *ProductTroubleController) GetProductTrouble() { | ||
38 | + srv := service.NewProductTroubleService(nil) | ||
39 | + id, _ := c.GetInt(":id") | ||
40 | + | ||
41 | + data, err := srv.GetProductTrouble(id) | ||
42 | + c.Response(data, err) | ||
43 | +} | ||
44 | + | ||
45 | +// 删除事故记录 | ||
46 | +func (c RewardStandardController) DeleteProductTrouble() { | ||
47 | + srv := service.NewProductTroubleService(nil) | ||
48 | + getQuery := &query.GetProductTroubleQuery{} | ||
49 | + Must(c.Unmarshal(getQuery)) | ||
50 | + err := srv.DeleteProductTrouble(int64(getQuery.Id)) | ||
51 | + c.Response(nil, err) | ||
52 | +} |
@@ -11,8 +11,8 @@ type RewardStandardController struct { | @@ -11,8 +11,8 @@ type RewardStandardController struct { | ||
11 | beego.BaseController | 11 | beego.BaseController |
12 | } | 12 | } |
13 | 13 | ||
14 | -//创建奖惩标准 | ||
15 | -func (c RewardStandardController) CreatedRewardStandard() { | 14 | +// 创建奖惩标准 |
15 | +func (c *RewardStandardController) CreatedRewardStandard() { | ||
16 | srv := service.NewRewardStandardService(nil) | 16 | srv := service.NewRewardStandardService(nil) |
17 | createCommand := &command.SaveRewardStandardCommand{} | 17 | createCommand := &command.SaveRewardStandardCommand{} |
18 | Must(c.Unmarshal(createCommand)) | 18 | Must(c.Unmarshal(createCommand)) |
@@ -21,8 +21,8 @@ func (c RewardStandardController) CreatedRewardStandard() { | @@ -21,8 +21,8 @@ func (c RewardStandardController) CreatedRewardStandard() { | ||
21 | c.Response(data, err) | 21 | c.Response(data, err) |
22 | } | 22 | } |
23 | 23 | ||
24 | -//更新奖惩标准 | ||
25 | -func (c RewardStandardController) UpdateRewardStandard() { | 24 | +// 更新奖惩标准 |
25 | +func (c *RewardStandardController) UpdateRewardStandard() { | ||
26 | srv := service.NewRewardStandardService(nil) | 26 | srv := service.NewRewardStandardService(nil) |
27 | createCommand := &command.SaveRewardStandardCommand{} | 27 | createCommand := &command.SaveRewardStandardCommand{} |
28 | Must(c.Unmarshal(createCommand)) | 28 | Must(c.Unmarshal(createCommand)) |
@@ -33,8 +33,8 @@ func (c RewardStandardController) UpdateRewardStandard() { | @@ -33,8 +33,8 @@ func (c RewardStandardController) UpdateRewardStandard() { | ||
33 | c.Response(data, err) | 33 | c.Response(data, err) |
34 | } | 34 | } |
35 | 35 | ||
36 | -//获取奖惩标准 | ||
37 | -func (c RewardStandardController) GetRewardStandard() { | 36 | +// 获取奖惩标准 |
37 | +func (c *RewardStandardController) GetRewardStandard() { | ||
38 | srv := service.NewRewardStandardService(nil) | 38 | srv := service.NewRewardStandardService(nil) |
39 | id, _ := c.GetInt(":id") | 39 | id, _ := c.GetInt(":id") |
40 | getQuery := &query.GetRewardStandard{ | 40 | getQuery := &query.GetRewardStandard{ |
@@ -45,8 +45,8 @@ func (c RewardStandardController) GetRewardStandard() { | @@ -45,8 +45,8 @@ func (c RewardStandardController) GetRewardStandard() { | ||
45 | c.Response(data, err) | 45 | c.Response(data, err) |
46 | } | 46 | } |
47 | 47 | ||
48 | -//删除奖惩标准 | ||
49 | -func (c RewardStandardController) DeleteRewardStandard() { | 48 | +// 删除奖惩标准 |
49 | +func (c *RewardStandardController) DeleteRewardStandard() { | ||
50 | srv := service.NewRewardStandardService(nil) | 50 | srv := service.NewRewardStandardService(nil) |
51 | getQuery := &query.GetRewardStandard{} | 51 | getQuery := &query.GetRewardStandard{} |
52 | Must(c.Unmarshal(getQuery)) | 52 | Must(c.Unmarshal(getQuery)) |
@@ -55,8 +55,8 @@ func (c RewardStandardController) DeleteRewardStandard() { | @@ -55,8 +55,8 @@ func (c RewardStandardController) DeleteRewardStandard() { | ||
55 | c.Response(data, err) | 55 | c.Response(data, err) |
56 | } | 56 | } |
57 | 57 | ||
58 | -//列表展示奖惩标准 | ||
59 | -func (c RewardStandardController) ListRewardStandard() { | 58 | +// 列表展示奖惩标准 |
59 | +func (c *RewardStandardController) ListRewardStandard() { | ||
60 | srv := service.NewRewardStandardService(nil) | 60 | srv := service.NewRewardStandardService(nil) |
61 | cmd := &query.ListRewardStandard{} | 61 | cmd := &query.ListRewardStandard{} |
62 | Must(c.Unmarshal(cmd)) | 62 | Must(c.Unmarshal(cmd)) |
@@ -66,8 +66,8 @@ func (c RewardStandardController) ListRewardStandard() { | @@ -66,8 +66,8 @@ func (c RewardStandardController) ListRewardStandard() { | ||
66 | ResponseGrid(c.BaseController, total, data, err) | 66 | ResponseGrid(c.BaseController, total, data, err) |
67 | } | 67 | } |
68 | 68 | ||
69 | -//SaveRewardRule 保存奖惩规则 | ||
70 | -func (c RewardStandardController) SaveRewardRule() { | 69 | +// SaveRewardRule 保存奖惩规则 |
70 | +func (c *RewardStandardController) SaveRewardRule() { | ||
71 | srv := service.NewRewardStandardService(nil) | 71 | srv := service.NewRewardStandardService(nil) |
72 | createCommand := &command.SaveRewardRuleCommand{} | 72 | createCommand := &command.SaveRewardRuleCommand{} |
73 | Must(c.Unmarshal(createCommand)) | 73 | Must(c.Unmarshal(createCommand)) |
@@ -76,8 +76,8 @@ func (c RewardStandardController) SaveRewardRule() { | @@ -76,8 +76,8 @@ func (c RewardStandardController) SaveRewardRule() { | ||
76 | c.Response(data, err) | 76 | c.Response(data, err) |
77 | } | 77 | } |
78 | 78 | ||
79 | -//GetRewardRule 获取奖惩规则 | ||
80 | -func (c RewardStandardController) GetRewardRule() { | 79 | +// GetRewardRule 获取奖惩规则 |
80 | +func (c *RewardStandardController) GetRewardRule() { | ||
81 | srv := service.NewRewardStandardService(nil) | 81 | srv := service.NewRewardStandardService(nil) |
82 | operater := ParseOperateInfo(c.BaseController) | 82 | operater := ParseOperateInfo(c.BaseController) |
83 | data, err := srv.GetRewardRule(operater) | 83 | data, err := srv.GetRewardRule(operater) |
1 | +package routers | ||
2 | + | ||
3 | +import ( | ||
4 | + "github.com/beego/beego/v2/server/web" | ||
5 | + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/port/beego/controllers" | ||
6 | +) | ||
7 | + | ||
8 | +func init() { | ||
9 | + web.Router("/product_trouble/", &controllers.ProductTroubleController{}, "Post:CreatedProductTrouble") | ||
10 | + web.Router("/product_trouble/:id", &controllers.ProductTroubleController{}, "Put:UpdateProductTrouble") | ||
11 | + web.Router("/product_trouble/:id", &controllers.ProductTroubleController{}, "Get:GetProductTrouble") | ||
12 | + web.Router("/product_trouble/remove", &controllers.ProductTroubleController{}, "Post:DeleteProductTrouble") | ||
13 | + // web.Router("/reward-standard/search", &controllers.RewardStandardController{}, "Post:ListRewardStandard") | ||
14 | +} |
-
请 注册 或 登录 后发表评论