qzyReal il y a 3 ans
Parent
commit
8ea207a818
24 fichiers modifiés avec 553 ajouts et 258 suppressions
  1. 65 7
      app/pages/onely-disinfect/type-business.vue
  2. 13 21
      sp-admin/sa-frame/menu-list.js
  3. 43 33
      sp-admin/sa-view/tb-business-sort/tb-business-sort-add.html
  4. 152 88
      sp-admin/sa-view/tb-business-sort/tb-business-sort-list.html
  5. 29 4
      sp-admin/sa-view/tb-business/tb-car-disincle-add.html
  6. 28 4
      sp-admin/sa-view/tb-business/tb-car-disincle-edit.html
  7. 2 1
      sp-admin/sa-view/tb-business/tb-car-disincle-list.html
  8. 2 2
      sp-admin/sa-view/tb-item-type/tb-item-list.html
  9. 1 1
      sp-server/app.pid
  10. 53 32
      sp-server/src/main/java/com/pj/api/service/ApiService.java
  11. 1 0
      sp-server/src/main/java/com/pj/project/tb_business/CarDisincle.java
  12. 1 1
      sp-server/src/main/java/com/pj/project/tb_business/TbBusinessController.java
  13. 6 0
      sp-server/src/main/java/com/pj/project/tb_business/TbBusinessMapper.java
  14. 34 1
      sp-server/src/main/java/com/pj/project/tb_business/TbBusinessMapper.xml
  15. 12 1
      sp-server/src/main/java/com/pj/project/tb_business/TbBusinessService.java
  16. 6 0
      sp-server/src/main/java/com/pj/project/tb_business_car/TbBusinessCarController.java
  17. 2 2
      sp-server/src/main/java/com/pj/project/tb_business_car/TbBusinessCarMapper.xml
  18. 21 7
      sp-server/src/main/java/com/pj/project/tb_business_car/TbBusinessCarService.java
  19. 15 0
      sp-server/src/main/java/com/pj/project/tb_business_sort/AddBusinessSortBO.java
  20. 1 0
      sp-server/src/main/java/com/pj/project/tb_business_sort/TbBusinessSort.java
  21. 5 21
      sp-server/src/main/java/com/pj/project/tb_business_sort/TbBusinessSortController.java
  22. 0 1
      sp-server/src/main/java/com/pj/project/tb_business_sort/TbBusinessSortMapper.xml
  23. 60 30
      sp-server/src/main/java/com/pj/project/tb_business_sort/TbBusinessSortService.java
  24. 1 1
      sp-server/src/main/java/com/pj/project/tb_item_type/TbItemTypeService.java

+ 65 - 7
app/pages/onely-disinfect/type-business.vue

@@ -21,14 +21,21 @@
 			<view class="item">
 				<view class="l"><text style="color: red;">*</text>车牌号:</view>
 				<view class="r">
-					<u-input placeholder="请填写车牌号" v-model="form.carNo" />
+					<u-input @input="carInputFn" placeholder="请填写车牌号" v-model="form.carNo" />
 				</view>
 			</view>
+			<view class="list" v-show="carList.length>0">
+				<u-radio-group v-model="form.carNo" placement="column" @change="groupChange">
+					<u-radio :customStyle="{marginBottom: '8px'}" v-for="(item, index) in carList" :key="index"
+						:label="item.carNo" :name="item.carNo">
+					</u-radio>
+				</u-radio-group>
+			</view>
 			<view class="item">
 				<view class="l">车辆类型:</view>
 				<view class="r">
-					<picker v-if="type.list.length>0" class="p-picker" id="qy" @change="bindPickerChange($event)" :value="type.index"
-						:range="type.list" range-key="name">
+					<picker v-if="type.list.length>0" class="p-picker" id="qy" @change="bindPickerChange($event)"
+						:value="type.index" :range="type.list" range-key="name">
 						<text class="p-text">{{type.list[type.index].name}}</text>
 						<u-icon class="p-icon" name="arrow-down-fill" size="20"></u-icon>
 					</picker>
@@ -99,6 +106,11 @@
 		</view>
 		<!-- ---------------------------------------------------------- -->
 		<view class="bottom-safety"></view>
+		<uni-popup ref="popup" type="bottom" background-color="#fff">
+			<view style="height: 300rpx;overflow-y: auto;">
+
+			</view>
+		</uni-popup>
 	</view>
 </template>
 
@@ -121,7 +133,8 @@
 					carNo: '',
 					carSize: '',
 					carWeight: '',
-					operator: ''
+					operator: '',
+					operateTime: '',
 				},
 				list: [],
 				checkList: [],
@@ -129,7 +142,32 @@
 					id: '',
 					name: '',
 					items: []
