作者 tangxuhui

更新

... ... @@ -8,7 +8,7 @@ import (
type GetCooperationContractQuery struct {
// 共创合约ID
CooperationContractId int64 `json:"cooperationContractId" valid:"Required"`
CooperationContractId int `json:"cooperationContractId" valid:"Required"`
}
func (getCooperationContractQuery *GetCooperationContractQuery) Valid(validation *validation.Validation) {
... ...
... ... @@ -27,7 +27,7 @@ func (cooperationModeService *CooperationModeService) CreateCooperationMode(crea
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
data := struct {
CooperationModeId int `json:"cooperationModeId,string," valid:"Required"`
CooperationModeId int `json:"cooperationModeId,string,"`
command.CreateCooperationModeCommand
}{
CooperationModeId: result.CooperationModeId,
... ...
... ... @@ -67,7 +67,6 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) UpdateDivide
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
return updateDividendsReturnedOrderCommand, nil
}
func NewDividendsReturnedOrderService(options map[string]interface{}) *DividendsReturnedOrderService {
... ...
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"
)
type CooperationContractController struct {
beego.BaseController
}
func (controller *CooperationContractController) CreateCooperationContract() {
cooperationContractService := service.NewCooperationContractService(nil)
createCooperationContractCommand := &command.CreateCooperationContractCommand{}
controller.Unmarshal(createCooperationContractCommand)
data, err := cooperationContractService.CreateCooperationContract(createCooperationContractCommand)
controller.Response(data, err)
}
func (controller *CooperationContractController) UpdateCooperationContract() {
cooperationContractService := service.NewCooperationContractService(nil)
updateCooperationContractCommand := &command.UpdateCooperationContractCommand{}
controller.Unmarshal(updateCooperationContractCommand)
contractId, _ := controller.GetInt(":contractId")
updateCooperationContractCommand.CooperationContract.CooperationContractId = contractId
data, err := cooperationContractService.UpdateCooperationContract(updateCooperationContractCommand)
controller.Response(data, err)
}
func (controller *CooperationContractController) GetCooperationContract() {
cooperationContractService := service.NewCooperationContractService(nil)
getCooperationContractQuery := &query.GetCooperationContractQuery{}
contractId, _ := controller.GetInt(":contractId")
getCooperationContractQuery.CooperationContractId = contractId
data, err := cooperationContractService.GetCooperationContract(getCooperationContractQuery)
controller.Response(data, err)
}
func (controller *CooperationContractController) ListCooperationContract() {
cooperationContractService := service.NewCooperationContractService(nil)
listCooperationContractQuery := &query.ListCooperationContractQuery{}
data, err := cooperationContractService.ListCooperationContract(listCooperationContractQuery)
controller.Response(data, err)
}
func (controller *CooperationContractController) EnableCooperationContract() {
cooperationContractService := service.NewCooperationContractService(nil)
enableCooperationContractCommand := &command.EnableCooperationContractCommand{}
controller.Unmarshal(enableCooperationContractCommand)
data, err := cooperationContractService.EnableCooperationContract(enableCooperationContractCommand)
controller.Response(data, err)
}
... ...
package web_client
import (
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/cooperationMode/command"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/cooperationMode/query"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/cooperationMode/service"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/log"
)
type CooperationModeController struct {
baseController
}
func (controller *CooperationModeController) CreateCooperationMode() {
cooperationModeService := service.NewCooperationModeService(nil)
createCooperationModeCommand := &command.CreateCooperationModeCommand{}
err := controller.Unmarshal(createCooperationModeCommand)
if err != nil {
log.Logger.Debug("json err:" + err.Error())
}
createCooperationModeCommand.Operator = controller.GetOperator()
data, err := cooperationModeService.CreateCooperationMode(createCooperationModeCommand)
controller.Response(data, err)
}
func (controller *CooperationModeController) UpdateCooperationMode() {
cooperationModeService := service.NewCooperationModeService(nil)
updateCooperationModeCommand := &command.UpdateCooperationModeCommand{}
err := controller.Unmarshal(updateCooperationModeCommand)
if err != nil {
log.Logger.Debug("json err:" + err.Error())
}
modeId, _ := controller.GetInt(":modeId")
updateCooperationModeCommand.Operator = controller.GetOperator()
updateCooperationModeCommand.CooperationModeId = modeId
data, err := cooperationModeService.UpdateCooperationMode(updateCooperationModeCommand)
controller.Response(data, err)
}
func (controller *CooperationModeController) GetCooperationMode() {
cooperationModeService := service.NewCooperationModeService(nil)
getCooperationModeQuery := &query.GetCooperationModeQuery{}
modeId, _ := controller.GetInt(":modeId")
getCooperationModeQuery.CooperationModeId = modeId
getCooperationModeQuery.Operator = controller.GetOperator()
data, err := cooperationModeService.GetCooperationMode(getCooperationModeQuery)
controller.Response(data, err)
}
func (controller *CooperationModeController) RemoveCooperationMode() {
cooperationModeService := service.NewCooperationModeService(nil)
removeCooperationModeCommand := &command.RemoveCooperationModeCommand{}
modeId, _ := controller.GetInt(":modeId")
removeCooperationModeCommand.Operator = controller.GetOperator()
removeCooperationModeCommand.CooperationModeId = modeId
data, err := cooperationModeService.RemoveCooperationMode(removeCooperationModeCommand)
controller.Response(data, err)
}
func (controller *CooperationModeController) ListCooperationMode() {
cooperationModeService := service.NewCooperationModeService(nil)
listCooperationModeQuery := &query.ListCooperationModeQuery{}
err := controller.Unmarshal(listCooperationModeQuery)
if err != nil {
log.Logger.Debug("json err:" + err.Error())
}
listCooperationModeQuery.Operator = controller.GetOperator()
cnt, data, err := cooperationModeService.ListCooperationMode(listCooperationModeQuery)
controller.returnPageListData(cnt, data, err, listCooperationModeQuery.PageNumber)
}
... ...
package web_client
import (
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/dividendsOrder/command"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/dividendsOrder/query"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/dividendsOrder/service"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/log"
)
type DividendsOrderController struct {
baseController
}
func (controller *DividendsOrderController) CreateDividendsOrder() {
dividendsOrderService := service.NewDividendsOrderService(nil)
createDividendsOrderCommand := &command.CreateDividendsOrderCommand{}
err := controller.Unmarshal(createDividendsOrderCommand)
if err != nil {
log.Logger.Debug("json err:" + err.Error())
}
data, err := dividendsOrderService.CreateDividendsOrder(createDividendsOrderCommand)
controller.Response(data, err)
}
func (controller *DividendsOrderController) UpdateDividendsOrder() {
dividendsOrderService := service.NewDividendsOrderService(nil)
updateDividendsOrderCommand := &command.UpdateDividendsOrderCommand{}
err := controller.Unmarshal(updateDividendsOrderCommand)
if err != nil {
log.Logger.Debug("json err:" + err.Error())
}
orderId, _ := controller.GetInt(":orderId")
updateDividendsOrderCommand.DividendsOrderID = orderId
data, err := dividendsOrderService.UpdateDividendsOrder(updateDividendsOrderCommand)
controller.Response(data, err)
}
func (controller *DividendsOrderController) RemoveDividendsOrder() {
dividendsOrderService := service.NewDividendsOrderService(nil)
removeDividendsOrderCommand := &command.RemoveDividendsOrderCommand{}
err := controller.Unmarshal(removeDividendsOrderCommand)
if err != nil {
log.Logger.Debug("json err:" + err.Error())
}
removeDividendsOrderCommand.Operator = controller.GetOperator()
data, err := dividendsOrderService.RemoveDividendsOrder(removeDividendsOrderCommand)
controller.Response(data, err)
}
func (controller *DividendsOrderController) GetDividendsOrder() {
dividendsOrderService := service.NewDividendsOrderService(nil)
getDividendsOrderQuery := &query.GetDividendsOrderQuery{}
orderId, _ := controller.GetInt(":orderId")
getDividendsOrderQuery.DividendsOrderId = orderId
getDividendsOrderQuery.Operator = controller.GetOperator()
data, err := dividendsOrderService.GetDividendsOrder(getDividendsOrderQuery)
controller.Response(data, err)
}
func (controller *DividendsOrderController) SearchDividendsOrder() {
dividendsOrderService := service.NewDividendsOrderService(nil)
searchDividendsOrderQuery := &query.SearchDividendsOrderQuery{}
err := controller.Unmarshal(searchDividendsOrderQuery)
if err != nil {
log.Logger.Debug("json err:" + err.Error())
}
searchDividendsOrderQuery.Operator = controller.GetOperator()
cnt, data, err := dividendsOrderService.SearchDividendsOrder(searchDividendsOrderQuery)
controller.returnPageListData(int64(cnt), data, err, searchDividendsOrderQuery.PageNumber)
}
... ...
package web_client
import (
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/dividendsReturnedOrder/command"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/dividendsReturnedOrder/query"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/dividendsReturnedOrder/service"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/log"
)
type DividendsReturnedOrderController struct {
baseController
}
func (controller *DividendsReturnedOrderController) CreateDividendsReturnedOrder() {
dividendsReturnedOrderService := service.NewDividendsReturnedOrderService(nil)
createDividendsReturnedOrderCommand := &command.CreateDividendsReturnedOrderCommand{}
err := controller.Unmarshal(createDividendsReturnedOrderCommand)
if err != nil {
log.Logger.Debug("json err:" + err.Error())
}
createDividendsReturnedOrderCommand.Operator = controller.GetOperator()
data, err := dividendsReturnedOrderService.CreateDividendsReturnedOrder(createDividendsReturnedOrderCommand)
controller.Response(data, err)
}
func (controller *DividendsReturnedOrderController) UpdateDividendsReturnedOrder() {
dividendsReturnedOrderService := service.NewDividendsReturnedOrderService(nil)
updateDividendsReturnedOrderCommand := &command.UpdateDividendsReturnedOrderCommand{}
err := controller.Unmarshal(updateDividendsReturnedOrderCommand)
if err != nil {
log.Logger.Debug("json err:" + err.Error())
}
projectId, _ := controller.GetInt(":projectId")
updateDividendsReturnedOrderCommand.DividendsReturnedOrderID = projectId
updateDividendsReturnedOrderCommand.Operator = controller.GetOperator()
data, err := dividendsReturnedOrderService.UpdateDividendsReturnedOrder(updateDividendsReturnedOrderCommand)
controller.Response(data, err)
}
func (controller *DividendsReturnedOrderController) RemoveDividendsReturnedOrder() {
dividendsReturnedOrderService := service.NewDividendsReturnedOrderService(nil)
removeDividendsReturnedOrderCommand := &command.RemoveDividendsReturnedOrderCommand{}
err := controller.Unmarshal(removeDividendsReturnedOrderCommand)
if err != nil {
log.Logger.Debug("json err:" + err.Error())
}
projectId, _ := controller.GetInt(":projectId")
removeDividendsReturnedOrderCommand.DividendsReturnedOrderID = projectId
removeDividendsReturnedOrderCommand.Operator = controller.GetOperator()
data, err := dividendsReturnedOrderService.RemoveDividendsReturnedOrder(removeDividendsReturnedOrderCommand)
controller.Response(data, err)
}
func (controller *DividendsReturnedOrderController) GetDividendsReturnedOrder() {
dividendsReturnedOrderService := service.NewDividendsReturnedOrderService(nil)
getDividendsReturnedOrderQuery := &query.GetDividendsReturnedOrderQuery{}
projectId, _ := controller.GetInt(":projectId")
getDividendsReturnedOrderQuery.DividendsReturnedOrderID = projectId
getDividendsReturnedOrderQuery.Operator = controller.GetOperator()
data, err := dividendsReturnedOrderService.GetDividendsReturnedOrder(getDividendsReturnedOrderQuery)
controller.Response(data, err)
}
func (controller *DividendsReturnedOrderController) SearchDividendsReturnedOrder() {
dividendsReturnedOrderService := service.NewDividendsReturnedOrderService(nil)
searchDividendsReturnedOrderQuery := &query.SearchDividendsReturnedOrderQuery{}
err := controller.Unmarshal(searchDividendsReturnedOrderQuery)
if err != nil {
log.Logger.Debug("json err:" + err.Error())
}
searchDividendsReturnedOrderQuery.Operator = controller.GetOperator()
cnt, data, err := dividendsReturnedOrderService.SearchDividendsReturnedOrder(searchDividendsReturnedOrderQuery)
controller.returnPageListData(int64(cnt), data, err, searchDividendsReturnedOrderQuery.PageNumber)
}
... ...
package routers
import (
"github.com/beego/beego/v2/server/web"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/port/beego/controllers/web_client"
)
func init() {
web.Router("/v1/web/cooperation-modes/", &web_client.CooperationModeController{}, "Post:CreateCooperationMode")
web.Router("/v1/web/cooperation-modes/:modeId", &web_client.CooperationModeController{}, "Put:UpdateCooperationMode")
web.Router("/v1/web/cooperation-modes/:modeId", &web_client.CooperationModeController{}, "Get:GetCooperationMode")
web.Router("/v1/web/cooperation-modes/:modeId", &web_client.CooperationModeController{}, "Delete:RemoveCooperationMode")
web.Router("/v1/web/cooperation-modes/search", &web_client.CooperationModeController{}, "Post:ListCooperationMode")
}
... ...
package routers
import (
"github.com/beego/beego/v2/server/web"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/port/beego/controllers/web_client"
)
func init() {
web.Router("/v1/web/dividends-returned-order/", &web_client.DividendsReturnedOrderController{}, "Post:CreateDividendsReturnedOrder")
web.Router("/v1/web/dividends-returned-order/:projectId", &web_client.DividendsReturnedOrderController{}, "Put:UpdateDividendsReturnedOrder")
web.Router("/v1/web/dividends-returned-order/:projectId", &web_client.DividendsReturnedOrderController{}, "Delete:RemoveDividendsReturnedOrder")
web.Router("/v1/web/dividends-returned-order/:projectId", &web_client.DividendsReturnedOrderController{}, "Get:GetDividendsReturnedOrder")
web.Router("/v1/web/dividends-returned-order/search", &web_client.DividendsReturnedOrderController{}, "Post:SearchDividendsReturnedOrder")
}
... ...