qzyReal 2 жил өмнө
parent
commit
d5a4332e5a

+ 1 - 1
app/manifest.json

@@ -85,7 +85,7 @@
     "vueVersion" : "2",
     "h5" : {
         "router" : {
-            "base" : "/test/",
+            "base" : "/h5/",
             "mode" : "history"
         },
         "devServer" : {

+ 2 - 2
app/utils/request.js

@@ -1,5 +1,5 @@
-// const server = 'http://127.0.0.1:8099/pro';
-const server = 'https://pco.aseanbusiness.cn/pro';
+const server = 'http://127.0.0.1:8099/pro';
+// const server = 'https://pco.aseanbusiness.cn/pro';
 // const server = 'https://dxkaa1.bgigc.com/pro';
 
 import common from '../common/js/common.js';

+ 1 - 1
sp-admin/sa-view/tb-business/tb-car-disincle-add.html

@@ -139,7 +139,7 @@
 						<el-row>
 							<el-card class="box-card">
 								<div slot="header" class="clearfix">
-									<span>业务项</span>
+									<span>收费项</span>
 								</div>
 								<div>
 									<el-form-item v-for="(type,index) in itemTypeList">

+ 1 - 1
sp-admin/sa-view/tb-business/tb-car-disincle-edit.html

@@ -137,7 +137,7 @@
 						<el-row>
 							<el-card class="box-card">
 								<div slot="header" class="clearfix">
-									<span>业务项</span>
+									<span>收费项</span>
 								</div>
 								<div>
 									<el-form-item v-for="(type,index) in itemTypeList">

+ 9 - 2
sp-admin/sa-view/tb-goods/tb-goods-list.html

@@ -32,7 +32,7 @@
 				<el-table class="data-table" ref="data-table" :data="dataList">
 					<el-table-column type="index" width="50">
 					</el-table-column>
-					<sa-td name="业务名称" prop="name"></sa-td>
+					<sa-td name="业务名称" prop="name" width="120"></sa-td>
 					<sa-td name="付款步骤" prop="payStep" type="enum" :jv="{1: '下单后', 2: '确认后'}" width="80"></sa-td>
 					<sa-td name="载重" prop="needWeight" type="switch" :jv="{0: '选填[#005500]', 1: '必填[#ff0000]'}"
 						@change="s => updateNeedWeight(s.row)" width="90"></sa-td>
@@ -104,7 +104,7 @@
 				},
 				methods: {
 					businessFn(data) {
-						sa.showIframe('数据详情', '../relation-goods-type/relation-goods-type-list.html?goodsId=' + data.id,
+						sa.showIframe('收费项', '../relation-goods-type/relation-goods-type-list.html?goodsId=' + data.id,
 							'1080px', '90%');
 					},
 					// 刷新
@@ -121,6 +121,13 @@
 						}.bind(this));
 					},
 					chinaLeaveChange(v) {
+						let obj={
+							id:v.id,
+							chinaCarLeave:v.chinaCarLeave
+						}
+						sa.ajax('/TbGoods/chinaLeaveChange',function(resp){
+							
+						}.bind(this))
 						console.log(v)
 					},
 					vietnamLeaveChange(v) {

+ 3 - 45
sp-server/src/main/java/com/pj/api/service/ApiService.java

@@ -148,54 +148,12 @@ public class ApiService {
         }
     }
 
