作者 tangxuhui

修正合约变更记录

package dto
import "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_cooperation"
type ContractChangeLogItem struct {
CooperationContractNumber string `json:"cooperationContractNumber"`
CreatedAt string `json:"createdAt"`
IncentivesRule string `json:"incentivesRule"`
IncentivesRuleDetail string `json:"incentivesRuleDetail"`
Operation string `json:"operation"`
OperationType int `json:"operationType"`
Undertakers string `json:"undertakers"`
UpdatedAt string `json:"updatedAt"`
}
func ToContractChangeLogList(param *allied_creation_cooperation.DataContractChangeLogsSearch) []ContractChangeLogItem {
listData := []ContractChangeLogItem{}
for _, v := range param.Grid.List {
item := ContractChangeLogItem{
CooperationContractNumber: v.CooperationContractNumber,
CreatedAt: v.CreatedAt.Format("2006-01-02 15:04:05"),
IncentivesRule: v.IncentivesRule,
IncentivesRuleDetail: v.IncentivesRuleDetail,
Operation: v.Operator.UserName,
OperationType: int(v.OperationType),
Undertakers: v.Undertakers,
UpdatedAt: v.UpdatedAt.Format("2006-01-02 15:04:05"),
}
listData = append(listData, item)
}
return listData
}
... ...
package service
import (
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/contractChangeLog/dto"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/contractChangeLog/query"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_cooperation"
)
... ... @@ -12,7 +13,7 @@ func NewContractChangeLogService(options map[string]interface{}) *ContractChange
return newContractChangeLogService
}
func (srv ContractChangeLogService) ContractChangeLogSearch(queryParam *query.ListContractChangeLogQuery) (interface{}, error) {
func (srv ContractChangeLogService) ContractChangeLogSearch(queryParam *query.ListContractChangeLogQuery) (int, interface{}, error) {
creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(queryParam.Operator)
result, err := creationCooperationGateway.CooperationContractChangeLogsSearch(allied_creation_cooperation.ReqContractChangeLogsSearch{
PageNumber: queryParam.PageNumber,
... ... @@ -20,5 +21,6 @@ func (srv ContractChangeLogService) ContractChangeLogSearch(queryParam *query.Li
CooperationContractNumber: queryParam.CooperationContractNumber,
OperationType: queryParam.OperationType,
})
return result, err
listData := dto.ToContractChangeLogList(result)
return result.Grid.Total, listData, err
}
... ...
... ... @@ -20,6 +20,6 @@ func (controller *ContractChangeLogController) ContractChangeLogSearch() {
return
}
listContractChangeLogQuery.Operator = controller.GetOperator()
data, err := cooperationContractService.ContractChangeLogSearch(listContractChangeLogQuery)
controller.Response(data, err)
cnt, listData, err := cooperationContractService.ContractChangeLogSearch(listContractChangeLogQuery)
controller.ReturnPageListData(int64(cnt), listData, err, listContractChangeLogQuery.PageNumber)
}
... ...
... ... @@ -6,5 +6,5 @@ import (
)
func init() {
web.Router("/v1/web/contract-change-logs/search", &web_client.ContractChangeLogController{}, "Put:ContractChangeLogSearch")
web.Router("/v1/web/contract-change-logs/search", &web_client.ContractChangeLogController{}, "Post:ContractChangeLogSearch")
}
... ...