|
@@ -117,7 +117,7 @@ public class TbBusinessCarService extends ServiceImpl<TbBusinessCarMapper, TbBus
|
|
|
}
|
|
|
|
|
|
public void add(TbBusinessCar t) throws Exception {
|
|
|
- String carNo = t.getCarNo();
|
|
|
+ String carNo = t.getCarNo().toUpperCase();
|
|
|
TbBusinessCar db = this.check(carNo);
|
|
|
String businessId = t.getBusinessId();
|
|
|
if (db != null) {
|
|
@@ -128,13 +128,13 @@ public class TbBusinessCarService extends ServiceImpl<TbBusinessCarMapper, TbBus
|
|
|
throw new Exception("车辆已存在");
|
|
|
}
|
|
|
TbBusiness tbBusiness = tbBusinessService.getById(businessId);
|
|
|
- if (tbBusiness != null) {
|
|
|
- tbBusiness.setChinaPartMoney(tbBusiness.getChinaPartMoney().add(partConfig.getBasePrice()))
|
|
|
- .setTotalMoney(tbBusiness.getTotalMoney().add(partConfig.getBasePrice()));
|
|
|
- tbBusinessService.updateById(tbBusiness);
|
|
|
+ if (!CAR_LIST.contains(carNo)) {
|
|
|
+ tbBusiness.setCardNo(carNo);
|
|
|
+ tbBusiness.setCardSize(t.getCarSize());
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
+ tbBusiness.setChinaPartMoney(tbBusiness.getChinaPartMoney().add(partConfig.getBasePrice()))
|
|
|
+ .setTotalMoney(tbBusiness.getTotalMoney().add(partConfig.getBasePrice()));
|
|
|
+ tbBusinessService.updateById(tbBusiness);
|
|
|
this.save(t);
|
|
|
}
|
|
|
|
|
@@ -172,14 +172,19 @@ public class TbBusinessCarService extends ServiceImpl<TbBusinessCarMapper, TbBus
|
|
|
return getOne(ew);
|
|
|
}
|
|
|
|
|
|
- public void deleteCar(String id) {
|
|
|
+ public AjaxJson deleteCar(String id) {
|
|
|
TbBusinessCar db = this.getById(id);
|
|
|
+ if (!CAR_LIST.contains(db.getCarNo())) {
|
|
|
+ return AjaxJson.getError("越南车不能删除");
|
|
|
+ }
|
|
|
this.removeById(id);
|
|
|
TbBusiness tbBusiness = tbBusinessService.getById(db.getBusinessId());
|
|
|
+
|
|
|
if (tbBusiness != null) {
|
|
|
tbBusiness.setChinaPartMoney(tbBusiness.getChinaPartMoney().subtract(partConfig.getBasePrice()))
|
|
|
.setTotalMoney(tbBusiness.getTotalMoney().subtract(partConfig.getBasePrice()));
|
|
|
tbBusinessService.updateById(tbBusiness);
|
|
|
}
|
|
|
+ return AjaxJson.getSuccess();
|
|
|
}
|
|
|
}
|