소스 검색

管桩预约

fanzherong_v 1 일 전
부모
커밋
bbd5d2aecd

+ 12 - 0
snowy-admin-web/src/api/biz/bizAppointmentRecordApi.js

@@ -17,6 +17,10 @@ export default {
 	bizAppointmentLoadRecordPage(data) {
 		return request('getLoadPage', data, 'get')
 	},
+	//获取管桩预约列表
+	bizAppointmentPipeRecordPage(data) {
+		return request('getPipePage', data, 'get')
+	},
 	// 提交预约记录表单 edit为true时为编辑,默认为新增
 	bizAppointmentRecordSubmitForm(data, edit = false) {
 		return request(edit ? 'edit' : 'add', data)
@@ -29,6 +33,10 @@ export default {
 	bizAppointmentLoadSubmitForm(data, edit = false) {
 		return request(edit ? 'editLoad' : 'addLoad', data)
 	},
+	//管桩预约
+	bizAppointmentPipeSubmitForm(data,edit = false){
+		return request(edit ? 'editPipeAppoint' : 'addPipeAppoint', data)
+	},
 	// 删除预约记录
 	bizAppointmentRecordDelete(data) {
 		return request('delete', data)
@@ -67,6 +75,10 @@ export default {
 	cancelAppointmentRecord(data){
 		return request('cancelAppointmentRecord',data)
 	},
+	//取消管桩预约
+	replacePipeAppoint(data){
+		return request('replacePipeAppoint',data)
+	},
 	//调整订单
 	adjustOrder(data){
 		return request('adjustOrder',data)

+ 124 - 0
snowy-admin-web/src/views/biz/bizpipeappoint/detail.vue

@@ -0,0 +1,124 @@
+<template>
+	<xn-form-container title="详情" :width="900" :visible="visible" :destroy-on-close="true" @close="onClose">
+		<a-form ref="formRef" :model="formData" :label-col="labelCol4" :wrapper-col="wrapperCol20">
+			<a-descriptions :column="4" size="middle" bordered class="mb-2" :label-style="labelStyle" :contentStyle="contentStyle">
+				<a-descriptions-item label="管桩计划单号" :span="2">{{ formData.planNumber }}</a-descriptions-item>
+				<a-descriptions-item label="车牌号" :span="2">{{ formData.licenseNumber }}</a-descriptions-item>
+				<a-descriptions-item label="司机姓名" :span="2">{{ formData.driverName }}</a-descriptions-item>
+				<a-descriptions-item label="司机电话" :span="2">{{ formData.driverMobile }}</a-descriptions-item>
+				<a-descriptions-item label="入场时间" :span="2">{{ formData.enterTime }}</a-descriptions-item>
+				<a-descriptions-item label="出场时间" :span="2">{{ formData.leaveTime }}</a-descriptions-item>
+				<a-descriptions-item label="创建人" :span="2">{{ formData.createUserName }}</a-descriptions-item>
+				<a-descriptions-item label="创建时间" :span="2">{{ formData.createTime }}</a-descriptions-item>
+
+				<a-descriptions-item label="预约状态" :span="2">
+					<a-tag
+						:color="
+							formData.status === '1'
+								? 'volcano'
+								: formData.status === '2'
+								  ? 'red'
+								  : formData.status === '3'
+								  ? 'processing'
+								  : formData.status === '4'
+								  ? 'warning'
+								  : formData.status === '5'
+								  ? 'magenta'
+								  : formData.status === '6'
+								  ? 'orange'
+								  : formData.status === '7'
+								  ? 'gold'
+								   : formData.status === '8'
+								  ? 'lime'
+								   : formData.status === '9'
+								  ? 'green'
+								  : formData.status === '10'
+								  ? 'cyan'
+								  : formData.status === '11'
+								  ? 'success'
+								  : formData.status === '12'
+								  ? 'blue'
+								  : formData.status === '13'
+								  ? 'geekblue'
+								  : 'error'
+						"
+					>
+						{{ $TOOL.dictTypeData('appointment_status', formData.status) }}
+					</a-tag>
+				</a-descriptions-item>
+			</a-descriptions>
+		</a-form>
+	</xn-form-container>
+</template>
+
+<script setup name="recordDoubleForm">
+	import { cloneDeep } from 'lodash-es'
+	import sysConfig from "@/config";
+	// 默认是关闭状态
+	const visible = ref(false)
+	const formData = ref({})
+	const table = ref()
+	const resultJson = ref()
+
+	const labelStyle = {
+		width: '20%'
+	}
+	const contentStyle = {
+		width: '30%'
+	}
+
+	const labelCol4 = ref({span: 4, style: 'width: 26%; line-height: 20px; white-space: normal',})
+	const labelCol8 = ref({span: 8, style: 'width: 26%; line-height: 20px; white-space: normal',})
+	const wrapperCol20 = ref({span: 20})
+
+	const fileList = ref([])
+	// 打开抽屉
+	const onOpen = (record) => {
+		visible.value = true
+		//getRecordDoubleDetail(record)
+		if(record){
+			let recordData = cloneDeep(record)
+			formData.value = Object.assign({}, recordData)
+			fileList.value = []
+			if(formData.value.unloadImg!=null){
+				for (var i=0;i<formData.value.unloadImg.split(',').length;i++){
+					fileList.value.push({
+						name: formData.value.unloadName.split(',')[i],
+						url:sysConfig.PREVIEW_PATH + formData.value.unloadImg.split(',')[i]
+					})
+				}
+			}
+		}
+
+	}
+	const getRecordDoubleDetail = (record) => {
+		const param = {
+			id: record.id
+		}
+		tbRecordDoubleApi.recordDoubleDetailPic(param).then((data) => {
+			Object.assign(record, data)
+			formData.value = record
+		})
+	}
+	// 关闭抽屉
+	const onClose = () => {
+		resultJson.value = ''
+		visible.value = false
+	}
+
+	// 调用这个函数将子组件的一些数据和方法暴露出去
+	defineExpose({
+		onOpen
+	})
+</script>
+
+<style scoped>
+	.imgDiv ::v-deep .ant-image {
+		margin-left: 20px;
+		margin-top: 10px;
+	}
+	.imgDiv ::v-deep .ant-image-mask-info {
+		margin-left: 20px;
+		margin-top: 10px;
+	}
+</style>

+ 9 - 8
snowy-admin-web/src/views/biz/bizpipeappoint/form.vue

@@ -7,13 +7,13 @@
 		@close="onClose"
 	>
 		<a-form ref="formRef" :model="formData" :rules="formRules" :wrapper-col="wrapperCol" :label-col="labelCol">
-			<a-form-item label="管桩计划:" name="planId">
-				<a-select v-model:value="formData.planId" placeholder="请选择管桩计划"
+			<a-form-item label="管桩计划:" name="orderId">
+				<a-select v-model:value="formData.orderId" placeholder="请选择管桩计划"
 						  :options="planIdList"
 				> </a-select>
 			</a-form-item>
-			<a-form-item label="车牌号:" name="licensePlate">
-				<a-input v-model:value="formData.licensePlate" placeholder="请输入车牌号" allow-clear />
+			<a-form-item label="车牌号:" name="licenseNumber">
+				<a-input v-model:value="formData.licenseNumber" placeholder="请输入车牌号" allow-clear />
 			</a-form-item>
 			<a-form-item label="司机姓名:" name="driverName">
 				<a-input v-model:value="formData.driverName" placeholder="请输入司机姓名" allow-clear />
@@ -34,6 +34,7 @@
 	import { required } from '@/utils/formRules'
 	import bizPipeAppointApi from '@/api/biz/bizPipeAppointApi'
 	import bizPipePlanApi from "@/api/biz/bizPipePlanApi";
+	import bizAppointmentRecordApi from "@/api/biz/bizAppointmentRecordApi";
 
 	// 抽屉状态
 	const open = ref(false)
@@ -72,8 +73,8 @@
 	}
 	// 默认要校验的
 	const formRules = {
-		planId:[required('请选择管桩计划')],
-		licensePlate:[required('请输入车牌号')],
+		orderId:[required('请选择管桩计划')],
+		licenseNumber:[required('请输入车牌号')],
 		driverName:[required('请输入司机姓名')],
 		driverMobile:[required('请输入司机电话')],
 	}
@@ -84,8 +85,8 @@
 			.then(() => {
 				submitLoading.value = true
 				const formDataParam = cloneDeep(formData.value)
-				bizPipeAppointApi
-					.bizPipeAppointSubmitForm(formDataParam, formDataParam.id)
+				bizAppointmentRecordApi
+					.bizAppointmentPipeSubmitForm(formDataParam, formDataParam.id)
 					.then(() => {
 						onClose()
 						emit('successful')

+ 190 - 6
snowy-admin-web/src/views/biz/bizpipeappoint/index.vue

@@ -1,4 +1,48 @@
 <template>
+	<a-card :bordered="false" style="margin-bottom: 10px" class="mb-2">
+		<a-form ref="searchFormRef" name="advanced_search" :model="searchFormState" class="ant-advanced-search-form">
+			<a-row :gutter="24">
+				<a-col :span="6">
+					<a-form-item label="管桩计划单号" name="planNumber">
+						<a-input v-model:value="searchFormState.planNumber" placeholder="管桩计划单号查询" />
+					</a-form-item>
+				</a-col>
+				<a-col :span="6">
+					<a-form-item label="车牌号" name="licenseNumber">
+						<a-input v-model:value="searchFormState.licenseNumber" placeholder="车牌号码查询" />
+					</a-form-item>
+				</a-col>
+				<a-col :span="6">
+					<a-form-item label="司机名称" name="driverName">
+						<a-input v-model:value="searchFormState.driverName" placeholder="司机名称查询" />
+					</a-form-item>
+				</a-col>
+				<template v-if="advanced">
+					<a-col :span="6">
+						<a-form-item label="司机电话" name="driverMobile">
+							<a-input v-model:value="searchFormState.driverMobile" placeholder="司机电话查询" />
+						</a-form-item>
+					</a-col>
+
+					<a-col :span="6">
+						<a-form-item label="预约状态" name="status">
+							<a-select v-model:value="searchFormState.status" placeholder="预约状态查询"
+									  :options="statusList"
+							> </a-select>
+						</a-form-item>
+					</a-col>
+				</template>
+				<a-col :span="6">
+					<a-button type="primary" @click="tableRef.refresh()">查询</a-button>
+					<a-button style="margin: 0 8px" @click="reset">重置</a-button>
+					<a @click="toggleAdvanced" style="margin-left: 8px">
+						{{ advanced ? '收起' : '展开' }}
+						<component :is="advanced ? 'up-outlined' : 'down-outlined'" />
+					</a>
+				</a-col>
+			</a-row>
+		</a-form>
+	</a-card>
 	<a-card :bordered="false">
 		<s-table
 			ref="tableRef"
@@ -17,36 +61,118 @@
 			</template>
 			<template #bodyCell="{ column, record }">
 				<template v-if="column.dataIndex === 'action'">
-					<a-space>
+<!--					<a-space>
 						<a @click="formRef.onOpen(record)" v-if="hasPerm('bizPipeAppointEdit')">编辑</a>
 						<a-divider type="vertical" v-if="hasPerm(['bizPipeAppointEdit', 'bizPipeAppointDelete'], 'and')" />
 						<a-popconfirm title="确定要删除吗?" @confirm="deleteBizPipeAppoint(record)">
 							<a-button type="link" danger size="small" v-if="hasPerm('bizPipeAppointDelete')">删除</a-button>
 						</a-popconfirm>
+					</a-space>-->
+
+					<a-space>
+						<a-dropdown>
+							<a class="ant-dropdown-link">
+								更多
+								<DownOutlined />
+							</a>
+
+							<template #overlay>
+								<a-menu>
+									<a-menu-item>
+										<a @click="detailRef.onOpen(record)">详情</a>
+									</a-menu-item>
+									<a-menu-item v-if="hasPerm('bizAppointmentRecordEdit') && (record.status == '2' || record.status == '4')">
+										<a @click="formRef.onOpen(record)" >编辑</a>
+									</a-menu-item>
+									<a-menu-item v-if="hasPerm('bizAppointmentRecordDelete') && (record.status == '2' || record.status == '4')">
+										<a style="color:red" type="link" danger size="small" @click="deleteConfig(record)">删除</a>
+									</a-menu-item>
+									<a-menu-item v-if="record.status=='4'">
+										<a style="color:green"  @click="cancel(record)" >取消</a>
+									</a-menu-item>
+								</a-menu>
+							</template>
+						</a-dropdown>
 					</a-space>
 				</template>
+				<template v-if="column.dataIndex === 'status'">
+					<a-tag
+						:color="
+							record.status === '1'
+								? 'volcano'
+								: record.status === '2'
+								  ? 'red'
+								  : record.status === '3'
+								  ? 'processing'
+								  : record.status === '4'
+								  ? 'warning'
+								  : record.status === '5'
+								  ? 'magenta'
+								  : record.status === '6'
+								  ? 'orange'
+								  : record.status === '7'
+								  ? 'gold'
+								   : record.status === '8'
+								  ? 'lime'
+								   : record.status === '9'
+								  ? 'green'
+								  : record.status === '10'
+								  ? 'cyan'
+								  : record.status === '11'
+								  ? 'success'
+								  : record.status === '12'
+								  ? 'blue'
+								  : record.status === '13'
+								  ? 'geekblue'
+								  : 'error'
+						"
+					>
+						{{ $TOOL.dictTypeData('appointment_status', record.status) }}
+					</a-tag>
+				</template>
 			</template>
 		</s-table>
 	</a-card>
 	<Form ref="formRef" @successful="tableRef.refresh()" />
+	<Detail ref="detailRef" @successful="tableRef.refresh()" />
 </template>
 
 <script setup name="bizpipeappoint">
 	import { cloneDeep } from 'lodash-es'
 	import Form from './form.vue'
 	import bizPipeAppointApi from '@/api/biz/bizPipeAppointApi'
+	import bizAppointmentRecordApi from "@/api/biz/bizAppointmentRecordApi"
+	import tool from '@/utils/tool'
+	import {ExclamationCircleOutlined} from '@ant-design/icons-vue';
+	import {Modal} from 'ant-design-vue';
+	import {createVNode} from 'vue';
+	import Detail from "./detail.vue";
+
+	//查询数据
+	const searchFormState = ref({})
+	const searchFormRef = ref()
+	const statusList = tool.dictList('appointment_status')
+
+	// 查询区域显示更多控制
+	const advanced = ref(false)
+	const toggleAdvanced = () => {
+		advanced.value = !advanced.value
+	}
+
+	const submitLoading = ref(false)
 	const tableRef = ref()
 	const formRef = ref()
+	const detailRef = ref()
 	const toolConfig = { refresh: true, height: true, columnSetting: true, striped: false }
 	const columns = [
 		{
 			title: '管桩计划单号',
-			dataIndex: 'planId',
+			dataIndex: 'planNumber',
 			align:'center'
 		},
 		{
 			title: '车牌号',
-			dataIndex: 'licensePlate',
+			dataIndex: 'licenseNumber',
 			align:'center'
 		},
 		{
@@ -61,12 +187,12 @@
 		},
 		{
 			title: '入场时间',
-			dataIndex: 'beginTime',
+			dataIndex: 'enterTime',
 			align:'center'
 		},
 		{
 			title: '出场时间',
-			dataIndex: 'endTime',
+			dataIndex: 'leaveTime',
 			align:'center'
 		},
 		{
@@ -101,7 +227,9 @@
 		}
 	}
 	const loadData = (parameter) => {
-		return bizPipeAppointApi.bizPipeAppointPage(parameter).then((data) => {
+		const searchFormParam = cloneDeep(searchFormState.value)
+		searchFormParam.type = '5'
+		return bizAppointmentRecordApi.bizAppointmentPipeRecordPage(Object.assign(parameter, searchFormParam)).then((data) => {
 			return data
 		})
 	}
@@ -121,6 +249,62 @@
 			tableRef.value.refresh(true)
 		})
 	}
+
+	//取消预约
+	const cancel = (record) => {
+
+		Modal.confirm({
+			title: '确定要取消吗?',
+			icon: createVNode(ExclamationCircleOutlined),
+			content: '',
+			onOk() {
+				submitLoading.value = true
+				let params =
+					{
+						id: record.id
+					}
+
+
+				bizAppointmentRecordApi
+					.replacePipeAppoint(params)
+					.then(() => {
+						tableRef.value.refresh(true)
+					})
+					.finally(() => {
+						submitLoading.value = false
+					})
+			},
+			onCancel() {}
+		})
+	}
+
+	// 删除
+	const deleteConfig = (record) => {
+
+		Modal.confirm({
+			title: '确定删除该数据吗?',
+			icon: createVNode(ExclamationCircleOutlined),
+			content: '',
+			onOk() {
+				submitLoading.value = true
+				let params = [
+					{
+						id: record.id
+					}
+				]
+
+				bizAppointmentRecordApi
+					.bizAppointmentRecordDelete(params)
+					.then(() => {
+						tableRef.value.refresh(true)
+					})
+					.finally(() => {
+						submitLoading.value = false
+					})
+			},
+			onCancel() {}
+		})
+	}
 	// 批量删除
 	const deleteBatchBizPipeAppoint = (params) => {
 		bizPipeAppointApi.bizPipeAppointDelete(params).then(() => {

+ 101 - 6
snowy-admin-web/src/views/biz/bizpipeplan/index.vue

@@ -40,11 +40,11 @@
 			</template>
 			<template #bodyCell="{ column, record }">
 				<template v-if="column.dataIndex === 'action'">
-<!--					<a-space>
-						<a @click="formRef.onOpen(record)" v-if="hasPerm('bizPipePlanEdit')">编辑</a>
-						<a-divider type="vertical" v-if="hasPerm(['bizPipePlanEdit', 'bizPipePlanDelete'], 'and')" />
-						<a style="color:red" size="small"  v-if="hasPerm('bizPipePlanDelete')" type="link" @click="deleteConfig(record)">删除</a>
-					</a-space>-->
+
+					<a @click="showModal(record)" v-if="(record.status == '1' || record.status == '2')">二维码</a>
+
+					<a-divider type="vertical" v-if="(record.status == '1' || record.status == '2') "/>
+
 					<a-dropdown>
 						<a class="ant-dropdown-link">
 							更多
@@ -97,6 +97,30 @@
 		</s-table>
 	</a-card>
 	<Form ref="formRef" @successful="tableRef.refresh()" />
+
+	<a-modal v-model:visible="open" title="二维码" width="600px" style="height: 700px">
+		<div id="qrcode" style="text-align: center; margin:  15px 5px 15px 5px">
+			<a-row>
+				<a-col :span="13" id="colFlag">
+					<div style="margin-top:10px;font-size:16px;">
+						<p id="projectCodeFlag">计划编码:{{ nowRecord.planNumber }}</p>
+						<p id="projectCodeFlag">计划名称:{{ nowRecord.planName }}</p>
+<!--						<p id="projectCodeFlag">预约次数:{{ nowRecord.planCount }}</p>
+						<p id="projectCodeFlag">已约次数:{{ nowRecord.planAlreadyCount }}</p>-->
+						<p id="projectCodeFlag">开始时间:{{ nowRecord.beginTime }}</p>
+						<p id="projectCodeFlag">结束时间:{{ nowRecord.endTime }}</p>
+					</div>
+				</a-col>
+				<a-col :span="11">
+					<a-image width="250"  height="100%" :src="qrCodeUrl.codeUrl"></a-image>
+				</a-col>
+			</a-row>
+		</div>
+		<template #footer>
+			<a-button @click="closeQrCode">关闭</a-button>
+			<a-button type="primary" @click="downloadFile">下载</a-button>
+		</template>
+	</a-modal>
 </template>
 
 <script setup name="bizpipeplan">
@@ -106,6 +130,8 @@
 	import {ExclamationCircleOutlined} from '@ant-design/icons-vue';
 	import {Modal} from 'ant-design-vue';
 	import {createVNode} from 'vue';
+	import QRCode from 'qrcode'
+	import html2canvas from 'html2canvas'
 
 
 	//查询数据
@@ -133,7 +159,7 @@
 			align:'center'
 		},
 		{
-			title: '已约次数',
+			title: '已约次数',
 			dataIndex: 'planAlreadyCount',
 			align:'center'
 		},
@@ -264,4 +290,73 @@
 			tableRef.value.clearRefreshSelected()
 		})
 	}
+
+
+	//二维码
+	const open = ref(false);
+	const qrCodeUrl = ref({})
+	const nowRecord = ref()
+	const showModal = (record) => {
+		nowRecord.value = record
+		open.value = true;
+		getQrCode(record)
+
+	};
+
+	const getQrCode = (record) => {
+		//QRCode.toDataURL("id:"+record.id+"saleCode:"+record.saleCode, {
+		let param = {
+			id:record.id,
+			loadNumber:record.planNumber,
+			type:'5'
+		}
+		QRCode.toDataURL(JSON.stringify(param), {
+			errorCorrectionLevel: 'H',
+			margin: 1,
+			height: 206,
+			width: 206,
+			type: '10',
+			scal: 177,
+			color: {
+				dark: '#000' // 二维码背景颜色
+			},
+			rendererOpts: {
+				quality: 0.9
+			}
+		})
+			.then((url) => {
+				qrCodeUrl.value.codeUrl = url
+			})
+			.catch((err) => {
+				console.error(err)
+			})
+	}
+
+	const closeQrCode = () => {
+		open.value = false;
+	}
+
+	// 下载二维码
+	const downloadFile = () => {
+		const qrcodeDiv = document.getElementById('qrcode');
+		html2canvas(qrcodeDiv, {
+			logging: false,
+			allowTaint: true,
+			scale: window.devicePixelRatio,
+			scrollY: 0,
+			scrollX: 0,
+			useCORS: true,
+			backgroundColor: '#ffffff'
+		})
+			.then(function (canvas) {
+				const a = window.document.createElement('a')
+				a.href = canvas.toDataURL('image/png')
+				a.download = '二维码'
+				a.click()
+				this.$message.success('正在进行下载保存')
+			})
+			.catch((err) => {
+				console.log(err)
+			})
+	}
 </script>

+ 56 - 0
snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/bizappointmentrecord/controller/BizAppointmentRecordController.java

@@ -326,6 +326,62 @@ public class BizAppointmentRecordController {
         return CommonResult.data(bizAppointmentRecordService.getLoadPage(bizAppointmentRecordPageParam));
     }
 
+    /**
+     * 添加管桩预约
+     *
+     * @author fanzherong
+     * @date  2025/03/24 14:47
+     */
+    @Operation(summary = "添加管桩预约")
+    @CommonLog("添加管桩预约")
+    @CommonNoRepeat
+    @PostMapping("/biz/bizappointmentrecord/addPipeAppoint")
+    public CommonResult<String> addPipeAppoint(@RequestBody @Valid BizAppointmentRecordAddParam bizAppointmentRecordAddParam) {
+        bizAppointmentRecordService.addPipeAppoint(bizAppointmentRecordAddParam);
+        return CommonResult.ok();
+    }
+
+    /**
+     * 编辑管桩预约记录
+     *
+     * @author fanzherong
+     * @date  2025/03/24 14:47
+     */
+    @Operation(summary = "编辑管桩预约记录")
+    @CommonLog("编辑管桩预约记录")
+    @PostMapping("/biz/bizappointmentrecord/editPipeAppoint")
+    public CommonResult<String> editPipeAppoint(@RequestBody @Valid BizAppointmentRecordEditParam bizAppointmentRecordEditParam) {
+        bizAppointmentRecordService.editPipeAppoint(bizAppointmentRecordEditParam);
+        return CommonResult.ok();
+    }
+
+    /**
+     * 获取管桩预约列表
+     *
+     * @author fanzherong
+     * @date  2025/03/24 14:47
+     */
+    @Operation(summary = "获取管桩预约列表")
+    @SaCheckPermission("/biz/bizappointmentrecord/getPipePage")
+    @GetMapping("/biz/bizappointmentrecord/getPipePage")
+    public CommonResult<Page<BizAppointmentRecord>> getPipePage(BizAppointmentRecordPageParam bizAppointmentRecordPageParam) {
+        return CommonResult.data(bizAppointmentRecordService.getPipePage(bizAppointmentRecordPageParam));
+    }
+
+    /**
+     * 取消管桩预约记录
+     *
+     * @author fanzherong
+     * @date  2025/03/24 14:47
+     */
+    @Operation(summary = "取消管桩预约记录")
+    @CommonLog("取消管桩预约记录")
+    @PostMapping("/biz/bizappointmentrecord/replacePipeAppoint")
+    public CommonResult<String> replacePipeAppoint(@RequestBody @Valid BizAppointmentRecordEditParam bizAppointmentRecordEditParam) {
+        bizAppointmentRecordService.replacePipeAppoint(bizAppointmentRecordEditParam);
+        return CommonResult.ok();
+    }
+
     /**
      * 其他预约_记录分页
      *

+ 11 - 0
snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/bizappointmentrecord/entity/BizAppointmentRecord.java

@@ -240,4 +240,15 @@ public class BizAppointmentRecord extends CommonEntity {
     @Schema(description = "操作时间")
     private String authorizeTime;
 
+    /**管桩计划单号*/
+    @TableField(exist = false)
+    private String planNumber;
+
+
+    /**入场时间*/
+    private Date enterTime;
+
+    /**出场时间*/
+    private Date leaveTime;
+
 }

+ 2 - 0
snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/bizappointmentrecord/mapper/BizAppointmentRecordMapper.java

@@ -39,4 +39,6 @@ public interface BizAppointmentRecordMapper extends BaseMapper<BizAppointmentRec
     List<BizAppointmentRecord> getRecordList(@Param("ew") QueryWrapper<BizAppointmentRecord> ew);
 
     Page<BizAppointmentRecord> getLoadPage(@Param("page") Page<BizAppointmentRecord> page,@Param("ew") QueryWrapper<BizAppointmentRecord> ew);
+
+    Page<BizAppointmentRecord> getPipePage(@Param("page") Page<BizAppointmentRecord> page,@Param("ew") QueryWrapper<BizAppointmentRecord> ew);
 }

+ 37 - 0
snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/bizappointmentrecord/mapper/mapping/BizAppointmentRecordMapper.xml

@@ -184,4 +184,41 @@
                 LEFT JOIN biz_load_time blt ON blt.id = bar.load_time_id
             ${ew.customSqlSegment}
     </select>
+
+    <select id="getPipePage"
+            resultType="vip.xiaonuo.biz.modular.bizappointmentrecord.entity.BizAppointmentRecord">
+        SELECT
+            bar.id,
+            bar.order_id,
+            bar.license_number,
+            bar.driver_name,
+            bar.driver_mobile,
+            bar.STATUS,
+            bar.appointment_reason,
+            bar.over_id,
+            br.id recordId,
+            bar.queue_number,
+            br.driver_sign,
+            br.unload_weight / 1000 unload_weight,
+            br.unload_img,
+            br.unload_name,
+            br.audit_sign,
+            bar.appointment_type,
+            bar.appointment_classify,
+            bar.create_time,
+            bar.create_user,
+            bar.load_point_id,
+            bar.load_time_id,
+            br.complete_send_time,
+            bpp.plan_number,
+            bpp.plan_name,
+            bar.enter_time,
+            bar.leave_time
+        FROM
+            biz_appointment_record bar
+                LEFT JOIN biz_record br ON bar.id = br.appointment_id
+                LEFT JOIN biz_pipe_plan bpp ON bar.order_id = bpp.id
+                LEFT JOIN biz_excess_config bec ON bec.id = bar.over_id
+            ${ew.customSqlSegment}
+    </select>
 </mapper>

+ 3 - 0
snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/bizappointmentrecord/param/BizAppointmentRecordPageParam.java

@@ -88,4 +88,7 @@ public class BizAppointmentRecordPageParam {
     /**起卸单号*/
     private String loadNumber;
 
+    /**管桩计划单号*/
+    private String planNumber;
+
 }

+ 11 - 0
snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/bizappointmentrecord/service/BizAppointmentRecordService.java

@@ -132,6 +132,17 @@ public interface BizAppointmentRecordService extends IService<BizAppointmentReco
     /**起卸预约编辑*/
     void editLoad(BizAppointmentRecordEditParam bizAppointmentRecordEditParam);
 
+    /**管桩预约新增*/
+    void addPipeAppoint(BizAppointmentRecordAddParam bizAppointmentRecordAddParam);
+
+    /**管桩预约编辑*/
+    void editPipeAppoint(BizAppointmentRecordEditParam bizAppointmentRecordEditParam);
+
+    /**管桩预约列表**/
+    Page<BizAppointmentRecord> getPipePage(BizAppointmentRecordPageParam bizAppointmentRecordPageParam);
+
+    /**取消管桩预约*/
+    void replacePipeAppoint(BizAppointmentRecordEditParam bizAppointmentRecordEditParam);
 
 
     /**

+ 201 - 0
snowy-plugin/snowy-plugin-biz/src/main/java/vip/xiaonuo/biz/modular/bizappointmentrecord/service/impl/BizAppointmentRecordServiceImpl.java

@@ -58,6 +58,8 @@ import vip.xiaonuo.biz.modular.bizorderconfig.entity.BizOrderConfig;
 import vip.xiaonuo.biz.modular.bizorderconfig.service.BizOrderConfigService;
 import vip.xiaonuo.biz.modular.bizordersupplier.entity.BizOrderSupplier;
 import vip.xiaonuo.biz.modular.bizordersupplier.service.BizOrderSupplierService;
+import vip.xiaonuo.biz.modular.bizpipeplan.entity.BizPipePlan;
+import vip.xiaonuo.biz.modular.bizpipeplan.service.BizPipePlanService;
 import vip.xiaonuo.biz.modular.bizsupplier.entity.BizSupplierTransport;
 import vip.xiaonuo.biz.modular.bizsupplier.service.BizSupplierTransportService;
 import vip.xiaonuo.biz.modular.customer.entity.BizCustomer;
@@ -151,6 +153,9 @@ public class BizAppointmentRecordServiceImpl extends ServiceImpl<BizAppointmentR
     @Resource
     private BizLoadAppointSupplierService bizLoadAppointSupplierService;
 
+    @Resource
+    private BizPipePlanService bizPipePlanService;
+
     @Override
     public Page<BizAppointmentRecord> page(BizAppointmentRecordPageParam bizAppointmentRecordPageParam) {
         QueryWrapper<BizAppointmentRecord> queryWrapper = getQueryWrapper(bizAppointmentRecordPageParam);
@@ -201,6 +206,10 @@ public class BizAppointmentRecordServiceImpl extends ServiceImpl<BizAppointmentR
         if (ObjectUtil.isNotEmpty(bizAppointmentRecordPageParam.getLoadNumber())) {
             queryWrapper.like("bla.load_number", bizAppointmentRecordPageParam.getLoadNumber());
         }
+        //管桩计划单号
+        if (ObjectUtil.isNotEmpty(bizAppointmentRecordPageParam.getPlanNumber())){
+            queryWrapper.like("bpp.plan_number",bizAppointmentRecordPageParam.getPlanNumber());
+        }
         queryWrapper.eq("bar.delete_flag", "NOT_DELETE");
         queryWrapper.orderByDesc("bar.create_time");
         return queryWrapper;
@@ -1281,6 +1290,8 @@ public class BizAppointmentRecordServiceImpl extends ServiceImpl<BizAppointmentR
         }
     }
 
+
+
     public void getLoadTimeCount(BizAppointmentRecordEditParam bizAppointmentRecordEditParam, BizAppointmentRecord bizAppointmentRecord) {
         lock.lock();
         try {
@@ -1303,6 +1314,196 @@ public class BizAppointmentRecordServiceImpl extends ServiceImpl<BizAppointmentR
 
     }
 
+    @Transactional
+    @Override
+    public void addPipeAppoint(BizAppointmentRecordAddParam bizAppointmentRecordAddParam) {
+        checkPipeParam(bizAppointmentRecordAddParam);
+        //获取流程配置判断预约是否需要审核
+        BizConfig bizConfig = bizConfigService.getOne(new QueryWrapper<BizConfig>().lambda().last("limit 1"));
+        BizAppointmentRecord bizAppointmentRecord = BeanUtil.toBean(bizAppointmentRecordAddParam, BizAppointmentRecord.class);
+        if (ObjectUtil.isNotNull(bizConfig)) {
+            if (StringUtils.equals(bizConfig.getTemporaryAuditSwitch(), "1")) {
+                //开启审核,设置待审核状态
+                bizAppointmentRecord.setStatus("1");
+            } else {
+                //未开启审核,设置待入场状态
+                bizAppointmentRecord.setStatus("4");
+            }
+        }
+        bizAppointmentRecord.setAppointmentType("5");
+        this.save(bizAppointmentRecord);
+
+        //修改管桩计划状态
+        BizPipePlan pipePlan = bizPipePlanService.getById(bizAppointmentRecordAddParam.getOrderId());
+        if(ObjectUtil.isNotNull(pipePlan)){
+            pipePlan.setStatus("2");
+            pipePlan.setPlanAlreadyCount(pipePlan.getPlanAlreadyCount() + 1);
+            bizPipePlanService.updateById(pipePlan);
+        }
+    }
+
+    public void checkPipeParam(BizAppointmentRecordAddParam bizAppointmentRecordAddParam) {
+        //校验车牌号
+        if (ObjectUtil.isNotEmpty(bizAppointmentRecordAddParam.getLicenseNumber())) {
+            bizAppointmentRecordAddParam.setLicenseNumber(bizAppointmentRecordAddParam.getLicenseNumber().toUpperCase().trim());
+            //校验车牌号是否添加过预约,排除11:已签收、 13:销售已审核  、 14:已取消
+            long count = this.count(new QueryWrapper<BizAppointmentRecord>().lambda().
+                    eq(BizAppointmentRecord::getLicenseNumber, bizAppointmentRecordAddParam.getLicenseNumber()).
+                    notIn(BizAppointmentRecord::getStatus, "10", "11", "12", "13", "14", "15"));
+            if (count > 0) {
+                throw new CommonException("车牌号:{}已经添加过预约!", bizAppointmentRecordAddParam.getLicenseNumber());
+            }
+        }
+        //校验手机号
+        if (ObjectUtil.isNotEmpty(bizAppointmentRecordAddParam.getDriverMobile())) {
+            if (!PhoneUtil.isMobile(bizAppointmentRecordAddParam.getDriverMobile())) {
+                throw new CommonException("手机号码:{}格式错误", bizAppointmentRecordAddParam.getDriverMobile());
+            }
+        }
+        //校验订单
+        if (ObjectUtil.isNotEmpty(bizAppointmentRecordAddParam.getOrderId())) {
+            BizPipePlan pipePlan = bizPipePlanService.getById(bizAppointmentRecordAddParam.getOrderId());
+            if (ObjectUtil.isNotNull(pipePlan)) {
+                if (!StringUtils.equals(pipePlan.getStatus(), "1") && !StringUtils.equals(pipePlan.getStatus(), "2")) {
+                    throw new CommonException("当前订单不可预约!");
+                }
+            }
+        }
+
+        //查询预约时间段内可预约次数
+        getPipeTimeCount(bizAppointmentRecordAddParam);
+    }
+
+    public void getPipeTimeCount(BizAppointmentRecordAddParam bizAppointmentRecordAddParam) {
+        lock.lock();
+        try {
+            //判断管桩计划次数是否满足
+            if (ObjectUtil.isNotEmpty(bizAppointmentRecordAddParam.getOrderId())) {
+                BizPipePlan pipePlan = bizPipePlanService.getById(bizAppointmentRecordAddParam.getOrderId());
+                if(ObjectUtil.isNotNull(pipePlan)){
+                    if(pipePlan.getPlanCount() - pipePlan.getPlanAlreadyCount() <= 0){
+                        throw new CommonException("当前管桩计划单预约次数已满");
+                    }
+                }
+            }
+        } finally {
+            lock.unlock(); // 释放锁
+        }
+
+    }
+
+    @Transactional
+    @Override
+    public void editPipeAppoint(BizAppointmentRecordEditParam bizAppointmentRecordEditParam) {
+        BizAppointmentRecord bizAppointmentRecord = this.queryEntity(bizAppointmentRecordEditParam.getId());
+        checkPipeParam(bizAppointmentRecordEditParam, bizAppointmentRecord);
+        if (!StringUtils.equals(bizAppointmentRecord.getLoadTimeId(), bizAppointmentRecordEditParam.getLoadTimeId())) {
+            //调整了装卸时段,释放之前的已约次数,更新新的时段已约次数
+            if (ObjectUtil.isNotEmpty(bizAppointmentRecordEditParam.getLoadTimeId())) {
+                BizLoadTime bizLoadTime = bizLoadTimeService.getById(bizAppointmentRecordEditParam.getLoadTimeId());
+                if (ObjectUtil.isNotNull(bizLoadTime)) {
+                    bizLoadTime.setAlreadyNumber(bizLoadTime.getAlreadyNumber() + 1);
+                    bizLoadTimeService.updateById(bizLoadTime);
+                }
+            }
+
+            if (ObjectUtil.isNotEmpty(bizAppointmentRecord.getLoadTimeId())) {
+                BizLoadTime bizLoadTime = bizLoadTimeService.getById(bizAppointmentRecord.getLoadTimeId());
+                if (ObjectUtil.isNotNull(bizLoadTime)) {
+                    bizLoadTime.setAlreadyNumber(bizLoadTime.getAlreadyNumber() - 1);
+                    bizLoadTimeService.updateById(bizLoadTime);
+                }
+            }
+        }
+        BeanUtil.copyProperties(bizAppointmentRecordEditParam, bizAppointmentRecord);
+        if (StringUtils.equals(bizAppointmentRecord.getStatus(), "2")) {
+            //如果当前状态是审核不通过的状态,修改后重新提交审核
+            bizAppointmentRecord.setStatus("1");
+        }
+        this.updateById(bizAppointmentRecord);
+    }
+
+    public void checkPipeParam(BizAppointmentRecordEditParam bizAppointmentRecordEditParam, BizAppointmentRecord bizAppointmentRecord) {
+        //校验车牌号
+        if (ObjectUtil.isNotEmpty(bizAppointmentRecordEditParam.getLicenseNumber())) {
+            bizAppointmentRecordEditParam.setLicenseNumber(bizAppointmentRecordEditParam.getLicenseNumber().toUpperCase().trim());
+            if (!StringUtils.equals(bizAppointmentRecord.getLicenseNumber(), bizAppointmentRecordEditParam.getLicenseNumber())) {
+                //校验车牌号是否添加过预约,排除11:已签收、 13:销售已审核  、 14:已取消
+                long count = this.count(new QueryWrapper<BizAppointmentRecord>().lambda().
+                        eq(BizAppointmentRecord::getLicenseNumber, bizAppointmentRecordEditParam.getLicenseNumber()).
+                        notIn(BizAppointmentRecord::getStatus, "10", "11", "12", "13", "14", "15"));
+                if (count > 0) {
+                    throw new CommonException("车牌号:{}已经添加过预约!", bizAppointmentRecordEditParam.getLicenseNumber());
+                }
+            }
+        }
+        //校验手机号
+        if (ObjectUtil.isNotEmpty(bizAppointmentRecordEditParam.getDriverMobile())) {
+            if (!PhoneUtil.isMobile(bizAppointmentRecordEditParam.getDriverMobile())) {
+                throw new CommonException("手机号码:{}格式错误", bizAppointmentRecordEditParam.getDriverMobile());
+            }
+        }
+        //校验订单
+        if (ObjectUtil.isNotEmpty(bizAppointmentRecordEditParam.getOrderId())) {
+            BizPipePlan pipePlan = bizPipePlanService.getById(bizAppointmentRecordEditParam.getOrderId());
+            if (ObjectUtil.isNotNull(pipePlan)) {
+                if (!StringUtils.equals(pipePlan.getStatus(), "1") && !StringUtils.equals(pipePlan.getStatus(), "2")) {
+                    throw new CommonException("当前订单不可预约!");
+                }
+            }
+
+        }
+
+        //查询预约时间段内可预约次数
+        getPipeTimeCount(bizAppointmentRecordEditParam, bizAppointmentRecord);
+
+    }
+
+    public void getPipeTimeCount(BizAppointmentRecordEditParam bizAppointmentRecordEditParam,BizAppointmentRecord bizAppointmentRecord) {
+        lock.lock();
+        try {
+            //判断管桩计划次数是否满足
+            if (ObjectUtil.isNotEmpty(bizAppointmentRecordEditParam.getOrderId())) {
+                if(!StringUtils.equals(bizAppointmentRecordEditParam.getOrderId(),bizAppointmentRecord.getOrderId())){
+                    BizPipePlan pipePlan = bizPipePlanService.getById(bizAppointmentRecordEditParam.getOrderId());
+                    if(ObjectUtil.isNotNull(pipePlan)){
+                        if(pipePlan.getPlanCount() - pipePlan.getPlanAlreadyCount() <= 0){
+                            throw new CommonException("当前管桩计划单预约次数已满");
+                        }
+                    }
+                }
+            }
+        } finally {
+            lock.unlock(); // 释放锁
+        }
+
+    }
+
+
+    @Override
+    public Page<BizAppointmentRecord> getPipePage(BizAppointmentRecordPageParam bizAppointmentRecordPageParam) {
+        QueryWrapper<BizAppointmentRecord> queryWrapper = getQueryWrapper(bizAppointmentRecordPageParam);
+        Page<BizAppointmentRecord> loadPage = this.getBaseMapper().getPipePage(CommonPageRequest.defaultPage(), queryWrapper);
+        return loadPage;
+    }
+
+    @Override
+    public void replacePipeAppoint(BizAppointmentRecordEditParam bizAppointmentRecordEditParam) {
+        //修改预约已取消状态
+        BizAppointmentRecord bizAppointmentRecord = this.queryEntity(bizAppointmentRecordEditParam.getId());
+        bizAppointmentRecord.setStatus("14");
+        this.updateById(bizAppointmentRecord);
+
+        //修改管桩计划单已约数量
+        BizPipePlan pipePlan = bizPipePlanService.getById(bizAppointmentRecord.getOrderId());
+        if(ObjectUtil.isNotNull(pipePlan)){
+            pipePlan.setPlanAlreadyCount(pipePlan.getPlanAlreadyCount() - 1);
+            bizPipePlanService.updateById(pipePlan);
+        }
+
+    }
+
+
     @Override
     public void addOtherAppointment(BizOtherAppointmentAddParam bizOtherAppointmentAddParam) {
         checkOtherParam(bizOtherAppointmentAddParam.getLicenseNumber());