Explorar el Código

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

# Conflicts:
#	sp-server/src/main/java/com/pj/project/tb_business_car/TbBusinessCarService.java
#	sp-server/src/main/java/com/pj/project/tb_fee_details/TbFeeDetailsService.java
qzyReal hace 3 años
padre
commit
90d6e586b8

+ 6 - 0
app/apis/api.js

@@ -182,6 +182,12 @@ export default {
 	},
 	addCarDisinfect(data){
 		return ajax.postForm('/api/addCarDisinfect',data)
+	},
+	editCarDisinfect(data){
+		return ajax.postForm('/api/editCarDisinfect',data)
+	},
+	getCarDisinFect(data){
+		return ajax.get('/TbBusiness/getCarDisincleList',data)	
 	}
 
 }

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

@@ -46,7 +46,7 @@
 					<sa-td name="联系号码" prop="driverPhone"></sa-td>
 					<sa-td name="入场时间" prop="realInTime" width=180></sa-td>
 					<sa-td name="离场时间" prop="realOutTime" width=180></sa-td>
-					<el-table-column label="操作" fixed="right" width="200px">
+					<el-table-column label="操作" width="200px">
 						<template slot-scope="s">
 							<el-button v-if="sa.isAuth('tb-business-car-change')&&s.row.realInTime==null" class="c-btn" type="primary"  @click="inFn(s.row)">确认入场
 							</el-button>

+ 19 - 6
sp-admin/sa-view/tb-business-car/tb-business-car-add.html

@@ -49,9 +49,17 @@
 						</div>
 						<div class="c-item">
 							<label class="c-label">联系号码:</label>
-							<el-input v-model="m.driverPhone" placeholder="联系人" readonly>
+							<el-input v-model="m.driverPhone" placeholder="联系人号码" readonly>
 							</el-input>
 						</div>
+						<div class="c-item">
+							<label class="c-label">入场时间:</label>
+							<el-date-picker type="datetime" value-format="yyyy-MM-dd HH:mm:ss" v-model="m.realInTime"></el-date-picker>
+						</div>
+						<div class="c-item" v-if="id>0 && m.isLock==0 && m.pay==1" >
+							<label class="c-label">离场时间:</label>
+							<el-date-picker type="datetime" value-format="yyyy-MM-dd HH:mm:ss" v-model="m.realOutTime"></el-date-picker>
+						</div>
 						<sa-item name="" class="s-ok" br>
 							<el-button type="primary" icon="el-icon-plus" @click="ok()">保存</el-button>
 						</sa-item>
