作者 陈志颖

feat:分红订单和分红退货单应用服务开发

正在显示 40 个修改的文件 包含 422 行增加267 行删除
@@ -2,67 +2,31 @@ package command @@ -2,67 +2,31 @@ package command
2 2
3 import ( 3 import (
4 "fmt" 4 "fmt"
  5 + "github.com/beego/beego/v2/core/validation"
5 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain" 6 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain"
6 "reflect" 7 "reflect"
7 "strings" 8 "strings"
8 - "time"  
9 -  
10 - "github.com/beego/beego/v2/core/validation"  
11 ) 9 )
12 10
13 type ApplyForCooperationCommand struct { 11 type ApplyForCooperationCommand struct {
14 // 共创申请描述附件 12 // 共创申请描述附件
15 CooperationApplicationAttachment []*domain.Attachment `cname:"共创申请描述附件" json:"cooperationApplicationAttachment" valid:"Required"` 13 CooperationApplicationAttachment []*domain.Attachment `cname:"共创申请描述附件" json:"cooperationApplicationAttachment" valid:"Required"`
16 // 共创申请描述 14 // 共创申请描述
17 - CooperationApplicationDescription string `cname:"共创申请描述" json:"cooperationApplicationDescription" valid:"Required"` 15 + CooperationApplicationDescription string `cname:"共创申请描述" json:"cooperationApplicationDescription,omitempty"`
18 // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员 16 // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员
19 - UserId int64 `cname:"用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员" json:"userId,string" valid:"Required"` 17 + UserId int64 `cname:"用户ID" json:"userId,string" valid:"Required"`
20 // 用户基本id 18 // 用户基本id
21 - UserBaseId int64 `cname:"用户基本id" json:"userBaseId,string" valid:"Required"` 19 + UserBaseId int64 `cname:"用户基本数据ID" json:"userBaseId,string" valid:"Required"`
22 // 组织机构ID 20 // 组织机构ID
23 OrgId int64 `cname:"组织机构ID" json:"orgId,string" valid:"Required"` 21 OrgId int64 `cname:"组织机构ID" json:"orgId,string" valid:"Required"`
24 - // 组织名称  
25 - OrgName string `cname:"组织名称" json:"orgName" valid:"Required"`  
26 // 公司ID,通过集成REST上下文获取 22 // 公司ID,通过集成REST上下文获取
27 - CompanyId int64 `cname:"公司ID,通过集成REST上下文获取" json:"companyId,string" valid:"Required"`  
28 - // 公司logo  
29 - CompanyLogo string `cname:"公司logo" json:"companyLogo" valid:"Required"`  
30 - // 公司名称  
31 - CompanyName string `cname:"公司名称" json:"companyName" valid:"Required"`  
32 - // 用户关联的组织机构  
33 - Orgs []*domain.Org `cname:"用户关联的组织机构" json:"orgs" valid:"Required"` 23 + CompanyId int64 `cname:"公司ID" json:"companyId,string" valid:"Required"`
34 // 部门ID,通过REST集成上下文获取 24 // 部门ID,通过REST集成上下文获取
35 - DepartmentId int64 `cname:"部门ID,通过REST集成上下文获取" json:"departmentId,string" valid:"Required"`  
36 - // 部门名称  
37 - DepartmentName string `cname:"部门名称" json:"departmentName" valid:"Required"`  
38 - // 部门编码  
39 - DepartmentNumber string `cname:"部门编码" json:"departmentNumber" valid:"Required"`  
40 - // 是否组织机构标识,1为是,2为否,默认为否  
41 - IsOrganization bool `cname:"是否组织机构标识,1为是,2为否,默认为否" json:"isOrganization" valid:"Required"`  
42 - // 角色ID  
43 - RoleId int64 `cname:"角色ID" json:"roleId,string" valid:"Required"`  
44 - // 角色名称  
45 - RoleName string `cname:"角色名称" json:"roleName" valid:"Required"`  
46 - // 用户头像  
47 - UserAvatar string `cname:"用户头像" json:"userAvatar" valid:"Required"`  
48 - // 用户邮箱  
49 - UserEmail string `cname:"用户邮箱" json:"userEmail" valid:"Required"`  
50 - // 共创人员姓名  
51 - UserName string `cname:"共创人员姓名" json:"userName" valid:"Required"`  
52 - // 用户手机号  
53 - UserPhone string `cname:"用户手机号" json:"userPhone" valid:"Required"`  
54 - // 用户账号,区别于手机号,冗余字段  
55 - UserAccount string `cname:"用户账号,区别于手机号,冗余字段" json:"userAccount" valid:"Required"`  
56 - // 用户类型  
57 - UserType int32 `cname:"用户类型" json:"userType" valid:"Required"`  
58 - // 状态  
59 - Status int32 `cname:"状态" json:"status" valid:"Required"` 25 + DepartmentId int64 `cname:"部门ID" json:"departmentId,string" valid:"Required"`
60 // 共创申请ID 26 // 共创申请ID
61 - CooperationApplicationId int64 `cname:"共创申请ID" json:"cooperationApplicationId,string" valid:"Required"` 27 + CooperationApplicationId string `cname:"共创申请ID" json:"cooperationApplicationId,string" valid:"Required"`
62 // 共创项目编号,自生成,生成规则:XM+6位年月日+#+3位流水,例XM210601#001 28 // 共创项目编号,自生成,生成规则:XM+6位年月日+#+3位流水,例XM210601#001
63 - CooperationProjectNumber string `cname:"共创项目编号,自生成,生成规则:XM+6位年月日+#+3位流水,例XM210601#001" json:"cooperationProjectNumber" valid:"Required"`  
64 - // 共创申请时间  
65 - CooperationApplyTime time.Time `cname:"共创申请时间" json:"cooperationApplyTime" valid:"Required"` 29 + CooperationProjectNumber string `cname:"共创项目编号" json:"cooperationProjectNumber" valid:"Required"`
66 } 30 }
67 31
68 func (applyForCooperationCommand *ApplyForCooperationCommand) Valid(validation *validation.Validation) { 32 func (applyForCooperationCommand *ApplyForCooperationCommand) Valid(validation *validation.Validation) {
@@ -8,35 +8,37 @@ import ( @@ -8,35 +8,37 @@ import (
8 "github.com/beego/beego/v2/core/validation" 8 "github.com/beego/beego/v2/core/validation"
9 ) 9 )
10 10
11 -type AgreeCooperationApplicationCommand struct { 11 +type ApprovalCooperationApplicationCommand struct {
12 // 共创申请ID 12 // 共创申请ID
13 CooperationApplicationId int64 `cname:"共创申请ID" json:"cooperationApplicationId,string" valid:"Required"` 13 CooperationApplicationId int64 `cname:"共创申请ID" json:"cooperationApplicationId,string" valid:"Required"`
14 // 共创申请审核描述 14 // 共创申请审核描述
15 - CooperationApplicationVerifyDescription string `cname:"共创申请审核描述" json:"cooperationApplicationVerifyDescription" valid:"Required"` 15 + CooperationApplicationVerifyDescription string `cname:"共创申请审核描述" json:"cooperationApplicationVerifyDescription,omitempty"`
16 // 公司ID,通过集成REST上下文获取 16 // 公司ID,通过集成REST上下文获取
17 - CompanyId int64 `cname:"公司ID,通过集成REST上下文获取" json:"companyId,string" valid:"Required"` 17 + CompanyId int64 `cname:"公司ID" json:"companyId,string" valid:"Required"`
18 // 组织机构id 18 // 组织机构id
19 - OrgId int64 `cname:"组织机构id" json:"orgId,string" valid:"Required"` 19 + OrgId int64 `cname:"组织机构ID" json:"orgId,string" valid:"Required"`
20 // 菜单编码,APP端必须 20 // 菜单编码,APP端必须
21 - Code string `cname:"菜单编码,APP端必须" json:"code" valid:"Required"` 21 + Code string `cname:"菜单编码" json:"code" valid:"Required"`
22 // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员 22 // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员
23 - UserId int64 `cname:"用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员" json:"userId,string" valid:"Required"` 23 + UserId int64 `cname:"用户ID" json:"userId,string" valid:"Required"`
24 // 用户基础数据id 24 // 用户基础数据id
25 - UserBaseId int64 `cname:"用户基础数据is" json:"userBaseId,string" valid:"Required"` 25 + UserBaseId int64 `cname:"用户基础数据ID" json:"userBaseId,string" valid:"Required"`
  26 + // 审核动作,1同意,2拒绝
  27 + Action int32 `cname:"审核动作" json:"action" valid:"Required"`
26 } 28 }
27 29
28 -func (agreeCooperationApplicationCommand *AgreeCooperationApplicationCommand) Valid(validation *validation.Validation) { 30 +func (approvalCooperationApplicationCommand *ApprovalCooperationApplicationCommand) Valid(validation *validation.Validation) {
29 //validation.SetError("CustomValid", "未实现的自定义认证") 31 //validation.SetError("CustomValid", "未实现的自定义认证")
30 } 32 }
31 33
32 -func (agreeCooperationApplicationCommand *AgreeCooperationApplicationCommand) ValidateCommand() error { 34 +func (approvalCooperationApplicationCommand *ApprovalCooperationApplicationCommand) ValidateCommand() error {
33 valid := validation.Validation{} 35 valid := validation.Validation{}
34 - b, err := valid.Valid(agreeCooperationApplicationCommand) 36 + b, err := valid.Valid(approvalCooperationApplicationCommand)
35 if err != nil { 37 if err != nil {
36 return err 38 return err
37 } 39 }
38 if !b { 40 if !b {
39 - elem := reflect.TypeOf(agreeCooperationApplicationCommand).Elem() 41 + elem := reflect.TypeOf(approvalCooperationApplicationCommand).Elem()
40 for _, validErr := range valid.Errors { 42 for _, validErr := range valid.Errors {
41 field, isExist := elem.FieldByName(validErr.Field) 43 field, isExist := elem.FieldByName(validErr.Field)
42 if isExist { 44 if isExist {
@@ -11,19 +11,19 @@ type BatchApprovalCooperationApplicationCommand struct { @@ -11,19 +11,19 @@ type BatchApprovalCooperationApplicationCommand struct {
11 // 共创申请ID数组 11 // 共创申请ID数组
12 CooperationApplicationIds []string `cname:"共创申请ID" json:"cooperationApplicationIds" valid:"Required"` 12 CooperationApplicationIds []string `cname:"共创申请ID" json:"cooperationApplicationIds" valid:"Required"`
13 // 共创申请审核描述 13 // 共创申请审核描述
14 - CooperationApplicationVerifyDescription string `cname:"共创申请审核描述" json:"cooperationApplicationVerifyDescription" valid:"Required"` 14 + CooperationApplicationVerifyDescription string `cname:"共创申请审核描述" json:"cooperationApplicationVerifyDescription,omitempty"`
15 // 公司ID,通过集成REST上下文获取 15 // 公司ID,通过集成REST上下文获取
16 - CompanyId int64 `cname:"公司ID,通过集成REST上下文获取" json:"companyId,string" valid:"Required"` 16 + CompanyId int64 `cname:"公司ID" json:"companyId,string" valid:"Required"`
17 // 组织机构id 17 // 组织机构id
18 - OrgId int64 `cname:"组织机构id" json:"orgId,string" valid:"Required"` 18 + OrgId int64 `cname:"组织机构ID" json:"orgId,string" valid:"Required"`
19 // 菜单编码,APP端必须 19 // 菜单编码,APP端必须
20 - Code string `cname:"菜单编码,APP端必须" json:"code" valid:"Required"` 20 + Code string `cname:"菜单编码" json:"code" valid:"Required"`
21 // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员 21 // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员
22 - UserId int64 `cname:"用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员" json:"userId,string" valid:"Required"` 22 + UserId int64 `cname:"用户ID" json:"userId,string" valid:"Required"`
23 // 用户基础数据id 23 // 用户基础数据id
24 - UserBaseId int64 `cname:"用户基础数据is" json:"userBaseId,string" valid:"Required"` 24 + UserBaseId int64 `cname:"用户基础数据ID" json:"userBaseId,string" valid:"Required"`
25 // 审核动作,1同意,2拒绝 25 // 审核动作,1同意,2拒绝
26 - Action int32 `cname:"审核动作,1同意,2拒绝" json:"action" valid:"Required"` 26 + Action int32 `cname:"审核动作" json:"action" valid:"Required"`
27 } 27 }
28 28
29 func (batchApprovalCooperationApplicationCommand *BatchApprovalCooperationApplicationCommand) Valid(validation *validation.Validation) { 29 func (batchApprovalCooperationApplicationCommand *BatchApprovalCooperationApplicationCommand) Valid(validation *validation.Validation) {
@@ -19,13 +19,13 @@ type CreateCooperationApplicationCommand struct { @@ -19,13 +19,13 @@ type CreateCooperationApplicationCommand struct {
19 // 关联的共创项目编号 19 // 关联的共创项目编号
20 CooperationProjectNumber string `cname:"关联的共创项目编号" json:"cooperationProjectNumber" valid:"Required"` 20 CooperationProjectNumber string `cname:"关联的共创项目编号" json:"cooperationProjectNumber" valid:"Required"`
21 // 公司ID,通过集成REST上下文获取 21 // 公司ID,通过集成REST上下文获取
22 - CompanyId int64 `cname:"公司ID,通过集成REST上下文获取" json:"companyId,string" valid:"Required"` 22 + CompanyId int64 `cname:"公司ID" json:"companyId,string" valid:"Required"`
23 // 组织机构ID 23 // 组织机构ID
24 OrgId int64 `cname:"组织机构ID" json:"orgId,string" valid:"Required"` 24 OrgId int64 `cname:"组织机构ID" json:"orgId,string" valid:"Required"`
25 // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员 25 // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员
26 - UserId int64 `cname:"用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员" json:"userId,string" valid:"Required"` 26 + UserId int64 `cname:"用户ID" json:"userId,string" valid:"Required"`
27 // 用户基础数据id 27 // 用户基础数据id
28 - UserBaseId int64 `cname:"用户基础数据is" json:"userBaseId,string" valid:"Required"` 28 + UserBaseId int64 `cname:"用户基础数据ID" json:"userBaseId,string" valid:"Required"`
29 } 29 }
30 30
31 func (createCooperationApplicationCommand *CreateCooperationApplicationCommand) Valid(validation *validation.Validation) { 31 func (createCooperationApplicationCommand *CreateCooperationApplicationCommand) Valid(validation *validation.Validation) {
@@ -2,41 +2,40 @@ package command @@ -2,41 +2,40 @@ package command
2 2
3 import ( 3 import (
4 "fmt" 4 "fmt"
  5 + "github.com/beego/beego/v2/core/validation"
5 "reflect" 6 "reflect"
6 "strings" 7 "strings"
7 -  
8 - "github.com/beego/beego/v2/core/validation"  
9 ) 8 )
10 9
11 -type RejectCooperationApplicationCommand struct {  
12 - // 共创申请ID  
13 - CooperationApplicationId int64 `cname:"共创申请ID" json:"cooperationApplicationId,string" valid:"Required"` 10 +type OneClickApprovalCooperationApplicationCommand struct {
14 // 共创申请审核描述 11 // 共创申请审核描述
15 - CooperationApplicationVerifyDescription string `cname:"共创申请审核描述" json:"cooperationApplicationVerifyDescription" valid:"Required"` 12 + CooperationApplicationVerifyDescription string `cname:"共创申请审核描述" json:"cooperationApplicationVerifyDescription,omitempty"`
16 // 公司ID,通过集成REST上下文获取 13 // 公司ID,通过集成REST上下文获取
17 - CompanyId int64 `cname:"公司ID,通过集成REST上下文获取" json:"companyId,string" valid:"Required"` 14 + CompanyId int64 `cname:"公司ID" json:"companyId,string" valid:"Required"`
18 // 组织机构id 15 // 组织机构id
19 - OrgId int64 `cname:"组织机构id" json:"orgId,string" valid:"Required"`  
20 - // 菜单模块编码,APP端必须  
21 - Code string `cname:"菜单模块编码,APP端必须" json:"code" valid:"Required"` 16 + OrgId int64 `cname:"组织机构ID" json:"orgId,string" valid:"Required"`
  17 + // 菜单编码,APP端必须
  18 + Code string `cname:"菜单编码" json:"code" valid:"Required"`
22 // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员 19 // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员
23 - UserId int64 `cname:"用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员" json:"userId,string" valid:"Required"` 20 + UserId int64 `cname:"用户ID" json:"userId,string" valid:"Required"`
24 // 用户基础数据id 21 // 用户基础数据id
25 - UserBaseId int64 `cname:"用户基础数据is" json:"userBaseId,string" valid:"Required"` 22 + UserBaseId int64 `cname:"用户基础数据ID" json:"userBaseId,string" valid:"Required"`
  23 + // 审核动作,1同意,2拒绝
  24 + Action int32 `cname:"审核动作" json:"action" valid:"Required"`
26 } 25 }
27 26
28 -func (rejectCooperationApplicationCommand *RejectCooperationApplicationCommand) Valid(validation *validation.Validation) { 27 +func (oneClickApprovalCooperationApplicationCommand *OneClickApprovalCooperationApplicationCommand) Valid(validation *validation.Validation) {
29 //validation.SetError("CustomValid", "未实现的自定义认证") 28 //validation.SetError("CustomValid", "未实现的自定义认证")
30 } 29 }
31 30
32 -func (rejectCooperationApplicationCommand *RejectCooperationApplicationCommand) ValidateCommand() error { 31 +func (oneClickApprovalCooperationApplicationCommand *OneClickApprovalCooperationApplicationCommand) ValidateCommand() error {
33 valid := validation.Validation{} 32 valid := validation.Validation{}
34 - b, err := valid.Valid(rejectCooperationApplicationCommand) 33 + b, err := valid.Valid(oneClickApprovalCooperationApplicationCommand)
35 if err != nil { 34 if err != nil {
36 return err 35 return err
37 } 36 }
38 if !b { 37 if !b {
39 - elem := reflect.TypeOf(rejectCooperationApplicationCommand).Elem() 38 + elem := reflect.TypeOf(oneClickApprovalCooperationApplicationCommand).Elem()
40 for _, validErr := range valid.Errors { 39 for _, validErr := range valid.Errors {
41 field, isExist := elem.FieldByName(validErr.Field) 40 field, isExist := elem.FieldByName(validErr.Field)
42 if isExist { 41 if isExist {
@@ -12,13 +12,13 @@ type RemoveCooperationApplicationCommand struct { @@ -12,13 +12,13 @@ type RemoveCooperationApplicationCommand struct {
12 // 共创申请ID 12 // 共创申请ID
13 CooperationApplicationId int64 `cname:"共创申请ID" json:"cooperationApplicationId,string" valid:"Required"` 13 CooperationApplicationId int64 `cname:"共创申请ID" json:"cooperationApplicationId,string" valid:"Required"`
14 // 公司ID,通过集成REST上下文获取 14 // 公司ID,通过集成REST上下文获取
15 - CompanyId int64 `cname:"公司ID,通过集成REST上下文获取" json:"companyId,string" valid:"Required"` 15 + CompanyId int64 `cname:"公司ID" json:"companyId,string" valid:"Required"`
16 // 组织机构ID 16 // 组织机构ID
17 OrgId int64 `cname:"组织机构ID" json:"orgId,string" valid:"Required"` 17 OrgId int64 `cname:"组织机构ID" json:"orgId,string" valid:"Required"`
18 // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员 18 // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员
19 - UserId int64 `cname:"用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员" json:"userId,string" valid:"Required"` 19 + UserId int64 `cname:"用户ID" json:"userId,string" valid:"Required"`
20 // 用户基础数据id 20 // 用户基础数据id
21 - UserBaseId int64 `cname:"用户基础数据is" json:"userBaseId,string" valid:"Required"` 21 + UserBaseId int64 `cname:"用户基础数据ID" json:"userBaseId,string" valid:"Required"`
22 } 22 }
23 23
24 func (removeCooperationApplicationCommand *RemoveCooperationApplicationCommand) Valid(validation *validation.Validation) { 24 func (removeCooperationApplicationCommand *RemoveCooperationApplicationCommand) Valid(validation *validation.Validation) {
@@ -11,9 +11,9 @@ import ( @@ -11,9 +11,9 @@ import (
11 11
12 type UpdateCooperationApplicationCommand struct { 12 type UpdateCooperationApplicationCommand struct {
13 // 共创申请id 13 // 共创申请id
14 - CooperationApplicationId string `cname:"共创申请id" json:"cooperationApplicationId" valid:"Required"` 14 + CooperationApplicationId string `cname:"共创申请ID" json:"cooperationApplicationId" valid:"Required"`
15 // 共创申请人uid 15 // 共创申请人uid
16 - ApplicantUid string `cname:"共创申请人uid" json:"applicantUid" valid:"Required"` 16 + ApplicantUid string `cname:"共创申请人UID" json:"applicantUid" valid:"Required"`
17 // 共创申请描述 17 // 共创申请描述
18 CooperationApplicationDescription string `cname:"共创申请描述" json:"cooperationApplicationDescription,omitempty"` 18 CooperationApplicationDescription string `cname:"共创申请描述" json:"cooperationApplicationDescription,omitempty"`
19 // 共创申请描述附件 19 // 共创申请描述附件
@@ -21,13 +21,13 @@ type UpdateCooperationApplicationCommand struct { @@ -21,13 +21,13 @@ type UpdateCooperationApplicationCommand struct {
21 // 关联的共创项目编号 21 // 关联的共创项目编号
22 CooperationProjectNumber string `cname:"关联的共创项目编号" json:"cooperationProjectNumber" valid:"Required"` 22 CooperationProjectNumber string `cname:"关联的共创项目编号" json:"cooperationProjectNumber" valid:"Required"`
23 // 公司ID,通过集成REST上下文获取 23 // 公司ID,通过集成REST上下文获取
24 - CompanyId int64 `cname:"公司ID,通过集成REST上下文获取" json:"companyId,string" valid:"Required"` 24 + CompanyId int64 `cname:"公司ID" json:"companyId,string" valid:"Required"`
25 // 组织机构ID 25 // 组织机构ID
26 OrgId int64 `cname:"组织机构ID" json:"orgId,string" valid:"Required"` 26 OrgId int64 `cname:"组织机构ID" json:"orgId,string" valid:"Required"`
27 // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员 27 // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员
28 - UserId int64 `cname:"用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员" json:"userId,string" valid:"Required"` 28 + UserId int64 `cname:"用户ID" json:"userId,string" valid:"Required"`
29 // 用户基础数据id 29 // 用户基础数据id
30 - UserBaseId int64 `cname:"用户基础数据is" json:"userBaseId,string" valid:"Required"` 30 + UserBaseId int64 `cname:"用户基础数据ID" json:"userBaseId,string" valid:"Required"`
31 } 31 }
32 32
33 func (updateCooperationApplicationCommand *UpdateCooperationApplicationCommand) Valid(validation *validation.Validation) { 33 func (updateCooperationApplicationCommand *UpdateCooperationApplicationCommand) Valid(validation *validation.Validation) {
@@ -12,13 +12,13 @@ type GetCooperationApplicationQuery struct { @@ -12,13 +12,13 @@ type GetCooperationApplicationQuery struct {
12 // 共创申请ID 12 // 共创申请ID
13 CooperationApplicationId int64 `cname:"共创申请ID" json:"cooperationApplicationId,string" valid:"Required"` 13 CooperationApplicationId int64 `cname:"共创申请ID" json:"cooperationApplicationId,string" valid:"Required"`
14 // 公司ID,通过集成REST上下文获取 14 // 公司ID,通过集成REST上下文获取
15 - CompanyId int64 `cname:"公司ID,通过集成REST上下文获取" json:"companyId,string" valid:"Required"` 15 + CompanyId int64 `cname:"公司ID" json:"companyId,string" valid:"Required"`
16 // 组织机构ID 16 // 组织机构ID
17 OrgId int64 `cname:"组织机构ID" json:"orgId,string" valid:"Required"` 17 OrgId int64 `cname:"组织机构ID" json:"orgId,string" valid:"Required"`
18 // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员 18 // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员
19 - UserId int64 `cname:"用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员" json:"userId,string" valid:"Required"` 19 + UserId int64 `cname:"用户ID" json:"userId,string" valid:"Required"`
20 // 用户基础数据id 20 // 用户基础数据id
21 - UserBaseId int64 `cname:"用户基础数据is" json:"userBaseId,string" valid:"Required"` 21 + UserBaseId int64 `cname:"用户基础数据ID" json:"userBaseId,string" valid:"Required"`
22 } 22 }
23 23
24 func (getCooperationApplicationQuery *GetCooperationApplicationQuery) Valid(validation *validation.Validation) { 24 func (getCooperationApplicationQuery *GetCooperationApplicationQuery) Valid(validation *validation.Validation) {
@@ -10,17 +10,17 @@ import ( @@ -10,17 +10,17 @@ import (
10 10
11 type ListCooperationApplicationQuery struct { 11 type ListCooperationApplicationQuery struct {
12 // 页面大小 12 // 页面大小
13 - PageNumber int64 `cname:"页面大小" json:"pageNumber,omitempty"` 13 + PageNumber int64 `cname:"页" json:"pageNumber,omitempty"`
14 // 页面大小 14 // 页面大小
15 PageSize int64 `cname:"页面大小" json:"pageSize,omitempty"` 15 PageSize int64 `cname:"页面大小" json:"pageSize,omitempty"`
16 // 公司ID,通过集成REST上下文获取 16 // 公司ID,通过集成REST上下文获取
17 - CompanyId int64 `cname:"公司ID,通过集成REST上下文获取" json:"companyId,string" valid:"Required"` 17 + CompanyId int64 `cname:"公司ID" json:"companyId,string" valid:"Required"`
18 // 组织机构ID 18 // 组织机构ID
19 OrgId int64 `cname:"组织机构ID" json:"orgId,string" valid:"Required"` 19 OrgId int64 `cname:"组织机构ID" json:"orgId,string" valid:"Required"`
20 // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员 20 // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员
21 - UserId int64 `cname:"用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员" json:"userId,string" valid:"Required"` 21 + UserId int64 `cname:"用户ID" json:"userId,string" valid:"Required"`
22 // 用户基础数据id 22 // 用户基础数据id
23 - UserBaseId int64 `cname:"用户基础数据is" json:"userBaseId,string" valid:"Required"` 23 + UserBaseId int64 `cname:"用户基础数据ID" json:"userBaseId,string" valid:"Required"`
24 } 24 }
25 25
26 func (listCooperationApplicationQuery *ListCooperationApplicationQuery) Valid(validation *validation.Validation) { 26 func (listCooperationApplicationQuery *ListCooperationApplicationQuery) Valid(validation *validation.Validation) {
@@ -16,19 +16,19 @@ type SearchCooperationApplicationQuery struct { @@ -16,19 +16,19 @@ type SearchCooperationApplicationQuery struct {
16 // 申请人姓名 16 // 申请人姓名
17 ApplicantName string `cname:"申请人姓名" json:"applicantName,omitempty"` 17 ApplicantName string `cname:"申请人姓名" json:"applicantName,omitempty"`
18 // 共创申请审核状态,1待审核,2已同意,3已拒绝 18 // 共创申请审核状态,1待审核,2已同意,3已拒绝
19 - CooperationApplicationStatus int32 `cname:"共创申请审核状态,1待审核,2已同意,3已拒绝" json:"cooperationApplicationStatus,omitempty"` 19 + CooperationApplicationStatus int32 `cname:"共创申请审核状态" json:"cooperationApplicationStatus,omitempty"`
20 // 页面大小 20 // 页面大小
21 PageSize int64 `cname:"页面大小" json:"pageSize,omitempty"` 21 PageSize int64 `cname:"页面大小" json:"pageSize,omitempty"`
22 // 页面大小 22 // 页面大小
23 - PageNumber int64 `cname:"页面大小" json:"pageNumber,omitempty"` 23 + PageNumber int64 `cname:"页" json:"pageNumber,omitempty"`
24 // 公司ID,通过集成REST上下文获取 24 // 公司ID,通过集成REST上下文获取
25 - CompanyId int64 `cname:"公司ID,通过集成REST上下文获取" json:"companyId,string" valid:"Required"` 25 + CompanyId int64 `cname:"公司ID" json:"companyId,string" valid:"Required"`
26 // 组织机构ID 26 // 组织机构ID
27 OrgId int64 `cname:"组织机构ID" json:"orgId,string" valid:"Required"` 27 OrgId int64 `cname:"组织机构ID" json:"orgId,string" valid:"Required"`
28 // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员 28 // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员
29 - UserId int64 `cname:"用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员" json:"userId,string" valid:"Required"` 29 + UserId int64 `cname:"用户ID" json:"userId,string" valid:"Required"`
30 // 用户基础数据id 30 // 用户基础数据id
31 - UserBaseId int64 `cname:"用户基础数据is" json:"userBaseId,string" valid:"Required"` 31 + UserBaseId int64 `cname:"用户基础数据ID" json:"userBaseId,string" valid:"Required"`
32 } 32 }
33 33
34 func (searchCooperationApplicationQuery *SearchCooperationApplicationQuery) Valid(validation *validation.Validation) { 34 func (searchCooperationApplicationQuery *SearchCooperationApplicationQuery) Valid(validation *validation.Validation) {
@@ -17,9 +17,9 @@ import ( @@ -17,9 +17,9 @@ import (
17 type CooperationApplicationService struct { 17 type CooperationApplicationService struct {
18 } 18 }
19 19
20 -// AgreeCooperationApplication 审核-同意共创申请  
21 -func (cooperationApplicationService *CooperationApplicationService) AgreeCooperationApplication(agreeCooperationApplicationCommand *command.AgreeCooperationApplicationCommand) (interface{}, error) {  
22 - if err := agreeCooperationApplicationCommand.ValidateCommand(); err != nil { 20 +// ApprovalCooperationApplication 审核共创申请
  21 +func (cooperationApplicationService *CooperationApplicationService) ApprovalCooperationApplication(approvalCooperationApplicationCommand *command.ApprovalCooperationApplicationCommand) (interface{}, error) {
  22 + if err := approvalCooperationApplicationCommand.ValidateCommand(); err != nil {
23 return nil, application.ThrowError(application.ARG_ERROR, err.Error()) 23 return nil, application.ThrowError(application.ARG_ERROR, err.Error())
24 } 24 }
25 transactionContext, err := factory.CreateTransactionContext(nil) 25 transactionContext, err := factory.CreateTransactionContext(nil)
@@ -53,10 +53,106 @@ func (cooperationApplicationService *CooperationApplicationService) ApplyForCoop @@ -53,10 +53,106 @@ func (cooperationApplicationService *CooperationApplicationService) ApplyForCoop
53 defer func() { 53 defer func() {
54 _ = transactionContext.RollbackTransaction() 54 _ = transactionContext.RollbackTransaction()
55 }() 55 }()
56 - if err := transactionContext.CommitTransaction(); err != nil {  
57 - return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 56 + var cooperationProjectRepository domain.CooperationProjectRepository
  57 + if value, err := factory.CreateCooperationProjectRepository(map[string]interface{}{
  58 + "transactionContext": transactionContext,
  59 + }); err != nil {
  60 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  61 + } else {
  62 + cooperationProjectRepository = value
  63 + }
  64 + cooperationProject, err := cooperationProjectRepository.FindOne(map[string]interface{}{"cooperationProjectNumber": applyForCooperationCommand.CooperationProjectNumber})
  65 + if err != nil {
  66 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  67 + }
  68 + if cooperationProject == nil {
  69 + return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", applyForCooperationCommand.CooperationProjectNumber))
  70 + } else {
  71 +
  72 + }
  73 +
  74 + // 用户REST服务初始化
  75 + var userService service.UserService
  76 + if value, err := factory.CreateUserService(map[string]interface{}{}); err != nil {
  77 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  78 + } else {
  79 + userService = value
  80 + }
  81 +
  82 + // 获取申请人
  83 + var applicant *domain.User
  84 + if data, err := userService.UserFrom(applyForCooperationCommand.CompanyId, applyForCooperationCommand.OrgId, applyForCooperationCommand.UserId); err != nil {
  85 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  86 + } else {
  87 + applicant = data
  88 + }
  89 +
  90 + // 公司REST服务初始化
  91 + var companyService service.CompanyService
  92 + if value, err := factory.CreateCompanyService(map[string]interface{}{}); err != nil {
  93 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  94 + } else {
  95 + companyService = value
  96 + }
  97 +
  98 + // 获取公司信息
  99 + var company *domain.Company
  100 + if data, err := companyService.CompanyFrom(applyForCooperationCommand.CompanyId); err != nil {
  101 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  102 + } else {
  103 + company = data
  104 + }
  105 +
  106 + // 组织机构REST服务初始化
  107 + var organizationService service.OrgService
  108 + if value, err := factory.CreateOrganizationService(map[string]interface{}{}); err != nil {
  109 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  110 + } else {
  111 + organizationService = value
  112 + }
  113 +
  114 + // 获取组织机构信息
  115 + var organization *domain.Org
  116 + if data, err := organizationService.OrgFrom(applyForCooperationCommand.CompanyId, applyForCooperationCommand.OrgId); err != nil {
  117 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  118 + } else {
  119 + organization = data
  120 + }
  121 +
  122 + newCooperationApplication := &domain.CooperationApplication{
  123 + CooperationApplicationApplicant: applicant,
  124 + CooperationApplicationAttachment: applyForCooperationCommand.CooperationApplicationAttachment,
  125 + CooperationApplicationDescription: applyForCooperationCommand.CooperationApplicationDescription,
  126 + CooperationApplicationStatus: 1,
  127 + CooperationApplicationVerifier: nil,
  128 + CooperationApplicationVerifyDescription: "",
  129 + CooperationApplicationVerifyTime: time.Time{},
  130 + CooperationApplyTime: time.Now(),
  131 + CooperationProject: cooperationProject,
  132 + Org: organization,
  133 + IsCanceled: false,
  134 + Company: company,
  135 + CreatedAt: time.Now(),
  136 + DeletedAt: time.Time{},
  137 + UpdatedAt: time.Time{},
  138 + }
  139 +
  140 + var cooperationApplicationRepository domain.CooperationApplicationRepository
  141 + if value, err := factory.CreateCooperationApplicationRepository(map[string]interface{}{
  142 + "transactionContext": transactionContext,
  143 + }); err != nil {
  144 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  145 + } else {
  146 + cooperationApplicationRepository = value
  147 + }
  148 + if cooperationApplication, err := cooperationApplicationRepository.Save(newCooperationApplication); err != nil {
  149 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  150 + } else {
  151 + if err := transactionContext.CommitTransaction(); err != nil {
  152 + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  153 + }
  154 + return cooperationApplication, nil
58 } 155 }
59 - return nil, nil  
60 } 156 }
61 157
62 // BatchApprovalCooperationApplication 一键审核共创申请 158 // BatchApprovalCooperationApplication 一键审核共创申请
@@ -114,7 +210,6 @@ func (cooperationApplicationService *CooperationApplicationService) CreateCooper @@ -114,7 +210,6 @@ func (cooperationApplicationService *CooperationApplicationService) CreateCooper
114 210
115 } 211 }
116 212
117 - //TODO 获取申请人  
118 // 用户REST服务初始化 213 // 用户REST服务初始化
119 var userService service.UserService 214 var userService service.UserService
120 if value, err := factory.CreateUserService(map[string]interface{}{}); err != nil { 215 if value, err := factory.CreateUserService(map[string]interface{}{}); err != nil {
@@ -274,27 +369,6 @@ func (cooperationApplicationService *CooperationApplicationService) ListCooperat @@ -274,27 +369,6 @@ func (cooperationApplicationService *CooperationApplicationService) ListCooperat
274 } 369 }
275 } 370 }
276 371
277 -// RejectCooperationApplication 审核-拒绝共创申请  
278 -func (cooperationApplicationService *CooperationApplicationService) RejectCooperationApplication(rejectCooperationApplicationCommand *command.RejectCooperationApplicationCommand) (interface{}, error) {  
279 - if err := rejectCooperationApplicationCommand.ValidateCommand(); err != nil {  
280 - return nil, application.ThrowError(application.ARG_ERROR, err.Error())  
281 - }  
282 - transactionContext, err := factory.CreateTransactionContext(nil)  
283 - if err != nil {  
284 - return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())  
285 - }  
286 - if err := transactionContext.StartTransaction(); err != nil {  
287 - return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())  
288 - }  
289 - defer func() {  
290 - _ = transactionContext.RollbackTransaction()  
291 - }()  
292 - if err := transactionContext.CommitTransaction(); err != nil {  
293 - return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())  
294 - }  
295 - return nil, nil  
296 -}  
297 -  
298 // RemoveCooperationApplication 移除共创申请服务 372 // RemoveCooperationApplication 移除共创申请服务
299 func (cooperationApplicationService *CooperationApplicationService) RemoveCooperationApplication(removeCooperationApplicationCommand *command.RemoveCooperationApplicationCommand) (interface{}, error) { 373 func (cooperationApplicationService *CooperationApplicationService) RemoveCooperationApplication(removeCooperationApplicationCommand *command.RemoveCooperationApplicationCommand) (interface{}, error) {
300 if err := removeCooperationApplicationCommand.ValidateCommand(); err != nil { 374 if err := removeCooperationApplicationCommand.ValidateCommand(); err != nil {
@@ -13,6 +13,8 @@ type CreateCooperationProjectCommand struct { @@ -13,6 +13,8 @@ type CreateCooperationProjectCommand struct {
13 CooperationProjectName string `cname:"共创项目名称" json:"cooperationProjectName" valid:"Required"` 13 CooperationProjectName string `cname:"共创项目名称" json:"cooperationProjectName" valid:"Required"`
14 // 承接对象,1员工,2共创用户,3公开,可以多选 14 // 承接对象,1员工,2共创用户,3公开,可以多选
15 CooperationProjectUndertakerTypes []int32 `cname:"承接对象" json:"cooperationProjectUndertakerTypes" valid:"Required"` 15 CooperationProjectUndertakerTypes []int32 `cname:"承接对象" json:"cooperationProjectUndertakerTypes" valid:"Required"`
  16 + // 共创模式编码
  17 + CooperationModeNumber string `cname:"共创模式编码" json:"cooperationModeNumber" valid:"Required"`
16 // 共创项目发起人uid 18 // 共创项目发起人uid
17 SponsorUid string `cname:"共创项目发起人UID" json:"sponsorUid" valid:"Required"` 19 SponsorUid string `cname:"共创项目发起人UID" json:"sponsorUid" valid:"Required"`
18 // 共创项目发布人uid 20 // 共创项目发布人uid
@@ -13,6 +13,8 @@ type UpdateCooperationProjectCommand struct { @@ -13,6 +13,8 @@ type UpdateCooperationProjectCommand struct {
13 CooperationProjectId string `cname:"共创项目ID" json:"cooperationProjectId" valid:"Required"` 13 CooperationProjectId string `cname:"共创项目ID" json:"cooperationProjectId" valid:"Required"`
14 // 共创项目名称 14 // 共创项目名称
15 CooperationProjectName string `cname:"共创项目名称" json:"cooperationProjectName" valid:"Required"` 15 CooperationProjectName string `cname:"共创项目名称" json:"cooperationProjectName" valid:"Required"`
  16 + // 共创模式编码
  17 + CooperationModeNumber string `cname:"共创模式编码" json:"cooperationModeNumber" valid:"Required"`
16 // 承接对象,1员工,2共创用户,3公开,可以多选 18 // 承接对象,1员工,2共创用户,3公开,可以多选
17 CooperationProjectUndertakerType []int32 `cname:"承接对象,1员工,2共创用户,3公开,可以多选" json:"cooperationProjectUndertakerType" valid:"Required"` 19 CooperationProjectUndertakerType []int32 `cname:"承接对象,1员工,2共创用户,3公开,可以多选" json:"cooperationProjectUndertakerType" valid:"Required"`
18 // 共创项目发起人uid 20 // 共创项目发起人uid
@@ -48,13 +48,13 @@ type CreateDividendsOrderCommand struct { @@ -48,13 +48,13 @@ type CreateDividendsOrderCommand struct {
48 // 订单产品列表 48 // 订单产品列表
49 OrderGoods []*OrderGoods `cname:"订单产品列表" json:"orderGoods,omitempty"` 49 OrderGoods []*OrderGoods `cname:"订单产品列表" json:"orderGoods,omitempty"`
50 // 公司ID,通过集成REST上下文获取 50 // 公司ID,通过集成REST上下文获取
51 - CompanyId int64 `cname:"公司ID,通过集成REST上下文获取" json:"companyId,string" valid:"Required"` 51 + CompanyId int64 `cname:"公司ID" json:"companyId,string" valid:"Required"`
52 // 组织机构ID 52 // 组织机构ID
53 OrgId int64 `cname:"组织机构ID" json:"orgId,string" valid:"Required"` 53 OrgId int64 `cname:"组织机构ID" json:"orgId,string" valid:"Required"`
54 // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员 54 // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员
55 - UserId int64 `cname:"用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员" json:"userId,string" valid:"Required"` 55 + UserId int64 `cname:"用户ID" json:"userId,string" valid:"Required"`
56 // 用户基础信息id 56 // 用户基础信息id
57 - UserBaseId int64 `cname:"用户基础数据id" json:"userBaseId" valid:"Required"` 57 + UserBaseId int64 `cname:"用户基础数据ID" json:"userBaseId" valid:"Required"`
58 } 58 }
59 59
60 func (createDividendsOrderCommand *CreateDividendsOrderCommand) Valid(validation *validation.Validation) { 60 func (createDividendsOrderCommand *CreateDividendsOrderCommand) Valid(validation *validation.Validation) {
  1 +package command
  2 +
  3 +import (
  4 + "fmt"
  5 + "reflect"
  6 + "strings"
  7 + "time"
  8 +
  9 + "github.com/beego/beego/v2/core/validation"
  10 +)
  11 +
  12 +type ImportDividendsOrderCommand struct {
  13 + // 客户名称
  14 + CustomerName string `cname:"客户名称" json:"customerName" valid:"Required"`
  15 + // 分红订单金额
  16 + DividendsOrderAmount float64 `cname:"分红订单金额" json:"dividendsOrderAmount" valid:"Required"`
  17 + // 分红订单号
  18 + DividendsOrderNumber string `cname:"分红订单号" json:"dividendsOrderNumber,string" valid:"Required"`
  19 + // 分红订单原单号
  20 + DividendsOriginalOrderNum string `cname:"分红订单原单号" json:"dividendsOriginalOrderNum" valid:"Required"`
  21 + // 订单产生时间
  22 + OrderTime time.Time `cname:"订单产生时间" json:"orderTime" valid:"Required"`
  23 + // 备注
  24 + Remarks string `cname:"备注" json:"remarks" valid:"Required"`
  25 + // 订单区域名称
  26 + RegionName string `cname:"订单区域名称" json:"regionName,omitempty"`
  27 + // 订单业务员uid
  28 + SalesmanUid string `cname:"订单业务员uid" json:"salesmanUid,omitempty"`
  29 + // 订单操作人uid
  30 + OperatorUid string `cname:"订单操作人uid" json:"operatorUid,omitempty"`
  31 + // 订单产品列表
  32 + OrderGoods []*OrderGoods `cname:"订单产品列表" json:"orderGoods,omitempty"`
  33 + // 公司ID,通过集成REST上下文获取
  34 + CompanyId int64 `cname:"公司ID" json:"companyId,string" valid:"Required"`
  35 + // 组织机构ID
  36 + OrgId int64 `cname:"组织机构ID" json:"orgId,string" valid:"Required"`
  37 + // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员
  38 + UserId int64 `cname:"用户ID" json:"userId,string" valid:"Required"`
  39 + // 用户基础信息id
  40 + UserBaseId int64 `cname:"用户基础数据ID" json:"userBaseId" valid:"Required"`
  41 +}
  42 +
  43 +func (importDividendsOrderCommand *ImportDividendsOrderCommand) Valid(validation *validation.Validation) {
  44 + //validation.SetError("CustomValid", "未实现的自定义认证")
  45 +}
  46 +
  47 +func (importDividendsOrderCommand *ImportDividendsOrderCommand) ValidateCommand() error {
  48 + valid := validation.Validation{}
  49 + b, err := valid.Valid(importDividendsOrderCommand)
  50 + if err != nil {
  51 + return err
  52 + }
  53 + if !b {
  54 + elem := reflect.TypeOf(importDividendsOrderCommand).Elem()
  55 + for _, validErr := range valid.Errors {
  56 + field, isExist := elem.FieldByName(validErr.Field)
  57 + if isExist {
  58 + return fmt.Errorf(strings.Replace(validErr.Message, validErr.Field, field.Tag.Get("cname"), -1))
  59 + } else {
  60 + return fmt.Errorf(validErr.Message)
  61 + }
  62 + }
  63 + }
  64 + return nil
  65 +}
@@ -12,13 +12,13 @@ type RemoveDividendsOrderCommand struct { @@ -12,13 +12,13 @@ type RemoveDividendsOrderCommand struct {
12 // 分红订单ID 12 // 分红订单ID
13 DividendsOrderId string `cname:"分红订单ID" json:"dividendsOrderId" valid:"Required"` 13 DividendsOrderId string `cname:"分红订单ID" json:"dividendsOrderId" valid:"Required"`
14 // 公司ID,通过集成REST上下文获取 14 // 公司ID,通过集成REST上下文获取
15 - CompanyId int64 `cname:"公司ID,通过集成REST上下文获取" json:"companyId,string" valid:"Required"` 15 + CompanyId int64 `cname:"公司ID" json:"companyId,string" valid:"Required"`
16 // 组织机构ID 16 // 组织机构ID
17 OrgId int64 `cname:"组织机构ID" json:"orgId,string" valid:"Required"` 17 OrgId int64 `cname:"组织机构ID" json:"orgId,string" valid:"Required"`
18 // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员 18 // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员
19 - UserId int64 `cname:"用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员" json:"userId,string" valid:"Required"` 19 + UserId int64 `cname:"用户ID" json:"userId,string" valid:"Required"`
20 // 用户基础数据id 20 // 用户基础数据id
21 - UserBaseId int64 `cname:"用户基础数据id" json:"userBaseId,string" valid:"Required"` 21 + UserBaseId int64 `cname:"用户基础数据ID" json:"userBaseId,string" valid:"Required"`
22 } 22 }
23 23
24 func (removeDividendsOrderCommand *RemoveDividendsOrderCommand) Valid(validation *validation.Validation) { 24 func (removeDividendsOrderCommand *RemoveDividendsOrderCommand) Valid(validation *validation.Validation) {
@@ -25,17 +25,17 @@ type UpdateDividendsOrderCommand struct { @@ -25,17 +25,17 @@ type UpdateDividendsOrderCommand struct {
25 // 备注 25 // 备注
26 Remarks string `cname:"备注" json:"remarks" valid:"Required"` 26 Remarks string `cname:"备注" json:"remarks" valid:"Required"`
27 // 业务员uid 27 // 业务员uid
28 - SalesmanUid string `cname:"业务员uid" json:"salesmanUid,omitempty"` 28 + SalesmanUid string `cname:"业务员UID" json:"salesmanUid,omitempty"`
29 // 操作人uid 29 // 操作人uid
30 - OperatorUid string `cname:"操作人uid" json:"operatorUid,omitempty"` 30 + OperatorUid string `cname:"操作人UID" json:"operatorUid,omitempty"`
31 // 公司ID,通过集成REST上下文获取 31 // 公司ID,通过集成REST上下文获取
32 - CompanyId int64 `cname:"公司ID,通过集成REST上下文获取" json:"companyId,string" valid:"Required"` 32 + CompanyId int64 `cname:"公司ID" json:"companyId,string" valid:"Required"`
33 // 组织机构ID 33 // 组织机构ID
34 OrgId int64 `cname:"组织机构ID" json:"orgId,string" valid:"Required"` 34 OrgId int64 `cname:"组织机构ID" json:"orgId,string" valid:"Required"`
35 // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员 35 // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员
36 - UserId int64 `cname:"用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员" json:"userId,string" valid:"Required"` 36 + UserId int64 `cname:"用户ID" json:"userId,string" valid:"Required"`
37 // 用户基础数据id 37 // 用户基础数据id
38 - UserBaseId int64 `cname:"用户基础数据id" json:"userBaseId,string" valid:"Required"` 38 + UserBaseId int64 `cname:"用户基础数据ID" json:"userBaseId,string" valid:"Required"`
39 } 39 }
40 40
41 func (updateDividendsOrderCommand *UpdateDividendsOrderCommand) Valid(validation *validation.Validation) { 41 func (updateDividendsOrderCommand *UpdateDividendsOrderCommand) Valid(validation *validation.Validation) {
@@ -12,13 +12,13 @@ type GetDividendsOrderQuery struct { @@ -12,13 +12,13 @@ type GetDividendsOrderQuery struct {
12 // 分红订单ID 12 // 分红订单ID
13 DividendsOrderId int64 `cname:"分红订单ID" json:"dividendsOrderId,string" valid:"Required"` 13 DividendsOrderId int64 `cname:"分红订单ID" json:"dividendsOrderId,string" valid:"Required"`
14 // 公司ID,通过集成REST上下文获取 14 // 公司ID,通过集成REST上下文获取
15 - CompanyId int64 `cname:"公司ID,通过集成REST上下文获取" json:"companyId,string" valid:"Required"` 15 + CompanyId int64 `cname:"公司ID" json:"companyId,string" valid:"Required"`
16 // 组织机构ID 16 // 组织机构ID
17 OrgId int64 `cname:"组织机构ID" json:"orgId,string" valid:"Required"` 17 OrgId int64 `cname:"组织机构ID" json:"orgId,string" valid:"Required"`
18 // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员 18 // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员
19 - UserId int64 `cname:"用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员" json:"userId,string" valid:"Required"` 19 + UserId int64 `cname:"用户ID" json:"userId,string" valid:"Required"`
20 // 用户基础数据id 20 // 用户基础数据id
21 - UserBaseId int64 `canme:"用户基础数据id" json:"userBaseId,string" valid:"Required"` 21 + UserBaseId int64 `canme:"用户基础数据ID" json:"userBaseId,string" valid:"Required"`
22 } 22 }
23 23
24 func (getDividendsOrderQuery *GetDividendsOrderQuery) Valid(validation *validation.Validation) { 24 func (getDividendsOrderQuery *GetDividendsOrderQuery) Valid(validation *validation.Validation) {
@@ -10,17 +10,17 @@ import ( @@ -10,17 +10,17 @@ import (
10 10
11 type ListDividendsOrdersQuery struct { 11 type ListDividendsOrdersQuery struct {
12 // 页面大小 12 // 页面大小
13 - PageNumber int64 `cname:"页面大小" json:"pageNumber,omitempty"` 13 + PageNumber int64 `cname:"页" json:"pageNumber,omitempty"`
14 // 页面大小 14 // 页面大小
15 PageSize int64 `cname:"页面大小" json:"pageSize,omitempty"` 15 PageSize int64 `cname:"页面大小" json:"pageSize,omitempty"`
16 // 公司ID,通过集成REST上下文获取 16 // 公司ID,通过集成REST上下文获取
17 - CompanyId int64 `cname:"公司ID,通过集成REST上下文获取" json:"companyId,string" valid:"Required"` 17 + CompanyId int64 `cname:"公司ID" json:"companyId,string" valid:"Required"`
18 // 组织机构ID 18 // 组织机构ID
19 OrgId int64 `cname:"组织机构ID" json:"orgId,string" valid:"Required"` 19 OrgId int64 `cname:"组织机构ID" json:"orgId,string" valid:"Required"`
20 // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员 20 // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员
21 - UserId int64 `cname:"用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员" json:"userId,string" valid:"Required"` 21 + UserId int64 `cname:"用户ID" json:"userId,string" valid:"Required"`
22 // 用户基础数据id 22 // 用户基础数据id
23 - UserBaseId int64 `cname:"用户基础数据id" json:"userBaseId,string" valid:"Required"` 23 + UserBaseId int64 `cname:"用户基础数据ID" json:"userBaseId,string" valid:"Required"`
24 } 24 }
25 25
26 func (listDividendsOrdersQuery *ListDividendsOrdersQuery) Valid(validation *validation.Validation) { 26 func (listDividendsOrdersQuery *ListDividendsOrdersQuery) Valid(validation *validation.Validation) {
@@ -16,15 +16,15 @@ type SearchDividendsOrderQuery struct { @@ -16,15 +16,15 @@ type SearchDividendsOrderQuery struct {
16 // 页面大小 16 // 页面大小
17 PageSize int64 `cname:"页面大小" json:"pageSize,omitempty"` 17 PageSize int64 `cname:"页面大小" json:"pageSize,omitempty"`
18 // 页面大小 18 // 页面大小
19 - PageNumber int64 `cname:"页面大小" json:"pageNumber,omitempty"` 19 + PageNumber int64 `cname:"页" json:"pageNumber,omitempty"`
20 // 公司ID,通过集成REST上下文获取 20 // 公司ID,通过集成REST上下文获取
21 - CompanyId int64 `cname:"公司ID,通过集成REST上下文获取" json:"companyId,string" valid:"Required"` 21 + CompanyId int64 `cname:"公司ID" json:"companyId,string" valid:"Required"`
22 // 组织机构ID 22 // 组织机构ID
23 OrgId int64 `cname:"组织机构ID" json:"orgId,string" valid:"Required"` 23 OrgId int64 `cname:"组织机构ID" json:"orgId,string" valid:"Required"`
24 // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员 24 // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员
25 - UserId int64 `cname:"用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员" json:"userId,string" valid:"Required"` 25 + UserId int64 `cname:"用户ID" json:"userId,string" valid:"Required"`
26 // 用户基础数据id 26 // 用户基础数据id
27 - UserBaseId int64 `cname:"用户基础数据id" json:"userBaseId,string" valid:"Required"` 27 + UserBaseId int64 `cname:"用户基础数据ID" json:"userBaseId,string" valid:"Required"`
28 } 28 }
29 29
30 func (searchDividendsOrderQuery *SearchDividendsOrderQuery) Valid(validation *validation.Validation) { 30 func (searchDividendsOrderQuery *SearchDividendsOrderQuery) Valid(validation *validation.Validation) {
@@ -12,15 +12,15 @@ type SearchDividendsOrderNumberQuery struct { @@ -12,15 +12,15 @@ type SearchDividendsOrderNumberQuery struct {
12 // 分红订单号 12 // 分红订单号
13 DividendsOrderNumber string `cname:"分红订单号" json:"dividendsOrderNumber,omitempty"` 13 DividendsOrderNumber string `cname:"分红订单号" json:"dividendsOrderNumber,omitempty"`
14 // 公司ID,通过集成REST上下文获取 14 // 公司ID,通过集成REST上下文获取
15 - CompanyId int64 `cname:"公司ID,通过集成REST上下文获取" json:"companyId,string" valid:"Required"` 15 + CompanyId int64 `cname:"公司ID" json:"companyId,string" valid:"Required"`
16 // 组织机构ID 16 // 组织机构ID
17 OrgId int64 `cname:"组织机构ID" json:"orgId,string" valid:"Required"` 17 OrgId int64 `cname:"组织机构ID" json:"orgId,string" valid:"Required"`
18 // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员 18 // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员
19 - UserId int64 `cname:"用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员" json:"userId,string" valid:"Required"` 19 + UserId int64 `cname:"用户ID" json:"userId,string" valid:"Required"`
20 // 用户基础数据id 20 // 用户基础数据id
21 - UserBaseId int64 `cname:"用户基础数据id" json:"userBaseId,string" valid:"Required"` 21 + UserBaseId int64 `cname:"用户基础数据ID" json:"userBaseId,string" valid:"Required"`
22 // 页面大小 22 // 页面大小
23 - PageNumber int64 `cname:"页面大小" json:"pageNumber,omitempty"` 23 + PageNumber int64 `cname:"页" json:"pageNumber,omitempty"`
24 // 页面大小 24 // 页面大小
25 PageSize int64 `cname:"页面大小" json:"pageSize,omitempty"` 25 PageSize int64 `cname:"页面大小" json:"pageSize,omitempty"`
26 } 26 }
@@ -90,24 +90,49 @@ func (dividendsOrderService *DividendsOrderService) CreateDividendsOrder(createD @@ -90,24 +90,49 @@ func (dividendsOrderService *DividendsOrderService) CreateDividendsOrder(createD
90 salesman = data 90 salesman = data
91 } 91 }
92 92
  93 + // 获取订单产品
  94 + var orderGoods []*domain.OrderGood
  95 + for _, orderGood := range createDividendsOrderCommand.OrderGoods {
  96 + orderGoods = append(orderGoods, &domain.OrderGood{
  97 + OrderGoodId: 0,
  98 + OrderGoodAmount: orderGood.OrderGoodAmount,
  99 + OrderGoodName: orderGood.OrderGoodName,
  100 + OrderGoodPrice: orderGood.OrderGoodPrice,
  101 + OrderGoodQuantity: orderGood.OrderGoodQuantity,
  102 + DividendsOrderNumber: "", //TODO 分红订单号,规则生成
  103 + DividendsReturnedOrderNumber: "",
  104 + CooperationContractNumber: orderGood.CooperationContractNumber,
  105 + OrderGoodExpense: 0,
  106 + OrgId: organization.OrgId,
  107 + CompanyId: company.CompanyId,
  108 + CreatedAt: time.Time{},
  109 + DeletedAt: time.Time{},
  110 + UpdatedAt: time.Time{},
  111 + })
  112 + }
  113 +
93 newDividendsOrder := &domain.DividendsOrder{ 114 newDividendsOrder := &domain.DividendsOrder{
94 - DividendsOrderNumber: "", 115 + DividendsOrderId: 0,
  116 + DividendsOrderNumber: "", // TODO 分红订单号,规则生成
95 DividendsOriginalOrderNum: createDividendsOrderCommand.DividendsOriginalOrderNum, 117 DividendsOriginalOrderNum: createDividendsOrderCommand.DividendsOriginalOrderNum,
96 DividendsOrderAmount: createDividendsOrderCommand.DividendsOrderAmount, 118 DividendsOrderAmount: createDividendsOrderCommand.DividendsOrderAmount,
97 OrderSalesman: salesman, 119 OrderSalesman: salesman,
98 - OrderTime: time.Time{}, 120 + OrderTime: createDividendsOrderCommand.OrderTime,
99 DividendTime: time.Time{}, 121 DividendTime: time.Time{},
100 DividendStatus: 0, 122 DividendStatus: 0,
101 - Region: nil,  
102 - CustomerName: "",  
103 - Goods: nil,  
104 - Org: organization,  
105 - Company: company,  
106 - CreatedAt: time.Now(),  
107 - DeletedAt: time.Time{},  
108 - UpdatedAt: time.Time{},  
109 - OperateTime: time.Time{},  
110 - Operator: operator, 123 + Region: &domain.RegionInfo{
  124 + RegionNumber: "",
  125 + RegionName: createDividendsOrderCommand.RegionName,
  126 + },
  127 + CustomerName: createDividendsOrderCommand.CustomerName,
  128 + Goods: orderGoods,
  129 + Org: organization,
  130 + Company: company,
  131 + CreatedAt: time.Now(),
  132 + DeletedAt: time.Time{},
  133 + UpdatedAt: time.Time{},
  134 + OperateTime: time.Now(),
  135 + Operator: operator,
111 } 136 }
112 137
113 var dividendsOrderRepository domain.DividendsOrderRepository 138 var dividendsOrderRepository domain.DividendsOrderRepository
@@ -32,7 +32,9 @@ type CreateDividendsReturnedOrderCommand struct { @@ -32,7 +32,9 @@ type CreateDividendsReturnedOrderCommand struct {
32 // 退货客户名称 32 // 退货客户名称
33 DividendsReturnedCustomerName string `cname:"退货客户名称" json:"dividendsReturnedCustomerName" valid:"Required"` 33 DividendsReturnedCustomerName string `cname:"退货客户名称" json:"dividendsReturnedCustomerName" valid:"Required"`
34 // 来源单号,源单号,订单号 34 // 来源单号,源单号,订单号
35 - OriginalOrderNum string `cname:"来源单号,源单号,订单号" json:"originalOrderNum" valid:"Required"` 35 + OriginalOrderNum string `cname:"来源单号" json:"originalOrderNum" valid:"Required"`
  36 + // 分红单号
  37 + DividendsOrderNumber string `cname:"订单号" json:"dividendsOrderNumber" valid:"Required"`
36 // 备注 38 // 备注
37 Remarks string `cname:"备注" json:"remarks" valid:"Required"` 39 Remarks string `cname:"备注" json:"remarks" valid:"Required"`
38 // 退货日期 40 // 退货日期
@@ -42,13 +44,13 @@ type CreateDividendsReturnedOrderCommand struct { @@ -42,13 +44,13 @@ type CreateDividendsReturnedOrderCommand struct {
42 // 订单产品列表 44 // 订单产品列表
43 OrderGoods []*OrderGoods `cname:"订单产品列表" json:"orderGoods,omitempty"` 45 OrderGoods []*OrderGoods `cname:"订单产品列表" json:"orderGoods,omitempty"`
44 // 公司ID,通过集成REST上下文获取 46 // 公司ID,通过集成REST上下文获取
45 - CompanyId int64 `cname:"公司ID,通过集成REST上下文获取" json:"companyId,string" valid:"Required"` 47 + CompanyId int64 `cname:"公司ID" json:"companyId,string" valid:"Required"`
46 // 组织机构ID 48 // 组织机构ID
47 OrgId int64 `cname:"组织机构ID" json:"orgId,string" valid:"Required"` 49 OrgId int64 `cname:"组织机构ID" json:"orgId,string" valid:"Required"`
48 // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员 50 // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员
49 - UserId int64 `cname:"用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员" json:"userId,string" valid:"Required"` 51 + UserId int64 `cname:"用户ID" json:"userId,string" valid:"Required"`
50 // 用户基础数据id 52 // 用户基础数据id
51 - UserBaseId int64 `cname:"用户基础数据id" json:"userBaseId,string" valid:"Required"` 53 + UserBaseId int64 `cname:"用户基础数据ID" json:"userBaseId,string" valid:"Required"`
52 } 54 }
53 55
54 func (createDividendsReturnedOrderCommand *CreateDividendsReturnedOrderCommand) Valid(validation *validation.Validation) { 56 func (createDividendsReturnedOrderCommand *CreateDividendsReturnedOrderCommand) Valid(validation *validation.Validation) {
@@ -4,23 +4,34 @@ import ( @@ -4,23 +4,34 @@ import (
4 "fmt" 4 "fmt"
5 "reflect" 5 "reflect"
6 "strings" 6 "strings"
  7 + "time"
7 8
8 "github.com/beego/beego/v2/core/validation" 9 "github.com/beego/beego/v2/core/validation"
9 ) 10 )
10 11
11 type ImportDividendsReturnedOrderCommand struct { 12 type ImportDividendsReturnedOrderCommand struct {
12 - // 导入文件  
13 - File string `cname:"导入文件" json:"file,omitempty"`  
14 - // 参数列表  
15 - Where string `cname:"参数列表" json:"where,omitempty"` 13 + // 退货金额
  14 + DividendsReturnedOrderRefund float64 `cname:"退货金额" json:"dividendsReturnedOrderRefund" valid:"Required"`
  15 + // 退货客户名称
  16 + DividendsReturnedCustomerName string `cname:"退货客户名称" json:"dividendsReturnedCustomerName" valid:"Required"`
  17 + // 来源单号,源单号,订单号
  18 + OriginalOrderNum string `cname:"来源单号" json:"originalOrderNum" valid:"Required"`
  19 + // 备注
  20 + Remarks string `cname:"备注" json:"remarks" valid:"Required"`
  21 + // 退货日期
  22 + DividendsReturnedDate time.Time `cname:"退货日期" json:"dividendsReturnedDate" valid:"Required"`
  23 + // 退货区域名称
  24 + RegionName string `cname:"退货区域名称" json:"regionName,omitempty"`
  25 + // 订单产品列表
  26 + OrderGoods []*OrderGoods `cname:"订单产品列表" json:"orderGoods,omitempty"`
16 // 公司ID,通过集成REST上下文获取 27 // 公司ID,通过集成REST上下文获取
17 - CompanyId int64 `cname:"公司ID,通过集成REST上下文获取" json:"companyId,string" valid:"Required"` 28 + CompanyId int64 `cname:"公司ID" json:"companyId,string" valid:"Required"`
18 // 组织机构ID 29 // 组织机构ID
19 OrgId int64 `cname:"组织机构ID" json:"orgId,string" valid:"Required"` 30 OrgId int64 `cname:"组织机构ID" json:"orgId,string" valid:"Required"`
20 // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员 31 // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员
21 - UserId int64 `cname:"用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员" json:"userId,string" valid:"Required"` 32 + UserId int64 `cname:"用户ID" json:"userId,string" valid:"Required"`
22 // 用户基础数据id 33 // 用户基础数据id
23 - UserBaseId int64 `cname:"用户基础数据id" json:"userBaseId,string" valid:"Required"` 34 + UserBaseId int64 `cname:"用户基础数据ID" json:"userBaseId,string" valid:"Required"`
24 } 35 }
25 36
26 func (importDividendsReturnedOrderCommand *ImportDividendsReturnedOrderCommand) Valid(validation *validation.Validation) { 37 func (importDividendsReturnedOrderCommand *ImportDividendsReturnedOrderCommand) Valid(validation *validation.Validation) {
@@ -12,13 +12,13 @@ type RemoveDividendsReturnedOrderCommand struct { @@ -12,13 +12,13 @@ type RemoveDividendsReturnedOrderCommand struct {
12 // 分红退货单记录ID 12 // 分红退货单记录ID
13 DividendsReturnedOrderId string `cname:"分红退货单记录ID" json:"dividendsReturnedOrderId" valid:"Required"` 13 DividendsReturnedOrderId string `cname:"分红退货单记录ID" json:"dividendsReturnedOrderId" valid:"Required"`
14 // 公司ID,通过集成REST上下文获取 14 // 公司ID,通过集成REST上下文获取
15 - CompanyId int64 `cname:"公司ID,通过集成REST上下文获取" json:"companyId,string" valid:"Required"` 15 + CompanyId int64 `cname:"公司ID" json:"companyId,string" valid:"Required"`
16 // 组织机构ID 16 // 组织机构ID
17 OrgId int64 `cname:"组织机构ID" json:"orgId,string" valid:"Required"` 17 OrgId int64 `cname:"组织机构ID" json:"orgId,string" valid:"Required"`
18 // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员 18 // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员
19 - UserId int64 `cname:"用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员" json:"userId,string" valid:"Required"` 19 + UserId int64 `cname:"用户ID" json:"userId,string" valid:"Required"`
20 // 用户基础数据id 20 // 用户基础数据id
21 - UserBaseId int64 `cname:"用户基础数据id" json:"userBaseId,string" valid:"Required"` 21 + UserBaseId int64 `cname:"用户基础数据ID" json:"userBaseId,string" valid:"Required"`
22 } 22 }
23 23
24 func (removeDividendsReturnedOrderCommand *RemoveDividendsReturnedOrderCommand) Valid(validation *validation.Validation) { 24 func (removeDividendsReturnedOrderCommand *RemoveDividendsReturnedOrderCommand) Valid(validation *validation.Validation) {
@@ -17,7 +17,7 @@ type UpdateDividendsReturnedOrderCommand struct { @@ -17,7 +17,7 @@ type UpdateDividendsReturnedOrderCommand struct {
17 // 退货客户名称 17 // 退货客户名称
18 DividendsReturnedCustomerName string `cname:"退货客户名称" json:"dividendsReturnedCustomerName" valid:"Required"` 18 DividendsReturnedCustomerName string `cname:"退货客户名称" json:"dividendsReturnedCustomerName" valid:"Required"`
19 // 来源单号,源单号,订单号 19 // 来源单号,源单号,订单号
20 - OriginalOrderNum string `cname:"来源单号,源单号,订单号" json:"originalOrderNum" valid:"Required"` 20 + OriginalOrderNum string `cname:"来源单号" json:"originalOrderNum" valid:"Required"`
21 // 备注 21 // 备注
22 Remarks string `cname:"备注" json:"remarks" valid:"Required"` 22 Remarks string `cname:"备注" json:"remarks" valid:"Required"`
23 // 退货日期 23 // 退货日期
@@ -27,13 +27,13 @@ type UpdateDividendsReturnedOrderCommand struct { @@ -27,13 +27,13 @@ type UpdateDividendsReturnedOrderCommand struct {
27 // 订单产品列表 27 // 订单产品列表
28 OrderGoods []*OrderGoods `cname:"订单产品列表" json:"orderGoods,omitempty"` 28 OrderGoods []*OrderGoods `cname:"订单产品列表" json:"orderGoods,omitempty"`
29 // 公司ID,通过集成REST上下文获取 29 // 公司ID,通过集成REST上下文获取
30 - CompanyId int64 `cname:"公司ID,通过集成REST上下文获取" json:"companyId,string" valid:"Required"` 30 + CompanyId int64 `cname:"公司ID" json:"companyId,string" valid:"Required"`
31 // 组织机构ID 31 // 组织机构ID
32 OrgId int64 `cname:"组织机构ID" json:"orgId,string" valid:"Required"` 32 OrgId int64 `cname:"组织机构ID" json:"orgId,string" valid:"Required"`
33 // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员 33 // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员
34 - UserId int64 `cname:"用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员" json:"userId,string" valid:"Required"` 34 + UserId int64 `cname:"用户ID" json:"userId,string" valid:"Required"`
35 // 用户基础数据id 35 // 用户基础数据id
36 - UserBaseId int64 `cname:"用户基础数据id" json:"userBaseId,string" valid:"Required"` 36 + UserBaseId int64 `cname:"用户基础数据ID" json:"userBaseId,string" valid:"Required"`
37 } 37 }
38 38
39 func (updateDividendsReturnedOrderCommand *UpdateDividendsReturnedOrderCommand) Valid(validation *validation.Validation) { 39 func (updateDividendsReturnedOrderCommand *UpdateDividendsReturnedOrderCommand) Valid(validation *validation.Validation) {
@@ -12,13 +12,13 @@ type GetDividendsReturnedOrderQuery struct { @@ -12,13 +12,13 @@ type GetDividendsReturnedOrderQuery struct {
12 // 分红退货单记录ID 12 // 分红退货单记录ID
13 DividendsReturnedOrderId string `cname:"分红退货单记录ID" json:"dividendsReturnedOrderId" valid:"Required"` 13 DividendsReturnedOrderId string `cname:"分红退货单记录ID" json:"dividendsReturnedOrderId" valid:"Required"`
14 // 公司ID,通过集成REST上下文获取 14 // 公司ID,通过集成REST上下文获取
15 - CompanyId int64 `cname:"公司ID,通过集成REST上下文获取" json:"companyId,string" valid:"Required"` 15 + CompanyId int64 `cname:"公司ID" json:"companyId,string" valid:"Required"`
16 // 组织机构ID 16 // 组织机构ID
17 OrgId int64 `cname:"组织机构ID" json:"orgId,string" valid:"Required"` 17 OrgId int64 `cname:"组织机构ID" json:"orgId,string" valid:"Required"`
18 // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员 18 // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员
19 - UserId int64 `cname:"用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员" json:"userId,string" valid:"Required"` 19 + UserId int64 `cname:"用户ID" json:"userId,string" valid:"Required"`
20 // 用户基础数据id 20 // 用户基础数据id
21 - UserBaseId int64 `cname:"用户基础数据id" json:"userBaseId,string" valid:"Required"` 21 + UserBaseId int64 `cname:"用户基础数据ID" json:"userBaseId,string" valid:"Required"`
22 } 22 }
23 23
24 func (getDividendsReturnedOrderQuery *GetDividendsReturnedOrderQuery) Valid(validation *validation.Validation) { 24 func (getDividendsReturnedOrderQuery *GetDividendsReturnedOrderQuery) Valid(validation *validation.Validation) {
@@ -10,17 +10,17 @@ import ( @@ -10,17 +10,17 @@ import (
10 10
11 type ListDividendsReturnedOrderQuery struct { 11 type ListDividendsReturnedOrderQuery struct {
12 // 页面大小 12 // 页面大小
13 - PageNumber int64 `cname:"页面大小" json:"pageNumber,omitempty"` 13 + PageNumber int64 `cname:"页" json:"pageNumber,omitempty"`
14 // 页面大小 14 // 页面大小
15 PageSize int64 `cname:"页面大小" json:"pageSize,omitempty"` 15 PageSize int64 `cname:"页面大小" json:"pageSize,omitempty"`
16 // 公司ID,通过集成REST上下文获取 16 // 公司ID,通过集成REST上下文获取
17 - CompanyId int64 `cname:"公司ID,通过集成REST上下文获取" json:"companyId,string" valid:"Required"` 17 + CompanyId int64 `cname:"公司ID" json:"companyId,string" valid:"Required"`
18 // 组织机构ID 18 // 组织机构ID
19 OrgId int64 `cname:"组织机构ID" json:"orgId,string" valid:"Required"` 19 OrgId int64 `cname:"组织机构ID" json:"orgId,string" valid:"Required"`
20 // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员 20 // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员
21 - UserId int64 `cname:"用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员" json:"userId,string" valid:"Required"` 21 + UserId int64 `cname:"用户ID" json:"userId,string" valid:"Required"`
22 // 用户基础数据id 22 // 用户基础数据id
23 - UserBaseId int64 `cname:"用户基础数据id" json:"userBaseId,string" valid:"Required"` 23 + UserBaseId int64 `cname:"用户基础数据ID" json:"userBaseId,string" valid:"Required"`
24 } 24 }
25 25
26 func (listDividendsReturnedOrderQuery *ListDividendsReturnedOrderQuery) Valid(validation *validation.Validation) { 26 func (listDividendsReturnedOrderQuery *ListDividendsReturnedOrderQuery) Valid(validation *validation.Validation) {
@@ -16,15 +16,15 @@ type SearchDividendsReturnedOrderQuery struct { @@ -16,15 +16,15 @@ type SearchDividendsReturnedOrderQuery struct {
16 // 页面大小 16 // 页面大小
17 PageSize int64 `cname:"页面大小" json:"pageSize,omitempty"` 17 PageSize int64 `cname:"页面大小" json:"pageSize,omitempty"`
18 // 页面大小 18 // 页面大小
19 - PageNumber int64 `cname:"页面大小" json:"pageNumber,omitempty"` 19 + PageNumber int64 `cname:"页" json:"pageNumber,omitempty"`
20 // 公司ID,通过集成REST上下文获取 20 // 公司ID,通过集成REST上下文获取
21 - CompanyId int64 `cname:"公司ID,通过集成REST上下文获取" json:"companyId,string" valid:"Required"` 21 + CompanyId int64 `cname:"公司ID" json:"companyId,string" valid:"Required"`
22 // 组织机构ID 22 // 组织机构ID
23 OrgId int64 `cname:"组织机构ID" json:"orgId,string" valid:"Required"` 23 OrgId int64 `cname:"组织机构ID" json:"orgId,string" valid:"Required"`
24 // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员 24 // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员
25 - UserId int64 `cname:"用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员" json:"userId,string" valid:"Required"` 25 + UserId int64 `cname:"用户ID" json:"userId,string" valid:"Required"`
26 // 用户基础数据id 26 // 用户基础数据id
27 - UserBaseId int64 `cname:"用户基础数据id" json:"userBaseId,string" valid:"Required"` 27 + UserBaseId int64 `cname:"用户基础数据ID" json:"userBaseId,string" valid:"Required"`
28 } 28 }
29 29
30 func (searchDividendsReturnedOrderQuery *SearchDividendsReturnedOrderQuery) Valid(validation *validation.Validation) { 30 func (searchDividendsReturnedOrderQuery *SearchDividendsReturnedOrderQuery) Valid(validation *validation.Validation) {
@@ -80,25 +80,49 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) CreateDivide @@ -80,25 +80,49 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) CreateDivide
80 operator = data 80 operator = data
81 } 81 }
82 82
  83 + // 获取分红退货单产品
  84 + var orderGoods []*domain.OrderGood
  85 + for _, orderGood := range createDividendsReturnedOrderCommand.OrderGoods {
  86 + orderGoods = append(orderGoods, &domain.OrderGood{
  87 + OrderGoodId: 0,
  88 + OrderGoodAmount: orderGood.OrderGoodAmount,
  89 + OrderGoodName: orderGood.OrderGoodName,
  90 + OrderGoodPrice: orderGood.OrderGoodPrice,
  91 + OrderGoodQuantity: orderGood.OrderGoodQuantity,
  92 + DividendsOrderNumber: "",
  93 + DividendsReturnedOrderNumber: "", // 分红退货单号,规则生成
  94 + CooperationContractNumber: orderGood.CooperationContractNumber,
  95 + OrderGoodExpense: 0,
  96 + OrgId: organization.OrgId,
  97 + CompanyId: company.CompanyId,
  98 + CreatedAt: time.Now(),
  99 + DeletedAt: time.Time{},
  100 + UpdatedAt: time.Time{},
  101 + })
  102 + }
  103 +
83 newDividendsReturnedOrder := &domain.DividendsReturnedOrder{ 104 newDividendsReturnedOrder := &domain.DividendsReturnedOrder{
84 - DividendsReturnedOrderNumber: "", 105 + DividendsReturnedOrderNumber: "", // 退货单号,生成
85 DividendsReturnedOrderRefund: 0, 106 DividendsReturnedOrderRefund: 0,
86 - OriginalOrderNum: "",  
87 - DividendsOrderNumber: 0,  
88 - DividendsReturnedCustomerName: "", 107 + OriginalOrderNum: createDividendsReturnedOrderCommand.OriginalOrderNum,
  108 + DividendsOrderNumber: createDividendsReturnedOrderCommand.DividendsOrderNumber,
  109 + DividendsReturnedCustomerName: createDividendsReturnedOrderCommand.DividendsReturnedCustomerName,
89 DividendsReturnedDate: time.Time{}, 110 DividendsReturnedDate: time.Time{},
90 - Region: nil,  
91 - Goods: nil,  
92 - Remarks: "",  
93 - DividendStatus: 0,  
94 - DividendTime: time.Time{},  
95 - Org: organization,  
96 - Company: company,  
97 - CreatedAt: time.Now(),  
98 - DeletedAt: time.Time{},  
99 - UpdatedAt: time.Time{},  
100 - Operator: operator,  
101 - OperateTime: time.Time{}, 111 + Region: &domain.RegionInfo{
  112 + RegionNumber: "",
  113 + RegionName: createDividendsReturnedOrderCommand.RegionName,
  114 + },
  115 + Goods: orderGoods,
  116 + Remarks: createDividendsReturnedOrderCommand.Remarks,
  117 + DividendStatus: 1,
  118 + DividendTime: time.Time{},
  119 + Org: organization,
  120 + Company: company,
  121 + CreatedAt: time.Now(),
  122 + DeletedAt: time.Time{},
  123 + UpdatedAt: time.Time{},
  124 + Operator: operator,
  125 + OperateTime: time.Now(),
102 } 126 }
103 127
104 var dividendsReturnedOrderRepository domain.DividendsReturnedOrderRepository 128 var dividendsReturnedOrderRepository domain.DividendsReturnedOrderRepository
@@ -13,7 +13,7 @@ type DividendsReturnedOrder struct { @@ -13,7 +13,7 @@ type DividendsReturnedOrder struct {
13 // 源单号(原始订单号) 13 // 源单号(原始订单号)
14 OriginalOrderNum string `json:"originalOrderNum"` 14 OriginalOrderNum string `json:"originalOrderNum"`
15 // 关联分红订单号 15 // 关联分红订单号
16 - DividendsOrderNumber int64 `json:"dividendsOrderNumber,string"` 16 + DividendsOrderNumber string `json:"dividendsOrderNumber"`
17 // 退货客户姓名 17 // 退货客户姓名
18 DividendsReturnedCustomerName string `json:"dividendsReturnedCustomerName"` 18 DividendsReturnedCustomerName string `json:"dividendsReturnedCustomerName"`
19 // 退货日期 19 // 退货日期
@@ -68,9 +68,6 @@ func (dividendsReturnedOrder *DividendsReturnedOrder) Update(data map[string]int @@ -68,9 +68,6 @@ func (dividendsReturnedOrder *DividendsReturnedOrder) Update(data map[string]int
68 if originalOrderNum, ok := data["originalOrderNum"]; ok { 68 if originalOrderNum, ok := data["originalOrderNum"]; ok {
69 dividendsReturnedOrder.OriginalOrderNum = originalOrderNum.(string) 69 dividendsReturnedOrder.OriginalOrderNum = originalOrderNum.(string)
70 } 70 }
71 - if dividendsOrderNumber, ok := data["dividendsOrderNumber"]; ok {  
72 - dividendsReturnedOrder.DividendsOrderNumber = dividendsOrderNumber.(int64)  
73 - }  
74 if dividendsReturnedCustomerName, ok := data["dividendsReturnedCustomerName"]; ok { 71 if dividendsReturnedCustomerName, ok := data["dividendsReturnedCustomerName"]; ok {
75 dividendsReturnedOrder.DividendsReturnedCustomerName = dividendsReturnedCustomerName.(string) 72 dividendsReturnedOrder.DividendsReturnedCustomerName = dividendsReturnedCustomerName.(string)
76 } 73 }
@@ -92,14 +89,5 @@ func (dividendsReturnedOrder *DividendsReturnedOrder) Update(data map[string]int @@ -92,14 +89,5 @@ func (dividendsReturnedOrder *DividendsReturnedOrder) Update(data map[string]int
92 if dividendTime, ok := data["dividendTime"]; ok { 89 if dividendTime, ok := data["dividendTime"]; ok {
93 dividendsReturnedOrder.DividendTime = dividendTime.(time.Time) 90 dividendsReturnedOrder.DividendTime = dividendTime.(time.Time)
94 } 91 }
95 - if orgId, ok := data["orgId"]; ok {  
96 - dividendsReturnedOrder.Org.OrgId = orgId.(int64)  
97 - }  
98 - if userType, ok := data["userType"]; ok {  
99 - dividendsReturnedOrder.Operator.UserType = userType.(int32)  
100 - }  
101 - if status, ok := data["status"]; ok {  
102 - dividendsReturnedOrder.Operator.Status = status.(int32)  
103 - }  
104 return nil 92 return nil
105 } 93 }
@@ -22,6 +22,10 @@ type OrderGood struct { @@ -22,6 +22,10 @@ type OrderGood struct {
22 CooperationContractNumber string `json:"cooperationContractNumber"` 22 CooperationContractNumber string `json:"cooperationContractNumber"`
23 // 订单产品费用 23 // 订单产品费用
24 OrderGoodExpense float64 `json:"orderGoodExpense"` 24 OrderGoodExpense float64 `json:"orderGoodExpense"`
  25 + // 组织机构ID
  26 + OrgId int64 `json:"orgId"`
  27 + // 公司ID
  28 + CompanyId int64 `json:"companyId"`
25 // 创建时间 29 // 创建时间
26 CreatedAt time.Time `json:"createdAt"` 30 CreatedAt time.Time `json:"createdAt"`
27 // 删除时间 31 // 删除时间
@@ -16,7 +16,7 @@ type DividendsReturnedOrder struct { @@ -16,7 +16,7 @@ type DividendsReturnedOrder struct {
16 // 源单号(原始订单号) 16 // 源单号(原始订单号)
17 OriginalOrderNum string `comment:"源单号(原始订单号)"` 17 OriginalOrderNum string `comment:"源单号(原始订单号)"`
18 // 关联分红订单号 18 // 关联分红订单号
19 - DividendsOrderNumber int64 `comment:"关联分红订单号"` 19 + DividendsOrderNumber string `comment:"关联分红订单号"`
20 // 退货客户姓名 20 // 退货客户姓名
21 DividendsReturnedCustomerName string `comment:"退货客户姓名"` 21 DividendsReturnedCustomerName string `comment:"退货客户姓名"`
22 // 退货日期 22 // 退货日期
@@ -20,6 +20,10 @@ type OrderGood struct { @@ -20,6 +20,10 @@ type OrderGood struct {
20 DividendsReturnedOrderNumber string `comment:"关联的分红退货单号"` 20 DividendsReturnedOrderNumber string `comment:"关联的分红退货单号"`
21 // 关联的共创合约编号 21 // 关联的共创合约编号
22 CooperationContractNumber string `comment:"关联的共创合约编号"` 22 CooperationContractNumber string `comment:"关联的共创合约编号"`
  23 + // 组织机构ID
  24 + OrgId int64 `comment:"组织机构ID"`
  25 + // 公司ID
  26 + CompanyId int64 `comment:"公司ID"`
23 // 订单产品费用 27 // 订单产品费用
24 OrderGoodExpense float64 `comment:"订单产品费用"` 28 OrderGoodExpense float64 `comment:"订单产品费用"`
25 // 创建时间 29 // 创建时间
@@ -15,6 +15,8 @@ func TransformToOrderGoodDomainModelFromPgModels(orderGoodModel *models.OrderGoo @@ -15,6 +15,8 @@ func TransformToOrderGoodDomainModelFromPgModels(orderGoodModel *models.OrderGoo
15 DividendsOrderNumber: orderGoodModel.DividendsOrderNumber, 15 DividendsOrderNumber: orderGoodModel.DividendsOrderNumber,
16 CooperationContractNumber: orderGoodModel.CooperationContractNumber, 16 CooperationContractNumber: orderGoodModel.CooperationContractNumber,
17 OrderGoodExpense: orderGoodModel.OrderGoodExpense, 17 OrderGoodExpense: orderGoodModel.OrderGoodExpense,
  18 + OrgId: orderGoodModel.OrgId,
  19 + CompanyId: orderGoodModel.CompanyId,
18 CreatedAt: orderGoodModel.CreatedAt, 20 CreatedAt: orderGoodModel.CreatedAt,
19 DeletedAt: orderGoodModel.DeletedAt, 21 DeletedAt: orderGoodModel.DeletedAt,
20 UpdatedAt: orderGoodModel.UpdatedAt, 22 UpdatedAt: orderGoodModel.UpdatedAt,
@@ -201,6 +201,8 @@ func (repository *DividendsOrderRepository) Save(dividendsOrder *domain.Dividend @@ -201,6 +201,8 @@ func (repository *DividendsOrderRepository) Save(dividendsOrder *domain.Dividend
201 DividendsReturnedOrderNumber: goodDomain.DividendsReturnedOrderNumber, 201 DividendsReturnedOrderNumber: goodDomain.DividendsReturnedOrderNumber,
202 CooperationContractNumber: goodDomain.CooperationContractNumber, 202 CooperationContractNumber: goodDomain.CooperationContractNumber,
203 OrderGoodExpense: goodDomain.OrderGoodExpense, 203 OrderGoodExpense: goodDomain.OrderGoodExpense,
  204 + OrgId: goodDomain.OrgId,
  205 + CompanyId: goodDomain.CompanyId,
204 CreatedAt: time.Time{}, 206 CreatedAt: time.Time{},
205 DeletedAt: time.Time{}, 207 DeletedAt: time.Time{},
206 UpdatedAt: time.Now(), 208 UpdatedAt: time.Now(),
@@ -115,6 +115,8 @@ func (repository *DividendsReturnedOrderRepository) Save(dividendsReturnedOrder @@ -115,6 +115,8 @@ func (repository *DividendsReturnedOrderRepository) Save(dividendsReturnedOrder
115 DividendsReturnedOrderNumber: good.DividendsReturnedOrderNumber, 115 DividendsReturnedOrderNumber: good.DividendsReturnedOrderNumber,
116 CooperationContractNumber: good.CooperationContractNumber, 116 CooperationContractNumber: good.CooperationContractNumber,
117 OrderGoodExpense: good.OrderGoodExpense, 117 OrderGoodExpense: good.OrderGoodExpense,
  118 + OrgId: good.OrgId,
  119 + CompanyId: good.CompanyId,
118 CreatedAt: time.Now(), 120 CreatedAt: time.Now(),
119 DeletedAt: time.Time{}, 121 DeletedAt: time.Time{},
120 UpdatedAt: time.Time{}, 122 UpdatedAt: time.Time{},
@@ -206,6 +208,8 @@ func (repository *DividendsReturnedOrderRepository) Save(dividendsReturnedOrder @@ -206,6 +208,8 @@ func (repository *DividendsReturnedOrderRepository) Save(dividendsReturnedOrder
206 DividendsReturnedOrderNumber: goodDomain.DividendsReturnedOrderNumber, 208 DividendsReturnedOrderNumber: goodDomain.DividendsReturnedOrderNumber,
207 CooperationContractNumber: goodDomain.CooperationContractNumber, 209 CooperationContractNumber: goodDomain.CooperationContractNumber,
208 OrderGoodExpense: goodDomain.OrderGoodExpense, 210 OrderGoodExpense: goodDomain.OrderGoodExpense,
  211 + OrgId: goodDomain.OrgId,
  212 + CompanyId: goodDomain.CompanyId,
209 CreatedAt: time.Time{}, 213 CreatedAt: time.Time{},
210 DeletedAt: time.Time{}, 214 DeletedAt: time.Time{},
211 UpdatedAt: time.Now(), 215 UpdatedAt: time.Now(),
@@ -34,6 +34,8 @@ func (repository *OrderGoodRepository) Save(orderGood *domain.OrderGood) (*domai @@ -34,6 +34,8 @@ func (repository *OrderGoodRepository) Save(orderGood *domain.OrderGood) (*domai
34 "dividends_order_number", 34 "dividends_order_number",
35 "cooperation_contract_number", 35 "cooperation_contract_number",
36 "order_good_expense", 36 "order_good_expense",
  37 + "org_id",
  38 + "company_id",
37 "created_at", 39 "created_at",
38 "deleted_at", 40 "deleted_at",
39 "updated_at", 41 "updated_at",
@@ -61,6 +63,8 @@ func (repository *OrderGoodRepository) Save(orderGood *domain.OrderGood) (*domai @@ -61,6 +63,8 @@ func (repository *OrderGoodRepository) Save(orderGood *domain.OrderGood) (*domai
61 &orderGood.DividendsOrderNumber, 63 &orderGood.DividendsOrderNumber,
62 &orderGood.CooperationContractNumber, 64 &orderGood.CooperationContractNumber,
63 &orderGood.OrderGoodExpense, 65 &orderGood.OrderGoodExpense,
  66 + &orderGood.OrgId,
  67 + &orderGood.CompanyId,
64 &orderGood.CreatedAt, 68 &orderGood.CreatedAt,
65 &orderGood.DeletedAt, 69 &orderGood.DeletedAt,
66 &orderGood.UpdatedAt, 70 &orderGood.UpdatedAt,
@@ -74,6 +78,8 @@ func (repository *OrderGoodRepository) Save(orderGood *domain.OrderGood) (*domai @@ -74,6 +78,8 @@ func (repository *OrderGoodRepository) Save(orderGood *domain.OrderGood) (*domai
74 orderGood.DividendsOrderNumber, 78 orderGood.DividendsOrderNumber,
75 orderGood.CooperationContractNumber, 79 orderGood.CooperationContractNumber,
76 orderGood.OrderGoodExpense, 80 orderGood.OrderGoodExpense,
  81 + orderGood.OrgId,
  82 + orderGood.CompanyId,
77 orderGood.CreatedAt, 83 orderGood.CreatedAt,
78 orderGood.DeletedAt, 84 orderGood.DeletedAt,
79 orderGood.UpdatedAt, 85 orderGood.UpdatedAt,
@@ -91,6 +97,8 @@ func (repository *OrderGoodRepository) Save(orderGood *domain.OrderGood) (*domai @@ -91,6 +97,8 @@ func (repository *OrderGoodRepository) Save(orderGood *domain.OrderGood) (*domai
91 &orderGood.DividendsOrderNumber, 97 &orderGood.DividendsOrderNumber,
92 &orderGood.CooperationContractNumber, 98 &orderGood.CooperationContractNumber,
93 &orderGood.OrderGoodExpense, 99 &orderGood.OrderGoodExpense,
  100 + &orderGood.OrgId,
  101 + &orderGood.CompanyId,
94 &orderGood.CreatedAt, 102 &orderGood.CreatedAt,
95 &orderGood.DeletedAt, 103 &orderGood.DeletedAt,
96 &orderGood.UpdatedAt, 104 &orderGood.UpdatedAt,
@@ -104,6 +112,8 @@ func (repository *OrderGoodRepository) Save(orderGood *domain.OrderGood) (*domai @@ -104,6 +112,8 @@ func (repository *OrderGoodRepository) Save(orderGood *domain.OrderGood) (*domai
104 orderGood.DividendsOrderNumber, 112 orderGood.DividendsOrderNumber,
105 orderGood.CooperationContractNumber, 113 orderGood.CooperationContractNumber,
106 orderGood.OrderGoodExpense, 114 orderGood.OrderGoodExpense,
  115 + orderGood.OrgId,
  116 + orderGood.CompanyId,
107 orderGood.CreatedAt, 117 orderGood.CreatedAt,
108 orderGood.DeletedAt, 118 orderGood.DeletedAt,
109 orderGood.UpdatedAt, 119 orderGood.UpdatedAt,
@@ -14,7 +14,6 @@ func (controller *CooperationApplicationController) ApplyForCooperation() { @@ -14,7 +14,6 @@ func (controller *CooperationApplicationController) ApplyForCooperation() {
14 cooperationApplicationService := service.NewCooperationApplicationService(nil) 14 cooperationApplicationService := service.NewCooperationApplicationService(nil)
15 applyForCooperationCommand := &command.ApplyForCooperationCommand{} 15 applyForCooperationCommand := &command.ApplyForCooperationCommand{}
16 _ = controller.Unmarshal(applyForCooperationCommand) 16 _ = controller.Unmarshal(applyForCooperationCommand)
17 - // 解析头部信息  
18 header := controller.GetRequestHeader(controller.Ctx) 17 header := controller.GetRequestHeader(controller.Ctx)
19 applyForCooperationCommand.CompanyId = header.CompanyId 18 applyForCooperationCommand.CompanyId = header.CompanyId
20 applyForCooperationCommand.OrgId = header.OrgId 19 applyForCooperationCommand.OrgId = header.OrgId
@@ -24,31 +23,16 @@ func (controller *CooperationApplicationController) ApplyForCooperation() { @@ -24,31 +23,16 @@ func (controller *CooperationApplicationController) ApplyForCooperation() {
24 controller.Response(data, err) 23 controller.Response(data, err)
25 } 24 }
26 25
27 -func (controller *CooperationApplicationController) AgreeCooperationApplication() { 26 +func (controller *CooperationApplicationController) ApprovalCooperationApplication() {
28 cooperationApplicationService := service.NewCooperationApplicationService(nil) 27 cooperationApplicationService := service.NewCooperationApplicationService(nil)
29 - agreeCooperationApplicationCommand := &command.AgreeCooperationApplicationCommand{} 28 + agreeCooperationApplicationCommand := &command.ApprovalCooperationApplicationCommand{}
30 _ = controller.Unmarshal(agreeCooperationApplicationCommand) 29 _ = controller.Unmarshal(agreeCooperationApplicationCommand)
31 - // 解析头部信息  
32 header := controller.GetRequestHeader(controller.Ctx) 30 header := controller.GetRequestHeader(controller.Ctx)
33 agreeCooperationApplicationCommand.CompanyId = header.CompanyId 31 agreeCooperationApplicationCommand.CompanyId = header.CompanyId
34 agreeCooperationApplicationCommand.OrgId = header.OrgId 32 agreeCooperationApplicationCommand.OrgId = header.OrgId
35 agreeCooperationApplicationCommand.UserId = header.UserId 33 agreeCooperationApplicationCommand.UserId = header.UserId
36 agreeCooperationApplicationCommand.UserBaseId = header.UserBaseId 34 agreeCooperationApplicationCommand.UserBaseId = header.UserBaseId
37 - data, err := cooperationApplicationService.AgreeCooperationApplication(agreeCooperationApplicationCommand)  
38 - controller.Response(data, err)  
39 -}  
40 -  
41 -func (controller *CooperationApplicationController) RejectCooperationApplication() {  
42 - cooperationApplicationService := service.NewCooperationApplicationService(nil)  
43 - rejectCooperationApplicationCommand := &command.RejectCooperationApplicationCommand{}  
44 - _ = controller.Unmarshal(rejectCooperationApplicationCommand)  
45 - // 解析头部信息  
46 - header := controller.GetRequestHeader(controller.Ctx)  
47 - rejectCooperationApplicationCommand.CompanyId = header.CompanyId  
48 - rejectCooperationApplicationCommand.OrgId = header.OrgId  
49 - rejectCooperationApplicationCommand.UserId = header.UserId  
50 - rejectCooperationApplicationCommand.UserBaseId = header.UserBaseId  
51 - data, err := cooperationApplicationService.RejectCooperationApplication(rejectCooperationApplicationCommand) 35 + data, err := cooperationApplicationService.ApprovalCooperationApplication(agreeCooperationApplicationCommand)
52 controller.Response(data, err) 36 controller.Response(data, err)
53 } 37 }
54 38
@@ -56,7 +40,6 @@ func (controller *CooperationContractController) BatchApprovalCooperationApplica @@ -56,7 +40,6 @@ func (controller *CooperationContractController) BatchApprovalCooperationApplica
56 cooperationApplicationService := service.NewCooperationApplicationService(nil) 40 cooperationApplicationService := service.NewCooperationApplicationService(nil)
57 batchApprovalCooperationApplicationCommand := &command.BatchApprovalCooperationApplicationCommand{} 41 batchApprovalCooperationApplicationCommand := &command.BatchApprovalCooperationApplicationCommand{}
58 _ = controller.Unmarshal(batchApprovalCooperationApplicationCommand) 42 _ = controller.Unmarshal(batchApprovalCooperationApplicationCommand)
59 - // 解析头部信息  
60 header := controller.GetRequestHeader(controller.Ctx) 43 header := controller.GetRequestHeader(controller.Ctx)
61 batchApprovalCooperationApplicationCommand.CompanyId = header.CompanyId 44 batchApprovalCooperationApplicationCommand.CompanyId = header.CompanyId
62 batchApprovalCooperationApplicationCommand.OrgId = header.OrgId 45 batchApprovalCooperationApplicationCommand.OrgId = header.OrgId
@@ -70,7 +53,6 @@ func (controller *CooperationApplicationController) CreateCooperationApplication @@ -70,7 +53,6 @@ func (controller *CooperationApplicationController) CreateCooperationApplication
70 cooperationApplicationService := service.NewCooperationApplicationService(nil) 53 cooperationApplicationService := service.NewCooperationApplicationService(nil)
71 createCooperationApplicationCommand := &command.CreateCooperationApplicationCommand{} 54 createCooperationApplicationCommand := &command.CreateCooperationApplicationCommand{}
72 _ = controller.Unmarshal(createCooperationApplicationCommand) 55 _ = controller.Unmarshal(createCooperationApplicationCommand)
73 - // 解析头部信息  
74 header := controller.GetRequestHeader(controller.Ctx) 56 header := controller.GetRequestHeader(controller.Ctx)
75 createCooperationApplicationCommand.CompanyId = header.CompanyId 57 createCooperationApplicationCommand.CompanyId = header.CompanyId
76 createCooperationApplicationCommand.OrgId = header.OrgId 58 createCooperationApplicationCommand.OrgId = header.OrgId
@@ -84,13 +66,11 @@ func (controller *CooperationApplicationController) UpdateCooperationApplication @@ -84,13 +66,11 @@ func (controller *CooperationApplicationController) UpdateCooperationApplication
84 cooperationApplicationService := service.NewCooperationApplicationService(nil) 66 cooperationApplicationService := service.NewCooperationApplicationService(nil)
85 updateCooperationApplicationCommand := &command.UpdateCooperationApplicationCommand{} 67 updateCooperationApplicationCommand := &command.UpdateCooperationApplicationCommand{}
86 _ = controller.Unmarshal(updateCooperationApplicationCommand) 68 _ = controller.Unmarshal(updateCooperationApplicationCommand)
87 - // 解析头部信息  
88 header := controller.GetRequestHeader(controller.Ctx) 69 header := controller.GetRequestHeader(controller.Ctx)
89 updateCooperationApplicationCommand.CompanyId = header.CompanyId 70 updateCooperationApplicationCommand.CompanyId = header.CompanyId
90 updateCooperationApplicationCommand.OrgId = header.OrgId 71 updateCooperationApplicationCommand.OrgId = header.OrgId
91 updateCooperationApplicationCommand.UserId = header.UserId 72 updateCooperationApplicationCommand.UserId = header.UserId
92 updateCooperationApplicationCommand.UserBaseId = header.UserBaseId 73 updateCooperationApplicationCommand.UserBaseId = header.UserBaseId
93 - // 解析路径参数  
94 cooperationApplicationId := controller.GetString(":cooperationApplicationId") 74 cooperationApplicationId := controller.GetString(":cooperationApplicationId")
95 updateCooperationApplicationCommand.CooperationApplicationId = cooperationApplicationId 75 updateCooperationApplicationCommand.CooperationApplicationId = cooperationApplicationId
96 data, err := cooperationApplicationService.UpdateCooperationApplication(updateCooperationApplicationCommand) 76 data, err := cooperationApplicationService.UpdateCooperationApplication(updateCooperationApplicationCommand)
@@ -100,13 +80,11 @@ func (controller *CooperationApplicationController) UpdateCooperationApplication @@ -100,13 +80,11 @@ func (controller *CooperationApplicationController) UpdateCooperationApplication
100 func (controller *CooperationApplicationController) GetCooperationApplication() { 80 func (controller *CooperationApplicationController) GetCooperationApplication() {
101 cooperationApplicationService := service.NewCooperationApplicationService(nil) 81 cooperationApplicationService := service.NewCooperationApplicationService(nil)
102 getCooperationApplicationQuery := &query.GetCooperationApplicationQuery{} 82 getCooperationApplicationQuery := &query.GetCooperationApplicationQuery{}
103 - // 解析头部信息  
104 header := controller.GetRequestHeader(controller.Ctx) 83 header := controller.GetRequestHeader(controller.Ctx)
105 getCooperationApplicationQuery.CompanyId = header.CompanyId 84 getCooperationApplicationQuery.CompanyId = header.CompanyId
106 getCooperationApplicationQuery.OrgId = header.OrgId 85 getCooperationApplicationQuery.OrgId = header.OrgId
107 getCooperationApplicationQuery.UserId = header.UserId 86 getCooperationApplicationQuery.UserId = header.UserId
108 getCooperationApplicationQuery.UserBaseId = header.UserBaseId 87 getCooperationApplicationQuery.UserBaseId = header.UserBaseId
109 - // 解析路劲参数  
110 cooperationApplicationId, _ := controller.GetInt64(":cooperationApplicationId") 88 cooperationApplicationId, _ := controller.GetInt64(":cooperationApplicationId")
111 getCooperationApplicationQuery.CooperationApplicationId = cooperationApplicationId 89 getCooperationApplicationQuery.CooperationApplicationId = cooperationApplicationId
112 data, err := cooperationApplicationService.GetCooperationApplication(getCooperationApplicationQuery) 90 data, err := cooperationApplicationService.GetCooperationApplication(getCooperationApplicationQuery)
@@ -117,13 +95,11 @@ func (controller *CooperationApplicationController) RemoveCooperationApplication @@ -117,13 +95,11 @@ func (controller *CooperationApplicationController) RemoveCooperationApplication
117 cooperationApplicationService := service.NewCooperationApplicationService(nil) 95 cooperationApplicationService := service.NewCooperationApplicationService(nil)
118 removeCooperationApplicationCommand := &command.RemoveCooperationApplicationCommand{} 96 removeCooperationApplicationCommand := &command.RemoveCooperationApplicationCommand{}
119 _ = controller.Unmarshal(removeCooperationApplicationCommand) 97 _ = controller.Unmarshal(removeCooperationApplicationCommand)
120 - // 解析头部信息  
121 header := controller.GetRequestHeader(controller.Ctx) 98 header := controller.GetRequestHeader(controller.Ctx)
122 removeCooperationApplicationCommand.CompanyId = header.CompanyId 99 removeCooperationApplicationCommand.CompanyId = header.CompanyId
123 removeCooperationApplicationCommand.OrgId = header.OrgId 100 removeCooperationApplicationCommand.OrgId = header.OrgId
124 removeCooperationApplicationCommand.UserId = header.UserId 101 removeCooperationApplicationCommand.UserId = header.UserId
125 removeCooperationApplicationCommand.UserBaseId = header.UserBaseId 102 removeCooperationApplicationCommand.UserBaseId = header.UserBaseId
126 - // 解析路径参数  
127 cooperationApplicationId, _ := controller.GetInt64(":cooperationApplicationId") 103 cooperationApplicationId, _ := controller.GetInt64(":cooperationApplicationId")
128 removeCooperationApplicationCommand.CooperationApplicationId = cooperationApplicationId 104 removeCooperationApplicationCommand.CooperationApplicationId = cooperationApplicationId
129 data, err := cooperationApplicationService.RemoveCooperationApplication(removeCooperationApplicationCommand) 105 data, err := cooperationApplicationService.RemoveCooperationApplication(removeCooperationApplicationCommand)
@@ -133,13 +109,11 @@ func (controller *CooperationApplicationController) RemoveCooperationApplication @@ -133,13 +109,11 @@ func (controller *CooperationApplicationController) RemoveCooperationApplication
133 func (controller *CooperationApplicationController) SearchCooperationApplication() { 109 func (controller *CooperationApplicationController) SearchCooperationApplication() {
134 cooperationApplicationService := service.NewCooperationApplicationService(nil) 110 cooperationApplicationService := service.NewCooperationApplicationService(nil)
135 searchCooperationApplicationQuery := &query.SearchCooperationApplicationQuery{} 111 searchCooperationApplicationQuery := &query.SearchCooperationApplicationQuery{}
136 - // 解析头部信息  
137 header := controller.GetRequestHeader(controller.Ctx) 112 header := controller.GetRequestHeader(controller.Ctx)
138 searchCooperationApplicationQuery.CompanyId = header.CompanyId 113 searchCooperationApplicationQuery.CompanyId = header.CompanyId
139 searchCooperationApplicationQuery.OrgId = header.OrgId 114 searchCooperationApplicationQuery.OrgId = header.OrgId
140 searchCooperationApplicationQuery.UserId = header.UserId 115 searchCooperationApplicationQuery.UserId = header.UserId
141 searchCooperationApplicationQuery.UserBaseId = header.UserBaseId 116 searchCooperationApplicationQuery.UserBaseId = header.UserBaseId
142 - // 解析其他参数  
143 pageSize, _ := controller.GetInt64("pageSize") 117 pageSize, _ := controller.GetInt64("pageSize")
144 searchCooperationApplicationQuery.PageSize = pageSize 118 searchCooperationApplicationQuery.PageSize = pageSize
145 pageNumber, _ := controller.GetInt64("pageNumber") 119 pageNumber, _ := controller.GetInt64("pageNumber")
@@ -151,13 +125,11 @@ func (controller *CooperationApplicationController) SearchCooperationApplication @@ -151,13 +125,11 @@ func (controller *CooperationApplicationController) SearchCooperationApplication
151 func (controller *CooperationApplicationController) ListCooperationApplication() { 125 func (controller *CooperationApplicationController) ListCooperationApplication() {
152 cooperationApplicationService := service.NewCooperationApplicationService(nil) 126 cooperationApplicationService := service.NewCooperationApplicationService(nil)
153 listCooperationApplicationQuery := &query.ListCooperationApplicationQuery{} 127 listCooperationApplicationQuery := &query.ListCooperationApplicationQuery{}
154 - // 解析头部信息  
155 header := controller.GetRequestHeader(controller.Ctx) 128 header := controller.GetRequestHeader(controller.Ctx)
156 listCooperationApplicationQuery.CompanyId = header.CompanyId 129 listCooperationApplicationQuery.CompanyId = header.CompanyId
157 listCooperationApplicationQuery.OrgId = header.OrgId 130 listCooperationApplicationQuery.OrgId = header.OrgId
158 listCooperationApplicationQuery.UserId = header.UserId 131 listCooperationApplicationQuery.UserId = header.UserId
159 listCooperationApplicationQuery.UserBaseId = header.UserBaseId 132 listCooperationApplicationQuery.UserBaseId = header.UserBaseId
160 - // 解析其他参数  
161 pageSize, _ := controller.GetInt64("pageSize") 133 pageSize, _ := controller.GetInt64("pageSize")
162 listCooperationApplicationQuery.PageSize = pageSize 134 listCooperationApplicationQuery.PageSize = pageSize
163 pageNumber, _ := controller.GetInt64("pageNumber") 135 pageNumber, _ := controller.GetInt64("pageNumber")
@@ -6,14 +6,13 @@ import ( @@ -6,14 +6,13 @@ import (
6 ) 6 )
7 7
8 func init() { 8 func init() {
9 - web.Router("/cooperation-applications/apply-for-cooperation", &controllers.CooperationApplicationController{}, "Post:ApplyForCooperation") // 申请共创  
10 - web.Router("/cooperation-applications/agree-cooperation-application", &controllers.CooperationApplicationController{}, "Post:AgreeCooperationApplication") // 同意共创申请  
11 - web.Router("/cooperation-applications/reject-cooperation-application", &controllers.CooperationApplicationController{}, "Post:RejectCooperationApplication") // 拒绝共创申请  
12 - web.Router("/cooperation-applications/batch-approval", &controllers.CooperationContractController{}, "Post:BatchApprovalCooperationApplication") // 一键审核  
13 - web.Router("/cooperation-applications/", &controllers.CooperationApplicationController{}, "Post:CreateCooperationApplication") // 新增共创申请  
14 - web.Router("/cooperation-applications/:cooperationApplicationId", &controllers.CooperationApplicationController{}, "Put:UpdateCooperationApplication") // 编辑共创申请  
15 - web.Router("/cooperation-applications/:cooperationApplicationId", &controllers.CooperationApplicationController{}, "Get:GetCooperationApplication") // 获取共创申请详情  
16 - web.Router("/cooperation-applications/:cooperationApplicationId", &controllers.CooperationApplicationController{}, "Delete:RemoveCooperationApplication") // 移除共创申请  
17 - web.Router("/cooperation-applications/search", &controllers.CooperationApplicationController{}, "Post:SearchCooperationApplication") // 搜索返回共创申请列表  
18 - web.Router("/cooperation-applications/", &controllers.CooperationApplicationController{}, "Get:ListCooperationApplication") // 返回共创申请列表 9 + web.Router("/cooperation-applications/apply-for-cooperation", &controllers.CooperationApplicationController{}, "Post:ApplyForCooperation") // 申请共创
  10 + web.Router("/cooperation-applications/agree-cooperation-application", &controllers.CooperationApplicationController{}, "Post:ApprovalCooperationApplication") // 同意共创申请
  11 + web.Router("/cooperation-applications/batch-approval", &controllers.CooperationContractController{}, "Post:BatchApprovalCooperationApplication") // 一键审核
  12 + web.Router("/cooperation-applications/", &controllers.CooperationApplicationController{}, "Post:CreateCooperationApplication") // 新增共创申请
  13 + web.Router("/cooperation-applications/:cooperationApplicationId", &controllers.CooperationApplicationController{}, "Put:UpdateCooperationApplication") // 编辑共创申请
  14 + web.Router("/cooperation-applications/:cooperationApplicationId", &controllers.CooperationApplicationController{}, "Get:GetCooperationApplication") // 获取共创申请详情
  15 + web.Router("/cooperation-applications/:cooperationApplicationId", &controllers.CooperationApplicationController{}, "Delete:RemoveCooperationApplication") // 移除共创申请
  16 + web.Router("/cooperation-applications/search", &controllers.CooperationApplicationController{}, "Post:SearchCooperationApplication") // 搜索返回共创申请列表
  17 + web.Router("/cooperation-applications/", &controllers.CooperationApplicationController{}, "Get:ListCooperationApplication") // 返回共创申请列表
19 } 18 }