|
@@ -354,11 +354,11 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
|
res.setOver24Hour(1);
|
|
|
res.setHourDesc(PartFeeEnum.OUT_24_HOURS.getDesc());
|
|
|
}
|
|
|
-// TbItem partItem=tbItemService.findByAliasName(SystemObject.config.getPartItemAlias());
|
|
|
-// if (partItem==null) {
|
|
|
-// throw new AjaxError("未配置停车费规则");
|
|
|
-// }
|
|
|
- List<TbItemFac> list = tbItemFacService.list();
|
|
|
+ TbItem partItem = tbItemService.findByAliasName(SystemObject.config.getPartItemAlias());
|
|
|
+ if (partItem == null) {
|
|
|
+ throw new AjaxError("未配置停车费规则");
|
|
|
+ }
|
|
|
+ List<TbItemFac> list = tbItemFacService.getByItemId(partItem.getId());
|
|
|
if (list.isEmpty()) {
|
|
|
throw new AjaxError("未配置停车费规则");
|
|
|
}
|
|
@@ -398,7 +398,6 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
* 微信端获取缴费信息
|
|
|
*
|
|
@@ -457,7 +456,7 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
|
partMoney = new BigDecimal("0");
|
|
|
}
|
|
|
if (CarEnum.PayTypeEnum.HAS_PAY_TYPE.getType().equals(tbBusinessCar.getPayType())) {
|
|
|
- inTime=tbBusinessCar.getPayTime();
|
|
|
+ inTime = tbBusinessCar.getPayTime();
|
|
|
}
|
|
|
if (partMoney.doubleValue() == 1) {
|
|
|
IOrderPriceRes partPriceRes = getPartMoney(inTime, outTime, tbBusinessCar.getCarNo(), tbBusinessCar.getColor());
|
|
@@ -490,18 +489,35 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
|
//未支付的
|
|
|
List<IOrderItem> expenses = new ArrayList<>();
|
|
|
items = items.stream().filter(item -> item.getPayStatus() == 0).collect(Collectors.toList());
|
|
|
- //如果不需要支付,则过滤掉入场管理费
|
|
|
-// ManagerBO dto = needPayManagerMoney(carNo, businessCarId, items);
|
|
|
-// if (dto.isNeed()) {
|
|
|
-// result.put("manager", dto);
|
|
|
-// }
|
|
|
- items.forEach(item -> {
|
|
|
- String num = item.getNum();
|
|
|
- String itemCode = item.getItemCode();
|
|
|
+ for (TbBusinessItem businessItem : items) {
|
|
|
+ String num = businessItem.getNum();
|
|
|
+ String itemCode = businessItem.getItemCode();
|
|
|
IOrderItem iOrderItem = new IOrderItem();
|
|
|
+ String itemAlias = businessItem.getItemAlias();
|
|
|
+ Date startTime = businessItem.getColdStartTime();
|
|
|
+ Date endTime = businessItem.getColdEndTime();
|
|
|
iOrderItem.setExpenseNum(Integer.parseInt(num)).setUniqExpenseId(itemCode);
|
|
|
+ if (StrUtil.equals(itemAlias, SystemObject.config.getColdItemAlias())) {
|
|
|
+ tbBusinessItemService.buildColdFceItem(businessItem, iOrderItem, startTime, endTime);
|
|
|
+ //充电打冷--->按小时计费
|
|
|
+ } else if (StrUtil.equals(itemAlias, SystemObject.config.getHeavyStoreItemAlias())
|
|
|
+ || StrUtil.equals(itemAlias, SystemObject.config.getEmptyStoreItemAlias())) {
|
|
|
+ //空柜堆存、重箱堆存--->按天算
|
|
|
+ //如果存柜的话则不收费
|
|
|
+ if (businessItem.getCabinetType() == 0) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ tbBusinessItemService.buildDaysFceItem(businessItem, iOrderItem, startTime, endTime);
|
|
|
+ } else if (StrUtil.equals(itemAlias, SystemObject.config.getBigHeadCar())
|
|
|
+ || StrUtil.equals(itemAlias, SystemObject.config.getCabinetCar())) {
|
|
|
+ //大车头、柜车、栏车
|
|
|
+ tbBusinessItemService.buildDaysFceItem(businessItem, iOrderItem, startTime, endTime);
|
|
|
+ //不收停车费
|
|
|
+ carMap.put("price", 0);
|
|
|
+ }
|
|
|
expenses.add(iOrderItem);
|
|
|
- });
|
|
|
+ }
|
|
|
+ result.put("carList", Collections.singleton(carMap));
|
|
|
if (!expenses.isEmpty()) {
|
|
|
IOrderPriceRes orderPriceRes = syncService.orderPriceCal(expenses);
|
|
|
BigDecimal totalPrice = orderPriceRes.getTotalOrderPrice();
|
|
@@ -516,7 +532,16 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
|
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())));
|
|
|
+ BigDecimal price = priceItem.getFirePrice().multiply(new BigDecimal(item.getNum()));
|
|
|
+ //柜车、栏车只有离场才知道多少钱
|
|
|
+ if (StrUtil.equals(item.getItemAlias(),SystemObject.config.getCabinetCar())){
|
|
|
+ TbBusiness tbBusiness = this.getById(item.getBusinessId());
|
|
|
+ tbBusiness.setItemPrice(price);
|
|
|
+ item.setTotal(price);
|
|
|
+ tbBusinessItemService.updateById(item);
|
|
|
+ this.updateById(tbBusiness);
|
|
|
+ }
|
|
|
+ itemMap.put("price", price);
|
|
|
});
|
|
|
itemList.add(itemMap);
|
|
|
TbBusinessSort tbBusinessSort = tbBusinessSortService.findByItemTypeId(item.getItemTypeId());
|
|
@@ -656,20 +681,38 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
|
}
|
|
|
int index = 1;
|
|
|
int size = cars.size();
|
|
|
+ String goodsName = tbGoods.getName();
|
|
|
for (TbItem tbItem : tbItems) {
|
|
|
TbItem db = tbItemService.getById(tbItem.getId());
|
|
|
String itemName = db.getItemName();
|
|
|
+ goodsName = goodsName + "—" + itemName;
|
|
|
+ String alaisName = db.getItemAlias();
|
|
|
+ String startImage = tbItem.getStartImage();
|
|
|
+ if (StrUtil.equals(SystemObject.config.getColdItemAlias(), alaisName) && StrUtil.isEmpty(startImage)) {
|
|
|
+ throw new AjaxError("请上传开始时间图片");
|
|
|
+ }
|
|
|
TbBusinessItem item = new TbBusinessItem();
|
|
|
+ int cabinetType = tbItem.getCabinetType();
|
|
|
+ if (!SystemObject.config.getEmptyStoreItemAlias().equals(alaisName)
|
|
|
+ && !SystemObject.config.getHeavyStoreItemAlias().equals(alaisName)) {
|
|
|
+ cabinetType = -1;
|
|
|
+ }
|
|
|
int num = tbItem.getNum();
|
|
|
String typeId = tbItem.getTypeId();
|
|
|
TbItemType tbItemType = tbItemTypeService.getById(typeId);
|
|
|
- BigDecimal itemTotalPrice = tbItem.getPrice().multiply(new BigDecimal(num));
|
|
|
- item.setNo(no + "0" + index).setPayTypeName(db.getPayTypeName()).setPayType(db.getPayType())
|
|
|
+ BigDecimal unitPrice = db.getPrice();
|
|
|
+ unitPrice = StrUtil.equals(db.getPattern(), "RULES") ? BigDecimal.ZERO : unitPrice;
|
|
|
+ BigDecimal itemTotalPrice = unitPrice.multiply(new BigDecimal(num));
|
|
|
+ item.setNo(no + "0" + index).setPayTypeName(db.getPayTypeName())
|
|
|
+ .setPayType(db.getPayType())
|
|
|
.setBusinessType(db.getBusinessType()).setTaxRate(NumberUtil.div(db.getTaxRate().doubleValue(), 100D, 2));
|
|
|
- item.setItemCode(db.getItemCode()).setNum(num + "").setItemId(db.getId()).setCabinetNo(tbItem.getCabinetNo())
|
|
|
+ item.setItemCode(db.getItemCode()).setNum(num + "")
|
|
|
+ .setItemId(db.getId()).setCabinetType(cabinetType)
|
|
|
+ .setCabinetNo(tbItem.getCabinetNo()).setColdStartTime(tbItem.getColdStartTime())
|
|
|
.setItemName(db.getItemName()).setItemPrice(db.getPrice()).setRemark(tbItem.getRemark())
|
|
|
- .setItemTypeId(typeId).setItemTypeName(tbItemType.getName())
|
|
|
- .setUnit(db.getUnit()).setTotal(itemTotalPrice).setCreateTime(now);
|
|
|
+ .setItemTypeId(typeId).setItemTypeName(tbItemType.getName()).setItemAlias(tbItem.getItemAlias())
|
|
|
+ .setUnit(db.getUnit()).setTotal(itemTotalPrice).setCreateTime(now)
|
|
|
+ .setColdStartTime(tbItem.getColdStartTime()).setStartImage(startImage);
|
|
|
if (partner != null) {
|
|
|
item.setPick(1).setPickCustomerId(pickCustomerId).setPickCustomerName(partner.getName())
|
|
|
.setPickBy(StpUserUtil.getCreateBy()).setPickTime(now);
|
|
@@ -677,6 +720,71 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
|
if (SystemObject.config.getEveryCarPay().contains(itemName)) {
|
|
|
itemTotalPrice = itemTotalPrice.multiply(BigDecimal.valueOf(size));
|
|
|
}
|
|
|
+ //堆存业务
|
|
|
+ if (SystemObject.config.getEmptyStoreItemAlias().equals(alaisName)
|
|
|
+ || SystemObject.config.getHeavyStoreItemAlias().equals(alaisName)) {
|
|
|
+ //取柜--->根据柜号查询上一个存柜时间
|
|
|
+ TbBusinessItem tbBusinessItem = tbBusinessItemService.findTheLastRecordByCabinetNo(tbItem.getCabinetNo());
|
|
|
+ //堆存---》取柜
|
|
|
+ if (cabinetType == 1) {
|
|
|
+ goodsName = goodsName + "(取柜)";
|
|
|
+ if (tbBusinessItem == null) {
|
|
|
+ throw new AjaxError("根据柜号" + tbItem.getCabinetNo() + "找不到堆存记录");
|
|
|
+ }
|
|
|
+ //已经取走
|
|
|
+ if (tbBusinessItem.getCabinetStatus() == 1) {
|
|
|
+ throw new AjaxError("柜号" + tbItem.getCabinetNo() + "已取走");
|
|
|
+ }
|
|
|
+ Date endTime = tbItem.getColdStartTime();
|
|
|
+ if (endTime == null) {
|
|
|
+ throw new AjaxError("请输入取柜时间");
|
|
|
+ }
|
|
|
+ item.setColdStartTime(tbBusinessItem.getColdStartTime())
|
|
|
+ .setParentCabinetId(tbBusinessItem.getId())
|
|
|
+ .setColdEndTime(endTime)
|
|
|
+ .setCabinetStatus(1);
|
|
|
+ tbBusinessItem.setColdEndTime(endTime)
|
|
|
+ .setCabinetStatus(1);
|
|
|
+ //计算金额
|
|
|
+ Date startTime = tbBusinessItem.getColdStartTime();
|
|
|
+ if (startTime != null) {
|
|
|
+ List<IOrderItem> expenses = new ArrayList<>();
|
|
|
+ tbBusinessItemService.buildExpenses(Collections.singletonList(item), expenses);
|
|
|
+ if (!expenses.isEmpty()) {
|
|
|
+ IOrderPriceRes res = syncService.orderPriceCal(expenses);
|
|
|
+ BigDecimal itemPrice = res.getTotalOrderPrice();
|
|
|
+ item.setTotal(itemPrice);
|
|
|
+ itemTotalPrice = itemPrice;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ tbBusinessItemService.updateById(tbBusinessItem);
|
|
|
+ } else {
|
|
|
+ goodsName = goodsName + "(存柜)";
|
|
|
+ //存柜
|
|
|
+ if (tbBusinessItem != null && tbBusinessItem.getCabinetStatus() == 0) {
|
|
|
+ throw new AjaxError("柜号" + tbItem.getCabinetNo() + "已存柜未取柜");
|
|
|
+ }
|
|
|
+ Date endTime = tbItem.getColdStartTime();
|
|
|
+ if (endTime == null) {
|
|
|
+ throw new AjaxError("请输入存柜时间");
|
|
|
+ }
|
|
|
+ //业务费xxx都为0;
|
|
|
+ BigDecimal zero = BigDecimal.ZERO;
|
|
|
+ item.setColdStartTime(endTime).setItemPrice(zero)
|
|
|
+ .setTotal(zero).setPayStatus(1);
|
|
|
+ //无需支付
|
|
|
+ item.setPayStatus(3);
|
|
|
+ itemTotalPrice = zero;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ Date startTime = item.getColdStartTime();
|
|
|
+ Date endTime = item.getColdEndTime();
|
|
|
+ if (startTime != null && endTime != null) {
|
|
|
+ List<IOrderItem> expenses = new ArrayList<>();
|
|
|
+ tbBusinessItemService.buildExpenses(Collections.singletonList(item), expenses);
|
|
|
+ IOrderPriceRes res = syncService.orderPriceCal(expenses);
|
|
|
+ item.setTotal(res.getTotalOrderPrice());
|
|
|
+ }
|
|
|
price = price.add(itemTotalPrice);
|
|
|
itemList.add(item);
|
|
|
index++;
|
|
@@ -684,7 +792,7 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
|
String declareNo = otherBusinessBO.getDeclareNo();
|
|
|
tbBusiness.setCardSize(otherBusinessBO.getCarSize()).setNetWeight(otherBusinessBO.getNetWeight())
|
|
|
.setOperator(otherBusinessBO.getOperator()).setOperateTime(otherBusinessBO.getOperateTime())
|
|
|
- .setNo(no).setGoodsName(tbGoods.getName()).setGoodsId(otherBusinessBO.getGoodsId())
|
|
|
+ .setNo(no).setGoodsName(goodsName).setGoodsId(otherBusinessBO.getGoodsId()).setGoodsCode(tbGoods.getCode())
|
|
|
.setBusinessGoodsName(otherBusinessBO.getBusinessGoodsName()).setBusinessGoodsNum(otherBusinessBO.getBusinessGoodsNum())
|
|
|
.setPayStep(tbGoods.getPayStep()).setDeclareNo(declareNo).setCardNo(otherBusinessBO.getCardNo());
|
|
|
tbBusiness.setCreateTime(now).setCreateByCustomerId(StpUserUtil.getCustomerId())
|
|
@@ -696,9 +804,6 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
|
for (TbBusinessCar car : cars) {
|
|
|
String carNo = car.getCarNo().trim().toUpperCase();
|
|
|
String carType = car.getCarType();
|
|
|
-// if (car.getCarSize() == null || car.getCarSize() <= 0) {
|
|
|
-// throw new AjaxError(carNo + "规格不正确");
|
|
|
-// }
|
|
|
if (StrUtil.isEmpty(carType)) {
|
|
|
throw new BusinessException(carNo + "类型不能为空");
|
|
|
}
|
|
@@ -735,6 +840,7 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
|
db.setCarNo(carNo).setIsLock(0).setBusinessType(CarEnum.BusinessTypeEnum.BUSINESS_CAR.getType());
|
|
|
db.setCarSize(car.getCarSize()).setConfirmJudge(CarEnum.ConfirmJudgeEnum.NO_JUDGE.getCode())//业务车都是未审核状态
|
|
|
.setTimeUpdate(now).setCarType(car.getCarType())
|
|
|
+ .setDriverName(car.getDriverName()).setDriverPhone(car.getDriverPhone())
|
|
|
.setNetWeight(car.getNetWeight()).setColor(car.getColor())
|
|
|
.setCustomerId(customerId)
|
|
|
.setNo(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmm")) + RandomUtil.randomNumbers(4));
|
|
@@ -789,8 +895,16 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
|
}
|
|
|
TbGoods tbGoods = tbGoodsService.getById(otherBusinessBO.getGoodsId());
|
|
|
String carBuseinssNo = DateUtil.format(now, "yyyyMMddHHmm");
|
|
|
+ String goodsName = tbGoods.getName();
|
|
|
List<TbBusinessItem> itemList = new ArrayList<>();
|
|
|
if (PayEnum.PayStatusEnum.HAS_PAY_CONFIRM.getCode() != dbBusiness.getPayStatus()) {
|
|
|
+ List<TbBusinessItem> businessItemList = tbBusinessItemService.findByBusinessId(id);
|
|
|
+ //变成未取柜状态
|
|
|
+ businessItemList.stream().filter(item -> item.getParentCabinetId() != null).forEach(item -> {
|
|
|
+ TbBusinessItem tbBusinessItem = tbBusinessItemService.getById(item.getParentCabinetId());
|
|
|
+ tbBusinessItem.setCabinetStatus(0).setColdEndTime(null);
|
|
|
+ tbBusinessItemService.updateById(tbBusinessItem);
|
|
|
+ });
|
|
|
tbBusinessItemService.removeByBusinessId(id);
|
|
|
BigDecimal price = new BigDecimal("0");
|
|
|
String no = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmm")) + RandomUtil.randomNumbers(4);
|
|
@@ -802,28 +916,103 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
|
dbBusiness.setPickCustomerId(pickCustomerId).setPickCustomerName(partner.getName());
|
|
|
}
|
|
|
int size = cars.size();
|
|
|
+
|
|
|
for (TbItem tbItem : tbItems) {
|
|
|
TbItem db = tbItemService.getById(tbItem.getId());
|
|
|
+ String alaisName = db.getItemAlias();
|
|
|
String itemName = db.getItemName();
|
|
|
+ goodsName = goodsName + "—" + itemName;
|
|
|
+ String endImage = tbItem.getEndImage();
|
|
|
+ if (StrUtil.equals(SystemObject.config.getColdItemAlias(), alaisName) && StrUtil.isEmpty(endImage)) {
|
|
|
+ throw new AjaxError("请上传结束时间图片");
|
|
|
+ }
|
|
|
+ int cabinetType = tbItem.getCabinetType();
|
|
|
+ //如果不是正面吊--->则取/存操作设置为-1
|
|
|
+ if (!SystemObject.config.getEmptyStoreItemAlias().equals(alaisName)
|
|
|
+ && !SystemObject.config.getHeavyStoreItemAlias().equals(alaisName)) {
|
|
|
+ cabinetType = -1;
|
|
|
+ }
|
|
|
TbBusinessItem item = new TbBusinessItem();
|
|
|
int num = tbItem.getNum();
|
|
|
TbItemType tbItemType = tbItemTypeService.getById(tbItem.getTypeId());
|
|
|
- BigDecimal itemTotalPrice = tbItem.getPrice().multiply(new BigDecimal(num));
|
|
|
-
|
|
|
+ BigDecimal unitPrice = db.getPrice();
|
|
|
+ unitPrice = StrUtil.equals(db.getPattern(), "RULES") ? BigDecimal.ZERO : unitPrice;
|
|
|
+ BigDecimal itemTotalPrice = unitPrice.multiply(new BigDecimal(num));
|
|
|
item.setNo(no + "0" + index).setPayTypeName(db.getPayTypeName()).setPayType(db.getPayType())
|
|
|
.setBusinessType(db.getBusinessType()).setTaxRate(NumberUtil.div(db.getTaxRate().doubleValue(), 100D, 2));
|
|
|
item.setItemCode(db.getItemCode()).setNum(num + "").setItemId(db.getId()).setBusinessId(dbBusiness.getId())
|
|
|
.setItemName(db.getItemName()).setItemPrice(db.getPrice()).setRemark(tbItem.getRemark())
|
|
|
.setItemTypeId(tbItem.getTypeId()).setItemTypeName(tbItemType.getName())
|
|
|
- .setCabinetNo(tbItem.getCabinetNo())
|
|
|
- .setUnit(db.getUnit()).setTotal(itemTotalPrice).setCreateTime(now);
|
|
|
+ .setCabinetNo(tbItem.getCabinetNo()).setItemAlias(tbItem.getItemAlias())
|
|
|
+ .setUnit(db.getUnit()).setTotal(itemTotalPrice).setCreateTime(now)
|
|
|
+ .setCabinetType(cabinetType).setEndImage(endImage).setStartImage(tbItem.getStartImage())
|
|
|
+ .setColdStartTime(tbItem.getColdStartTime()).setColdEndTime(tbItem.getColdEndTime());
|
|
|
if (partner != null) {
|
|
|
item.setPick(1).setPickCustomerId(pickCustomerId).setPickCustomerName(partner.getName())
|
|
|
.setPickBy(StpUserUtil.getCreateBy()).setPickTime(now);
|
|
|
}
|
|
|
+ //装卸-->x车辆数量
|
|
|
if (SystemObject.config.getEveryCarPay().contains(itemName)) {
|
|
|
itemTotalPrice = itemTotalPrice.multiply(BigDecimal.valueOf(size));
|
|
|
+ item.setTotal(itemTotalPrice);
|
|
|
+ }
|
|
|
+
|
|
|
+ Date startTime = item.getColdStartTime();
|
|
|
+ Date endTime = item.getColdEndTime();
|
|
|
+ if (startTime != null && endTime != null) {
|
|
|
+ List<IOrderItem> expenses = new ArrayList<>();
|
|
|
+ tbBusinessItemService.buildExpenses(Collections.singletonList(item), expenses);
|
|
|
+ if (!expenses.isEmpty()) {
|
|
|
+ IOrderPriceRes res = syncService.orderPriceCal(expenses);
|
|
|
+ BigDecimal itemPrice = res.getTotalOrderPrice();
|
|
|
+ item.setTotal(itemPrice);
|
|
|
+ itemTotalPrice = itemPrice;
|
|
|
+ }
|
|
|
}
|
|
|
+ //正面吊堆存业务
|
|
|
+ if (SystemObject.config.getEmptyStoreItemAlias().equals(alaisName)
|
|
|
+ || SystemObject.config.getHeavyStoreItemAlias().equals(alaisName)) {
|
|
|
+ //取柜--->根据柜号查询上一个存柜时间
|
|
|
+ TbBusinessItem tbBusinessItem = tbBusinessItemService.findTheLastRecordByCabinetNo(tbItem.getCabinetNo());
|
|
|
+ //堆存
|
|
|
+ if (cabinetType == 1) {//取柜
|
|
|
+ if (tbBusinessItem == null) {
|
|
|
+ throw new AjaxError("根据柜号" + tbItem.getCabinetNo() + "找不到堆存记录");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (endTime == null) {
|
|
|
+ throw new AjaxError("请输入取柜时间");
|
|
|
+ }
|
|
|
+ goodsName = goodsName + "(取柜)";
|
|
|
+ item.setColdStartTime(tbBusinessItem.getColdStartTime())
|
|
|
+ .setParentCabinetId(tbBusinessItem.getId())
|
|
|
+ .setColdEndTime(endTime);
|
|
|
+ tbBusinessItem.setColdEndTime(endTime)
|
|
|
+ .setCabinetStatus(1);
|
|
|
+ tbBusinessItemService.updateById(tbBusinessItem);
|
|
|
+ } else {
|
|
|
+ if (startTime == null) {
|
|
|
+ throw new AjaxError("请输入存柜时间");
|
|
|
+ }
|
|
|
+ String businessItemId = tbItem.getBusinessItemId();
|
|
|
+ if (StrUtil.isNotEmpty(businessItemId)
|
|
|
+ && tbBusinessItem != null
|
|
|
+ && !StrUtil.equals(businessItemId, tbBusinessItem.getId() + "")
|
|
|
+ && tbBusinessItem.getColdEndTime() == null) {
|
|
|
+ throw new AjaxError("箱规未取走,不能存入");
|
|
|
+ }
|
|
|
+ goodsName = goodsName + "(存柜)";
|
|
|
+ //业务费xxx都为0;
|
|
|
+ BigDecimal zero = BigDecimal.ZERO;
|
|
|
+ item.setColdStartTime(endTime).setItemPrice(zero)
|
|
|
+ .setTotal(zero).setPayStatus(1).setPayTime(now);
|
|
|
+ itemTotalPrice = zero;
|
|
|
+ item.setColdStartTime(startTime);
|
|
|
+ //无需支付
|
|
|
+ item.setPayStatus(3);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
price = price.add(itemTotalPrice);
|
|
|
itemList.add(item);
|
|
|
index++;
|
|
@@ -834,9 +1023,6 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
|
for (TbBusinessCar tbBusinessCar : cars) {
|
|
|
String businessCarId = tbBusinessCar.getId();
|
|
|
String carNo = tbBusinessCar.getCarNo();
|
|
|
- for (TbBusinessItem item : itemList) {
|
|
|
- checkOtherBusiness(item.getItemTypeId(), otherBusinessBO.getOperateTime(), dbBusiness.getId(), carNo);
|
|
|
- }
|
|
|
if (StrUtil.isNotEmpty(businessCarId)) {
|
|
|
//原来已存在的
|
|
|
TbBusinessCar dbBusinessCar = tbBusinessCarService.getById(businessCarId);
|
|
@@ -846,15 +1032,8 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
|
//把关联删除掉,然后添加新的关联
|
|
|
relationBusinessCarService.removeByBusinessIdAndCarId(dbBusiness.getId(), businessCarId);
|
|
|
TbBusinessCar otherCar = tbBusinessCarService.findTheLastRecord(carNo);
|
|
|
- if (otherCar == null ||//不存在或者已离场===>新建
|
|
|
- (otherCar.getRealInTime() != null && otherCar.getRealOutTime() != null)) {
|
|
|
- otherCar = new TbBusinessCar();
|
|
|
- otherCar.setCreateTime(now).setPay(0).setNo(carBuseinssNo + RandomUtil.randomNumbers(4))
|
|
|
- .setCarNo(carNo).setCarType(tbBusinessCar.getCarType()).setCarSize(tbBusinessCar.getCarSize())
|
|
|
- .setNetWeight(tbBusinessCar.getNetWeight()).setCustomerId(dbBusiness.getCustomerId())
|
|
|
- .setTimeUpdate(now).setIsLock(0).setCarType(tbBusinessCar.getCarType())
|
|
|
- .setConfirmJudge(CarEnum.ConfirmJudgeEnum.NO_JUDGE.getCode());
|
|
|
- tbBusinessCarService.save(otherCar);
|
|
|
+ if (otherCar == null) {
|
|
|
+ throw new AjaxError("车辆【" + carNo + "】未入场");
|
|
|
} else {
|
|
|
List<TbBusiness> tbBusinessList = this.findOtherBusinessByCarId(businessCarId);
|
|
|
if (tbBusinessList.size() == 1 && dbBusinessCar.getRealInTime() == null) {
|
|
@@ -873,12 +1052,8 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
|
} else {
|
|
|
TbBusinessCar checkCar = tbBusinessCarService.findTheLastRecord(carNo);
|
|
|
//不存在或者已经离场的
|
|
|
- if (checkCar == null ||
|
|
|
- (checkCar.getRealInTime() != null && checkCar.getRealOutTime() != null)) {
|
|
|
- checkCar = new TbBusinessCar();
|
|
|
- checkCar.setCreateTime(now).setPay(0).setBusinessType(1)
|
|
|
- .setConfirmJudge(CarEnum.ConfirmJudgeEnum.NO_JUDGE.getCode())
|
|
|
- .setNo(carBuseinssNo + RandomUtil.randomNumbers(4));
|
|
|
+ if (checkCar == null) {
|
|
|
+ throw new AjaxError("车辆【" + carNo + "】未入场");
|
|
|
}
|
|
|
checkCar.setCarNo(carNo).setCarType(tbBusinessCar.getCarType()).setCarSize(tbBusinessCar.getCarSize())
|
|
|
.setNetWeight(tbBusinessCar.getNetWeight()).setCustomerId(dbBusiness.getCustomerId())
|
|
@@ -892,7 +1067,7 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
|
}
|
|
|
if (!StrUtil.equals(dbBusiness.getGoodsId(), otherBusinessBO.getGoodsId())) {
|
|
|
dbBusiness.setGoodsId(otherBusinessBO.getGoodsId())
|
|
|
- .setGoodsName(tbGoods.getName()).setPayStep(tbGoods.getPayStep());
|
|
|
+ .setGoodsName(goodsName).setPayStep(tbGoods.getPayStep());
|
|
|
}
|
|
|
String customerId = otherBusinessBO.getCustomerId();
|
|
|
if (StrUtil.isNotEmpty(customerId)) {
|
|
@@ -907,7 +1082,7 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
|
|
|
|
dbBusiness.setCardSize(otherBusinessBO.getCarSize()).setNetWeight(otherBusinessBO.getNetWeight())
|
|
|
.setOperator(otherBusinessBO.getOperator()).setOperateTime(otherBusinessBO.getOperateTime())
|
|
|
- .setGoodsId(otherBusinessBO.getGoodsId())
|
|
|
+ .setGoodsId(otherBusinessBO.getGoodsId()).setGoodsCode(tbGoods.getCode()).setGoodsName(goodsName)
|
|
|
.setOwner(otherBusinessBO.getOwner()).setBusinessGoodsName(otherBusinessBO.getBusinessGoodsName())
|
|
|
.setBusinessGoodsNum(otherBusinessBO.getBusinessGoodsNum())
|
|
|
.setCardNo(otherBusinessBO.getCardNo());
|
|
@@ -1509,6 +1684,7 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
|
|
|
|
/**
|
|
|
* 审核通过
|
|
|
+ *
|
|
|
* @param id
|
|
|
*/
|
|
|
public void confirmJudgePass(String id) {
|
|
@@ -1543,20 +1719,32 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
|
item.setPayTime(now).setPayStatus(1).setPayType(PayEnum.PayType.PER_PAY.getCode())
|
|
|
.setPayTypeName(PayEnum.PayType.PER_PAY.getDesc());
|
|
|
tbBusinessItemService.updateById(item);
|
|
|
- tbBusiness.setPayMoney(price.add(tbBusiness.getPayMoney()));
|
|
|
+ tbBusiness.setPayMoney(price.add(tbBusiness.getPayMoney())).setPayTime(now);
|
|
|
BigDecimal afterBalance = balance.subtract(price);
|
|
|
tbAccount.setTotalMoney(afterBalance);//增加累计扣款
|
|
|
tbAccountService.updateById(tbAccount);
|
|
|
TbFeeDetails details = tbFeeDetailsService.savePrePayDetails(res, item, tbBusinessCar, tbBusiness, FeeTypeEnum.STEVEDORE_FEE);
|
|
|
tbFeeStatisticsService.addOrUpdateStatistic(now, PayEnum.PayType.PER_PAY.getCode());//更新当前日期的日统计
|
|
|
- TbDeductionRecord record= automaticPay.createTbDeductionRecord(details, balance, afterBalance, tbBusiness.getPickCustomerId(), tbBusiness.getPickCustomerName(), tbBusinessCar.getCarNo(), tbBusinessCar.getId(), FeeTypeEnum.STEVEDORE_FEE);
|
|
|
- addInvoiceOrder(tbBusiness, res.getTotalOrderPrice(),details,record);
|
|
|
+ TbDeductionRecord record = automaticPay.createTbDeductionRecord(details, balance, afterBalance, tbBusiness.getPickCustomerId(), tbBusiness.getPickCustomerName(), tbBusinessCar.getCarNo(), tbBusinessCar.getId(), FeeTypeEnum.STEVEDORE_FEE);
|
|
|
+ addInvoiceOrder(tbBusiness, res.getTotalOrderPrice(), details, record);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
//其他费项 装卸业务管理费” 进行预存款扣除
|
|
|
for (TbBusinessItem item : tbBusinessItems) {
|
|
|
+ String aliasName = item.getItemAlias();
|
|
|
+ //充电打冷,正面吊(取柜)必须得有开始时间+结束时间
|
|
|
+ if (StrUtil.equals(aliasName, SystemObject.config.getColdItemAlias())
|
|
|
+ || (StrUtil.equals(aliasName, SystemObject.config.getEmptyStoreItemAlias())
|
|
|
+ && item.getCabinetType() == 1)
|
|
|
+ || (StrUtil.equals(aliasName, SystemObject.config.getHeavyStoreItemAlias())
|
|
|
+ && item.getCabinetType() == 1)
|
|
|
+ ) {
|
|
|
+ if (item.getColdStartTime() == null || item.getColdEndTime() == null) {
|
|
|
+ throw new AjaxError("请先点击【修改】,然后录入业务开始/结束时间");
|
|
|
+ }
|
|
|
+ }
|
|
|
//业务类型是装卸业务管理费且未支付的进行扣款
|
|
|
if (item.getPayStatus() == 0 && SystemObject.config.getUnLoadItem().contains(item.getItemTypeName())) {
|
|
|
List<IOrderItem> expenses = new ArrayList<>();
|
|
@@ -1576,29 +1764,35 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
|
item.setPayTime(now).setPayStatus(1).setPayType(PayEnum.PayType.PER_PAY.getCode())
|
|
|
.setPayTypeName(PayEnum.PayType.PER_PAY.getDesc());
|
|
|
tbBusinessItemService.updateById(item);
|
|
|
- tbBusiness.setPayMoney(price.add(tbBusiness.getPayMoney()));
|
|
|
- //查找越南车--->统计以
|
|
|
- TbBusinessCar tbBusinessCar = tbBusinessCars.stream().filter(car -> !CAR_LIST.contains(car.getCarNo().substring(0, 1)))
|
|
|
+ tbBusiness.setPayMoney(price.add(tbBusiness.getPayMoney())).setPayTime(now);
|
|
|
+ //查找越南车--->统计以--->重车对集装箱吊装 (重 柜 ) =====空车 vs 集装箱吊装 (空 柜 )
|
|
|
+ String itemAlias = item.getItemAlias();
|
|
|
+ TbBusinessCar tbBusinessCar = tbBusinessCars.stream().filter(car -> car.getCarType().equals(CarEnum.CarTypeEnum.EMPTY_TYPE.getType()))
|
|
|
.findAny().orElse(tbBusinessCars.get(0));
|
|
|
+ if (StrUtil.equals(itemAlias, SystemObject.config.getHeavyCondoleItemAlias())) {
|
|
|
+ tbBusinessCar = tbBusinessCars.stream().filter(car -> car.getCarType().equals(CarEnum.CarTypeEnum.WEIGHT_TYPE.getType()))
|
|
|
+ .findAny().orElse(tbBusinessCars.get(0));
|
|
|
+ }
|
|
|
TbFeeDetails details = tbFeeDetailsService.savePrePayDetails(res, item, tbBusinessCar, tbBusiness, FeeTypeEnum.STEVEDORE_FEE);
|
|
|
tbFeeStatisticsService.addOrUpdateStatistic(now, PayEnum.PayType.PER_PAY.getCode());//更新当前日期的日统计
|
|
|
- TbDeductionRecord record= automaticPay.createTbDeductionRecord(details, balance, afterBalance, tbBusiness.getPickCustomerId(), tbBusiness.getPickCustomerName(), tbBusinessCar.getCarNo(), tbBusinessCar.getId(), FeeTypeEnum.STEVEDORE_FEE);
|
|
|
- addInvoiceOrder(tbBusiness, res.getTotalOrderPrice(),details,record);
|
|
|
+ TbDeductionRecord record = automaticPay.createTbDeductionRecord(details, balance, afterBalance, tbBusiness.getPickCustomerId(), tbBusiness.getPickCustomerName(), tbBusinessCar.getCarNo(), tbBusinessCar.getId(), FeeTypeEnum.STEVEDORE_FEE);
|
|
|
+ addInvoiceOrder(tbBusiness, res.getTotalOrderPrice(), details, record);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
tbBusiness.setConfirmJudgeTime(now).setConfirmJudgeContent("审核通过")
|
|
|
.setConfirmJudge(CarEnum.ConfirmJudgeEnum.JUDGE_PASS.getCode())
|
|
|
- .setJudgeBy(StpUserUtil.getCreateBy()).setPayTime(now);
|
|
|
+ .setJudgeBy(StpUserUtil.getCreateBy());
|
|
|
this.updateById(tbBusiness);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 添加开票订单
|
|
|
+ *
|
|
|
* @param tbBusiness
|
|
|
* @param billMoney
|
|
|
*/
|
|
|
- private void addInvoiceOrder(TbBusiness tbBusiness, BigDecimal billMoney,TbFeeDetails details,TbDeductionRecord record) {
|
|
|
+ private void addInvoiceOrder(TbBusiness tbBusiness, BigDecimal billMoney, TbFeeDetails details, TbDeductionRecord record) {
|
|
|
TbInvoiceOrder t = new TbInvoiceOrder();
|
|
|
t.setBusinessName(tbBusiness.getGoodsName())
|
|
|
.setBusinessNo(tbBusiness.getNo())
|
|
@@ -1614,6 +1808,7 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
|
|
|
|
/**
|
|
|
* 审核驳回
|
|
|
+ *
|
|
|
* @param id
|
|
|
* @param judgeContent
|
|
|
*/
|