-    public Set<TbBusinessCar> searchPartCar(String carNo) {
+    public List<TbBusinessCar> searchPartCar(String carNo) {
         if (StrUtil.isEmpty(carNo) || StrUtil.length(carNo) < 3) {
-            return new HashSet<>();
+            return Collections.emptyList();
         }
-        Set<TbBusinessCar> set = new HashSet<>();
         //查询出未缴费的车辆
-        List<TbBusinessCar> list = tbBusinessCarService.searchNoPayCar(carNo);
-        for (TbBusinessCar businessCar : list) {
-            String businessCarId = businessCar.getId();
-            List<TbBusiness> businessList = tbBusinessService.findOtherBusinessByCarId(businessCarId);
-            for (TbBusiness tbBusiness : businessList) {
-                Integer payStep = tbBusiness.getPayStep();
-                //确认之后才可以缴费
-                if (TbGoods.PayStep.AFTER_CONFIRM.getCode().equals(payStep)&&tbBusiness.getAdminConfirmInput()==1){
-                    set.add(businessCar);
-                    break;
-                }
-            }
-            set.add(businessCar);
-
-        }
-
-
-        list = list.stream().filter(tbBusinessCar -> {
-            String businessId = tbBusinessCar.getBusinessId();
-            if (StrUtil.isEmpty(businessId)) {
-                return false;
-            }
-            TbBusiness tbBusiness = tbBusinessService.getById(businessId);
-            return tbBusiness.getAdminConfirmInput() == 1;
-        }).collect(Collectors.toList());
-
-        List<TbBusinessCar> otherBusinessCarList = tbBusinessCarService.searchOtherBusinessCar(carNo);
-        otherBusinessCarList = otherBusinessCarList.stream().filter(tbBusinessCar -> {
-            String businessCarId = tbBusinessCar.getId();
-            List<TbBusiness> businesses = tbBusinessService.findOtherBusinessByCarId(businessCarId);
-            return businesses.stream().anyMatch(tbBusiness -> tbBusiness.getPayMoney().doubleValue() < tbBusiness.getTotalMoney().doubleValue()
-                    && (((TbGoods.PayStep.BEFORE_CONFIRM.getCode().equals(tbBusiness.getPayStep()) && tbBusiness.getAdminConfirmInput() >= 0)
-                    || (TbGoods.PayStep.AFTER_CONFIRM.getCode().equals(tbBusiness.getPayStep()) && tbBusiness.getAdminConfirmInput() == 1))
-            ));
-        }).collect(Collectors.toList());
-
-
-        List<TbBusinessCar> cars = tbBusinessCarService.findTheNoBusinessCar(carNo);
-        //过滤掉不用缴费的车
-        list.addAll(cars);
-        list.addAll(otherBusinessCarList);
-        return new HashSet<>(list);
+        return tbBusinessCarService.searchForPayCar(carNo);
     }
 
     public void confirm(List<String> ids) {

+ 1 - 0
sp-server/src/main/java/com/pj/current/satoken/StpUserUtil.java

@@ -54,6 +54,7 @@ public class StpUserUtil {
     }
 
     public static String getCustomerId(){
+        SpAdmin admin=getAdmin();
         return getAdmin().getCustomerId();
     }
 

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

@@ -201,7 +201,6 @@ public class TbBusinessController {
         if (!currentCustomerId.equals(UserTypeEnum.PLATFORM_ADMIN.getCustomerId())) {
             so.put("customerId", currentCustomerId);
         }
-        so.put("businessType", TbBusiness.BusinessType.CAR_DISINCLE.getCode());
         List<TbBusiness> list = tbBusinessService.getList(so.startPage());
         return AjaxJson.getPageData(so.getDataCount(), list);
     }

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

@@ -495,23 +495,29 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
         Map<String, Object> result = new HashMap<>();
         List<TbBusiness> businessList = this.findOtherBusinessByCarId(businessCarId);
         List<TbBusinessCar> cars = new ArrayList<>();
-
-        //中国车是否需要支付
+        //越南车是否需要支付
         int vietnamCarPay = businessList.stream().anyMatch(tbBusiness -> {
             TbGoods tbGoods = tbGoodsService.getById(tbBusiness.getGoodsId());
             return tbGoods.getVietnamCarPay() == 1;
         }) ? 1 : 0;
-        //越南车是否需要支付
+        //中国车是否需要支付
         int chinaCarPay = businessList.stream().anyMatch(tbBusiness -> {
             TbGoods tbGoods = tbGoodsService.getById(tbBusiness.getGoodsId());
             return tbGoods.getChinaCarPay() == 1;
         }) ? 1 : 0;
-        //无业务的车辆
+        //无业务的车辆,中国车和越南车都需要支付
         if (businessList.isEmpty()) {
             vietnamCarPay = 1;
             chinaCarPay = 1;
             cars.add(tbBusinessCarService.getById(businessCarId));
         }
+        businessList = businessList.stream().filter(tbBusiness -> {
+            Integer payStep = tbBusiness.getPayStep();
+            //确认订单后方可缴费
+            return TbGoods.PayStep.AFTER_CONFIRM.getCode().equals(payStep) && tbBusiness.getAdminConfirmInput() == 1
+                    //或者下单后可缴费
+                    || TbGoods.PayStep.BEFORE_CONFIRM.getCode().equals(payStep);
+        }).collect(Collectors.toList());
         businessList.forEach(tbBusiness -> {
             List<TbBusinessCar> businessCars = tbBusinessCarService.findOtherBusinessCar(tbBusiness.getId());
             cars.addAll(businessCars);
@@ -661,7 +667,7 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
                 BigDecimal price = calculationPartMoney(realInTime, realOutTime);
                 tbBusinessCar.setMoney(price);
             }
-            tbBusinessCar.setPay(1);
+            tbBusinessCar.setPay(1).setPayTime(now);
             tbBusinessCarService.updateById(tbBusinessCar);
         });
         List<TbBusinessItem> items = tbBusinessItemService.findByBusinessId(id);

+ 2 - 0
sp-server/src/main/java/com/pj/project/tb_business_car/TbBusinessCarMapper.java

@@ -42,4 +42,6 @@ public interface TbBusinessCarMapper extends BaseMapper<TbBusinessCar> {
     void removeBusinessId(String id);
 
     List<TbBusinessCar> findOtherBusinessCar(String businessId);
+
+    List<TbBusinessCar> searchForPayCar(@Param("carNo")String carNo);
 }

+ 13 - 0
sp-server/src/main/java/com/pj/project/tb_business_car/TbBusinessCarMapper.xml

@@ -152,6 +152,19 @@
     <select id="findOtherBusinessCar" resultType="com.pj.project.tb_business_car.TbBusinessCar">
         select a.* from  tb_business_car a,relation_business_car b where  a.id=b.business_car_id and b.business_id=#{businessId}
     </select>
+    <select id="searchForPayCar" resultType="com.pj.project.tb_business_car.TbBusinessCar">
+        SELECT
+        distinct
+        a.*
+        FROM
+        tb_business_car a,
+        relation_business_car b,
+        tb_business c
+        WHERE
+        a.id = b.business_car_id
+        AND b.business_id = c.id
+        AND (c.pay_money &lt; c.item_price  or a.pay=0) AND a.car_no LIKE CONCAT('%',#{carNo},'%');
+    </select>
 
 
 </mapper>

+ 3 - 6
sp-server/src/main/java/com/pj/project/tb_business_car/TbBusinessCarService.java

@@ -412,11 +412,8 @@ public class TbBusinessCarService extends ServiceImpl<TbBusinessCarMapper, TbBus
         return tbBusinessCarMapper.findOtherBusinessCar(businessId);
     }
 
-    public List<TbBusinessCar> searchNoPayCar(String carNo) {
-        QueryWrapper<TbBusinessCar> ew = new QueryWrapper<>();
-        ew.like("car_no", carNo)
-                .eq("pay", 0)
-                .isNull("pay_time");
-        return list(ew);
+
+    public List<TbBusinessCar> searchForPayCar(String carNo) {
+        return tbBusinessCarMapper.searchForPayCar(carNo);
     }
 }