Procházet zdrojové kódy

蓝色车牌免费显示

qzyReal před 3 roky
rodič
revize
b33d7bd457

+ 23 - 12
sp-server/src/main/java/com/pj/project/tb_business_car/TbBusinessCarService.java

@@ -29,6 +29,7 @@ import com.pj.project.tb_business_item.TbBusinessItem;
 import com.pj.project.tb_business_item.TbBusinessItemService;
 import com.pj.project.tb_car.TbCar;
 import com.pj.project.tb_car.TbCarService;
+import com.pj.project.tb_car_no_color.TbCarNoColor;
 import com.pj.project.tb_car_no_color.TbCarNoColorService;
 import com.pj.project.tb_fee_details.TbFeeDetails;
 import com.pj.project.tb_fee_details.TbFeeDetailsService;
@@ -70,19 +71,28 @@ public class TbBusinessCarService extends ServiceImpl<TbBusinessCarMapper, TbBus
     @Resource
     private UploadConfig uploadConfig;
 
+    @Resource
+    private TbCarNoColorService tbCarNoColorService;
 
 
     /**
      * 查集合 - 根据条件(参数为空时代表忽略指定条件)
      */
     List<TbBusinessCar> getList(SoMap so) {
-        List<TbBusinessCar> list=tbBusinessCarMapper.getList(so);
+        List<TbCarNoColor> carNoColors = tbCarNoColorService.getFreeColor();
+       String colorStr= carNoColors.stream().map(TbCarNoColor::getCarNoColor).collect(Collectors.joining(""));
+        List<TbBusinessCar> list = tbBusinessCarMapper.getList(so);
         for (TbBusinessCar tbBusinessCar : list) {
+            String color=tbBusinessCar.getColor();
             TbCar tbCar = tbCarService.findByCardNo(tbBusinessCar.getCarNo());
             if (tbCar != null && !TbCar.CarTypeEnum.BUSINESS_CAR.getType().equals(tbCar.getCarType())) {
                 tbBusinessCar.setPayType("免费");
                 continue;
             }
+            if (StrUtil.isNotEmpty(color)&&colorStr.contains(color.substring(0,1))){
+                tbBusinessCar.setPayType("免费");
+                continue;
+            }
             final List<String> CAR_LIST = StrUtil.splitTrim("浙,粤,京,津,冀,晋,蒙,辽,黑,沪,吉,苏,皖,赣,鲁,豫,鄂,湘,桂,琼,渝,川,贵,云,藏, 陕, 甘, 青, 宁", ",");
             Date inTime = tbBusinessCar.getRealInTime();
             Date outTime = tbBusinessCar.getRealOutTime();
@@ -288,10 +298,10 @@ public class TbBusinessCarService extends ServiceImpl<TbBusinessCarMapper, TbBus
             List<TbFeeDetails> feeDetailsLIst = tbFeeDetailsService.getByBusinessIdAndCarNo(businessId, oldCarNo);
             feeDetailsLIst.forEach(fee -> fee.setCarNo(carNo));
             tbFeeDetailsService.updateBatchById(feeDetailsLIst);
-        } else{
+        } else {
             List<TbFeeDetails> feeDetailsList = tbFeeDetailsService.getByBusinessCarIdAndCarNoAndFeeType(t.getId(), oldCarNo, TbFeeDetails.fee.PARK_FEE.getCode());
             for (TbFeeDetails feeDetail : feeDetailsList) {
-                if(feeDetail != null){
+                if (feeDetail != null) {
                     feeDetail.setCarNo(carNo);
                     tbFeeDetailsService.updateById(feeDetail);
                 }
@@ -332,27 +342,28 @@ public class TbBusinessCarService extends ServiceImpl<TbBusinessCarMapper, TbBus
     }
 
     public List<TbBusinessCar> findByCarNo(String carNo) {
-        QueryWrapper<TbBusinessCar>ew=new QueryWrapper<>();
-        ew.eq("car_no",carNo);
+        QueryWrapper<TbBusinessCar> ew = new QueryWrapper<>();
+        ew.eq("car_no", carNo);
         return list(ew);
     }
 
     public AjaxJson deleteRecord(String id) {
-      TbFeeDetails tbFeeDetails=  tbFeeDetailsService.findByBusinessCarId(id,TbFeeDetails.fee.PARK_FEE.getCode());
-      if (tbFeeDetails!=null){
-          return AjaxJson.getError("该车有付款记录,不能删除");
-      }
-      this.removeById(id);
+        TbFeeDetails tbFeeDetails = tbFeeDetailsService.findByBusinessCarId(id, TbFeeDetails.fee.PARK_FEE.getCode());
+        if (tbFeeDetails != null) {
+            return AjaxJson.getError("该车有付款记录,不能删除");
+        }
+        this.removeById(id);
         return AjaxJson.getSuccess();
     }
 
-    public List<TbBusinessCar> findInCarByDay(String day){
+    public List<TbBusinessCar> findInCarByDay(String day) {
         QueryWrapper<TbBusinessCar> qw = new QueryWrapper();
         qw.like("real_in_time", day);
         List<TbBusinessCar> list = this.list(qw);
         return list;
     }
-    public List<TbBusinessCar> findOutCarByDay(String day){
+
+    public List<TbBusinessCar> findOutCarByDay(String day) {
         QueryWrapper<TbBusinessCar> qw = new QueryWrapper();
         qw.like("real_out_time", day);
         List<TbBusinessCar> list = this.list(qw);