|
@@ -101,11 +101,31 @@ public class ArrivalServiceImpl extends ServiceImpl<ArrivalMapper, Arrival> impl
|
|
|
@Override
|
|
|
public Page<ArrivalVo> getPage(ArrivalSelectDto dto) {
|
|
|
IWrapper<Arrival> wrapper = getWrapper();
|
|
|
+
|
|
|
+ wrapper.eq("a", Arrival::getPurchaseId, dto.getPurchaseId());
|
|
|
+
|
|
|
wrapper.orderByDesc("a", Arrival::getId);
|
|
|
Page<ArrivalVo> page = this.baseMapper.getPage(dto.getPage(), wrapper);
|
|
|
+ List<ArrivalVo> records = page.getRecords();
|
|
|
+ if (ObjectUtil.isEmpty(records)) {
|
|
|
+ return page;
|
|
|
+ }
|
|
|
+ setInfo(records);
|
|
|
return page;
|
|
|
}
|
|
|
|
|
|
+ void setInfo(List<ArrivalVo> records) {
|
|
|
+ List<Long> ids = records.stream().map(Arrival::getId).collect(Collectors.toList());
|
|
|
+ if (ObjectUtil.isEmpty(ids)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ List<ArrivalDetailVo> arrivalDetailVos = arrivalDetailService.getList(IWrapper.<ArrivalDetail>getWrapper().in("ad", ArrivalDetail::getArrivalId, ids));
|
|
|
+ Map<Long, List<ArrivalDetailVo>> collect = arrivalDetailVos.stream().collect(Collectors.groupingBy(ArrivalDetail::getArrivalId));
|
|
|
+ for (ArrivalVo record : records) {
|
|
|
+ record.setArrivalDetailVoList(collect.getOrDefault(record.getId(), new ArrayList<>()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public ArrivalVo detail(Long id) {
|
|
|
Arrival Arrival = this.getById(id);
|
|
@@ -247,7 +267,7 @@ public class ArrivalServiceImpl extends ServiceImpl<ArrivalMapper, Arrival> impl
|
|
|
|
|
|
json.put("arrivalId", arrival.getId());
|
|
|
json.put("arrivalCode", arrival.getCode());
|
|
|
- stockWait.setVictoriatouristJson(JSONObject.toJSONString(json,JSONWriter.Feature.WriteLongAsString));
|
|
|
+ stockWait.setVictoriatouristJson(JSONObject.toJSONString(json, JSONWriter.Feature.WriteLongAsString));
|
|
|
|
|
|
stockWait.setPurchaseId(purchase.getId());
|
|
|
stockWait.setDeliverGoodsId(deliverGoodsId);
|
|
@@ -309,7 +329,7 @@ public class ArrivalServiceImpl extends ServiceImpl<ArrivalMapper, Arrival> impl
|
|
|
|
|
|
//存在到货数量不等于发货数量 创建异常
|
|
|
if (flag != 0) {
|
|
|
- wdlyService.addAbnormalInfo(arrival.getId(), arrival.getCode(),deliverGoodsId);
|
|
|
+ wdlyService.addAbnormalInfo(arrival.getId(), arrival.getCode(), deliverGoodsId);
|
|
|
}
|
|
|
}
|
|
|
arrivalDetailService.saveBatch(arrivalDetailList);
|
|
@@ -361,7 +381,7 @@ public class ArrivalServiceImpl extends ServiceImpl<ArrivalMapper, Arrival> impl
|
|
|
*/
|
|
|
@Override
|
|
|
public ArrivalVo arrivalInfo(Long deliverGoodsId) {
|
|
|
- Assert.notEmpty(deliverGoodsId,"发货id不能为空");
|
|
|
+ Assert.notEmpty(deliverGoodsId, "发货id不能为空");
|
|
|
ArrivalVo arrival = baseMapper.arrivalInfo(deliverGoodsId);
|
|
|
Assert.notEmpty(arrival, "查询不到到货信息");
|
|
|
List<ArrivalDetail> arrivalDetailList = arrivalDetailService.list(q -> q.eq(ArrivalDetail::getArrivalId, arrival.getId()));
|