作者 陈志颖

fix:修复分红订单产品信息不完整

@@ -705,12 +705,12 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC @@ -705,12 +705,12 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC
705 if err := updateCooperationContractCommand.ValidateCommand(); err != nil { 705 if err := updateCooperationContractCommand.ValidateCommand(); err != nil {
706 return nil, application.ThrowError(application.ARG_ERROR, err.Error()) 706 return nil, application.ThrowError(application.ARG_ERROR, err.Error())
707 } 707 }
708 - transactionContext, err := factory.CreateTransactionContext(nil)  
709 - if err != nil {  
710 - return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 708 + transactionContext, err1 := factory.CreateTransactionContext(nil)
  709 + if err1 != nil {
  710 + return nil, application.ThrowError(application.TRANSACTION_ERROR, err1.Error())
711 } 711 }
712 - if err := transactionContext.StartTransaction(); err != nil {  
713 - return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 712 + if err2 := transactionContext.StartTransaction(); err2 != nil {
  713 + return nil, application.ThrowError(application.TRANSACTION_ERROR, err2.Error())
714 } 714 }
715 defer func() { 715 defer func() {
716 _ = transactionContext.RollbackTransaction() 716 _ = transactionContext.RollbackTransaction()
@@ -718,59 +718,76 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC @@ -718,59 +718,76 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC
718 718
719 // 公司REST服务初始化 719 // 公司REST服务初始化
720 var companyService service.CompanyService 720 var companyService service.CompanyService
721 - if value, err := factory.CreateCompanyService(map[string]interface{}{}); err != nil {  
722 - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 721 + if value, err3 := factory.CreateCompanyService(map[string]interface{}{}); err3 != nil {
  722 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err3.Error())
723 } else { 723 } else {
724 companyService = value 724 companyService = value
725 } 725 }
726 726
727 // 获取公司信息 727 // 获取公司信息
728 var company *domain.Company 728 var company *domain.Company
729 - if data, err := companyService.CompanyFrom(updateCooperationContractCommand.CompanyId); err != nil {  
730 - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 729 + if data, err4 := companyService.CompanyFrom(updateCooperationContractCommand.CompanyId); err4 != nil {
  730 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err4.Error())
731 } else { 731 } else {
732 company = data 732 company = data
733 } 733 }
734 734
735 // 组织机构REST服务初始化 735 // 组织机构REST服务初始化
736 var organizationService service.OrgService 736 var organizationService service.OrgService
737 - if value, err := factory.CreateOrganizationService(map[string]interface{}{}); err != nil {  
738 - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 737 + if value, err5 := factory.CreateOrganizationService(map[string]interface{}{}); err5 != nil {
  738 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err5.Error())
739 } else { 739 } else {
740 organizationService = value 740 organizationService = value
741 } 741 }
742 742
743 // 获取组织机构信息 743 // 获取组织机构信息
744 var organization *domain.Org 744 var organization *domain.Org
745 - if data, err := organizationService.OrgFrom(updateCooperationContractCommand.CompanyId, updateCooperationContractCommand.OrgId); err != nil {  
746 - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 745 + if data, err6 := organizationService.OrgFrom(updateCooperationContractCommand.CompanyId, updateCooperationContractCommand.OrgId); err6 != nil {
  746 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err6.Error())
747 } else { 747 } else {
748 organization = data 748 organization = data
749 } 749 }
750 750
751 - var cooperationContractRepository domain.CooperationContractRepository  
752 - if value, err := factory.CreateCooperationContractRepository(map[string]interface{}{ 751 + // 共创合约变更记录仓储初始化
  752 + var cooperationContractChangeLogRepository domain.CooperationContractChangeLogRepository
  753 + if value, err := factory.CreateCooperationContractChangeLogRepository(map[string]interface{}{
753 "transactionContext": transactionContext, 754 "transactionContext": transactionContext,
754 }); err != nil { 755 }); err != nil {
755 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 756 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
756 } else { 757 } else {
  758 + cooperationContractChangeLogRepository = value
  759 + }
  760 +
  761 + // 共创合约仓储初始化
  762 + var cooperationContractRepository domain.CooperationContractRepository
  763 + if value, err7 := factory.CreateCooperationContractRepository(map[string]interface{}{
  764 + "transactionContext": transactionContext,
  765 + }); err7 != nil {
  766 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err7.Error())
  767 + } else {
757 cooperationContractRepository = value 768 cooperationContractRepository = value
758 } 769 }
759 - cooperationContract, err := cooperationContractRepository.FindOne(map[string]interface{}{"cooperationContractId": updateCooperationContractCommand.CooperationContractId})  
760 - if err != nil {  
761 - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 770 +
  771 + // 获取待更新的共创合约
  772 + cooperationContract, err8 := cooperationContractRepository.FindOne(map[string]interface{}{"cooperationContractId": updateCooperationContractCommand.CooperationContractId})
  773 + if err8 != nil {
  774 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err8.Error())
762 } 775 }
763 if cooperationContract == nil { 776 if cooperationContract == nil {
764 return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", string(updateCooperationContractCommand.CooperationContractId))) 777 return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", string(updateCooperationContractCommand.CooperationContractId)))
765 } 778 }
  779 +
  780 + cooperationContractFound := cooperationContract
  781 +
