作者 tangxuhui

修正合约变更记录

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