|
@@ -4,7 +4,9 @@ import java.util.Date;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.service.IService;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
@@ -31,6 +33,7 @@ import javax.annotation.Resource;
|
|
|
@Service
|
|
|
@Transactional
|
|
|
public class TbBusinessCarService extends ServiceImpl<TbBusinessCarMapper, TbBusinessCar> implements IService<TbBusinessCar> {
|
|
|
+ private final List<String> CAR_LIST = StrUtil.splitTrim("浙,粤,京,津,冀,晋,蒙,辽,黑,沪,吉,苏,皖,赣,鲁,豫,鄂,湘,桂,琼,渝,川,贵,云,藏, 陕, 甘, 青, 宁", ",");
|
|
|
|
|
|
/**
|
|
|
* 底层 Mapper 对象
|
|
@@ -125,9 +128,9 @@ public class TbBusinessCarService extends ServiceImpl<TbBusinessCarMapper, TbBus
|
|
|
throw new Exception("车辆已存在");
|
|
|
}
|
|
|
TbBusiness tbBusiness = tbBusinessService.getById(businessId);
|
|
|
- if (tbBusiness!=null){
|
|
|
+ if (tbBusiness != null) {
|
|
|
tbBusiness.setChinaPartMoney(tbBusiness.getChinaPartMoney().add(partConfig.getBasePrice()))
|
|
|
- .setTotalMoney(tbBusiness.getTotalMoney().add(partConfig.getBasePrice()));
|
|
|
+ .setTotalMoney(tbBusiness.getTotalMoney().add(partConfig.getBasePrice()));
|
|
|
tbBusinessService.updateById(tbBusiness);
|
|
|
}
|
|
|
|
|
@@ -137,6 +140,16 @@ public class TbBusinessCarService extends ServiceImpl<TbBusinessCarMapper, TbBus
|
|
|
|
|
|
public void updateCar(TbBusinessCar t) {
|
|
|
this.updateById(t);
|
|
|
+ TbBusiness tbBusiness = tbBusinessService.getById(t.getBusinessId());
|
|
|
+ String carNo = t.getCarNo();
|
|
|
+ if (!CAR_LIST.contains(carNo)) {
|
|
|
+ tbBusiness.setCardNo(carNo);
|
|
|
+ } else {
|
|
|
+ List<TbBusinessCar> cars = this.findByBusinessId(t.getBusinessId());
|
|
|
+ String chiaCarNo = cars.stream().filter(obj -> CAR_LIST.contains(obj.getCarNo())).map(TbBusinessCar::getCarNo).collect(Collectors.joining("、"));
|
|
|
+ tbBusiness.setChinaCarNo(chiaCarNo);
|
|
|
+ }
|
|
|
+ tbBusinessService.updateById(tbBusiness);
|
|
|
}
|
|
|
|
|
|
public void adminIn(String businessId, String carNo, Date realInTime) {
|
|
@@ -160,12 +173,12 @@ public class TbBusinessCarService extends ServiceImpl<TbBusinessCarMapper, TbBus
|
|
|
}
|
|
|
|
|
|
public void deleteCar(String id) {
|
|
|
- TbBusinessCar db=this.getById(id);
|
|
|
+ TbBusinessCar db = this.getById(id);
|
|
|
this.removeById(id);
|
|
|
TbBusiness tbBusiness = tbBusinessService.getById(db.getBusinessId());
|
|
|
- if (tbBusiness!=null){
|
|
|
+ if (tbBusiness != null) {
|
|
|
tbBusiness.setChinaPartMoney(tbBusiness.getChinaPartMoney().subtract(partConfig.getBasePrice()))
|
|
|
- .setTotalMoney(tbBusiness.getTotalMoney().subtract(partConfig.getBasePrice()));
|
|
|
+ .setTotalMoney(tbBusiness.getTotalMoney().subtract(partConfig.getBasePrice()));
|
|
|
tbBusinessService.updateById(tbBusiness);
|
|
|
}
|
|
|
}
|