瀏覽代碼

业务规则组设置

qzyReal 3 年之前
父節點
當前提交
e3e41c11d8

+ 22 - 17
app/pages/wx/pay.vue

@@ -65,9 +65,12 @@
 					<text class="t1">金额:</text>
 					<text class="t2">¥{{total}}元</text>
 				</view>
-				<view class="r">
+				<view class="r" v-if="showPay">
 					<view class="btn" @click="confirmPayFn()">立即支付</view>
 				</view>
+				<view class="r" v-else>
+					<view class="btn" @click="showMsg">存在待录入业务</view>
+				</view>
 			</view>
 		</view>
 	</view>
@@ -93,6 +96,7 @@
 				cars: [],
 				type: 0,
 				businessAble: true,
+				showPay: false,
 				item: {
 					itemsPrice: 0,
 					businessId: '',
@@ -141,6 +145,9 @@
 			}
 		},
 		methods: {
+			showMsg(){
+				this.$common.toast('请先完善相关业务录入');
+			},
 			businessChange(value) {
 				this.itemSelect = value.length == 0 ? this.itemSelect = [] : this.item.list.map(obj => obj.id)
 			},
@@ -152,7 +159,7 @@
 						let data = resp.data;
 						if (data.cars && data.cars.length > 0) {
 							this.cars = data.cars;
-							let carId=[data.cars[0].id];
+							let carId = [data.cars[0].id];
 							this.carsSelect = carId;
 							this.groupChange(carId)
 						}
@@ -184,7 +191,7 @@
 				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 type = this.type;
+				let type = this.type;
 				let p = {
 					b: this.businessSelect.length > 0 ? this.item.businessId : '',
 					c: JSON.stringify(cars.map(obj => {
@@ -196,25 +203,24 @@
 					money: this.total,
 					tradeType: "JSAPI",
 					openid: this.openid,
-					type:type
+					type: type
 				}
 				let con = 'A1-停车费';
 				let tradeType = 'PORT_PARKING_FEE';
 				if (type == 2) {
 					con = 'A1-整车业务';
-					tradeType='PORT_OPERATION_FEE';
+					tradeType = 'PORT_OPERATION_FEE';
 				} else if (type == 1) {
-					let itemSelect=this.itemSelect;
-					console.log(itemSelect)
-					let itemStr=this.item.list
-					.filter(obj=>itemSelect.indexOf(obj.id)!==-1).map(obj=>obj.name)
-					.join('、');
+					let itemSelect = this.itemSelect;
+					let itemStr = this.item.list
+						.filter(obj => itemSelect.indexOf(obj.id) !== -1).map(obj => obj.name)
+						.join('、');
 					console.log(itemStr)
-					con = 'A1-'+itemStr;
-					tradeType='PORT_OPERATION_FEE';
+					con = 'A1-' + itemStr;
+					tradeType = 'PORT_OPERATION_FEE';
 				}
 				p.desc = con + '-' + carNos;
-				p.businessType=tradeType;
+				p.businessType = tradeType;
 				this.$common.showLoading('正在请求...');
 				let that = this;
 				that.$api.getPrePay(that.$common.removeNull(p)).then(resp => {
@@ -282,6 +288,7 @@
 				}).then(resp => {
 					let data = resp.data;
 					this.cars = data.carList;
+					this.showPay = data.showPay;
 					this.type = data.type;
 					let list = data.itemList;
 					this.carsSelect = this.cars.filter(obj => obj.id == carId && obj.price > 0).map(obj => obj.id)
@@ -293,10 +300,8 @@
 					this.businessAble = list.filter(obj => obj.pay == 1).length == list.length;
 					let selectCar = this.list.filter(obj => obj.id == carId).pop();
 					let carNo = selectCar.carNo;
-					if (!this.$common.isCarNo(carNo)) {
-						this.itemSelect = data.itemList.filter(obj => obj.pay == 0).map(obj => obj.id)
-						this.businessSelect = this.itemSelect.length == 0 ? [] : [1]
-					}
+					this.itemSelect = data.itemList.filter(obj => obj.pay == 0).map(obj => obj.id)
+					this.businessSelect = this.itemSelect.length == 0 ? [] : [1]
 					this.list = [];
 				})
 			},

+ 24 - 7
sp-admin/sa-frame/menu-list.js

@@ -340,7 +340,7 @@ var menuList = [{
 					},
 				]
 			},
-			
+
 
 		]
 	},
@@ -376,7 +376,7 @@ var menuList = [{
 
 				]
 			},
-			
+
 			{
 				id: 'tb-item-re-list',
 				name: '明细管理',
@@ -399,16 +399,33 @@ var menuList = [{
 				]
 			},
 			{
-				id: 'tb-business-sort-list',
-				name: '项目顺序',
-				url: 'sa-view/tb-business-sort/tb-business-sort-list.html',
-				childList: [{
-						id: 'tb-business-sort-edit',
+				id: 'tb-sort-group',
+				name: '其他业务设置',
+				url: 'sa-view/tb-sort-group/tb-sort-group-list.html',
+				childList: [
+					{
+						id: 'tb-sort-group-add',
+						name: '添加',
+						isShow: false
+					},
+					{
+						id: 'tb-sort-group-del',
+						name: '删除',
+						isShow: false
+					},
+					{
+						id: 'tb-sort-group-edit',
 						name: '修改',
 						isShow: false
 					},
 				]
 			},
+			// {
+			// 	id: 'tb-business-sort-list',
+			// 	name: '项目顺序',
+			// 	url: 'sa-view/tb-business-sort/tb-business-sort-list.html',
+			// 	childList: []
+			// },
 		],
 
 	},

+ 8 - 2
sp-admin/sa-view/tb-business/tb-car-disincle-list.html

@@ -54,7 +54,7 @@
 					<sa-td name="作业时间" prop="operateTime" width="160"></sa-td>
 					<sa-td name="确认" prop="adminConfirmInput" type="enum" :jv="{1: '已确认', 0: '未确认'}"></sa-td>
 					<sa-td name="已支付(元)" prop="payMoney" width="140"></sa-td>
-					<sa-td name="业务费(元)" prop="totalMoney" width="120"></sa-td>
+					<sa-td name="业务费(元)" prop="totalMoney" width="120"></sa-td>
 					<sa-td name="入场时间" prop="realInTime" width="140"></sa-td>
 					<sa-td name="离场时间" prop="realOutTime" width="140"></sa-td>
 					<sa-td width="160" name="创建时间" prop="createTime"></sa-td>
@@ -66,7 +66,7 @@
 								<el-button class="c-btn" type="primary" v-if="sa.isAuth('tb-business-confirm')
 									&&currentCustomerId=='1'&&s.row.adminConfirmInput==1" @click="checkConfirmFn(s.row)">查看账单</el-button>
 							<el-button class="c-btn" type="success" @click="get(s.row)">查看</el-button>
-							<el-button class="c-btn" type="primary" v-if="s.row.adminConfirmInput==0&&sa.isAuth('tb-flex-business-edit')"
+							<el-button class="c-btn" type="primary" v-if="currentCustomerId=='1'||(s.row.adminConfirmInput==0&&sa.isAuth('tb-flex-business-edit'))"
 								@click="update(s.row)">
 								修改</el-button>
 							<el-button class="c-btn" type="danger"
@@ -141,6 +141,11 @@
 					}
 				},
 				methods: {
+					getCurrendCustomer() {
+						sa.ajax('/TbCostomer/getCurrentCustomerId', function(resp) {
+							this.currentCustomerId = resp.data;
+						}.bind(this));
+					},
 					// 查看
 					get: function(data) {
 						sa.showIframe('数据详情', 'tb-car-disincle-info.html?id=' + data.id, '1050px', '90%');
@@ -212,6 +217,7 @@
 					sa.onInputEnter();
 				},
 				mounted() {
+					this.getCurrendCustomer();
 					this.f5();
 				},
 			})

