|
|
package web_client
|
|
|
|
|
|
import (
|
|
|
"github.com/linmadan/egglib-go/web/beego"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/cooperationContract/command"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/cooperationContract/query"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/cooperationContract/service"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/log"
|
|
|
)
|
|
|
|
|
|
type CooperationContractController struct {
|
|
|
beego.BaseController
|
|
|
baseController
|
|
|
}
|
|
|
|
|
|
func (controller *CooperationContractController) CreateCooperationContract() {
|
|
|
cooperationContractService := service.NewCooperationContractService(nil)
|
|
|
createCooperationContractCommand := &command.CreateCooperationContractCommand{}
|
|
|
controller.Unmarshal(createCooperationContractCommand)
|
|
|
err := controller.Unmarshal(createCooperationContractCommand)
|
|
|
if err != nil {
|
|
|
log.Logger.Debug("json err:" + err.Error())
|
|
|
}
|
|
|
createCooperationContractCommand.Operator = controller.GetOperator()
|
|
|
data, err := cooperationContractService.CreateCooperationContract(createCooperationContractCommand)
|
|
|
controller.Response(data, err)
|
|
|
}
|
...
|
...
|
@@ -22,8 +26,12 @@ func (controller *CooperationContractController) CreateCooperationContract() { |
|
|
func (controller *CooperationContractController) UpdateCooperationContract() {
|
|
|
cooperationContractService := service.NewCooperationContractService(nil)
|
|
|
updateCooperationContractCommand := &command.UpdateCooperationContractCommand{}
|
|
|
controller.Unmarshal(updateCooperationContractCommand)
|
|
|
err := controller.Unmarshal(updateCooperationContractCommand)
|
|
|
if err != nil {
|
|
|
log.Logger.Debug("json err:" + err.Error())
|
|
|
}
|
|
|
contractId, _ := controller.GetInt(":contractId")
|
|
|
updateCooperationContractCommand.Operator = controller.GetOperator()
|
|
|
updateCooperationContractCommand.CooperationContract.CooperationContractId = contractId
|
|
|
data, err := cooperationContractService.UpdateCooperationContract(updateCooperationContractCommand)
|
|
|
controller.Response(data, err)
|
...
|
...
|
@@ -33,6 +41,7 @@ func (controller *CooperationContractController) GetCooperationContract() { |
|
|
cooperationContractService := service.NewCooperationContractService(nil)
|
|
|
getCooperationContractQuery := &query.GetCooperationContractQuery{}
|
|
|
contractId, _ := controller.GetInt(":contractId")
|
|
|
getCooperationContractQuery.Operator = controller.GetOperator()
|
|
|
getCooperationContractQuery.CooperationContractId = contractId
|
|
|
data, err := cooperationContractService.GetCooperationContract(getCooperationContractQuery)
|
|
|
controller.Response(data, err)
|
...
|
...
|
@@ -41,14 +50,22 @@ func (controller *CooperationContractController) GetCooperationContract() { |
|
|
func (controller *CooperationContractController) ListCooperationContract() {
|
|
|
cooperationContractService := service.NewCooperationContractService(nil)
|
|
|
listCooperationContractQuery := &query.ListCooperationContractQuery{}
|
|
|
_, data, err := cooperationContractService.ListCooperationContract(listCooperationContractQuery)
|
|
|
controller.Response(data, err)
|
|
|
err := controller.Unmarshal(listCooperationContractQuery)
|
|
|
if err != nil {
|
|
|
log.Logger.Debug("json err:" + err.Error())
|
|
|
}
|
|
|
listCooperationContractQuery.Operator = controller.GetOperator()
|
|
|
cnt, data, err := cooperationContractService.ListCooperationContract(listCooperationContractQuery)
|
|
|
controller.ReturnPageListData(int64(cnt), data, err, listCooperationContractQuery.PageNumber)
|
|
|
}
|
|
|
|
|
|
func (controller *CooperationContractController) EnableCooperationContract() {
|
|
|
cooperationContractService := service.NewCooperationContractService(nil)
|
|
|
enableCooperationContractCommand := &command.EnableCooperationContractCommand{}
|
|
|
controller.Unmarshal(enableCooperationContractCommand)
|
|
|
err := controller.Unmarshal(enableCooperationContractCommand)
|
|
|
if err != nil {
|
|
|
log.Logger.Debug("json err:" + err.Error())
|
|
|
}
|
|
|
data, err := cooperationContractService.EnableCooperationContract(enableCooperationContractCommand)
|
|
|
controller.Response(data, err)
|
|
|
} |
...
|
...
|
|