Merge branch 'dev' of http://gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway into dev
正在显示
18 个修改的文件
包含
157 行增加
和
88 行删除
| @@ -25,7 +25,7 @@ type CreateCooperationContractCommand struct { | @@ -25,7 +25,7 @@ type CreateCooperationContractCommand struct { | ||
| 25 | // 共创模式编码, | 25 | // 共创模式编码, |
| 26 | CooperationModeNumber string `json:"cooperationModeNumber"` | 26 | CooperationModeNumber string `json:"cooperationModeNumber"` |
| 27 | // 共创合约发起人uid | 27 | // 共创合约发起人uid |
| 28 | - SponsorUid string `json:"sponsorUid"` | 28 | + SponsorUserId string `json:"sponsorUserId"` |
| 29 | } `json:"cooperationContract"` | 29 | } `json:"cooperationContract"` |
| 30 | // 业绩分红激励规则列表 | 30 | // 业绩分红激励规则列表 |
| 31 | DividendsIncentivesRules []struct { | 31 | DividendsIncentivesRules []struct { |
| @@ -63,9 +63,10 @@ type CreateCooperationContractCommand struct { | @@ -63,9 +63,10 @@ type CreateCooperationContractCommand struct { | ||
| 63 | } `json:"moneyIncentivesRules"` | 63 | } `json:"moneyIncentivesRules"` |
| 64 | // 承接方列表 | 64 | // 承接方列表 |
| 65 | Undertakers []struct { | 65 | Undertakers []struct { |
| 66 | - UndertakerId string `json:"undertakerId"` //承接人用户id | ||
| 67 | - RerferrerId string `json:"rerferrerId"` //推荐人用户id | ||
| 68 | - SalesmanId string `json:"salesmanId"` //关联业务员id | 66 | + UndertakerId int `json:"undertakerId,string"` //承接人列表id |
| 67 | + UserId int `json:"userId,string"` //用户的id | ||
| 68 | + RerferrerId int `json:"rerferrerId,string"` //推荐人用户id | ||
| 69 | + SalesmanId int `json:"salesmanId,string"` //关联业务员id | ||
| 69 | Attachment []domain.Attachment `json:"attachment"` | 70 | Attachment []domain.Attachment `json:"attachment"` |
| 70 | } `json:"undertakers"` | 71 | } `json:"undertakers"` |
| 71 | //关联业务员 | 72 | //关联业务员 |
| @@ -13,7 +13,7 @@ type EnableCooperationContractCommand struct { | @@ -13,7 +13,7 @@ type EnableCooperationContractCommand struct { | ||
| 13 | // 共创合约ID | 13 | // 共创合约ID |
| 14 | CooperationContractId []string `json:"cooperationContractId" valid:"Required"` | 14 | CooperationContractId []string `json:"cooperationContractId" valid:"Required"` |
| 15 | // 暂停和恢复的状态 | 15 | // 暂停和恢复的状态 |
| 16 | - Status int `json:"status,omitempty"` | 16 | + Status int `json:"status"` //暂停或恢复合约动作,1恢复,2暂停 |
| 17 | } | 17 | } |
| 18 | 18 | ||
| 19 | func (enableCooperationContractCommand *EnableCooperationContractCommand) Valid(validation *validation.Validation) { | 19 | func (enableCooperationContractCommand *EnableCooperationContractCommand) Valid(validation *validation.Validation) { |
| @@ -27,7 +27,7 @@ type UpdateCooperationContractCommand struct { | @@ -27,7 +27,7 @@ type UpdateCooperationContractCommand struct { | ||
| 27 | // 共创模式编码, | 27 | // 共创模式编码, |
| 28 | CooperationModeNumber string `json:"cooperationModeNumber"` | 28 | CooperationModeNumber string `json:"cooperationModeNumber"` |
| 29 | // 共创合约发起人uid | 29 | // 共创合约发起人uid |
| 30 | - SponsorUid string `json:"sponsorUid"` | 30 | + SponsorUserId string `json:"sponsorUserId"` |
| 31 | } `json:"cooperationContract"` | 31 | } `json:"cooperationContract"` |
| 32 | // 业绩分红激励规则列表 | 32 | // 业绩分红激励规则列表 |
| 33 | DividendsIncentivesRules []struct { | 33 | DividendsIncentivesRules []struct { |
| @@ -38,13 +38,13 @@ type UpdateCooperationContractCommand struct { | @@ -38,13 +38,13 @@ type UpdateCooperationContractCommand struct { | ||
| 38 | // 业务员抽成比例 | 38 | // 业务员抽成比例 |
| 39 | SalesmanPercentage float64 `json:"salesmanPercentage"` | 39 | SalesmanPercentage float64 `json:"salesmanPercentage"` |
| 40 | // 分红规则激励百分点 | 40 | // 分红规则激励百分点 |
| 41 | - DividendsIncentivesPercentage float64 `json:"dividendsIncentivesPercentage"` | 41 | + DividendsPercentage float64 `json:"dividendsPercentage"` |
| 42 | // 分红规则激励阶段, | 42 | // 分红规则激励阶段, |
| 43 | - DividendsIncentivesStage int `json:"dividendsIncentivesStage,string,"` | 43 | + DividendsStage int `json:"dividendsStage"` |
| 44 | // 分红规则激励阶段结束 | 44 | // 分红规则激励阶段结束 |
| 45 | - DividendsIncentivesStageEnd int `json:"dividendsIncentivesStageEnd"` | 45 | + DividendsStageEnd int `json:"dividendsStageEnd"` |
| 46 | // 分红规则激励阶段开始 | 46 | // 分红规则激励阶段开始 |
| 47 | - DividendsIncentivesStageStart int `json:"dividendsIncentivesStageStart"` | 47 | + DividendsStageStart int `json:"dividendsStageStart"` |
| 48 | } `json:"dividendsIncentivesRules"` | 48 | } `json:"dividendsIncentivesRules"` |
| 49 | // 金额激励规则列表 | 49 | // 金额激励规则列表 |
| 50 | MoneyIncentivesRules []struct { | 50 | MoneyIncentivesRules []struct { |
| @@ -65,9 +65,10 @@ type UpdateCooperationContractCommand struct { | @@ -65,9 +65,10 @@ type UpdateCooperationContractCommand struct { | ||
| 65 | } `json:"moneyIncentivesRules"` | 65 | } `json:"moneyIncentivesRules"` |
| 66 | // 承接方列表 | 66 | // 承接方列表 |
| 67 | Undertakers []struct { | 67 | Undertakers []struct { |
| 68 | - UndertakerId string `json:"undertakerId"` //承接人用户id | ||
| 69 | - RerferrerId string `json:"rerferrerId"` //推荐人用户id | ||
| 70 | - SalesmanId string `json:"salesmanId"` //关联业务员id | 68 | + UndertakerId int `json:"undertakerId,string"` //承接人列表id |
| 69 | + UserId int `json:"userId,string"` //用户id | ||
| 70 | + RerferrerId int `json:"rerferrerId,string"` //推荐人用户id | ||
| 71 | + SalesmanId int `json:"salesmanId,string"` //关联业务员id | ||
| 71 | Attachment []domain.Attachment `json:"attachment"` | 72 | Attachment []domain.Attachment `json:"attachment"` |
| 72 | } `json:"undertakers"` | 73 | } `json:"undertakers"` |
| 73 | //关联业务员 | 74 | //关联业务员 |
| @@ -9,9 +9,9 @@ type CooperationContractItem struct { | @@ -9,9 +9,9 @@ type CooperationContractItem struct { | ||
| 9 | CooperationContractId int `json:"cooperationContractId,string,"` | 9 | CooperationContractId int `json:"cooperationContractId,string,"` |
| 10 | CooperationContractNumber string `json:"cooperationContractNumber"` //合约编号 | 10 | CooperationContractNumber string `json:"cooperationContractNumber"` //合约编号 |
| 11 | CooperationProjectNumber string `json:"cooperationProjectNumber"` //项目编号 | 11 | CooperationProjectNumber string `json:"cooperationProjectNumber"` //项目编号 |
| 12 | - CooperationContractName string `json:"CooperationContractName"` //合约名称 | 12 | + CooperationContractName string `json:"cooperationContractName"` //合约名称 |
| 13 | Status int `json:"status"` //合约状态 | 13 | Status int `json:"status"` //合约状态 |
| 14 | - CreateTtime int `json:"createTtime"` | 14 | + CreateTime int `json:"createTime"` |
| 15 | Department domain.Department `json:"department"` | 15 | Department domain.Department `json:"department"` |
| 16 | IncentivesType string `json:"incentivesType"` //Incentives激励方式 | 16 | IncentivesType string `json:"incentivesType"` //Incentives激励方式 |
| 17 | CooperationContractSponsor struct { | 17 | CooperationContractSponsor struct { |
| @@ -20,16 +20,24 @@ type CooperationContractItem struct { | @@ -20,16 +20,24 @@ type CooperationContractItem struct { | ||
| 20 | } `json:"cooperationContractSponsor"` //共创发起人 | 20 | } `json:"cooperationContractSponsor"` //共创发起人 |
| 21 | CooperationMode domain.CooperationMode `json:"cooperationMode"` //共创模式 | 21 | CooperationMode domain.CooperationMode `json:"cooperationMode"` //共创模式 |
| 22 | Org domain.Org `json:"org"` //组织结构 | 22 | Org domain.Org `json:"org"` //组织结构 |
| 23 | + CooperationContractUndertakerType []int `json:"cooperationContractUndertakerType"` //共创合约承接对象,1员工,2共创用户,3公开 | ||
| 24 | + CooperationContractDescription string `json:"cooperationContractDescription"` //合约描述 | ||
| 23 | } | 25 | } |
| 24 | 26 | ||
| 25 | func ToCooperationContractItem(param *allied_creation_cooperation.CooperationContract) *CooperationContractItem { | 27 | func ToCooperationContractItem(param *allied_creation_cooperation.CooperationContract) *CooperationContractItem { |
| 28 | + cooperationContractUndertakerType := param.CooperationContractUndertakerTypes | ||
| 29 | + if len(cooperationContractUndertakerType) == 0 { | ||
| 30 | + cooperationContractUndertakerType = []int{} | ||
| 31 | + } | ||
| 26 | data := CooperationContractItem{ | 32 | data := CooperationContractItem{ |
| 33 | + CooperationContractUndertakerType: cooperationContractUndertakerType, | ||
| 34 | + CooperationContractDescription: param.CooperationContractDescription, | ||
| 27 | CooperationContractId: param.CooperationContractId, | 35 | CooperationContractId: param.CooperationContractId, |
| 28 | CooperationProjectNumber: param.CooperationContractNumber, | 36 | CooperationProjectNumber: param.CooperationContractNumber, |
| 29 | CooperationContractName: param.CooperationContractName, | 37 | CooperationContractName: param.CooperationContractName, |
| 30 | CooperationContractNumber: param.CooperationContractNumber, | 38 | CooperationContractNumber: param.CooperationContractNumber, |
| 31 | Status: param.Status, | 39 | Status: param.Status, |
| 32 | - CreateTtime: int(param.CreatedAt.Unix()), | 40 | + CreateTime: int(param.CreatedAt.UnixNano() / 1e6), |
| 33 | } | 41 | } |
| 34 | data.CooperationContractSponsor.UserId = param.CooperationContractSponsor.UserId | 42 | data.CooperationContractSponsor.UserId = param.CooperationContractSponsor.UserId |
| 35 | data.CooperationContractSponsor.UserName = param.CooperationContractSponsor.UserInfo.UserName | 43 | data.CooperationContractSponsor.UserName = param.CooperationContractSponsor.UserInfo.UserName |
| @@ -76,6 +84,7 @@ type Relevant struct { | @@ -76,6 +84,7 @@ type Relevant struct { | ||
| 76 | } | 84 | } |
| 77 | 85 | ||
| 78 | type ContractUndertaker struct { | 86 | type ContractUndertaker struct { |
| 87 | + UndertakerId int `json:"undertakerId,string"` | ||
| 79 | Attachment []domain.Attachment `json:"attachment"` | 88 | Attachment []domain.Attachment `json:"attachment"` |
| 80 | Department domain.Department `json:"department"` | 89 | Department domain.Department `json:"department"` |
| 81 | HasReferrer bool `json:"hasReferrer"` | 90 | HasReferrer bool `json:"hasReferrer"` |
| @@ -90,6 +99,7 @@ type CooperationContractInfo struct { | @@ -90,6 +99,7 @@ type CooperationContractInfo struct { | ||
| 90 | DividendsIncentivesRules []DividendsIncentivesRule `json:"dividendsIncentivesRules"` | 99 | DividendsIncentivesRules []DividendsIncentivesRule `json:"dividendsIncentivesRules"` |
| 91 | MoneyIncentivesRules []MoneyIncentivesRule `json:"moneyIncentivesRules"` | 100 | MoneyIncentivesRules []MoneyIncentivesRule `json:"moneyIncentivesRules"` |
| 92 | ContractUndertaker []ContractUndertaker `json:"contractUndertaker"` | 101 | ContractUndertaker []ContractUndertaker `json:"contractUndertaker"` |
| 102 | + UndertakerTypesUncheckedAvailable []int `json:"undertakerTypesUncheckedAvailable"` // 可以去除勾选的共创项目承接对象列表 | ||
| 93 | } | 103 | } |
| 94 | 104 | ||
| 95 | func ToCooperationContractInfo(param *allied_creation_cooperation.CooperationContract) *CooperationContractInfo { | 105 | func ToCooperationContractInfo(param *allied_creation_cooperation.CooperationContract) *CooperationContractInfo { |
| @@ -122,8 +132,8 @@ func ToCooperationContractInfo(param *allied_creation_cooperation.CooperationCon | @@ -122,8 +132,8 @@ func ToCooperationContractInfo(param *allied_creation_cooperation.CooperationCon | ||
| 122 | SalesmanPercentage: v.SalesmanPercentage, | 132 | SalesmanPercentage: v.SalesmanPercentage, |
| 123 | DividendsIncentivesPercentage: v.DividendsIncentivesPercentage, | 133 | DividendsIncentivesPercentage: v.DividendsIncentivesPercentage, |
| 124 | DividendsIncentivesStage: v.DividendsIncentivesStage, | 134 | DividendsIncentivesStage: v.DividendsIncentivesStage, |
| 125 | - DividendsIncentivesStageEnd: v.DividendsIncentivesStageEnd.Unix(), | ||
| 126 | - DividendsIncentivesStageStart: v.DividendsIncentivesStageStart.Unix(), | 135 | + DividendsIncentivesStageEnd: v.DividendsIncentivesStageEnd.UnixNano() / 1e6, |
| 136 | + DividendsIncentivesStageStart: v.DividendsIncentivesStageStart.UnixNano() / 1e6, | ||
| 127 | } | 137 | } |
| 128 | dividendsIncentivesRules = append(dividendsIncentivesRules, r) | 138 | dividendsIncentivesRules = append(dividendsIncentivesRules, r) |
| 129 | } | 139 | } |
| @@ -134,7 +144,7 @@ func ToCooperationContractInfo(param *allied_creation_cooperation.CooperationCon | @@ -134,7 +144,7 @@ func ToCooperationContractInfo(param *allied_creation_cooperation.CooperationCon | ||
| 134 | CooperationContractNumber: v.CooperationContractNumber, | 144 | CooperationContractNumber: v.CooperationContractNumber, |
| 135 | MoneyIncentivesAmount: v.MoneyIncentivesAmount, | 145 | MoneyIncentivesAmount: v.MoneyIncentivesAmount, |
| 136 | MoneyIncentivesStage: v.MoneyIncentivesStage, | 146 | MoneyIncentivesStage: v.MoneyIncentivesStage, |
| 137 | - MoneyIncentivesTime: v.MoneyIncentivesTime.Unix(), | 147 | + MoneyIncentivesTime: v.MoneyIncentivesTime.UnixNano() / 1e6, |
| 138 | ReferrerPercentage: v.ReferrerPercentage, | 148 | ReferrerPercentage: v.ReferrerPercentage, |
| 139 | SalesmanPercentage: v.SalesmanPercentage, | 149 | SalesmanPercentage: v.SalesmanPercentage, |
| 140 | } | 150 | } |
| @@ -162,6 +172,7 @@ func ToCooperationContractInfo(param *allied_creation_cooperation.CooperationCon | @@ -162,6 +172,7 @@ func ToCooperationContractInfo(param *allied_creation_cooperation.CooperationCon | ||
| 162 | UsersId: v.Salesman.UserId, | 172 | UsersId: v.Salesman.UserId, |
| 163 | Phone: v.Salesman.UserInfo.UserPhone, | 173 | Phone: v.Salesman.UserInfo.UserPhone, |
| 164 | }, | 174 | }, |
| 175 | + UndertakerId: v.UndertakerId, | ||
| 165 | UserInfo: domain.UserInfo{ | 176 | UserInfo: domain.UserInfo{ |
| 166 | UsersName: v.UserInfo.UserName, | 177 | UsersName: v.UserInfo.UserName, |
| 167 | UsersId: v.UserId, | 178 | UsersId: v.UserId, |
| @@ -170,12 +181,17 @@ func ToCooperationContractInfo(param *allied_creation_cooperation.CooperationCon | @@ -170,12 +181,17 @@ func ToCooperationContractInfo(param *allied_creation_cooperation.CooperationCon | ||
| 170 | } | 181 | } |
| 171 | contractUndertaker = append(contractUndertaker, u) | 182 | contractUndertaker = append(contractUndertaker, u) |
| 172 | } | 183 | } |
| 184 | + undertakerTypesUncheckedAvailable := param.UndertakerTypesUncheckedAvailable | ||
| 185 | + if len(undertakerTypesUncheckedAvailable) == 0 { | ||
| 186 | + undertakerTypesUncheckedAvailable = []int{} | ||
| 187 | + } | ||
| 173 | data := CooperationContractInfo{ | 188 | data := CooperationContractInfo{ |
| 174 | CooperationContract: *ToCooperationContractItem(param), | 189 | CooperationContract: *ToCooperationContractItem(param), |
| 175 | Relevant: relevants, | 190 | Relevant: relevants, |
| 176 | DividendsIncentivesRules: dividendsIncentivesRules, | 191 | DividendsIncentivesRules: dividendsIncentivesRules, |
| 177 | MoneyIncentivesRules: moneyIncentivesRules, | 192 | MoneyIncentivesRules: moneyIncentivesRules, |
| 178 | ContractUndertaker: contractUndertaker, | 193 | ContractUndertaker: contractUndertaker, |
| 194 | + UndertakerTypesUncheckedAvailable: undertakerTypesUncheckedAvailable, | ||
| 179 | } | 195 | } |
| 180 | return &data | 196 | return &data |
| 181 | 197 |
| @@ -50,13 +50,14 @@ func (cooperationContractService *CooperationContractService) CreateCooperationC | @@ -50,13 +50,14 @@ func (cooperationContractService *CooperationContractService) CreateCooperationC | ||
| 50 | for _, v := range createCooperationContractCommand.Undertakers { | 50 | for _, v := range createCooperationContractCommand.Undertakers { |
| 51 | u := allied_creation_cooperation.Undertaker{ | 51 | u := allied_creation_cooperation.Undertaker{ |
| 52 | UndertakerId: v.UndertakerId, | 52 | UndertakerId: v.UndertakerId, |
| 53 | - RerferrerId: v.RerferrerId, | 53 | + UserId: v.UserId, |
| 54 | + ReferrerId: v.RerferrerId, | ||
| 54 | SalesmanId: v.SalesmanId, | 55 | SalesmanId: v.SalesmanId, |
| 55 | Attachment: v.Attachment, | 56 | Attachment: v.Attachment, |
| 56 | } | 57 | } |
| 57 | underTakers = append(underTakers, u) | 58 | underTakers = append(underTakers, u) |
| 58 | } | 59 | } |
| 59 | - _, err := creationCooperationGateway.CooperationContractAdd(allied_creation_cooperation.ReqCooperationContractAdd{ | 60 | + result, err := creationCooperationGateway.CooperationContractAdd(allied_creation_cooperation.ReqCooperationContractAdd{ |
| 60 | MoneyIncentivesRules: rules2, | 61 | MoneyIncentivesRules: rules2, |
| 61 | DividendsIncentivesRules: rules1, | 62 | DividendsIncentivesRules: rules1, |
| 62 | Undertakers: underTakers, | 63 | Undertakers: underTakers, |
| @@ -67,7 +68,7 @@ func (cooperationContractService *CooperationContractService) CreateCooperationC | @@ -67,7 +68,7 @@ func (cooperationContractService *CooperationContractService) CreateCooperationC | ||
| 67 | CooperationContractUndertakerType: createCooperationContractCommand.CooperationContract.CooperationContractUndertakerType, | 68 | CooperationContractUndertakerType: createCooperationContractCommand.CooperationContract.CooperationContractUndertakerType, |
| 68 | CooperationContractName: createCooperationContractCommand.CooperationContract.CooperationContractName, | 69 | CooperationContractName: createCooperationContractCommand.CooperationContract.CooperationContractName, |
| 69 | CooperationModeNumber: createCooperationContractCommand.CooperationContract.CooperationModeNumber, | 70 | CooperationModeNumber: createCooperationContractCommand.CooperationContract.CooperationModeNumber, |
| 70 | - SponsorUid: createCooperationContractCommand.CooperationContract.SponsorUid, | 71 | + SponsorUid: createCooperationContractCommand.CooperationContract.SponsorUserId, |
| 71 | CompanyId: int(createCooperationContractCommand.Operator.CompanyId), | 72 | CompanyId: int(createCooperationContractCommand.Operator.CompanyId), |
| 72 | UserId: int(createCooperationContractCommand.Operator.UserId), | 73 | UserId: int(createCooperationContractCommand.Operator.UserId), |
| 73 | UserBaseId: int(createCooperationContractCommand.Operator.UserBaseId), | 74 | UserBaseId: int(createCooperationContractCommand.Operator.UserBaseId), |
| @@ -76,7 +77,7 @@ func (cooperationContractService *CooperationContractService) CreateCooperationC | @@ -76,7 +77,7 @@ func (cooperationContractService *CooperationContractService) CreateCooperationC | ||
| 76 | if err != nil { | 77 | if err != nil { |
| 77 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | 78 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) |
| 78 | } | 79 | } |
| 79 | - return createCooperationContractCommand, err | 80 | + return dto.ToCooperationContractInfo(&result.CooperationContract), err |
| 80 | } | 81 | } |
| 81 | 82 | ||
| 82 | // 暂停恢复共创合约 | 83 | // 暂停恢复共创合约 |
| @@ -84,8 +85,15 @@ func (cooperationContractService *CooperationContractService) EnableCooperationC | @@ -84,8 +85,15 @@ func (cooperationContractService *CooperationContractService) EnableCooperationC | ||
| 84 | if err := enableCooperationContractCommand.ValidateCommand(); err != nil { | 85 | if err := enableCooperationContractCommand.ValidateCommand(); err != nil { |
| 85 | return nil, application.ThrowError(application.ARG_ERROR, err.Error()) | 86 | return nil, application.ThrowError(application.ARG_ERROR, err.Error()) |
| 86 | } | 87 | } |
| 87 | - | ||
| 88 | - return nil, nil | 88 | + creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(enableCooperationContractCommand.Operator) |
| 89 | + _, err := creationCooperationGateway.CooperationContractsBatchOperate(allied_creation_cooperation.ReqCooperationContractsBatchOperate{ | ||
| 90 | + CooperationContractIds: enableCooperationContractCommand.CooperationContractId, | ||
| 91 | + Action: enableCooperationContractCommand.Status, | ||
| 92 | + }) | ||
| 93 | + if err != nil { | ||
| 94 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
| 95 | + } | ||
| 96 | + return enableCooperationContractCommand, nil | ||
| 89 | } | 97 | } |
| 90 | 98 | ||
| 91 | // 返回共创合约详情 | 99 | // 返回共创合约详情 |
| @@ -141,10 +149,10 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC | @@ -141,10 +149,10 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC | ||
| 141 | CooperationContractNumber: v.CooperationContractNumber, | 149 | CooperationContractNumber: v.CooperationContractNumber, |
| 142 | ReferrerPercentage: v.ReferrerPercentage, | 150 | ReferrerPercentage: v.ReferrerPercentage, |
| 143 | SalesmanPercentage: v.SalesmanPercentage, | 151 | SalesmanPercentage: v.SalesmanPercentage, |
| 144 | - DividendsIncentivesPercentage: v.DividendsIncentivesPercentage, | ||
| 145 | - DividendsIncentivesStage: v.DividendsIncentivesStage, | ||
| 146 | - DividendsIncentivesStageEnd: time.Unix(int64(v.DividendsIncentivesStageEnd/1e3), 0), | ||
| 147 | - DividendsIncentivesStageStart: time.Unix(int64(v.DividendsIncentivesStageStart/1e3), 0), | 152 | + DividendsIncentivesPercentage: v.DividendsPercentage, |
| 153 | + DividendsIncentivesStage: v.DividendsStage, | ||
| 154 | + DividendsIncentivesStageEnd: time.Unix(int64(v.DividendsStageEnd/1e3), 0), | ||
| 155 | + DividendsIncentivesStageStart: time.Unix(int64(v.DividendsStageStart/1e3), 0), | ||
| 148 | } | 156 | } |
| 149 | rules1 = append(rules1, r) | 157 | rules1 = append(rules1, r) |
| 150 | } | 158 | } |
| @@ -165,13 +173,14 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC | @@ -165,13 +173,14 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC | ||
| 165 | for _, v := range updateCooperationContractCommand.Undertakers { | 173 | for _, v := range updateCooperationContractCommand.Undertakers { |
| 166 | u := allied_creation_cooperation.Undertaker{ | 174 | u := allied_creation_cooperation.Undertaker{ |
| 167 | UndertakerId: v.UndertakerId, | 175 | UndertakerId: v.UndertakerId, |
| 168 | - RerferrerId: v.RerferrerId, | 176 | + UserId: v.UserId, |
| 177 | + ReferrerId: v.RerferrerId, | ||
| 169 | SalesmanId: v.SalesmanId, | 178 | SalesmanId: v.SalesmanId, |
| 170 | Attachment: v.Attachment, | 179 | Attachment: v.Attachment, |
| 171 | } | 180 | } |
| 172 | underTakers = append(underTakers, u) | 181 | underTakers = append(underTakers, u) |
| 173 | } | 182 | } |
| 174 | - _, err := creationCooperationGateway.CooperationContractUpdate(allied_creation_cooperation.ReqCooperationContractUpdate{ | 183 | + result, err := creationCooperationGateway.CooperationContractUpdate(allied_creation_cooperation.ReqCooperationContractUpdate{ |
| 175 | CooperationContractId: updateCooperationContractCommand.CooperationContract.CooperationContractId, | 184 | CooperationContractId: updateCooperationContractCommand.CooperationContract.CooperationContractId, |
| 176 | MoneyIncentivesRules: rules2, | 185 | MoneyIncentivesRules: rules2, |
| 177 | DividendsIncentivesRules: rules1, | 186 | DividendsIncentivesRules: rules1, |
| @@ -184,7 +193,7 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC | @@ -184,7 +193,7 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC | ||
| 184 | CooperationContractUndertakerType: updateCooperationContractCommand.CooperationContract.CooperationContractUndertakerType, | 193 | CooperationContractUndertakerType: updateCooperationContractCommand.CooperationContract.CooperationContractUndertakerType, |
| 185 | CooperationContractName: updateCooperationContractCommand.CooperationContract.CooperationContractName, | 194 | CooperationContractName: updateCooperationContractCommand.CooperationContract.CooperationContractName, |
| 186 | CooperationModeNumber: updateCooperationContractCommand.CooperationContract.CooperationModeNumber, | 195 | CooperationModeNumber: updateCooperationContractCommand.CooperationContract.CooperationModeNumber, |
| 187 | - SponsorUid: updateCooperationContractCommand.CooperationContract.SponsorUid, | 196 | + SponsorUid: updateCooperationContractCommand.CooperationContract.SponsorUserId, |
| 188 | CompanyId: int(updateCooperationContractCommand.Operator.CompanyId), | 197 | CompanyId: int(updateCooperationContractCommand.Operator.CompanyId), |
| 189 | UserId: int(updateCooperationContractCommand.Operator.UserId), | 198 | UserId: int(updateCooperationContractCommand.Operator.UserId), |
| 190 | UserBaseId: int(updateCooperationContractCommand.Operator.UserBaseId), | 199 | UserBaseId: int(updateCooperationContractCommand.Operator.UserBaseId), |
| @@ -193,7 +202,7 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC | @@ -193,7 +202,7 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC | ||
| 193 | if err != nil { | 202 | if err != nil { |
| 194 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | 203 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) |
| 195 | } | 204 | } |
| 196 | - return nil, nil | 205 | + return dto.ToCooperationContractInfo(&result.CooperationContract), nil |
| 197 | } | 206 | } |
| 198 | 207 | ||
| 199 | func NewCooperationContractService(options map[string]interface{}) *CooperationContractService { | 208 | func NewCooperationContractService(options map[string]interface{}) *CooperationContractService { |
| @@ -41,7 +41,7 @@ type CooperationProjectInfo struct { | @@ -41,7 +41,7 @@ type CooperationProjectInfo struct { | ||
| 41 | UsersId int `json:"userId,string"` | 41 | UsersId int `json:"userId,string"` |
| 42 | } `json:"userInfo"` | 42 | } `json:"userInfo"` |
| 43 | } `json:"cooperationProjectSponsor"` //项目发起人 | 43 | } `json:"cooperationProjectSponsor"` //项目发起人 |
| 44 | - CooperationProjectUndertakerType []int `json:"cooperationProjectUndertakerTypes"` //共创合约承接对象,1员工,2共创用户,3公开 | 44 | + CooperationProjectUndertakerType []int `json:"cooperationProjectUndertakerType"` //共创合约承接对象,1员工,2共创用户,3公开 |
| 45 | Department struct { | 45 | Department struct { |
| 46 | DepartmentNumber string `json:"departmentNumber"` | 46 | DepartmentNumber string `json:"departmentNumber"` |
| 47 | DepartmentId int `json:"departmentId,string,"` | 47 | DepartmentId int `json:"departmentId,string,"` |
| @@ -79,16 +79,17 @@ type CooperationApplicationItem struct { | @@ -79,16 +79,17 @@ type CooperationApplicationItem struct { | ||
| 79 | Company domain.CompanyData `json:"company"` | 79 | Company domain.CompanyData `json:"company"` |
| 80 | Department domain.Department `json:"department"` | 80 | Department domain.Department `json:"department"` |
| 81 | Org domain.Org `json:"org"` | 81 | Org domain.Org `json:"org"` |
| 82 | - UserBaseID int `json:"userBaseId"` | ||
| 83 | - UserID int `json:"userId"` | 82 | + UserBaseID int `json:"userBaseId,string"` |
| 83 | + UserID int `json:"userId,string"` | ||
| 84 | UserInfo domain.UserInfo `json:"userInfo"` | 84 | UserInfo domain.UserInfo `json:"userInfo"` |
| 85 | UserType int `json:"userType"` | 85 | UserType int `json:"userType"` |
| 86 | } `json:"cooperationApplicationApplicant"` //申请人 | 86 | } `json:"cooperationApplicationApplicant"` //申请人 |
| 87 | CooperationApplicationDescription string `json:"cooperationApplicationDescription"` //描述 | 87 | CooperationApplicationDescription string `json:"cooperationApplicationDescription"` //描述 |
| 88 | - CooperationApplicationID int `json:"cooperationApplicationId"` //申请id | 88 | + CooperationApplicationID int `json:"cooperationApplicationId,string"` //申请id |
| 89 | CooperationApplicationStatus int `json:"cooperationApplicationStatus"` //状态 | 89 | CooperationApplicationStatus int `json:"cooperationApplicationStatus"` //状态 |
| 90 | CooperationApplyTime int `json:"cooperationApplyTime"` //申请时间 | 90 | CooperationApplyTime int `json:"cooperationApplyTime"` //申请时间 |
| 91 | CooperationApplicationAttachment []domain.Attachment `json:"cooperationApplicationAttachment"` //附件 | 91 | CooperationApplicationAttachment []domain.Attachment `json:"cooperationApplicationAttachment"` //附件 |
| 92 | + CooperationApplicationVerifyTime int `json:"cooperationApplicationVerifyTime"` | ||
| 92 | } | 93 | } |
| 93 | 94 | ||
| 94 | func ToCooperationApplicationItem(param *allied_creation_cooperation.CooperationApplication) *CooperationApplicationItem { | 95 | func ToCooperationApplicationItem(param *allied_creation_cooperation.CooperationApplication) *CooperationApplicationItem { |
| @@ -97,8 +98,9 @@ func ToCooperationApplicationItem(param *allied_creation_cooperation.Cooperation | @@ -97,8 +98,9 @@ func ToCooperationApplicationItem(param *allied_creation_cooperation.Cooperation | ||
| 97 | CooperationApplicationDescription: param.CooperationApplicationDescription, | 98 | CooperationApplicationDescription: param.CooperationApplicationDescription, |
| 98 | CooperationApplicationID: applicationID, | 99 | CooperationApplicationID: applicationID, |
| 99 | CooperationApplicationStatus: param.CooperationApplicationStatus, | 100 | CooperationApplicationStatus: param.CooperationApplicationStatus, |
| 100 | - CooperationApplyTime: int(param.CooperationApplyTime), | 101 | + CooperationApplyTime: param.CooperationApplyTime, |
| 101 | CooperationApplicationAttachment: param.CooperationApplicationAttachment, | 102 | CooperationApplicationAttachment: param.CooperationApplicationAttachment, |
| 103 | + CooperationApplicationVerifyTime: param.CooperationApplicationVerifyTime, | ||
| 102 | } | 104 | } |
| 103 | data.CooperationApplicationApplicant.Company.CompanyID = param.Company.CompanyID | 105 | data.CooperationApplicationApplicant.Company.CompanyID = param.Company.CompanyID |
| 104 | data.CooperationApplicationApplicant.Company.CompanyName = param.Company.CompanyName | 106 | data.CooperationApplicationApplicant.Company.CompanyName = param.Company.CompanyName |
| @@ -12,7 +12,7 @@ type MoneyIncentivesItem struct { | @@ -12,7 +12,7 @@ type MoneyIncentivesItem struct { | ||
| 12 | type DividendsEstimateDividendItem struct { | 12 | type DividendsEstimateDividendItem struct { |
| 13 | CooperationContractNumber string `json:"cooperationContractNumber"` //共创合约编号 | 13 | CooperationContractNumber string `json:"cooperationContractNumber"` //共创合约编号 |
| 14 | CustomerName string `json:"customerName"` //客户名称 | 14 | CustomerName string `json:"customerName"` //客户名称 |
| 15 | - DividendsIncentivesAmount int `json:"dividendsIncentivesAmount"` //业绩激励分红金额 | 15 | + DividendsIncentivesAmount float64 `json:"dividendsIncentivesAmount"` //业绩激励分红金额 |
| 16 | OrderOrReturnedOrderNum string `json:"orderOrReturnedOrderNum"` //分红订单号或退货单号 | 16 | OrderOrReturnedOrderNum string `json:"orderOrReturnedOrderNum"` //分红订单号或退货单号 |
| 17 | OrderTime int64 `json:"orderTime"` //订单/退货单日期 | 17 | OrderTime int64 `json:"orderTime"` //订单/退货单日期 |
| 18 | OriginalOrderNum string `json:"originalOrderNum"` //来源单号,源单号,订单号 | 18 | OriginalOrderNum string `json:"originalOrderNum"` //来源单号,源单号,订单号 |
| @@ -21,15 +21,15 @@ type DividendsEstimateDividendItem struct { | @@ -21,15 +21,15 @@ type DividendsEstimateDividendItem struct { | ||
| 21 | 21 | ||
| 22 | func ToDividendsEstimateDividendItem(param *allied_creation_cooperation.DataDividendsEstimateSearchDividend) []DividendsEstimateDividendItem { | 22 | func ToDividendsEstimateDividendItem(param *allied_creation_cooperation.DataDividendsEstimateSearchDividend) []DividendsEstimateDividendItem { |
| 23 | var listdata []DividendsEstimateDividendItem | 23 | var listdata []DividendsEstimateDividendItem |
| 24 | - for _, v := range param.Grid.List { | 24 | + for _, v := range param.List { |
| 25 | item := DividendsEstimateDividendItem{ | 25 | item := DividendsEstimateDividendItem{ |
| 26 | CooperationContractNumber: v.CooperationContractNumber, | 26 | CooperationContractNumber: v.CooperationContractNumber, |
| 27 | CustomerName: v.CustomerName, | 27 | CustomerName: v.CustomerName, |
| 28 | - DividendsIncentivesAmount: v.DividendsIncentivesAmount, | ||
| 29 | - OrderOrReturnedOrderNum: v.OrderOrReturnedOrderNum, | ||
| 30 | - OrderTime: v.OrderTime.Unix(), | 28 | + DividendsIncentivesAmount: v.OrderAmount, |
| 29 | + OrderOrReturnedOrderNum: v.OrderNumber, | ||
| 30 | + OrderTime: v.OrderDate.UnixNano() / 1e6, | ||
| 31 | OriginalOrderNum: v.OriginalOrderNum, | 31 | OriginalOrderNum: v.OriginalOrderNum, |
| 32 | - RegionName: v.Region.RegionName, | 32 | + RegionName: v.RegionName, |
| 33 | } | 33 | } |
| 34 | listdata = append(listdata, item) | 34 | listdata = append(listdata, item) |
| 35 | } | 35 | } |
| @@ -37,6 +37,7 @@ func ToDividendsEstimateDividendItem(param *allied_creation_cooperation.DataDivi | @@ -37,6 +37,7 @@ func ToDividendsEstimateDividendItem(param *allied_creation_cooperation.DataDivi | ||
| 37 | return listdata | 37 | return listdata |
| 38 | } | 38 | } |
| 39 | 39 | ||
| 40 | +//金额激励列表 | ||
| 40 | type DividendsEstimateMoneyItem struct { | 41 | type DividendsEstimateMoneyItem struct { |
| 41 | CooperationContractName string `json:"cooperationContractName"` //合约名称 | 42 | CooperationContractName string `json:"cooperationContractName"` //合约名称 |
| 42 | CooperationContractNumber string `json:"cooperationContractNumber"` //合约编码 | 43 | CooperationContractNumber string `json:"cooperationContractNumber"` //合约编码 |
| @@ -85,7 +85,7 @@ func (dividendsEstimateService *DividendsEstimateService) SearchDividendsIncenti | @@ -85,7 +85,7 @@ func (dividendsEstimateService *DividendsEstimateService) SearchDividendsIncenti | ||
| 85 | return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | 85 | return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) |
| 86 | } | 86 | } |
| 87 | listdata := dto.ToDividendsEstimateDividendItem(result) | 87 | listdata := dto.ToDividendsEstimateDividendItem(result) |
| 88 | - return result.Grid.Total, listdata, nil | 88 | + return result.Total, listdata, nil |
| 89 | } | 89 | } |
| 90 | 90 | ||
| 91 | // 查询金额激励分红 | 91 | // 查询金额激励分红 |
| @@ -28,6 +28,7 @@ type DividendsOrder struct { | @@ -28,6 +28,7 @@ type DividendsOrder struct { | ||
| 28 | } `json:"region"` | 28 | } `json:"region"` |
| 29 | Remarks string `json:"remarks"` | 29 | Remarks string `json:"remarks"` |
| 30 | Goods []allied_creation_cooperation.DividendsOrderGoods `json:"goods"` | 30 | Goods []allied_creation_cooperation.DividendsOrderGoods `json:"goods"` |
| 31 | + Returned bool `json:"returned"` | ||
| 31 | } | 32 | } |
| 32 | 33 | ||
| 33 | func ToDividendsOrder(param *allied_creation_cooperation.DividendsOrder) *DividendsOrder { | 34 | func ToDividendsOrder(param *allied_creation_cooperation.DividendsOrder) *DividendsOrder { |
| @@ -35,7 +36,7 @@ func ToDividendsOrder(param *allied_creation_cooperation.DividendsOrder) *Divide | @@ -35,7 +36,7 @@ func ToDividendsOrder(param *allied_creation_cooperation.DividendsOrder) *Divide | ||
| 35 | Company: param.Company, | 36 | Company: param.Company, |
| 36 | CustomerName: param.CustomerName, | 37 | CustomerName: param.CustomerName, |
| 37 | DividendStatus: param.DividendStatus, | 38 | DividendStatus: param.DividendStatus, |
| 38 | - DividendTime: param.DividendTime.Unix(), | 39 | + DividendTime: param.DividendTime.UnixNano() / 1e6, |
| 39 | DividendsOrderAmount: param.DividendsOrderAmount, | 40 | DividendsOrderAmount: param.DividendsOrderAmount, |
| 40 | DividendsOrderID: param.DividendsOrderID, | 41 | DividendsOrderID: param.DividendsOrderID, |
| 41 | DividendsOrderNumber: param.DividendsOrderNumber, | 42 | DividendsOrderNumber: param.DividendsOrderNumber, |
| @@ -45,6 +46,7 @@ func ToDividendsOrder(param *allied_creation_cooperation.DividendsOrder) *Divide | @@ -45,6 +46,7 @@ func ToDividendsOrder(param *allied_creation_cooperation.DividendsOrder) *Divide | ||
| 45 | Region: param.Region, | 46 | Region: param.Region, |
| 46 | Remarks: param.Remarks, | 47 | Remarks: param.Remarks, |
| 47 | Goods: param.Goods, | 48 | Goods: param.Goods, |
| 49 | + Returned: param.Returned, | ||
| 48 | } | 50 | } |
| 49 | return &data | 51 | return &data |
| 50 | } | 52 | } |
| @@ -41,12 +41,12 @@ func ToDividendsReturnedOrderInfo(param *allied_creation_cooperation.DividendsRe | @@ -41,12 +41,12 @@ func ToDividendsReturnedOrderInfo(param *allied_creation_cooperation.DividendsRe | ||
| 41 | Org: param.Org, | 41 | Org: param.Org, |
| 42 | Region: param.Region, | 42 | Region: param.Region, |
| 43 | Company: param.Company, | 43 | Company: param.Company, |
| 44 | - CreatedAt: param.CreatedAt.Unix(), | 44 | + CreatedAt: param.CreatedAt.UnixNano() / 1e6, |
| 45 | DividendStatus: param.DividendStatus, | 45 | DividendStatus: param.DividendStatus, |
| 46 | - DividendTime: param.DividendTime.Unix(), | 46 | + DividendTime: param.DividendTime.UnixNano() / 1e6, |
| 47 | DividendsOrderNumber: param.DividendsOrderNumber, | 47 | DividendsOrderNumber: param.DividendsOrderNumber, |
| 48 | DividendsReturnedCustomerName: param.DividendsReturnedCustomerName, | 48 | DividendsReturnedCustomerName: param.DividendsReturnedCustomerName, |
| 49 | - DividendsReturnedDate: param.DividendsReturnedDate.Unix(), | 49 | + DividendsReturnedDate: param.DividendsReturnedDate.UnixNano() / 1e6, |
| 50 | DividendsReturnedOrderID: param.DividendsReturnedOrderID, | 50 | DividendsReturnedOrderID: param.DividendsReturnedOrderID, |
| 51 | DividendsReturnedOrderNumber: param.DividendsReturnedOrderNumber, | 51 | DividendsReturnedOrderNumber: param.DividendsReturnedOrderNumber, |
| 52 | DividendsReturnedOrderRefund: param.DividendsReturnedOrderRefund, | 52 | DividendsReturnedOrderRefund: param.DividendsReturnedOrderRefund, |
| @@ -18,8 +18,8 @@ type DividendsReturnedOrderService struct { | @@ -18,8 +18,8 @@ type DividendsReturnedOrderService struct { | ||
| 18 | // 创建分红退货单服务 | 18 | // 创建分红退货单服务 |
| 19 | func (dividendsReturnedOrderService *DividendsReturnedOrderService) CreateDividendsReturnedOrder(createDividendsReturnedOrderCommand *command.CreateDividendsReturnedOrderCommand) (interface{}, error) { | 19 | func (dividendsReturnedOrderService *DividendsReturnedOrderService) CreateDividendsReturnedOrder(createDividendsReturnedOrderCommand *command.CreateDividendsReturnedOrderCommand) (interface{}, error) { |
| 20 | creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(createDividendsReturnedOrderCommand.Operator) | 20 | creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(createDividendsReturnedOrderCommand.Operator) |
| 21 | - dividendsReturnedDate := time.Unix(createDividendsReturnedOrderCommand.DividendsReturnedDate, 0) | ||
| 22 | - orderDate := time.Unix(createDividendsReturnedOrderCommand.OrderDate, 0) | 21 | + dividendsReturnedDate := time.Unix(createDividendsReturnedOrderCommand.DividendsReturnedDate/1e3, 0) |
| 22 | + orderDate := time.Unix(createDividendsReturnedOrderCommand.OrderDate/1e3, 0) | ||
| 23 | result, err := creationCooperationGateway.DividendsReturnedOrderAdd(allied_creation_cooperation.ReqDividendsReturnedOrderAdd{ | 23 | result, err := creationCooperationGateway.DividendsReturnedOrderAdd(allied_creation_cooperation.ReqDividendsReturnedOrderAdd{ |
| 24 | DividendsReturnedCustomerName: createDividendsReturnedOrderCommand.DividendsReturnedCustomerName, | 24 | DividendsReturnedCustomerName: createDividendsReturnedOrderCommand.DividendsReturnedCustomerName, |
| 25 | DividendsOrderNumber: createDividendsReturnedOrderCommand.DividendsOrderNumber, | 25 | DividendsOrderNumber: createDividendsReturnedOrderCommand.DividendsOrderNumber, |
| @@ -52,13 +52,8 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) GetDividends | @@ -52,13 +52,8 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) GetDividends | ||
| 52 | // 移除分红退货单服务 | 52 | // 移除分红退货单服务 |
| 53 | func (dividendsReturnedOrderService *DividendsReturnedOrderService) RemoveDividendsReturnedOrder(removeDividendsReturnedOrderCommand *command.RemoveDividendsReturnedOrderCommand) (interface{}, error) { | 53 | func (dividendsReturnedOrderService *DividendsReturnedOrderService) RemoveDividendsReturnedOrder(removeDividendsReturnedOrderCommand *command.RemoveDividendsReturnedOrderCommand) (interface{}, error) { |
| 54 | creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(removeDividendsReturnedOrderCommand.Operator) | 54 | creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(removeDividendsReturnedOrderCommand.Operator) |
| 55 | - ids := []int{} | ||
| 56 | - for _, v := range removeDividendsReturnedOrderCommand.DividendsReturnedOrderID { | ||
| 57 | - id, _ := strconv.Atoi(v) | ||
| 58 | - ids = append(ids, id) | ||
| 59 | - } | ||
| 60 | _, err := creationCooperationGateway.DividendsReturnedOrderBatchRemove(allied_creation_cooperation.ReqDividendsReturnedOrderBatchRemove{ | 55 | _, err := creationCooperationGateway.DividendsReturnedOrderBatchRemove(allied_creation_cooperation.ReqDividendsReturnedOrderBatchRemove{ |
| 61 | - DividendsReturnedOrderIDs: ids, | 56 | + DividendsReturnedOrderIDs: removeDividendsReturnedOrderCommand.DividendsReturnedOrderID, |
| 62 | }) | 57 | }) |
| 63 | if err != nil { | 58 | if err != nil { |
| 64 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | 59 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) |
| @@ -89,8 +84,8 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) SearchDivide | @@ -89,8 +84,8 @@ func (dividendsReturnedOrderService *DividendsReturnedOrderService) SearchDivide | ||
| 89 | // 更新分红退货单服务 | 84 | // 更新分红退货单服务 |
| 90 | func (dividendsReturnedOrderService *DividendsReturnedOrderService) UpdateDividendsReturnedOrder(updateDividendsReturnedOrderCommand *command.UpdateDividendsReturnedOrderCommand) (interface{}, error) { | 85 | func (dividendsReturnedOrderService *DividendsReturnedOrderService) UpdateDividendsReturnedOrder(updateDividendsReturnedOrderCommand *command.UpdateDividendsReturnedOrderCommand) (interface{}, error) { |
| 91 | creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(updateDividendsReturnedOrderCommand.Operator) | 86 | creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(updateDividendsReturnedOrderCommand.Operator) |
| 92 | - dividendsReturnedDate := time.Unix(updateDividendsReturnedOrderCommand.DividendsReturnedDate, 0) | ||
| 93 | - orderDate := time.Unix(updateDividendsReturnedOrderCommand.OrderDate, 0) | 87 | + dividendsReturnedDate := time.Unix(updateDividendsReturnedOrderCommand.DividendsReturnedDate/1e3, 0) |
| 88 | + orderDate := time.Unix(updateDividendsReturnedOrderCommand.OrderDate/1e3, 0) | ||
| 94 | _, err := creationCooperationGateway.DividendsReturnedOrderUpdate(allied_creation_cooperation.ReqDividendsReturnedOrderUpdate{ | 89 | _, err := creationCooperationGateway.DividendsReturnedOrderUpdate(allied_creation_cooperation.ReqDividendsReturnedOrderUpdate{ |
| 95 | DividendsReturnedOrderID: updateDividendsReturnedOrderCommand.DividendsReturnedOrderID, | 90 | DividendsReturnedOrderID: updateDividendsReturnedOrderCommand.DividendsReturnedOrderID, |
| 96 | DividendsReturnedCustomerName: updateDividendsReturnedOrderCommand.DividendsReturnedCustomerName, | 91 | DividendsReturnedCustomerName: updateDividendsReturnedOrderCommand.DividendsReturnedCustomerName, |
| @@ -228,3 +228,34 @@ func (gateway HttplibAlliedCreationCooperation) CooperationContractGet(param Req | @@ -228,3 +228,34 @@ func (gateway HttplibAlliedCreationCooperation) CooperationContractGet(param Req | ||
| 228 | err = gateway.GetResponseData(result, &data) | 228 | err = gateway.GetResponseData(result, &data) |
| 229 | return &data, err | 229 | return &data, err |
| 230 | } | 230 | } |
| 231 | + | ||
| 232 | +// CooperationContractsBatchOperate 暂停恢复合约 | ||
| 233 | +func (gateway HttplibAlliedCreationCooperation) CooperationContractsBatchOperate(param ReqCooperationContractsBatchOperate) (*DataCooperationContractsBatchOperate, error) { | ||
| 234 | + url := gateway.baseUrL + "/cooperation-contracts/batch-operate" | ||
| 235 | + method := "POST" | ||
| 236 | + req := gateway.CreateRequest(url, method) | ||
| 237 | + log.Logger.Debug("向业务模块请求数据:返回共创合约详情。", map[string]interface{}{ | ||
| 238 | + "api": method + ":" + url, | ||
| 239 | + "param": param, | ||
| 240 | + }) | ||
| 241 | + req, err := req.JSONBody(param) | ||
| 242 | + if err != nil { | ||
| 243 | + return nil, fmt.Errorf("请求返回共创合约详情失败:%w", err) | ||
| 244 | + } | ||
| 245 | + | ||
| 246 | + byteResult, err := req.Bytes() | ||
| 247 | + if err != nil { | ||
| 248 | + return nil, fmt.Errorf("获取返回共创合约详情失败:%w", err) | ||
| 249 | + } | ||
| 250 | + log.Logger.Debug("获取业务模块请求数据:返回共创合约详情。", map[string]interface{}{ | ||
| 251 | + "result": string(byteResult), | ||
| 252 | + }) | ||
| 253 | + var result service_gateway.GatewayResponse | ||
| 254 | + err = json.Unmarshal(byteResult, &result) | ||
| 255 | + if err != nil { | ||
| 256 | + return nil, fmt.Errorf("解析返回共创合约详情:%w", err) | ||
| 257 | + } | ||
| 258 | + var data DataCooperationContractsBatchOperate | ||
| 259 | + err = gateway.GetResponseData(result, &data) | ||
| 260 | + return &data, err | ||
| 261 | +} |
| @@ -31,8 +31,8 @@ type CooperationApplication struct { | @@ -31,8 +31,8 @@ type CooperationApplication struct { | ||
| 31 | Department interface{} `json:"department"` | 31 | Department interface{} `json:"department"` |
| 32 | } `json:"cooperationApplicationVerifier"` | 32 | } `json:"cooperationApplicationVerifier"` |
| 33 | CooperationApplicationVerifyDescription string `json:"cooperationApplicationVerifyDescription"` | 33 | CooperationApplicationVerifyDescription string `json:"cooperationApplicationVerifyDescription"` |
| 34 | - CooperationApplicationVerifyTime int64 `json:"cooperationApplicationVerifyTime"` | ||
| 35 | - CooperationApplyTime int64 `json:"cooperationApplyTime"` | 34 | + CooperationApplicationVerifyTime int `json:"cooperationApplicationVerifyTime"` |
| 35 | + CooperationApplyTime int `json:"cooperationApplyTime"` | ||
| 36 | CooperationProject struct { | 36 | CooperationProject struct { |
| 37 | CooperationProjectID int `json:"cooperationProjectId"` | 37 | CooperationProjectID int `json:"cooperationProjectId"` |
| 38 | CooperationProjectNumber string `json:"cooperationProjectNumber"` | 38 | CooperationProjectNumber string `json:"cooperationProjectNumber"` |
| @@ -55,6 +55,7 @@ type CooperationContract struct { | @@ -55,6 +55,7 @@ type CooperationContract struct { | ||
| 55 | Undertakers []struct { | 55 | Undertakers []struct { |
| 56 | ContractAttachment []domain.Attachment `json:"contractAttachment"` | 56 | ContractAttachment []domain.Attachment `json:"contractAttachment"` |
| 57 | UserId int `json:"userId,string"` | 57 | UserId int `json:"userId,string"` |
| 58 | + UndertakerId int `json:"undertakerId,string"` | ||
| 58 | UserInfo struct { | 59 | UserInfo struct { |
| 59 | UserAvatar string `json:"userAvatar"` // 用户头像 | 60 | UserAvatar string `json:"userAvatar"` // 用户头像 |
| 60 | UserEmail string `json:"userEmail"` // 用户邮箱 | 61 | UserEmail string `json:"userEmail"` // 用户邮箱 |
| @@ -114,6 +115,7 @@ type CooperationContract struct { | @@ -114,6 +115,7 @@ type CooperationContract struct { | ||
| 114 | OperateTime time.Time `json:"operateTime"` // 操作时间 | 115 | OperateTime time.Time `json:"operateTime"` // 操作时间 |
| 115 | CreatedAt time.Time `json:"createdAt"` // 创建时间 | 116 | CreatedAt time.Time `json:"createdAt"` // 创建时间 |
| 116 | UpdatedAt time.Time `json:"updatedAt"` // 更新时间 | 117 | UpdatedAt time.Time `json:"updatedAt"` // 更新时间 |
| 118 | + UndertakerTypesUncheckedAvailable []int `json:"undertakerTypesUncheckedAvailable"` | ||
| 117 | } | 119 | } |
| 118 | 120 | ||
| 119 | //创建共创合约 | 121 | //创建共创合约 |
| @@ -142,9 +144,10 @@ type ( | @@ -142,9 +144,10 @@ type ( | ||
| 142 | 144 | ||
| 143 | //合约承接方 | 145 | //合约承接方 |
| 144 | Undertaker struct { | 146 | Undertaker struct { |
| 145 | - UndertakerId string `json:"undertakerId"` //承接人用户id | ||
| 146 | - RerferrerId string `json:"rerferrerId"` //推荐人用户id | ||
| 147 | - SalesmanId string `json:"salesmanId"` //关联业务员id | 147 | + UndertakerId int `json:"undertakerId,string"` |
| 148 | + UserId int `json:"userId,string"` //承接人用户id | ||
| 149 | + ReferrerId int `json:"referrerId,string"` //推荐人用户id | ||
| 150 | + SalesmanId int `json:"salesmanId,string"` //关联业务员id | ||
| 148 | Attachment []domain.Attachment `json:"attachment"` | 151 | Attachment []domain.Attachment `json:"attachment"` |
| 149 | } | 152 | } |
| 150 | 153 | ||
| @@ -188,10 +191,10 @@ type ( | @@ -188,10 +191,10 @@ type ( | ||
| 188 | MoneyIncentivesRules []MoneyIncentivesRule `json:"moneyIncentivesRules"` | 191 | MoneyIncentivesRules []MoneyIncentivesRule `json:"moneyIncentivesRules"` |
| 189 | Undertakers []Undertaker `json:"undertakers"` // 承接方列表 // 业绩分红激励规则列表 | 192 | Undertakers []Undertaker `json:"undertakers"` // 承接方列表 // 业绩分红激励规则列表 |
| 190 | RelevantIds []string `json:"relevantIds"` //关联业务员 | 193 | RelevantIds []string `json:"relevantIds"` //关联业务员 |
| 191 | - CompanyId int `json:"companyId,string"` | ||
| 192 | - OrgId int `json:"orgId,string"` // 组织机构ID | ||
| 193 | - UserId int ` json:"userId,string"` // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员 | ||
| 194 | - UserBaseId int `json:"userBaseId,string" ` // 用户基础数据id | 194 | + CompanyId int `json:"-"` |
| 195 | + OrgId int `json:"-"` // 组织机构ID | ||
| 196 | + UserId int ` json:"-"` // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员 | ||
| 197 | + UserBaseId int `json:"-" ` // 用户基础数据id | ||
| 195 | } | 198 | } |
| 196 | 199 | ||
| 197 | DataCooperationContractUpdate struct { | 200 | DataCooperationContractUpdate struct { |
| @@ -263,3 +266,12 @@ type ( | @@ -263,3 +266,12 @@ type ( | ||
| 263 | UndertakerTypesUncheckedAvailable []int `json:"undertakerTypesUncheckedAvailable"` | 266 | UndertakerTypesUncheckedAvailable []int `json:"undertakerTypesUncheckedAvailable"` |
| 264 | } | 267 | } |
| 265 | ) | 268 | ) |
| 269 | + | ||
| 270 | +//批量恢复或暂停合约 | ||
| 271 | +type ( | ||
| 272 | + ReqCooperationContractsBatchOperate struct { | ||
| 273 | + CooperationContractIds []string `json:"cooperationContractIds"` | ||
| 274 | + Action int `json:"action"` //暂停或恢复合约动作,1恢复,2暂停 | ||
| 275 | + } | ||
| 276 | + DataCooperationContractsBatchOperate []interface{} | ||
| 277 | +) |
| @@ -118,12 +118,6 @@ type ( | @@ -118,12 +118,6 @@ type ( | ||
| 118 | CooperationProjectDescription string `json:"cooperationProjectDescription"` | 118 | CooperationProjectDescription string `json:"cooperationProjectDescription"` |
| 119 | Attachment []domain.Attachment `json:"attachment"` | 119 | Attachment []domain.Attachment `json:"attachment"` |
| 120 | DepartmentId int `json:"departmentId,string"` | 120 | DepartmentId int `json:"departmentId,string"` |
| 121 | - // 组织机构ID | ||
| 122 | - // OrgId int64 `cname:"组织机构ID" json:"orgId,string" valid:"Required"` | ||
| 123 | - // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员 | ||
| 124 | - //UserId int64 `cname:"用户ID" json:"userId,string" valid:"Required"` | ||
| 125 | - // 用户基础数据id | ||
| 126 | - //UserBaseId int64 `cname:"用户基础数据ID" json:"userBaseId,string" valid:"Required"` | ||
| 127 | } | 121 | } |
| 128 | 122 | ||
| 129 | DataCooperationProjectUpdate struct { | 123 | DataCooperationProjectUpdate struct { |
| @@ -12,21 +12,25 @@ type ( | @@ -12,21 +12,25 @@ type ( | ||
| 12 | } | 12 | } |
| 13 | 13 | ||
| 14 | DataDividendsEstimateSearchDividend struct { | 14 | DataDividendsEstimateSearchDividend struct { |
| 15 | - Grid struct { | ||
| 16 | Total int `json:"total"` | 15 | Total int `json:"total"` |
| 17 | List []struct { | 16 | List []struct { |
| 18 | - CooperationContractNumber string `json:"cooperationContractNumber"` //共创合约编号 | ||
| 19 | - CustomerName string `json:"customerName"` //客户名称 | ||
| 20 | - DividendsIncentivesAmount int `json:"dividendsIncentivesAmount"` //业绩激励分红金额 | ||
| 21 | - OrderOrReturnedOrderNum string `json:"orderOrReturnedOrderNum"` //分红订单号或退货单号 | ||
| 22 | - OrderTime time.Time `json:"orderTime"` //订单/退货单日期 | ||
| 23 | - OriginalOrderNum string `json:"originalOrderNum"` //来源单号,源单号,订单号 | ||
| 24 | - Region struct { | ||
| 25 | - RegionName string `json:"regionName"` //区域名称 | ||
| 26 | - RegionNumber string `json:"regionNumber"` //区域编码 | ||
| 27 | - } `json:"region"` | 17 | + // 分红订单产品ID |
| 18 | + OrderGoodId int64 `json:"orderGoodId,string"` | ||
| 19 | + // 共创合约编号 | ||
| 20 | + CooperationContractNumber string `json:"cooperationContractNumber"` | ||
| 21 | + // 分红订单号或退货单号、 | ||
| 22 | + OrderNumber string `json:"orderNumber"` | ||
| 23 | + // 来源单号 | ||
| 24 | + OriginalOrderNum string `json:"originalOrderNum"` | ||
| 25 | + // 客户名称 | ||
| 26 | + CustomerName string `json:"customerName"` | ||
| 27 | + // 订单区域 | ||
| 28 | + RegionName string `json:"region"` | ||
| 29 | + // 订单金额 | ||
| 30 | + OrderAmount float64 `json:"orderAmount"` | ||
| 31 | + // 订单/退货单日期 | ||
| 32 | + OrderDate time.Time `json:"-"` //TODO 等待数据调整 | ||
| 28 | } `json:"list"` | 33 | } `json:"list"` |
| 29 | - } `json:"grid"` | ||
| 30 | } | 34 | } |
| 31 | ) | 35 | ) |
| 32 | 36 |
| @@ -50,6 +50,7 @@ type DividendsOrder struct { | @@ -50,6 +50,7 @@ type DividendsOrder struct { | ||
| 50 | } `json:"region"` | 50 | } `json:"region"` |
| 51 | Remarks string `json:"remarks"` | 51 | Remarks string `json:"remarks"` |
| 52 | Goods []DividendsOrderGoods `json:"goods"` | 52 | Goods []DividendsOrderGoods `json:"goods"` |
| 53 | + Returned bool `json:"returned"` //是否有退货记录,true:有退货记录,false:无退货记录 | ||
| 53 | } | 54 | } |
| 54 | 55 | ||
| 55 | type ( | 56 | type ( |
| @@ -64,7 +65,7 @@ type ( | @@ -64,7 +65,7 @@ type ( | ||
| 64 | OrderGoodName string `json:"orderGoodName"` //订单产品名称 | 65 | OrderGoodName string `json:"orderGoodName"` //订单产品名称 |
| 65 | OrderGoodPrice float64 `json:"orderGoodPrice"` //订单产品单价 | 66 | OrderGoodPrice float64 `json:"orderGoodPrice"` //订单产品单价 |
| 66 | OrderGoodQuantity int `json:"orderGoodQuantity,string"` //订单产品数量 | 67 | OrderGoodQuantity int `json:"orderGoodQuantity,string"` //订单产品数量 |
| 67 | - OrderGoodDividendsStatus int32 `json:"OrderGoodDividendsStatus"` // 订单产品分红状态, 1待分红,2已分红 | 68 | + OrderGoodDividendsStatus int32 `json:"orderGoodDividendsStatus"` // 订单产品分红状态, 1待分红,2已分红 |
| 68 | } | 69 | } |
| 69 | ReqDividendsOrderAdd struct { | 70 | ReqDividendsOrderAdd struct { |
| 70 | CompanyId int `json:"companyId,string"` | 71 | CompanyId int `json:"companyId,string"` |
| @@ -116,7 +116,7 @@ type ( | @@ -116,7 +116,7 @@ type ( | ||
| 116 | //批量移除分红退货单 | 116 | //批量移除分红退货单 |
| 117 | type ( | 117 | type ( |
| 118 | ReqDividendsReturnedOrderBatchRemove struct { | 118 | ReqDividendsReturnedOrderBatchRemove struct { |
| 119 | - DividendsReturnedOrderIDs []int `json:"dividendsReturnedOrderIds"` //分红退货单记录id | 119 | + DividendsReturnedOrderIDs []string `json:"dividendsReturnedOrderIds"` //分红退货单记录id |
| 120 | } | 120 | } |
| 121 | 121 | ||
| 122 | DataDividendsReturnedOrderBatchRemove struct { | 122 | DataDividendsReturnedOrderBatchRemove struct { |
-
请 注册 或 登录 后发表评论