+ 165 - 0
sp-admin/sa-view/tb-sort-group/tb-sort-group-add.html

@@ -0,0 +1,165 @@
+<!DOCTYPE html>
+<html>
+	<head>
+		<title>业务限制组-添加/修改</title>
+		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+		<meta name="viewport"
+			content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
+		<!-- 所有的 css js 资源 -->
+		<link rel="stylesheet" href="../../static/kj/element-ui/theme-chalk/index.css">
+		<link rel="stylesheet" href="../../static/sa.css">
+		<script src="../../static/kj/vue.min.js"></script>
+		<script src="../../static/kj/element-ui/index.js"></script>
+		<script src="../../static/kj/httpVueLoader.js"></script>
+		<script src="../../static/kj/jquery.min.js"></script>
+		<script src="../../static/kj/layer/layer.js"></script>
+		<script src="../../static/sa.js"></script>
+		<style type="text/css">
+			.c-panel .el-form .c-label {
+				width: 8em !important;
+			}
+
+			.c-panel .el-form .el-input,
+			.c-panel .el-form .el-textarea__inner {
+				width: 250px;
+			}
+
+			.item-num .el-input__inner {
+				width: 130px;
+				display: inline;
+			}
+		</style>
+	</head>
+	<body>
+		<div class="vue-box" :class="{sbot: id}" style="display: none;" :style="'display: block;'">
+			<!-- ------- 内容部分 ------- -->
+			<div class="s-body">
+				<div class="c-panel">
+					<div class="c-title" v-if="id == 0">数据添加</div>
+					<el-form>
+						<sa-item type="text" name="组名称" v-model="m.name" br></sa-item>
+						<sa-item type="enum" name="是否启用" v-model="m.status" :jv="{0: '否', 1: '是'}" jtype="3" br>
+						</sa-item>
+						<sa-item type="enum" name="完整性支付" v-model="m.completePay" :jv="{0: '否', 1: '是'}" jtype="3" br>
+						</sa-item>
+						<sa-item name="" class="s-ok" br>
+							<el-button type="primary" icon="el-icon-plus" @click="ok()">保存</el-button>
+						</sa-item>
+						<el-divider></el-divider>
+						<h4>规则设置</h4>
+						<div style="width: 850px;margin-top: 20px;">
+							<div v-for="item in list" :key="item.index">
+								<div class="c-item" v-if="item.index>0">
+									<label class="c-label">项目间隔(分):</label>
+									<el-input-number class="item-num" v-model="item.intervalTime" :step="10" :min="0"
+										:max="9999">
+									</el-input-number>
+								</div>
+								<div class="c-item">
+									<label class="c-label">第{{item.index+1}}个:</label>
+									<el-select v-model="item.typeId" placeholder="请选择">
+										<el-option :label="type.name" :value="type.id"
+											v-for="(type,index) in item.businessTypeList">
+										</el-option>
+									</el-select>
+									<label class="c-label" style="width: 160px;">单项间隔(小时):</label>
+									<el-input-number class="item-num" v-model="item.singleIntervalTime" :step="1"
+										:min="1" :max="48">
+									</el-input-number>
+									<label style="position: relative;left: 50px;">
+										<el-button style="cursor: pointer;" @click="handlerAdd"
+											v-if="item.index==0&&list.length<businessTypeList.length">添加项
+										</el-button>
+										<el-button @click="handlerDel(item.index)" v-if="item.index>0">删除项</el-button>
+									</label>
+								</div>
+							</div>
+						</div>
+					</el-form>
+				</div>
+			</div>
+			<!-- ------- 底部按钮 ------- -->
+			<div class="s-foot">
+				<el-button type="primary" @click="ok()">确定</el-button>
+				<el-button @click="sa.closeCurrIframe()">取消</el-button>
+			</div>
+		</div>
+		<script>
+			var app = new Vue({
+				components: {
+					"sa-item": httpVueLoader('../../sa-frame/com/sa-item.vue')
+				},
+				el: '.vue-box',
+				data: {
+					id: sa.p('id', 0), // 获取超链接中的id参数(0=添加,非0=修改) 
+					m: {
+						name: '', // 名称
+						status: 1,
+						completePay:1,
+					}, // 实体对象 
+					list: [],
+					businessTypeList: [],
+				},
+				methods: {
+					handlerAdd() {
+						let list = this.list;
+						this.list.push({
+							index: list.length,
+							typeId: '',
+							intervalTime: 30,
+							singleIntervalTime: 12,
+							businessTypeList: this.businessTypeList
+						})
+					},
+					handlerDel(index) {
+						let list = this.list;
+						list.splice(index, 1);
+						for (let i in list) {
+							let obj = list[i];
+							if (obj.index > index) {
+								obj.index = obj.index - 1;
+							}
+						}
+						this.list = list;
+					},
+					getBusinessType() {
+						sa.ajax('/TbItemType/getList', {
+							business: 0,
+							sortType: 0
+						}, function(resp) {
+							let list = resp.data;
+							let obj = {
+								index: 0,
+								typeId: list.length > 0 ? list[0].id : '',
+								intervalTime: 30,
+								singleIntervalTime: 12,
+								businessTypeList: list
+							}
+							this.list.push(obj);
+							this.businessTypeList = list;
+						}.bind(this))
+					},
+					// 提交数据 
+					ok: function() {
+						// 表单校验 
+						let m = this.m;
+						sa.checkNull(m.name, '请输入 [名称]');
+						let list = this.list.filter(obj => obj.typeId !== null && obj.typeId !== '');
+						m.items = JSON.stringify(list);
+						sa.ajax('/TbSortGroup/add', m, function(res) {
+							sa.alert('增加成功', this.clean);
+						}.bind(this));
+					},
+					// 添加/修改 完成后的动作
+					clean: function() {
+						parent.app.f5(); // 刷新父页面列表
+						sa.closeCurrIframe();
+					}
+				},
+				mounted: function() {
+					this.getBusinessType();
+				}
+			})
+		</script>
+	</body>
+</html>

+ 195 - 0
sp-admin/sa-view/tb-sort-group/tb-sort-group-edit.html

