Procházet zdrojové kódy

Merge branch 'dev' of http://47.101.143.145:8090/77975466/pco into dev

# Conflicts:
#	sp-server/app.pid
qzyReal před 3 roky
rodič
revize
6d46ee8693

+ 1 - 0
sp-server/src/main/java/com/pj/api/service/ApiService.java

@@ -137,6 +137,7 @@ public class ApiService {
             return tbBusiness.getAdminConfirmInput() == 1;
         }).collect(Collectors.toList());
        List<TbBusinessCar>cars= tbBusinessCarService.findTheNoBusinessCar(carNo);
+       //过滤掉不用缴费的车
        list.addAll(cars);
         return list;
     }

+ 1 - 1
sp-server/src/main/java/com/pj/project/tb_business/TbBusinessService.java

@@ -542,7 +542,7 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
                 Map<String, Object> itemMap = new HashMap<>();
                 itemMap.put("id", item.getId());
                 itemMap.put("name", item.getItemName()+"("+item.getItemTypeName()+")");
-                itemMap.put("price", item.getItemPrice());
+                itemMap.put("price", item.getItemPrice().multiply(new BigDecimal(item.getNum())));
                 itemMap.put("pay", item.getPayStatus());
                 itemList.add(itemMap);
             }

+ 1 - 15
sp-server/src/main/java/com/pj/project/tb_business_car/TbBusinessCar.java

@@ -122,21 +122,7 @@ public class TbBusinessCar extends Model<TbBusinessCar> implements Serializable
     @TableField(exist = false)
     private String payType;
 
-    public String getPayType() {
-        final List<String> CAR_LIST = StrUtil.splitTrim("浙,粤,京,津,冀,晋,蒙,辽,黑,沪,吉,苏,皖,赣,鲁,豫,鄂,湘,桂,琼,渝,川,贵,云,藏, 陕, 甘, 青, 宁", ",");
-        Date inTime = this.getRealInTime();
-        Date outTime = this.getRealOutTime();
-        if (inTime != null && outTime != null) {
-            LocalDateTime inDayTime = inTime.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
-            LocalDateTime outDayTime = outTime.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
-            long minutes = ChronoUnit.MINUTES.between(inDayTime, outDayTime);
-            PartConfig partConfig = SpringUtil.getBean(PartConfig.class);
-            if (minutes < partConfig.getFreeMinutes() || !CAR_LIST.contains(this.carNo.substring(0, 1))) {
-                return "免费";
-            }
-        }
-        return this.pay == null || this.pay == 0 ? "未支付" : "已支付";
-    }
+
 
 
 }

+ 28 - 2
sp-server/src/main/java/com/pj/project/tb_business_car/TbBusinessCarService.java

@@ -16,6 +16,7 @@ import cn.hutool.core.io.FileUtil;
 import cn.hutool.core.util.RandomUtil;
 import cn.hutool.core.util.RandomUtil;
 import cn.hutool.core.util.StrUtil;
+import cn.hutool.extra.spring.SpringUtil;
 import com.alibaba.excel.EasyExcel;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.IService;
@@ -26,6 +27,8 @@ import com.pj.project.tb_business.TbBusiness;
 import com.pj.project.tb_business.TbBusinessService;
 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.TbCarNoColorService;
 import com.pj.project.tb_fee_details.TbFeeDetails;
 import com.pj.project.tb_fee_details.TbFeeDetailsService;
@@ -59,7 +62,7 @@ public class TbBusinessCarService extends ServiceImpl<TbBusinessCarMapper, TbBus
     @Lazy
     private TbBusinessService tbBusinessService;
     @Resource
-    TbCarNoColorService tbCarNoColorService;
+    TbCarService tbCarService;
     @Resource
     @Lazy
     TbFeeDetailsService tbFeeDetailsService;
@@ -72,7 +75,30 @@ public class TbBusinessCarService extends ServiceImpl<TbBusinessCarMapper, TbBus
      * 查集合 - 根据条件(参数为空时代表忽略指定条件)
      */
     List<TbBusinessCar> getList(SoMap so) {
-        return tbBusinessCarMapper.getList(so);
+        List<TbBusinessCar> list=tbBusinessCarMapper.getList(so);
+        for (TbBusinessCar tbBusinessCar : list) {
+            TbCar tbCar = tbCarService.findByCardNo(tbBusinessCar.getCarNo());
+            if (tbCar != null && !TbCar.CarTypeEnum.BUSINESS_CAR.getType().equals(tbCar.getCarType())) {
+                tbBusinessCar.setPayType("免费");
+                continue;
+            }
+            final List<String> CAR_LIST = StrUtil.splitTrim("浙,粤,京,津,冀,晋,蒙,辽,黑,沪,吉,苏,皖,赣,鲁,豫,鄂,湘,桂,琼,渝,川,贵,云,藏, 陕, 甘, 青, 宁", ",");
+            Date inTime = tbBusinessCar.getRealInTime();
+            Date outTime = tbBusinessCar.getRealOutTime();
+            if (inTime != null && outTime != null) {
+                LocalDateTime inDayTime = inTime.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
+                LocalDateTime outDayTime = outTime.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
+                long minutes = ChronoUnit.MINUTES.between(inDayTime, outDayTime);
+                PartConfig partConfig = SpringUtil.getBean(PartConfig.class);
+                if (minutes < partConfig.getFreeMinutes() || !CAR_LIST.contains(tbBusinessCar.getCarNo().substring(0, 1))) {
+                    tbBusinessCar.setPayType("免费");
+                    continue;
+                }
+            }
+            String type = tbBusinessCar.getPay() == null || tbBusinessCar.getPay() == 0 ? "未支付" : "已支付";
+            tbBusinessCar.setPayType(type);
+        }
+        return list;
     }
 
     public TbBusinessCar findByBusinessIdAndCarNo(String businessId, String carNo) {