@@ -74,13 +82,17 @@
 					id: sa.p('id', 0), // 获取超链接中的id参数(0=添加,非0=修改) 
 					m: {
 						id: '', //  
-						businessId: sa.p('businessId', -1), //  
+
 						carNo: '', //  
 						carSize: '', //  
 						driverName: '', //  
 						money: '', //  
-						driverPhone: '', //  
-					}, // 实体对象 
+						driverPhone: '', //
+						realInTime: '',
+						realOutTime: '',
+						pay: '',
+						isLock: '',
+					}, // 实体对象
 				},
 				methods: {
 					// 提交数据 
@@ -89,6 +101,7 @@
 						let m = this.m;
 						sa.checkNull(m.carNo, '请输入 [车牌号]');
 						sa.checkNull(m.carSize, '请输入 [车辆规格]');
+						sa.checkNull(m.realInTime, '请输入 [入场时间]');
 						let phone = m.driverPhone;
 						if (phone && !sa.isPhone(phone)) {
 							sa.error('联系号码不正确')
@@ -97,11 +110,11 @@
 
 						// 开始增加或修改
 						if (this.id <= 0) { // 添加
-							sa.ajax('/TbBusinessCar/add', m, function(res) {
+							sa.ajax('/TbBusinessCar/addCarRecord', m, function(res) {
 								sa.alert('增加成功', this.clean);
 							}.bind(this));
 						} else { // 修改
-							sa.ajax('/TbBusinessCar/update', m, function(res) {
+							sa.ajax('/TbBusinessCar/updateCarRecord', m, function(res) {
 								sa.alert('修改成功', this.clean);
 							}.bind(this));
 						}

+ 5 - 1
sp-admin/sa-view/tb-business-car/tb-business-car-list.html

@@ -20,6 +20,8 @@
 			<div class="c-panel">
 				<div class="fast-btn">
 					<el-button size="mini" type="info" @click="sa.f5()">刷新</el-button>
+					<el-button size="mini" type="primary"  @click="add()">
+						新增</el-button>
 				</div>
 				<!-- ------------- 数据列表 ------------- -->
 				<el-table class="data-table" ref="data-table" :data="dataList">
@@ -45,10 +47,12 @@
 						</template>
 					</el-table-column>
 
-					<el-table-column label="操作" fixed="right" width="200px">
+					<el-table-column label="操作" width="200px">
 						<template slot-scope="s">
 							<el-button class="c-btn" type="success" icon="el-icon-view" @click="get(s.row)">查看
 							</el-button>
+							<el-button v-if="/*s.row.pay==0&&*/sa.isAuth('tb-business-edit')" class="c-btn" type="primary" icon="el-icon-edit" @click="update(s.row)">修改
+							</el-button>
 						</template>
 					</el-table-column>
 				</el-table>

+ 4 - 3
sp-server/src/main/java/com/pj/api/jh/service/JhService.java

@@ -84,9 +84,10 @@ public class JhService {
                 .execute().body();
         JSONObject jsonResult = JSONUtil.parseObj(result);
         if(StrUtil.equals("0000", jsonResult.get("resultCode").toString())){
-            JSONObject payMessage = JSONUtil.parseObj(jsonResult.get("payMessage"));
-            Object prePayId = payMessage.get("prepay_id");
-            String preId = prePayId == null ? "" : prePayId.toString();
+            JSONObject payMessage = JSONUtil.parseObj(jsonResult.get("payMessage").toString());
+            String packStr = payMessage.get("package").toString();
+            String prePayId = StrUtil.sub(packStr, packStr.indexOf("=")+1, packStr.length());
+            String preId = prePayId == null ? "" : prePayId;
             return getPayParams(openid, preId);
         }
         throw new Exception("支付信息有误");

+ 15 - 0
sp-server/src/main/java/com/pj/project/tb_business_car/TbBusinessCarController.java

@@ -84,6 +84,21 @@ public class TbBusinessCarController {
 		return AjaxJson.getPageData(so.getDataCount(), list);
 	}
 
+    /** 手动添加放行记录*/
+    @RequestMapping("addCarRecord")
+    @SaCheckPermission(TbBusiness.PERMISSION_CODE)
+    public AjaxJson addManualCar(TbBusinessCar t) throws Exception{
+        tbBusinessCarService.addCarRecord(t);
+        return AjaxJson.getSuccess();
+    }
+
+    @RequestMapping("updateCarRecord")
+    @SaCheckPermission(TbBusiness.PERMISSION_CODE)
+    public AjaxJson updateCarRecord(TbBusinessCar t) throws Exception{
+        tbBusinessCarService.updateCarRecord(t);
+        return AjaxJson.getSuccess();
+    }
+
 	
 	
 	

+ 55 - 7
sp-server/src/main/java/com/pj/project/tb_business_car/TbBusinessCarService.java

@@ -12,6 +12,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_fee_details.TbFeeDetails;
+import com.pj.project.tb_fee_details.TbFeeDetailsService;
 import com.pj.utils.so.SoMap;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Lazy;
@@ -42,6 +44,9 @@ public class TbBusinessCarService extends ServiceImpl<TbBusinessCarMapper, TbBus
     private TbBusinessService tbBusinessService;
     @Resource
     PartConfig partConfig;
+    @Resource
+    @Lazy
+    TbFeeDetailsService tbFeeDetailsService;
 
 
     /**
@@ -86,13 +91,6 @@ public class TbBusinessCarService extends ServiceImpl<TbBusinessCarMapper, TbBus
 
 
     public List<TbBusinessCar> searchPartCar(String carNo) {
-//        QueryWrapper<TbBusinessCar> ew = new QueryWrapper<>();
-//        ew.like("car_no", carNo);
-//        ew.orderByDesc("id");
-//        List<TbBusinessCar> list = this.list(ew);
-//        list = list.stream().filter(tbBusinessCar -> tbBusinessCar.getPay()==0).collect(
-//                Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(TbBusinessCar::getCarNo))), ArrayList::new));
-//        return list;
         return   tbBusinessCarMapper.searchPartCar(carNo.toUpperCase());
     }
 
@@ -205,4 +203,54 @@ public class TbBusinessCarService extends ServiceImpl<TbBusinessCarMapper, TbBus
         List<TbBusinessCar> list = this.list(ew);
         return list.isEmpty() ? null : list.get(0);
     }
+
+    public void addCarRecord(TbBusinessCar t) throws Exception {
+        String carNo = t.getCarNo().toUpperCase();
+        TbBusinessCar db = this.check(carNo);
+        if (db != null) {
+            throw new Exception("该车有未完成业务");
+        }
+        t.setPay(0);
+        this.save(t);
+    }
+
+    public void updateCarRecord(TbBusinessCar t) throws Exception {
+        if(StrUtil.isEmpty(t.getBusinessId())) {
+            t.setBusinessId(null);
+        }
+        if(StrUtil.isEmpty(t.getCustomerId())) {
+            t.setCustomerId(null);
+        }
+        String carNo = t.getCarNo().toUpperCase();
+        TbBusinessCar old = this.getById(t.getId());
+        String oldCarNo = old.getCarNo();
+        TbBusinessCar db = this.check(carNo);
+        String businessId = t.getBusinessId();
+        if (db != null && !StrUtil.equals(t.getId(), db.getId())) {
+            throw new Exception("该车有未完成业务");
+        }
+        TbBusinessCar businessCar = this.findByBusinessIdAndCarNo(businessId, carNo);
+        if (businessCar != null && !StrUtil.equals(t.getId(), businessCar.getId())) {
+            throw new Exception("车辆已存在");
+        }
+
+        this.updateById(t);
+        TbBusiness tbBusiness = tbBusinessService.getById(t.getBusinessId());
+        if(tbBusiness != null) {
+            if (!CAR_LIST.contains(carNo.substring(0,1))) {
+                tbBusiness.setCardNo(carNo);
+            } else {
+                List<TbBusinessCar> cars = this.findByBusinessId(t.getBusinessId());
+                String chiaCarNo = cars.stream().filter(obj -> CAR_LIST.contains(obj.getCarNo().substring(0,1))).map(TbBusinessCar::getCarNo).collect(Collectors.joining("、"));
+                tbBusiness.setChinaCarNo(chiaCarNo);
+            }
+            tbBusinessService.updateById(tbBusiness);
+
+            List<TbFeeDetails> feeDetailsLIst = tbFeeDetailsService.getByBusinessIdAndCarNo(businessId, oldCarNo);
+            feeDetailsLIst.forEach(fee -> fee.setCarNo(carNo));
+            tbFeeDetailsService.updateBatchById(feeDetailsLIst);
+        }
+
+    }
+
 }

+ 6 - 1
sp-server/src/main/java/com/pj/project/tb_fee_details/TbFeeDetailsService.java

@@ -106,7 +106,12 @@ public class TbFeeDetailsService extends ServiceImpl<TbFeeDetailsMapper, TbFeeDe
         qw.eq("fee_type", feeType);
         return getOne(qw);
     }
-
+    public List<TbFeeDetails> getByBusinessIdAndCarNo(String businessId, String carNo){
+        QueryWrapper<TbFeeDetails> qw = new QueryWrapper<>();
+        qw.eq("business_id", businessId);
+        qw.eq("car_no", carNo);
+        return list(qw);
+    }
     public TbFeeDetails getByBusinessIdAndCarNoAndItemType(String businessId, String carNo, String itemTypeId) {
         QueryWrapper<TbFeeDetails> qw = new QueryWrapper<>();
         qw.eq("business_id", businessId);