-				}
+				},
+				carList: [{
+						id: '1234',
+						carNo: '桂a09345'
+					},
+					{
+						id: '342',
+						carNo: '桂a09343'
+					},
+					{
+						id: '5431',
+						carNo: '桂a09645'
+					},
+					{
+						id: '5431',
+						carNo: '桂a09645'
+					},
+					{
+						id: '5431',
+						carNo: '桂a09645'
+					},
+					{
+						id: '5431',
+						carNo: '桂a09645'
+					},
+				]
 			}
 		},
 		computed: {
@@ -165,6 +203,14 @@
 		},
 
 		methods: {
+			carInputFn() {
+			},
+			showWin() {
+				this.$refs.popup.open('bottom')
+			},
+			groupChange() {
+				console.log(11)
+			},
 			getItemTypeEnum() {
 				this.$api.getItemTypeEnum().then(resp => {
 					this.type.list = resp.data;
@@ -195,8 +241,9 @@
 				}).then(resp => {
 					let data = resp.data;
 					let items = data.items
-					.filter(obj => obj.itemType && obj.itemType.indexOf(this.type.list[this.type.index].name) !== -1);
-					data.items=items;
+						.filter(obj => obj.itemType && obj.itemType.indexOf(this.type.list[this.type.index]
+							.name) !== -1);
+					data.items = items;
 					this.itemType = data;
 					this.checkList = items.filter(obj => obj.need == 1).map(obj => obj.id)
 
@@ -262,6 +309,17 @@
 		text-align: center;
 	}
 
+	.list {
+		position: absolute;
+		left: 34%;
+		z-index: 999;
+		background: #e5e5e5;
+		padding: 10rpx 200rpx 10rpx 40rpx;
+		border-radius: 10rpx;
+		height: 120rpx;
+		overflow-y: auto;
+	}
+
 	.item-line {
 		color: #a2a2a2;
 		padding: 5px 0 10px 29px;

+ 13 - 21
sp-admin/sa-frame/menu-list.js

@@ -340,27 +340,7 @@ var menuList = [{
 					},
 				]
 			},
-			{
-				id: 'tb-business-sort-list',
-				name: '业务顺序',
-				url: 'sa-view/tb-business-sort/tb-business-sort-list.html',
-				childList: [{
-						id: 'tb-business-sort-add',
-						name: '添加',
-						isShow: false
-					},
-					{
-						id: 'tb-business-sort-del',
-						name: '删除',
-						isShow: false
-					},
-					{
-						id: 'tb-business-sort-edit',
-						name: '修改',
-						isShow: false
-					},
-				]
-			},
+			
 
 		]
 	},
@@ -396,6 +376,7 @@ var menuList = [{
 
 				]
 			},
+			
 			{
 				id: 'tb-item-re-list',
 				name: '明细管理',
@@ -417,6 +398,17 @@ 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',
+						name: '修改',
+						isShow: false
+					},
+				]
+			},
 		],
 
 	},

+ 43 - 33
sp-admin/sa-view/tb-business-sort/tb-business-sort-add.html

@@ -41,7 +41,8 @@
 						<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.interval" :step="10" :min="1" :max="9999">
+								<el-input-number class="item-num" v-model="item.interval" :step="10" :min="1"
+									:max="9999">
 								</el-input-number>
 							</div>
 							<div class="c-item">
@@ -77,40 +78,58 @@
 					id: sa.p('id', 0), // 获取超链接中的id参数(0=添加,非0=修改) 
 					m: null, // 实体对象 
 					list: [],
