作者 yangfu

Merge branch 'dev' of http://gitlab.fjmaimaimai.com/allied-creation/allied-creat…

…ion-cooperation into dev
正在显示 30 个修改的文件 包含 115 行增加63 行删除
... ... @@ -14,7 +14,7 @@ type SearchContractUndertakerFeedbackQuery struct {
// 组织机构ID
OrgId int64 `cname:"组织机构ID" json:"orgId"`
// 关联的组织机构ID列表
OrgIds []int64 `cname:"关联的组织机构ID列表" json:"orgIds"`
OrgIds []string `cname:"关联的组织机构ID列表" json:"orgIds"`
// 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员
UserId int64 `cname:"用户ID" json:"userId"`
// 用户基础数据id
... ...
... ... @@ -26,7 +26,7 @@ type SearchCooperationApplicationQuery struct {
// 组织机构ID
OrgId int64 `cname:"组织机构ID" json:"orgId"`
// 关联的组织机构ID列表
OrgIds []int64 `cname:"关联的组织机构ID列表" json:"orgIds"`
OrgIds []string `cname:"关联的组织机构ID列表" json:"orgIds"`
// 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员
UserId int64 `cname:"用户ID" json:"userId"`
// 用户基础数据id
... ...
... ... @@ -21,6 +21,8 @@ type SearchCooperationContractQuery struct {
CompanyId int64 `cname:"公司ID" json:"companyId"`
// 组织机构ID
OrgId int64 `cname:"组织机构ID" json:"orgId"`
// 关联的组织机构ID列表
OrgIds []string `cname:"关联的组织机构ID列表" json:"orgIds"`
// 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员
UserId int64 `cname:"用户ID" json:"userId"`
// 用户基础数据id
... ...
... ... @@ -21,6 +21,8 @@ type SearchCooperationContractByUndertakerQuery struct {
CompanyId int64 `cname:"公司ID" json:"companyId"`
// 组织机构ID
OrgId int64 `cname:"组织机构ID" json:"orgId"`
// 关联的组织机构ID列表
OrgIds []string `cname:"关联的组织机构ID列表" json:"orgIds"`
// 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员
UserId int64 `cname:"用户ID" json:"userId"`
// 用户基础数据id
... ...
... ... @@ -1056,6 +1056,7 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC
UpdatedAt: time.Time{},
DeletedAt: time.Time{},
CreatedAt: time.Now(),
Remarks: dividendsIncentivesRule.Remarks,
})
}
... ... @@ -1084,6 +1085,7 @@ func (cooperationContractService *CooperationContractService) UpdateCooperationC
UpdatedAt: time.Time{},
DeletedAt: time.Time{},
CreatedAt: time.Now(),
Remarks: moneyIncentivesRule.Remarks,
})
}
... ...
... ... @@ -22,7 +22,7 @@ type SearchCooperationContractChangeLogQuery struct {
// 组织机构ID
OrgId int64 `cname:"组织机构ID" json:"orgId"`
// 关联的组织机构ID列表
OrgIds []int64 `cname:"关联的组织机构ID列表" json:"orgIds"`
OrgIds []string `cname:"关联的组织机构ID列表" json:"orgIds"`
// 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员
UserId int64 `cname:"用户ID" json:"userId"`
// 用户基础数据id
... ...
... ... @@ -22,7 +22,7 @@ type SearchCooperationModeQuery struct {
// 组织机构ID
OrgId int64 `cname:"组织机构ID" json:"orgId"`
// 关联的组织机构ID列表
OrgIds []int64 `cname:"关联的组织机构ID列表" json:"orgIds"`
OrgIds []string `cname:"关联的组织机构ID列表" json:"orgIds"`
// 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员
UserId int64 `cname:"用户ID" json:"userId"`
// 用户基础数据id
... ...
... ... @@ -24,7 +24,7 @@ type SearchCooperationProjectQuery struct {
// 组织机构ID
OrgId int64 `cname:"组织机构ID" json:"orgId"`
// 关联的组织机构ID列表
OrgIds []int64 `cname:"关联的组织机构ID列表" json:"orgIds"`
OrgIds []string `cname:"关联的组织机构ID列表" json:"orgIds"`
// 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员
UserId int64 `cname:"用户ID" json:"userId"`
// 用户基础数据id
... ...
... ... @@ -27,7 +27,7 @@ type SearchCreditAccountQuery struct {
// 组织机构ID
OrgId int64 `cname:"组织机构ID" json:"orgId"`
// 关联的组织机构ID列表
OrgIds []int64 `cname:"关联的组织机构ID列表" json:"orgIds"`
OrgIds []string `cname:"关联的组织机构ID列表" json:"orgIds"`
// 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员
UserId int64 `cname:"用户ID" json:"userId"`
// 用户基础数据id
... ...
... ... @@ -19,7 +19,7 @@ type SearchDividendsEstimateQuery struct {
// 组织机构ID
OrgId int64 `cname:"组织机构ID" json:"orgId"`
// 关联的组织机构ID列表
OrgIds []int64 `cname:"关联的组织机构ID列表" json:"orgIds"`
OrgIds []string `cname:"关联的组织机构ID列表" json:"orgIds"`
// 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员
UserId int64 `cname:"用户ID" json:"userId"`
// 用户基础数据id
... ...
... ... @@ -19,7 +19,7 @@ type SearchDividendsIncentivesEstimateQuery struct {
// 组织机构ID
OrgId int64 `cname:"组织机构ID" json:"orgId"`
// 关联的组织机构ID列表
OrgIds []int64 `cname:"关联的组织机构ID列表" json:"orgIds"`
OrgIds []string `cname:"关联的组织机构ID列表" json:"orgIds"`
// 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员
UserId int64 `cname:"用户ID" json:"userId"`
// 用户基础数据id
... ...
... ... @@ -19,7 +19,7 @@ type SearchMoneyIncentivesEstimateQuery struct {
// 组织机构ID
OrgId int64 `cname:"组织机构ID" json:"orgId"`
// 关联的组织机构ID列表
OrgIds []int64 `cname:"关联的组织机构ID列表" json:"orgIds"`
OrgIds []string `cname:"关联的组织机构ID列表" json:"orgIds"`
// 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员
UserId int64 `cname:"用户ID" json:"userId"`
// 用户基础数据id
... ...
... ... @@ -22,7 +22,7 @@ type SearchDividendsOrderQuery struct {
// 组织机构ID
OrgId int64 `cname:"组织机构ID" json:"orgId"`
// 关联的组织机构ID列表
OrgIds []int64 `cname:"关联的组织机构ID列表" json:"orgIds"`
OrgIds []string `cname:"关联的组织机构ID列表" json:"orgIds"`
// 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员
UserId int64 `cname:"用户ID" json:"userId"`
// 用户基础数据id
... ...
... ... @@ -16,7 +16,7 @@ type SearchDividendsOrderNumberQuery struct {
// 组织机构ID
OrgId int64 `cname:"组织机构ID" json:"orgId"`
// 关联的组织机构ID列表
OrgIds []int64 `cname:"关联的组织机构ID列表" json:"orgIds"`
OrgIds []string `cname:"关联的组织机构ID列表" json:"orgIds"`
// 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员
UserId int64 `cname:"用户ID" json:"userId"`
// 用户基础数据id
... ...
... ... @@ -19,6 +19,8 @@ type SearchDividendsReturnedOrderQuery struct {
PageNumber int64 `cname:"页码" json:"pageNumber,omitempty"`
// 公司ID,通过集成REST上下文获取
CompanyId int64 `cname:"公司ID" json:"companyId"`
// 关联的组织机构ID列表
OrgIds []string `cname:"关联的组织机构ID列表" json:"orgIds"`
// 组织机构ID
OrgId int64 `cname:"组织机构ID" json:"orgId"`
// 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员
... ...
... ... @@ -162,7 +162,7 @@ func (repository *ContractUndertakerFeedbackRepository) Find(queryOptions map[st
if orgId, ok := queryOptions["orgId"]; ok && orgId.(int64) != 0 {
query.Where("org->>'orgId' = '?'", orgId)
}
if orgIds, ok := queryOptions["orgIds"]; ok && len(orgIds.([]int64)) > 0 {
if orgIds, ok := queryOptions["orgIds"]; ok && len(orgIds.([]string)) > 0 {
query.Where("org->>'orgId' in (?)", pg.In(orgIds))
}
// 搜索内容包括项目合约名称、承接人姓名、承接内容关键字
... ...
... ... @@ -243,7 +243,7 @@ func (repository *CooperationApplicationRepository) Find(queryOptions map[string
if orgId, ok := queryOptions["orgId"]; ok && orgId.(int64) != 0 {
query.Where("org->>'orgId' = '?'", orgId)
}
if orgIds, ok := queryOptions["orgIds"]; ok && len(orgIds.([]int64)) > 0 {
if orgIds, ok := queryOptions["orgIds"]; ok && len(orgIds.([]string)) > 0 {
query.Where("org->>'orgId' in (?)", pg.In(orgIds))
}
offsetLimitFlag := true
... ...
... ... @@ -171,7 +171,7 @@ func (repository *CooperationContractChangeLogRepository) Find(queryOptions map[
if orgId, ok := queryOptions["orgId"]; ok && orgId.(int64) != 0 {
query.Where("org->>'orgId' = '?'", orgId)
}
if orgIds, ok := queryOptions["orgIds"]; ok && len(orgIds.([]int64)) > 0 {
if orgIds, ok := queryOptions["orgIds"]; ok && len(orgIds.([]string)) > 0 {
query.Where("org->>'orgId' in (?)", pg.In(orgIds))
}
if offsetLimitFlag {
... ...
... ... @@ -176,7 +176,7 @@ func (repository *CooperationContractRelevantRepository) Find(queryOptions map[s
if orgId, ok := queryOptions["orgId"]; ok && orgId.(int64) != 0 {
query.Where("org->>'orgId' = '?'", orgId)
}
if orgIds, ok := queryOptions["orgIds"]; ok && len(orgIds.([]int64)) > 0 {
if orgIds, ok := queryOptions["orgIds"]; ok && len(orgIds.([]string)) > 0 {
query.Where("org->>'orgId' in (?)", pg.In(orgIds))
}
if userBaseId, ok := queryOptions["userBaseId"]; ok && userBaseId.(int64) != 0 {
... ...
... ... @@ -167,7 +167,6 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai
var dividendsIncentivesRulesModel []*models.DividendsIncentivesRule
for _, rule := range cooperationContract.DividendsIncentivesRules {
dividendsIncentivesRulesModel = append(dividendsIncentivesRulesModel, &models.DividendsIncentivesRule{
DividendsIncentivesRuleId: 0,
CooperationContractNumber: cooperationContract.CooperationContractNumber,
ReferrerPercentage: rule.ReferrerPercentage,
SalesmanPercentage: rule.SalesmanPercentage,
... ... @@ -193,7 +192,6 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai
var moneyIncentivesRulesModel []*models.MoneyIncentivesRule
for _, rule := range cooperationContract.MoneyIncentivesRules {
moneyIncentivesRulesModel = append(moneyIncentivesRulesModel, &models.MoneyIncentivesRule{
MoneyIncentivesRuleId: 0,
CooperationContractNumber: cooperationContract.CooperationContractNumber,
MoneyIncentivesAmount: rule.MoneyIncentivesAmount,
MoneyIncentivesStage: rule.MoneyIncentivesStage,
... ... @@ -292,7 +290,6 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai
var cooperationContractRelevantPeopleToAddModels []*models.CooperationContractRelevant
for _, relevantDomain := range cooperationContractRelevantPeopleToAdd {
cooperationContractRelevantPeopleToAddModels = append(cooperationContractRelevantPeopleToAddModels, &models.CooperationContractRelevant{
CooperationContractRelevantId: 0,
CooperationContractNumber: relevantDomain.CooperationContractNumber,
UserId: relevantDomain.UserId,
UserBaseId: relevantDomain.UserBaseId,
... ... @@ -437,27 +434,27 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai
"待更新的承接人": undertakerModelsToUpdate,
})
for i, undertakerModelToUpdate := range undertakerModelsToUpdate {
for j, undertaker := range cooperationContract.Undertakers {
for _, undertaker := range cooperationContract.Undertakers {
if undertaker.UndertakerId == undertakerModelToUpdate.CooperationContractUndertakerId {
undertakerModelsToUpdate[i] = &models.CooperationContractUndertaker{
CooperationContractUndertakerId: cooperationContract.Undertakers[j].UndertakerId,
CooperationContractNumber: cooperationContract.Undertakers[j].CooperationContractNumber,
UserId: cooperationContract.Undertakers[j].UserId,
UserBaseId: cooperationContract.Undertakers[j].UserBaseId,
Org: cooperationContract.Undertakers[j].Org,
Orgs: cooperationContract.Undertakers[j].Orgs,
Department: cooperationContract.Undertakers[j].Department,
Roles: cooperationContract.Undertakers[j].Roles,
UserInfo: cooperationContract.Undertakers[j].UserInfo,
UserType: cooperationContract.Undertakers[j].UserType,
Referrer: cooperationContract.Undertakers[j].Referrer,
Salesman: cooperationContract.Undertakers[j].Salesman,
Status: cooperationContract.Undertakers[j].Status,
Company: cooperationContract.Undertakers[j].Company,
ContractAttachment: cooperationContract.Undertakers[j].ContractAttachment,
CreatedAt: undertakerModelsToUpdate[i].CreatedAt,
CooperationContractUndertakerId: undertaker.UndertakerId,
CooperationContractNumber: undertaker.CooperationContractNumber,
UserId: undertaker.UserId,
UserBaseId: undertaker.UserBaseId,
Org: undertaker.Org,
Orgs: undertaker.Orgs,
Department: undertaker.Department,
Roles: undertaker.Roles,
UserInfo: undertaker.UserInfo,
UserType: undertaker.UserType,
Referrer: undertaker.Referrer,
Salesman: undertaker.Salesman,
Status: undertaker.Status,
Company: undertaker.Company,
ContractAttachment: undertaker.ContractAttachment,
CreatedAt: undertakerModelToUpdate.CreatedAt,
UpdatedAt: time.Now(),
DeletedAt: undertakerModelsToUpdate[i].DeletedAt,
DeletedAt: undertakerModelToUpdate.DeletedAt,
}
}
}
... ... @@ -561,7 +558,30 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai
log.Logger.Info("待更新的分红激励规则", map[string]interface{}{
"dividendsRuleModelsToUpdate": dividendsRuleModelsToUpdate,
})
if len(dividendsRuleModelsToUpdate) > 0 {
for i, dividendsRuleModelToUpdate := range dividendsRuleModelsToUpdate {
for _, dividendsRule := range cooperationContract.DividendsIncentivesRules {
if dividendsRule.DividendsIncentivesRuleId == dividendsRuleModelToUpdate.DividendsIncentivesRuleId {
dividendsRuleModelsToUpdate[i] = &models.DividendsIncentivesRule{
DividendsIncentivesRuleId: dividendsRuleModelToUpdate.DividendsIncentivesRuleId,
CooperationContractNumber: dividendsRuleModelToUpdate.CooperationContractNumber,
ReferrerPercentage: dividendsRuleModelToUpdate.ReferrerPercentage,
SalesmanPercentage: dividendsRuleModelToUpdate.SalesmanPercentage,
DividendsIncentivesPercentage: dividendsRuleModelToUpdate.DividendsIncentivesPercentage,
DividendsIncentivesStage: dividendsRuleModelToUpdate.DividendsIncentivesStage,
DividendsIncentivesStageEnd: dividendsRuleModelToUpdate.DividendsIncentivesStageEnd,
DividendsIncentivesStageStart: dividendsRuleModelToUpdate.DividendsIncentivesStageStart,
Remarks: dividendsRuleModelToUpdate.Remarks,
Org: dividendsRuleModelToUpdate.Org,
Company: dividendsRuleModelToUpdate.Company,
UpdatedAt: time.Now(),
DeletedAt: dividendsRuleModelToUpdate.DeletedAt,
CreatedAt: dividendsRuleModelToUpdate.CreatedAt,
}
}
}
}
if _, err := tx.Model(&dividendsRuleModelsToUpdate).WherePK().Update(); err != nil {
return nil, err
}
... ... @@ -659,6 +679,29 @@ func (repository *CooperationContractRepository) Save(cooperationContract *domai
"moneyRuleModelsToUpdate": moneyRuleModelsToUpdate,
})
if len(moneyRuleModelsToUpdate) > 0 {
for i, moneyRuleModelToUpdate := range moneyRuleModelsToUpdate {
for _, moneyRule := range cooperationContract.MoneyIncentivesRules {
if moneyRule.MoneyIncentivesRuleId == moneyRuleModelToUpdate.MoneyIncentivesRuleId {
moneyRuleModelsToUpdate[i] = &models.MoneyIncentivesRule{
MoneyIncentivesRuleId: moneyRule.MoneyIncentivesRuleId,
CooperationContractNumber: moneyRule.CooperationContractNumber,
MoneyIncentivesAmount: moneyRule.MoneyIncentivesAmount,
MoneyIncentivesStage: moneyRule.MoneyIncentivesStage,
MoneyIncentivesStageEnd: moneyRule.MoneyIncentivesStageEnd,
MoneyIncentivesStageStart: moneyRule.MoneyIncentivesStageStart,
MoneyIncentivesTime: moneyRule.MoneyIncentivesTime,
ReferrerPercentage: moneyRule.MoneyIncentivesAmount,
SalesmanPercentage: moneyRule.MoneyIncentivesAmount,
Remarks: moneyRule.Remarks,
Org: moneyRule.Org,
Company: moneyRule.Company,
UpdatedAt: time.Now(),
DeletedAt: moneyRuleModelToUpdate.DeletedAt,
CreatedAt: moneyRuleModelToUpdate.CreatedAt,
}
}
}
}
if _, err := tx.Model(&moneyRuleModelsToUpdate).WherePK().Update(); err != nil {
return nil, err
}
... ... @@ -952,7 +995,7 @@ func (repository *CooperationContractRepository) Find(queryOptions map[string]in
if orgId, ok := queryOptions["orgId"]; ok && orgId.(int64) != 0 {
query.Where("org->>'orgId' = '?'", orgId)
}
if orgIds, ok := queryOptions["orgIds"]; ok && len(orgIds.([]int64)) > 0 {
if orgIds, ok := queryOptions["orgIds"]; ok && len(orgIds.([]string)) > 0 {
query.Where("org->>'orgId' in (?)", pg.In(orgIds))
}
if incentivesType, ok := queryOptions["incentivesType"]; ok && incentivesType.(int32) != 0 {
... ...
... ... @@ -187,7 +187,7 @@ func (repository *CooperationContractUndertakerRepository) Find(queryOptions map
if orgId, ok := queryOptions["orgId"]; ok && orgId.(int64) != 0 {
query.Where("org->>'orgId' = '?'", orgId)
}
if orgIds, ok := queryOptions["orgIds"]; ok && len(orgIds.([]int64)) > 0 {
if orgIds, ok := queryOptions["orgIds"]; ok && len(orgIds.([]string)) > 0 {
query.Where("org->>'orgId' in (?)", pg.In(orgIds))
}
if userBaseId, ok := queryOptions["userBaseId"]; ok && userBaseId.(int64) != 0 {
... ...
... ... @@ -187,7 +187,7 @@ func (repository *CooperationModeRepository) Find(queryOptions map[string]interf
if orgId, ok := queryOptions["orgId"]; ok && orgId.(int64) != 0 {
query.Where("org->>'orgId' = '?'", orgId)
}
if orgIds, ok := queryOptions["orgIds"]; ok && len(orgIds.([]int64)) > 0 {
if orgIds, ok := queryOptions["orgIds"]; ok && len(orgIds.([]string)) > 0 {
query.Where("org->>'orgId' in (?)", pg.In(orgIds))
}
offsetLimitFlag := true
... ...
... ... @@ -249,7 +249,7 @@ func (repository *CooperationProjectRepository) Find(queryOptions map[string]int
if orgId, ok := queryOptions["orgId"]; ok && orgId.(int64) != 0 {
query.Where("org->>'orgId' = '?'", orgId)
}
if orgIds, ok := queryOptions["orgIds"]; ok && len(orgIds.([]int64)) > 0 {
if orgIds, ok := queryOptions["orgIds"]; ok && len(orgIds.([]string)) > 0 {
query.Where("org->>'orgId' in (?)", pg.In(orgIds))
}
if v, ok := queryOptions["status"]; ok && v.(int32) > 0 {
... ...
... ... @@ -218,7 +218,7 @@ func (repository *CreditAccountRepository) Find(queryOptions map[string]interfac
if orgId, ok := queryOptions["orgId"]; ok && orgId.(int64) != 0 {
query.Where("org->>'orgId' = '?'", orgId)
}
if orgIds, ok := queryOptions["orgIds"]; ok && len(orgIds.([]int64)) > 0 {
if orgIds, ok := queryOptions["orgIds"]; ok && len(orgIds.([]string)) > 0 {
query.Where("org->>'orgId' in (?)", pg.In(orgIds))
}
offsetLimitFlag := true
... ...
... ... @@ -301,7 +301,7 @@ func (repository *DividendsEstimateRepository) Find(queryOptions map[string]inte
if orgId, ok := queryOptions["orgId"]; ok && orgId.(int64) != 0 {
query.Where("org->>'orgId' = '?'", orgId)
}
if orgIds, ok := queryOptions["orgIds"]; ok && len(orgIds.([]int64)) > 0 {
if orgIds, ok := queryOptions["orgIds"]; ok && len(orgIds.([]string)) > 0 {
query.Where("org->>'orgId' in (?)", pg.In(orgIds))
}
offsetLimitFlag := true
... ...
... ... @@ -171,7 +171,7 @@ func (repository *DividendsIncentivesRuleRepository) Find(queryOptions map[strin
if orgId, ok := queryOptions["orgId"]; ok && orgId.(int64) != 0 {
query.Where("org->>'orgId' = '?'", orgId)
}
if orgIds, ok := queryOptions["orgIds"]; ok && len(orgIds.([]int64)) > 0 {
if orgIds, ok := queryOptions["orgIds"]; ok && len(orgIds.([]string)) > 0 {
query.Where("org->>'orgId' in (?)", pg.In(orgIds))
}
offsetLimitFlag := true
... ...
... ... @@ -243,30 +243,31 @@ func (repository *DividendsOrderRepository) Save(dividendsOrder *domain.Dividend
log.Logger.Info("待更新的分红订单产品", map[string]interface{}{
"orderGoodModelsToUpdate": orderGoodModelsToUpdate,
})
if len(orderGoodModelsToUpdate) > 0 {
for i, orderGoodModelToUpdate := range orderGoodModelsToUpdate {
for j, orderGood := range dividendsOrder.Goods {
for _, orderGood := range dividendsOrder.Goods {
if orderGood.OrderGoodId == orderGoodModelToUpdate.OrderGoodId {
orderGoodModelsToUpdate[i] = &models.OrderGood{
OrderGoodId: dividendsOrder.Goods[j].OrderGoodId,
OrderGoodAmount: dividendsOrder.Goods[j].OrderGoodAmount,
OrderGoodName: dividendsOrder.Goods[j].OrderGoodName,
OrderGoodPrice: dividendsOrder.Goods[j].OrderGoodPrice,
OrderGoodQuantity: dividendsOrder.Goods[j].OrderGoodQuantity,
DividendsOrderNumber: dividendsOrder.Goods[j].DividendsOrderNumber,
DividendsReturnedOrderNumber: dividendsOrder.Goods[j].DividendsReturnedOrderNumber,
CooperationContractNumber: dividendsOrder.Goods[j].CooperationContractNumber,
OrgId: dividendsOrder.Goods[j].OrgId,
CompanyId: dividendsOrder.Goods[j].CompanyId,
OrderGoodExpense: dividendsOrder.Goods[j].OrderGoodExpense,
OrderGoodDividendsStatus: dividendsOrder.Goods[j].OrderGoodDividendsStatus,
CreatedAt: orderGoodModelsToUpdate[i].CreatedAt,
DeletedAt: orderGoodModelsToUpdate[i].DeletedAt,
OrderGoodId: orderGoodModelToUpdate.OrderGoodId,
OrderGoodAmount: orderGoodModelToUpdate.OrderGoodAmount,
OrderGoodName: orderGoodModelToUpdate.OrderGoodName,
OrderGoodPrice: orderGoodModelToUpdate.OrderGoodPrice,
OrderGoodQuantity: orderGoodModelToUpdate.OrderGoodQuantity,
DividendsOrderNumber: orderGoodModelToUpdate.DividendsOrderNumber,
DividendsReturnedOrderNumber: orderGoodModelToUpdate.DividendsReturnedOrderNumber,
CooperationContractNumber: orderGoodModelToUpdate.CooperationContractNumber,
OrgId: orderGoodModelToUpdate.OrgId,
CompanyId: orderGoodModelToUpdate.CompanyId,
OrderGoodExpense: orderGoodModelToUpdate.OrderGoodExpense,
OrderGoodDividendsStatus: orderGoodModelToUpdate.OrderGoodDividendsStatus,
CreatedAt: orderGoodModelToUpdate.CreatedAt,
DeletedAt: orderGoodModelToUpdate.DeletedAt,
UpdatedAt: time.Now(),
}
}
}
}
if len(orderGoodModelsToUpdate) > 0 {
if _, err := tx.Model(&orderGoodModelsToUpdate).WherePK().Update(); err != nil {
return nil, err
}
... ... @@ -412,7 +413,7 @@ func (repository *DividendsOrderRepository) Find(queryOptions map[string]interfa
if orgId, ok := queryOptions["orgId"]; ok && orgId.(int64) != 0 {
query.Where("org->>'orgId' = '?'", orgId)
}
if orgIds, ok := queryOptions["orgIds"]; ok && len(orgIds.([]int64)) > 0 {
if orgIds, ok := queryOptions["orgIds"]; ok && len(orgIds.([]string)) > 0 {
query.Where("org->>'orgId' in (?)", pg.In(orgIds))
}
offsetLimitFlag := true
... ...
... ... @@ -415,7 +415,7 @@ func (repository *DividendsReturnedOrderRepository) Find(queryOptions map[string
if orgId, ok := queryOptions["orgId"]; ok && orgId.(int64) != 0 {
query.Where("org->>'orgId' = '?'", orgId)
}
if orgIds, ok := queryOptions["orgIds"]; ok && len(orgIds.([]int64)) > 0 {
if orgIds, ok := queryOptions["orgIds"]; ok && len(orgIds.([]string)) > 0 {
query.Where("org->>'orgId' in (?)", pg.In(orgIds))
}
offsetLimitFlag := true
... ...
... ... @@ -171,7 +171,7 @@ func (repository *MoneyIncentivesRuleRepository) Find(queryOptions map[string]in
if orgId, ok := queryOptions["orgId"]; ok && orgId.(int64) != 0 {
query.Where("org->>'orgId' = '?'", orgId)
}
if orgIds, ok := queryOptions["orgIds"]; ok && len(orgIds.([]int64)) > 0 {
if orgIds, ok := queryOptions["orgIds"]; ok && len(orgIds.([]string)) > 0 {
query.Where("org->>'orgId' in (?)", pg.In(orgIds))
}
offsetLimitFlag := true
... ...
... ... @@ -184,7 +184,7 @@ func (repository *OrderGoodRepository) Find(queryOptions map[string]interface{})
if orgId, ok := queryOptions["orgId"]; ok && orgId.(int64) != 0 {
query.Where("org_id = '?'", orgId)
}
if orgIds, ok := queryOptions["orgIds"]; ok && len(orgIds.([]int64)) > 0 {
if orgIds, ok := queryOptions["orgIds"]; ok && len(orgIds.([]string)) > 0 {
query.Where("org_id in (?)", pg.In(orgIds))
}
offsetLimitFlag := true
... ...