Commit 5ba46b213883bc15900b68a49314443621003671
1 parent
ed1da727
feat: 申请列表-订单信息展示
Showing
2 changed files
with
188 additions
and
4 deletions
src/main/java/com/order/erp/domain/vo/order/OrderApplyResultVO.java
1 | 1 | package com.order.erp.domain.vo.order; |
2 | 2 | |
3 | -import com.baomidou.mybatisplus.annotation.FieldFill; | |
4 | -import com.baomidou.mybatisplus.annotation.TableField; | |
5 | -import com.baomidou.mybatisplus.annotation.TableLogic; | |
6 | 3 | import com.fasterxml.jackson.annotation.JsonFormat; |
7 | 4 | import lombok.*; |
8 | 5 | import lombok.experimental.SuperBuilder; |
9 | -import org.apache.ibatis.type.LocalDateTimeTypeHandler; | |
10 | 6 | |
11 | 7 | import java.io.Serializable; |
12 | 8 | import java.time.LocalDateTime; |
... | ... | @@ -80,5 +76,30 @@ public class OrderApplyResultVO implements Serializable { |
80 | 76 | */ |
81 | 77 | private String modifyBy; |
82 | 78 | |
79 | + /** | |
80 | + * 订单基础信息 | |
81 | + */ | |
82 | + private OrderBaseInfoVO orderBaseInfo; | |
83 | + | |
84 | + /** | |
85 | + * 利润分析信息 | |
86 | + */ | |
87 | + private OrderProfitAnalysisVO profitAnalysisInfo; | |
88 | + | |
89 | + /** | |
90 | + * 项目完成报告信息 | |
91 | + */ | |
92 | + private OrderCompletionReportVO reportInfo; | |
93 | + | |
94 | + /** | |
95 | + * 跟单信息 | |
96 | + */ | |
97 | + private OrderTrackStageVO trackStageInfo; | |
98 | + | |
99 | + /** | |
100 | + * 质检信息 | |
101 | + */ | |
102 | + private OrderInspectionStageVO inspectionStageInfo; | |
103 | + | |
83 | 104 | |
84 | 105 | } | ... | ... |
src/main/java/com/order/erp/service/order/impl/OrderFieldLockApplyServiceImpl.java
... | ... | @@ -30,7 +30,10 @@ import org.springframework.transaction.annotation.Transactional; |
30 | 30 | |
31 | 31 | import javax.annotation.Resource; |
32 | 32 | import java.util.List; |
33 | +import java.util.Map; | |
33 | 34 | import java.util.Objects; |
35 | +import java.util.Set; | |
36 | +import java.util.function.Function; | |
34 | 37 | import java.util.stream.Collectors; |
35 | 38 | |
36 | 39 | /** |
... | ... | @@ -64,6 +67,12 @@ public class OrderFieldLockApplyServiceImpl extends ServiceImpl<OrderFieldLockAp |
64 | 67 | @Resource |
65 | 68 | private OrderProfitAnalysisService profitAnalysisService; |
66 | 69 | |
70 | + @Resource | |
71 | + private OrderTrackStageService trackStageService; | |
72 | + | |
73 | + @Resource | |
74 | + private OrderInspectionStageService inspectionStageService; | |
75 | + | |
67 | 76 | /** |
68 | 77 | * 通过ID查询单条数据 |
69 | 78 | * <p> |
... | ... | @@ -114,6 +123,7 @@ public class OrderFieldLockApplyServiceImpl extends ServiceImpl<OrderFieldLockAp |
114 | 123 | return resultVO; |
115 | 124 | }).collect(Collectors.toList()); |
116 | 125 | |
126 | + fillOrderInfo(resultVOList); | |
117 | 127 | webVOPage.setRecords(resultVOList); |
118 | 128 | } |
119 | 129 | BeanUtils.copyProperties(page, webVOPage, "records"); |
... | ... | @@ -121,6 +131,159 @@ public class OrderFieldLockApplyServiceImpl extends ServiceImpl<OrderFieldLockAp |
121 | 131 | } |
122 | 132 | |
123 | 133 | /** |
134 | + * @param resultVOList | |
135 | + */ | |
136 | + private void fillOrderInfo(List<OrderApplyResultVO> resultVOList) { | |
137 | + if (CollectionUtils.isEmpty(resultVOList)) { | |
138 | + return; | |
139 | + } | |
140 | + Set<Long> orderIds = resultVOList.stream().map(OrderApplyResultVO::getOrderId).collect(Collectors.toSet()); | |
141 | + List<OrderBaseInfoDO> orderBaseInfoDOList = orderBaseInfoService.listByIds(orderIds); | |
142 | + | |
143 | + if (CollectionUtils.isNotEmpty(orderBaseInfoDOList)) { | |
144 | + fillOrderBaseInfo(resultVOList, orderBaseInfoDOList); | |
145 | + } | |
146 | + | |
147 | + List<OrderCompletionReportDO> reportDOList = reportService.list(new LambdaQueryWrapper<OrderCompletionReportDO>() | |
148 | + .eq(BaseDO::getEnableFlag, Constant.ENABLE_TEN).in(OrderCompletionReportDO::getOrderId, orderIds)); | |
149 | + | |
150 | + if (CollectionUtils.isNotEmpty(reportDOList)) { | |
151 | + fillOrderReportInfo(resultVOList, reportDOList); | |
152 | + } | |
153 | + | |
154 | + List<OrderProfitAnalysisDO> profitAnalysisDOList = profitAnalysisService.list(new LambdaQueryWrapper<OrderProfitAnalysisDO>() | |
155 | + .eq(BaseDO::getEnableFlag, Constant.ENABLE_TEN).in(OrderProfitAnalysisDO::getOrderId, orderIds)); | |
156 | + | |
157 | + if (CollectionUtils.isNotEmpty(profitAnalysisDOList)) { | |
158 | + fillOrderProfitInfo(resultVOList, profitAnalysisDOList); | |
159 | + } | |
160 | + | |
161 | + List<OrderTrackStageDO> trackStageDOList = trackStageService.list(new LambdaQueryWrapper<OrderTrackStageDO>() | |
162 | + .eq(BaseDO::getEnableFlag, Constant.ENABLE_TEN).in(OrderTrackStageDO::getOrderId, orderIds)); | |
163 | + | |
164 | + if (CollectionUtils.isNotEmpty(trackStageDOList)) { | |
165 | + fillOrderTrackerInfo(resultVOList, trackStageDOList); | |
166 | + } | |
167 | + | |
168 | + List<OrderInspectionStageDO> inspectionStageDOList = inspectionStageService.list(new LambdaQueryWrapper<OrderInspectionStageDO>() | |
169 | + .eq(BaseDO::getEnableFlag, Constant.ENABLE_TEN).in(OrderInspectionStageDO::getOrderId, orderIds)); | |
170 | + | |
171 | + if (CollectionUtils.isNotEmpty(inspectionStageDOList)) { | |
172 | + fillOrderInspectInfo(resultVOList, inspectionStageDOList); | |
173 | + } | |
174 | + } | |
175 | + | |
176 | + /** | |
177 | + * @param resultVOList | |
178 | + * @param orderBaseInfoDOList | |
179 | + */ | |
180 | + private void fillOrderBaseInfo(List<OrderApplyResultVO> resultVOList, List<OrderBaseInfoDO> orderBaseInfoDOList) { | |
181 | + if (CollectionUtils.isEmpty(resultVOList)) { | |
182 | + return; | |
183 | + } | |
184 | + if (CollectionUtils.isEmpty(orderBaseInfoDOList)) { | |
185 | + return; | |
186 | + } | |
187 | + Map<Long, OrderBaseInfoDO> orderBaseInfoDOMap = orderBaseInfoDOList.stream().collect(Collectors.toMap(OrderBaseInfoDO::getId, Function.identity())); | |
188 | + resultVOList.forEach(x -> { | |
189 | + if (orderBaseInfoDOMap.containsKey(x.getOrderId())) { | |
190 | + OrderBaseInfoDO orderBaseInfoDO = orderBaseInfoDOMap.get(x.getOrderId()); | |
191 | + OrderBaseInfoVO orderBaseInfo = new OrderBaseInfoVO(); | |
192 | + BeanUtils.copyProperties(orderBaseInfoDO, orderBaseInfo); | |
193 | + x.setOrderBaseInfo(orderBaseInfo); | |
194 | + } | |
195 | + }); | |
196 | + } | |
197 | + | |
198 | + /** | |
199 | + * @param resultVOList | |
200 | + * @param reportDOList | |
201 | + */ | |
202 | + private void fillOrderReportInfo(List<OrderApplyResultVO> resultVOList, List<OrderCompletionReportDO> reportDOList) { | |
203 | + if (CollectionUtils.isEmpty(resultVOList)) { | |
204 | + return; | |
205 | + } | |
206 | + if (CollectionUtils.isEmpty(reportDOList)) { | |
207 | + return; | |
208 | + } | |
209 | + Map<Long, OrderCompletionReportDO> reportDOMap = reportDOList.stream().collect(Collectors.toMap(OrderCompletionReportDO::getId, Function.identity())); | |
210 | + resultVOList.forEach(x -> { | |
211 | + if (reportDOMap.containsKey(x.getOrderId())) { | |
212 | + OrderCompletionReportDO reportDO = reportDOMap.get(x.getOrderId()); | |
213 | + OrderCompletionReportVO reportVO = new OrderCompletionReportVO(); | |
214 | + BeanUtils.copyProperties(reportDO, reportVO); | |
215 | + x.setReportInfo(reportVO); | |
216 | + } | |
217 | + }); | |
218 | + } | |
219 | + | |
220 | + /** | |
221 | + * @param resultVOList | |
222 | + * @param profitAnalysisDOS | |
223 | + */ | |
224 | + private void fillOrderProfitInfo(List<OrderApplyResultVO> resultVOList, List<OrderProfitAnalysisDO> profitAnalysisDOS) { | |
225 | + if (CollectionUtils.isEmpty(resultVOList)) { | |
226 | + return; | |
227 | + } | |
228 | + if (CollectionUtils.isEmpty(profitAnalysisDOS)) { | |
229 | + return; | |
230 | + } | |
231 | + Map<Long, OrderProfitAnalysisDO> profitAnalysisDOMap = profitAnalysisDOS.stream().collect(Collectors.toMap(OrderProfitAnalysisDO::getId, Function.identity())); | |
232 | + resultVOList.forEach(x -> { | |
233 | + if (profitAnalysisDOMap.containsKey(x.getOrderId())) { | |
234 | + OrderProfitAnalysisDO profitAnalysisDO = profitAnalysisDOMap.get(x.getOrderId()); | |
235 | + OrderProfitAnalysisVO profitAnalysisVO = new OrderProfitAnalysisVO(); | |
236 | + BeanUtils.copyProperties(profitAnalysisDO, profitAnalysisVO); | |
237 | + x.setProfitAnalysisInfo(profitAnalysisVO); | |
238 | + } | |
239 | + }); | |
240 | + } | |
241 | + | |
242 | + /** | |
243 | + * @param resultVOList | |
244 | + * @param trackStageDOS | |
245 | + */ | |
246 | + private void fillOrderTrackerInfo(List<OrderApplyResultVO> resultVOList, List<OrderTrackStageDO> trackStageDOS) { | |
247 | + if (CollectionUtils.isEmpty(resultVOList)) { | |
248 | + return; | |
249 | + } | |
250 | + if (CollectionUtils.isEmpty(trackStageDOS)) { | |
251 | + return; | |
252 | + } | |
253 | + Map<Long, OrderTrackStageDO> trackStageDOMap = trackStageDOS.stream().collect(Collectors.toMap(OrderTrackStageDO::getId, Function.identity())); | |
254 | + resultVOList.forEach(x -> { | |
255 | + if (trackStageDOMap.containsKey(x.getOrderId())) { | |
256 | + OrderTrackStageDO trackStageDO = trackStageDOMap.get(x.getOrderId()); | |
257 | + OrderTrackStageVO trackStageVO = new OrderTrackStageVO(); | |
258 | + BeanUtils.copyProperties(trackStageDO, trackStageVO); | |
259 | + x.setTrackStageInfo(trackStageVO); | |
260 | + } | |
261 | + }); | |
262 | + } | |
263 | + | |
264 | + /** | |
265 | + * @param resultVOList | |
266 | + * @param inspectionStageDOS | |
267 | + */ | |
268 | + private void fillOrderInspectInfo(List<OrderApplyResultVO> resultVOList, List<OrderInspectionStageDO> inspectionStageDOS) { | |
269 | + if (CollectionUtils.isEmpty(resultVOList)) { | |
270 | + return; | |
271 | + } | |
272 | + if (CollectionUtils.isEmpty(inspectionStageDOS)) { | |
273 | + return; | |
274 | + } | |
275 | + Map<Long, OrderInspectionStageDO> inspectionStageDOMap = inspectionStageDOS.stream().collect(Collectors.toMap(OrderInspectionStageDO::getId, Function.identity())); | |
276 | + resultVOList.forEach(x -> { | |
277 | + if (inspectionStageDOMap.containsKey(x.getOrderId())) { | |
278 | + OrderInspectionStageDO inspectionStageDO = inspectionStageDOMap.get(x.getOrderId()); | |
279 | + OrderInspectionStageVO inspectionStageVO = new OrderInspectionStageVO(); | |
280 | + BeanUtils.copyProperties(inspectionStageDO, inspectionStageVO); | |
281 | + x.setInspectionStageInfo(inspectionStageVO); | |
282 | + } | |
283 | + }); | |
284 | + } | |
285 | + | |
286 | + /** | |
124 | 287 | * @param queryVO |
125 | 288 | * @return |
126 | 289 | */ | ... | ... |