|
@@ -352,7 +352,7 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
|
}
|
|
|
TbItemFac itemFac = list.get(0);
|
|
|
IOrderItem orderItem = new IOrderItem();
|
|
|
- String uniqueExpenseId=itemFac.getUniqueExpenseId();
|
|
|
+ String uniqueExpenseId = itemFac.getUniqueExpenseId();
|
|
|
orderItem.setUniqExpenseId(uniqueExpenseId).setExpenseNum(1);
|
|
|
List<IFactorItem> factors = new ArrayList<>();
|
|
|
for (TbItemFac fac : list) {
|
|
@@ -381,7 +381,7 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
|
.setUniqueExpenseId(uniqueExpenseId)
|
|
|
.setFireResult(orderPriceRes.getFireResult())
|
|
|
.setTotalOrderPrice(orderPriceRes.getTotalOrderPrice());
|
|
|
- log.info("part money resp:{}",JSONUtil.toJsonStr(res));
|
|
|
+ log.info("part money resp:{}", JSONUtil.toJsonStr(res));
|
|
|
return res;
|
|
|
}
|
|
|
|
|
@@ -472,12 +472,13 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
|
//对应的业务
|
|
|
List<TbBusiness> businessList = this.findOtherBusinessByCarId(businessCarId);
|
|
|
TbBusinessCar tbBusinessCar = tbBusinessCarService.getById(businessCarId);
|
|
|
- //越南车是否需要支付
|
|
|
+ String carNo = tbBusinessCar.getCarNo();
|
|
|
+ //越南车是否需要支付---停车费
|
|
|
int vietnamCarPay = businessList.stream().anyMatch(tbBusiness -> {
|
|
|
TbGoods tbGoods = tbGoodsService.getById(tbBusiness.getGoodsId());
|
|
|
return tbGoods.getVietnamCarPay() == 1;
|
|
|
}) ? 1 : 0;
|
|
|
- //中国车是否需要支付
|
|
|
+ //中国车是否需要支付--停车费
|
|
|
int chinaCarPay = businessList.stream().anyMatch(tbBusiness -> {
|
|
|
TbGoods tbGoods = tbGoodsService.getById(tbBusiness.getGoodsId());
|
|
|
return tbGoods.getChinaCarPay() == 1;
|
|
@@ -556,8 +557,9 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
|
carMap.put("calculateId;", partPriceRes.getCalculateId());
|
|
|
carMap.put("hourDesc", partPriceRes.getHourDesc());
|
|
|
carMap.put("over24Hour", partPriceRes.getOver24Hour());
|
|
|
- partPriceRes.getFireResult().get(0)
|
|
|
- .getPriceDetail().forEach(obj->carMap.put(obj.getKey(), obj.getValue()));
|
|
|
+ List<PriceDetailItem> detailItemList = partPriceRes.getFireResult().get(0)
|
|
|
+ .getPriceDetail();
|
|
|
+ detailItemList.forEach(obj -> carMap.put(obj.getKey(), obj.getValue()));
|
|
|
}
|
|
|
//todo 计算停车费
|
|
|
}
|
|
@@ -575,46 +577,70 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
|
if (!items.isEmpty()) {
|
|
|
//未支付的
|
|
|
List<IOrderItem> expenses = new ArrayList<>();
|
|
|
- items.stream().filter(item -> item.getPayStatus() == 0)
|
|
|
- .forEach(item -> {
|
|
|
- String num = item.getNum();
|
|
|
- String itemCode = item.getItemCode();
|
|
|
- IOrderItem iOrderItem = new IOrderItem();
|
|
|
- iOrderItem.setExpenseNum(Integer.parseInt(num)).setUniqExpenseId(itemCode);
|
|
|
- expenses.add(iOrderItem);
|
|
|
+ items = items.stream().filter(item -> item.getPayStatus() == 0).collect(Collectors.toList());
|
|
|
+ //如果不需要支付,则过滤掉入场管理费
|
|
|
+// boolean needPayManagerMoney = needPayManagerMoney(carNo, items);
|
|
|
+// if (needPayManagerMoney) {
|
|
|
+// //查询出对应的费项
|
|
|
+// TbItem tbItem = tbItemService.findByName(SystemObject.config.getManagerWord());
|
|
|
+// if (tbItem != null) {
|
|
|
+// List<IOrderItem> managerList = new ArrayList<>();
|
|
|
+// IOrderItem iOrderItem = new IOrderItem();
|
|
|
+// iOrderItem.setExpenseNum(1).setUniqExpenseId(tbItem.getItemCode());
|
|
|
+// managerList.add(iOrderItem);
|
|
|
+// IOrderPriceRes managerPriceRes = syncService.orderPriceCal(managerList);
|
|
|
+// Map<String, Object> managerMap = new HashMap<>();
|
|
|
+// managerMap.put("id", tbItem.getId());
|
|
|
+// managerMap.put("name", tbItem.getItemName());
|
|
|
+// managerMap.put("carNo", carNo);
|
|
|
+// managerMap.put("carId", businessCarId);
|
|
|
+// managerMap.put("label", tbItem.getItemName() + "(入场管理费)");
|
|
|
+// managerMap.put("price", managerPriceRes.getTotalOrderPrice());
|
|
|
+// managerMap.put("calculateId", managerPriceRes.getCalculateId());
|
|
|
+// result.put("manager", managerMap);
|
|
|
+// }
|
|
|
+// }
|
|
|
+ items.forEach(item -> {
|
|
|
+ String num = item.getNum();
|
|
|
+ String itemCode = item.getItemCode();
|
|
|
+ IOrderItem iOrderItem = new IOrderItem();
|
|
|
+ iOrderItem.setExpenseNum(Integer.parseInt(num)).setUniqExpenseId(itemCode);
|
|
|
+ expenses.add(iOrderItem);
|
|
|
+ });
|
|
|
+ if (!expenses.isEmpty()){
|
|
|
+ IOrderPriceRes orderPriceRes = syncService.orderPriceCal(expenses);
|
|
|
+ BigDecimal totalPrice = orderPriceRes.getTotalOrderPrice();
|
|
|
+ carCalculateIds.add(orderPriceRes.getCalculateId());
|
|
|
+ for (TbBusinessItem item : items) {
|
|
|
+ BigDecimal itemPrice = item.getItemPrice().multiply(new BigDecimal(item.getNum()));
|
|
|
+ itemsPrice = itemsPrice.add(itemPrice);
|
|
|
+ Map<String, Object> itemMap = new HashMap<>();
|
|
|
+ itemMap.put("id", item.getId());
|
|
|
+ itemMap.put("name", item.getItemName() + "(" + item.getItemTypeName() + ")");
|
|
|
+ itemMap.put("price", itemPrice);
|
|
|
+ itemMap.put("pay", item.getPayStatus());
|
|
|
+ orderPriceRes.getFireResult().stream().filter(priceItem -> StrUtil.equals(item.getItemCode(), priceItem.getUniqExpenseId()))
|
|
|
+ .findAny().ifPresent(priceItem -> {
|
|
|
+ itemMap.put("price", priceItem.getFirePrice().multiply(new BigDecimal(item.getNum())));
|
|
|
});
|
|
|
- IOrderPriceRes orderPriceRes = syncService.orderPriceCal(expenses);
|
|
|
- BigDecimal totalPrice = orderPriceRes.getTotalOrderPrice();
|
|
|
- carCalculateIds.add(orderPriceRes.getCalculateId());
|
|
|
- for (TbBusinessItem item : items) {
|
|
|
- BigDecimal itemPrice = item.getItemPrice().multiply(new BigDecimal(item.getNum()));
|
|
|
- itemsPrice = itemsPrice.add(itemPrice);
|
|
|
- Map<String, Object> itemMap = new HashMap<>();
|
|
|
- itemMap.put("id", item.getId());
|
|
|
- itemMap.put("name", item.getItemName() + "(" + item.getItemTypeName() + ")");
|
|
|
- itemMap.put("price", itemPrice);
|
|
|
- itemMap.put("pay", item.getPayStatus());
|
|
|
- orderPriceRes.getFireResult().stream().filter(priceItem -> StrUtil.equals(item.getItemCode(), priceItem.getUniqExpenseId()))
|
|
|
- .findAny().ifPresent(priceItem -> {
|
|
|
- itemMap.put("price", priceItem.getFirePrice().multiply(new BigDecimal(item.getNum())));
|
|
|
- });
|
|
|
- itemList.add(itemMap);
|
|
|
- TbBusinessSort tbBusinessSort = tbBusinessSortService.findByItemTypeId(item.getItemTypeId());
|
|
|
- if (tbBusinessSort != null) {
|
|
|
- TbSortGroup sortGroup = tbSortGroupService.getById(tbBusinessSort.getGroupId());
|
|
|
- if (sortGroup.getCompletePay().equals(1) && sortGroup.getStatus().equals(1)) {
|
|
|
- List<TbBusinessSort> sorts = tbBusinessSortService.findByGroupId(sortGroup.getId());
|
|
|
- for (TbBusinessSort sort : sorts) {
|
|
|
- long count = items.stream().filter(tbBusinessItem -> StrUtil.equals(sort.getTypeId(), tbBusinessItem.getItemTypeId()))
|
|
|
- .count();
|
|
|
- if (count == 0) {
|
|
|
- result.put("showPay", false);
|
|
|
+ itemList.add(itemMap);
|
|
|
+ TbBusinessSort tbBusinessSort = tbBusinessSortService.findByItemTypeId(item.getItemTypeId());
|
|
|
+ if (tbBusinessSort != null) {
|
|
|
+ TbSortGroup sortGroup = tbSortGroupService.getById(tbBusinessSort.getGroupId());
|
|
|
+ if (sortGroup.getCompletePay().equals(1) && sortGroup.getStatus().equals(1)) {
|
|
|
+ List<TbBusinessSort> sorts = tbBusinessSortService.findByGroupId(sortGroup.getId());
|
|
|
+ for (TbBusinessSort sort : sorts) {
|
|
|
+ long count = items.stream().filter(tbBusinessItem -> StrUtil.equals(sort.getTypeId(), tbBusinessItem.getItemTypeId()))
|
|
|
+ .count();
|
|
|
+ if (count == 0) {
|
|
|
+ result.put("showPay", false);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ result.put("itemsPrice", totalPrice);
|
|
|
}
|
|
|
- result.put("itemsPrice", totalPrice);
|
|
|
}
|
|
|
result.put("itemList", itemList);
|
|
|
result.put("calculateId", String.join(",", carCalculateIds));
|
|
@@ -623,6 +649,30 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 是否需要交入场管理费
|
|
|
+ *
|
|
|
+ * @param carNo
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public boolean needPayManagerMoney(String carNo, List<TbBusinessItem> items) {
|
|
|
+ List<String> needItemTypeList = SystemObject.config.getManagerItemType();
|
|
|
+ //是否有相关业务,,,没有的话直接不用交入场管理费
|
|
|
+ boolean before = items.stream().anyMatch(item -> needItemTypeList.contains(item.getItemTypeName()));
|
|
|
+ if (!before) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ String carPrefix = StrUtil.sub(carNo, 0, 1);
|
|
|
+ boolean isvietnamCar = !CAR_LIST.contains(carPrefix);
|
|
|
+ List<Integer> managerList = SystemObject.config.getManagerMoney();
|
|
|
+ //越南车是否需要支付
|
|
|
+ boolean verNeePay = managerList.contains(ManagerEnum.VER_PAY.getType());
|
|
|
+ //中国车是否需要支付
|
|
|
+ boolean chinaNeePay = managerList.contains(ManagerEnum.CHINA_PAY.getType());
|
|
|
+ //是否需要支付入场管理费
|
|
|
+ return isvietnamCar && verNeePay || !isvietnamCar && chinaNeePay;
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
public List<TbBusiness> findOtherBusinessByCarId(String businessCarId) {
|
|
|
return tbBusinessMapper.findOtherBusinessByCarId(businessCarId);
|