-					businessTypeList:[],
+					businessTypeList: [],
 				},
 				methods: {
-					handlerAdd(){
-						let list=this.list;
+					handlerAdd() {
+						let list = this.list;
+						let businessTypeList = this.businessTypeList;
 						this.list.push({
 							index: list.length,
-							typeId: '',
+							typeId: businessTypeList[0].id,
 							interval: 30,
-							businessTypeList: this.businessTypeList
+							businessTypeList: 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;
+					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;
+						this.list = list;
 					},
 					getBusinessType() {
 						this.list = [];
-						sa.ajax('/TbCostomer/getTypeList', function(resp) {
-							let list=resp.data;
-							this.businessTypeList=list;
-							this.list.push({
-								index: 0,
-								typeId: '',
-								interval: 30,
-								businessTypeList: list
-							})
+						sa.ajax('/TbItemType/getList', function(resp) {
+							let list = resp.data;
+							this.businessTypeList = list;
+							this.getSortList();
+						}.bind(this))
+					},
+					getSortList() {
+						console.log(111)
+						sa.ajax('/TbBusinessOrder/getList', function(resp) {
+							let dbList = resp.data;
+							let businessTypeList = this.businessTypeList;
+							let index = 0;
+							let list = [];
+							for (let i in dbList) {
+								let item = dbList[i];
+								let obj = {
+									id: item.id,
+									index: index,
+									typeId: item.typeId,
+									interval: item.intervalTime,
+									businessTypeList: businessTypeList
+								}
+								list.push(obj);
+								index++;
+							}
+							this.list = list;
 						}.bind(this))
 					},
 					// 创建一个 默认Model 
@@ -156,16 +175,7 @@
 				mounted: function() {
 					this.getBusinessType();
 					// 初始化数据 
-					if (this.id <= 0) {
-						this.m = this.createModel();
-					} else {
-						sa.ajax('/TbBusinessOrder/getById?id=' + this.id, function(res) {
-							this.m = res.data;
-							if (res.data == null) {
-								sa.alert('未能查找到 id=' + this.id + " 详细数据");
-							}
-						}.bind(this))
-					}
+
 				}
 			})
 		</script>

+ 152 - 88
sp-admin/sa-view/tb-business-sort/tb-business-sort-list.html

@@ -1,10 +1,11 @@
 <!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 资源 -->
+		<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>
@@ -13,112 +14,175 @@
 		<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" style="display: none;" :style="'display: block;'">
-			<div class="c-panel">
-				<!-- ------------- 检索参数 ------------- -->
-				<div class="c-title">检索参数</div>
-				<!-- ------------- 快捷按钮 ------------- -->
-				<sa-item type="fast-btn" show="add,reset"></sa-item>
-				<!-- ------------- 数据列表 ------------- -->
-				<el-table class="data-table" ref="data-table" :data="dataList" >
-					<sa-td name="名称" prop="name" ></sa-td>
-					<sa-td name="业务类型" prop="typeName" ></sa-td>
-					<sa-td name="顺序" prop="sort" ></sa-td>
-					<sa-td name="距离上一业务间隔" prop="intervalTime" ></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 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>
+						<div style="width: 850px;">
+							<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="!sa.isAuth('tb-business-sort-edit')" class="item-num" v-model="item.interval" :step="10" :min="1"
+										:max="9999">
+									</el-input-number>
+								</div>
+								<div class="c-item">
+									<label class="c-label">第{{item.index+1}}个:</label>
+									<el-select :disabled="!sa.isAuth('tb-business-sort-edit')" 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="!sa.isAuth('tb-business-sort-edit')" 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&&sa.isAuth('tb-business-sort-edit')">添加项
+										</el-button>
+										<el-button @click="handlerDel(item.index)" v-if="item.index>0&&sa.isAuth('tb-business-sort-edit')">删除项</el-button>
+									</label>
+								</div>
+							</div>
+						</div>
+						<sa-item name="" class="s-ok" br v-if="sa.isAuth('tb-business-sort-edit')">
+							<el-button type="primary" icon="el-icon-plus" @click="ok()">保存</el-button>
+						</sa-item>
+					</el-form>
+				</div>
 			</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'),		
+					"sa-item": httpVueLoader('../../sa-frame/com/sa-item.vue')
 				},
 				el: '.vue-box',
 				data: {
-					p: { // 查询参数  
-						id: '',		//  
-						name: '',		//  
-						typeName: '',		//  
-						sort: '',		//  
-						pageNo: 1,		// 当前页 
-						pageSize: 10,	// 页大小 
-						sortType: 0		// 排序方式 
-					},
-					dataCount: 0,
-					dataList: [], // 数据集合 
+					id: sa.p('id', 0), // 获取超链接中的id参数(0=添加,非0=修改) 
+					m: null, // 实体对象 
+					list: [],
+					businessTypeList: [],
 				},
 				methods: {
-					// 刷新
-					f5: function() {
-						sa.ajax('/TbBusinessOrder/getList', sa.removeNull(this.p), function(res) {
-							this.dataList = res.data; // 数据
-							this.dataCount = res.dataCount; // 数据总数 
-							sa.f5TableHeight();		// 刷新表格高度 
-						}.bind(this));
+					handlerAdd() {
+						let list = this.list;
+						this.list.push({
+							index: list.length,
+							typeId: '',
+							interval: 30,
+							singleIntervalTime:24,
+							businessTypeList: this.businessTypeList
+						})
 					},
-					// 查看
-					get: function(data) {
-						sa.showIframe('数据详情', 'tb-business-sort-info.html?id=' + data.id, '1050px', '90%');
-					},
-					// 查看 - 根据选中的
-					getBySelect: function(data) {
-						var selection = this.$refs['data-table'].selection;
-						if(selection.length == 0) {
-							return sa.msg('请选择一条数据')
+					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.get(selection[0]);
+						this.list = list;
 					},
-					// 修改
-					update: function(data) {
-						sa.showIframe('修改数据', 'tb-business-sort-add.html?id=' + data.id, '800px', '80%');
+					getBusinessType() {
+						this.list = [];
+						sa.ajax('/TbItemType/getList', {
+							business: 0,
+							sortType: 0
+						}, function(resp) {
+							let list = resp.data;
+							this.businessTypeList = list;
+							this.getSortList();
+						}.bind(this))
 					},
-					// 新增
-					add: function(data) {
-						sa.showIframe('新增数据', 'tb-business-sort-add.html?id=-1', '700px', '80%');
+					getSortList() {
+						sa.ajax('/TbBusinessOrder/getList', function(resp) {
+							let dbList = resp.data;
+							let businessTypeList = this.businessTypeList;
+							let index = 0;
+							let list = [];
+							for(let i in dbList){
+								let item=dbList[i];
+								let obj={
+									index:index,
+									typeId:item.typeId,
+									interval:item.intervalTime,
+									singleIntervalTime:item.singleIntervalTime,
+									businessTypeList:businessTypeList
+								}
+								index++;
+								list.push(obj);
+							}
+							this.list = list;
+						}.bind(this))
 					},
-					// 删除
-					del: function(data) {
-						sa.confirm('是否删除,此操作不可撤销', function() {
-							sa.ajax('/TbBusinessOrder/delete?id=' + data.id, function(res) {
-								sa.arrayDelete(this.dataList, data);
-								sa.ok('删除成功');
-								sa.f5TableHeight();		// 刷新表格高度 
-							}.bind(this))
-						}.bind(this));
+					// 创建一个 默认Model 
+					createModel: function() {
+						return {
+							id: '', //  
+							name: '', //  
+							typeId: '',
+							typeName: '', //  
+							sort: '', //  
+						}
 					},
-					// 批量删除
-					deleteByIds: function() {
-						// 获取选中元素的id列表 
-						let selection = this.$refs['data-table'].selection;
-						let ids = sa.getArrayField(selection, 'id');
-						if(selection.length == 0) {
-							return sa.msg('请至少选择一条数据')
+					// 提交数据 
+					ok: function() {
+						let list = this.list.filter(obj=>obj.itemId!='');
+						if(list.length==0){
+							sa.error('请设置项目')
+							return;
+						}
+						for (let i in list) {
+							let obj = list[i];
+							if(i==0){
+								obj.intervalTime=0;
+							}
+							let businessList = obj.businessTypeList;
+							let name = businessList.filter(type => type.id == obj.typeId)[0].name;
+							obj.typeName=name;
 						}
-						// 提交删除 
-						sa.confirm('是否批量删除选中数据?此操作不可撤销', function() {
-							sa.ajax('/TbBusinessOrder/deleteByIds', {ids: ids.join(',')}, function(res) {
-								sa.arrayDelete(this.dataList, selection);
-								sa.ok('删除成功');
-								sa.f5TableHeight();		// 刷新表格高度 
-							}.bind(this))
+						let obj={addJson:JSON.stringify(list)};
+						sa.ajax('/TbBusinessOrder/add', obj, function(res) {
+							sa.alert('设置成功', this.getBusinessType());
 						}.bind(this));
 					},
+					// 添加/修改 完成后的动作
+					clean: function() {
+						if (this.id == 0) {
+							this.m = this.createModel();
+						} else {
+							parent.app.f5(); // 刷新父页面列表
+							sa.closeCurrIframe(); // 关闭本页 
+						}
+					}
 				},
-				created: function() {
-					this.f5();
-					sa.onInputEnter();
+				mounted: function() {
+					this.getBusinessType();
+					// 初始化数据 
+
 				}
 			})
 		</script>

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

@@ -51,8 +51,13 @@
 											</el-option>
 										</el-select>
 									</div>
-									<sa-item name="车牌号" placeholder="请输入车牌号" v-model="m.carNo" br>
-									</sa-item>
+									<div class="c-item">
+										<label class="c-label"><span style="color: red;">*</span>车牌号:</label>
+										<el-autocomplete v-model="m.carNo" placeholder="请输入车牌号"
+											@select="handleSelectCar" value-key='carNo'
+											:fetch-suggestions="queryCarAsync">
+										</el-autocomplete>
+									</div>
 									<sa-item type="num" name="车辆规格(米)" placeholder="请输入车辆规格" v-model="m.carSize" br>
 									</sa-item>
 									<sa-item name="作业人员" placeholder="请输入作业人员" v-model="m.operator" br>
@@ -71,7 +76,7 @@
 										placeholder="请输入车辆载重" v-model="m.carWeight" br>
 									</sa-item>
 									<div class="c-item">
-										<label class="c-label">作业时间:</label>
+										<label class="c-label"><span style="color: red;">*</span>作业时间:</label>
 										<el-date-picker type="datetime" value-format="yyyy-MM-dd HH:mm:ss"
 											v-model="m.operateTime"></el-date-picker>
 									</div>
@@ -142,6 +147,7 @@
 						carSize: '',
 						customerId: '',
 						carType: '载重',
+						operateTime:'',
 						carWeight: '',
 						itemTypeId: ''
 					}, // 实体对象 
@@ -165,10 +171,25 @@
 					}
 				},
 				methods: {
+					queryCarAsync(queryStr, cb) {
+						if(!queryStr){
+							cb([]);
+							return;
+						}
+						sa.ajaxNoLoading('/TbBusinessCar/searchInNotOutCar',{carNo:queryStr},function(resp){
+							cb(resp.data)
+						}.bind(this))
+					},
+					handleSelectCar(data) {
+						this.m.carNo = data.carNo;
+						if(!this.m.carSize){
+							this.m.carSize=data.carSize;
+						}
+					},
 					getCustomer() {
 						sa.ajax('/TbCostomer/getCurrentCustomerId', function(resp) {
 							let id = resp.data;
-							if (id == 1) {
+							if (id == '1') {
 								this.getCustomerList();
 							} else {
 								this.m.customerId = id;
@@ -236,6 +257,10 @@
 							sa.error('请输入车牌号')
 							return false;
 						}
+						if (!m.operateTime) {
+							sa.error('请选择作业时间')
+							return false;
+						}
 						let checkList = this.checkList;
 						let itemList = this.items;
 						let list = itemList.filter(obj => checkList.indexOf(obj.id) !== -1);

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

@@ -51,8 +51,13 @@
 											</el-option>
 										</el-select>
 									</div>
-									<sa-item name="车牌号" placeholder="请输入车牌号" v-model="m.carNo" br>
-									</sa-item>
+									<div class="c-item">
+										<label class="c-label"><span style="color: red;">*</span>车牌号:</label>
+										<el-autocomplete v-model="m.carNo" placeholder="请输入车牌号"
+											@select="handleSelectCar" value-key='carNo'
+											:fetch-suggestions="queryCarAsync">
+										</el-autocomplete>
+									</div>
 									<sa-item type="num" name="车辆规格(米)" placeholder="请输入车辆规格" v-model="m.carSize" br>
 									</sa-item>
 									<sa-item name="作业人员" placeholder="请输入作业人员" v-model="m.operator" br>
@@ -71,7 +76,7 @@
 										placeholder="请输入车辆载重" v-model="m.carWeight" br>
 									</sa-item>
 									<div class="c-item">
-										<label class="c-label">作业时间:</label>
+										<label class="c-label"><span style="color: red;">*</span>作业时间:</label>
 										<el-date-picker type="datetime" value-format="yyyy-MM-dd HH:mm:ss"
 											v-model="m.operateTime"></el-date-picker>
 									</div>
@@ -168,6 +173,21 @@
 					}
 				},
 				methods: {
+					queryCarAsync(queryStr, cb) {
+						if(!queryStr){
+							cb([]);
+							return;
+						}
+						sa.ajaxNoLoading('/TbBusinessCar/searchInNotOutCar',{carNo:queryStr},function(resp){
+							cb(resp.data)
+						}.bind(this))
+					},
+					handleSelectCar(data) {
+						this.m.carNo = data.carNo;
+						if(!this.m.carSize){
+							this.m.carSize=data.carSize;
+						}
+					},
 					itemChange() {
 						sa.ajax('/TbItem/getTypeItemList', {
 							pageNo: 1,
@@ -196,7 +216,7 @@
 					getCustomer() {
 						sa.ajax('/TbCostomer/getCurrentCustomerId', function(resp) {
 							let id = resp.data;
-							if (id == 1) {
+							if (id == '1') {
 								this.getCustomerList();
 							} else {
 								this.m.customerId = id;
@@ -261,6 +281,10 @@
 							sa.error('请输入车牌号')
 							return false;
 						}
+						if (!m.operateTime) {
+							sa.error('请选择作业时间')
+							return false;
+						}
 						let checkList = this.checkList;
 						let itemList = this.items;
 						let list = itemList.filter(obj => checkList.indexOf(obj.id) !== -1);

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

@@ -51,6 +51,7 @@
 					<sa-td name="车辆类型" prop="goodsName"></sa-td>
 					<sa-td name="业务项" prop="itemTypeName" width="160"></sa-td>
 					<sa-td name="车牌号" prop="carNo"></sa-td>
+					<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>
@@ -183,7 +184,7 @@
 					// 删除
 					del: function(data) {
 						sa.confirm('是否删除,此操作不可撤销', function() {
-							sa.ajax('/TbBusiness/deleteOtherBusiness?id=' + data.id, function(res) {
+							sa.ajax('/TbBusiness/deleteOtherBusiness?id=' + data.id+'&businessCarId='+data.businessCarId, function(res) {
 								sa.arrayDelete(this.dataList, data);
 								sa.ok('删除成功');
 								sa.f5TableHeight(); // 刷新表格高度 

+ 2 - 2
sp-admin/sa-view/tb-item-type/tb-item-list.html

@@ -40,12 +40,12 @@
 					<sa-td name="价格" prop="price"></sa-td>
 					<sa-td name="计价单位" prop="unit"></sa-td>
 					<sa-td name="税率(%)" prop="taxRate"></sa-td>
-					<sa-td name="适合规格(米)">
+					<sa-td name="适合规格(米)" width="120">
 						<template slot-scope="s">
 							<label>{{s.row.minLength}}—{{s.row.carLength}}</label>
 						</template>
 					</sa-td>
-					<sa-td name="适合载重(吨)">
+					<sa-td name="适合载重(kg)" width="120">
 						<template slot-scope="s">
 							<label>{{s.row.minWeight}}—{{s.row.maxWeight}}</label>
 						</template>

+ 1 - 1
sp-server/app.pid

@@ -1 +1 @@
-23292
+23640

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

@@ -60,6 +60,7 @@ import org.springframework.transaction.annotation.Transactional;
 
 import javax.annotation.Resource;
 import java.math.BigDecimal;
+import java.time.LocalDate;
 import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
 import java.util.*;
@@ -312,47 +313,24 @@ public class ApiService {
             throw new BusinessException("请选择明细");
         }
         String carNo = otherBusinessBO.getCarNo().trim().toUpperCase();
-        SoMap soMap = SoMap.getRequestSoMap();
-        List<TbBusinessSort> sorts = tbBusinessSortService.getList(soMap);
-        LocalDateTime now = LocalDateTime.now();
-        int i = 1;
-        for (TbBusinessSort tbBusinessSort : sorts) {
-            if (i > 1) {
-                TbBusinessSort beforeItem = sorts.get(i - 1);
-                String typeId = beforeItem.getTypeId();
-                Integer interval = tbBusinessSort.getIntervalTime();
-                LocalDateTime endTime = now.minusMinutes(interval);
-                int count = tbBusinessCarService.checkCarBusinessType(typeId, carNo, endTime.toString());
-                if (count > 0) {
-                    throw new BusinessException(beforeItem.getTypeName() + "后" + tbBusinessSort.getIntervalTime() + "才可以执行" + tbBusinessSort.getTypeName());
-                }
-            }
-            i++;
-        }
-        for (TbItem tbItem1 : tbItems) {
-            List<TbBusinessCar> tbBusinessCarList = tbBusinessCarService.findTodayRecord(carNo, tbItem1.getId());
-            if (!tbBusinessCarList.isEmpty()) {
-                throw new BusinessException("该车当天已有相同业务");
-            }
-        }
+        checkOtherBusiness(otherBusinessBO, tbItems, carNo);
         TbBusinessCar db = tbBusinessCarService.findNotOutCar(carNo);
         String customerId = otherBusinessBO.getCustomerId();
         TbItemType tbItemType = tbItemTypeService.getById(otherBusinessBO.getItemTypeId());
+        TbCar tbCar = tbCarService.findByCardNo(carNo);
         if (db == null) {
             db = tbBusinessCarService.findNotInCar(carNo);
             if (db == null) {
-                TbCar tbCar = tbCarService.findByCardNo(carNo);
                 db = new TbBusinessCar();
-                db.setPay(0).setCarNo(carNo).setBusinessType(TbBusiness.BusinessType.CAR_DISINCLE.getCode())
-                        .setIsLock(0).setCarCompany(tbCar != null ? tbCar.getCustomerName() : "临时");
-                db.setCarSize(otherBusinessBO.getCarSize()).setTimeUpdate(new Date()).setCustomerId(customerId)
-                        .setNo(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmm")) + RandomUtil.randomNumbers(4));
-                tbBusinessCarService.save(db);
             }
         }
+        db.setPay(0).setCarNo(carNo).setBusinessType(TbBusiness.BusinessType.CAR_DISINCLE.getCode())
+                .setBusinessType(TbBusiness.BusinessType.CAR_DISINCLE.getCode())
+                .setIsLock(0).setCarCompany(tbCar != null ? tbCar.getCustomerName() : "临时");
+        db.setCarSize(otherBusinessBO.getCarSize()).setTimeUpdate(new Date()).setCustomerId(customerId)
+                .setNo(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmm")) + RandomUtil.randomNumbers(4));
+        tbBusinessCarService.saveOrUpdate(db);
         TbBusiness tbBusiness = new TbBusiness();
-        db.setBusinessType(TbBusiness.BusinessType.CAR_DISINCLE.getCode());
-        tbBusinessCarService.updateById(db);
         tbBusiness.setBusinessCarId(db.getId()).setPayStep(tbItemType.getPayStep());
         TbCostomer tbCostomer = tbCostomerService.getById(customerId);
         if (tbCostomer != null) {
@@ -412,9 +390,10 @@ public class ApiService {
         }
         TbItemType tbItemType = tbItemTypeService.getById(otherBusinessBO.getItemTypeId());
         String businessId = otherBusinessBO.getId();
+        tbBusinessItemService.removeByBusinessId(businessId);
         String carNo = otherBusinessBO.getCarNo();
         String customerId = otherBusinessBO.getCustomerId();
-        tbBusinessItemService.removeByBusinessId(businessId);
+        checkOtherBusiness(otherBusinessBO, tbItems, carNo);
         TbCostomer tbCostomer = tbCostomerService.getById(customerId);
         TbBusiness tbBusiness = tbBusinessService.getById(businessId);
         tbBusiness.setOperateTime(otherBusinessBO.getOperateTime())
@@ -464,4 +443,46 @@ 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);
+        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);
+                String typeId = afterItem.getTypeId();
+                Integer interval = afterItem.getIntervalTime();
+                LocalDateTime endTime = operateTime.plusMinutes(interval);
+                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())) {
+                TbBusinessSort beforeItem = sorts.get(i - 1);
+                String typeId = beforeItem.getTypeId();
+                Integer interval = tbBusinessSort.getIntervalTime();
+                LocalDateTime endTime = operateTime.minusMinutes(interval);
+                int count = tbBusinessService.checkCarBusinessType(typeId, carNo, endTime.format(formatter),0);
+                if (count > 0) {
+                    throw new BusinessException("车辆:[" + carNo + "]" + beforeItem.getTypeName() + "后" + tbBusinessSort.getIntervalTime() + "分钟才可以执行" + tbBusinessSort.getTypeName());
+                }
+            }
+            String typeId = otherBusinessBO.getItemTypeId();
+            Integer singleIntervalTime = tbBusinessSort.getSingleIntervalTime();
+            String timeStart = operateTime.minusHours(singleIntervalTime).format(formatter);
+            String businessId = otherBusinessBO.getId();
+            String timeEnd = operateTime.plusHours(singleIntervalTime).format(formatter);
+            int count = tbBusinessService.checkCarBusinessType(typeId, carNo, timeStart, timeEnd, businessId);
+            if (count > 0) {
+                throw new BusinessException("车辆:[" + carNo + "]" + singleIntervalTime + "小时内已有相同作业");
+            }
+            i++;
+        }
+    }
+
 }

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

@@ -14,6 +14,7 @@ public class CarDisincle implements Serializable {
     private String carNo;
     private String cardSize;
     private String netWeight;
+    private String operateTime;
     private String goodsName;
     private String payStatus;
     private Integer adminConfirmInput;

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

@@ -319,7 +319,7 @@ public class TbBusinessController {
     }
 
     @RequestMapping("deleteOtherBusiness")
-    public AjaxJson deleteOtherBusiness(String id) {
+    public AjaxJson deleteOtherBusiness(String id,String businessCarId) {
         tbBusinessService.deleteOtherBusiness(id);
         return AjaxJson.getSuccess();
     }

+ 6 - 0
sp-server/src/main/java/com/pj/project/tb_business/TbBusinessMapper.java

@@ -6,6 +6,7 @@ import org.apache.ibatis.annotations.Mapper;
 
 import com.pj.utils.so.*;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
 import org.springframework.stereotype.Repository;
 
 /**
@@ -28,4 +29,9 @@ public interface TbBusinessMapper extends BaseMapper<TbBusiness> {
 
     List<CarDisincle> getCarDisincleList(SoMap soMap);
 
+    int checkCarBusinessType(@Param("typeId") String typeId,@Param("carNo") String carNo, @Param("operateTime")String operateTime,@Param("before")int before);
+
+    int checkCarBusinessTypeByTime(@Param("typeId") String typeId, @Param("carNo") String carNo,
+                                          @Param("timeStart")String timeStart,
+                                          @Param("timeEnd") String timeEnd,  @Param("businessId")String businessId);
 }

+ 34 - 1
sp-server/src/main/java/com/pj/project/tb_business/TbBusinessMapper.xml

@@ -71,7 +71,7 @@
 		SELECT
             a.id,
             b.id as businessCarId,
-            a.`no`,
+            a.`no`,a.operate_time,
             a.item_price,a.goods_name,a.admin_confirm_input,b.car_no,
             b.base_part_money,a.total_money,a.pay_money,a.create_time,
             b.real_in_time,b.real_out_time,b.car_no ,a.net_weight,a.card_size,a.pay_status,a.item_type_name
@@ -91,6 +91,39 @@
         </if>
         ORDER BY a.create_time desc
 	</select>
+    <select id="checkCarBusinessType" resultType="java.lang.Integer">
+        SELECT
+	        count(a.id)
+        FROM
+            tb_business_car a,
+            tb_business b
+        WHERE
+            a.id = b.business_car_id
+            AND a.car_no =#{carNo}
+            and b.item_type_id=#{typeId}
+            <if test="before==1">
+                AND DATE_FORMAT( b.operate_time, '%Y-%m-%d %H:%i:%s' ) &lt; #{operateTime}
+            </if>
+        <if test="before==0">
+            AND DATE_FORMAT( b.operate_time, '%Y-%m-%d %H:%i:%s' ) &gt; #{operateTime}
+        </if>
+    </select>
+    <select id="checkCarBusinessTypeByTime" resultType="java.lang.Integer">
+          SELECT
+	        count(b.id)
+        FROM
+            tb_business_car a,
+            tb_business b
+        WHERE
+            a.id = b.business_car_id
+            AND a.car_no =#{carNo}
+            and b.item_type_id=#{typeId}
+            AND DATE_FORMAT( b.operate_time, '%Y-%m-%d %H:%i:%s' ) &gt; #{timeStart}
+            and DATE_FORMAT( b.operate_time, '%Y-%m-%d %H:%i:%s' ) &lt; #{timeEnd}
+            <if test="businessId!=null and businessId !=''">
+                and b.id !=#{businessId}
+            </if>
+    </select>
 
 
 </mapper>

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

@@ -651,8 +651,19 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
 
     public void deleteOtherBusiness(String id) {
         TbBusiness db = super.getById(id);
+        List<TbBusiness>businesses=this.findOtherBusinessByCarId(db.getBusinessCarId());
+        if (businesses.size()==1){
+            tbBusinessCarService.removeById(db.getBusinessCarId());
+        }
         this.removeById(id);
         tbBusinessItemService.removeByBusinessId(id);
-        tbBusinessCarService.removeById(db.getBusinessCarId());
+    }
+
+    public int checkCarBusinessType(String typeId, String carNo, String operateTime,int before) {
+        return tbBusinessMapper.checkCarBusinessType(typeId,carNo,operateTime,before);
+    }
+
+    public int checkCarBusinessType(String typeId, String carNo, String timeStart, String timeEnd, String businessId) {
+        return tbBusinessMapper.checkCarBusinessTypeByTime(typeId,carNo,timeStart,timeEnd,businessId);
     }
 }

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

@@ -111,6 +111,12 @@ public class TbBusinessCarController {
     	SoMap soMap=SoMap.getRequestSoMap();
         return AjaxJson.getSuccessData( tbBusinessCarService.export(soMap));
     }
+    @RequestMapping("searchInNotOutCar")
+    public AjaxJson searchInNotOutCar() {
+		SoMap soMap=SoMap.getRequestSoMap();
+		String carNo=soMap.getString("carNo");
+        return AjaxJson.getSuccessData( tbBusinessCarService.findNotOutCarLike(carNo));
+    }
 
 
 	

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

@@ -132,9 +132,9 @@
         WHERE
             a.id = b.business_car_id
             AND b.id = c.business_id
-        AND car_no=#{carNo}
+        AND a.car_no=#{carNo}
         and c.business_type=#{typeId}
-        and DATE_FORMAT(c.create_time,'%y-%m-%d %H:%i') &lt;=#{timeEnd}
+        and DATE_FORMAT(b.operate_time,'%y-%m-%d %H:%i:%s') &gt;#{timeEnd}
     </select>
 
 

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

@@ -33,6 +33,7 @@ import com.pj.project.tb_car_no_color.TbCarNoColor;
 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;
+import com.pj.project4sp.global.BusinessException;
 import com.pj.project4sp.uploadfile.UploadConfig;
 import com.pj.utils.so.SoMap;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -81,15 +82,15 @@ public class TbBusinessCarService extends ServiceImpl<TbBusinessCarMapper, TbBus
     List<TbBusinessCar> getList(SoMap so) {
         List<TbBusinessCar> list = tbBusinessCarMapper.getList(so);
         List<TbCarNoColor> carNoColors = tbCarNoColorService.getFreeColor();
-       String colorStr= carNoColors.stream().map(TbCarNoColor::getCarNoColor).collect(Collectors.joining(""));
+        String colorStr = carNoColors.stream().map(TbCarNoColor::getCarNoColor).collect(Collectors.joining(""));
         for (TbBusinessCar tbBusinessCar : list) {
-            String color=tbBusinessCar.getColor();
+            String color = tbBusinessCar.getColor();
             TbCar tbCar = tbCarService.findByCardNo(tbBusinessCar.getCarNo());
             if (tbCar != null && !TbCar.CarTypeEnum.BUSINESS_CAR.getType().equals(tbCar.getCarType())) {
                 tbBusinessCar.setPayType("免费");
                 continue;
             }
-            if (StrUtil.isNotEmpty(color)&&colorStr.contains(color.substring(0,1))){
+            if (StrUtil.isNotEmpty(color) && colorStr.contains(color.substring(0, 1))) {
                 tbBusinessCar.setPayType("免费");
                 continue;
             }
@@ -101,7 +102,7 @@ public class TbBusinessCarService extends ServiceImpl<TbBusinessCarMapper, TbBus
                 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)) &&TbBusiness.BusinessType.HOLD_CAR.getCode().equals(tbBusinessCar.getBusinessType()))) {
+                        || (!CAR_LIST.contains(tbBusinessCar.getCarNo().substring(0, 1)) && TbBusiness.BusinessType.HOLD_CAR.getCode().equals(tbBusinessCar.getBusinessType()))) {
                     tbBusinessCar.setPayType("免费");
                     continue;
                 }
@@ -127,6 +128,7 @@ public class TbBusinessCarService extends ServiceImpl<TbBusinessCarMapper, TbBus
                 .isNull("real_out_time");
         return getOne(ew);
     }
+
     public TbBusinessCar findInAndHasBusinessCar(String carNo) {
         QueryWrapper<TbBusinessCar> ew = new QueryWrapper<>();
         ew.eq("car_no", carNo.toUpperCase())
@@ -172,6 +174,10 @@ public class TbBusinessCarService extends ServiceImpl<TbBusinessCarMapper, TbBus
         ew.eq("car_no", carNo.toUpperCase())
                 .isNull("real_out_time")
                 .isNotNull("real_in_time");
+        List<TbBusinessCar> list = list(ew);
+        if (list.size() > 1) {
+            throw new BusinessException("该车有多个未出场记录");
+        }
         return getOne(ew);
     }
 
@@ -385,14 +391,22 @@ public class TbBusinessCarService extends ServiceImpl<TbBusinessCarMapper, TbBus
     }
 
     public List<TbBusinessCar> searchOtherBusinessCar(String carNo) {
-       return tbBusinessCarMapper.searchOtherBusinessCar(carNo);
+        return tbBusinessCarMapper.searchOtherBusinessCar(carNo);
     }
 
     public List<TbBusinessCar> findTodayRecord(String carNo, String itemId) {
-        return tbBusinessCarMapper.findTodayRecord(carNo,itemId);
+        return tbBusinessCarMapper.findTodayRecord(carNo, itemId);
     }
 
     public int checkCarBusinessType(String typeId, String carNo, String timeEnd) {
-        return tbBusinessCarMapper.checkCarBusinessType(typeId,carNo,timeEnd);
+        return tbBusinessCarMapper.checkCarBusinessType(typeId, carNo, timeEnd);
+    }
+
+    public List<TbBusinessCar> findNotOutCarLike(String carNo) {
+        QueryWrapper<TbBusinessCar> ew = new QueryWrapper<>();
+        ew.select("car_no,car_size");
+        ew.like("car_no", carNo.toUpperCase());
+        List<TbBusinessCar>list=list(ew);
+        return list.stream().distinct().collect(Collectors.toList());
     }
 }

+ 15 - 0
sp-server/src/main/java/com/pj/project/tb_business_sort/AddBusinessSortBO.java

@@ -0,0 +1,15 @@
+package com.pj.project.tb_business_sort;
+
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+@Data
+@Accessors(chain = true)
+public class AddBusinessSortBO implements Serializable {
+    private String id;
+    private String typeId;
+    private String typeName;
+    private Integer interval;
+    private Integer singleIntervalTime;
+}

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

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

+ 5 - 21
sp-server/src/main/java/com/pj/project/tb_business_sort/TbBusinessSortController.java

@@ -28,30 +28,14 @@ public class TbBusinessSortController {
 
 	/** 增 */  
 	@RequestMapping("add")
-	@SaCheckPermission(TbBusinessSort.PERMISSION_CODE)
-	@Transactional(rollbackFor = Exception.class)
-	public AjaxJson add(TbBusinessSort t){
-		tbBusinessSortService.add(t);
-		t = tbBusinessSortService.getById(SP.publicMapper.getPrimarykey());
-		return AjaxJson.getSuccessData(t);
-	}
+	public AjaxJson add(){
+		SoMap so = SoMap.getRequestSoMap();
+		String addJson=so.getString("addJson");
+		tbBusinessSortService.add(addJson);
 
-	/** 删 */  
-	@RequestMapping("delete")
-	@SaCheckPermission(TbBusinessSort.PERMISSION_CODE)
-	public AjaxJson delete(Long id){
-		tbBusinessSortService.delete(id);
 		return AjaxJson.getSuccess();
 	}
-	
-	/** 删 - 根据id列表 */  
-	@RequestMapping("deleteByIds")
-	@SaCheckPermission(TbBusinessSort.PERMISSION_CODE)
-	public AjaxJson deleteByIds(){
-		List<Long> ids = SoMap.getRequestSoMap().getListByComma("ids", long.class); 
-		int line = SP.publicMapper.deleteByIds(TbBusinessSort.TABLE_NAME, ids);
-		return AjaxJson.getByLine(line);
-	}
+
 	
 	/** 改 */  
 	@RequestMapping("update")

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

@@ -24,7 +24,6 @@
 	<select id="getList" resultMap="model">
 		<include refid="select_sql"></include>
 		<where>
-			<if test=' this.has("id") '> and id = #{id} </if>
 			<if test=' this.has("name") '> and name = #{name} </if>
 			<if test=' this.has("typeName") '> and type_name = #{typeName} </if>
 			<if test=' this.has("sort") '> and sort = #{sort} </if>

+ 60 - 30
sp-server/src/main/java/com/pj/project/tb_business_sort/TbBusinessSortService.java

@@ -2,49 +2,79 @@ package com.pj.project.tb_business_sort;
 
 import java.util.List;
 
+import cn.hutool.json.JSONUtil;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.pj.project.tb_costomer.TbCostomer;
 import com.pj.project.tb_costomer.TbCostomerMapper;
+import com.pj.project.tb_item_type.TbItemType;
+import com.pj.project.tb_item_type.TbItemTypeService;
 import com.pj.utils.so.SoMap;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.Resource;
 
 /**
  * Service: tb_business_order -- 业务顺序
- * @author qzy 
+ *
+ * @author qzy
  */
 @Service
+@Transactional(rollbackFor = Exception.class)
 public class TbBusinessSortService extends ServiceImpl<TbBusinessSortMapper, TbBusinessSort> implements IService<TbBusinessSort> {
 
-	/** 底层 Mapper 对象 */
-	@Autowired
-	TbBusinessSortMapper tbBusinessOrderMapper;
-
-	/** 增 */
-	void add(TbBusinessSort t){
-		 super.save(t);
-	}
-
-	/** 删 */
-	void delete(Long id){
-		 this.removeById(id);
-	}
-
-	/** 改 */
-	void update(TbBusinessSort t){
-		this.updateById(t);
-	}
-
-	/** 查 */
-	TbBusinessSort getById(Long id){
-		return super.getById(id);
-	}
-
-	/** 查集合 - 根据条件(参数为空时代表忽略指定条件) */  
-	public List<TbBusinessSort> getList(SoMap so) {
-		return tbBusinessOrderMapper.getList(so);	
-	}
-	
+    /**
+     * 底层 Mapper 对象
+     */
+    @Autowired
+    TbBusinessSortMapper tbBusinessOrderMapper;
+    @Resource
+    private TbItemTypeService tbItemTypeService;
+
+    /**
+     * 增
+     */
+    void add(String addJson) {
+        remove(new QueryWrapper<>());
+        List<AddBusinessSortBO> businessSortBOS = JSONUtil.toList(addJson, AddBusinessSortBO.class);
+        int sort = 1;
+        for (AddBusinessSortBO addBusinessSortBO : businessSortBOS) {
+            TbBusinessSort tbBusinessSort = new TbBusinessSort();
+            tbBusinessSort.setSingleIntervalTime(addBusinessSortBO.getSingleIntervalTime())
+                    .setTypeId(addBusinessSortBO.getTypeId())
+                    .setTypeName(addBusinessSortBO.getTypeName()).setSort(sort)
+                    .setIntervalTime(addBusinessSortBO.getInterval());
+            if (sort == 1) {
+                tbBusinessSort.setIntervalTime(0);
+            }
+            this.save(tbBusinessSort);
+            sort++;
+        }
+    }
+
+    /**
+     * 改
+     */
+    void update(TbBusinessSort t) {
+        this.updateById(t);
+    }
+
+    /**
+     * 查
+     */
+    TbBusinessSort getById(Long id) {
+        return super.getById(id);
+    }
+
+    /**
+     * 查集合 - 根据条件(参数为空时代表忽略指定条件)
+     */
+    public List<TbBusinessSort> getList(SoMap so) {
+        return tbBusinessOrderMapper.getList(so);
+    }
+
 
 }

+ 1 - 1
sp-server/src/main/java/com/pj/project/tb_item_type/TbItemTypeService.java

@@ -64,7 +64,7 @@ public class TbItemTypeService extends ServiceImpl<TbItemTypeMapper, TbItemType>
     /**
      * 查集合 - 根据条件(参数为空时代表忽略指定条件)
      */
-    List<TbItemType> getList(SoMap so) {
+  public   List<TbItemType> getList(SoMap so) {
         List<TbItemType> list = tbItemTypeMapper.getList(so);
         String customerId = StpUserUtil.getCustomerId();
         if (!UserTypeEnum.PLATFORM_ADMIN.getCustomerId().equals(customerId)) {