@@ -0,0 +1,195 @@
+<!DOCTYPE html>
+<html>
+	<head>
+		<title>业务限制组-添加/修改</title>
+		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+		<meta name="viewport"
+			content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
+		<!-- 所有的 css js 资源 -->
+		<link rel="stylesheet" href="../../static/kj/element-ui/theme-chalk/index.css">
+		<link rel="stylesheet" href="../../static/sa.css">
+		<script src="../../static/kj/vue.min.js"></script>
+		<script src="../../static/kj/element-ui/index.js"></script>
+		<script src="../../static/kj/httpVueLoader.js"></script>
+		<script src="../../static/kj/jquery.min.js"></script>
+		<script src="../../static/kj/layer/layer.js"></script>
+		<script src="../../static/sa.js"></script>
+		<style type="text/css">
+			.c-panel .el-form .c-label {
+				width: 8em !important;
+			}
+
+			.c-panel .el-form .el-input,
+			.c-panel .el-form .el-textarea__inner {
+				width: 250px;
+			}
+
+			.item-num .el-input__inner {
+				width: 130px;
+				display: inline;
+			}
+		</style>
+	</head>
+	<body>
+		<div class="vue-box" :class="{sbot: id}" style="display: none;" :style="'display: block;'">
+			<!-- ------- 内容部分 ------- -->
+			<div class="s-body">
+				<div class="c-panel">
+					<div class="c-title" v-if="id == 0">数据添加</div>
+					<div class="c-title" v-else>数据修改</div>
+					<el-form v-if="m">
+						<sa-item type="text" name="组名称" v-model="m.name" br></sa-item>
+						<sa-item type="enum" name="是否启用" v-model="m.status" :jv="{0: '否', 1: '是'}" jtype="3" br>
+						</sa-item>
+						<sa-item type="enum" name="完整性支付" v-model="m.completePay" :jv="{0: '否', 1: '是'}" jtype="3" br>
+						</sa-item>
+						<sa-item name="" class="s-ok" br>
+							<el-button type="primary" icon="el-icon-plus" @click="ok()">保存</el-button>
+						</sa-item>
+						<el-divider></el-divider>
+						<h4>规则设置</h4>
+						<div style="width: 850px;margin-top: 20px;">
+							<div v-for="item in list" :key="item.index">
+								<div class="c-item" v-if="item.index>0">
+									<label class="c-label">项目间隔(分):</label>
+									<el-input-number class="item-num" v-model="item.intervalTime" :step="10" :min="0"
+										:max="9999">
+									</el-input-number>
+								</div>
+								<div class="c-item">
+									<label class="c-label">第{{item.index+1}}个:</label>
+									<el-select v-model="item.typeId" placeholder="请选择">
+										<el-option :label="type.name" :value="type.id"
+											v-for="(type,index) in item.businessTypeList">
+										</el-option>
+									</el-select>
+									<label class="c-label" style="width: 160px;">单项间隔(小时):</label>
+									<el-input-number class="item-num" v-model="item.singleIntervalTime" :step="1"
+										:min="1" :max="48">
+									</el-input-number>
+									<label style="position: relative;left: 50px;">
+										<el-button style="cursor: pointer;" @click="handlerAdd"
+											v-if="item.index==0&&list.length<businessTypeList.length">添加项
+										</el-button>
+										<el-button @click="handlerDel(item.index)" v-if="item.index>0">删除项</el-button>
+									</label>
+								</div>
+							</div>
+						</div>
+					</el-form>
+				</div>
+			</div>
+			<!-- ------- 底部按钮 ------- -->
+			<div class="s-foot">
+				<el-button type="primary" @click="ok()">确定</el-button>
+				<el-button @click="sa.closeCurrIframe()">取消</el-button>
+			</div>
+		</div>
+		<script>
+			var app = new Vue({
+				components: {
+					"sa-item": httpVueLoader('../../sa-frame/com/sa-item.vue')
+				},
+				el: '.vue-box',
+				data: {
+					id: sa.p('id', 0), // 获取超链接中的id参数(0=添加,非0=修改) 
+					m: null, // 实体对象 
+					list: [],
+					businessTypeList: [],
+				},
+				methods: {
+					handlerAdd() {
+						let list = this.list;
+						this.list.push({
+							index: list.length,
+							typeId: '',
+							intervalTime: 30,
+							singleIntervalTime: 12,
+							businessTypeList: this.businessTypeList
+						})
+					},
+					handlerDel(index) {
+						let list = this.list;
+						list.splice(index, 1);
+						for (let i in list) {
+							let obj = list[i];
+							if (obj.index > index) {
+								obj.index = obj.index - 1;
+							}
+						}
+						this.list = list;
+					},
+					getBusinessType() {
+						sa.ajax('/TbItemType/getList', {
+							business: 0,
+							sortType: 0
+						}, function(resp) {
+							let list = resp.data;
+							this.businessTypeList = list;
+							this.getById();
+						}.bind(this))
+					},
+					// 创建一个 默认Model 
+					createModel: function() {
+						return {
+							id: '', //  
+							name: '', // 名称 
+							status: 1, // 是否启用(0=否,1=是) 
+							createTime: '', // 创建时间 
+						}
+					},
+					// 提交数据 
+					ok: function() {
+						// 表单校验 
+						let m = this.m;
+						sa.checkNull(m.name, '请输入 [名称]');
+						let list = this.list.filter(obj => obj.typeId !== null && obj.typeId !== '');
+						m.items = JSON.stringify(list);
+						m.sorts = null;
+						sa.ajax('/TbSortGroup/update', sa.removeNull(m), function(res) {
+							sa.alert('修改成功', this.clean);
+						}.bind(this));
+					},
+					// 添加/修改 完成后的动作
+					clean: function() {
+						if (this.id == 0) {
+							this.m = this.createModel();
+						} else {
+							parent.app.f5(); // 刷新父页面列表
+							sa.closeCurrIframe(); // 关闭本页 
+						}
+					},
+					getById() {
+						sa.ajax('/TbSortGroup/getById?id=' + this.id, function(res) {
+							let data = res.data;
+							if (data == null) {
+								sa.alert('未能查找到 id=' + this.id + " 详细数据");
+								return;
+							}
+							let sorts = data.sorts;
+							let businessTypeList = this.businessTypeList;
+							let list = [];
+							for (let i in sorts) {
+								let sort = sorts[i];
+								let obj = {
+									id: sort.id,
+									index: parseInt(i),
+									typeId: sort.typeId,
+									intervalTime: sort.intervalTime,
+									singleIntervalTime: sort.singleIntervalTime,
+									businessTypeList: businessTypeList
+								}
+								list.push(obj);
+							}
+							this.m = data;
+							this.list = list;
+						}.bind(this))
+					}
+				},
+				mounted() {
+					this.getBusinessType()
+				}
+			})
+		</script>
+	</body>
+</html>

+ 184 - 0
sp-admin/sa-view/tb-sort-group/tb-sort-group-info.html

