|
@@ -0,0 +1,81 @@
|
|
|
|
|
+package handler
|
|
|
|
|
+
|
|
|
|
|
+import (
|
|
|
|
|
+ "context"
|
|
|
|
|
+ "dashoo.cn/common_definition/comm_def"
|
|
|
|
|
+ "dashoo.cn/micro_libary/micro_srv"
|
|
|
|
|
+ "dashoo.cn/micro_libary/myerrors"
|
|
|
|
|
+ "github.com/gogf/gf/frame/g"
|
|
|
|
|
+ "lims_adapter/model"
|
|
|
|
|
+ selfModel "lims_adapter/model/equipment"
|
|
|
|
|
+ service "lims_adapter/service/instrument_surcharge"
|
|
|
|
|
+)
|
|
|
|
|
+
|
|
|
|
|
+// 设备附加费
|
|
|
|
|
+type InstrumentSurchargeController struct{}
|
|
|
|
|
+
|
|
|
|
|
+// 设备附加费列表
|
|
|
|
|
+func (a *InstrumentSurchargeController) InstrumentSurchargeList(ctx context.Context, req *model.ListReq, rsp *comm_def.CommonMsg) error {
|
|
|
|
|
+ tenant, err := micro_srv.GetTenant(ctx)
|
|
|
|
|
+ if err != nil {
|
|
|
|
|
+ return err
|
|
|
|
|
+ }
|
|
|
|
|
+ g.Log().Info("Received InstrumentSurchargeController.InstrumentSurchargeList request @ " + tenant)
|
|
|
|
|
+ if req.Current < 0 {
|
|
|
|
|
+ req.Current = DefaultPageCurrent
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ var list, errors = service.NewService(tenant).List(*req)
|
|
|
|
|
+ _, err, code, msg := myerrors.CheckError(errors)
|
|
|
|
|
+ if err != nil {
|
|
|
|
|
+ return err
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ rsp.Code = code
|
|
|
|
|
+ rsp.Msg = msg
|
|
|
|
|
+ rsp.Data = g.Map{"list": list}
|
|
|
|
|
+ return nil
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+// 设备附加费 保存
|
|
|
|
|
+func (a *InstrumentSurchargeController) SaveInstrumentSurcharge(ctx context.Context, req *selfModel.InstrumentSurchargeSaveReq, rsp *comm_def.CommonMsg) error {
|
|
|
|
|
+ tenant, err := micro_srv.GetTenant(ctx)
|
|
|
|
|
+ if err != nil {
|
|
|
|
|
+ return err
|
|
|
|
|
+ }
|
|
|
|
|
+ user, err := micro_srv.GetUserInfo(ctx)
|
|
|
|
|
+ if err != nil {
|
|
|
|
|
+ return err
|
|
|
|
|
+ }
|
|
|
|
|
+ g.Log().Info("Received InstrumentSurchargeController.SaveInstrumentSurcharge request @ " + tenant)
|
|
|
|
|
+
|
|
|
|
|
+ var errors = service.NewService(tenant).Save(*req, user)
|
|
|
|
|
+ _, err, code, msg := myerrors.CheckError(errors)
|
|
|
|
|
+ if err != nil {
|
|
|
|
|
+ return err
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ rsp.Code = code
|
|
|
|
|
+ rsp.Msg = msg
|
|
|
|
|
+ return nil
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+// 设备附加费 删除
|
|
|
|
|
+func (a *InstrumentSurchargeController) DeleteInstrumentSurcharge(ctx context.Context, req *selfModel.InstrumentSurchargeDeleteReq, rsp *comm_def.CommonMsg) error {
|
|
|
|
|
+ tenant, err := micro_srv.GetTenant(ctx)
|
|
|
|
|
+ if err != nil {
|
|
|
|
|
+ return err
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ g.Log().Info("Received InstrumentSurchargeController.DeleteInstrumentSurcharge request @ " + tenant)
|
|
|
|
|
+
|
|
|
|
|
+ var errors = service.NewService(tenant).Delete(*req)
|
|
|
|
|
+ _, err, code, msg := myerrors.CheckError(errors)
|
|
|
|
|
+ if err != nil {
|
|
|
|
|
+ return err
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ rsp.Code = code
|
|
|
|
|
+ rsp.Msg = msg
|
|
|
|
|
+ return nil
|
|
|
|
|
+}
|