作者 yangfu
@@ -15,7 +15,8 @@ type CreateCooperationApplicationCommand struct { @@ -15,7 +15,8 @@ type CreateCooperationApplicationCommand struct {
15 // 申请人的id 15 // 申请人的id
16 //ApplicantUid int `json:"userId"` 16 //ApplicantUid int `json:"userId"`
17 // 17 //
18 - CooperationProjectNumber string `json:"cooperationProjectNumber"` 18 + CooperationProjectId int `json:"cooperationProjectId"`
  19 + // CooperationProjectNumber string `json:"cooperationProjectNumber"`
19 // 附件列表 20 // 附件列表
20 Attachment []domain.Attachment `json:"attachment"` 21 Attachment []domain.Attachment `json:"attachment"`
21 } 22 }
@@ -95,11 +95,10 @@ func (srv CooperationApplicationsService) SearchCooperationApplications(applicat @@ -95,11 +95,10 @@ func (srv CooperationApplicationsService) SearchCooperationApplications(applicat
95 func (srv CooperationApplicationsService) CreateCooperationApplications(createApplicationsCommand *command.CreateCooperationApplicationCommand) (interface{}, error) { 95 func (srv CooperationApplicationsService) CreateCooperationApplications(createApplicationsCommand *command.CreateCooperationApplicationCommand) (interface{}, error) {
96 creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation( 96 creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
97 createApplicationsCommand.Operator) 97 createApplicationsCommand.Operator)
98 - result, err := creationCooperationGateway.CooperationApplicationAdd(allied_creation_cooperation.ReqCooperationApplicationAdd{  
99 - ApplicantUid: strconv.Itoa(int(createApplicationsCommand.Operator.UserId)), 98 + result, err := creationCooperationGateway.ApplyForCooperation(allied_creation_cooperation.ReqApplyForCooperation{
100 CooperationApplicationDescription: createApplicationsCommand.CooperationApplicationDescription, 99 CooperationApplicationDescription: createApplicationsCommand.CooperationApplicationDescription,
  100 + CooperationProjectId: createApplicationsCommand.CooperationProjectId,
101 CooperationApplicationAttachment: createApplicationsCommand.Attachment, 101 CooperationApplicationAttachment: createApplicationsCommand.Attachment,
102 - CooperationProjectNumber: createApplicationsCommand.CooperationProjectNumber,  
103 }) 102 })
104 if err != nil { 103 if err != nil {
105 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) 104 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
@@ -51,7 +51,7 @@ type DividendsEstimateMoneyItem struct { @@ -51,7 +51,7 @@ type DividendsEstimateMoneyItem struct {
51 DepartmentName string `json:"departmentName"` 51 DepartmentName string `json:"departmentName"`
52 } `json:"department"` //发起部门 52 } `json:"department"` //发起部门
53 CooperationContractSponsorName string `json:"cooperationContractSponsorName"` 53 CooperationContractSponsorName string `json:"cooperationContractSponsorName"`
54 - StageAndUndertaker struct { 54 + StageAndUndertaker []struct {
55 Stage int `json:"stage"` // 分红阶段 55 Stage int `json:"stage"` // 分红阶段
56 Undertakers []struct { 56 Undertakers []struct {
57 UndertakerId int `json:"undertakerId,string"` // 承接人id 57 UndertakerId int `json:"undertakerId,string"` // 承接人id
@@ -60,7 +60,7 @@ type DividendsEstimateMoneyItem struct { @@ -60,7 +60,7 @@ type DividendsEstimateMoneyItem struct {
60 UserPhone string `json:"userPhone"` // 用户手机号 60 UserPhone string `json:"userPhone"` // 用户手机号
61 } `json:"userInfo"` 61 } `json:"userInfo"`
62 } `json:"undertakers"` // 共创承接人 62 } `json:"undertakers"` // 共创承接人
63 - } 63 + } `json:"stageAndUndertaker"`
64 } 64 }
65 65
66 func ToDividendsEstimateMoneyItem(param *allied_creation_cooperation.DataDividendsEstimateSearchMoney) []DividendsEstimateMoneyItem { 66 func ToDividendsEstimateMoneyItem(param *allied_creation_cooperation.DataDividendsEstimateSearchMoney) []DividendsEstimateMoneyItem {
@@ -412,3 +412,34 @@ func (gateway HttplibAlliedCreationCooperation) CooperationApplicationsOneclickA @@ -412,3 +412,34 @@ func (gateway HttplibAlliedCreationCooperation) CooperationApplicationsOneclickA
412 err = gateway.GetResponseData(result, &data) 412 err = gateway.GetResponseData(result, &data)
413 return &data, err 413 return &data, err
414 } 414 }
  415 +
  416 +// ApplyForCooperation 申请共创项目
  417 +func (gateway HttplibAlliedCreationCooperation) ApplyForCooperation(param ReqApplyForCooperation) (*DataApplyForCooperation, error) {
  418 + url := gateway.baseUrL + "/cooperation-applications/" + strconv.Itoa(param.CooperationProjectId) + "/apply-for-cooperation"
  419 + method := "POST"
  420 + req := gateway.CreateRequest(url, method)
  421 + log.Logger.Debug("向业务模块请求数据:创建共创申请。", map[string]interface{}{
  422 + "api": method + ":" + url,
  423 + "param": param,
  424 + })
  425 + req, err := req.JSONBody(param)
  426 + if err != nil {
  427 + return nil, fmt.Errorf("请求创建共创申请失败:%w", err)
  428 + }
  429 +
  430 + byteResult, err := req.Bytes()
  431 + if err != nil {
  432 + return nil, fmt.Errorf("获取创建共创申请失败:%w", err)
  433 + }
  434 + log.Logger.Debug("获取业务模块请求数据:创建共创申请。", map[string]interface{}{
  435 + "result": string(byteResult),
  436 + })
  437 + var result service_gateway.GatewayResponse
  438 + err = json.Unmarshal(byteResult, &result)
  439 + if err != nil {
  440 + return nil, fmt.Errorf("解析创建共创申请:%w", err)
  441 + }
  442 + var data DataApplyForCooperation
  443 + err = gateway.GetResponseData(result, &data)
  444 + return &data, err
  445 +}
@@ -233,3 +233,20 @@ type ( @@ -233,3 +233,20 @@ type (
233 DataCooperationApplicationOneclickApproval struct { 233 DataCooperationApplicationOneclickApproval struct {
234 } 234 }
235 ) 235 )
  236 +
  237 +//申请共创项目
  238 +type (
  239 + ReqApplyForCooperation struct {
  240 + // 共创申请人uid
  241 + // ApplicantUid string `json:"-" `
  242 + // 共创申请描述
  243 + CooperationApplicationDescription string ` json:"cooperationApplicationDescription"`
  244 + // 共创申请描述附件
  245 + CooperationApplicationAttachment []domain.Attachment `json:"cooperationApplicationAttachment"`
  246 + // 关联的共创项目id
  247 + CooperationProjectId int `json:"cooperationProjectId"`
  248 + }
  249 + DataApplyForCooperation struct {
  250 + CooperationApplicationId int `json:"cooperationApplicationId,string"`
  251 + }
  252 +)
@@ -17,7 +17,7 @@ type CooperationContract struct { @@ -17,7 +17,7 @@ type CooperationContract struct {
17 DepartmentId int `json:"departmentId,string"` 17 DepartmentId int `json:"departmentId,string"`
18 DepartmentName string `json:"departmentName"` 18 DepartmentName string `json:"departmentName"`
19 DepartmentNumber string `json:"departmentNumber"` 19 DepartmentNumber string `json:"departmentNumber"`
20 - } `jsopn:"department" json:"department"` //发起部门 20 + } `jsopn:"department"` //发起部门
21 CooperationContractSponsor struct { 21 CooperationContractSponsor struct {
22 UserId int `json:"userId,string"` //id 22 UserId int `json:"userId,string"` //id
23 UserInfo struct { 23 UserInfo struct {
@@ -233,6 +233,7 @@ type ( @@ -233,6 +233,7 @@ type (
233 } `json:"operator"` 233 } `json:"operator"`
234 //OperateTime time.Time `json:"operateTime"` 234 //OperateTime time.Time `json:"operateTime"`
235 Status int `json:"status"` 235 Status int `json:"status"`
  236 + ApplicantCount int `json:"applicantCount"` // 共创申请人计数
236 } 237 }
237 DataCooperationProjectSearch struct { 238 DataCooperationProjectSearch struct {
238 List []DataCooperationProjectSearchItem `json:"list"` 239 List []DataCooperationProjectSearchItem `json:"list"`
@@ -18,7 +18,7 @@ type ( @@ -18,7 +18,7 @@ type (
18 OrderGoodId int `json:"orderGoodId,string"` 18 OrderGoodId int `json:"orderGoodId,string"`
19 // 共创合约编号 19 // 共创合约编号
20 CooperationContractNumber string `json:"cooperationContractNumber"` 20 CooperationContractNumber string `json:"cooperationContractNumber"`
21 - // 分红订单号或退货单号 21 + // 分红订单号或退货单号
22 OrderNumber string `json:"orderNumber"` 22 OrderNumber string `json:"orderNumber"`
23 // 来源单号 23 // 来源单号
24 OriginalOrderNum string `json:"originalOrderNum"` 24 OriginalOrderNum string `json:"originalOrderNum"`
@@ -26,12 +26,13 @@ type ( @@ -26,12 +26,13 @@ type (
26 CustomerName string `json:"customerName"` 26 CustomerName string `json:"customerName"`
27 // 订单区域 27 // 订单区域
28 RegionName string `json:"region"` 28 RegionName string `json:"region"`
29 - //货品名称 29 + // 货品名称
30 OrderGoodName string `json:"orderGoodName"` 30 OrderGoodName string `json:"orderGoodName"`
31 // 订单金额 31 // 订单金额
32 OrderAmount float64 `json:"orderAmount"` 32 OrderAmount float64 `json:"orderAmount"`
33 // 订单/退货单日期 33 // 订单/退货单日期
34 OrderDate time.Time `json:"orderDate"` 34 OrderDate time.Time `json:"orderDate"`
  35 + OrgId int `json:"orgId"`
35 } `json:"list"` 36 } `json:"list"`
36 } 37 }
37 ) 38 )
@@ -121,7 +122,7 @@ type ( @@ -121,7 +122,7 @@ type (
121 } `json:"department"` //发起部门 122 } `json:"department"` //发起部门
122 // 共创合约发起人 123 // 共创合约发起人
123 CooperationContractSponsorName string `json:"cooperationContractSponsor"` 124 CooperationContractSponsorName string `json:"cooperationContractSponsor"`
124 - StageAndUndertaker struct { 125 + StageAndUndertaker []struct {
125 Stage int `json:"stage"` // 分红阶段 126 Stage int `json:"stage"` // 分红阶段
126 Undertakers []struct { 127 Undertakers []struct {
127 UndertakerId int `json:"undertakerId,string"` // 承接人id 128 UndertakerId int `json:"undertakerId,string"` // 承接人id
@@ -2,10 +2,9 @@ package allied_creation_cooperation @@ -2,10 +2,9 @@ package allied_creation_cooperation
2 2
3 import "time" 3 import "time"
4 4
5 -//创建分红退货单  
6 type ( 5 type (
7 DividendsReturnedOrderGoods struct { 6 DividendsReturnedOrderGoods struct {
8 - OrderGoodId int64 `json:"orderGoodId,string"` // 订单产品id 7 + OrderGoodId int64 `json:"orderGoodId,string"` //订单产品id
9 CooperationContractNumber string `json:"cooperationContractNumber"` //关联的共创合约编号 8 CooperationContractNumber string `json:"cooperationContractNumber"` //关联的共创合约编号
10 OrderGoodAmount float64 `json:"orderGoodAmount"` //订单产品金额 9 OrderGoodAmount float64 `json:"orderGoodAmount"` //订单产品金额
11 OrderGoodName string `json:"orderGoodName"` //订单产品名称 10 OrderGoodName string `json:"orderGoodName"` //订单产品名称
@@ -57,6 +56,7 @@ type ( @@ -57,6 +56,7 @@ type (
57 OrderGoodPrice float64 `json:"orderGoodPrice"` //订单产品单价 56 OrderGoodPrice float64 `json:"orderGoodPrice"` //订单产品单价
58 OrderGoodQuantity float64 `json:"orderGoodQuantity"` //订单产品数量 57 OrderGoodQuantity float64 `json:"orderGoodQuantity"` //订单产品数量
59 } 58 }
  59 + //创建分红退货单
60 ReqDividendsReturnedOrderAdd struct { 60 ReqDividendsReturnedOrderAdd struct {
61 DividendsReturnedCustomerName string `json:"dividendsReturnedCustomerName"` 61 DividendsReturnedCustomerName string `json:"dividendsReturnedCustomerName"`
62 DividendsOrderNumber string `json:"dividendsOrderNumber"` //分红单号 62 DividendsOrderNumber string `json:"dividendsOrderNumber"` //分红单号