作者 tangxuhui

数据结构适配改造

{"D:\\workspaceGo\\src\\allied-creation-gateway\\pkg\\port\\beego\\routers":1628060696735619100}
\ No newline at end of file
{"D:\\workspaceGo\\src\\allied-creation-gateway\\pkg\\port\\beego\\routers":1628574006679578700}
\ No newline at end of file
... ...
... ... @@ -75,29 +75,12 @@ func ToCooperationProjectInfo(param *allied_creation_cooperation.CooperationProj
type CooperationApplicationItem struct {
CooperationApplicationApplicant struct {
Company struct {
CompanyID int `json:"companyId"`
CompanyLogo string `json:"companyLogo"`
CompanyName string `json:"companyName"`
} `json:"company"`
Department struct {
DepartmentID int `json:"departmentId"`
DepartmentName string `json:"departmentName"`
DepartmentNumber string `json:"departmentNumber"`
} `json:"department"`
Org struct {
OrgID int `json:"orgId"`
OrgName string `json:"orgName"`
} `json:"org"`
Company domain.CompanyData `json:"company"`
Department domain.Department `json:"department"`
Org domain.Org `json:"org"`
UserBaseID int `json:"userBaseId"`
UserID int `json:"userId"`
UserInfo struct {
UserAccount string `json:"userAccount"`
UserAvatar string `json:"userAvatar"`
UserEmail string `json:"userEmail"`
UserName string `json:"userName"`
UserPhone string `json:"userPhone"`
} `json:"userInfo"`
UserInfo domain.UserInfo `json:"userInfo"`
UserType int `json:"userType"`
} `json:"cooperationApplicationApplicant"` //申请人
CooperationApplicationDescription string `json:"cooperationApplicationDescription"` //描述
... ... @@ -109,12 +92,24 @@ type CooperationApplicationItem struct {
func ToCooperationApplicationItem(param *allied_creation_cooperation.CooperationApplication) *CooperationApplicationItem {
data := CooperationApplicationItem{
CooperationApplicationApplicant: param.CooperationApplicationApplicant,
CooperationApplicationDescription: param.CooperationApplicationDescription,
CooperationApplicationID: param.CooperationApplicationID,
CooperationApplicationStatus: param.CooperationApplicationStatus,
CooperationApplyTime: int(param.CooperationApplyTime.Unix()),
CooperationApplicationAttachment: param.CooperationApplicationAttachment,
}
data.CooperationApplicationApplicant.Company.CompanyID = param.CooperationApplicationApplicant.Company.CompanyID
// data.CooperationApplicationApplicant.Company.CompanyLogo = param.CooperationApplicationApplicant.Company.CompanyLogo
data.CooperationApplicationApplicant.Company.CompanyName = param.CooperationApplicationApplicant.Company.CompanyName
data.CooperationApplicationApplicant.Department.DepartmentId = param.CooperationApplicationApplicant.Department.DepartmentID
data.CooperationApplicationApplicant.Department.DepartmentName = param.CooperationApplicationApplicant.Department.DepartmentName
data.CooperationApplicationApplicant.Department.DepartmentNumber = param.CooperationApplicationApplicant.Department.DepartmentNumber
data.CooperationApplicationApplicant.Org.OrgID = param.CooperationApplicationApplicant.Org.OrgID
data.CooperationApplicationApplicant.Org.OrgName = param.CooperationApplicationApplicant.Org.OrgName
data.CooperationApplicationApplicant.UserID = param.CooperationApplicationApplicant.UserID
data.CooperationApplicationApplicant.UserType = param.CooperationApplicationApplicant.UserType
data.CooperationApplicationApplicant.UserInfo.Phone = param.CooperationApplicationApplicant.UserInfo.UserPhone
data.CooperationApplicationApplicant.UserInfo.UsersName = param.CooperationApplicationApplicant.UserInfo.UserName
data.CooperationApplicationApplicant.UserInfo.UsersId = param.CooperationApplicationApplicant.UserID
return &data
}
... ...
package service
import (
"strconv"
"time"
"github.com/linmadan/egglib-go/core/application"
... ... @@ -80,16 +79,15 @@ func (dividendsOrderService *DividendsOrderService) RemoveDividendsOrder(removeD
if err := removeDividendsOrderCommand.ValidateCommand(); err != nil {
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
}
dividendsOrderId := []int{}
for _, v := range removeDividendsOrderCommand.DividendsOrderId {
id, _ := strconv.Atoi(v)
dividendsOrderId = append(dividendsOrderId, id)
}
creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(removeDividendsOrderCommand.Operator)
creationCooperationGateway.DividendsOrderRemove(allied_creation_cooperation.ReqDividendsOrderRemove{
DividendsOrderId: 0, ///TODO 改换为批量删除
_, err := creationCooperationGateway.DividendsOrderBatchRemove(allied_creation_cooperation.ReqDividendsOrderBatchRemove{
DividendsOrderIds: removeDividendsOrderCommand.DividendsOrderId,
})
return nil, nil
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
return removeDividendsOrderCommand, nil
}
// 查询分红订单方法
... ...
... ... @@ -9,7 +9,7 @@ const SERVICE_NAME = "allied-creation-gateway"
var LOG_LEVEL = "debug"
var HTTP_PORT int = 8081
var HTTP_PORT int = 8083
//天联共创基础模块
var ALLIED_CREATION_BASIC_HOST = "http://localhost:8080"
... ...
package domain
//组织
type Org struct {
OrgID int `json:"orgId"`
OrgName string `json:"orgName"`
}
... ...
... ... @@ -5,4 +5,5 @@ type UserInfo struct {
UsersName string `json:"usersName"`
Phone string `json:"phone"`
UsersId int `json:"userId,string"`
UserCode string `json:"userCode"`
}
... ...
... ... @@ -226,3 +226,34 @@ func (gateway HttplibAlliedCreationCooperation) DividendsOrderGet(param ReqDivid
err = gateway.GetResponseData(result, &data)
return &data, err
}
// DividendsOrderBatchRemove 批量移除分红订单
func (gateway HttplibAlliedCreationCooperation) DividendsOrderBatchRemove(param ReqDividendsOrderBatchRemove) (*DataDividendsOrderBatchRemove, error) {
url := gateway.baseUrL + "/dividends-orders/batch-remove"
method := "DELETE"
req := gateway.CreateRequest(url, method)
log.Logger.Debug("向业务模块请求数据:移除分红订单。", map[string]interface{}{
"api": method + ":" + url,
"param": param,
})
req, err := req.JSONBody(param)
if err != nil {
return nil, fmt.Errorf("请求移除分红订单失败:%w", err)
}
byteResult, err := req.Bytes()
if err != nil {
return nil, fmt.Errorf("获取移除分红订单失败:%w", err)
}
log.Logger.Debug("获取业务模块请求数据:移除分红订单。", map[string]interface{}{
"result": string(byteResult),
})
var result service_gateway.GatewayResponse
err = json.Unmarshal(byteResult, &result)
if err != nil {
return nil, fmt.Errorf("解析移除分红订单:%w", err)
}
var data DataDividendsOrderBatchRemove
err = gateway.GetResponseData(result, &data)
return &data, err
}
... ...
... ... @@ -162,3 +162,13 @@ type (
DividendsOrder
}
)
//移除分红订单
type (
ReqDividendsOrderBatchRemove struct {
DividendsOrderIds []string `json:"dividendsOrderIds"`
}
DataDividendsOrderBatchRemove struct {
}
)
... ...