소스 검색

删除出入场记录以及其权限管理

qzyReal 3 년 전
부모
커밋
ad0bd4b18d

+ 4 - 4
app/apis/api.js

@@ -110,12 +110,12 @@ export default {
 	getUnitList() {
 		return ajax.get('/TbUnit/getList')
 	},
-	// getPrePay(data) {
-	// 	return ajax.get('/wx/pre-pay', data)
-	// },
 	getPrePay(data) {
-		return ajax.get('/jh/init-pay', data)
+		return ajax.get('/wx/pre-pay', data)
 	},
+	// getPrePay(data) {
+	// 	return ajax.get('/jh/init-pay', data)
+	// },
 	getRedirectUrl(data) {
 		return ajax.get('/wx/getRedirectUrl', data)
 	},

+ 20 - 16
app/pages/wx/pay.vue

@@ -30,7 +30,7 @@
 							</view>
 							<view class="c">{{item.carNo}}</view>
 							<view class="r" v-if="item.price>0">{{item.price}}元</view>
-								<view class="r" v-else>无需缴费</view>
+							<view class="r" v-else>无需缴费</view>
 						</label>
 					</view>
 				</u-checkbox-group>
@@ -91,7 +91,7 @@
 				state: '',
 				list: [],
 				cars: [],
-				type:0,
+				type: 0,
 				businessAble: true,
 				item: {
 					itemsPrice: 0,
@@ -114,6 +114,9 @@
 			this.state = options.state;
 			this.getOpenidByCode();
 		},
+		onShow() {
+			this.$common.hidingLoading();
+		},
 		created() {},
 		mounted() {
 			this.getChannelCar();
@@ -178,7 +181,7 @@
 			confirmPayFn() {
 				let carIds = this.carsSelect
 				let cars = this.cars.filter(obj => carIds.indexOf(obj.id) !== -1);
-				let carNos=this.cars.map(obj=>obj.carNo).join('、')
+				let carNos = this.cars.map(obj => obj.carNo).join('、')
 				let p = {
 					b: this.businessSelect.length > 0 ? this.item.businessId : '',
 					c: JSON.stringify(cars.map(obj => {
@@ -191,21 +194,22 @@
 					tradeType: "JSAPI",
 					openid: this.openid
 				}
-				let type=this.type;
-				let con='A1停车费';
-				if(type==2){
-					con='A1整车业务';
-				}else if(type==1){
-					con='A1车辆消杀'
+				let type = this.type;
+				let con = 'A1停车费';
+				if (type == 2) {
+					con = 'A1整车业务';
+				} else if (type == 1) {
+					con = 'A1车辆消杀'
 				}
-				p.desc=con+'-'+carNos;
-				this.$api.getPrePay(this.$common.removeNull(p)).then(resp => {
+				p.desc = con + '-' + carNos;
+				this.$common.showLoading('正在请求...');
+				let that = this;
+				that.$api.getPrePay(that.$common.removeNull(p)).then(resp => {
 					let data = resp.data;
-					if(data.code&&data.code==500){
-						this.$common.toast('系统异常');
+					if (resp.code !== 200) {
+						that.$common.toast(resp.msg);
 						return;
 					}
-					let that = this;
 					jweixin.chooseWXPay({
 						timestamp: data
 							.timeStamp, // 支付签名时间戳,注意微信jssdk中的所有使用timestamp字段均为小写。但最新版的支付后台生成签名使用的timeStamp字段名需大写其中的S字符
@@ -249,9 +253,9 @@
 				}).then(resp => {
 					let data = resp.data;
 					this.cars = data.carList;
-					this.type=data.type;
+					this.type = data.type;
 					let list = data.itemList;
-					this.carsSelect = this.cars.filter(obj => obj.id == carId &&obj.price>0).map(obj => obj.id)
+					this.carsSelect = this.cars.filter(obj => obj.id == carId && obj.price > 0).map(obj => obj.id)
 					Object.assign(this.item, {
 						itemsPrice: data.itemsPrice,
 						businessId: data.businessId,

+ 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';

+ 27 - 2
sp-admin/sa-frame/menu-list.js

@@ -331,8 +331,33 @@ var menuList = [{
 		childList: [{
 			id: 'tb-business-car-list',
 			name: '放行列表',
-
-			url: 'sa-view/tb-business-car/tb-business-car-list.html'
+			url: 'sa-view/tb-business-car/tb-business-car-list.html',
+			childList:[
+				{
+				
+					id: 'tb-business-car-add',
+					name: '添加记录',
+					isShow: false
+				},
+				{
+				
+					id: 'tb-business-car-export',
+					name: '导出记录',
+					isShow: false
+				},
+				{
+				
+					id: 'tb-business-car-edit',
+					name: '修改记录',
+					isShow: false
+				},
+				{
+				
+					id: 'tb-business-car-del',
+					name: '删除记录',
+					isShow: false
+				},
+			]
 		}, ]
 	},
 	{

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

@@ -18,7 +18,6 @@
 	<body>
 		<div class="vue-box" style="display: none;" :style="'display: block;'">
 			<div class="c-panel">
-				<div class="c-title">检索参数</div>
 				<el-form ref="form" :model='p' @submit.native.prevent>
 					<sa-item type="text" name="车牌号" v-model="p.carNo"></sa-item>
 					<div class="c-item">
@@ -40,9 +39,10 @@
 					<div class="c-item" style="width: 120px;">
 						<label class="c-label">车辆颜色:</label>
 						<el-select v-model="p.color" placeholder="请选择">
-							<el-option label="-全部-" value="1"> </el-option>
-							<el-option label="已离场" value="2"> </el-option>
-							<el-option label="未离场" value="3"> </el-option>
+							<el-option label="-全部-" value=""> </el-option>
+							<el-option v-for="(item,index) in colorList" :key="index" :label="item.carNoColor"
+								:value="item.carNoColor"> </el-option>
+
 						</el-select>
 					</div>
 				</el-form>
@@ -60,10 +60,18 @@
 						</el-date-picker>
 					</div>
 					<el-button type="primary" icon="el-icon-search" @click="p.pageNo = 1; f5()">查询</el-button>
-					<el-button size="mini" type="primary" @click="exportFn">导出</el-button>
+					<el-button size="mini" type="primary" @click="exportFn" v-if="sa.isAuth('tb-business-car-export')">导出</el-button>
 					<el-button size="mini" type="info" @click="sa.f5()">重置</el-button>
-					<el-button size="mini" type="primary" @click="add()">
+					<el-button size="mini" type="primary" @click="add()" v-if="sa.isAuth('tb-business-car-add')">
 						新增</el-button>
+						<br/>
+					<sa-item name="综合排序">
+						<el-radio-group v-model="p.sortType" class="s-radio-text">
+							<el-radio :label="10">默认</el-radio>
+							<el-radio :label="6">入场时间</el-radio>
+							<el-radio :label="7">离场时间</el-radio>
+						</el-radio-group>
+					</sa-item>
 				</el-form>
 				<!-- ------------- 数据列表 ------------- -->
 				<el-table class="data-table" ref="data-table" :data="dataList">
@@ -96,9 +104,10 @@
 						<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="sa.isAuth('tb-business-edit')" class="c-btn" type="primary"
+							<el-button v-if="sa.isAuth('tb-business-car-edit')" class="c-btn" type="primary"
 								icon="el-icon-edit" @click="update(s.row)">修改
 							</el-button>
+							<el-button v-if="sa.isAuth('tb-business-car-del')&&s.row.money==0" class="c-btn" type="danger" icon="el-icon-delete" @click="del(s.row)">删除</el-button>
 						</template>
 					</el-table-column>
 				</el-table>
@@ -120,6 +129,7 @@
 					p: { // 查询参数
 						id: '', //  
 						businessId: sa.p('id', ''), //  
+						color: '',
 						carNo: '', //  
 						leave: '1',
 						pay: '',
@@ -131,8 +141,18 @@
 					},
 					dataCount: 0,
 					dataList: [], // 数据集合 
+					colorList: []
 				},
 				methods: {
+					getCarColor() {
+						sa.ajax('/TbCarNoColor/getList', {
+							pageNo: 1,
+							pageSize: 20,
+							status: 1
+						}, function(resp) {
+							this.colorList = resp.data;
+						}.bind(this))
+					},
 					exportFn() {
 						this.$confirm('确定导出符合条件的数据?', '提示', {
 							confirmButtonText: '确定',
@@ -187,36 +207,18 @@
 					// 删除
 					del: function(data) {
 						sa.confirm('是否删除,此操作不可撤销', function() {
-							sa.ajax('/TbBusinessCar/delete?id=' + data.id, function(res) {
+							sa.ajax('/TbBusinessCar/deleteRecord?id=' + data.id, function(res) {
 								sa.arrayDelete(this.dataList, data);
 								sa.ok('删除成功');
 								sa.f5TableHeight(); // 刷新表格高度 
 							}.bind(this))
 						}.bind(this));
 					},
-					// 改 - 状态(0=否,1=是)
-					updateStatus: function(data) {
-						// 声明变量记录是否成功 
-						var isOk = false;
-						var oldValue = data.isLock;
-						var ajax = sa.ajax('/TbBusinessCar/updateStatus', {
-							id: data.id,
-							value: data.isLock
-						}, function(res) {
-							isOk = true;
-							sa.msg('修改成功');
-						}.bind(this));
-						// 如果未能修改成功, 则回滚 
-						$.when(ajax).done(function() {
-							if (isOk == false) {
-								data.isLock = oldValue;
-							}
-						})
-					},
 				},
 				created: function() {
 					this.f5();
 					sa.onInputEnter();
+					this.getCarColor();
 				}
 			})
 		</script>

+ 1 - 1
sp-server/app.pid

@@ -1 +1 @@
-6392
+25324

+ 2 - 0
sp-server/src/main/java/com/pj/api/h5/ApiController.java

@@ -2,6 +2,7 @@ package com.pj.api.h5;
 
 
 import cn.hutool.core.util.StrUtil;
+import cn.hutool.log.StaticLog;
 import com.pj.api.bo.InOutRecordBO;
 import com.pj.api.service.ApiService;
 import com.pj.constants.RoleEnum;
@@ -115,6 +116,7 @@ public class ApiController {
 
     @GetMapping(value = "getPartCarByChannel")
     public AjaxJson getPartCarByChannel(String channel) {
+        StaticLog.error("查询通道车辆:{}",channel);
         return AjaxJson.getSuccessData(apiService.getPartCarByChannel(channel));
     }
 

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

@@ -46,7 +46,7 @@ public class TbBusiness extends Model<TbBusiness> implements Serializable {
     public static final String PERMISSION_CONFIRM = "tb-business-confirm";
     public static final String PERMISSION_PAY = "tb-business-pay";
     public static final String PERMISSION_INPUT = "tb-business-add";
-    public static final String PERMISSION_EXPORT = "tb-business-car-export";
+
 
 
     // ---------- 表中字段 ----------

+ 4 - 0
sp-server/src/main/java/com/pj/project/tb_business_car/TbBusinessCar.java

@@ -44,6 +44,10 @@ public class TbBusinessCar extends Model<TbBusinessCar> implements Serializable
      */
     public static final String PERMISSION_CODE = "tb-business-car";
     public static final String PERMISSION_LIST = "tb-business-car-list";
+    public static final String PERMISSION_EXPORT = "tb-business-car-export";
+    public static final String PERMISSION_ADD = "tb-business-car-add";
+    public static final String PERMISSION_EDIT = "tb-business-car-edit";
+    public static final String PERMISSION_DEL= "tb-business-car-del";
 
 
     // ---------- 表中字段 ----------

+ 10 - 3
sp-server/src/main/java/com/pj/project/tb_business_car/TbBusinessCarController.java

@@ -43,6 +43,13 @@ public class TbBusinessCarController {
 		return tbBusinessCarService.deleteCar(id);
 	}
 
+	/** 查 - 根据id */
+	@RequestMapping("deleteRecord")
+	@SaCheckPermission(TbBusinessCar.PERMISSION_DEL)
+	public AjaxJson deleteRecord(String id) {
+		return tbBusinessCarService.deleteRecord(id);
+	}
+
 	@RequestMapping(value = "findInAndNoBusinessCar")
 	public AjaxJson findInAndNoBusinessCar(){
 		List<TbBusinessCar>list=tbBusinessCarService.findInAndNoBusinessCar();
@@ -86,20 +93,20 @@ public class TbBusinessCarController {
 
     /** 手动添加放行记录*/
     @RequestMapping("addCarRecord")
-    @SaCheckPermission(TbBusiness.PERMISSION_CODE)
+    @SaCheckPermission(TbBusinessCar.PERMISSION_ADD)
     public AjaxJson addManualCar(TbBusinessCar t) throws Exception{
         tbBusinessCarService.addCarRecord(t);
         return AjaxJson.getSuccess();
     }
 
     @RequestMapping("updateCarRecord")
-    @SaCheckPermission(TbBusiness.PERMISSION_CODE)
+    @SaCheckPermission(TbBusinessCar.PERMISSION_EDIT)
     public AjaxJson updateCarRecord(TbBusinessCar t) throws Exception{
         tbBusinessCarService.updateCarRecord(t);
         return AjaxJson.getSuccess();
     }
     @RequestMapping("export")
-    @SaCheckPermission(TbBusiness.PERMISSION_CODE)
+    @SaCheckPermission(TbBusinessCar.PERMISSION_EXPORT)
     public AjaxJson export() {
     	SoMap soMap=SoMap.getRequestSoMap();
         return AjaxJson.getSuccessData( tbBusinessCarService.export(soMap));

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

@@ -56,6 +56,12 @@
             <if test="inEnd!=null and inEnd !=''">
                 and  date_format(real_in_time,'%Y-%m-%d %H:%m:%s') &lt;=#{inEnd}
             </if>
+            <if test="color !=null and color !='' and color !='其他'">
+                and color=#{color}
+            </if>
+            <if test="color =='其他'">
+                and (color='' or color ='未知' or color is null)
+            </if>
         </where>
         order by
         <choose>

+ 10 - 0
sp-server/src/main/java/com/pj/project/tb_business_car/TbBusinessCarService.java

@@ -71,6 +71,7 @@ public class TbBusinessCarService extends ServiceImpl<TbBusinessCarMapper, TbBus
     private UploadConfig uploadConfig;
 
 
+
     /**
      * 查集合 - 根据条件(参数为空时代表忽略指定条件)
      */
@@ -335,4 +336,13 @@ public class TbBusinessCarService extends ServiceImpl<TbBusinessCarMapper, TbBus
         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);
+        return AjaxJson.getSuccess();
+    }
 }

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

@@ -226,4 +226,10 @@ public class TbFeeDetailsService extends ServiceImpl<TbFeeDetailsMapper, TbFeeDe
         return prefix + "/feeDetails/" + today + "/收费明细表_" + time + ".xlsx";
     }
 
+    public TbFeeDetails findByBusinessCarId(String businessCarId,int feeType) {
+        QueryWrapper<TbFeeDetails>ew=new QueryWrapper<>();
+        ew.eq("business_car_id",businessCarId);
+        ew.eq("fee_type",feeType);
+        return getOne(ew);
+    }
 }

+ 1 - 1
sp-server/src/main/resources/application-dev.yml

@@ -6,7 +6,7 @@ spring:
     # 数据源配置
     datasource:
         type: com.alibaba.druid.pool.DruidDataSource
-        url: jdbc:mysql://127.0.0.1:3306/pco_system?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=GMT%2B8
+        url: jdbc:mysql://127.0.0.1:3306/test?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=GMT%2B8
         username: root
         password: 123456
         # 是否打开sql监控台  (生产环境请务必关闭此选项)