|
@@ -90,6 +90,7 @@ import com.pj.utils.cache.RedisUtil;
|
|
import com.pj.utils.sg.AjaxJson;
|
|
import com.pj.utils.sg.AjaxJson;
|
|
import com.pj.utils.so.SoMap;
|
|
import com.pj.utils.so.SoMap;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
+import org.aspectj.weaver.loadtime.Aj;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.context.annotation.Lazy;
|
|
import org.springframework.context.annotation.Lazy;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
@@ -455,14 +456,11 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
|
|
|
|
List<String> businessIdList = businessList.stream().map(TbBusiness::getId).collect(Collectors.toList());
|
|
List<String> businessIdList = businessList.stream().map(TbBusiness::getId).collect(Collectors.toList());
|
|
String businessIds = StrUtil.join(",", businessIdList);
|
|
String businessIds = StrUtil.join(",", businessIdList);
|
|
|
|
+ long judgeCount = businessList.stream().filter(tbBusiness -> tbBusiness.getConfirmJudge() == CarEnum.ConfirmJudgeEnum.JUDGE_PASS.getCode()).count();
|
|
|
|
+ int size=businessList.size();
|
|
result.put("showPay", true);
|
|
result.put("showPay", true);
|
|
result.put("businessId", businessIds);
|
|
result.put("businessId", businessIds);
|
|
- result.put("noJudgeCount", 0);
|
|
|
|
- if (CarEnum.BusinessTypeEnum.BUSINESS_CAR.getType().equals(tbBusinessCar.getBusinessType())) {
|
|
|
|
- if (tbBusinessCar.getConfirmJudge() != CarEnum.ConfirmJudgeEnum.JUDGE_PASS.getCode()) {
|
|
|
|
- result.put("noJudgeCount", 1);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ result.put("noJudgeCount", judgeCount==size?0:1);
|
|
List<TbBusinessItem> items = tbBusinessItemService.findByBusinessIdList(businessIdList);
|
|
List<TbBusinessItem> items = tbBusinessItemService.findByBusinessIdList(businessIdList);
|
|
Date inTime = tbBusinessCar.getRealInTime();
|
|
Date inTime = tbBusinessCar.getRealInTime();
|
|
int pay = tbBusinessCar.getPay();
|
|
int pay = tbBusinessCar.getPay();
|
|
@@ -781,10 +779,6 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
}
|
|
}
|
|
//最新一条记录
|
|
//最新一条记录
|
|
TbBusinessCar db = tbBusinessCarService.findTheLastRecord(carNo);
|
|
TbBusinessCar db = tbBusinessCarService.findTheLastRecord(carNo);
|
|
- //存在并且未离场+已审核
|
|
|
|
- if (db != null && db.getConfirmJudge() == CarEnum.ConfirmJudgeEnum.JUDGE_PASS.getCode() && db.getRealOutTime() == null) {
|
|
|
|
- throw new BusinessException("车辆【" + carNo + "】已审核,请驳回再录入业务");
|
|
|
|
- }
|
|
|
|
if (!tbGoods.getName().contains("整车")) {
|
|
if (!tbGoods.getName().contains("整车")) {
|
|
//记录不存在或者已离场
|
|
//记录不存在或者已离场
|
|
if (db == null || db.getRealOutTime() != null) {
|
|
if (db == null || db.getRealOutTime() != null) {
|
|
@@ -839,15 +833,18 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
String id = otherBusinessBO.getId();
|
|
String id = otherBusinessBO.getId();
|
|
TbBusiness dbBusiness = this.getById(id);
|
|
TbBusiness dbBusiness = this.getById(id);
|
|
if (dbBusiness == null) {
|
|
if (dbBusiness == null) {
|
|
- throw new BusinessException("记录不存在");
|
|
|
|
|
|
+ throw new AjaxError("记录不存在");
|
|
|
|
+ }
|
|
|
|
+ if (dbBusiness.getConfirmJudge()== CarEnum.ConfirmJudgeEnum.JUDGE_PASS.getCode()){
|
|
|
|
+ throw new AjaxError("业务已审核,请驳回后修改");
|
|
}
|
|
}
|
|
List<TbItem> tbItems = otherBusinessBO.getItems();
|
|
List<TbItem> tbItems = otherBusinessBO.getItems();
|
|
if (tbItems.isEmpty()) {
|
|
if (tbItems.isEmpty()) {
|
|
- throw new BusinessException("请选择收费明细");
|
|
|
|
|
|
+ throw new AjaxError("请选择收费明细");
|
|
}
|
|
}
|
|
List<TbBusinessCar> cars = otherBusinessBO.getCars();
|
|
List<TbBusinessCar> cars = otherBusinessBO.getCars();
|
|
if (cars.isEmpty()) {
|
|
if (cars.isEmpty()) {
|
|
- throw new BusinessException("作业车辆不能为空");
|
|
|
|
|
|
+ throw new AjaxError("作业车辆不能为空");
|
|
}
|
|
}
|
|
|
|
|
|
Date now = new Date();
|
|
Date now = new Date();
|
|
@@ -914,16 +911,12 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
if (StrUtil.isNotEmpty(businessCarId)) {
|
|
if (StrUtil.isNotEmpty(businessCarId)) {
|
|
//原来已存在的
|
|
//原来已存在的
|
|
TbBusinessCar dbBusinessCar = tbBusinessCarService.getById(businessCarId);
|
|
TbBusinessCar dbBusinessCar = tbBusinessCarService.getById(businessCarId);
|
|
- if (dbBusinessCar.getConfirmJudge() == CarEnum.ConfirmJudgeEnum.JUDGE_PASS.getCode()) {
|
|
|
|
- throw new BusinessException("车辆【" + carNo + "】已审核,请驳回再录入业务");
|
|
|
|
- }
|
|
|
|
//如果修改了车牌号
|
|
//如果修改了车牌号
|
|
String dbCarNo = dbBusinessCar.getCarNo();
|
|
String dbCarNo = dbBusinessCar.getCarNo();
|
|
if (!dbCarNo.equals(carNo)) {
|
|
if (!dbCarNo.equals(carNo)) {
|
|
//把关联删除掉,然后添加新的关联
|
|
//把关联删除掉,然后添加新的关联
|
|
relationBusinessCarService.removeByBusinessIdAndCarId(dbBusiness.getId(), businessCarId);
|
|
relationBusinessCarService.removeByBusinessIdAndCarId(dbBusiness.getId(), businessCarId);
|
|
TbBusinessCar otherCar = tbBusinessCarService.findTheLastRecord(carNo);
|
|
TbBusinessCar otherCar = tbBusinessCarService.findTheLastRecord(carNo);
|
|
-
|
|
|
|
if (otherCar == null ||//不存在或者已离场===>新建
|
|
if (otherCar == null ||//不存在或者已离场===>新建
|
|
(otherCar.getRealInTime() != null && otherCar.getRealOutTime() != null)) {
|
|
(otherCar.getRealInTime() != null && otherCar.getRealOutTime() != null)) {
|
|
otherCar = new TbBusinessCar();
|
|
otherCar = new TbBusinessCar();
|
|
@@ -950,12 +943,6 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
TbBusinessCar checkCar = tbBusinessCarService.findTheLastRecord(carNo);
|
|
TbBusinessCar checkCar = tbBusinessCarService.findTheLastRecord(carNo);
|
|
- //存在+审核+未离场的
|
|
|
|
- if (checkCar != null
|
|
|
|
- && checkCar.getConfirmJudge() == CarEnum.ConfirmJudgeEnum.JUDGE_PASS.getCode()
|
|
|
|
- && checkCar.getRealOutTime() == null) {
|
|
|
|
- throw new BusinessException("车辆【" + carNo + "】已审核,请驳回再录入业务");
|
|
|
|
- }
|
|
|
|
//不存在或者已经离场的
|
|
//不存在或者已经离场的
|
|
if (checkCar == null ||
|
|
if (checkCar == null ||
|
|
(checkCar.getRealInTime() != null && checkCar.getRealOutTime() != null)) {
|
|
(checkCar.getRealInTime() != null && checkCar.getRealOutTime() != null)) {
|
|
@@ -1006,11 +993,10 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
|
|
|
|
public void bindOtherBusinessCar(String businessId, List<String> businessCarIdList) {
|
|
public void bindOtherBusinessCar(String businessId, List<String> businessCarIdList) {
|
|
TbBusiness tbBusiness = this.getById(businessId);
|
|
TbBusiness tbBusiness = this.getById(businessId);
|
|
- List<TbBusinessCar> list = tbBusinessCarService.findOtherBusinessCar(businessId);
|
|
|
|
- long count = list.stream().filter(tbBusinessCar -> tbBusinessCar.getConfirmJudge() == 1).count();
|
|
|
|
- if (count > 0) {
|
|
|
|
- throw new AjaxError("业务已审核,请先驳回审核");
|
|
|
|
|
|
+ if (tbBusiness.getConfirmJudge()== CarEnum.ConfirmJudgeEnum.JUDGE_PASS.getCode()){
|
|
|
|
+ throw new AjaxError("业务已审核,请先驳回");
|
|
}
|
|
}
|
|
|
|
+ List<TbBusinessCar> list = tbBusinessCarService.findOtherBusinessCar(businessId);
|
|
list.stream().filter(tbBusinessCar -> !businessCarIdList.contains(tbBusinessCar.getId()) && tbBusinessCar.getRealInTime() == null)
|
|
list.stream().filter(tbBusinessCar -> !businessCarIdList.contains(tbBusinessCar.getId()) && tbBusinessCar.getRealInTime() == null)
|
|
.forEach(tbBusinessCar -> tbBusinessCarService.removeById(tbBusinessCar.getId()));
|
|
.forEach(tbBusinessCar -> tbBusinessCarService.removeById(tbBusinessCar.getId()));
|
|
relationBusinessCarService.removeByBusinessId(businessId);
|
|
relationBusinessCarService.removeByBusinessId(businessId);
|
|
@@ -1538,6 +1524,9 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
public void addBusinessCar(TbBusinessCar tbBusinessCar) {
|
|
public void addBusinessCar(TbBusinessCar tbBusinessCar) {
|
|
String businessId = tbBusinessCar.getBusinessId();
|
|
String businessId = tbBusinessCar.getBusinessId();
|
|
TbBusiness tbBusiness = this.getById(businessId);
|
|
TbBusiness tbBusiness = this.getById(businessId);
|
|
|
|
+ if (tbBusiness.getConfirmJudge()== CarEnum.ConfirmJudgeEnum.JUDGE_PASS.getCode()){
|
|
|
|
+ throw new AjaxError("业务已审核,不能绑定新车辆");
|
|
|
|
+ }
|
|
String carNo = tbBusinessCar.getCarNo().trim().toUpperCase();
|
|
String carNo = tbBusinessCar.getCarNo().trim().toUpperCase();
|
|
TbBusinessCar lastRecord = tbBusinessCarService.findTheLastRecord(carNo);
|
|
TbBusinessCar lastRecord = tbBusinessCarService.findTheLastRecord(carNo);
|
|
String businessCarId;
|
|
String businessCarId;
|
|
@@ -1556,8 +1545,10 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
businessCarId = tbBusinessCar.getId();
|
|
businessCarId = tbBusinessCar.getId();
|
|
} else {
|
|
} else {
|
|
businessCarId = lastRecord.getId();
|
|
businessCarId = lastRecord.getId();
|
|
- lastRecord.setPayType(CarEnum.PayTypeEnum.NO_PAY_TYPE.getType()).setCustomerId(tbBusiness.getCustomerId())
|
|
|
|
- .setCarNo(carNo).setConfirmJudge(CarEnum.ConfirmJudgeEnum.NO_JUDGE.getCode()).setPayUnloadMoney(0)
|
|
|
|
|
|
+ lastRecord.setPayType(CarEnum.PayTypeEnum.NO_PAY_TYPE.getType())
|
|
|
|
+ .setCustomerId(tbBusiness.getCustomerId())
|
|
|
|
+ .setCarNo(carNo).setConfirmJudge(CarEnum.ConfirmJudgeEnum.NO_JUDGE.getCode())
|
|
|
|
+ .setPayUnloadMoney(lastRecord.getPayUnloadMoney())
|
|
.setTimeUpdate(now)
|
|
.setTimeUpdate(now)
|
|
.setBusinessType(CarEnum.BusinessTypeEnum.BUSINESS_CAR.getType());
|
|
.setBusinessType(CarEnum.BusinessTypeEnum.BUSINESS_CAR.getType());
|
|
tbBusinessCarService.updateById(lastRecord);
|
|
tbBusinessCarService.updateById(lastRecord);
|
|
@@ -1615,11 +1606,11 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
throw new AjaxError("[" + tbAccount.getCustomerName() + "]账户余额不足扣除" + item.getItemName());
|
|
throw new AjaxError("[" + tbAccount.getCustomerName() + "]账户余额不足扣除" + item.getItemName());
|
|
} else {
|
|
} else {
|
|
tbBusinessCar.setPayUnloadMoney(1);
|
|
tbBusinessCar.setPayUnloadMoney(1);
|
|
|
|
+ tbBusinessCarService.updateById(tbBusinessCar);
|
|
item.setPayTime(now).setPayStatus(1).setPayType(PayEnum.PayType.PER_PAY.getCode())
|
|
item.setPayTime(now).setPayStatus(1).setPayType(PayEnum.PayType.PER_PAY.getCode())
|
|
.setPayTypeName(PayEnum.PayType.PER_PAY.getDesc());
|
|
.setPayTypeName(PayEnum.PayType.PER_PAY.getDesc());
|
|
tbBusinessItemService.updateById(item);
|
|
tbBusinessItemService.updateById(item);
|
|
tbBusiness.setPayMoney(price.add(tbBusiness.getPayMoney()));
|
|
tbBusiness.setPayMoney(price.add(tbBusiness.getPayMoney()));
|
|
- this.updateById(tbBusiness);
|
|
|
|
BigDecimal afterBalance = balance.subtract(price);
|
|
BigDecimal afterBalance = balance.subtract(price);
|
|
tbAccount.setTotalMoney(afterBalance);//增加累计扣款
|
|
tbAccount.setTotalMoney(afterBalance);//增加累计扣款
|
|
tbAccountService.updateById(tbAccount);
|
|
tbAccountService.updateById(tbAccount);
|
|
@@ -1654,7 +1645,6 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
.setPayTypeName(PayEnum.PayType.PER_PAY.getDesc());
|
|
.setPayTypeName(PayEnum.PayType.PER_PAY.getDesc());
|
|
tbBusinessItemService.updateById(item);
|
|
tbBusinessItemService.updateById(item);
|
|
tbBusiness.setPayMoney(price.add(tbBusiness.getPayMoney()));
|
|
tbBusiness.setPayMoney(price.add(tbBusiness.getPayMoney()));
|
|
- this.updateById(tbBusiness);
|
|
|
|
//查找越南车--->统计以
|
|
//查找越南车--->统计以
|
|
TbBusinessCar tbBusinessCar = tbBusinessCars.stream().filter(car -> !CAR_LIST.contains(car.getCarNo().substring(0, 1)))
|
|
TbBusinessCar tbBusinessCar = tbBusinessCars.stream().filter(car -> !CAR_LIST.contains(car.getCarNo().substring(0, 1)))
|
|
.findAny().orElse(tbBusinessCars.get(0));
|
|
.findAny().orElse(tbBusinessCars.get(0));
|
|
@@ -1664,5 +1654,11 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ tbBusiness.setConfirmJudgeTime(now).setConfirmJudgeContent("审核通过")
|
|
|
|
+ .setConfirmJudge(CarEnum.ConfirmJudgeEnum.JUDGE_PASS.getCode())
|
|
|
|
+ .setJudgeBy(StpUserUtil.getCreateBy()).setPayTime(now);
|
|
|
|
+ this.updateById(tbBusiness);
|
|
|
|
+
|
|
}
|
|
}
|
|
}
|
|
}
|