766 // 更新合约基础信息 782 // 更新合约基础信息
767 - if err := cooperationContract.Update(tool_funs.SimpleStructToMap(updateCooperationContractCommand)); err != nil {  
768 - return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) 783 + if err9 := cooperationContract.Update(tool_funs.SimpleStructToMap(updateCooperationContractCommand)); err9 != nil {
  784 + return nil, application.ThrowError(application.BUSINESS_ERROR, err9.Error())
769 } 785 }
  786 +
770 // 用户REST服务初始化 787 // 用户REST服务初始化
771 var userService service.UserService 788 var userService service.UserService
772 - if value, err := factory.CreateUserService(map[string]interface{}{}); err != nil {  
773 - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 789 + if value, err10 := factory.CreateUserService(map[string]interface{}{}); err10 != nil {
  790 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err10.Error())
774 } else { 791 } else {
775 userService = value 792 userService = value
776 } 793 }
@@ -778,8 +795,8 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC @@ -778,8 +795,8 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC
778 // 获取发起人 795 // 获取发起人
779 var sponsor *domain.User 796 var sponsor *domain.User
780 sponsorUid, _ := strconv.ParseInt(updateCooperationContractCommand.SponsorUid, 10, 64) 797 sponsorUid, _ := strconv.ParseInt(updateCooperationContractCommand.SponsorUid, 10, 64)
781 - if data, err := userService.OperatorFrom(updateCooperationContractCommand.CompanyId, updateCooperationContractCommand.OrgId, sponsorUid); err != nil {  
782 - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 798 + if data, err11 := userService.OperatorFrom(updateCooperationContractCommand.CompanyId, updateCooperationContractCommand.OrgId, sponsorUid); err11 != nil {
  799 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err11.Error())
783 } else { 800 } else {
784 sponsor = data 801 sponsor = data
785 } 802 }
@@ -792,8 +809,8 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC @@ -792,8 +809,8 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC
792 for _, relevantPersonUid := range updateCooperationContractCommand.RelevantPeople { 809 for _, relevantPersonUid := range updateCooperationContractCommand.RelevantPeople {
793 var relevantDomain *domain.Relevant 810 var relevantDomain *domain.Relevant
794 relevantUid, _ := strconv.ParseInt(relevantPersonUid, 10, 64) 811 relevantUid, _ := strconv.ParseInt(relevantPersonUid, 10, 64)
795 - if data, err := userService.RelevantFrom(updateCooperationContractCommand.CompanyId, updateCooperationContractCommand.OrgId, relevantUid); err != nil {  
796 - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 812 + if data, err12 := userService.RelevantFrom(updateCooperationContractCommand.CompanyId, updateCooperationContractCommand.OrgId, relevantUid); err12 != nil {
  813 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err12.Error())
797 } else { 814 } else {
798 relevantDomain = data 815 relevantDomain = data
799 } 816 }
@@ -821,8 +838,8 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC @@ -821,8 +838,8 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC
821 for _, undertaker := range updateCooperationContractCommand.Undertakers { 838 for _, undertaker := range updateCooperationContractCommand.Undertakers {
822 var undertakerDomain *domain.Undertaker 839 var undertakerDomain *domain.Undertaker
823 undertakerUid, _ := strconv.ParseInt(undertaker.UserId, 10, 64) 840 undertakerUid, _ := strconv.ParseInt(undertaker.UserId, 10, 64)
824 - if data, err := userService.UndertakerFrom(updateCooperationContractCommand.CompanyId, updateCooperationContractCommand.OrgId, undertakerUid); err != nil {  
825 - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 841 + if data, err13 := userService.UndertakerFrom(updateCooperationContractCommand.CompanyId, updateCooperationContractCommand.OrgId, undertakerUid); err13 != nil {
  842 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err13.Error())
826 } else { 843 } else {
827 undertakerDomain = data 844 undertakerDomain = data
828 } 845 }
@@ -831,8 +848,8 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC @@ -831,8 +848,8 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC
831 var referrerDomain *domain.Referrer 848 var referrerDomain *domain.Referrer
832 referrerUid, _ := strconv.ParseInt(undertaker.ReferrerId, 10, 64) 849 referrerUid, _ := strconv.ParseInt(undertaker.ReferrerId, 10, 64)
833 if referrerUid > 0 { 850 if referrerUid > 0 {
834 - if data, err := userService.ReferrerFrom(updateCooperationContractCommand.CompanyId, updateCooperationContractCommand.OrgId, referrerUid); err != nil {  
835 - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 851 + if data, err14 := userService.ReferrerFrom(updateCooperationContractCommand.CompanyId, updateCooperationContractCommand.OrgId, referrerUid); err14 != nil {
  852 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err14.Error())
836 } else { 853 } else {
837 referrerDomain = data 854 referrerDomain = data
838 } 855 }
@@ -840,18 +857,21 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC @@ -840,18 +857,21 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC
840 857
841 // 获取业务员 858 // 获取业务员
842 var salesmanDomain *domain.Salesman 859 var salesmanDomain *domain.Salesman
843 - salesmanUid, _ := strconv.ParseInt(undertaker.SalesmanId, 10, 64) 860 + salesmanUid, err22 := strconv.ParseInt(undertaker.SalesmanId, 10, 64)
  861 + if err22 != nil {
  862 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err22.Error())
  863 + }
844 if salesmanUid > 0 { 864 if salesmanUid > 0 {
845 - if data, err := userService.SalesmanFrom(updateCooperationContractCommand.CompanyId, updateCooperationContractCommand.OrgId, salesmanUid); err != nil {  
846 - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 865 + if data, err15 := userService.SalesmanFrom(updateCooperationContractCommand.CompanyId, updateCooperationContractCommand.OrgId, salesmanUid); err15 != nil {
  866 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err15.Error())
847 } else { 867 } else {
848 salesmanDomain = data 868 salesmanDomain = data
849 } 869 }
850 } 870 }
851 871
852 - undertakerId, err3 := strconv.ParseInt(undertaker.UndertakerId, 10, 64)  
853 - if err3 != nil {  
854 - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err3.Error()) 872 + undertakerId, err16 := strconv.ParseInt(undertaker.UndertakerId, 10, 64)
  873 + if err16 != nil {
  874 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err16.Error())
855 } 875 }
856 undertakers = append(undertakers, &domain.Undertaker{ 876 undertakers = append(undertakers, &domain.Undertaker{
857 UndertakerId: undertakerId, 877 UndertakerId: undertakerId,
@@ -877,9 +897,9 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC @@ -877,9 +897,9 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC
877 // 获取分红规则列表 897 // 获取分红规则列表
878 var dividendsIncentivesRules []*domain.DividendsIncentivesRule 898 var dividendsIncentivesRules []*domain.DividendsIncentivesRule
879 for _, dividendsIncentivesRule := range updateCooperationContractCommand.DividendsIncentivesRules { 899 for _, dividendsIncentivesRule := range updateCooperationContractCommand.DividendsIncentivesRules {
880 - dividendsIncentivesRuleId, err2 := strconv.ParseInt(dividendsIncentivesRule.DividendsIncentivesRuleId, 10, 64)  
881 - if err2 != nil {  
882 - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err2.Error()) 900 + dividendsIncentivesRuleId, err17 := strconv.ParseInt(dividendsIncentivesRule.DividendsIncentivesRuleId, 10, 64)
  901 + if err17 != nil {
  902 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err17.Error())
883 } 903 }
884 dividendsIncentivesRules = append(dividendsIncentivesRules, &domain.DividendsIncentivesRule{ 904 dividendsIncentivesRules = append(dividendsIncentivesRules, &domain.DividendsIncentivesRule{
885 DividendsIncentivesRuleId: dividendsIncentivesRuleId, 905 DividendsIncentivesRuleId: dividendsIncentivesRuleId,
@@ -903,9 +923,9 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC @@ -903,9 +923,9 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC
903 // 获取金额激励规则列表 923 // 获取金额激励规则列表
904 var moneyIncentivesRules []*domain.MoneyIncentivesRule 924 var moneyIncentivesRules []*domain.MoneyIncentivesRule
905 for _, moneyIncentivesRule := range updateCooperationContractCommand.MoneyIncentivesRules { 925 for _, moneyIncentivesRule := range updateCooperationContractCommand.MoneyIncentivesRules {
906 - moneyIncentivesRuleId, err4 := strconv.ParseInt(moneyIncentivesRule.MoneyIncentivesRuleId, 10, 64)  
907 - if err4 != nil {  
908 - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err4.Error()) 926 + moneyIncentivesRuleId, err18 := strconv.ParseInt(moneyIncentivesRule.MoneyIncentivesRuleId, 10, 64)
  927 + if err18 != nil {
  928 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err18.Error())
909 } 929 }
910 moneyIncentivesRules = append(moneyIncentivesRules, &domain.MoneyIncentivesRule{ 930 moneyIncentivesRules = append(moneyIncentivesRules, &domain.MoneyIncentivesRule{
911 MoneyIncentivesRuleId: moneyIncentivesRuleId, 931 MoneyIncentivesRuleId: moneyIncentivesRuleId,
@@ -927,13 +947,35 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC @@ -927,13 +947,35 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC
927 // 更新金额激励规则列表 947 // 更新金额激励规则列表
928 cooperationContract.MoneyIncentivesRules = moneyIncentivesRules 948 cooperationContract.MoneyIncentivesRules = moneyIncentivesRules
929 949
930 - if cooperationContract, err := cooperationContractRepository.Save(cooperationContract); err != nil {  
931 - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 950 + // 保存共创合约变更
  951 + if cooperationContractSaved, err19 := cooperationContractRepository.Save(cooperationContract); err19 != nil {
  952 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err19.Error())
932 } else { 953 } else {
933 - if err := transactionContext.CommitTransaction(); err != nil {  
934 - return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 954 + // TODO 保存共创合约变更记录
  955 + var incentivesRule string
  956 + var incentivesRuleDetail string
  957 + if cooperationContractFound.IncentivesType != cooperationContractSaved.IncentivesType { // 1.激励规则变更
  958 +
935 } 959 }
936 - return cooperationContract, nil 960 +
  961 + newCooperationContractChangeLog := &domain.CooperationContractChangeLog{
  962 + IncentivesRule: incentivesRule,
  963 + IncentivesRuleDetail: incentivesRuleDetail,
  964 + OperationType: 0,
  965 + Undertakers: "",
  966 + CooperationContractNumber: cooperationContractSaved.CooperationContractNumber,
  967 + Company: company,
  968 + Operator: nil,
  969 + UpdatedAt: time.Time{},
  970 + CreatedAt: time.Now(),
  971 + }
  972 + if _, err20 := cooperationContractChangeLogRepository.Save(newCooperationContractChangeLog); err20 != nil {
  973 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err20.Error())
  974 + }
  975 + if err21 := transactionContext.CommitTransaction(); err21 != nil {
  976 + return nil, application.ThrowError(application.TRANSACTION_ERROR, err21.Error())
  977 + }
  978 + return cooperationContractSaved, nil
937 } 979 }
938 } 980 }
939 981
@@ -65,6 +65,16 @@ func (cooperationContractChangeLogService *CooperationContractChangeLogService) @@ -65,6 +65,16 @@ func (cooperationContractChangeLogService *CooperationContractChangeLogService)
65 operator = data 65 operator = data
66 } 66 }
67 67
  68 + // 共创合约变更记录仓储初始化
  69 + var cooperationContractChangeLogRepository domain.CooperationContractChangeLogRepository
  70 + if value, err := factory.CreateCooperationContractChangeLogRepository(map[string]interface{}{
  71 + "transactionContext": transactionContext,
  72 + }); err != nil {
  73 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  74 + } else {
  75 + cooperationContractChangeLogRepository = value
  76 + }
  77 +
68 newCooperationContractChangeLog := &domain.CooperationContractChangeLog{ 78 newCooperationContractChangeLog := &domain.CooperationContractChangeLog{
69 IncentivesRule: createCooperationContractChangeLogCommand.IncentivesRule, 79 IncentivesRule: createCooperationContractChangeLogCommand.IncentivesRule,
70 IncentivesRuleDetail: createCooperationContractChangeLogCommand.IncentivesRuleDetail, 80 IncentivesRuleDetail: createCooperationContractChangeLogCommand.IncentivesRuleDetail,
@@ -77,14 +87,7 @@ func (cooperationContractChangeLogService *CooperationContractChangeLogService) @@ -77,14 +87,7 @@ func (cooperationContractChangeLogService *CooperationContractChangeLogService)
77 DeletedAt: time.Time{}, 87 DeletedAt: time.Time{},
78 CreatedAt: time.Now(), 88 CreatedAt: time.Now(),
79 } 89 }
80 - var cooperationContractChangeLogRepository domain.CooperationContractChangeLogRepository  
81 - if value, err := factory.CreateCooperationContractChangeLogRepository(map[string]interface{}{  
82 - "transactionContext": transactionContext,  
83 - }); err != nil {  
84 - return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())  
85 - } else {  
86 - cooperationContractChangeLogRepository = value  
87 - } 90 +
88 if cooperationContractChangeLog, err := cooperationContractChangeLogRepository.Save(newCooperationContractChangeLog); err != nil { 91 if cooperationContractChangeLog, err := cooperationContractChangeLogRepository.Save(newCooperationContractChangeLog); err != nil {
89 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 92 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
90 } else { 93 } else {
@@ -126,8 +126,8 @@ func (dividendsOrderService *DividendsOrderService) CreateDividendsOrder(createD @@ -126,8 +126,8 @@ func (dividendsOrderService *DividendsOrderService) CreateDividendsOrder(createD
126 DividendsReturnedOrderNumber: "", 126 DividendsReturnedOrderNumber: "",
127 CooperationContractNumber: orderGood.CooperationContractNumber, 127 CooperationContractNumber: orderGood.CooperationContractNumber,
128 OrderGoodExpense: orderGood.OrderGoodExpense, 128 OrderGoodExpense: orderGood.OrderGoodExpense,
129 - OrgId: organization.OrgId,  
130 - CompanyId: company.CompanyId, 129 + OrgId: createDividendsOrderCommand.OrgId,
  130 + CompanyId: createDividendsOrderCommand.CompanyId,
131 CreatedAt: time.Time{}, 131 CreatedAt: time.Time{},
132 DeletedAt: time.Time{}, 132 DeletedAt: time.Time{},
133 UpdatedAt: time.Time{}, 133 UpdatedAt: time.Time{},
@@ -148,7 +148,7 @@ func (dividendsOrderService *DividendsOrderService) CreateDividendsOrder(createD @@ -148,7 +148,7 @@ func (dividendsOrderService *DividendsOrderService) CreateDividendsOrder(createD
148 DividendsOrderAmount: dividendsOrderAmount, 148 DividendsOrderAmount: dividendsOrderAmount,
149 OrderTime: orderTime, 149 OrderTime: orderTime,
150 DividendTime: time.Time{}, 150 DividendTime: time.Time{},
151 - DividendStatus: 0, 151 + DividendStatus: domain.TO_BE_DIVIDEND,
152 Region: &domain.RegionInfo{ 152 Region: &domain.RegionInfo{
153 RegionNumber: "", 153 RegionNumber: "",
154 RegionName: createDividendsOrderCommand.RegionName, 154 RegionName: createDividendsOrderCommand.RegionName,
@@ -121,8 +121,8 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) CreateDivide @@ -121,8 +121,8 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) CreateDivide
121 DividendsReturnedOrderNumber: dividendsReturnedOrderNumber, 121 DividendsReturnedOrderNumber: dividendsReturnedOrderNumber,
122 CooperationContractNumber: orderGood.CooperationContractNumber, 122 CooperationContractNumber: orderGood.CooperationContractNumber,
123 OrderGoodExpense: 0, 123 OrderGoodExpense: 0,
124 - OrgId: organization.OrgId,  
125 - CompanyId: company.CompanyId, 124 + OrgId: createDividendsReturnedOrderCommand.OrgId,
  125 + CompanyId: createDividendsReturnedOrderCommand.CompanyId,
126 CreatedAt: time.Now(), 126 CreatedAt: time.Now(),
127 DeletedAt: time.Time{}, 127 DeletedAt: time.Time{},
128 UpdatedAt: time.Time{}, 128 UpdatedAt: time.Time{},
@@ -142,7 +142,7 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) CreateDivide @@ -142,7 +142,7 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) CreateDivide
142 }, 142 },
143 Goods: orderGoods, 143 Goods: orderGoods,
144 Remarks: createDividendsReturnedOrderCommand.Remarks, 144 Remarks: createDividendsReturnedOrderCommand.Remarks,
145 - DividendStatus: 1, 145 + DividendStatus: domain.TO_BE_DIVIDENDED,
146 DividendTime: time.Time{}, 146 DividendTime: time.Time{},
147 Org: organization, 147 Org: organization,
148 Company: company, 148 Company: company,
@@ -2,6 +2,12 @@ package domain @@ -2,6 +2,12 @@ package domain
2 2
3 import "time" 3 import "time"
4 4
  5 +const (
  6 + TO_BE_DIVIDEND = iota + 1
  7 + ALL_DIVIDENDED
  8 + PART_DIVIDENDED
  9 +)
  10 +
5 // DividendsOrder 分红订单实体 11 // DividendsOrder 分红订单实体
6 type DividendsOrder struct { 12 type DividendsOrder struct {
7 // 分红订单ID 13 // 分红订单ID