|
@@ -140,12 +140,30 @@ public class SupplierQuotationProjectQuoteServiceImpl |
|
@@ -140,12 +140,30 @@ public class SupplierQuotationProjectQuoteServiceImpl |
|
140
|
|
140
|
|
|
141
|
Set<String> roleCodeSet = getRoleCodeSet(userId);
|
141
|
Set<String> roleCodeSet = getRoleCodeSet(userId);
|
|
142
|
|
142
|
|
|
|
|
143
|
+ // 供应商只能看到自己的报价
|
|
143
|
if (roleCodeSet.contains("gys")) {
|
144
|
if (roleCodeSet.contains("gys")) {
|
|
144
|
- SupplierQuotationProjectQuote supplierQuotationProjectQuote = getBaseMapper().findByProjectAndSupplier(projectId, userId);
|
|
|
|
145
|
- if (supplierQuotationProjectQuote == null) {
|
145
|
+ SupplierQuotationProjectQuote myQuote = getBaseMapper().findByProjectAndSupplier(projectId, userId);
|
|
|
|
146
|
+ if (myQuote == null) {
|
|
146
|
return Collections.emptyList();
|
147
|
return Collections.emptyList();
|
|
147
|
}
|
148
|
}
|
|
148
|
- return Collections.singletonList(supplierQuotationProjectQuote);
|
149
|
+
|
|
|
|
150
|
+ // 【核心修改 1】如果是实时成交项目,为供应商计算排名
|
|
|
|
151
|
+ if (isRealTime(project.getProjectType())) {
|
|
|
|
152
|
+ // 从数据库查出该项目下所有的报价(仅用于计算排名,不返回给前端)
|
|
|
|
153
|
+ // 注意:这里查全量数据是为了算排名,如果数据量极大,可以考虑在 Mapper 中单独写一个只查 price 和 id 的方法
|
|
|
|
154
|
+ List<SupplierQuotationProjectQuote> allQuotes = getBaseMapper().listByProject(projectId, ORDER_BY_PRICE_ASC);
|
|
|
|
155
|
+
|
|
|
|
156
|
+ // 遍历所有报价,找到当前用户的报价并赋予排名
|
|
|
|
157
|
+ for (int i = 0; i < allQuotes.size(); i++) {
|
|
|
|
158
|
+ // 假设实体类有 getId() 方法,通过主键匹配
|
|
|
|
159
|
+ if (allQuotes.get(i).getId().equals(myQuote.getId())) {
|
|
|
|
160
|
+ myQuote.setRank(i + 1); // 排名从 1 开始
|
|
|
|
161
|
+ break;
|
|
|
|
162
|
+ }
|
|
|
|
163
|
+ }
|
|
|
|
164
|
+ }
|
|
|
|
165
|
+
|
|
|
|
166
|
+ return Collections.singletonList(myQuote);
|
|
149
|
}
|
167
|
}
|
|
150
|
|
168
|
|
|
151
|
LocalDateTime now = LocalDateTime.now();
|
169
|
LocalDateTime now = LocalDateTime.now();
|
|
@@ -161,6 +179,12 @@ public class SupplierQuotationProjectQuoteServiceImpl |
|
@@ -161,6 +179,12 @@ public class SupplierQuotationProjectQuoteServiceImpl |
|
161
|
}
|
179
|
}
|
|
162
|
|
180
|
|
|
163
|
List<SupplierQuotationProjectQuote> list = getBaseMapper().listByProject(projectId, orderBy);
|
181
|
List<SupplierQuotationProjectQuote> list = getBaseMapper().listByProject(projectId, orderBy);
|
|
|
|
182
|
+ if (realTime && CollectionUtil.isNotEmpty(list)) {
|
|
|
|
183
|
+ for (int i = 0; i < list.size(); i++) {
|
|
|
|
184
|
+ list.get(i).setRank(i + 1);
|
|
|
|
185
|
+ }
|
|
|
|
186
|
+ }
|
|
|
|
187
|
+
|
|
164
|
if (beforeBidTime && CollectionUtil.isNotEmpty(list)) {
|
188
|
if (beforeBidTime && CollectionUtil.isNotEmpty(list)) {
|
|
165
|
list.forEach(v -> v.setPrice(null));
|
189
|
list.forEach(v -> v.setPrice(null));
|
|
166
|
}
|
190
|
}
|