正在显示
15 个修改的文件
包含
74 行增加
和
55 行删除
@@ -80,33 +80,51 @@ func (contractUndertakerFeedbackService *ContractUndertakerFeedbackService) Crea | @@ -80,33 +80,51 @@ func (contractUndertakerFeedbackService *ContractUndertakerFeedbackService) Crea | ||
80 | organization = data | 80 | organization = data |
81 | } | 81 | } |
82 | 82 | ||
83 | - newContractUndertakerFeedback := &domain.ContractUndertakerFeedback{ | ||
84 | - FeedbackAttachment: createContractUndertakerFeedbackCommand.FeedbackAttachment, | ||
85 | - FeedbackContent: createContractUndertakerFeedbackCommand.FeedbackContent, | ||
86 | - CooperationContractNumber: createContractUndertakerFeedbackCommand.CooperationContractNumber, | ||
87 | - ContractUndertaker: undertaker, | ||
88 | - Company: company, | ||
89 | - Org: organization, | ||
90 | - UpdatedAt: time.Time{}, | ||
91 | - DeletedAt: time.Time{}, | ||
92 | - CreatedAt: time.Now(), | ||
93 | - } | ||
94 | - | ||
95 | - var contractUndertakerFeedbackRepository domain.ContractUndertakerFeedbackRepository | ||
96 | - if value, err := factory.CreateContractUndertakerFeedbackRepository(map[string]interface{}{ | 83 | + // 获取项目合约信息 |
84 | + var cooperationContractRepository domain.CooperationContractRepository | ||
85 | + if value, err := factory.CreateCooperationContractRepository(map[string]interface{}{ | ||
97 | "transactionContext": transactionContext, | 86 | "transactionContext": transactionContext, |
98 | }); err != nil { | 87 | }); err != nil { |
99 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 88 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
100 | } else { | 89 | } else { |
101 | - contractUndertakerFeedbackRepository = value | 90 | + cooperationContractRepository = value |
102 | } | 91 | } |
103 | - if contractUndertakerFeedback, err := contractUndertakerFeedbackRepository.Save(newContractUndertakerFeedback); err != nil { | 92 | + cooperationContract, err := cooperationContractRepository.FindOne(map[string]interface{}{"cooperationContractNumber": createContractUndertakerFeedbackCommand.CooperationContractNumber}) |
93 | + if err != nil { | ||
104 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 94 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
95 | + } | ||
96 | + if cooperationContract == nil { | ||
97 | + return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", createContractUndertakerFeedbackCommand.CooperationContractNumber)) | ||
105 | } else { | 98 | } else { |
106 | - if err := transactionContext.CommitTransaction(); err != nil { | ||
107 | - return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | 99 | + newContractUndertakerFeedback := &domain.ContractUndertakerFeedback{ |
100 | + FeedbackAttachment: createContractUndertakerFeedbackCommand.FeedbackAttachment, | ||
101 | + FeedbackContent: createContractUndertakerFeedbackCommand.FeedbackContent, | ||
102 | + CooperationContractNumber: createContractUndertakerFeedbackCommand.CooperationContractNumber, | ||
103 | + CooperationContractName: cooperationContract.CooperationContractName, | ||
104 | + ContractUndertaker: undertaker, | ||
105 | + Company: company, | ||
106 | + Org: organization, | ||
107 | + UpdatedAt: time.Time{}, | ||
108 | + DeletedAt: time.Time{}, | ||
109 | + CreatedAt: time.Now(), | ||
110 | + } | ||
111 | + | ||
112 | + var contractUndertakerFeedbackRepository domain.ContractUndertakerFeedbackRepository | ||
113 | + if value, err := factory.CreateContractUndertakerFeedbackRepository(map[string]interface{}{ | ||
114 | + "transactionContext": transactionContext, | ||
115 | + }); err != nil { | ||
116 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
117 | + } else { | ||
118 | + contractUndertakerFeedbackRepository = value | ||
119 | + } | ||
120 | + if contractUndertakerFeedback, err := contractUndertakerFeedbackRepository.Save(newContractUndertakerFeedback); err != nil { | ||
121 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
122 | + } else { | ||
123 | + if err := transactionContext.CommitTransaction(); err != nil { | ||
124 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
125 | + } | ||
126 | + return contractUndertakerFeedback, nil | ||
108 | } | 127 | } |
109 | - return contractUndertakerFeedback, nil | ||
110 | } | 128 | } |
111 | } | 129 | } |
112 | 130 |
@@ -3,7 +3,7 @@ package domain | @@ -3,7 +3,7 @@ package domain | ||
3 | // Company 公司值对象 | 3 | // Company 公司值对象 |
4 | type Company struct { | 4 | type Company struct { |
5 | // 公司ID,通过集成REST上下文获取 | 5 | // 公司ID,通过集成REST上下文获取 |
6 | - CompanyId int64 `json:"companyId"` | 6 | + CompanyId int64 `json:"companyId,string"` |
7 | // 公司logo | 7 | // 公司logo |
8 | CompanyLogo string `json:"companyLogo"` | 8 | CompanyLogo string `json:"companyLogo"` |
9 | // 公司名称 | 9 | // 公司名称 |
@@ -12,6 +12,8 @@ type ContractUndertakerFeedback struct { | @@ -12,6 +12,8 @@ type ContractUndertakerFeedback struct { | ||
12 | FeedbackContent string `json:"feedbackContent"` | 12 | FeedbackContent string `json:"feedbackContent"` |
13 | // 共创合约编号 | 13 | // 共创合约编号 |
14 | CooperationContractNumber string `json:"cooperationContractNumber"` | 14 | CooperationContractNumber string `json:"cooperationContractNumber"` |
15 | + // 项目合约名称 | ||
16 | + CooperationContractName string `json:"cooperationContractName"` | ||
15 | // 共创合约承接人 | 17 | // 共创合约承接人 |
16 | ContractUndertaker *Undertaker `json:"contractUndertaker"` | 18 | ContractUndertaker *Undertaker `json:"contractUndertaker"` |
17 | // 数据所属组织机构 | 19 | // 数据所属组织机构 |
@@ -3,7 +3,7 @@ package domain | @@ -3,7 +3,7 @@ package domain | ||
3 | // Department 部门值对象 | 3 | // Department 部门值对象 |
4 | type Department struct { | 4 | type Department struct { |
5 | // 部门ID,通过REST集成上下文获取 | 5 | // 部门ID,通过REST集成上下文获取 |
6 | - DepartmentId int64 `json:"departmentId"` | 6 | + DepartmentId int64 `json:"departmentId,string"` |
7 | // 部门名称 | 7 | // 部门名称 |
8 | DepartmentName string `json:"departmentName"` | 8 | DepartmentName string `json:"departmentName"` |
9 | // 部门编码 | 9 | // 部门编码 |
@@ -3,7 +3,7 @@ package domain | @@ -3,7 +3,7 @@ package domain | ||
3 | // Org 组织机构值对象 | 3 | // Org 组织机构值对象 |
4 | type Org struct { | 4 | type Org struct { |
5 | // 组织机构ID | 5 | // 组织机构ID |
6 | - OrgId int64 `json:"orgId"` | 6 | + OrgId int64 `json:"orgId,string"` |
7 | // 组织名称 | 7 | // 组织名称 |
8 | OrgName string `json:"orgName"` | 8 | OrgName string `json:"orgName"` |
9 | // 公司 | 9 | // 公司 |
@@ -3,9 +3,9 @@ package domain | @@ -3,9 +3,9 @@ package domain | ||
3 | // Participator 共创参与人 | 3 | // Participator 共创参与人 |
4 | type Participator struct { | 4 | type Participator struct { |
5 | // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员 | 5 | // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员 |
6 | - UserId int64 `json:"userId"` | 6 | + UserId int64 `json:"userId,string"` |
7 | // 用户基本id | 7 | // 用户基本id |
8 | - UserBaseId int64 `json:"userBaseId"` | 8 | + UserBaseId int64 `json:"userBaseId,string"` |
9 | // 用户所属的组织机构 | 9 | // 用户所属的组织机构 |
10 | Org *Org `json:"org"` | 10 | Org *Org `json:"org"` |
11 | // 用户关联的组织机构 | 11 | // 用户关联的组织机构 |
@@ -3,9 +3,9 @@ package domain | @@ -3,9 +3,9 @@ package domain | ||
3 | // Referrer 推荐人值对象 | 3 | // Referrer 推荐人值对象 |
4 | type Referrer struct { | 4 | type Referrer struct { |
5 | // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员 | 5 | // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员 |
6 | - UserId int64 `json:"userId"` | 6 | + UserId int64 `json:"userId,string"` |
7 | // 用户基本id | 7 | // 用户基本id |
8 | - UserBaseId int64 `json:"userBaseId"` | 8 | + UserBaseId int64 `json:"userBaseId,string"` |
9 | // 用户角色 | 9 | // 用户角色 |
10 | Roles []*Role `json:"role"` | 10 | Roles []*Role `json:"role"` |
11 | // 用户关联的组织机构 | 11 | // 用户关联的组织机构 |
@@ -3,13 +3,13 @@ package domain | @@ -3,13 +3,13 @@ package domain | ||
3 | // Relevant 共创合约相关人值对象 | 3 | // Relevant 共创合约相关人值对象 |
4 | type Relevant struct { | 4 | type Relevant struct { |
5 | // 相关人id | 5 | // 相关人id |
6 | - RelevantId int64 `json:"relevantId"` | 6 | + RelevantId int64 `json:"relevantId,string"` |
7 | // 共创合约编号 | 7 | // 共创合约编号 |
8 | CooperationContractNumber string `json:"cooperationContractNumber"` | 8 | CooperationContractNumber string `json:"cooperationContractNumber"` |
9 | // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员 | 9 | // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员 |
10 | - UserId int64 `json:"userId"` | 10 | + UserId int64 `json:"userId,string"` |
11 | // 用户基本id | 11 | // 用户基本id |
12 | - UserBaseId int64 `json:"userBaseId"` | 12 | + UserBaseId int64 `json:"userBaseId,string"` |
13 | // 用户所属的组织机构 | 13 | // 用户所属的组织机构 |
14 | Org *Org `json:"org"` | 14 | Org *Org `json:"org"` |
15 | // 用户关联的组织机构 | 15 | // 用户关联的组织机构 |
@@ -3,9 +3,9 @@ package domain | @@ -3,9 +3,9 @@ package domain | ||
3 | // Salesman 业务员值对象 | 3 | // Salesman 业务员值对象 |
4 | type Salesman struct { | 4 | type Salesman struct { |
5 | // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员 | 5 | // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员 |
6 | - UserId int64 `json:"userId"` | 6 | + UserId int64 `json:"userId,string"` |
7 | // 用户基本id | 7 | // 用户基本id |
8 | - UserBaseId int64 `json:"userBaseId"` | 8 | + UserBaseId int64 `json:"userBaseId,string"` |
9 | // 用户角色 | 9 | // 用户角色 |
10 | Roles []*Role `json:"role"` | 10 | Roles []*Role `json:"role"` |
11 | // 用户关联的组织机构 | 11 | // 用户关联的组织机构 |
@@ -3,11 +3,11 @@ package domain | @@ -3,11 +3,11 @@ package domain | ||
3 | // Undertaker 共创合约承接方值对象 | 3 | // Undertaker 共创合约承接方值对象 |
4 | type Undertaker struct { | 4 | type Undertaker struct { |
5 | // 承接人id | 5 | // 承接人id |
6 | - UndertakerId int64 `json:"relevantId"` | 6 | + UndertakerId int64 `json:"relevantId,string"` |
7 | // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员 | 7 | // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员 |
8 | - UserId int64 `json:"userId"` | 8 | + UserId int64 `json:"userId,string"` |
9 | // 用户基本id | 9 | // 用户基本id |
10 | - UserBaseId int64 `json:"userBaseId"` | 10 | + UserBaseId int64 `json:"userBaseId,string"` |
11 | // 共创合约编号 | 11 | // 共创合约编号 |
12 | CooperationContractNumber string `json:"cooperationContractNumber"` | 12 | CooperationContractNumber string `json:"cooperationContractNumber"` |
13 | // 用户所属组织机构 | 13 | // 用户所属组织机构 |
@@ -3,9 +3,9 @@ package domain | @@ -3,9 +3,9 @@ package domain | ||
3 | // User 用户第三方服务防腐模型 | 3 | // User 用户第三方服务防腐模型 |
4 | type User struct { | 4 | type User struct { |
5 | // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员 | 5 | // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员 |
6 | - UserId int64 `json:"userId"` | 6 | + UserId int64 `json:"userId,string"` |
7 | // 用户基本id | 7 | // 用户基本id |
8 | - UserBaseId int64 `json:"userBaseId"` | 8 | + UserBaseId int64 `json:"userBaseId,string"` |
9 | // 用户所属组织机构 | 9 | // 用户所属组织机构 |
10 | Org *Org `json:"org"` | 10 | Org *Org `json:"org"` |
11 | // 用户关联的组织机构 | 11 | // 用户关联的组织机构 |
@@ -27,9 +27,6 @@ func (service *UserService) UserFrom(companyId int64, orgId int64, userId int64) | @@ -27,9 +27,6 @@ func (service *UserService) UserFrom(companyId int64, orgId int64, userId int64) | ||
27 | if err1 != nil { | 27 | if err1 != nil { |
28 | return nil, err | 28 | return nil, err |
29 | } | 29 | } |
30 | - log.Logger.Debug("普通用户", map[string]interface{}{ | ||
31 | - "user json": userJson, | ||
32 | - }) | ||
33 | err2 := json.Unmarshal(userJson, &returnData) | 30 | err2 := json.Unmarshal(userJson, &returnData) |
34 | if err2 != nil { | 31 | if err2 != nil { |
35 | return nil, err2 | 32 | return nil, err2 |
@@ -57,9 +54,6 @@ func (service *UserService) ReferrerFrom(companyId int64, orgId int64, userId in | @@ -57,9 +54,6 @@ func (service *UserService) ReferrerFrom(companyId int64, orgId int64, userId in | ||
57 | if err1 != nil { | 54 | if err1 != nil { |
58 | return nil, err | 55 | return nil, err |
59 | } | 56 | } |
60 | - log.Logger.Debug("推荐人", map[string]interface{}{ | ||
61 | - "referrer json": referrerJson, | ||
62 | - }) | ||
63 | err2 := json.Unmarshal(referrerJson, &returnData) | 57 | err2 := json.Unmarshal(referrerJson, &returnData) |
64 | if err2 != nil { | 58 | if err2 != nil { |
65 | return nil, err2 | 59 | return nil, err2 |
@@ -87,9 +81,6 @@ func (service *UserService) UndertakerFrom(companyId int64, orgId int64, userId | @@ -87,9 +81,6 @@ func (service *UserService) UndertakerFrom(companyId int64, orgId int64, userId | ||
87 | if err1 != nil { | 81 | if err1 != nil { |
88 | return nil, err | 82 | return nil, err |
89 | } | 83 | } |
90 | - log.Logger.Debug("承接人", map[string]interface{}{ | ||
91 | - "undertaker json": undertakerJson, | ||
92 | - }) | ||
93 | err2 := json.Unmarshal(undertakerJson, &returnData) | 84 | err2 := json.Unmarshal(undertakerJson, &returnData) |
94 | if err2 != nil { | 85 | if err2 != nil { |
95 | return nil, err2 | 86 | return nil, err2 |
@@ -117,9 +108,6 @@ func (service *UserService) RelevantFrom(companyId int64, orgId int64, userId in | @@ -117,9 +108,6 @@ func (service *UserService) RelevantFrom(companyId int64, orgId int64, userId in | ||
117 | if err1 != nil { | 108 | if err1 != nil { |
118 | return nil, err | 109 | return nil, err |
119 | } | 110 | } |
120 | - log.Logger.Debug("相关人", map[string]interface{}{ | ||
121 | - "relevant json": relevantJson, | ||
122 | - }) | ||
123 | err2 := json.Unmarshal(relevantJson, &returnData) | 111 | err2 := json.Unmarshal(relevantJson, &returnData) |
124 | if err2 != nil { | 112 | if err2 != nil { |
125 | return nil, err2 | 113 | return nil, err2 |
@@ -147,9 +135,6 @@ func (service *UserService) SalesmanFrom(companyId int64, orgId int64, userId in | @@ -147,9 +135,6 @@ func (service *UserService) SalesmanFrom(companyId int64, orgId int64, userId in | ||
147 | if err1 != nil { | 135 | if err1 != nil { |
148 | return nil, err | 136 | return nil, err |
149 | } | 137 | } |
150 | - log.Logger.Debug("业务员", map[string]interface{}{ | ||
151 | - "salesman json": salesmanJson, | ||
152 | - }) | ||
153 | err2 := json.Unmarshal(salesmanJson, &returnData) | 138 | err2 := json.Unmarshal(salesmanJson, &returnData) |
154 | if err2 != nil { | 139 | if err2 != nil { |
155 | return nil, err2 | 140 | return nil, err2 |
@@ -177,9 +162,6 @@ func (service *UserService) OperatorFrom(companyId int64, orgId int64, userId in | @@ -177,9 +162,6 @@ func (service *UserService) OperatorFrom(companyId int64, orgId int64, userId in | ||
177 | if err1 != nil { | 162 | if err1 != nil { |
178 | return nil, err | 163 | return nil, err |
179 | } | 164 | } |
180 | - log.Logger.Debug("操作人", map[string]interface{}{ | ||
181 | - "operator json": operatorJson, | ||
182 | - }) | ||
183 | err2 := json.Unmarshal(operatorJson, &returnData) | 165 | err2 := json.Unmarshal(operatorJson, &returnData) |
184 | if err2 != nil { | 166 | if err2 != nil { |
185 | return nil, err2 | 167 | return nil, err2 |
@@ -15,6 +15,8 @@ type ContractUndertakerFeedback struct { | @@ -15,6 +15,8 @@ type ContractUndertakerFeedback struct { | ||
15 | FeedbackContent string `comment:"合约承接方反馈内容"` | 15 | FeedbackContent string `comment:"合约承接方反馈内容"` |
16 | // 共创合约编号 | 16 | // 共创合约编号 |
17 | CooperationContractNumber string `comment:"共创合约编号"` | 17 | CooperationContractNumber string `comment:"共创合约编号"` |
18 | + // 项目合约名称 | ||
19 | + CooperationContractName string `comment:"项目合约名称"` | ||
18 | // 共创合约承接人 | 20 | // 共创合约承接人 |
19 | ContractUndertaker *domain.Undertaker `comment:"共创合约承接人"` | 21 | ContractUndertaker *domain.Undertaker `comment:"共创合约承接人"` |
20 | // 数据所属组织机构 | 22 | // 数据所属组织机构 |
@@ -3,7 +3,7 @@ package repository | @@ -3,7 +3,7 @@ package repository | ||
3 | import ( | 3 | import ( |
4 | "fmt" | 4 | "fmt" |
5 | "github.com/go-pg/pg/v10" | 5 | "github.com/go-pg/pg/v10" |
6 | - | 6 | + "github.com/go-pg/pg/v10/orm" |
7 | "github.com/linmadan/egglib-go/persistent/pg/sqlbuilder" | 7 | "github.com/linmadan/egglib-go/persistent/pg/sqlbuilder" |
8 | pgTransaction "github.com/linmadan/egglib-go/transaction/pg" | 8 | pgTransaction "github.com/linmadan/egglib-go/transaction/pg" |
9 | "github.com/linmadan/egglib-go/utils/snowflake" | 9 | "github.com/linmadan/egglib-go/utils/snowflake" |
@@ -31,6 +31,7 @@ func (repository *ContractUndertakerFeedbackRepository) Save(contractUndertakerF | @@ -31,6 +31,7 @@ func (repository *ContractUndertakerFeedbackRepository) Save(contractUndertakerF | ||
31 | "feedback_attachment", | 31 | "feedback_attachment", |
32 | "feedback_content", | 32 | "feedback_content", |
33 | "cooperation_contract_number", | 33 | "cooperation_contract_number", |
34 | + "cooperation_contract_name", | ||
34 | "contract_undertaker", | 35 | "contract_undertaker", |
35 | "org", | 36 | "org", |
36 | "company", | 37 | "company", |
@@ -57,6 +58,7 @@ func (repository *ContractUndertakerFeedbackRepository) Save(contractUndertakerF | @@ -57,6 +58,7 @@ func (repository *ContractUndertakerFeedbackRepository) Save(contractUndertakerF | ||
57 | &contractUndertakerFeedback.FeedbackAttachment, | 58 | &contractUndertakerFeedback.FeedbackAttachment, |
58 | &contractUndertakerFeedback.FeedbackContent, | 59 | &contractUndertakerFeedback.FeedbackContent, |
59 | &contractUndertakerFeedback.CooperationContractNumber, | 60 | &contractUndertakerFeedback.CooperationContractNumber, |
61 | + &contractUndertakerFeedback.CooperationContractName, | ||
60 | &contractUndertakerFeedback.ContractUndertaker, | 62 | &contractUndertakerFeedback.ContractUndertaker, |
61 | &contractUndertakerFeedback.Org, | 63 | &contractUndertakerFeedback.Org, |
62 | &contractUndertakerFeedback.Company, | 64 | &contractUndertakerFeedback.Company, |
@@ -69,6 +71,7 @@ func (repository *ContractUndertakerFeedbackRepository) Save(contractUndertakerF | @@ -69,6 +71,7 @@ func (repository *ContractUndertakerFeedbackRepository) Save(contractUndertakerF | ||
69 | contractUndertakerFeedback.FeedbackAttachment, | 71 | contractUndertakerFeedback.FeedbackAttachment, |
70 | contractUndertakerFeedback.FeedbackContent, | 72 | contractUndertakerFeedback.FeedbackContent, |
71 | contractUndertakerFeedback.CooperationContractNumber, | 73 | contractUndertakerFeedback.CooperationContractNumber, |
74 | + contractUndertakerFeedback.CooperationContractName, | ||
72 | contractUndertakerFeedback.ContractUndertaker, | 75 | contractUndertakerFeedback.ContractUndertaker, |
73 | contractUndertakerFeedback.Org, | 76 | contractUndertakerFeedback.Org, |
74 | contractUndertakerFeedback.Company, | 77 | contractUndertakerFeedback.Company, |
@@ -85,6 +88,7 @@ func (repository *ContractUndertakerFeedbackRepository) Save(contractUndertakerF | @@ -85,6 +88,7 @@ func (repository *ContractUndertakerFeedbackRepository) Save(contractUndertakerF | ||
85 | &contractUndertakerFeedback.FeedbackAttachment, | 88 | &contractUndertakerFeedback.FeedbackAttachment, |
86 | &contractUndertakerFeedback.FeedbackContent, | 89 | &contractUndertakerFeedback.FeedbackContent, |
87 | &contractUndertakerFeedback.CooperationContractNumber, | 90 | &contractUndertakerFeedback.CooperationContractNumber, |
91 | + &contractUndertakerFeedback.CooperationContractName, | ||
88 | &contractUndertakerFeedback.ContractUndertaker, | 92 | &contractUndertakerFeedback.ContractUndertaker, |
89 | &contractUndertakerFeedback.Org, | 93 | &contractUndertakerFeedback.Org, |
90 | &contractUndertakerFeedback.Company, | 94 | &contractUndertakerFeedback.Company, |
@@ -97,6 +101,7 @@ func (repository *ContractUndertakerFeedbackRepository) Save(contractUndertakerF | @@ -97,6 +101,7 @@ func (repository *ContractUndertakerFeedbackRepository) Save(contractUndertakerF | ||
97 | contractUndertakerFeedback.FeedbackAttachment, | 101 | contractUndertakerFeedback.FeedbackAttachment, |
98 | contractUndertakerFeedback.FeedbackContent, | 102 | contractUndertakerFeedback.FeedbackContent, |
99 | contractUndertakerFeedback.CooperationContractNumber, | 103 | contractUndertakerFeedback.CooperationContractNumber, |
104 | + contractUndertakerFeedback.CooperationContractName, | ||
100 | contractUndertakerFeedback.ContractUndertaker, | 105 | contractUndertakerFeedback.ContractUndertaker, |
101 | contractUndertakerFeedback.Org, | 106 | contractUndertakerFeedback.Org, |
102 | contractUndertakerFeedback.Company, | 107 | contractUndertakerFeedback.Company, |
@@ -151,6 +156,15 @@ func (repository *ContractUndertakerFeedbackRepository) Find(queryOptions map[st | @@ -151,6 +156,15 @@ func (repository *ContractUndertakerFeedbackRepository) Find(queryOptions map[st | ||
151 | if undertakerName, ok := queryOptions["undertakerName"]; ok && undertakerName != "" { | 156 | if undertakerName, ok := queryOptions["undertakerName"]; ok && undertakerName != "" { |
152 | query.Where("contract_undertaker->>'userName' like ?", fmt.Sprintf("%%%s%%", undertakerName)) | 157 | query.Where("contract_undertaker->>'userName' like ?", fmt.Sprintf("%%%s%%", undertakerName)) |
153 | } | 158 | } |
159 | + // 搜索内容包括项目合约名称、承接人姓名、承接内容关键字 | ||
160 | + if matchWord, ok := queryOptions["matchWord"]; ok && matchWord != "" { | ||
161 | + query.WhereGroup(func(q *orm.Query) (*orm.Query, error) { | ||
162 | + q.WhereOr("cooperation_contract_name like ?",fmt.Sprintf("%%%s%%", matchWord)) | ||
163 | + q.WhereOr("contract_undertaker->>'userName' like ?", fmt.Sprintf("%%%s%%", matchWord)) | ||
164 | + q.WhereOr("feedback_content like ?", fmt.Sprintf("%%%s%%", matchWord)) | ||
165 | + return q, nil | ||
166 | + }) | ||
167 | + } | ||
154 | query.SetOffsetAndLimit(20) | 168 | query.SetOffsetAndLimit(20) |
155 | query.SetOrderDirect("feedback_id", "DESC") | 169 | query.SetOrderDirect("feedback_id", "DESC") |
156 | if count, err := query.SelectAndCount(); err != nil { | 170 | if count, err := query.SelectAndCount(); err != nil { |
@@ -625,6 +625,7 @@ func (repository *CooperationContractRepository) FindOne(queryOptions map[string | @@ -625,6 +625,7 @@ func (repository *CooperationContractRepository) FindOne(queryOptions map[string | ||
625 | cooperationContractModel := new(models.CooperationContract) | 625 | cooperationContractModel := new(models.CooperationContract) |
626 | query := sqlbuilder.BuildQuery(tx.Model(cooperationContractModel), queryOptions) | 626 | query := sqlbuilder.BuildQuery(tx.Model(cooperationContractModel), queryOptions) |
627 | query.SetWhereByQueryOption("cooperation_contract.cooperation_contract_id = ?", "cooperationContractId") | 627 | query.SetWhereByQueryOption("cooperation_contract.cooperation_contract_id = ?", "cooperationContractId") |
628 | + query.SetWhereByQueryOption("cooperation_contract.cooperation_contract_number = ?", "cooperationContractNumber") | ||
628 | if err := query.First(); err != nil { | 629 | if err := query.First(); err != nil { |
629 | if err.Error() == "pg: no rows in result set" { | 630 | if err.Error() == "pg: no rows in result set" { |
630 | return nil, fmt.Errorf("没有此资源") | 631 | return nil, fmt.Errorf("没有此资源") |
-
请 注册 或 登录 后发表评论