|
|
@@ -132,42 +132,41 @@ public class DeliveryController extends BladeController {
|
|
|
redisClient.basicData("all");
|
|
|
List<CorpsDesc> corpsDescList = castToList(redisTemplate.opsForValue().get("corps"), CorpsDesc.class);
|
|
|
List<User> userList = castToList(redisTemplate.opsForValue().get("user"), User.class);
|
|
|
+ List<StorageDesc> storageDescList = castToList(redisTemplate.opsForValue().get("storageDesc"), StorageDesc.class);
|
|
|
|
|
|
if (CollectionUtils.isNotEmpty(pages.getRecords())){
|
|
|
pages.getRecords().forEach(item ->{
|
|
|
if (item.getCorpId() != null){
|
|
|
CorpsDesc corpMessage = corpsDescList.stream().filter(corps -> corps.getId().equals(item.getCorpId())).findFirst().orElse(null);
|
|
|
- /*R<CorpsDesc> corpMessage = corpsDescClient.getCorpMessage(item.getCorpId());*/
|
|
|
if (ObjectUtil.isNotEmpty(corpMessage)){
|
|
|
item.setCorpsName(corpMessage.getCname());
|
|
|
}
|
|
|
}
|
|
|
if (item.getSalesCompany() != null){
|
|
|
CorpsDesc corpMessage = corpsDescList.stream().filter(corps -> corps.getId().equals(item.getSalesCompany())).findFirst().orElse(null);
|
|
|
- /*R<CorpsDesc> corpMessage = corpsDescClient.getCorpMessage(item.getSalesCompany());*/
|
|
|
if (ObjectUtil.isNotEmpty(corpMessage)){
|
|
|
item.setSalesCompanyName(corpMessage.getCname());
|
|
|
}
|
|
|
}
|
|
|
if (item.getCreateUser() != null){
|
|
|
User user = userList.stream().filter(e -> e.getId().equals(item.getCreateUser())).findFirst().orElse(null);
|
|
|
- /*R<User> user = iUserClient.userInfoById(item.getCreateUser());*/
|
|
|
if (ObjectUtil.isNotEmpty(user)){
|
|
|
item.setCreateUserName(user.getName());
|
|
|
}
|
|
|
}
|
|
|
if (item.getUpdateUser() != null){
|
|
|
User user1 = userList.stream().filter(e -> e.getId().equals(item.getUpdateUser())).findFirst().orElse(null);
|
|
|
- /*R<User> user1 = iUserClient.userInfoById(item.getUpdateUser());*/
|
|
|
if (ObjectUtil.isNotEmpty(user1)){
|
|
|
item.setUpdateUserName(user1.getName());
|
|
|
}
|
|
|
}
|
|
|
//仓库信息
|
|
|
- StorageDesc storageDesc = iStorageClient.findById(item.getStorageId());
|
|
|
- if(storageDesc!=null)
|
|
|
- {
|
|
|
- item.setStorageName(storageDesc.getCname());
|
|
|
+ if (item.getStorageId() != null){
|
|
|
+ StorageDesc storageDesc = storageDescList.stream().filter(e -> e.getId().equals(item.getStorageId())).findFirst().orElse(null);
|
|
|
+ if(storageDesc!=null)
|
|
|
+ {
|
|
|
+ item.setStorageName(storageDesc.getCname());
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
//获得明细到货数量和到货金额
|
|
|
@@ -220,34 +219,45 @@ public class DeliveryController extends BladeController {
|
|
|
lambdaQueryWrapper.le(Func.isNotEmpty(delivery.getArrivalEndTime()),Delivery::getArrivalTime,delivery.getArrivalEndTime());//确认到货日期结束
|
|
|
lambdaQueryWrapper.orderByDesc(Delivery::getId);
|
|
|
List<Delivery> list = deliveryService.list(lambdaQueryWrapper);
|
|
|
+
|
|
|
+ redisClient.basicData("all");
|
|
|
+ List<CorpsDesc> corpsDescList = castToList(redisTemplate.opsForValue().get("corps"), CorpsDesc.class);
|
|
|
+ List<User> userList = castToList(redisTemplate.opsForValue().get("user"), User.class);
|
|
|
+ List<StorageDesc> storageDescList = castToList(redisTemplate.opsForValue().get("storageDesc"), StorageDesc.class);
|
|
|
+
|
|
|
if (CollectionUtils.isNotEmpty(list)){
|
|
|
list.forEach(item ->{
|
|
|
if (item.getCorpId() != null){
|
|
|
- R<CorpsDesc> corpMessage = corpsDescClient.getCorpMessage(item.getCorpId());
|
|
|
- if (corpMessage.isSuccess() && corpMessage.getData() != null){
|
|
|
- item.setCorpsName(corpMessage.getData().getCname());
|
|
|
+ CorpsDesc corpMessage = corpsDescList.stream().filter(corps -> corps.getId().equals(item.getCorpId())).findFirst().orElse(null);
|
|
|
+ if (ObjectUtil.isNotEmpty(corpMessage)){
|
|
|
+ item.setCorpsName(corpMessage.getCname());
|
|
|
}
|
|
|
}
|
|
|
if (item.getSalesCompany() != null){
|
|
|
- R<CorpsDesc> corpMessage = corpsDescClient.getCorpMessage(item.getSalesCompany());
|
|
|
- if (corpMessage.isSuccess() && corpMessage.getData() != null){
|
|
|
- item.setSalesCompanyName(corpMessage.getData().getCname());
|
|
|
+ CorpsDesc corpMessage = corpsDescList.stream().filter(corps -> corps.getId().equals(item.getSalesCompany())).findFirst().orElse(null);
|
|
|
+ if (ObjectUtil.isNotEmpty(corpMessage)){
|
|
|
+ item.setSalesCompanyName(corpMessage.getCname());
|
|
|
}
|
|
|
}
|
|
|
- R<User> user = iUserClient.userInfoById(item.getCreateUser());
|
|
|
- if (user.isSuccess() && user.getData() != null){
|
|
|
- item.setCreateUserName(user.getData().getName());
|
|
|
+ if (item.getCreateUser() != null){
|
|
|
+ User user = userList.stream().filter(e -> e.getId().equals(item.getCreateUser())).findFirst().orElse(null);
|
|
|
+ if (ObjectUtil.isNotEmpty(user)){
|
|
|
+ item.setCreateUserName(user.getName());
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
- R<User> user1 = iUserClient.userInfoById(item.getUpdateUser());
|
|
|
- if (user1.isSuccess() && user1.getData() != null){
|
|
|
- item.setUpdateUserName(user1.getData().getName());
|
|
|
+ if (item.getUpdateUser() != null){
|
|
|
+ User user1 = userList.stream().filter(e -> e.getId().equals(item.getUpdateUser())).findFirst().orElse(null);
|
|
|
+ if (ObjectUtil.isNotEmpty(user1)){
|
|
|
+ item.setUpdateUserName(user1.getName());
|
|
|
+ }
|
|
|
}
|
|
|
//仓库信息
|
|
|
- StorageDesc storageDesc = iStorageClient.findById(item.getStorageId());
|
|
|
- if(storageDesc!=null)
|
|
|
- {
|
|
|
- item.setStorageName(storageDesc.getCname());
|
|
|
+ if (item.getStorageId() != null){
|
|
|
+ StorageDesc storageDesc = storageDescList.stream().filter(e -> e.getId().equals(item.getStorageId())).findFirst().orElse(null);
|
|
|
+ if(storageDesc!=null)
|
|
|
+ {
|
|
|
+ item.setStorageName(storageDesc.getCname());
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
//获得明细到货数量和到货金额
|
|
|
@@ -262,7 +272,7 @@ public class DeliveryController extends BladeController {
|
|
|
//实际到货金额
|
|
|
item.setActualArrivalAmount(itemsList.stream().reduce(BigDecimal.ZERO, (x, y) -> {
|
|
|
return x.add(y.getArrivalQuantity().multiply(y.getPrice()));
|
|
|
- },BigDecimal::add));
|
|
|
+ },BigDecimal::add).setScale(2,BigDecimal.ROUND_HALF_UP));
|
|
|
|
|
|
});
|
|
|
}
|
|
|
@@ -301,7 +311,7 @@ public class DeliveryController extends BladeController {
|
|
|
return deliveryService.submit(delivery);
|
|
|
}
|
|
|
/**
|
|
|
- * 撤销发货通知单
|
|
|
+ * 撤销确认收货
|
|
|
*/
|
|
|
@PostMapping("/repeal")
|
|
|
@ApiOperationSupport(order = 7)
|