@@ -0,0 +1,184 @@
+<!DOCTYPE html>
+<html>
+	<head>
+		<title>业务限制组-添加/修改</title>
+		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
+		<!-- 所有的 css js 资源 -->
+		<link rel="stylesheet" href="../../static/kj/element-ui/theme-chalk/index.css">
+		<link rel="stylesheet" href="../../static/sa.css">
+		<script src="../../static/kj/vue.min.js"></script>
+		<script src="../../static/kj/element-ui/index.js"></script>
+		<script src="../../static/kj/httpVueLoader.js"></script>
+		<script src="../../static/kj/jquery.min.js"></script>
+		<script src="../../static/kj/layer/layer.js"></script>
+		<script src="../../static/sa.js"></script>
+		<style type="text/css">
+			.c-panel .el-form .c-label{width: 8em !important;}
+			.c-panel .el-form .el-input, .c-panel .el-form .el-textarea__inner{width: 250px;}
+			.item-num .el-input__inner {
+				width: 130px;
+				display: inline;
+			}
+		</style>
+	</head>
+	<body>
+		<div class="vue-box" :class="{sbot: id}" style="display: none;" :style="'display: block;'">
+			<!-- ------- 内容部分 ------- -->
+			<div class="s-body">
+				<div class="c-panel">
+					<el-form v-if="m">
+						<sa-info name="组名称" br>{{m.name}}</sa-info>
+						<sa-info type="enum" name="是否启用" :value="m.status"
+							:jv="{1: '是', 0: '否'}" br></sa-info>
+							<sa-info type="enum" name="完整性支付" :value="m.completePay"
+								:jv="{1: '是', 0: '否'}" br></sa-info>
+						<sa-item name="" class="s-ok" br>
+							<el-button type="primary" icon="el-icon-plus" @click="ok()">保存</el-button>
+						</sa-item>
+						 <el-divider></el-divider>
+						<h4>规则</h4>
+						<div style="width: 850px;margin-top: 20px;">
+							<div v-for="item in list" :key="item.index">
+								<div class="c-item" v-if="item.index>0">
+									<label class="c-label">项目间隔(分):</label>
+									<el-input-number disabled class="item-num" v-model="item.interval" :step="10" :min="0"
+										:max="9999">
+									</el-input-number>
+								</div>
+								<div class="c-item">
+									<label class="c-label">第{{item.index+1}}个:</label>
+									<el-select disabled v-model="item.typeId" placeholder="请选择">
+										<el-option :label="type.name" :value="type.id"
+											v-for="(type,index) in item.businessTypeList">
+										</el-option>
+									</el-select>
+									<label class="c-label" style="width: 160px;">单项间隔(小时):</label>
+									<el-input-number disabled class="item-num" v-model="item.singleIntervalTime" :step="1"
+										:min="1" :max="48">
+									</el-input-number>
+								</div>
+							</div>
+						</div>
+					</el-form>
+				</div>
+			</div>
+			<!-- ------- 底部按钮 ------- -->
+			<div class="s-foot">
+				<el-button type="primary" @click="sa.closeCurrIframe()">关闭</el-button>
+			</div>
+		</div>
+        <script>
+			
+			var app = new Vue({
+				components: {
+					"sa-info": httpVueLoader('../../sa-frame/com/sa-info.vue'),
+					"sa-item": httpVueLoader('../../sa-frame/com/sa-item.vue')
+				},
+				el: '.vue-box',
+				data: {
+					id: sa.p('id', 0),		// 获取超链接中的id参数(0=添加,非0=修改) 
+					m: null,		// 实体对象 
+					list: [],
+					businessTypeList: [],
+				},
+				methods: {
+					handlerAdd() {
+						let list = this.list;
+						this.list.push({
+							index: list.length,
+							typeId: '',
+							interval: 30,
+							singleIntervalTime:12,
+							businessTypeList: this.businessTypeList
+						})
+					},
+					handlerDel(index) {
+						let list = this.list;
+						list.splice(index, 1);
+						for (let i in list) {
+							let obj = list[i];
+							if (obj.index > index) {
+								obj.index = obj.index - 1;
+							}
+						}
+						this.list = list;
+					},
+					getBusinessType() {
+						sa.ajax('/TbItemType/getList', {
+							business: 0,
+							sortType: 0
+						}, function(resp) {
+							let list = resp.data;							
+							this.businessTypeList = list;
+							this.getById();
+						}.bind(this))
+					},
+					// 创建一个 默认Model 
+					createModel: function() {
+						return {
+							id: '',		//  
+							name: '',		// 名称 
+							status: 1,		// 是否启用(0=否,1=是) 
+							createTime: '',		// 创建时间 
+						}
+					},
+					// 提交数据 
+					ok: function(){
+						// 表单校验 
+						let m = this.m;
+						sa.checkNull(m.name, '请输入 [名称]');
+						// 开始增加或修改
+						if(this.id <= 0) {	// 添加
+							sa.ajax('/TbSortGroup/add', m, function(res){
+								sa.alert('增加成功', this.clean); 
+							}.bind(this));
+						} else {	// 修改
+							sa.ajax('/TbSortGroup/update', m, function(res){
+								sa.alert('修改成功', this.clean);
+							}.bind(this));
+						}
+					},
+					// 添加/修改 完成后的动作
+					clean: function() {
+						if(this.id == 0) {
+							this.m = this.createModel();
+						} else {
+							parent.app.f5();		// 刷新父页面列表
+							sa.closeCurrIframe();	// 关闭本页 
+						}
+					},
+					getById(){
+						sa.ajax('/TbSortGroup/getById?id=' + this.id, function(res) {
+							let data=res.data;
+							if(data == null) {
+								sa.alert('未能查找到 id=' + this.id + " 详细数据");
+								return;
+							}
+							let sorts=data.sorts;
+							let businessTypeList=this.businessTypeList;
+							let list=[];
+							for(let i in sorts){
+								let sort=sorts[i];
+								let obj={
+									index:parseInt(i),
+									typeId:sort.typeId,
+									interval:sort.intervalTime,
+									singleIntervalTime:sort.singleIntervalTime,
+									businessTypeList:businessTypeList
+								}
+								list.push(obj);
+							}
+							this.m=data;
+							this.list=list;
+						}.bind(this))
+					}
+				},
+				mounted() {
+					this.getBusinessType()
+				}
+			})
+			
+		</script>
+	</body>
+</html>

+ 149 - 0
sp-admin/sa-view/tb-sort-group/tb-sort-group-list.html

