|
@@ -534,7 +534,7 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
|
.findAny().ifPresent(priceItem -> {
|
|
|
BigDecimal price = priceItem.getFirePrice().multiply(new BigDecimal(item.getNum()));
|
|
|
//柜车、栏车只有离场才知道多少钱
|
|
|
- if (StrUtil.equals(item.getItemAlias(),SystemObject.config.getCabinetCar())){
|
|
|
+ if (StrUtil.equals(item.getItemAlias(), SystemObject.config.getCabinetCar())) {
|
|
|
TbBusiness tbBusiness = this.getById(item.getBusinessId());
|
|
|
tbBusiness.setItemPrice(price);
|
|
|
item.setTotal(price);
|
|
@@ -813,6 +813,17 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
|
}
|
|
|
//最新一条记录
|
|
|
TbBusinessCar db = tbBusinessCarService.findTheLastRecord(carNo);
|
|
|
+ if (db != null && db.getRealOutTime() == null) {
|
|
|
+ //未离场====>检查是否录入了其他业务,需要校验其绑定的客户是否一致
|
|
|
+ List<TbBusiness> exitBusinessList = this.findOtherBusinessByCarId(db.getId());
|
|
|
+ if (!exitBusinessList.isEmpty()) {
|
|
|
+ TbBusiness exitBusiness = exitBusinessList.get(0);
|
|
|
+ String bindCustomerId = exitBusiness.getCustomerId();
|
|
|
+ if (!StrUtil.equals(bindCustomerId, customerId)) {
|
|
|
+ throw new AjaxError("车辆【" + carNo + "】绑定的客户与已绑定的【" + exitBusiness.getCustomerName() + "】不一致");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
if (!tbGoods.getName().contains("整车")) {
|
|
|
//记录不存在或者已离场
|
|
|
if (db == null || db.getRealOutTime() != null) {
|
|
@@ -824,11 +835,6 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
|
db = new TbBusinessCar();
|
|
|
db.setCreateTime(now).setPay(0).setNo(carBuseinssNo + RandomUtil.randomNumbers(4));
|
|
|
}
|
|
|
- for (TbBusinessItem item : itemList) {
|
|
|
- if (StrUtil.isNotEmpty(otherBusinessBO.getOperateTime())) {
|
|
|
- checkOtherBusiness(item.getItemTypeId(), otherBusinessBO.getOperateTime(), tbBusiness.getId(), carNo);
|
|
|
- }
|
|
|
- }
|
|
|
db.setPayType(CarEnum.PayTypeEnum.NO_PAY_TYPE.getType());
|
|
|
TbCar tbCar = tbCarService.findByCardNo(carNo);
|
|
|
if (tbCar != null) {
|
|
@@ -866,6 +872,7 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
|
|
|
|
public void editOtherBusiness(OtherBusinessBO otherBusinessBO) {
|
|
|
String id = otherBusinessBO.getId();
|
|
|
+ String customerId = otherBusinessBO.getCustomerId();
|
|
|
TbBusiness dbBusiness = this.getById(id);
|
|
|
if (dbBusiness == null) {
|
|
|
throw new AjaxError("记录不存在");
|
|
@@ -897,7 +904,7 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
|
String carBuseinssNo = DateUtil.format(now, "yyyyMMddHHmm");
|
|
|
String goodsName = tbGoods.getName();
|
|
|
List<TbBusinessItem> itemList = new ArrayList<>();
|
|
|
- if (PayEnum.PayStatusEnum.HAS_PAY_CONFIRM.getCode() != dbBusiness.getPayStatus()) {
|
|
|
+ if (dbBusiness.getPayMoney().compareTo(dbBusiness.getItemPrice()) < 0) {
|
|
|
List<TbBusinessItem> businessItemList = tbBusinessItemService.findByBusinessId(id);
|
|
|
//变成未取柜状态
|
|
|
businessItemList.stream().filter(item -> item.getParentCabinetId() != null).forEach(item -> {
|
|
@@ -916,7 +923,6 @@ 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();
|
|
@@ -947,6 +953,7 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
|
.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);
|
|
@@ -1023,6 +1030,18 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
|
for (TbBusinessCar tbBusinessCar : cars) {
|
|
|
String businessCarId = tbBusinessCar.getId();
|
|
|
String carNo = tbBusinessCar.getCarNo();
|
|
|
+ TbBusinessCar checkCar = tbBusinessCarService.findTheLastRecord(carNo);
|
|
|
+ if (checkCar != null && checkCar.getRealOutTime() == null) {
|
|
|
+ //未离场====>检查是否录入了其他业务,需要校验其绑定的客户是否一致
|
|
|
+ List<TbBusiness> exitBusinessList = this.findOtherBusinessByCarId(checkCar.getId());
|
|
|
+ if (!exitBusinessList.isEmpty()) {
|
|
|
+ TbBusiness exitBusiness = exitBusinessList.get(0);
|
|
|
+ String bindCustomerId = exitBusiness.getCustomerId();
|
|
|
+ if (!StrUtil.equals(bindCustomerId, customerId)) {
|
|
|
+ //throw new AjaxError("车辆【" + carNo + "】绑定的客户与已绑定的【" + exitBusiness.getCustomerName() + "】不一致");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
if (StrUtil.isNotEmpty(businessCarId)) {
|
|
|
//原来已存在的
|
|
|
TbBusinessCar dbBusinessCar = tbBusinessCarService.getById(businessCarId);
|
|
@@ -1050,7 +1069,7 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
|
tbBusinessCarService.updateById(dbBusinessCar);
|
|
|
}
|
|
|
} else {
|
|
|
- TbBusinessCar checkCar = tbBusinessCarService.findTheLastRecord(carNo);
|
|
|
+
|
|
|
//不存在或者已经离场的
|
|
|
if (checkCar == null) {
|
|
|
throw new AjaxError("车辆【" + carNo + "】未入场");
|
|
@@ -1069,7 +1088,6 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
|
dbBusiness.setGoodsId(otherBusinessBO.getGoodsId())
|
|
|
.setGoodsName(goodsName).setPayStep(tbGoods.getPayStep());
|
|
|
}
|
|
|
- String customerId = otherBusinessBO.getCustomerId();
|
|
|
if (StrUtil.isNotEmpty(customerId)) {
|
|
|
TbCostomer tbCostomer = tbCostomerService.getById(customerId);
|
|
|
dbBusiness.setCustomerId(customerId).setCustomerName(tbCostomer.getName());
|
|
@@ -1734,6 +1752,7 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
|
//其他费项 装卸业务管理费” 进行预存款扣除
|
|
|
for (TbBusinessItem item : tbBusinessItems) {
|
|
|
String aliasName = item.getItemAlias();
|
|
|
+ String itemName = item.getItemName();
|
|
|
//充电打冷,正面吊(取柜)必须得有开始时间+结束时间
|
|
|
if (StrUtil.equals(aliasName, SystemObject.config.getColdItemAlias())
|
|
|
|| (StrUtil.equals(aliasName, SystemObject.config.getEmptyStoreItemAlias())
|
|
@@ -1745,8 +1764,9 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
|
throw new AjaxError("请先点击【修改】,然后录入业务开始/结束时间");
|
|
|
}
|
|
|
}
|
|
|
- //业务类型是装卸业务管理费且未支付的进行扣款
|
|
|
- if (item.getPayStatus() == 0 && SystemObject.config.getUnLoadItem().contains(item.getItemTypeName())) {
|
|
|
+ //其他业务类型是装卸业务管理费且未支付的进行扣款
|
|
|
+ if (item.getPayStatus() == 0 && SystemObject.config.getUnLoadItem().contains(item.getItemTypeName())
|
|
|
+ && !SystemObject.config.getEveryCarPay().contains(itemName)) {
|
|
|
List<IOrderItem> expenses = new ArrayList<>();
|
|
|
IOrderItem orderItem = new IOrderItem();
|
|
|
orderItem.setExpenseNum(Integer.parseInt(item.getNum()))
|