作者 yangfu

上报修改

@@ -38,6 +38,14 @@ func (srv CooperationProjectService) CreateCooperationProject(createCooperationP @@ -38,6 +38,14 @@ func (srv CooperationProjectService) CreateCooperationProject(createCooperationP
38 if err != nil { 38 if err != nil {
39 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 39 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
40 } 40 }
  41 + //if err = broker.Push(constant.TOPIC_UP_BLOCK_CHAIN, broker.NewPushObject(
  42 + // domain.BlockChainSourceCooperationProject,
  43 + // strconv.Itoa(result.CooperationProject.CooperationProjectId),
  44 + // strconv.Itoa(result.CooperationProject.CooperationProjectId),
  45 + // result,
  46 + //)); err != nil {
  47 + // return nil, application.ThrowError(application.TRANSACTION_ERROR, "消息服务异常"+err.Error())
  48 + //}
41 return dto.ToCooperationProjectInfo(&result.CooperationProject), nil 49 return dto.ToCooperationProjectInfo(&result.CooperationProject), nil
42 } 50 }
43 51
@@ -23,6 +23,8 @@ type CooperationContractItem struct { @@ -23,6 +23,8 @@ type CooperationContractItem struct {
23 CooperationContractUndertakerType []int `json:"cooperationContractUndertakerType"` //共创合约承接对象,1员工,2共创用户,3公开 23 CooperationContractUndertakerType []int `json:"cooperationContractUndertakerType"` //共创合约承接对象,1员工,2共创用户,3公开
24 CooperationContractDescription string `json:"cooperationContractDescription"` //合约描述 24 CooperationContractDescription string `json:"cooperationContractDescription"` //合约描述
25 AuthFlag bool `json:"authFlag"` 25 AuthFlag bool `json:"authFlag"`
  26 + UpChainID int `json:"upChainId"`
  27 + BlockHash string `json:"blockChainId"`
26 } 28 }
27 29
28 func ToCooperationContractItem(param *allied_creation_cooperation.CooperationContract, operatorOrgId int64) *CooperationContractItem { 30 func ToCooperationContractItem(param *allied_creation_cooperation.CooperationContract, operatorOrgId int64) *CooperationContractItem {
1 package service 1 package service
2 2
3 import ( 3 import (
  4 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/constant"
  5 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
  6 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/broker"
  7 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_user"
4 "strconv" 8 "strconv"
5 "time" 9 "time"
6 10
@@ -78,6 +82,16 @@ func (cooperationContractService *CooperationContractService) CreateCooperationC @@ -78,6 +82,16 @@ func (cooperationContractService *CooperationContractService) CreateCooperationC
78 if err != nil { 82 if err != nil {
79 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 83 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
80 } 84 }
  85 +
  86 + if err = broker.Push(constant.TOPIC_UP_BLOCK_CHAIN, broker.NewPushObject(
  87 + domain.BlockChainSourceCooperationContract,
  88 + strconv.Itoa(result.CooperationContractId),
  89 + strconv.Itoa(result.CooperationContractId),
  90 + dto.ToCooperationContractInfo(&result.CooperationContract, 0),
  91 + )); err != nil {
  92 + return nil, application.ThrowError(application.TRANSACTION_ERROR, "消息服务异常"+err.Error())
  93 + }
  94 +
81 return dto.ToCooperationContractInfo(&result.CooperationContract, createCooperationContractCommand.Operator.OrgId), err 95 return dto.ToCooperationContractInfo(&result.CooperationContract, createCooperationContractCommand.Operator.OrgId), err
82 96
83 } 97 }
@@ -124,9 +138,31 @@ func (cooperationContractService *CooperationContractService) ListCooperationCon @@ -124,9 +138,31 @@ func (cooperationContractService *CooperationContractService) ListCooperationCon
124 if err != nil { 138 if err != nil {
125 return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 139 return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
126 } 140 }
  141 +
  142 + var primaryIdList = make([]string, 0)
  143 + for i := range result.Grid.List {
  144 + item := result.Grid.List[i].CooperationContractId
  145 + primaryIdList = append(primaryIdList, strconv.Itoa(item))
  146 + }
  147 + creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
  148 + listCooperationContractQuery.Operator)
  149 + resp, err := creationUserGateway.ListBlockChains(allied_creation_user.ReqListBlockChain{
  150 + DisableLimit: true,
  151 + EnableDistinctPrimaryID: true,
  152 + PrimaryIDList: primaryIdList,
  153 + Source: domain.BlockChainSourceCooperationProject,
  154 + })
  155 + if err != nil {
  156 + return 0, nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
  157 + }
  158 + mapChainItems := resp.ToMap()
127 data := []dto.CooperationContractItem{} 159 data := []dto.CooperationContractItem{}
128 for i := range result.Grid.List { 160 for i := range result.Grid.List {
129 item := dto.ToCooperationContractItem(&result.Grid.List[i], listCooperationContractQuery.Operator.OrgId) 161 item := dto.ToCooperationContractItem(&result.Grid.List[i], listCooperationContractQuery.Operator.OrgId)
  162 + if v, ok := mapChainItems[strconv.Itoa(item.CooperationContractId)]; ok {
  163 + item.UpChainID = v.UpChainID
  164 + item.BlockHash = v.BlockHash
  165 + }
130 data = append(data, *item) 166 data = append(data, *item)
131 } 167 }
132 168
@@ -201,6 +237,16 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC @@ -201,6 +237,16 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC
201 if err != nil { 237 if err != nil {
202 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 238 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
203 } 239 }
  240 +
  241 + if err = broker.Push(constant.TOPIC_UP_BLOCK_CHAIN, broker.NewPushObject(
  242 + domain.BlockChainSourceCooperationContract,
  243 + strconv.Itoa(result.CooperationContractId),
  244 + strconv.Itoa(result.CooperationContractId),
  245 + dto.ToCooperationContractInfo(&result.CooperationContract, 0),
  246 + )); err != nil {
  247 + return nil, application.ThrowError(application.TRANSACTION_ERROR, "消息服务异常"+err.Error())
  248 + }
  249 +
204 return dto.ToCooperationContractInfo(&result.CooperationContract, updateCooperationContractCommand.Operator.OrgId), nil 250 return dto.ToCooperationContractInfo(&result.CooperationContract, updateCooperationContractCommand.Operator.OrgId), nil
205 } 251 }
206 252
1 package service 1 package service
2 2
3 import ( 3 import (
4 - "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/constant"  
5 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain" 4 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
6 - "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/broker"  
7 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_user" 5 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_user"
8 "strconv" 6 "strconv"
9 7
@@ -44,14 +42,14 @@ func (cooperationProjectService *CooperationProjectService) CreateCooperationPro @@ -44,14 +42,14 @@ func (cooperationProjectService *CooperationProjectService) CreateCooperationPro
44 CooperationProjectId: result.CooperationProjectId, 42 CooperationProjectId: result.CooperationProjectId,
45 CreateCooperationProjectCommand: *createCooperationProjectCommand, 43 CreateCooperationProjectCommand: *createCooperationProjectCommand,
46 } 44 }
47 - if err = broker.Push(constant.TOPIC_UP_BLOCK_CHAIN, broker.NewPushObject(  
48 - domain.BlockChainSourceCooperationProject,  
49 - strconv.Itoa(result.CooperationProject.CooperationProjectId),  
50 - strconv.Itoa(result.CooperationProject.CooperationProjectId),  
51 - result,  
52 - )); err != nil {  
53 - return nil, application.ThrowError(application.TRANSACTION_ERROR, "消息服务异常"+err.Error())  
54 - } 45 + //if err = broker.Push(constant.TOPIC_UP_BLOCK_CHAIN, broker.NewPushObject(
  46 + // domain.BlockChainSourceCooperationProject,
  47 + // strconv.Itoa(result.CooperationProject.CooperationProjectId),
  48 + // strconv.Itoa(result.CooperationProject.CooperationProjectId),
  49 + // result,
  50 + //)); err != nil {
  51 + // return nil, application.ThrowError(application.TRANSACTION_ERROR, "消息服务异常"+err.Error())
  52 + //}