@@ -0,0 +1,149 @@
+<!DOCTYPE html>
+<html>
+	<head>
+		<title>业务限制组-列表</title>
+		<meta charset="utf-8">
+		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
+		<!-- 所有的 css & js 资源 -->
+		<link rel="stylesheet" href="../../static/kj/element-ui/theme-chalk/index.css">
+		<link rel="stylesheet" href="../../static/sa.css">
+		<script src="../../static/kj/vue.min.js"></script>
+		<script src="../../static/kj/element-ui/index.js"></script>
+		<script src="../../static/kj/httpVueLoader.js"></script>
+		<script src="../../static/kj/jquery.min.js"></script>
+		<script src="../../static/kj/layer/layer.js"></script>
+		<script src="../../static/sa.js"></script>
+	</head>
+	<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.name"></sa-item>
+					<el-button type="primary" icon="el-icon-search" @click="p.pageNo = 1; f5()">查询</el-button>
+					<el-button v-if="sa.isAuth('tb-sort-group-add')" size="mini" type="primary" @click="add()">
+						新增</el-button>
+					<el-button size="mini" type="info" @click="sa.f5()">重置</el-button>
+				</el-form>
+				<!-- ------------- 数据列表 ------------- -->
+				<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="status" type="switch" :jv="{0: '否[#ff0000]', 1: '是[#005500]'}"
+						@change="s => updateStatus(s.row)"></sa-td>
+						<sa-td  name="完整性支付" prop="completePay" type="switch" :jv="{0: '否[#ff0000]', 1: '是[#005500]'}"
+							@change="s => updateCompletePay(s.row)"></sa-td>
+					<sa-td name="创建时间" prop="createTime" ></sa-td>
+					<el-table-column label="操作" fixed="right"  width="240px">
+						<template slot-scope="s">
+							<el-button class="c-btn" type="success" icon="el-icon-view" @click="get(s.row)">查看</el-button>
+							<el-button class="c-btn" type="primary" icon="el-icon-edit" @click="update(s.row)">修改</el-button>
+							<el-button class="c-btn" type="danger" icon="el-icon-delete" @click="del(s.row)">删除</el-button>
+						</template>
+					</el-table-column>
+				</el-table>
+				<!-- ------------- 分页 ------------- -->
+				<sa-item type="page" :curr.sync="p.pageNo" :size.sync="p.pageSize" :total="dataCount" @change="f5()"></sa-item>
+			</div>
+		</div>
+		<script>
+			var app = new Vue({
+				components: {
+					"sa-item": httpVueLoader('../../sa-frame/com/sa-item.vue'),  
+					"sa-td": httpVueLoader('../../sa-frame/com/sa-td.vue'),		
+				},
+				el: '.vue-box',
+				data: {
+					p: { // 查询参数  
+						id: '',		//  
+						name: '',		// 名称 
+						status: '',		// 是否启用(0=否,1=是) 
+						createTime: '',		// 创建时间 
+						pageNo: 1,		// 当前页 
+						pageSize: 10,	// 页大小 
+						sortType: 0		// 排序方式 
+					},
+					dataCount: 0,
+					dataList: [], // 数据集合 
+				},
+				methods: {
+					// 刷新
+					f5: function() {
+						sa.ajax('/TbSortGroup/getList', sa.removeNull(this.p), function(res) {
+							this.dataList = res.data; // 数据
+							this.dataCount = res.dataCount; // 数据总数 
+							sa.f5TableHeight();		// 刷新表格高度 
+						}.bind(this));
+					},
+					// 查看
+					get: function(data) {
+						sa.showIframe('数据详情', 'tb-sort-group-info.html?id=' + data.id, '1050px', '90%');
+					},
+					// 查看 - 根据选中的
+					getBySelect: function(data) {
+						var selection = this.$refs['data-table'].selection;
+						if(selection.length == 0) {
+							return sa.msg('请选择一条数据')
+						}
+						this.get(selection[0]);
+					},
+					// 修改
+					update: function(data) {
+						sa.showIframe('修改数据', 'tb-sort-group-edit.html?id=' + data.id, '1000px', '90%');
+					},
+					// 新增
+					add: function(data) {
+						sa.showIframe('新增数据', 'tb-sort-group-add.html?id=-1', '1000px', '90%');
+					},
+					// 删除
+					del: function(data) {
+						sa.confirm('是否删除,此操作不可撤销', function() {
+							sa.ajax('/TbSortGroup/delete?id=' + data.id, function(res) {
+								sa.arrayDelete(this.dataList, data);
+								sa.ok('删除成功');
+								sa.f5TableHeight();		// 刷新表格高度 
+							}.bind(this))
+						}.bind(this));
+					},
+					updateCompletePay(data){
+						// 声明变量记录是否成功
+						var isOk = false;	
+						var oldValue = data.completePay;
+						var ajax = sa.ajax('/TbSortGroup/updateCompletePay', {id: data.id, value: data.completePay}, function(res) {
+							isOk = true;
+							sa.msg('修改成功');
+						}.bind(this));
+						// 如果未能修改成功, 则回滚 
+						$.when(ajax).done(function() {
+							if(isOk == false) {
+								data.completePay = oldValue; 
+							}
+						})
+					},
+					// 改 - 是否启用(0=否,1=是)
+					updateStatus: function(data) {
+						// 声明变量记录是否成功 
+						var isOk = false;	
+						var oldValue = data.status;
+						var ajax = sa.ajax('/TbSortGroup/updateStatus', {id: data.id, value: data.status}, function(res) {
+							isOk = true;
+							sa.msg('修改成功');
+						}.bind(this));
+						// 如果未能修改成功, 则回滚 
+						$.when(ajax).done(function() {
+							if(isOk == false) {
+								data.status = oldValue; 
+							}
+						})
+					},
+				},
+				created: function() {
+					this.f5();
+					sa.onInputEnter();
+				}
+			})
+		</script>
+	</body>
+</html>

+ 1 - 1
sp-admin/static/sa.js

@@ -22,7 +22,7 @@ var sa = {
 		api_url: 'https://dxkaa1.bgigc.com/pro',
 		web_url: 'http://www.baidu.com'
 	}
-	sa.cfg = cfg_dev; // 最终环境 , 上线前请选择正确的环境
+	sa.cfg = cfg_test; // 最终环境 , 上线前请选择正确的环境
 })();
 
 

+ 1 - 1
sp-server/app.pid

@@ -1 +1 @@
-19384
+26532

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

@@ -323,7 +323,7 @@ public class ApiService {
             if (db == null) {
                 db = new TbBusinessCar();
             }
-        }else {
+        } else {
             db.setBusinessType(TbBusiness.BusinessType.CAR_DISINCLE.getCode());
             tbBusinessCarService.updateById(db);
         }
@@ -397,9 +397,9 @@ public class ApiService {
         tbBusinessItemService.removeByBusinessId(businessId);
         String carNo = otherBusinessBO.getCarNo();
         String customerId = otherBusinessBO.getCustomerId();
-        checkOtherBusiness(otherBusinessBO, tbItems, carNo);
         TbCostomer tbCostomer = tbCostomerService.getById(customerId);
         TbBusiness tbBusiness = tbBusinessService.getById(businessId);
+        checkOtherBusiness(otherBusinessBO, tbItems, carNo);
         tbBusiness.setOperateTime(otherBusinessBO.getOperateTime())
                 .setOperator(otherBusinessBO.getOperator())
                 .setPayStep(tbItemType.getPayStep()).setItemTypeName(tbItemType.getName())
@@ -415,14 +415,14 @@ public class ApiService {
         }
         String no = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmm")) + RandomUtil.randomNumbers(4);
         TbBusinessCar tbBusinessCar = tbBusinessCarService.getById(tbBusiness.getBusinessCarId());
-        TbBusinessCar otherCar=  tbBusinessCarService.searchOtherBusinessCarNotOut(carNo);
-        if (otherCar!=null){
-            List<TbBusiness>checkList=tbBusinessService.findOtherBusinessByCarId(tbBusiness.getBusinessCarId());
-            if (checkList.size()==1){
+        TbBusinessCar otherCar = tbBusinessCarService.searchOtherBusinessCarNotOut(carNo);
+        if (otherCar != null) {
+            List<TbBusiness> checkList = tbBusinessService.findOtherBusinessByCarId(tbBusiness.getBusinessCarId());
+            if (checkList.size() == 1) {
                 tbBusinessCarService.removeById(tbBusiness.getBusinessCarId());
             }
             tbBusiness.setBusinessCarId(otherCar.getId());
-        }else {
+        } else {
             tbBusinessCar.setCarSize(otherBusinessBO.getCarSize()).setBusinessType(TbBusiness.BusinessType.CAR_DISINCLE.getCode())
                     .setCustomerId(otherBusinessBO.getCustomerId()).setCarNo(carNo)
                     .setTimeUpdate(new Date());
@@ -452,6 +452,7 @@ public class ApiService {
             itemList.add(item);
             index++;
         }
+        tbBusiness.setItemPrice(price);
         tbBusinessItemService.saveBatch(itemList);
         tbBusinessService.updateById(tbBusiness);
 
@@ -459,34 +460,33 @@ public class ApiService {
     }
 
     private void checkOtherBusiness(OtherBusinessBO otherBusinessBO, List<TbItem> tbItems, String carNo) {
-        SoMap soMap = SoMap.getRequestSoMap();
         DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
-        List<TbBusinessSort> sorts = tbBusinessSortService.getList(soMap);
+        String itemTypeId = otherBusinessBO.getItemTypeId();
+        TbBusinessSort sort = tbBusinessSortService.findByItemTypeId(itemTypeId);
+        List<TbBusinessSort> sorts = tbBusinessSortService.findByGroupId(sort.getGroupId());
         LocalDateTime operateTime = LocalDateTime.parse(otherBusinessBO.getOperateTime(), formatter);
-        String today=DateUtil.today();
         int i = 0;
-        List<String> businessTypeList = tbItems.stream().map(TbItem::getBusinessType).collect(Collectors.toList());
         for (TbBusinessSort tbBusinessSort : sorts) {
-            if (i==0&&StrUtil.equals(tbBusinessSort.getTypeId(),otherBusinessBO.getItemTypeId())&&sorts.size()>1){
-                TbBusinessSort afterItem = sorts.get(i +1);
+            if (i == 0 && StrUtil.equals(tbBusinessSort.getTypeId(), otherBusinessBO.getItemTypeId()) && sorts.size() > 1) {
+                TbBusinessSort afterItem = sorts.get(i + 1);
                 String typeId = afterItem.getTypeId();
                 Integer interval = afterItem.getIntervalTime();
                 LocalDateTime endTime = operateTime.plusMinutes(interval);
-                if (afterItem.getIntervalTime()>0){
-                    int count = tbBusinessService.checkCarBusinessType(typeId, carNo, endTime.format(formatter),1);
+                if (afterItem.getIntervalTime() > 0) {
+                    int count = tbBusinessService.checkCarBusinessType(typeId, carNo, endTime.format(formatter), 1);
                     if (count > 0) {
                         throw new BusinessException("车辆:[" + carNo + "]" + tbBusinessSort.getTypeName() + "后" + afterItem.getIntervalTime() + "分钟才可以执行" + afterItem.getTypeName());
                     }
                 }
             }
-            if (i > 0 &&StrUtil.equals(tbBusinessSort.getTypeId(),otherBusinessBO.getItemTypeId())) {
+            if (i > 0 && StrUtil.equals(tbBusinessSort.getTypeId(), otherBusinessBO.getItemTypeId())) {
                 TbBusinessSort beforeItem = sorts.get(i - 1);
                 String typeId = beforeItem.getTypeId();
                 Integer interval = tbBusinessSort.getIntervalTime();
                 LocalDateTime endTime = operateTime.minusMinutes(interval);
-                if (tbBusinessSort.getIntervalTime()>0){
-                    int count = tbBusinessService.checkCarBusinessType(typeId, carNo, endTime.format(formatter),0);
-                    if (count >0) {
+                if (tbBusinessSort.getIntervalTime() > 0) {
+                    int count = tbBusinessService.checkCarBusinessType(typeId, carNo, endTime.format(formatter), 0);
+                    if (count > 0) {
                         throw new BusinessException("车辆:[" + carNo + "]" + beforeItem.getTypeName() + "后" + tbBusinessSort.getIntervalTime() + "分钟才可以执行" + tbBusinessSort.getTypeName());
                     }
                 }

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

@@ -36,6 +36,8 @@ import com.pj.project.tb_business_item.TbBusinessItem;
 import com.pj.project.tb_business_item.TbBusinessItemService;
 import com.pj.project.tb_business_people.TbBusinessPeople;
 import com.pj.project.tb_business_people.TbBusinessPeopleService;
+import com.pj.project.tb_business_sort.TbBusinessSort;
+import com.pj.project.tb_business_sort.TbBusinessSortService;
 import com.pj.project.tb_car.TbCar;
 import com.pj.project.tb_car.TbCarService;
 import com.pj.project.tb_car_no_color.TbCarNoColor;
@@ -56,6 +58,8 @@ import com.pj.project.tb_notices.TbNoticesMapper;
 import com.pj.project.tb_notices.TbNoticesService;
 import com.pj.project.tb_pass_record.TbPassRecord;
 import com.pj.project.tb_pass_record.TbPassRecordService;
+import com.pj.project.tb_sort_group.TbSortGroup;
+import com.pj.project.tb_sort_group.TbSortGroupService;
 import com.pj.project.tb_unit.TbUnit;
 import com.pj.project.tb_unit.TbUnitService;
 import com.pj.project4sp.admin.SpAdmin;
@@ -136,6 +140,11 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
     @Resource
     private SpAdminService spAdminService;
 
+    @Resource
+    private TbBusinessSortService tbBusinessSortService;
+    @Resource
+    private TbSortGroupService tbSortGroupService;
+
 
     private final List<String> CAR_LIST = StrUtil.splitTrim("浙,粤,京,津,冀,晋,蒙,辽,黑,沪,吉,苏,皖,赣,鲁,豫,鄂,湘,桂,琼,渝,川,贵,云,藏, 陕, 甘, 青, 宁", ",");
 
@@ -491,10 +500,12 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
         String businessId = car.getBusinessId();
         Integer businessType = car.getBusinessType();
         result.put("type", businessType);
+        result.put("showPay", true);
         List<TbBusinessCar> cars = new ArrayList<>();
         List<TbBusinessItem> items = new ArrayList<>();
         cars.add(car);
         //其他业务
+        String itemTypeId = "";
         if (TbBusiness.BusinessType.CAR_DISINCLE.getCode().equals(businessType)) {
             List<TbBusiness> businesses = this.findOtherBusinessByCarId(carId);
             businesses = businesses.stream()
@@ -506,6 +517,7 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
                     .collect(Collectors.toList());
             List<String> businessIdList = businesses.stream().map(TbBusiness::getId).collect(Collectors.toList());
             if (!businessIdList.isEmpty()) {
+                itemTypeId = businesses.get(0).getItemTypeId();
                 items = tbBusinessItemService.findByBusinessIdList(businessIdList);
                 businessId = String.join(",", businessIdList);
             }
@@ -523,7 +535,7 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
             Date inTime = tbBusinessCar.getRealInTime();
             BigDecimal partMoney = new BigDecimal("0");
             String carNo = tbBusinessCar.getCarNo().substring(0, 1);
-            if (inTime != null&&tbBusinessCar.getRealOutTime()==null) {
+            if (inTime != null && tbBusinessCar.getRealOutTime() == null) {
                 if (tbBusinessCar.getPay() == 1 && tbBusinessCar.getPayTime() != null) {
                     inTime = tbBusinessCar.getPayTime();
                 }
@@ -567,6 +579,17 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
         }
         result.put("itemsPrice", itemsPrice);
         result.put("itemList", itemList);
+        if (TbBusiness.BusinessType.CAR_DISINCLE.getCode().equals(businessType) && StrUtil.isNotEmpty(itemTypeId)) {
+            TbBusinessSort tbBusinessSort = tbBusinessSortService.findByItemTypeId(itemTypeId);
+            TbSortGroup sortGroup = tbSortGroupService.getById(tbBusinessSort.getGroupId());
+            if (sortGroup.getCompletePay().equals(1)&&sortGroup.getStatus().equals(1)) {
+                List<TbBusinessSort> sorts = tbBusinessSortService.findByGroupId(sortGroup.getId());
+                if (sorts.size() > items.size()) {
+                    result.put("showPay", false);
+                }
+            }
+        }
+
         return result;
     }
 
@@ -604,7 +627,7 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
     public void deleteOtherBusiness(String id) {
         TbBusiness db = super.getById(id);
         TbBusinessCar tbBusinessCar = tbBusinessCarService.getById(db.getBusinessCarId());
-        if (tbBusinessCar==null||tbBusinessCar.getRealInTime()==null){
+        if (tbBusinessCar == null || tbBusinessCar.getRealInTime() == null) {
             List<TbBusiness> businesses = this.findOtherBusinessByCarId(db.getBusinessCarId());
             if (businesses.size() == 1) {
                 tbBusinessCarService.removeById(db.getBusinessCarId());

+ 1 - 0
sp-server/src/main/java/com/pj/project/tb_business_sort/TbBusinessSort.java

@@ -58,6 +58,7 @@ public class TbBusinessSort extends Model<TbBusinessSort> implements Serializabl
 	private Integer sort=1;
 	private Integer intervalTime=30;
 	private Integer singleIntervalTime=24;
+	private Long groupId;
 
 
 

+ 0 - 1
sp-server/src/main/java/com/pj/project/tb_business_sort/TbBusinessSortController.java

@@ -32,7 +32,6 @@ public class TbBusinessSortController {
 		SoMap so = SoMap.getRequestSoMap();
 		String addJson=so.getString("addJson");
 		tbBusinessSortService.add(addJson);
-
 		return AjaxJson.getSuccess();
 	}
 

+ 18 - 0
sp-server/src/main/java/com/pj/project/tb_business_sort/TbBusinessSortService.java

@@ -77,4 +77,22 @@ public class TbBusinessSortService extends ServiceImpl<TbBusinessSortMapper, TbB
     }
 
 
+    public List<TbBusinessSort> findByGroupId(Long groupId) {
+        QueryWrapper<TbBusinessSort> ew = new QueryWrapper<>();
+        ew.eq("group_id", groupId);
+        return list(ew);
+    }
+
+    public void removeByGroupId(Long groupId) {
+        QueryWrapper<TbBusinessSort> ew = new QueryWrapper<>();
+        ew.eq("group_id", groupId);
+        this.remove(ew);
+    }
+
+    public TbBusinessSort findByItemTypeId(String typeId) {
+        QueryWrapper<TbBusinessSort> ew = new QueryWrapper<>();
+        ew.eq("type_id", typeId);
+        List<TbBusinessSort>list=list(ew);
+        return list.isEmpty()?null:list.get(0);
+    }
 }

+ 78 - 0
sp-server/src/main/java/com/pj/project/tb_sort_group/TbSortGroup.java

@@ -0,0 +1,78 @@
+package com.pj.project.tb_sort_group;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+import com.baomidou.mybatisplus.annotation.*;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import com.pj.project.tb_business_sort.TbBusinessSort;
+import lombok.EqualsAndHashCode;
+
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+/**
+ * Model: tb_sort_group -- 业务限制组
+ * @author qzy 
+ */
+@Data
+@Accessors(chain = true)
+@TableName(TbSortGroup.TABLE_NAME)
+@EqualsAndHashCode(callSuper = false)
+public class TbSortGroup extends Model<TbSortGroup> implements Serializable {
+
+	// ---------- 模块常量 ----------
+	/**
+	 * 序列化版本id 
+	 */
+	private static final long serialVersionUID = 1L;	
+	/**
+	 * 此模块对应的表名 
+	 */
+	public static final String TABLE_NAME = "tb_sort_group";	
+	/**
+	 * 此模块对应的权限码 
+	 */
+	public static final String PERMISSION_CODE = "tb-sort-group";	
+	public static final String PERMISSION_CODE_ADD = "tb-sort-group-add";
+	public static final String PERMISSION_CODE_EDIT = "tb-sort-group-edit";
+	public static final String PERMISSION_CODE_DEL = "tb-sort-group-del";
+
+
+	// ---------- 表中字段 ----------
+	/**
+	 *  
+	 */
+	@TableId(type = IdType.AUTO)
+	private Long id;	
+
+	/**
+	 * 名称 
+	 */
+	private String name;	
+
+	/**
+	 * 是否启用(0=否,1=是) 
+	 */
+	private Integer status;
+	/**
+	 * 完整性支付==>需要添加完子项才能支付
+	 */
+	private Integer completePay;
+
+	/**
+	 * 创建时间 
+	 */
+	private String createTime;	
+
+
+	@TableField(exist = false)
+	private List<TbBusinessSort>sorts=new ArrayList<>();
+
+
+
+	
+
+
+}

+ 117 - 0
sp-server/src/main/java/com/pj/project/tb_sort_group/TbSortGroupController.java

@@ -0,0 +1,117 @@
+package com.pj.project.tb_sort_group;
+
+import java.util.List;
+
+import cn.hutool.json.JSONUtil;
+import com.pj.project.tb_business_sort.TbBusinessSort;
+import com.pj.utils.so.SoMap;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.bind.annotation.*;
+
+import com.pj.utils.sg.*;
+import com.pj.project4sp.SP;
+
+import com.pj.current.satoken.StpUserUtil;
+import cn.dev33.satoken.annotation.SaCheckPermission;
+
+
+/**
+ * Controller: tb_sort_group -- 业务限制组
+ *
+ * @author qzy
+ */
+@RestController
+@RequestMapping("/TbSortGroup/")
+public class TbSortGroupController {
+
+    /**
+     * 底层 Service 对象
+     */
+    @Autowired
+    TbSortGroupService tbSortGroupService;
+
+    /**
+     * 增
+     */
+    @RequestMapping("add")
+    @SaCheckPermission(TbSortGroup.PERMISSION_CODE_ADD)
+    @Transactional(rollbackFor = Exception.class)
+    public AjaxJson add(TbSortGroup t) {
+        SoMap so = SoMap.getRequestSoMap();
+        String items = so.getString("items");
+        List<TbBusinessSort> sorts = JSONUtil.toList(items, TbBusinessSort.class);
+        t.setSorts(sorts );
+        tbSortGroupService.add(t);
+        return AjaxJson.getSuccessData(t);
+    }
+
+    /**
+     * 删
+     */
+    @RequestMapping("delete")
+    @SaCheckPermission(TbSortGroup.PERMISSION_CODE_DEL)
+    public AjaxJson delete(Long id) {
+        tbSortGroupService.delete(id);
+        return AjaxJson.getSuccess();
+    }
+
+
+    /**
+     * 改
+     */
+    @RequestMapping("update")
+    @SaCheckPermission(TbSortGroup.PERMISSION_CODE_EDIT)
+    public AjaxJson update(TbSortGroup t) {
+        SoMap so = SoMap.getRequestSoMap();
+        String items = so.getString("items");
+        List<TbBusinessSort> sorts = JSONUtil.toList(items, TbBusinessSort.class);
+        t.setSorts(sorts );
+        tbSortGroupService.update(t);
+        return AjaxJson.getSuccess();
+    }
+
+    /**
+     * 查 - 根据id
+     */
+    @RequestMapping("getById")
+    public AjaxJson getById(Long id) {
+        TbSortGroup t = tbSortGroupService.getById(id);
+        return AjaxJson.getSuccessData(t);
+    }
+
+    /**
+     * 查集合 - 根据条件(参数为空时代表忽略指定条件)
+     */
+    @RequestMapping("getList")
+    public AjaxJson getList() {
+        SoMap so = SoMap.getRequestSoMap();
+        List<TbSortGroup> list = tbSortGroupService.getList(so.startPage());
+        return AjaxJson.getPageData(so.getDataCount(), list);
+    }
+
+
+    /**
+     * 改 - 是否启用(0=否,1=是)
+     */
+    @RequestMapping("updateStatus")
+    @SaCheckPermission(TbSortGroup.PERMISSION_CODE_EDIT)
+    public AjaxJson updateStatus(Long id, Integer value) {
+        int line = SP.publicMapper.updateColumnById(TbSortGroup.TABLE_NAME, "status", value, id);
+        return AjaxJson.getByLine(line);
+    }
+    /**
+     * 改 - 是否启用(0=否,1=是)
+     */
+    @RequestMapping("updateCompletePay")
+    @SaCheckPermission(TbSortGroup.PERMISSION_CODE_EDIT)
+    public AjaxJson updateCompletePay(Long id, Integer value) {
+        int line = SP.publicMapper.updateColumnById(TbSortGroup.TABLE_NAME, "complete_pay", value, id);
+        return AjaxJson.getByLine(line);
+    }
+
+
+    // ------------------------- 前端接口 -------------------------
+
+
+}

+ 28 - 0
sp-server/src/main/java/com/pj/project/tb_sort_group/TbSortGroupMapper.java

@@ -0,0 +1,28 @@
+package com.pj.project.tb_sort_group;
+
+import java.util.List;
+
+import org.apache.ibatis.annotations.Mapper;
+
+import com.pj.utils.so.*;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.springframework.stereotype.Repository;
+
+/**
+ * Mapper: tb_sort_group -- 业务限制组
+ * @author qzy 
+ */
+
+@Mapper
+@Repository
+public interface TbSortGroupMapper extends BaseMapper <TbSortGroup> {
+
+	/**
+	 * 查集合 - 根据条件(参数为空时代表忽略指定条件)
+	 * @param so 参数集合 
+	 * @return 数据列表 
+	 */
+	List<TbSortGroup> getList(SoMap so);
+
+
+}

+ 51 - 0
sp-server/src/main/java/com/pj/project/tb_sort_group/TbSortGroupMapper.xml

@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.pj.project.tb_sort_group.TbSortGroupMapper">
+
+
+	<!-- ================================== 查询相关 ================================== -->
+	<!-- select id, name, status, create_time from tb_sort_group  -->
+	
+	<!-- 通用映射:手动模式 -->
+	<resultMap id="model" type="com.pj.project.tb_sort_group.TbSortGroup">
+		<result property="id" column="id" />
+		<result property="name" column="name" />
+		<result property="status" column="status" />
+		<result property="createTime" column="create_time" />
+	</resultMap>
+	
+	<!-- 公共查询sql片段 -->
+	<sql id="select_sql">
+		select * 
+		from tb_sort_group 
+	</sql>
+
+	<!-- 查集合 - 根据条件(参数为空时代表忽略指定条件) [G] -->
+	<select id="getList" resultType="com.pj.project.tb_sort_group.TbSortGroup">
+		<include refid="select_sql"></include>
+		<where>
+			<if test=' this.has("id") '> and id = #{id} </if>
+			<if test=' this.has("name") '> and name like concat('%',#{name},'%')  </if>
+			<if test=' this.has("status") '> and status = #{status} </if>
+			<if test=' this.has("createTime") '> and create_time = #{createTime} </if>
+		</where>
+		order by
+		<choose>
+			<when test='sortType == 1'> id desc </when>
+			<when test='sortType == 2'> name desc </when>
+			<when test='sortType == 3'> status desc </when>
+			<when test='sortType == 4'> create_time desc </when>
+			<otherwise> id desc </otherwise>
+		</choose>
+	</select>
+	
+	
+	
+	
+	
+	
+	
+	
+	
+
+</mapper>

+ 122 - 0
sp-server/src/main/java/com/pj/project/tb_sort_group/TbSortGroupService.java

@@ -0,0 +1,122 @@
+package com.pj.project.tb_sort_group;
+
+import java.util.List;
+
+import cn.hutool.core.date.DateUtil;
+import cn.hutool.json.JSONUtil;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.pj.project.tb_business.TbBusiness;
+import com.pj.project.tb_business.TbBusinessMapper;
+import com.pj.project.tb_business_sort.TbBusinessSort;
+import com.pj.project.tb_business_sort.TbBusinessSortService;
+import com.pj.project.tb_item_type.TbItemType;
+import com.pj.project.tb_item_type.TbItemTypeService;
+import com.pj.project4sp.global.BusinessException;
+import com.pj.utils.so.SoMap;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import com.pj.utils.sg.*;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.Resource;
+
+/**
+ * Service: tb_sort_group -- 业务限制组
+ *
+ * @author qzy
+ */
+@Service
+@Transactional(rollbackFor = Exception.class)
+public class TbSortGroupService extends ServiceImpl<TbSortGroupMapper, TbSortGroup> implements IService<TbSortGroup> {
+
+    @Resource
+    private TbBusinessSortService tbBusinessSortService;
+
+    @Resource
+    private TbItemTypeService tbItemTypeService;
+
+    /**
+     * 底层 Mapper 对象
+     */
+    @Autowired
+    TbSortGroupMapper tbSortGroupMapper;
+
+    /**
+     * 增
+     */
+    void add(TbSortGroup t) {
+        List<TbBusinessSort> sorts = t.getSorts();
+        t.setCreateTime(DateUtil.now());
+        this.save(t);
+        int sort = 1;
+        for (TbBusinessSort tbBusinessSort : sorts) {
+            TbBusinessSort checkDb = tbBusinessSortService.findByItemTypeId(tbBusinessSort.getTypeId());
+            if (checkDb != null) {
+                throw new BusinessException(checkDb.getTypeName() + "已存在其他规则组");
+            }
+            String typeId = tbBusinessSort.getTypeId();
+            TbItemType tbItemType = tbItemTypeService.getById(typeId);
+            tbBusinessSort.setSort(sort).setTypeName(tbItemType.getName())
+                    .setGroupId(t.getId()).setName(t.getName());
+            if (sort == 1) {
+                tbBusinessSort.setIntervalTime(0);
+            }
+            sort++;
+        }
+        tbBusinessSortService.saveBatch(sorts);
+    }
+
+    /**
+     * 删
+     */
+    void delete(Long id) {
+        this.removeById(id);
+        tbBusinessSortService.removeByGroupId(id);
+    }
+
+    /**
+     * 改
+     */
+    void update(TbSortGroup t) {
+        this.updateById(t);
+        List<TbBusinessSort> sorts = t.getSorts();
+        tbBusinessSortService.removeByGroupId(t.getId());
+        int sort = 1;
+        for (TbBusinessSort tbBusinessSort : sorts) {
+            String typeId = tbBusinessSort.getTypeId();
+            TbBusinessSort db = tbBusinessSortService.findByItemTypeId(typeId);
+            if (db!=null&&!db.getId().equals(tbBusinessSort.getId())){
+                throw new BusinessException(tbBusinessSort.getTypeName()+"已存在其他规则组");
+            }
+            TbItemType tbItemType = tbItemTypeService.getById(typeId);
+            tbBusinessSort.setSort(sort).setTypeName(tbItemType.getName())
+                    .setGroupId(t.getId()).setName(t.getName());
+            if (sort == 1) {
+                tbBusinessSort.setIntervalTime(0);
+            }
+            sort++;
+        }
+        tbBusinessSortService.saveBatch(sorts);
+    }
+
+    /**
+     * 查
+     */
+    TbSortGroup getById(Long id) {
+        TbSortGroup tbSortGroup = super.getById(id);
+        List<TbBusinessSort> sorts = tbBusinessSortService.findByGroupId(id);
+        tbSortGroup.setSorts(sorts);
+        return tbSortGroup;
+    }
+
+    /**
+     * 查集合 - 根据条件(参数为空时代表忽略指定条件)
+     */
+    List<TbSortGroup> getList(SoMap so) {
+        return tbSortGroupMapper.getList(so);
+    }
+
+
+}