55 return data, nil 53 return data, nil
56 } 54 }
57 55
@@ -146,6 +144,7 @@ func (cooperationProjectService *CooperationProjectService) ListCooperationProje @@ -146,6 +144,7 @@ func (cooperationProjectService *CooperationProjectService) ListCooperationProje
146 EnableDistinctPrimaryID: true, 144 EnableDistinctPrimaryID: true,
147 PrimaryIDList: primaryIdList, 145 PrimaryIDList: primaryIdList,
148 Source: domain.BlockChainSourceCooperationProject, 146 Source: domain.BlockChainSourceCooperationProject,
  147 + Disable: true,
149 }) 148 })
150 if err != nil { 149 if err != nil {
151 return 0, nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) 150 return 0, nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
@@ -159,7 +158,7 @@ func (cooperationProjectService *CooperationProjectService) ListCooperationProje @@ -159,7 +158,7 @@ func (cooperationProjectService *CooperationProjectService) ListCooperationProje
159 func (cooperationProjectService *CooperationProjectService) UpdateCooperationProject(updateCooperationProjectCommand *command.UpdateCooperationProjectCommand) (interface{}, error) { 158 func (cooperationProjectService *CooperationProjectService) UpdateCooperationProject(updateCooperationProjectCommand *command.UpdateCooperationProjectCommand) (interface{}, error) {
160 159
161 creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(updateCooperationProjectCommand.Operator) 160 creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(updateCooperationProjectCommand.Operator)
162 - result, err := creationCooperationGateway.CooperationProjectUpdate(allied_creation_cooperation.ReqCooperationProjectUpdate{ 161 + _, err := creationCooperationGateway.CooperationProjectUpdate(allied_creation_cooperation.ReqCooperationProjectUpdate{
163 CooperationProjectId: updateCooperationProjectCommand.CooperationProjectId, 162 CooperationProjectId: updateCooperationProjectCommand.CooperationProjectId,
164 CooperationProjectName: updateCooperationProjectCommand.CooperationProjectName, 163 CooperationProjectName: updateCooperationProjectCommand.CooperationProjectName,
165 CooperationModeNumber: updateCooperationProjectCommand.CooperationModeNumber, 164 CooperationModeNumber: updateCooperationProjectCommand.CooperationModeNumber,
@@ -174,14 +173,14 @@ func (cooperationProjectService *CooperationProjectService) UpdateCooperationPro @@ -174,14 +173,14 @@ func (cooperationProjectService *CooperationProjectService) UpdateCooperationPro
174 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 173 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
175 } 174 }
176 175
177 - if err = broker.Push(constant.TOPIC_UP_BLOCK_CHAIN, broker.NewPushObject(  
178 - domain.BlockChainSourceCooperationProject,  
179 - strconv.Itoa(result.CooperationProject.CooperationProjectId),  
180 - strconv.Itoa(result.CooperationProject.CooperationProjectId),  
181 - result,  
182 - )); err != nil {  
183 - return nil, application.ThrowError(application.TRANSACTION_ERROR, "消息服务异常"+err.Error())  
184 - } 176 + //if err = broker.Push(constant.TOPIC_UP_BLOCK_CHAIN, broker.NewPushObject(
  177 + // domain.BlockChainSourceCooperationProject,
  178 + // strconv.Itoa(result.CooperationProject.CooperationProjectId),
  179 + // strconv.Itoa(result.CooperationProject.CooperationProjectId),
  180 + // result,
  181 + //)); err != nil {
  182 + // return nil, application.ThrowError(application.TRANSACTION_ERROR, "消息服务异常"+err.Error())
  183 + //}
185 return updateCooperationProjectCommand, nil 184 return updateCooperationProjectCommand, nil
186 } 185 }
187 186
@@ -76,6 +76,7 @@ const ( @@ -76,6 +76,7 @@ const (
76 ) 76 )
77 77
78 const ( 78 const (
  79 + BlockChainSourceCooperationContract = "allied-creation.cooperation.contract"
79 BlockChainSourceCooperationProject = "allied-creation.cooperation.project" 80 BlockChainSourceCooperationProject = "allied-creation.cooperation.project"
80 BlockChainSourceCooperationDividendsEstimate = "allied-creation.cooperation.dividends-estimate" 81 BlockChainSourceCooperationDividendsEstimate = "allied-creation.cooperation.dividends-estimate"
81 ) 82 )
@@ -9,7 +9,7 @@ import ( @@ -9,7 +9,7 @@ import (
9 ) 9 )
10 10
11 func (gateway HttplibAlliedCreationUser) ListBlockChains(param ReqListBlockChain) (DataListBlockChain, error) { 11 func (gateway HttplibAlliedCreationUser) ListBlockChains(param ReqListBlockChain) (DataListBlockChain, error) {
12 - if !constant.EnableBlockChain { 12 + if !constant.EnableBlockChain || param.Disable {
13 return []DataListBlockChainItem{}, nil 13 return []DataListBlockChainItem{}, nil
14 } 14 }
15 url := gateway.baseUrL + "/block-chains/" 15 url := gateway.baseUrL + "/block-chains/"
@@ -6,6 +6,8 @@ type ( @@ -6,6 +6,8 @@ type (
6 EnableDistinctPrimaryID bool `json:"enableDistinctPrimaryId"` 6 EnableDistinctPrimaryID bool `json:"enableDistinctPrimaryId"`
7 PrimaryIDList []string `json:"primaryIdList"` 7 PrimaryIDList []string `json:"primaryIdList"`
8 Source string `json:"source"` 8 Source string `json:"source"`
  9 + // 禁用标识
  10 + Disable bool `json:"-"`
9 } 11 }
10 DataListBlockChain []DataListBlockChainItem 12 DataListBlockChain []DataListBlockChainItem
11 DataListBlockChainItem struct { 13 DataListBlockChainItem struct {