qzyReal 3 роки тому
батько
коміт
14ad7f5748
34 змінених файлів з 2535 додано та 807 видалено
  1. 8 0
      app/pages.json
  2. 637 0
      app/pages/business-entering/business-edit.vue
  3. 1 19
      app/pages/business-entering/business-entering.vue
  4. 1 1
      app/pages/business-order/business-order.vue
  5. 133 0
      app/pages/customer-management/customer-info.vue
  6. 28 0
      app/pages/customer-management/customer-list.vue
  7. 41 36
      app/pages/index/index.vue
  8. 2 2
      app/utils/request.js
  9. 106 120
      sp-admin/sa-view/tb-business/tb-business-add.html
  10. 510 0
      sp-admin/sa-view/tb-business/tb-business-edit.html
  11. 74 85
      sp-admin/sa-view/tb-business/tb-business-info.html
  12. 109 47
      sp-admin/sa-view/tb-business/tb-business-list.html
  13. 5 2
      sp-admin/sa-view/tb-costomer/tb-costomer-add.html
  14. 16 15
      sp-admin/sa-view/tb-costomer/tb-costomer-info.html
  15. 3 11
      sp-admin/sa-view/tb-costomer/tb-costomer-list.html
  16. 101 6
      sp-admin/static/sa.js
  17. 1 0
      sp-server/app.pid
  18. 0 0
      sp-server/logs/pco/SxFx_info.log
  19. 0 0
      sp-server/logs/pco/comm_info.log
  20. 47 0
      sp-server/logs/pco/log_debug.log
  21. 25 0
      sp-server/logs/pco/log_info.log
  22. 9 1
      sp-server/src/main/java/com/pj/SpServerApplication.java
  23. 80 52
      sp-server/src/main/java/com/pj/api/open/service/OpenService.java
  24. 178 172
      sp-server/src/main/java/com/pj/project/tb_business/TbBusiness.java
  25. 211 157
      sp-server/src/main/java/com/pj/project/tb_business/TbBusinessController.java
  26. 80 40
      sp-server/src/main/java/com/pj/project/tb_business/TbBusinessService.java
  27. 1 1
      sp-server/src/main/java/com/pj/project/tb_business_item/TbBusinessItem.java
  28. 7 0
      sp-server/src/main/java/com/pj/project/tb_business_item/TbBusinessItemService.java
  29. 2 0
      sp-server/src/main/java/com/pj/project/tb_goods/TbGoods.java
  30. 1 1
      sp-server/src/main/java/com/pj/project/tb_goods/TbGoodsMapper.xml
  31. 2 0
      sp-server/src/main/java/com/pj/project/tb_item_type/TbItemType.java
  32. 3 1
      sp-server/src/main/java/com/pj/utils/so/SoMap.java
  33. 3 2
      sp-server/src/main/resources/application.yml
  34. 110 36
      sp-server/src/main/resources/logback.xml

+ 8 - 0
app/pages.json

@@ -38,6 +38,14 @@
             
         }
 		,{
+		    "path" : "pages/business-entering/business-edit",
+		    "style" :                                                                                    
+		    {
+		        "navigationBarTitleText": ""//业务录入
+		    }
+		    
+		}
+		,{
 		    "path" : "pages/business-entering/business-detail",
 		    "style" :                                                                                    
 		    {

+ 637 - 0
app/pages/business-entering/business-edit.vue

@@ -0,0 +1,637 @@
+<template>
+	<view>
+		<view class="box" v-show="hs.visible">
+			<view class="top">
+				<text class="title">录入核酸人员</text>
+			</view>
+			<view style="display: flex;">
+				<u-button type="primary" @click="hs.visible=false" text="返回" style="width: 20px;" size="mini" />
+				<u-button type="primary" @click="showHsModal" text="添加" icon="plus" style="width: 20px;" size="mini" />
+			</view>
+			<u-row style="margin-top: 70rpx;">
+				<u-col span="4" style="text-align: center;">姓名</u-col>
+				<u-col span="4" style="text-align: center;">联系号码</u-col>
+				<u-col span="4" style="text-align: center;">操作</u-col>
+			</u-row>
+			<u-row v-for="item in hs.list" style="margin-top: 40rpx;">
+				<u-col span="4" style="text-align: center;">{{item.name}}</u-col>
+				<u-col span="4" style="text-align: center;">{{item.phone}}</u-col>
+				<u-col span="4" style="text-align: center;">
+					<u-row>
+						<u-col span="6">
+							<u-button type="primary" text="编辑" style="width: 20px;" @click="editFn(item)" size="mini">
+							</u-button>
+						</u-col>
+						<u-col span="6">
+							<u-button type="error" style="width: 20px;" text="删除" @click="deleteFn(item)" size="mini">
+							</u-button>
+						</u-col>
+					</u-row>
+				</u-col>
+			</u-row>
+		</view>
+		<view class="box" v-show="!hs.visible">
+			<view class="top">
+				<text class="title">业务录入</text>
+			</view>
+			<view class="item" v-show="customerId=='1'">
+				<view class="l">企业名称:</view>
+				<view class="r">
+					<picker v-if="customer.customerList.length>0" class="p-picker" id="qy"
+						@change="bindPickerChange($event)" :value="customer.index" :range="customer.customerList"
+						range-key="name">
+						<text class="p-text">{{customer.customerList[customer.index].name}}</text>
+						<u-icon class="p-icon" name="arrow-down-fill" size="20"></u-icon>
+					</picker>
+				</view>
+			</view>
+			<view class="item">
+				<view class="l">境外车牌:</view>
+				<view class="r">
+					<u-input placeholder="输入车牌号" @input="carInputFn" v-model="form.cardNo" />
+				</view>
+			</view>
+			<view class="item">
+				<view class="l">规格(米):</view>
+				<view class="r">
+					<u-input type="number" placeholder="输入车辆规格" v-model="form.cardSize" />
+				</view>
+			</view>
+			<view class="item">
+				<view class="l">载重(吨):</view>
+				<view class="r">
+					<u-input type="number" placeholder="输入载重" v-model="form.netWeight" />
+				</view>
+			</view>
+			<view class="item">
+				<view class="l">货物:</view>
+				<view class="r">
+					<picker v-if="goods.goodsList.length>0" class="p-picker" id="hw" @change="bindPickerChange($event)"
+						:value="goods.index" :range="goods.goodsList" range-key="name">
+						<text class="p-text">{{goods.goodsList[goods.index].name}}</text>
+						<u-icon class="p-icon" name="arrow-down-fill" size="20"></u-icon>
+					</picker>
+				</view>
+			</view>
+			<view class="item">
+				<view class="l">预计入场:</view>
+				<view class="r">
+					<view class="r">
+						<uni-datetime-picker placeholder="请选择" type="datetime" v-model="form.expectInDay"
+							@close="closeFn" />
+					</view>
+				</view>
+			</view>
+			<view class="item">
+				<view class="l">中国车牌号:</view>
+				<view class="r">
+					<u-input placeholder="中国车牌号" @input="handler()" v-model="form.chinaCarNo" />
+				</view>
+			</view>
+			<view class="item">
+				<view class="l">中国司机:</view>
+				<view class="r">
+					<u-input placeholder="司机姓名" @input="handler()" v-model="form.driverName" />
+				</view>
+			</view>
+			<view class="item">
+				<view class="l">联系号码:</view>
+				<view class="r">
+					<u-input placeholder="司机联系号码" @input="handler()" v-model="form.driverPhone" />
+				</view>
+			</view>
+			<view class="item-line">
+				业务项
+			</view>
+			<view class="item" v-for="item in itemList" :key="item.id" v-if="item.items.length>0">
+				<view class="l">{{item.name}}:</view>
+				<view class="r">
+					<view @click="selectItemFn(item)">
+						<u-input placeholder="请选择" v-model="item.itemName" readonly clearable style="width: 120px;">
+							<u-icon name="close" v-if="item.itemName" slot="suffix" color="#E5E5E5;" size="5"
+								@click="item.itemName=''"></u-icon>
+						</u-input>
+					</view>
+					<u-input placeholder="数量" border="surround" v-model="item.num" type="number" style="width: 10px;"
+						v-if="item.itemName"></u-input>
+					<view style="margin-left: 20rpx;color: red;" v-if="item.itemName">
+						{{item.items.filter(obj=>obj.itemName==item.itemName)[0].price*item.num}}元
+					</view>
+					<u-icon name="plus" style="position: absolute;right: 10rpx;"
+						v-if="item.itemName&&item.name.indexOf('人员核酸检测')!==-1" @click="addHsFn(true)"></u-icon>
+				</view>
+			</view>
+			<view class="hj" v-show="totalPrice>0">
+				合计:{{totalPrice}}元
+			</view>
+		</view>
+		<u-button type="primary" text="确定" @click="saveFn" v-show="!hs.visible"></u-button>
+		<!-- ---------------------------------------------------------- -->
+		<view class="bottom-safety"></view>
+		<u-popup :show="car.carInput" :overlay="false" @close="car.carInput=false" borderRadius="10">
+			<view style="padding: 40rpx;line-height: 60rpx;text-align: center;">
+				<view v-for="item in car.filterList" :id="item.id"
+					style="margin-bottom: 20rpx;border-bottom: 1rpx solid #E5E5E5;" @click="selectCarNo(item)">
+					{{item.cardNo}}({{item.cardSize}})
+				</view>
+			</view>
+		</u-popup>
+		<u-popup :show="driver.show" :overlay="false" @close="driver.show=false" borderRadius="10">
+			<view style="padding: 40rpx;line-height: 60rpx;text-align: center;">
+				<view v-for="item in driver.filterList" :id="item.id"
+					style="margin-bottom: 20rpx;border-bottom: 1rpx solid #E5E5E5;" @click="selectDriverFn(item)">
+					{{item.name}}({{item.idCard}})
+				</view>
+			</view>
+		</u-popup>
+		<u-popup :show="show" closeable closeOnClickOverlay @close="show=false">
+			<view style="padding: 40rpx;">
+				<u-radio-group @change="itemSelectFn" placement="column" v-model="item.itemName">
+					<u-radio v-for="item in item.items" :key="item.id" :label="item.itemName" :name="item.itemName"
+						style="margin-top: 30rpx;">
+					</u-radio>
+				</u-radio-group>
+			</view>
+		</u-popup>
+		<u-modal :show="modal.visible" showCancelButton closeOnClickOverlay @cancel="modal.visible=false"
+			@confirm="addHsPeopleFn">
+			<view style="">
+				<u--input placeholder="姓名" border="surround" v-model="modal.form.name"></u--input>
+				<u--input style="margin-top: 20rpx;" placeholder="联系号码" border="surround" v-model="modal.form.phone">
+				</u--input>
+			</view>
+		</u-modal>
+	</view>
+</template>
+
+<script>
+	export default {
+		data() {
+			return {
+				car: {
+					carInput: false,
+					filterList: [],
+				},
+				driver: {
+					show: false,
+					filterList: [],
+				},
+				customerId: '1',
+				itemList: [],
+				form: {
+					customerId: '',
+					customerIndex: 0,
+					countryIndex: 0,
+					goodsIndex: 0,
+					cardNo: '',
+					cardSize: '',
+					goodsName: '',
+					netWeight: '',
+					chinaCarNo: '',
+					driverName: '',
+					driverPhone: ''
+
+				},
+				show: false,
+				item: {
+					items: []
+				},
+				customer: {
+					index: 0,
+					customerList: [],
+				},
+				carList: [],
+				driverList: [],
+				country: {
+					index: 0,
+					list: ['越南车', '中国车']
+				},
+				goods: {
+					index: 0,
+					goodsList: []
+				},
+				hs: {
+					visible: false,
+					list: []
+				},
+				modal: {
+					visible: false,
+					form: {
+						name: '',
+						phone: ''
+					}
+				}
+			}
+		},
+		onLoad(optsions) {
+			this.form.id = optsions.id;
+
+		},
+		onShow() {
+			this.customerId = uni.getStorageSync('customerId');
+			if (!this.form.id) {
+				setTimeout(() => {
+					this.checkStore();
+				}, 1000)
+			}
+
+
+		},
+		computed: {
+			totalPrice() {
+				let itemList = this.itemList.filter(obj => obj.itemName);
+				let price = 0;
+				for (let i in itemList) {
+					let type = itemList[i];
+					let items = type.items;
+					for (let j in items) {
+						let item = items[j];
+						if (item.itemName == type.itemName) {
+							price += item.price;
+							break;
+						}
+					}
+				}
+				return price;
+			}
+		},
+		created() {
+			this.getItemList();
+			if (this.customerId == '1') {
+				this.getCustomerList();
+			}
+			this.getCarList();
+			this.getDriverList();
+			this.getGoodsList();
+			if (this.form.id) {
+				this.$common.showLoading('加载中...')
+				setTimeout(() => {
+					this.getBusinessById();
+				}, 800)
+			}
+		},
+		methods: {
+			closeFn(data) {
+				console.log(data);
+			},
+			getBusinessById() {
+				this.$api.getBusinessById({
+					id: this.form.id
+				}).then(resp => {
+					let data = resp.data;
+					this.form = data;
+					this.customer.index = this.customer.customerList.map(obj => obj.name).indexOf(data
+						.customerName);
+					this.goods.index = this.goods.goodsList.map(o => o.name).indexOf(data.goodsName);
+					let items = data.items;
+					let names = items.map(obj => obj.itemTypeName);
+					let itemTypeList = this.itemList.filter(obj => names.indexOf(obj.name) !== -1);
+					for (let i in itemTypeList) {
+						let type = itemTypeList[i];
+						for (let j in items) {
+							let item = items[j];
+							if (item.itemTypeId == type.id) {
+								type.itemName = item.itemName;
+								type.num = item.num
+								break;
+							}
+						}
+					}
+					this.addHsFn(false)
+					setTimeout(() => {
+						this.car.carInput = false;
+					}, 50)
+				})
+			},
+			addHsFn(show) {
+				this.hs.visible = show;
+				this.$api.getBusinessPeople({
+					businessId: this.form.id
+				}).then(resp => {
+					let list = resp.data;
+					let index = 0;
+					let r = [];
+					for (let i in list) {
+						r.push({
+							name: list[i].name,
+							phone: list[i].phone,
+							index: index,
+							id: list[i].id
+						})
+						index++;
+					}
+					this.hs.list = r;
+				})
+			},
+			showHsModal() {
+				Object.assign(this.modal, {
+					visible: true,
+					form: {
+						name: '',
+						phone: '',
+						index: -1
+					}
+				});
+			},
+			addHsPeopleFn() {
+				if (!this.modal.form.name) {
+					this.$common.toast('请输入名称');
+					return;
+				}
+				if (!this.modal.form.phone) {
+					this.$common.toast('请输入联系号码');
+					return;
+				}
+				let dbIndex = this.modal.form.index;
+				if (dbIndex >= 0) {
+					this.hs.list[dbIndex].name = this.modal.form.name;
+					this.hs.list[dbIndex].phone = this.modal.form.phone;
+				} else {
+					this.modal.form.index = this.hs.list.length;
+					this.hs.list.push(this.modal.form);
+				}
+				this.modal.visible = false;
+				this.handler();
+			},
+			editFn(data) {
+				Object.assign(this.modal, {
+					visible: true,
+					form: data
+				})
+			},
+			deleteFn(data) {
+				this.hs.list.splice(data.index, 1);
+				if (data.id) {
+					this.$api.deleteHsPeople({
+						id: data.id
+					});
+				}
+			},
+			getGoodsList() {
+				this.$api.getGoodsList().then(resp => {
+					this.goods.goodsList = resp.data;
+				})
+			},
+			getDriverList() {
+				this.$api.getDriverList().then(resp => {
+					this.driverList = resp.data;
+				})
+			},
+			idCardInput() {
+				let val = this.form.driverIdCard;
+				let list = this.driverList.filter(obj => obj.idCard.indexOf(val) !== -1);
+				if (list.length > 0 && val) {
+					this.driver.show = true;
+					this.driver.filterList = list;
+				} else {
+					this.driver.show = false;
+				}
+			},
+			selectDriverFn(item) {
+				this.form.driverIdCard = item.idCard;
+				this.form.driverName = item.name;
+				this.form.driverPhone = item.phone
+				let that = this;
+				setTimeout(() => {
+					that.driver.show = false;
+				}, 150)
+			},
+			getCarList() {
+				this.$api.getCarList().then(resp => {
+					this.carList = resp.data;
+				})
+			},
+			carInputFn() {
+				let val = this.form.cardNo;
+				let list = this.carList.filter(obj => obj.cardNo.indexOf(val) !== -1);
+				if (list.length > 0 && val) {
+					this.car.carInput = true;
+					this.car.filterList = list;
+				} else {
+					this.car.carInput = false;
+				}
+				this.handler();
+			},
+			selectCarNo(item) {
+				this.form.cardNo = item.cardNo;
+				this.form.cardSize = item.cardSize;
+				this.form.netWeight = item.lastNetWeight;
+				let names = this.goods.goodsList.map(obj => obj.name);
+				let index = names.indexOf(item.lastGoodsName);
+				this.goods.index = index == -1 ? 0 : index;
+				this.country.index = this.country.list.indexOf(item.countryName)
+				let that = this;
+				this.handler();
+				setTimeout(() => {
+					this.car.carInput = false;
+				}, 150)
+
+			},
+			getCustomerList() {
+				this.$api.getCustomerList().then(resp => {
+					this.customer.customerList = resp.data;
+				})
+			},
+			getItemList() {
+				this.$api.getItemList().then(resp => {
+					this.itemList = resp.data;
+				})
+			},
+			selectItemFn(item) {
+				this.item = item;
+				this.show = true;
+
+			},
+			itemSelectFn(data) {
+				this.show = false;
+				this.item.itemName = data;
+				this.handler();
+			},
+			handler() {
+				let goodsIndex = this.goods.index;
+				let countryIndex = this.country.index;
+				this.form.goodsName = this.goods.goodsList[goodsIndex].name;
+				this.form.countryName = this.country.list[countryIndex];
+				this.form.goodsIndex = goodsIndex;
+				this.form.countryIndex = countryIndex;
+				this.form.peopleJson = JSON.stringify(this.hs.list);
+				let customerId = this.customerId;
+				if (customerId == '1') {
+					let customerIndex = this.customer.index;
+					this.form.customerId = this.customer.customerList[customerIndex].id;
+					this.form.customerIndex = customerIndex;
+				}
+				let that = this;
+				uni.setStorage({
+					key: 'business_' + customerId,
+					data: that.form
+				})
+			},
+			checkStore() {
+				let customerId = this.customerId;
+				let data = uni.getStorageSync('business_' + customerId)
+				if (data) {
+					let that = this;
+					uni.showModal({
+						title: '提示',
+						content: '您上次录入数据未提交,是否继续?',
+						cancelText: '重新录入',
+						confirmText: '继续',
+						success(res) {
+							if (res.confirm) {
+								that.rebackStore(data);
+							} else {
+								uni.removeStorageSync('business_' + customerId)
+							}
+						}
+					})
+				}
+			},
+			rebackStore(data) {
+				this.form = data;
+
+				this.goods.index = data.goodsIndex ? data.goodsIndex : 0;
+				this.customer.index = data.customerIndex ? data.customerIndex : 0;
+				this.country.index = data.countryIndex ? data.countryIndex : 0;
+				this.hs.list = data.peopleJson ? JSON.parse(data.peopleJson) : []
+				setTimeout(() => {
+					this.car.carInput = false;
+					this.driver.show = false;
+				}, 150)
+			},
+			check() {
+				this.handler();
+				if (!this.form.cardNo) {
+					this.$common.toast('请录入境外车牌号')
+					return false;
+				}
+				if (!this.form.cardSize) {
+					this.$common.toast('请录入车辆规格')
+					return false;
+				}
+				let inDayTime=this.form.expectInDay;
+				if(!inDayTime||inDayTime.length<12){
+					this.$common.toast('入场时间不正确')
+					return false;
+				}
+			
+
+				if (!this.form.chinaCarNo) {
+					this.$common.toast('请录入中国车牌')
+					return false;
+				}
+				if (!this.form.driverName) {
+					this.$common.toast('请录入中国司机')
+					return false;
+				}
+				if (!this.form.driverPhone) {
+					this.$common.toast('请录入司机联系号码')
+					return false;
+				}
+				let typeList = this.itemList.filter(obj => obj.itemName);
+				if (typeList.length == 0) {
+					this.$common.toast('至少选择一项业务项')
+					return false;
+				}
+				if (typeList.filter(obj => obj.name.indexOf('核酸') !== -1).length > 0 && this.hs.list.length == 0) {
+					this.$common.toast('录入核酸检测人员')
+					return false;
+				}
+				let list = [];
+				for (let i in typeList) {
+					let type = typeList[i];
+					type.num = 1;
+					for (let j in type.items) {
+						let item = type.items[j];
+						if (type.itemName == item.itemName) {
+							type.itemId = item.id;
+							break;
+						}
+					}
+					list.push({
+						itemId: type.itemId,
+						num: type.num
+					})
+				}
+				this.form.itemJson = JSON.stringify(list);
+				this.form.items = null;
+				if (this.customerId == '1') {
+					this.form.customerId = this.customer.customerList[this.customer.index].id;
+				} else {
+					this.form.customerId = this.customerId;
+				}
+
+				return true;
+			},
+			saveFn() {
+				if (this.check()) {
+					let obj = this.$common.removeNull(this.form);
+					this.$api.saveBusiness(obj).then(resp => {
+						if (resp.code == 200) {
+							uni.removeStorageSync('business_' + this.customerId);
+							this.$common.toast('修改成功');
+							this.hs.list = [];
+							setTimeout(() => {
+								this.$common.to('/pages/business-order/business-order')
+							}, 1000)
+						}
+					})
+				}
+			},
+			bindPickerChange(e) {
+				var nowId = e.target.id; //当前picker的ID id需要自己设置 在picker中
+				var value = e.detail.value; //当前picker选中的值
+				switch (nowId) { //根据ID判断是哪个picker
+					case "qy": //picker的ID
+						this.customer.index = value;
+						break;
+					case "hw": //picker的ID
+						this.goods.index = value;
+						break;
+					case "gj": //picker的ID
+						this.country.index = value;
+						break;
+				}
+				this.handler();
+			},
+		}
+	}
+</script>
+
+<style lang="scss">
+	page {
+		background-color: #fff;
+	}
+
+	.hs-item {
+		text-align: center;
+	}
+
+	.item-line {
+		color: #a2a2a2;
+		padding: 5px 0 10px 29px;
+		border-bottom: 1px solid #E5E5E5;
+	}
+
+	.hj {
+		padding: 50rpx;
+		font-size: 40rpx;
+		color: red;
+		font-weight: bold;
+	}
+
+	.save-btn {
+		background-color: #ff4200;
+		height: 88rpx;
+		display: flex;
+		justify-content: center;
+		align-items: center;
+		margin: 60rpx;
+		color: #fff;
+		font-size: 30rpx;
+		font-weight: bold;
+		border-radius: 10rpx;
+	}
+
+	@import '@/common/common.scss'
+</style>

+ 1 - 19
app/pages/business-entering/business-entering.vue

@@ -304,25 +304,7 @@
 			},
 			addHsFn() {
 				this.hs.visible = true;
-				if (this.form.id) {
-					this.$api.getBusinessPeople({
-						businessId: this.form.id
-					}).then(resp => {
-						let list = resp.data;
-						let index = 0;
-						let r = [];
-						for (let i in list) {
-							r.push({
-								name: list[i].name,
-								phone: list[i].phone,
-								index: index,
-								id: list[i].id
-							})
-							index++;
-						}
-						this.hs.list = r;
-					})
-				}
+			
 			},
 			showHsModal() {
 				Object.assign(this.modal, {

+ 1 - 1
app/pages/business-order/business-order.vue

@@ -135,7 +135,7 @@
 				this.$common.to('/pages/business-entering/business-detail?id='+data.id)
 			},
 			editFn(data){
-				this.$common.to('/pages/business-entering/business-entering?id='+data.id)
+				this.$common.to('/pages/business-entering/business-edit?id='+data.id)
 			},
 			deleteFn(data){
 				let that=this;

+ 133 - 0
app/pages/customer-management/customer-info.vue

@@ -0,0 +1,133 @@
+<template>
+	<view>
+		<view class="box">
+			<view class="top">
+				<text class="title">信息管理</text>
+			</view>
+			<view class="item">
+				<view class="l">企业名称:</view>
+				<view class="r">
+					<u-input v-model="form.name" placeholder="输入企业名称" />
+				</view>
+			</view>
+			<view class="item">
+				<view class="l">联系人:</view>
+				<view class="r">
+					<u-input v-model="form.dutyPeople" placeholder="输入联系人" />
+				</view>
+			</view>
+			<view class="item">
+				<view class="l">联系电话:</view>
+				<view class="r">
+					<u-input maxlength="11" v-model="form.phone" placeholder="输入电话号码" />
+				</view>
+			</view>
+			<view class="item">
+				<view class="l">结算方式:</view>
+				<view class="r">
+					<radio-group @change="payChange">
+						<label class="radio">
+							<radio value="1" checked />现结
+						</label>
+						<label class="radio" style="margin-left: 20rpx;">
+							<radio value="2" />月结
+						</label>
+					</radio-group>
+				</view>
+			</view>
+			<view class="item">
+				<view class="l">营业执照:</view>
+				<view class="r">
+					<view class="img">
+						<u-upload max-count="1" ref="license" :file-list="imgList" :action="uploadImageUrl" width="300"
+							height="200"></u-upload>
+					</view>
+				</view>
+			</view>
+		</view>
+		<view class="common-btn" @click="confirm">确认</view>
+	</view>
+</template>
+
+<script>
+	import request from '../../utils/request.js'
+	export default {
+		data() {
+			return {
+				imgList: [],
+				uploadImageUrl: request.server + '/upload/image',
+				form: {
+					name: '',
+					dutyPeople: '',
+					phone: '',
+					payType: '1',
+					businessLicence: ''
+				}
+			}
+		},
+		mounted() {
+			let id = uni.getStorageSync('info').customerId;
+			this.getCustomerById(id);
+		},
+		methods: {
+			getCustomerById(id) {
+				this.$api.getCustomerById({
+					id: id
+				}).then(resp => {
+					this.form = resp.data;
+				})
+			},
+			payChange(e) {
+				this.form.payType = e.detail.value
+			},
+			check() {
+				if (!this.form.name) {
+					this.$common.toast('请录入名称');
+					return false;
+				}
+				if (!this.form.dutyPeople) {
+					this.$common.toast('请录入联系人');
+					return false;
+				}
+				if (!this.form.phone) {
+					this.$common.toast('请录入联系号码');
+					return false;
+				}
+				let licenseFiles = this.$refs.license.lists.filter(val => {
+					return val.progress == 100;
+				})
+				if (licenseFiles.length > 0) {
+					this.form.businessLicence = licenseFiles.map(obj => {
+						if (obj.response) {
+							return obj.response.data;
+						} else if (obj.url) {
+							return obj.url;
+						}
+					}).join(',');
+				}
+
+				return true;
+			},
+			confirm() {
+				if (this.check()) {
+					this.$api.editCustomer(this.$common.removeNull(this.form)).then(resp => {
+						if (resp.code == 200) {
+							this.$common.toast('修改成功');
+							setTimeout(()=>{
+								this.$common.back();
+							},1000)
+						}
+					})
+				}
+			}
+		}
+	}
+</script>
+
+<style lang="scss">
+	page {
+		background-color: #fff;
+	}
+
+	@import '@/common/common.scss'
+</style>

+ 28 - 0
app/pages/customer-management/customer-list.vue

@@ -0,0 +1,28 @@
+<template>
+	<management v-if="customerId=='1'"></management>
+	<info v-else></info>
+</template>
+
+<script>
+	import info from './customer-info.vue'
+	import management from './customer-management.vue'
+	export default{
+		components:{
+			info,management
+		},
+		data(){
+			return{
+				customerId:''
+			}
+		},
+		onShow() {
+			this.customerId=uni.getStorageSync('info').customerId;
+		},
+		methods:{
+			
+		}
+	}
+</script>
+
+<style>
+</style>

+ 41 - 36
app/pages/index/index.vue

@@ -50,48 +50,52 @@
 				companyName: '',
 				customerId:'',
 				qrcoderlc: '../../static/qrcode.png',
-				indexItemList: [{
-						auth: false,
-						icon: '../../static/home-icon-01.png',
-						text: '企业注册',
-						url: '/pages/enterprise-reg/enterprise-reg',
-						show:uni.getStorageSync('info')?false:true
-					},
-					{
-						auth: true,
-						icon: '../../static/home-icon-02.png',
-						text: '业务录入',
-						url: '/pages/business-entering/business-entering',
-						show: uni.getStorageSync('perList').indexOf('tb-business-add')!==-1
-					},
-					{
-						auth: true,
-						icon: '../../static/home-icon-03.png',
-						text: '业务订单',
-						url: '/pages/business-order/business-order',
-						show:true
-					},
-					{
-						auth: true,
-						icon: '../../static/home-icon-04.png',
-						text: '企业管理',
-						url: '/pages/customer-management/customer-list',
-						show:true
-					},
-					{
-						auth: true,
-						icon: '../../static/home-icon-05.png',
-						text: '出入记录',
-						url: '/pages/inout-record/inout-record',
-						show:true
-					}
-				]
+				indexItemList: []
 			}
 		},
 		onShow() {
 			this.getStoreInfo();
+			this.setList();
 		},
 		methods: {
+			setList(){
+				this.indexItemList=[
+			{
+					auth: false,
+					icon: '../../static/home-icon-01.png',
+					text: '企业注册',
+					url: '/pages/enterprise-reg/enterprise-reg',
+					show:uni.getStorageSync('info')?false:true
+				},
+				{
+					auth: true,
+					icon: '../../static/home-icon-02.png',
+					text: '业务录入',
+					url: '/pages/business-entering/business-entering',
+					show: uni.getStorageSync('perList').indexOf('tb-business-add')!==-1
+				},
+				{
+					auth: true,
+					icon: '../../static/home-icon-03.png',
+					text: '业务订单',
+					url: '/pages/business-order/business-order',
+					show:true
+				},
+				{
+					auth: true,
+					icon: '../../static/home-icon-04.png',
+					text: '企业管理',
+					url: '/pages/customer-management/customer-list',
+					show:true
+				},
+				{
+					auth: true,
+					icon: '../../static/home-icon-05.png',
+					text: '出入记录',
+					url: '/pages/inout-record/inout-record',
+					show:true
+				}	]
+			},
 			getStoreInfo() {
 				let info = uni.getStorageSync('info');
 				console.log(info.customerId)
@@ -108,6 +112,7 @@
 				uni.removeStorageSync('token')
 				uni.removeStorageSync('info')
 				this.isLogin=false;
+				this.setList();
 			},
 			navTo(item) {
 				let auth = item.auth;

+ 2 - 2
app/utils/request.js

@@ -1,5 +1,5 @@
-const server = 'http://192.168.3.217:8099';
-
+//const server = 'http://192.168.3.217:8099';
+const server = 'http://47.101.143.145/pro';
 import common from '../common/js/common.js';
 
 function get(url, data) {

+ 106 - 120
sp-admin/sa-view/tb-business/tb-business-add.html

@@ -67,39 +67,33 @@
 											</el-select>
 										</div>
 										<div class="c-item">
-											<label class="c-label">境外车牌号:</label>
-											<el-autocomplete v-model="m.cardNo" @select="handleSelectCar"
-												value-key='cardNo' :fetch-suggestions="queryCarAsync">
-											</el-autocomplete>
-										</div>
-										<sa-item type="num" name="境外车规格" placeholder="单位(米)" v-model="m.cardSize" br>
-										</sa-item>
-										<!-- 									<div class="c-item">
-											<label class="c-label">国籍:</label>
-											<el-select v-model="m.countryName" placeholder="请选择">
-												<el-option v-for="item in countryList" :key="item.name"
-													:label="item.name" :value="item.name">
-												</el-option>
-											</el-select>
-										</div> -->
-										<div class="c-item">
 											<label class="c-label">运输货品:</label>
-											<el-select v-model="m.goodsName" placeholder="请选择">
+											<el-select v-model="m.goodsName" placeholder="请选择" @change="goodsChange">
 												<el-option v-for="item in goodsList" :key="item.id" :label="item.name"
 													:value="item.name">
 												</el-option>
 											</el-select>
 										</div>
-										<sa-item type="num" name="载重(吨)" v-model="m.netWeight" br></sa-item>
+										<sa-item type="text" name="境外车牌号" placeholder="请输入境外车牌号" v-model="m.cardNo" br>
+										</sa-item>
+										</sa-item>
 										<div class="c-item">
-											<label class="c-label">中国车牌:</label>
-											<el-autocomplete v-model="m.chinaCarNo" @select="handleSelectChinaCar"
-												value-key='cardNo' :fetch-suggestions="queryCarAsync">
+											<label class="c-label">境外车规格:</label>
+											<el-autocomplete v-model="m.cardSize" placeholder="请输入车规格"
+												@select="handleSelectCarSize" value-key='unit'
+												:fetch-suggestions="queryCaSizerAsync">
 											</el-autocomplete>
 										</div>
-										<sa-item type="text" name="中国司机" v-model="m.driverName" br></sa-item>
-										<sa-item type="text" name="联系号码" v-model="m.driverPhone" br></sa-item>
-										<sa-item type="datetime" name="预计入场" v-model="m.expectInDay" br></sa-item>
+										<sa-item type="num" name="载重(吨)" placeholder="请输入车辆载重" v-model="m.netWeight" br>
+										</sa-item>
+										<sa-item type="text" name="中国车牌" placeholder="请输入中国车牌" v-model="m.chinaCarNo"
+											br></sa-item>
+										<sa-item type="text" name="中国司机" placeholder="请输入中国车司机" v-model="m.driverName"
+											br></sa-item>
+										<sa-item type="text" name="联系号码" placeholder="请输入联系号码" v-model="m.driverPhone"
+											br></sa-item>
+										<sa-item type="datetime" name="预计入场" placeholder="请选择" v-model="m.expectInDay"
+											br></sa-item>
 									</div>
 								</el-card>
 							</el-col>
@@ -110,15 +104,18 @@
 										<span>业务项</span>
 									</div>
 									<div>
-										<el-form-item v-for="(type,index) in itemTypeList" :label="type.name"
-											style="display: flex;">
+										<el-form-item v-for="(type,index) in filterTypeList" style="display: flex;"
+											v-if="filterTypeList.length>0">
+											<label slot="label"><label v-if="needTypeId.indexOf(type.id)!==-1"
+													style="color: red;">*</label>{{type.name}}</label>
 											<el-select v-model="type.itemId" style="width: 120px;" placeholder="请选择">
 												<el-option v-for="item in type.items" :key="item.id"
 													:label="item.itemName" :value="item.id">
 												</el-option>
 											</el-select>
 											<el-input-number style="margin-left: 60px;" class="item-num"
-												v-model="type.num" :min="1" :max="10" size="mini"></el-input-number>
+												v-model="type.num" :min="1" :max="10" size="mini"
+												:disabled="type.inc==0"></el-input-number>
 											<div class="xj" v-if="type.itemId">
 												{{type.items.filter(obj=>obj.id==type.itemId)[0].price*type.num}}元
 												<label @click="type.itemId=''"
@@ -126,8 +123,11 @@
 														class="el-icon-delete"></i>)</label>
 											</div>
 											<el-button v-if="type.code=='p09'&&type.itemId"
-												@click="addPeopleFn(type.itemId)">操作</el-button>
+												@click="addPeopleFn(type.itemId,type.num)">操作</el-button>
 										</el-form-item>
+										<div v-if="filterTypeList.length==0" style="height: 400px;padding: 30px;">
+											请先选择运输货品
+										</div>
 										<div class="hj" v-if="totalPrice>0">
 											合计费用:{{totalPrice}}<label>元</label>
 										</div>
@@ -149,7 +149,7 @@
 				<el-card class="box-card">
 					<div slot="header">
 						<span>列表</span>
-						<el-button style="float: right;" icon="el-icon-plus" type="primary" @click="showAddModal">添加
+						<el-button style="float: right;" icon="el-icon-plus" type="primary" @click="showAddModal" v-if="modal.list.length<modal.num">添加
 						</el-button>
 					</div>
 					<el-table :data="modal.list">
@@ -175,8 +175,8 @@
 			<el-dialog title="人员核酸检测" :visible.sync="addModal.visible" width="400">
 				<span>
 					<el-form label-position="left">
-						<sa-item type="text" name="姓名" v-model="addModal.form.name" br></sa-item>
-						<sa-item type="text" name="联系号码" v-model="addModal.form.phone" br></sa-item>
+						<sa-item type="text" name="姓名" placeholder="姓名" v-model="addModal.form.name" br></sa-item>
+						<sa-item type="text" name="联系号码" placeholder="联系号码" v-model="addModal.form.phone" br></sa-item>
 					</el-form>
 				</span>
 				<span slot="footer" class="dialog-footer">
@@ -216,6 +216,7 @@
 					driverList: [],
 					currentCustomerId: 1,
 					itemTypeList: [],
+					filterTypeList: [],
 					goodsList: [],
 					countryList: [{
 						name: '越南车'
@@ -226,6 +227,7 @@
 					modal: {
 						visible: false,
 						itemId: 4,
+						num: 1,
 						list: []
 					},
 					addModal: {
@@ -236,7 +238,9 @@
 							itemId: 4,
 							ticket: ''
 						}
-					}
+					},
+					unitList: [],
+					needTypeId: []
 				},
 				computed: {
 					totalPrice() {
@@ -258,26 +262,25 @@
 					}
 				},
 				methods: {
-					addPeopleFn(itemId) {
-						sa.ajax('/TbBusinessPeople/getList', {
-							businessId: this.m.id?this.m.id:-1
+					goodsChange(value) {
+						let goods = this.goodsList.filter(obj => obj.name === value).pop();
+						let noNeedIds = goods.noNeedIds.split(',');
+						this.needTypeId = goods.needIds.split(',');
+						this.filterTypeList = this.itemTypeList.filter(type => noNeedIds.indexOf(type.id) === -1);
+					},
+					getUnitList() {
+						sa.ajax('/TbUnit/getList', {
+							pageNo: 1,
+							pageSize: 50
 						}, function(resp) {
-							let list = resp.data;
-							let index = 0;
-							let r = [];
-							for (let i in list) {
-								r.push({
-									name: list[i].name,
-									phone: list[i].phone,
-									index: index,
-									id: list[i].id
-								})
-								index++;
-							}
-							this.modal.list = r;
-							this.modal.itemId = itemId;
-							this.modal.visible = true;
-						}.bind(this));
+							this.unitList = resp.data;
+						}.bind(this))
+					},
+					addPeopleFn(itemId, num) {
+						this.modal.itemId = itemId;
+						this.modal.num = num;
+						this.modal.visible = true;
+
 					},
 					showAddModal() {
 						Object.assign(this.addModal, {
@@ -294,14 +297,16 @@
 					cancelAdd() {
 						this.modal.list = [];
 						this.modal.visible = false;
+
 					},
 					confirmAdd() {
 						if (!this.addModal.form.name) {
 							sa.error('请输入检测人姓名')
 							return false;
 						}
-						if (!this.addModal.form.phone) {
-							sa.error('请输入检测人联系号码')
+						let phone = this.addModal.form.phone;
+						if (phone && !sa.isPhone(phone)) {
+							sa.error('检测人联系号码不正确')
 							return false;
 						}
 						let dbIndex = this.addModal.form.index;
@@ -330,9 +335,6 @@
 							}.bind(this))
 						}
 					},
-					handleSelectChinaCar() {
-
-					},
 					getGoods() {
 						sa.ajax('/TbGoods/getList', {
 							pageNo: 1,
@@ -365,44 +367,14 @@
 							this.itemTypeList = typeList;
 						}.bind(this))
 					},
-					getCardList() {
-						sa.ajax('/TbCar/getList', {
-							pageNo: 1,
-							pageSize: 100
-						}, function(resp) {
-							this.cardList = resp.data;
-						}.bind(this));
-					},
-					queryCarAsync(queryStr, cb) {
-						let list = this.cardList;
-						let filterList = list.filter(obj => obj.cardNo.indexOf(queryStr) !== -1);
-						cb(filterList)
-					},
-					handleSelectCar(item) {
-						console.log(item);
-						this.m.cardSize = item.cardSize;
-						this.m.goodsName = item.lastGoodsName
-						this.m.countryName = item.countryName;
-						this.m.netWeight = item.lastNetWeight;
-					},
-					getDriverList() {
-						sa.ajax('/TbDriver/getList', {
-							pageNo: 1,
-							pageSize: 100
-						}, function(resp) {
-							this.driverList = resp.data;
-						}.bind(this));
-					},
-					queryDriverAsync(queryStr, cb) {
-						let list = this.driverList;
-						let filterList = list.filter(obj => obj.idCard.indexOf(queryStr) !== -1);
+					queryCaSizerAsync(queryStr, cb) {
+						let list = this.unitList;
+						let filterList = list.filter(obj => obj.unit.indexOf(queryStr) !== -1);
 						cb(filterList)
 					},
-					handleSelectDriver(item) {
-						this.m.driverId = item.id;
-						this.m.driverName = item.name;
-						this.m.driverIdCard = item.idCard;
-						this.m.driverPhone = item.phone
+
+					handleSelectCarSize(item) {
+						this.m.cardSize = item.unit;
 					},
 					getCustomerList() {
 						sa.ajax('/TbCostomer/getList', {
@@ -429,46 +401,61 @@
 					},
 					// 提交数据 
 					ok: function() {
-						let itemList = this.itemTypeList.filter(obj => obj.itemId);
+						// 表单校验
+						let m = this.m;
+						if (this.currentCustomerId == 1) {
+							sa.checkNull(m.customerId, '请选择 [客户名称]');
+						}
+						sa.checkNull(m.goodsName, '请选择运输货物');
+						sa.checkNull(m.cardNo, '请输入 [车牌号]');
+						if (!sa.isNum(m.cardSize)) {
+							sa.error('车辆规格只能输入数字')
+							return;
+						}
+						if (!sa.isNum(m.netWeight)) {
+							sa.error('载重只能输入数字')
+							return;
+						}
+						sa.checkNull(m.driverName, '请输入 [中国司机名称]');
+						if (!sa.isPhone(m.driverPhone)) {
+							sa.error('司机联系号码不正确')
+							return false;
+						}
+						sa.checkNull(m.chinaCarNo, '请输入 [中国车牌号]');
+						let checkList = this.itemTypeList;
+						for (let j in this.needTypeId) {
+							let id = this.needTypeId[j];
+							for (let i in checkList) {
+								let type = checkList[i];
+								if (id == type.id && !type.itemId) {
+									sa.error('选择[' + this.m.goodsName + ']时,[' + type.name + ']必选')
+									return;
+								}
+							}
+						}
+						let typeList = this.itemTypeList.filter(obj => obj.itemId);
 						let list = [];
-						if (itemList.length == 0) {
+						if (typeList.length == 0) {
 							sa.error('至少选择一项业务');
 							return false;
 						}
-						for (let i in itemList) {
-							let item = itemList[i];
-							if (!item.num || item.num <= 0) {
-								this.$message({
-									message: '请填写【' + item.name + '】数量',
-									type: 'error'
-								});
-								return;
-							}
+						for (let i in typeList) {
+							let type = typeList[i];
 							list.push({
-								itemId: item.itemId,
-								num: item.num
+								itemId: type.itemId,
+								num: type.num
 							})
 						}
-						if (itemList.filter(obj => obj.itemId == 4 || obj.itemId == 9).length > 0 && this.modal.list
+						if (typeList.filter(obj => obj.itemId == 4 || obj.itemId == 9).length > 0 && this.modal.list
 							.length == 0) {
 							sa.error('请添加核酸检测人员');
 							return false;
 						}
-						// 表单校验 
-						let m = this.m;
+
 						m.itemJson = JSON.stringify(list);
 						m.peopleJson = JSON.stringify(this.modal.list);
 						m.items = [];
-						if (this.currentCustomerId == 1) {
-							sa.checkNull(m.customerId, '请选择 [客户名称]');
-						}
-						sa.checkNull(m.cardNo, '请输入 [车牌号]');
-						sa.checkNull(m.cardSize, '请输入 [车规格]');
-						sa.checkNull(m.netWeight, '请输入 [载重]');
-						sa.checkNull(m.goodsName, '请选择运输货物');
-						sa.checkNull(m.driverName, '请输入 [司机名称]');
-						sa.checkNull(m.driverPhone, '请输入 [司机联系号码]');
-						sa.checkNull(m.chinaCarNo, '请输入 [中国车牌号]');
+
 						if (this.id <= 0) { // 添加
 							sa.ajax('/TbBusiness/add', m, function(res) {
 								sa.alert('增加成功', this.clean);
@@ -492,10 +479,9 @@
 				},
 				mounted: function() {
 					this.getCustomer();
-					this.getCardList();
-					this.getDriverList();
 					this.getItemTypeList();
 					this.getGoods();
+					this.getUnitList();
 				}
 			})
 		</script>

+ 510 - 0
sp-admin/sa-view/tb-business/tb-business-edit.html

@@ -0,0 +1,510 @@
+<!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>
+		<script src="../../static/kj/upload-util.js"></script>
+		<style type="text/css">
+			.c-panel .el-form .c-label {
+				width: 7em !important;
+			}
+
+			.c-panel .el-form .c-panel .el-form {
+				width: 180px;
+			}
+
+			.item-num .el-input__inner {
+				width: 100px;
+			}
+
+			.xj {
+				display: inline;
+				color: red;
+				margin-left: 9px;
+				font-weight: bold;
+			}
+
+			.hj {
+				color: red;
+				margin-left: 9px;
+				font-weight: bold;
+
+			}
+		</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" label-position="left">
+						<el-row>
+							<el-col span=10>
+								<el-card class="box-card">
+									<div slot="header" class="clearfix">
+										<span>基本资料</span>
+									</div>
+									<div>
+										<div class="c-item" v-show="currentCustomerId==1">
+											<label class="c-label">选择客户:</label>
+											<el-select v-model="m.customerId" placeholder="请选择" filterable>
+												<el-option v-for="item in customerList" :key="item.id"
+													:label="item.name" :value="item.id">
+												</el-option>
+											</el-select>
+										</div>
+										<div class="c-item">
+											<label class="c-label">境外车牌号:</label>
+											<el-autocomplete v-model="m.cardNo" @select="handleSelectCar"
+												value-key='cardNo' :fetch-suggestions="queryCarAsync">
+											</el-autocomplete>
+										</div>
+										<sa-item type="num" name="境外车规格" placeholder="单位(米)" v-model="m.cardSize" br>
+										</sa-item>
+										<!-- 									<div class="c-item">
+											<label class="c-label">国籍:</label>
+											<el-select v-model="m.countryName" placeholder="请选择">
+												<el-option v-for="item in countryList" :key="item.name"
+													:label="item.name" :value="item.name">
+												</el-option>
+											</el-select>
+										</div> -->
+										<div class="c-item">
+											<label class="c-label">运输货品:</label>
+											<el-select v-model="m.goodsName" placeholder="请选择">
+												<el-option v-for="item in goodsList" :key="item.id" :label="item.name"
+													:value="item.name">
+												</el-option>
+											</el-select>
+										</div>
+										<sa-item type="num" name="载重(吨)" v-model="m.netWeight" br></sa-item>
+										<div class="c-item">
+											<label class="c-label">中国车牌:</label>
+											<el-autocomplete v-model="m.chinaCarNo" @select="handleSelectChinaCar"
+												value-key='cardNo' :fetch-suggestions="queryCarAsync">
+											</el-autocomplete>
+										</div>
+										<sa-item type="text" name="中国司机" v-model="m.driverName" br></sa-item>
+										<sa-item type="text" name="联系号码" v-model="m.driverPhone" br></sa-item>
+										<sa-item type="datetime" name="预计入场" v-model="m.expectInDay" br></sa-item>
+									</div>
+								</el-card>
+							</el-col>
+
+							<el-col span=14>
+								<el-card class="box-card">
+									<div slot="header" class="clearfix">
+										<span>业务项</span>
+									</div>
+									<div>
+										<el-form-item v-for="(type,index) in itemTypeList" :label="type.name"
+											style="display: flex;">
+											<el-select v-model="type.itemId" style="width: 120px;" placeholder="请选择">
+												<el-option v-for="item in type.items" :key="item.id"
+													:label="item.itemName" :value="item.id">
+												</el-option>
+											</el-select>
+											<el-input-number style="margin-left: 60px;" class="item-num"
+												v-model="type.num" :min="1" :max="10" size="mini"></el-input-number>
+											<div class="xj" v-if="type.itemId">
+												{{type.items.filter(obj=>obj.id==type.itemId)[0].price*type.num}}元
+												<label @click="type.itemId=''"
+													style="margin-left: 5px;cursor: pointer">(<i
+														class="el-icon-delete"></i>)</label>
+											</div>
+											<el-button v-if="type.code=='p09'&&type.itemId"
+												@click="addPeopleFn(type.itemId,true)">操作</el-button>
+										</el-form-item>
+										<div class="hj" v-if="totalPrice>0">
+											合计费用:{{totalPrice}}<label>元</label>
+										</div>
+									</div>
+								</el-card>
+							</el-col>
+						</el-row>
+
+					</el-form>
+				</div>
+
+			</div>
+			<!-- ------- 底部按钮 ------- -->
+			<div class="s-foot">
+				<el-button type="primary" @click="ok()">确定</el-button>
+				<el-button @click="sa.closeCurrIframe()">取消</el-button>
+			</div>
+			<el-dialog title="人员核酸检测" :visible.sync="modal.visible" width="80%">
+				<el-card class="box-card">
+					<div slot="header">
+						<span>列表</span>
+						<el-button style="float: right;" icon="el-icon-plus" type="primary" @click="showAddModal">添加
+						</el-button>
+					</div>
+					<el-table :data="modal.list">
+						<el-table-column prop="name" label="姓名">
+						</el-table-column>
+						<el-table-column prop="phone" label="联系号码">
+						</el-table-column>
+						<!-- <sa-td type="img-list" name="核酸报告" prop="ticket"></sa-td> -->
+						<el-table-column label="操作">
+							<template slot-scope="s">
+								<!-- <el-button class="c-btn" type="primary" @click="uploadFn(s.row)">上传</el-button> -->
+								<el-button class="c-btn" type="info" @click="editFn(s.row)">修改</el-button>
+								<el-button class="c-btn" type="danger" @click="deleteFn(s.row)">删除</el-button>
+							</template>
+						</el-table-column>
+					</el-table>
+				</el-card>
+				<span slot="footer" class="dialog-footer">
+					<el-button @click="cancelAdd">取 消</el-button>
+					<el-button type="primary" @click="modal.visible=false">确 定</el-button>
+				</span>
+			</el-dialog>
+			<el-dialog title="人员核酸检测" :visible.sync="addModal.visible" width="400">
+				<span>
+					<el-form label-position="left">
+						<sa-item type="text" name="姓名" v-model="addModal.form.name" br></sa-item>
+						<sa-item type="text" name="联系号码" v-model="addModal.form.phone" br></sa-item>
+					</el-form>
+				</span>
+				<span slot="footer" class="dialog-footer">
+					<el-button @click="addModal.visible = false">取 消</el-button>
+					<el-button type="primary" @click="confirmAdd">确 定</el-button>
+				</span>
+			</el-dialog>
+		</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: {
+					id: sa.p('id', 0), // 获取超链接中的id参数(0=添加,非0=修改) 
+					m: {
+						id: '', // 主键 
+						customerId: '', // 客户id 
+						customerName: '', // 客户名称 
+						no: '', // 编号 
+						cardNo: '', // 车牌号 
+						countryName: '越南车',
+						cardSize: '', // 车规格 
+						netWeight: '', // 载重(kg) 
+						goodsName: '', // 商品 
+						chinaCarNo: '',
+						expectInDay: '',
+						driverName: '', // 司机名称 
+						driverPhone: '', // 司机联系号码 
+						driverIdCard: '', // 司机身份证 
+						payTicket: '', // 支付凭证 
+					}, // 实体对象 
+					customerList: [],
+					cardList: [],
+					driverList: [],
+					currentCustomerId: 1,
+					itemTypeList: [],
+					goodsList: [],
+					countryList: [{
+						name: '越南车'
+					}, {
+						name: '中国车'
+					}],
+					tableData: [],
+					modal: {
+						visible: false,
+						itemId: 4,
+						list: []
+					},
+					addModal: {
+						visible: false,
+						form: {
+							name: '',
+							phone: '',
+							itemId: 4,
+							ticket: ''
+						}
+					}
+				},
+				computed: {
+					totalPrice() {
+						let itemList = this.itemTypeList.filter(obj => obj.itemId);
+						let price = 0;
+						for (let i in itemList) {
+							let type = itemList[i];
+							let num = type.num;
+							let items = type.items;
+							for (let j in items) {
+								let item = items[j];
+								if (item.id == type.itemId) {
+									price += num * item.price;
+									break;
+								}
+							}
+						}
+						return price;
+					}
+				},
+				methods: {
+					addPeopleFn(itemId,show) {
+						sa.ajax('/TbBusinessPeople/getList', {
+							businessId: this.id
+						}, function(resp) {
+							let list = resp.data;
+							let index = 0;
+							let r = [];
+							for (let i in list) {
+								r.push({
+									name: list[i].name,
+									phone: list[i].phone,
+									index: index,
+									id: list[i].id
+								})
+								index++;
+							}
+							this.modal.list = r;
+
+						}.bind(this));
+						this.modal.itemId = itemId;
+						this.modal.visible = show;
+					},
+					showAddModal() {
+						Object.assign(this.addModal, {
+							visible: true,
+							form: {
+								index: -1,
+								name: '',
+								phone: '',
+								itemId: this.modal.itemId,
+								ticket: ''
+							}
+						})
+					},
+					cancelAdd() {
+						this.modal.list = [];
+						this.modal.visible = false;
+					},
+					confirmAdd() {
+						if (!this.addModal.form.name) {
+							sa.error('请输入检测人姓名')
+							return false;
+						}
+						if (!this.addModal.form.phone) {
+							sa.error('请输入检测人联系号码')
+							return false;
+						}
+						let dbIndex = this.addModal.form.index;
+						if (dbIndex >= 0) {
+							this.modal.list[dbIndex].name = this.addModal.form.name;
+							this.modal.list[dbIndex].phone = this.addModal.form.phone;
+						} else {
+							this.addModal.form.index = this.modal.list.length;
+							this.modal.list.push(this.addModal.form);
+						}
+						this.addModal.visible = false;
+					},
+					editFn(data) {
+						Object.assign(this.addModal, {
+							visible: true,
+							form: data
+						})
+					},
+					deleteFn(data) {
+						this.modal.list.splice(data.index, 1);
+						if (data.id) {
+							sa.ajax('/TbBusinessPeople/deleteById', {
+								id: data.id
+							}, function(resp) {
+
+							}.bind(this))
+						}
+					},
+					handleSelectChinaCar() {
+
+					},
+					getGoods() {
+						sa.ajax('/TbGoods/getList', {
+							pageNo: 1,
+							pageSize: 10
+						}, function(resp) {
+							this.goodsList = resp.data;
+						}.bind(this))
+					},
+					getItemTypeList() {
+						sa.ajax('/TbItemType/getList', function(resp) {
+							let typeList = resp.data;
+							// 初始化数据
+							if (this.id > 0) {
+								sa.ajax('/TbBusiness/getById?id=' + this.id, function(res) {
+									let m = res.data;
+									let items = m.items;
+									let hsItem= items.filter(obj=>obj.itemTypeName.indexOf('人')!==-1
+									&&obj.itemTypeName.indexOf('核酸')!==-1);
+									if(hsItem.length>0){
+										this.addPeopleFn(hsItem[0].itemTypeId,false)
+									}
+									for (let i in items) {
+										let item = items[i];
+										for (let j in typeList) {
+											let type = typeList[j];
+											if (item.itemTypeId == type.id) {
+												type.itemId = item.itemId;
+												type.num = item.num;
+												break;
+											}
+										}
+									}
+									this.m = m;
+								}.bind(this))
+							}
+							this.itemTypeList = typeList;
+						}.bind(this))
+					},
+					getCardList() {
+						sa.ajax('/TbCar/getList', {
+							pageNo: 1,
+							pageSize: 100
+						}, function(resp) {
+							this.cardList = resp.data;
+						}.bind(this));
+					},
+					queryCarAsync(queryStr, cb) {
+						let list = this.cardList;
+						let filterList = list.filter(obj => obj.cardNo.indexOf(queryStr) !== -1);
+						cb(filterList)
+					},
+					handleSelectCar(item) {
+						console.log(item);
+						this.m.cardSize = item.cardSize;
+						this.m.goodsName = item.lastGoodsName
+						this.m.countryName = item.countryName;
+						this.m.netWeight = item.lastNetWeight;
+					},
+					getDriverList() {
+						sa.ajax('/TbDriver/getList', {
+							pageNo: 1,
+							pageSize: 100
+						}, function(resp) {
+							this.driverList = resp.data;
+						}.bind(this));
+					},
+					queryDriverAsync(queryStr, cb) {
+						let list = this.driverList;
+						let filterList = list.filter(obj => obj.idCard.indexOf(queryStr) !== -1);
+						cb(filterList)
+					},
+					handleSelectDriver(item) {
+						this.m.driverId = item.id;
+						this.m.driverName = item.name;
+						this.m.driverIdCard = item.idCard;
+						this.m.driverPhone = item.phone
+					},
+					getCustomerList() {
+						sa.ajax('/TbCostomer/getList', {
+							pageNo: 1,
+							pageSize: 100,
+							judgeStatus: 2
+						}, function(resp) {
+							this.customerList = resp.data;
+							if (resp.data.length > 0) {
+								this.m.customerId = resp.data[0].id;
+							}
+						}.bind(this));
+					},
+					getCustomer() {
+						sa.ajax('/TbCostomer/getCurrentCustomerId', function(resp) {
+							let id = resp.data;
+							if (id == 1) {
+								this.getCustomerList();
+							} else {
+								this.m.customerId = id;
+							}
+							this.currentCustomerId = id;
+						}.bind(this));
+					},
+					// 提交数据 
+					ok: function() {
+						let itemList = this.itemTypeList.filter(obj => obj.itemId);
+						let list = [];
+						if (itemList.length == 0) {
+							sa.error('至少选择一项业务');
+							return false;
+						}
+						for (let i in itemList) {
+							let item = itemList[i];
+							if (!item.num || item.num <= 0) {
+								this.$message({
+									message: '请填写【' + item.name + '】数量',
+									type: 'error'
+								});
+								return;
+							}
+							list.push({
+								itemId: item.itemId,
+								num: item.num
+							})
+						}
+						if (itemList.filter(obj => obj.itemId == 4 || obj.itemId == 9).length > 0 && this.modal.list
+							.length == 0) {
+							sa.error('请添加核酸检测人员');
+							return false;
+						}
+						// 表单校验 
+						let m = this.m;
+						m.itemJson = JSON.stringify(list);
+						m.peopleJson = JSON.stringify(this.modal.list);
+						m.items = [];
+						if (this.currentCustomerId == 1) {
+							sa.checkNull(m.customerId, '请选择 [客户名称]');
+						}
+						sa.checkNull(m.cardNo, '请输入 [车牌号]');
+						sa.checkNull(m.cardSize, '请输入 [车规格]');
+						sa.checkNull(m.netWeight, '请输入 [载重]');
+						sa.checkNull(m.goodsName, '请选择运输货物');
+						sa.checkNull(m.driverName, '请输入 [司机名称]');
+						sa.checkNull(m.driverPhone, '请输入 [司机联系号码]');
+						sa.checkNull(m.chinaCarNo, '请输入 [中国车牌号]');
+						if (this.id <= 0) { // 添加
+							sa.ajax('/TbBusiness/add', m, function(res) {
+								sa.alert('增加成功', this.clean);
+							}.bind(this));
+						} else { // 修改
+							sa.ajax('/TbBusiness/update', m, function(res) {
+								sa.alert('修改成功', this.clean);
+							}.bind(this));
+						}
+					},
+					// 添加/修改 完成后的动作
+					clean: function() {
+						this.modal.list = [];
+						if (this.id == 0) {
+							this.m = this.createModel();
+						} else {
+							parent.app.f5(); // 刷新父页面列表
+							sa.closeCurrIframe(); // 关闭本页 
+						}
+					}
+				},
+				mounted: function() {
+					this.getCustomer();
+					this.getCardList();
+					this.getDriverList();
+					this.getItemTypeList();
+					this.getGoods();
+				}
+			})
+		</script>
+	</body>
+</html>

+ 74 - 85
sp-admin/sa-view/tb-business/tb-business-info.html

@@ -3,7 +3,8 @@
 	<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" />
+		<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">
@@ -16,7 +17,9 @@
 		<script src="../../static/sa.js"></script>
 		<script src="../../static/kj/upload-util.js"></script>
 		<style type="text/css">
-			.c-panel .c-label{width: 8em;}
+			.c-panel .c-label {
+				width: 8em;
+			}
 		</style>
 	</head>
 	<body>
@@ -28,6 +31,7 @@
 						<el-row>
 							<el-col span="12">
 								<sa-info name="客户名称" br>{{m.customerName}}</sa-info>
+
 								<sa-info name="业务编号" br>{{m.no}}</sa-info>
 								<sa-info name="境外车牌号" br>{{m.cardNo}}</sa-info>
 								<sa-info name="境外车规格" br>{{m.cardSize}}(米)</sa-info>
@@ -36,73 +40,63 @@
 									<label v-else>未入场</label>
 								</sa-info>
 								<sa-info name="出场时间" br>{{m.outDayTime}}</sa-info>
-								<sa-info name="停车时长" br>{{m.partTime}}(分)</sa-info>
-								<sa-info name="停车费用" br>{{m.partMoney}}(元)</sa-info>
+								<!-- <sa-info name="停车时长" br>{{m.partTime}}(分)</sa-info> -->
+								<sa-info name="停车费用(元)" br>{{m.partMoney}}</sa-info>
 								<sa-info name="载重" br>{{m.netWeight}}(吨)</sa-info>
 								<sa-info name="录入时间" br>{{m.createTime}}</sa-info>
 								<sa-info name="录入人" br>{{m.createBy}}</sa-info>
-								
+								<sa-info type="enum" name="支付状态" :value="m.payStatus"
+									:jv="{1: '未支付', 2: '已支付未确认', 3: '已支付已确认'}" br></sa-info>
+								<sa-info name="支付人" br>{{m.payBy}}</sa-info>
 							</el-col>
 							<el-col span="12">
 								<sa-info name="货物" br>{{m.goodsName}}</sa-info>
 								<sa-info name="中国车牌" br>{{m.chinaCarNo}}</sa-info>
 								<sa-info name="中国司机" br>{{m.driverName}}</sa-info>
 								<sa-info name="联系号码" br>{{m.driverPhone}}</sa-info>
+								<sa-info name="入场时间" br>{{m.chinaCarInTime}}</sa-info>
+								<sa-info name="出场时间" br>{{m.chinaCarOutTime}}</sa-info>
+								<!-- <sa-info name="停车时长" br>{{m.partTime}}(分)</sa-info> -->
+								<sa-info name="停车费用(元)" br>{{m.partMoney}}</sa-info>
 								<sa-info name="业务费用(元)" br>{{m.itemPrice}}</sa-info>
 								<sa-info name="合计费用(元)" br>{{m.totalMoney}}</sa-info>
-								<sa-info name="确认时间" br>{{m.confirmInputTime}}</sa-info>
-								<sa-info name="确认人" br>{{m.confirmInputBy}}</sa-info>
-								<sa-info type="enum" name="支付状态" :value="m.payStatus" :jv="{1: '未支付', 2: '已支付未确认', 3: '已支付已确认'}" br></sa-info>
-								<sa-info name="支付人" br>{{m.payBy}}</sa-info>
 								<sa-info name="支付时间" br>{{m.payTime}}</sa-info>
 								<sa-info type="img-list" name="支付凭证" :value="m.payTicket" br></sa-info>
+								<sa-info name="确认时间" br>{{m.confirmInputTime}}</sa-info>
+								<sa-info name="确认人" br>{{m.confirmInputBy}}</sa-info>
 							</el-col>
 						</el-row>
 						<el-row>
 							<el-collapse value='1'>
-							  <el-collapse-item  name="1">
-								  <div slot="title">
-								  	具体业务项
-									<label style="color: red; font-weight: bold;margin-left: 20px;">总费用:({{m.itemPrice}}元)</label>
-								  </div>
-								   <el-table
-									  :data="tableData"
-									  style="width: 100%">
-									  <el-table-column
-										prop="itemTypeName"
-										label="业务分类"
-										width="180">
-									  </el-table-column>
-									  <el-table-column
-										prop="itemName"
-										label="具体"
-										width="180">
-									  </el-table-column>
-									  <el-table-column
-									  		prop="itemPrice"
-									  		label="单价">
-									  </el-table-column>
-									  <el-table-column
-										prop="unit"
-										label="计费标准">
-									  </el-table-column>
-									  <el-table-column
-									  		prop="num"
-									  		label="数量">
-									  </el-table-column>
-									  <el-table-column
-									  		prop="total"
-									  		label="合计">
-									  </el-table-column>
-									  <sa-td type="img-list" name="凭据" prop="ticket" ></sa-td>
-									  <el-table-column label="其他凭据">
-									  	<template slot-scope="s">
-									  		<el-button class="c-btn" type="primary"   @click="uploadFn(s.row)">上传</el-button>
-									  	</template>
-									  </el-table-column>
+								<el-collapse-item name="1">
+									<div slot="title">
+										具体业务项
+										<label
+											style="color: red; font-weight: bold;margin-left: 20px;">总费用:({{m.itemPrice}}元)</label>
+									</div>
+									<el-table :data="tableData" style="width: 100%">
+										<el-table-column prop="itemTypeName" label="业务分类" width="180">
+										</el-table-column>
+										<el-table-column prop="itemName" label="具体" width="180">
+										</el-table-column>
+										<el-table-column prop="itemPrice" label="单价">
+										</el-table-column>
+										<el-table-column prop="unit" label="计费标准">
+										</el-table-column>
+										<el-table-column prop="num" label="数量">
+										</el-table-column>
+										<el-table-column prop="total" label="合计">
+										</el-table-column>
+										<sa-td type="img-list" name="凭据" prop="ticket"></sa-td>
+										<el-table-column label="其他凭据">
+											<template slot-scope="s">
+												<el-button class="c-btn" type="primary" @click="uploadFn(s.row)">上传
+												</el-button>
+											</template>
+										</el-table-column>
 									</el-table>
-									
-							  </el-collapse-item>
+
+								</el-collapse-item>
 							</el-collapse>
 						</el-row>
 					</el-form>
@@ -110,64 +104,60 @@
 			</div>
 			<!-- ------- 底部按钮 ------- -->
 			<div class="s-foot">
-				<el-button type="success" @click="sa.closeCurrIframe()">确定</el-button>
-				<el-button @click="sa.closeCurrIframe()">取消</el-button>
+				<el-button type="success" @click="sa.closeCurrIframe()">关闭</el-button>
 			</div>
-			
-			<el-dialog
-			  title="上传凭据"
-			  :visible.sync="upload.visible"
-			  width="400">
-			  <el-form>
-			  	<sa-item type="img-list" name="凭据图片" v-model="upload.form.ticket" br></sa-item>
-			  </el-form>
-			  <span slot="footer" class="dialog-footer">
-			    <el-button @click="upload.visible=false">取 消</el-button>
-			    <el-button type="primary" @click="ok()">确 定</el-button>
-			  </span>
+
+			<el-dialog title="上传凭据" :visible.sync="upload.visible" width="400">
+				<el-form>
+					<sa-item type="img-list" name="凭据图片" v-model="upload.form.ticket" br></sa-item>
+				</el-form>
+				<span slot="footer" class="dialog-footer">
+					<el-button @click="upload.visible=false">取 消</el-button>
+					<el-button type="primary" @click="ok()">确 定</el-button>
+				</span>
 			</el-dialog>
-		
+
 		</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'),
-					"sa-td": httpVueLoader('../../sa-frame/com/sa-td.vue'),		
+					"sa-td": httpVueLoader('../../sa-frame/com/sa-td.vue'),
 				},
 				el: '.vue-box',
 				data: {
-					id: sa.p('id', 0),	// 获取数据ID 
+					id: sa.p('id', 0), // 获取数据ID 
 					m: null,
-					tableData:[],
-					upload:{
-						visible:false,
-						form:{
-							id:'',
-							ticket:''
+					tableData: [],
+					upload: {
+						visible: false,
+						form: {
+							id: '',
+							ticket: ''
 						}
 					}
 				},
 				methods: {
-					uploadFn(data){
-						Object.assign(this.upload,{
-							visible:true,
-							form:data
+					uploadFn(data) {
+						Object.assign(this.upload, {
+							visible: true,
+							form: data
 						})
 					},
-					ok(){
-						if(!this.upload.form.ticket){
+					ok() {
+						if (!this.upload.form.ticket) {
 							sa.error('请上传凭据');
 							return;
 						}
-						sa.ajax('/TbBusinessItem/update',this.upload.form,function(resp){
-							this.upload.visible=false;
+						sa.ajax('/TbBusinessItem/update', this.upload.form, function(resp) {
+							this.upload.visible = false;
 						}.bind(this))
 					},
-					getInfo(){
+					getInfo() {
 						sa.ajax('/TbBusiness/getById?id=' + this.id, function(res) {
 							this.m = res.data;
-							this.tableData=res.data.items;
+							this.tableData = res.data.items;
 						}.bind(this))
 					}
 				},
@@ -175,7 +165,6 @@
 					this.getInfo()
 				}
 			})
-			
 		</script>
 	</body>
 </html>

+ 109 - 47
sp-admin/sa-view/tb-business/tb-business-list.html

@@ -16,6 +16,12 @@
 		<script src="../../static/sa.js"></script>
 		<script src="../../static/kj/upload-util.js"></script>
 	</head>
+	<style>
+		.complete-modal .c-label,
+		.confirm-in .c-label,.confirm-info .c-label {
+			width: 200px;
+		}
+	</style>
 	<body>
 		<div class="vue-box" style="display: none;" :style="'display: block;'">
 			<div class="c-panel">
@@ -48,20 +54,22 @@
 					<sa-td name="载重(吨)" prop="netWeight"></sa-td>
 					<!-- 	<sa-td name="司机名称" prop="driverName" ></sa-td>
 					<sa-td name="司机联系" width="120" prop="driverPhone" ></sa-td> -->
-					<sa-td name="支付凭证" prop="payTicket" type="img-list"></sa-td>
-					<sa-td name="业务费(元)" prop="itemPrice"></sa-td>
-					<!-- <sa-td  name="是否放行" prop="adminConfirmPay" type="enum"
-						:jv="{0: '否[#ff0000]', 1: '否[#005500]'}"></sa-td> -->
-					<sa-td name="入场时间" width="140" prop="realInTime"></sa-td>
-					<sa-td name="离场时间" width="140" prop="outDayTime"></sa-td>
+					<sa-td name="总费用费(元)" prop="itemPrice"></sa-td>
 					<sa-td width="130" name="支付状态" prop="payStatus" type="enum"
 						:jv="{1: '未支付[#ff0000]', 2: '已支付(未确认)[#ffaa00]', 3: '已支付(已确认)[#005500]'}"></sa-td>
-					<sa-td width="160" name="支付时间" prop="payTime"></sa-td>
+						<sa-td width="160" name="支付时间" prop="payTime"></sa-td>
+					<sa-td name="支付凭证" prop="payTicket" type="img-list"></sa-td>
+					<sa-td  name="放行状态" prop="adminConfirmPay" type="enum"
+						:jv="{0: '不可放行[#ff0000]', 1: '可放行[#005500]'}"></sa-td>
+					<!-- <sa-td name="入场时间" width="140" prop="realInTime"></sa-td>
+					<sa-td name="离场时间" width="140" prop="outDayTime"></sa-td> -->
 					<sa-td width="160" name="录入时间" prop="createTime"></sa-td>
 					<sa-td name="账单确认" prop="confirmInput" type="enum" :jv="{0: '未确认[#ff0000]', 1: '已确认[#005500]'}">
 					</sa-td>
 					<el-table-column label="操作" width="240px" fixed="right">
 						<template slot-scope="s">
+							<el-button class="c-btn" type="primary" v-if="s.row.realInTime!=null
+								&&s.row.complete==0&&currentCustomerId=='1'" @click="completeFn(s.row)">生成账单</el-button>
 							<el-button class="c-btn" type="primary" v-if="s.row.confirmInput==0
 								&&s.row.payStatus==1
 								&&s.row.outDayTime!=null
@@ -71,10 +79,11 @@
 								&&s.row.payStatus==1&&s.row.confirmInput==1&&currentCustomerId!='1'" @click="payFn(s.row)">
 								马上支付</el-button>
 							<el-button class="c-btn" type="primary"
-								v-if="currentCustomerId=='1'&&s.row.realInTime==null" @click="inFn(s.row)">确认入场
+								v-if="currentCustomerId=='1'&&(s.row.realInTime==null&&s.row.chinaCarInTime==null)"
+								@click="inFn(s.row)">确认入场
 							</el-button>
 							<el-button class="c-btn" type="primary"
-								v-if="currentCustomerId=='1'&&s.row.outDayTime==null&&s.row.realInTime!=null"
+							 v-if="currentCustomerId=='1'&&s.row.complete==1&&s.row.payStatus>1"
 								@click="outFn(s.row)">确认离场
 							</el-button>
 							<el-button class="c-btn" type="success"
@@ -108,26 +117,34 @@
 				</span>
 			</el-dialog>
 			<el-dialog title="确认账单" :visible.sync="confirm.visible" width="30%">
-				<el-form>
-					<el-row>
-						<el-col>
-							<sa-info name="入场时间" br>{{confirm.form.realInTime}}</label>
-							</sa-info>
-							<sa-info name="出场时间" br>{{confirm.form.outDayTime}}</sa-info>
-							<sa-info name="停车时长" br>{{confirm.form.partTime}}(分)</sa-info>
-						</el-col>
-						<el-col>
-							<sa-info name="停车费用" br>{{confirm.form.partMoney}}(元)</sa-info>
-							<sa-info name="业务费用(元)" br>{{confirm.form.itemPrice}}</sa-info>
-							<sa-info name="合计费用(元)" br>{{confirm.form.totalMoney}}</sa-info>
-						</e-col>
-					</el-row>
-				</el-form>
+				<div class="confirm-info">
+					<sa-info name="停车费用" br>{{confirm.form.partMoney+confirm.form.chinaPartMoney}}(元)</sa-info>
+					<sa-info name="业务费用(元)" br>{{confirm.form.itemPrice}}</sa-info>
+					<sa-info name="合计费用(元)" br>{{confirm.form.totalMoney}}</sa-info>
+				</div>
 				<span slot="footer" class="dialog-footer">
 					<el-button @click="confirm.visible = false">取 消</el-button>
 					<el-button type="primary" @click="sureConfirmFn">确 认</el-button>
 				</span>
 			</el-dialog>
+			<el-dialog title="生成账单" :visible.sync="complete.visible" width="40%">
+				<div class="complete-modal">
+					<sa-info name="客户名称" br>{{complete.form.customerName}}</sa-info>
+					<sa-info name="业务单号" br>{{complete.form.no}}</sa-info>
+					<sa-info name="业务费用(元)" br>{{complete.form.itemPrice}}</sa-info>
+					<sa-item type="datetime" @input="jwCaroTimeChange" name="境外车预计离场" v-model="complete.form.outDayTime"
+						br></sa-item>
+					<sa-info name="停车费用(元)" br>{{complete.form.partMoney}}</sa-info>
+					<sa-item type="datetime" @input="chinaCaroTimeChange" name="中国车预计离场"
+						v-model="complete.form.chinaCarOutTime" br></sa-item>
+					<sa-info name="停车费用(元)" br>{{complete.form.chinaPartMoney}}</sa-info>
+					<sa-info name="总计费用" br>{{complete.form.totalMoney}}元</sa-info>
+				</div>
+				<span slot="footer" class="dialog-footer">
+					<el-button @click="complete.visible = false">取 消</el-button>
+					<el-button type="primary" @click="sureCompleteFn">确 认</el-button>
+				</span>
+			</el-dialog>
 			<el-dialog title="支付确认" :visible.sync="pay.visible" width="30%">
 				<sa-info name="业务单号" br>{{pay.form.no}}</sa-info>
 				<sa-info name="总计费用" br>{{pay.form.totalMoney}}元</sa-info>
@@ -139,8 +156,10 @@
 			</el-dialog>
 			<el-dialog title="确认入场" :visible.sync="rc.visible" width="30%">
 				<el-form label-position="left">
-					<sa-item type="text" name="入场通道" v-model="rc.form.inChannel" br></sa-item>
-					<sa-item type="datetime" name="入场时间" v-model="rc.form.realInTime" br></sa-item>
+					<div class="confirm-in">
+						<sa-item type="datetime" name="境外车入场时间" v-model="rc.form.realInTime" br></sa-item>
+						<sa-item type="datetime" name="中国车入场时间" v-model="rc.form.chinaCarInTime" br></sa-item>
+					</div>
 				</el-form>
 				<span slot="footer" class="dialog-footer">
 					<el-button @click="rc.visible = false">取 消</el-button>
@@ -149,8 +168,12 @@
 			</el-dialog>
 			<el-dialog title="确认离场" :visible.sync="out.visible" width="30%">
 				<el-form label-position="left">
-					<sa-item type="text" name="离场通道" v-model="out.form.outChannel" br></sa-item>
-					<sa-item type="datetime" name="离场时间" v-model="out.form.outDayTime" br></sa-item>
+					<div class="confirm-in">
+						<sa-item type="datetime"  name="境外车离场" v-model="out.form.outDayTime"
+							br></sa-item>
+						<sa-item type="datetime" name="中国车离场"
+							v-model="out.form.chinaCarOutTime" br></sa-item>
+					</div>
 				</el-form>
 				<span slot="footer" class="dialog-footer">
 					<el-button @click="out.visible = false">取 消</el-button>
@@ -222,38 +245,77 @@
 						visible: false,
 						form: {
 							inChannel: '',
-							realInTime: ''
+							realInTime: '',
+							carType: '境外车'
 						}
 					},
 					out: {
 						visible: false,
 						form: {
 							outChannel: '',
-							realInTime: ''
+							realInTime: '',
+							carType: '境外车'
+						}
+					},
+					complete: {
+						visible: false,
+						form: {
+							id: '',
+							no: ''
 						}
 					}
 				},
 				methods: {
+					jwCaroTimeChange(oTime) {
+						if (oTime) {
+							let o = Object.assign(this.complete.form);
+							o.items = [];
+							sa.ajaxNoLoading('/TbBusiness/calJwPartMoney', sa.removeNull(o), function(resp) {
+								this.complete.form = resp.data;
+							}.bind(this))
+						}
+					},
+					chinaCaroTimeChange(oTime) {
+						if (oTime) {
+							let o = Object.assign(this.complete.form);
+							o.items = [];
+							sa.ajaxNoLoading('/TbBusiness/calChinaPartMoney', sa.removeNull(o), function(resp) {
+								this.complete.form = resp.data;
+							}.bind(this))
+						}
+					},
+					completeFn(data) {
+						Object.assign(this.complete, {
+							visible: true,
+							form: data
+						})
+					},
+					sureCompleteFn() {
+						sa.ajax('/TbBusiness/complete', this.complete.form, function(resp) {
+							this.complete.visible = false;
+							this.f5();
+						}.bind(this))
+					},
 					inFn(data) {
 						Object.assign(this.rc, {
 							visible: true,
 							form: {
 								id: data.id,
-								inChannel: '',
-								realInTime: ''
+								realInTime: data.realInTime,
+								chinaCarInTime: data.chinaCarInTime
 							}
 						})
 					},
 					sureRcFn() {
-						if (!this.rc.form.inChannel) {
-							sa.error('填写入场通道')
+						if (!this.rc.form.realInTime) {
+							sa.error('请选择境外车入场时间')
 							return;
 						}
-						if (!this.rc.form.realInTime) {
-							sa.error('选择入场时间')
+						if (!this.rc.form.chinaCarInTime) {
+							sa.error('选择中国车入场时间')
 							return;
 						}
-						sa.ajax('/TbBusiness/adminSetIn', this.rc.form, function(resp) {
+						sa.ajax('/TbBusiness/adminSetIn', sa.removeNull(this.rc.form), function(resp) {
 							this.f5();
 							this.rc.visible = false;
 						}.bind(this))
@@ -262,19 +324,19 @@
 						Object.assign(this.out, {
 							visible: true,
 							form: {
-								id: data.id,
-								outDayTime: '',
-								outChannel: ''
+								id:data.id,
+								outDayTime:'',
+								chinaCarOutTime:''
 							}
 						})
 					},
 					sureOutFn() {
-						if (!this.out.form.outChannel) {
-							sa.error('请填写离场通道')
+						if (!this.out.form.outDayTime) {
+							sa.error('选择境外车离场时间')
 							return;
 						}
-						if (!this.out.form.outDayTime) {
-							sa.error('选择离场时间')
+						if (!this.out.form.chinaCarOutTime) {
+							sa.error('选择中国车离场时间')
 							return;
 						}
 						sa.ajax('/TbBusiness/adminOut', this.out.form, function(resp) {
@@ -290,9 +352,9 @@
 					adminSurePayFn(data) {
 						Object.assign(this.pay, {
 							visible: true,
-							form:data
+							form: data
 						})
-						this.pay.form.ids=data.id;
+						this.pay.form.ids = data.id;
 					},
 					surePayirmFn() {
 						sa.ajax('/TbBusiness/adminConfirmPay', this.pay.form, function(resp) {
@@ -363,7 +425,7 @@
 					},
 					// 修改
 					update: function(data) {
-						sa.showIframe('修改数据', 'tb-business-add.html?id=' + data.id, '1000px', '90%');
+						sa.showIframe('修改数据', 'tb-business-edit.html?id=' + data.id, '1000px', '90%');
 					},
 					// 新增
 					add: function(data) {

+ 5 - 2
sp-admin/sa-view/tb-costomer/tb-costomer-add.html

@@ -31,7 +31,7 @@
 							<sa-item type="text" name="客户名称" v-model="m.name" br></sa-item>
 							<sa-item type="text" name="联系人" v-model="m.dutyPeople" br></sa-item>
 							<sa-item type="text" name="联系号码" v-model="m.phone" br></sa-item>
-							<sa-item type="enum" name="结方式" v-model="m.payType" :jv="{2: '月结', 1: '现结'}" jtype="1" br></sa-item>
+							<sa-item type="enum" name="结方式" v-model="m.payType" :jv="{2: '月结', 1: '现结'}" jtype="1" br></sa-item>
 						<!-- 	<div class="c-item br">
 								<label class="c-label"><label style="color: red">*</label>地区:</label>
 								<el-cascader size="mini" placeholder="请选择" v-model="m.address_arry"
@@ -89,7 +89,10 @@
 						// 表单校验 
 						let m = this.m;
 						sa.checkNull(m.name, '请输入 [客户名称]');
-						sa.checkNull(m.phone, '请输入 [联系号码]');
+						if(!sa.isPhone(m.phone)){
+							sa.error('联系号码不正确')
+							return;
+						}
 						sa.checkNull(m.dutyPeople, '请输入 [负责人]');
 						// this.m.addressIds = this.m.address_arry.join(',');
 						// sa.checkNull(m.addressIds, '请选择 [地址信息]');

+ 16 - 15
sp-admin/sa-view/tb-costomer/tb-costomer-info.html

@@ -3,7 +3,8 @@
 	<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" />
+		<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">
@@ -14,7 +15,9 @@
 		<script src="../../static/kj/layer/layer.js"></script>
 		<script src="../../static/sa.js"></script>
 		<style type="text/css">
-			.c-panel .c-label{width: 8em;}
+			.c-panel .c-label {
+				width: 8em;
+			}
 		</style>
 	</head>
 	<body>
@@ -25,18 +28,19 @@
 					<el-form v-if="m">
 						<el-row>
 							<el-col span="12">
-								<sa-info name="名称" br>{{m.name}}</sa-info>
-								<sa-info name="联系号码" br>{{m.phone}}</sa-info>
-								<sa-info name="负责人" br>{{m.dutyPeople}}</sa-info>
-								<!-- <sa-info name="地址" br>{{m.addressStr}}</sa-info> -->
+								<sa-info name="公司名称" br>{{m.name}}</sa-info>
 								<sa-info type="img" name="营业执照" :value="m.businessLicence" br></sa-info>
+								<sa-info name="联系人" br>{{m.dutyPeople}}</sa-info>
+								<sa-info name="联系号码" br>{{m.phone}}</sa-info>
+								<sa-info type="enum" name="状态" :value="m.status" :jv="{0: '禁用', 1: '启用'}" br></sa-info>
 							</el-col>
 							<el-col span="12">
-								<sa-info type="enum" name="状态" :value="m.status" :jv="{0: '否', 1: '是'}" br></sa-info>
 								<sa-info name="创建时间" br>{{m.creareTime}}</sa-info>
-								<sa-info type="enum" name="审核状态" :value="m.judgeStatus" :jv="{1: '未审核'}" br></sa-info>
+								<sa-info type="enum" name="审核状态" :value="m.judgeStatus"
+									:jv="{1: '未审核',2: '审核通过',3: '审核不通过'}" br></sa-info>
 								<sa-info name="审核时间" br>{{m.judgeTime}}</sa-info>
 								<sa-info name="审核意见" br>{{m.judgeContent}}</sa-info>
+								<sa-info name="创建时间" br>{{m.creareTime}}</sa-info>
 							</el-col>
 						</el-row>
 					</el-form>
@@ -44,8 +48,7 @@
 			</div>
 			<!-- ------- 底部按钮 ------- -->
 			<div class="s-foot">
-				<el-button type="success" @click="sa.closeCurrIframe()">确定</el-button>
-				<el-button @click="sa.closeCurrIframe()">取消</el-button>
+				<el-button type="success" @click="sa.closeCurrIframe()">关闭</el-button>
 			</div>
 		</div>
 		<script>
@@ -55,21 +58,19 @@
 				},
 				el: '.vue-box',
 				data: {
-					id: sa.p('id', 0),	// 获取数据ID 
+					id: sa.p('id', 0), // 获取数据ID 
 					m: null
 				},
-				methods: {
-				},
+				methods: {},
 				mounted: function() {
 					sa.ajax('/TbCostomer/getById?id=' + this.id, function(res) {
 						this.m = res.data;
-						if(res.data == null) {
+						if (res.data == null) {
 							sa.alert('未能查找到 id=' + this.id + " 详细数据");
 						}
 					}.bind(this))
 				}
 			})
-			
 		</script>
 	</body>
 </html>

+ 3 - 11
sp-admin/sa-view/tb-costomer/tb-costomer-list.html

@@ -23,7 +23,7 @@
 				<el-form ref="form" :model='p' @submit.native.prevent>
 					<sa-item type="text" name="名称" v-model="p.name"></sa-item>
 					<sa-item type="text" name="联系号码" v-model="p.phone"></sa-item>
-					<sa-item type="text" name="负责人" v-model="p.dutyPeople"></sa-item>
+					<sa-item type="text" name="联系人" v-model="p.dutyPeople"></sa-item>
 					<div class="c-item">
 						<label class="c-label">审核状态:</label>
 						<el-select v-model="p.judgeStatus" placeholder="请选择" filterable>
@@ -34,14 +34,6 @@
 						</el-select>
 					</div>
 					<el-button type="primary" icon="el-icon-search" @click="p.pageNo = 1; f5()">查询</el-button>
-					<br />
-					<sa-item name="综合排序">
-						<el-radio-group v-model="p.sortType" class="s-radio-text">
-							<el-radio :label="0">默认</el-radio>
-							<el-radio :label="2">名称</el-radio>
-							<el-radio :label="8">创建时间</el-radio>
-						</el-radio-group>
-					</sa-item>
 				</el-form>
 				<el-button type="primary" icon="el-icon-plus" @click="add()" v-if="currentCustomerId=='1'">新增
 				</el-button>
@@ -58,7 +50,7 @@
 					<sa-td name="结算类型" prop="payType" type="enum" :jv="{1: '现结', 2: '月结'}"></sa-td>
 					<!-- <sa-td name="地址" prop="addressStr" ></sa-td> -->
 					<sa-td name="营业执照" prop="businessLicence" type="img"></sa-td>
-					<sa-td name="是否启用" prop="status" type="switch" :jv="{0: '否[#ff0000]', 1: '是[#005500]'}"
+					<sa-td name="状态" prop="status" type="switch" :jv="{0: '禁用[#ff0000]', 1: '启用[#005500]'}"
 						@change="s => updateStatus(s.row)"></sa-td>
 					<sa-td name="创建时间" prop="creareTime"></sa-td>
 					<sa-td name="审核状态" prop="judgeStatus" type="enum" :jv="{1: '未审核', 2: '已通过', 3: '不通过'}"></sa-td>
@@ -182,7 +174,7 @@
 					},
 					// 查看
 					get: function(data) {
-						sa.showIframe('数据详情', 'tb-costomer-info.html?id=' + data.id, '1050px', '90%');
+						sa.showIframe('数据详情', 'tb-costomer-info.html?id=' + data.id, '600px', '90%');
 					},
 					// 查看 - 根据选中的
 					getBySelect: function(data) {

+ 101 - 6
sp-admin/static/sa.js

@@ -9,7 +9,7 @@ var sa = {
 (function(){
 	// 公司开发环境
 	var cfg_dev = {
-		api_url: 'http://127.0.0.1:8099',	// 所有ajax请求接口父地址
+		api_url: 'http://192.168.3.217:8099/pro',	// 所有ajax请求接口父地址
 		web_url: 'http://www.baidu.com'		// 此项目前台地址 (此配置项非必须)
 	}
 	// 服务器测试环境
@@ -29,6 +29,90 @@ var sa = {
 // ===========================  ajax的封装  ======================================= 
 (function(){
 	
+	sa.ajaxNoLoading = function(url, data, success200, cfg){
+		
+		// 如果是简写模式(省略了data参数)
+		if(typeof data === 'function'){
+			cfg = success200;
+			success200 = data;
+			data = {};
+		}
+		
+		// 默认配置
+		var defaultCfg = {
+			baseUrl: (url.indexOf('http') === 0 ? '' : sa.cfg.api_url),// 父url,拼接在url前面
+			sleep: 0,	// 休眠n毫秒处理回调函数 
+			type: 'post',	// 默认请求类型 
+			success200: success200,			// code=200, 代表成功 
+			success500: function(res){		// code=500, 代表失败 
+				return layer.alert('失败:' + res.msg);
+			},
+			success403: function(res){		// code=403, 代表权限不足
+				return layer.alert("权限不足," + res.msg, {icon: 5});
+			},
+			success401: function(res){		// code=401, 代表未登录
+				return layer.confirm("您当前暂未登录,是否立即登录?", {}, function(){
+					layer.closeAll();
+					return sa.$page.openLogin(cfg.login_url);
+				});
+			},
+			errorfn: function(xhr, type, errorThrown){		// ajax发生异常时的默认处理函数
+				if(xhr.status == 0){
+					return layer.alert('无法连接到服务器,请检查网络');
+				}
+				return layer.alert("异常:" + JSON.stringify(xhr));
+			},
+			complete: function(xhr, ts) {	// 成功失败都会执行 
+				
+			}
+		}
+		
+		// 将调用者的配置和默认配置合并 
+		cfg = sa.extendJson(cfg, defaultCfg);
+		
+		// 开始显示loading图标 
+		if(cfg.msg != null){
+			sa.loading(cfg.msg);
+		}
+		
+		// 开始请求ajax 
+		return $.ajax({
+			url: cfg.baseUrl + url,
+			type: cfg.type, 
+			data: data,
+			dataType: 'json',
+			// xhrFields: {
+			// 	withCredentials: true // 携带跨域cookie
+			// },
+			// crossDomain: true,
+			beforeSend: function(xhr) {
+				xhr.setRequestHeader('X-Requested-With','XMLHttpRequest');
+				// 追加token
+				if(localStorage.tokenName) {
+					xhr.setRequestHeader(localStorage.tokenName, localStorage.tokenValue);
+				}
+			},
+			success: function(res){
+				console.log('返回数据:', res);
+				setTimeout(function() {
+					sa.hideLoading();
+					// 如果相应的处理函数存在
+					if(cfg['success' + res.code] != undefined) {
+						return cfg['success' + res.code](res);
+					}
+					layer.alert('未知状态码:' + JSON.stringify(res));
+				}, cfg.sleep);
+			},
+			error: function(xhr, type, errorThrown){
+				setTimeout(function() {
+					sa.hideLoading();
+					return cfg.errorfn(xhr, type, errorThrown);
+				}, cfg.sleep);
+			},
+			complete: cfg.complete
+		});
+		
+	};
 	/** 对ajax的再封装, 这个ajax假设你的接口会返回以下格式的内容 
 		{
 			"code": 200,
@@ -94,10 +178,6 @@ var sa = {
 		// 将调用者的配置和默认配置合并 
 		cfg = sa.extendJson(cfg, defaultCfg);
 		
-		// 打印请求地址和参数, 以便调试 
-		console.log("请求地址:" + cfg.baseUrl + url);
-		console.log("请求参数:" + JSON.stringify(data));
-		
 		// 开始显示loading图标 
 		if(cfg.msg != null){
 			sa.loading(cfg.msg);
@@ -672,6 +752,14 @@ var sa = {
 			} 
 			return false;
 		}
+		me.isNum = function(str) {
+			str = str + '';
+			if((/^[0-9]*$/.test(str))||(/^[0-9]+(.[0-9]{1})?$/.test(str))){ 
+				return true; 
+			} 
+			return false;
+		}
+		
 		
 		// 产生随机字符串
 		me.randomString = function(len) {
@@ -735,7 +823,14 @@ var sa = {
 			}
 			return null;
 		}
-		
+		// 正则验证是否为手机号
+		me.isPhone = function(str) {
+			str = str + '';
+			if ((/^1[3456789]\d{9}$/.test(str))) {
+				return true;
+			}
+			return false;
+		}
 		// 从数组删除指定记录
 		me.arrayDelete = function(arr, item){
 			if(item instanceof Array) {

+ 1 - 0
sp-server/app.pid

@@ -0,0 +1 @@
+23040

+ 0 - 0
sp-server/logs/pco/SxFx_info.log


+ 0 - 0
sp-server/logs/pco/comm_info.log


Різницю між файлами не показано, бо вона завелика
+ 47 - 0
sp-server/logs/pco/log_debug.log


Різницю між файлами не показано, бо вона завелика
+ 25 - 0
sp-server/logs/pco/log_info.log


+ 9 - 1
sp-server/src/main/java/com/pj/SpServerApplication.java

@@ -2,11 +2,15 @@ package com.pj;
 
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.context.ApplicationPidFileWriter;
 import org.springframework.boot.web.servlet.ServletComponentScan;
 import org.springframework.cache.annotation.EnableCaching;
 import org.springframework.scheduling.annotation.EnableScheduling;
 import org.springframework.transaction.annotation.EnableTransactionManagement;
 
+import java.io.File;
+import java.util.Properties;
+
 /**
  * 启动 
  * @author kong 
@@ -19,7 +23,11 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
 public class SpServerApplication {
 
 	public static void main(String[] args) {
-		SpringApplication.run(SpServerApplication.class, args);
+		Properties properties = System.getProperties();
+		String rootPath = properties.getProperty("user.dir");
+		SpringApplication application = new SpringApplication(SpServerApplication.class);
+		application.addListeners(new ApplicationPidFileWriter(rootPath + File.separator + "app.pid"));
+		application.run(args);
 	}
 	
 }

+ 80 - 52
sp-server/src/main/java/com/pj/api/open/service/OpenService.java

@@ -1,6 +1,7 @@
 package com.pj.api.open.service;
 
 import cn.hutool.core.util.NumberUtil;
+import cn.hutool.core.util.StrUtil;
 import com.pj.api.open.ResultJson;
 import com.pj.api.open.bo.CheckCarNumberBO;
 import com.pj.current.config.PartConfig;
@@ -14,14 +15,11 @@ import org.springframework.stereotype.Service;
 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.LocalTime;
-import java.time.ZoneId;
-import java.time.format.DateTimeFormatter;
-import java.time.temporal.ChronoUnit;
+import java.util.ArrayList;
 import java.util.Date;
+import java.util.List;
 
 @Service
 @Transactional
@@ -32,60 +30,90 @@ public class OpenService {
     private TbCostomerService tbCostomerService;
     @Resource
     private TbCarService tbCarService;
+    private final List<String> CAR_LIST = StrUtil.splitTrim("浙,粤,京,津,冀,晋,蒙,辽,黑,沪,吉,苏,皖,赣,鲁,豫,鄂,湘,桂,琼,渝,川,贵,云,藏, 陕, 甘, 青, 宁", ",");
 
 
     public ResultJson checkCarNumber(CheckCarNumberBO checkCarNumberBO) {
-        String carNo=checkCarNumberBO.getCarNumber();
-        TbBusiness tbBusiness= tbBusinessService.findCarTheNewRecord(carNo);
-       if (tbBusiness==null||tbBusiness.getOutDayTime()!=null){
-           return ResultJson.error("无业务登记记录");
-       }
-        if (tbBusiness.getConfirmInput()==0){
-            return ResultJson.error("业务订单未确认,请先确认");
+        String carNo = checkCarNumberBO.getCarNumber();
+        String start = carNo.substring(0, 1);
+        if (CAR_LIST.contains(start)) {
+            return handlerChinaCar(checkCarNumberBO);
+        } else {
+            return handlerOutCar(checkCarNumberBO);
+        }
+
+    }
+
+    private ResultJson handlerOutCar(CheckCarNumberBO checkCarNumberBO) {
+        String carNo = checkCarNumberBO.getCarNumber();
+        TbBusiness tbBusiness = tbBusinessService.findCarTheNewRecord(carNo);
+        if (tbBusiness == null) {
+            return ResultJson.error("无业务登记记录");
         }
-      int inOrOut= checkCarNumberBO.getInOrOut();
-        TbCar car=tbCarService.findByCardNo(carNo);
+        Date outTime=tbBusiness.getOutDayTime();
         Date now=new Date();
-       if (inOrOut==1){
-           if (tbBusiness.getRealInDay()==null){
-               //入场
-               tbBusiness.setRealInTime(now)
-                       .setInChannel(checkCarNumberBO.getChannelName());
-               car.setLastInTime(now);
-               tbBusinessService.updateById(tbBusiness);
-               return ResultJson.success();
-           }else {
-               return ResultJson.error("车辆已入场");
-           }
-       }else{
-           if (tbBusiness.getOutDayTime()==null){
-              TbCostomer tbCostomer= tbCostomerService.getById(tbBusiness.getCustomerId());
-              car.setLastOutTime(now);
-               tbCarService.updateById(car);
-               tbBusiness.setOutChannel(checkCarNumberBO.getChannelName());
-               try {
-                   handlerOut(tbBusiness);
-               } catch (Exception e) {
-                   e.printStackTrace();
-               }
-               if (tbCostomer.getPayType()==2){
-                  return ResultJson.success();
-              }else {
-                  if (tbBusiness.getPayStatus() != 3) {
-                      return ResultJson.error("车辆未缴费");
-                  }
-              }
-               return ResultJson.success();
-           }else {
-               return ResultJson.error("车辆已离场");
-           }
-       }
+        if (outTime!=null&&Math.abs(outTime.getHours()-now.getHours())>10) {
+            return ResultJson.error("无业务登记记录");
+        }
+        if (tbBusiness.getAdminConfirmPay() ==0) {
+            return ResultJson.error("账单未支付");
+        }
+        int inOrOut = checkCarNumberBO.getInOrOut();
+        TbCar car = tbCarService.findByCardNo(carNo);
+        if (inOrOut == 1) {
+            if (tbBusiness.getRealInDay() == null) {
+                //入场
+                tbBusiness.setRealInTime(now)
+                        .setInChannel(checkCarNumberBO.getChannelName());
+                car.setLastInTime(now);
+                tbBusinessService.updateById(tbBusiness);
+                return ResultJson.success();
+            } else {
+                return ResultJson.error("车辆已入场");
+            }
+        } else {
+            if (tbBusiness.getOutDayTime() == null) {
+                TbCostomer tbCostomer = tbCostomerService.getById(tbBusiness.getCustomerId());
+                car.setLastOutTime(now);
+                tbCarService.updateById(car);
+                tbBusiness.setOutChannel(checkCarNumberBO.getChannelName());
+                handlerOut(tbBusiness);
+                if (tbCostomer.getPayType() == 2) {
+                    return ResultJson.success();
+                } else {
+                    if (tbBusiness.getPayStatus() != 3) {
+                        return ResultJson.error("车辆未缴费");
+                    }
+                }
+                return ResultJson.success();
+            } else {
+                return ResultJson.error("车辆已离场");
+            }
+        }
+
+    }
 
+    private ResultJson handlerChinaCar(CheckCarNumberBO checkCarNumberBO) {
+        String carNo = checkCarNumberBO.getCarNumber();
+        TbBusiness cb = tbBusinessService.findByChinaCarNo(carNo);
+        Date now = new Date();
+        String channel = checkCarNumberBO.getChannelName();
+        if (checkCarNumberBO.getInOrOut() == 1 && cb.getRealInTime() == null) {
+            cb.setChinaCarInTime(now).setChinaCarInChannel(channel);
+            tbBusinessService.updateById(cb);
+            return ResultJson.success();
+        }
+        if (checkCarNumberBO.getInOrOut() == 2) {
+            cb.setChinaCarOutTime(now).setChinaCarOutChannel(channel);
+            tbBusinessService.calculationPartMoney("中国车", cb);
+            return ResultJson.success();
+        }
+        return null;
     }
 
-    private void handlerOut(TbBusiness tbBusiness) throws Exception{
+    private void handlerOut(TbBusiness tbBusiness) {
         tbBusiness.setOutDayTime(new Date());
-       tbBusinessService.calculationPartMoney(tbBusiness);
-       tbBusinessService.updateById(tbBusiness);
+        tbBusinessService.calculationPartMoney("越南车", tbBusiness);
+        tbBusinessService.updateById(tbBusiness);
     }
 }

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

@@ -16,7 +16,8 @@ import lombok.experimental.Accessors;
 
 /**
  * Model: tb_business -- 入境登记
- * @author qzy 
+ *
+ * @author qzy
  */
 @Data
 @Accessors(chain = true)
@@ -24,177 +25,182 @@ import lombok.experimental.Accessors;
 @EqualsAndHashCode(callSuper = false)
 public class TbBusiness extends Model<TbBusiness> implements Serializable {
 
-	// ---------- 模块常量 ----------
-	/**
-	 * 序列化版本id 
-	 */
-	private static final long serialVersionUID = 1L;	
-	/**
-	 * 此模块对应的表名 
-	 */
-	public static final String TABLE_NAME = "tb_business";	
-	/**
-	 * 此模块对应的权限码 
-	 */
-	public static final String PERMISSION_CODE = "tb-business";	
-	public static final String PERMISSION_LIST = "tb-business-list";
-	public static final String PERMISSION_CONFIRM = "tb-business-confirm";
-	public static final String PERMISSION_PAY = "tb-business-pay";
-	public static final String PERMISSION_INPUT = "tb-business-add";
-
-
-
-	// ---------- 表中字段 ----------
-	/**
-	 * 主键 
-	 */
-	private String id;
-
-	/**
-	 * 客户id 
-	 */
-	private String customerId;
-
-	/**
-	 * 客户名称 
-	 */
-	private String customerName;	
-
-	/**
-	 * 编号 
-	 */
-	private String no;	
-
-	/**
-	 * 车牌号 
-	 */
-	private String cardNo;
-	private String countryName;
-
-	/**
-	 * 车规格 
-	 */
-	private Double cardSize;
-
-	/**
-	 * 载重(kg) 
-	 */
-	private Double netWeight;	
-
-	/**
-	 * 商品 
-	 */
-	private String goodsName;	
-
-	/**
-	 * 商品编号 
-	 */
-	private String goodsCode;	
-
-	/**
-	 * 司机名称 
-	 */
-	private String driverName;	
-
-	/**
-	 * 司机id 
-	 */
-	private String driverId;
-
-	/**
-	 * 司机联系号码 
-	 */
-	private String driverPhone;	
-
-	/**
-	 * 司机身份证 
-	 */
-	private String driverIdCard;	
-
-	/**
-	 * 支付凭证 
-	 */
-	private String payTicket;	
-
-	/**
-	 * 预计进边境日期 
-	 */
-	private Date expectInDay;
-
-	/**
-	 * 实际进边境日期 
-	 */
-	private Date realInDay;
-
-	/**
-	 * 实际进境时间 
-	 */
-	private Date realInTime;
-	/**
-	 * 入场通道
-	 */
-	private String inChannel;
-
-
-	/**
-	 * 支付状态(1=未支付,2=已支付,3=运营人员确认支付)
-	 */
-	private Integer payStatus=1;
-
-	/**
-	 * 支付时间 
-	 */
-	private Date payTime;
-
-	/**
-	 * 支付方式(1=线下支付,2现金支付,3=第三方支付) 
-	 */
-	private Integer payType=1;
-	private String payBy;
-
-	/**
-	 * 离境时间 
-	 */
-	private Date outDayTime;
-	/**
-	 * 出场通道
-	 */
-	private String outChannel;
-
-
-	/**
-	 * 停车费用 
-	 */
-	private BigDecimal partMoney;
-
-	/**
-	 * 停车时常(分) 
-	 */
-	private Long partTime;
-	private BigDecimal itemPrice;
-	private BigDecimal totalMoney;
-	private Date createTime;
-	private String createBy;
-	private Integer confirmInput;
-	private Date confirmInputTime;
-	private String confirmInputBy;
-
-
-	private Integer adminConfirmPay;
-	private Date adminConfirmPayTime;
-	private String adminConfirmPayBy;
-	//结账方式(1=现结,2=月结)[j]
-	private int customerType;
-	private String chinaCarNo;
-
-	private transient String itemJson;
-	private transient String peopleJson;
-	@TableField(exist = false)
-	private List<TbBusinessItem>items=new ArrayList<>();
-
-
-
-	
+    // ---------- 模块常量 ----------
+    /**
+     * 序列化版本id
+     */
+    private static final long serialVersionUID = 1L;
+    /**
+     * 此模块对应的表名
+     */
+    public static final String TABLE_NAME = "tb_business";
+    /**
+     * 此模块对应的权限码
+     */
+    public static final String PERMISSION_CODE = "tb-business";
+    public static final String PERMISSION_LIST = "tb-business-list";
+    public static final String PERMISSION_CONFIRM = "tb-business-confirm";
+    public static final String PERMISSION_PAY = "tb-business-pay";
+    public static final String PERMISSION_INPUT = "tb-business-add";
+
+
+    // ---------- 表中字段 ----------
+    /**
+     * 主键
+     */
+    private String id;
+
+    /**
+     * 客户id
+     */
+    private String customerId;
+
+    /**
+     * 客户名称
+     */
+    private String customerName;
+
+    /**
+     * 编号
+     */
+    private String no;
+
+    /**
+     * 车牌号
+     */
+    private String cardNo;
+    private String countryName;
+
+    /**
+     * 车规格
+     */
+    private Double cardSize;
+
+    /**
+     * 载重(kg)
+     */
+    private Double netWeight;
+
+    /**
+     * 商品
+     */
+    private String goodsName;
+
+    /**
+     * 商品编号
+     */
+    private String goodsCode;
+
+    /**
+     * 司机名称
+     */
+    private String driverName;
+
+    /**
+     * 司机id
+     */
+    private String driverId;
+
+    /**
+     * 司机联系号码
+     */
+    private String driverPhone;
+
+    /**
+     * 司机身份证
+     */
+    private String driverIdCard;
+
+    /**
+     * 支付凭证
+     */
+    private String payTicket;
+
+    /**
+     * 预计进边境日期
+     */
+    private Date expectInDay;
+
+    /**
+     * 实际进边境日期
+     */
+    private Date realInDay;
+
+    /**
+     * 实际进境时间
+     */
+    private Date realInTime;
+    /**
+     * 入场通道
+     */
+    private String inChannel;
+
+
+    /**
+     * 支付状态(1=未支付,2=已支付,3=运营人员确认支付)
+     */
+    private Integer payStatus = 1;
+
+    /**
+     * 支付时间
+     */
+    private Date payTime;
+
+    /**
+     * 支付方式(1=线下支付,2现金支付,3=第三方支付)
+     */
+    private Integer payType = 1;
+    private String payBy;
+
+    /**
+     * 离境时间
+     */
+    private Date outDayTime;
+    /**
+     * 出场通道
+     */
+    private String outChannel;
+
+
+    /**
+     * 停车费用
+     */
+    private BigDecimal partMoney=new BigDecimal(0);
+
+    private BigDecimal chinaPartMoney=new BigDecimal(0);
+
+    /**
+     * 停车时常(分)
+     */
+    private Long partTime;
+    private Long chinaCarPartTime;
+    private BigDecimal itemPrice=new BigDecimal(0);
+    private BigDecimal totalMoney=new BigDecimal(0);
+    private Date createTime;
+    private String createBy;
+    private Integer confirmInput;
+    private Date confirmInputTime;
+    private String confirmInputBy;
+
+
+    private Integer adminConfirmPay;
+    private Date adminConfirmPayTime;
+    private String adminConfirmPayBy;
+    //结账方式(1=现结,2=月结)[j]
+    private int customerType;
+    private String chinaCarNo;
+    private String chinaCarInChannel;
+    private String chinaCarOutChannel;
+    private Date chinaCarInTime;
+    private Date chinaCarOutTime;
+    /**
+     * 是否完成 0 1
+     */
+    private Integer complete=0;
+    private transient String itemJson;
+    private transient String peopleJson;
+    @TableField(exist = false)
+    private List<TbBusinessItem> items = new ArrayList<>();
 
 
 }

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

@@ -26,175 +26,229 @@ import javax.annotation.Resource;
 
 /**
  * Controller: tb_business -- 入境登记
- * @author qzy 
+ *
+ * @author qzy
  */
 @RestController
 @RequestMapping("/TbBusiness/")
 public class TbBusinessController {
 
-	/** 底层 Service 对象 */
-	@Autowired
-	TbBusinessService tbBusinessService;
-	@Resource
-	private TbBusinessItemService tbBusinessItemService;
-	@Resource
+    /**
+     * 底层 Service 对象
+     */
+    @Autowired
+    TbBusinessService tbBusinessService;
+    @Resource
+    private TbBusinessItemService tbBusinessItemService;
+    @Resource
     private TbPassRecordService tbPassRecordService;
 
-	/** 增 */  
-	@RequestMapping("add")
-	@SaCheckPermission(TbBusiness.PERMISSION_CODE)
-	@Transactional(rollbackFor = Exception.class)
-	public AjaxJson add(TbBusiness t){
-		return tbBusinessService.addOrUpdate(t);
-	}
-
-	/** 删 */  
-	@RequestMapping("delete")
-	@SaCheckPermission(TbBusiness.PERMISSION_INPUT)
-	@Transactional(rollbackFor = Exception.class)
-	public AjaxJson delete(String id){
-		tbBusinessService.removeById(id);
-		tbBusinessItemService.removeByBusinessId(id);
-		return AjaxJson.getSuccess();
-	}
-	
-	/** 删 - 根据id列表 */  
-	@RequestMapping("deleteByIds")
-	@SaCheckPermission(TbBusiness.PERMISSION_CODE)
-	@Transactional(rollbackFor = Exception.class)
-	public AjaxJson deleteByIds(){
-		List<Long> ids = SoMap.getRequestSoMap().getListByComma("ids", long.class);
-		ids.forEach(id->{
-			tbBusinessItemService.removeByBusinessId(id+"");
-		});
-		int line = SP.publicMapper.deleteByIds(TbBusiness.TABLE_NAME, ids);
-		return AjaxJson.getByLine(line);
-	}
-	
-	/** 改 */  
-	@RequestMapping("update")
-	@SaCheckPermission(TbBusiness.PERMISSION_CODE)
-	public AjaxJson update(TbBusiness t){
-		tbBusinessService.addOrUpdate(t);
-		return AjaxJson.getSuccess();
-	}
-	/** 确认业务 */
-	@RequestMapping("confirm")
-	@Transactional(rollbackFor = Exception.class)
-	public AjaxJson confirm(){
-		if (!StpUtil.hasPermissionAnd(TbBusiness.PERMISSION_CONFIRM)&&!
-				StrUtil.equals(StpUserUtil.getCustomerId(), UserTypeEnum.PLATFORM_ADMIN.getCustomerId())) {
-			return AjaxJson.getError("无确认业务权限");
-		}
-		SoMap so = SoMap.getRequestSoMap();
-		List<String>ids=so.getListByComma("ids",String.class);
-		tbBusinessService.confirm(ids);
-		return AjaxJson.getSuccess();
-	}
-	/** 确认业务 */
-	@RequestMapping("adminConfirmPay")
-	@Transactional(rollbackFor = Exception.class)
-	public AjaxJson adminConfirmPay(){
-		if (!StrUtil.equals(StpUserUtil.getCustomerId(), UserTypeEnum.PLATFORM_ADMIN.getCustomerId())) {
-			return AjaxJson.getError("无确认支付权限");
-		}
-		SoMap so = SoMap.getRequestSoMap();
-		List<String>ids=so.getListByComma("ids",String.class);
-		String ticket=so.getString("payTicket");
-		tbBusinessService.adminConfirmPay(ids,ticket);
-		return AjaxJson.getSuccess();
-	}
-
-	/** 手动入场确认 */
-	@RequestMapping("adminConfirmIn")
-	@Transactional(rollbackFor = Exception.class)
-	public AjaxJson adminConfirmIn(){
-		if (!StrUtil.equals(StpUserUtil.getCustomerId(), UserTypeEnum.PLATFORM_ADMIN.getCustomerId())) {
-			return AjaxJson.getError("无确认入场权限");
-		}
-		SoMap so = SoMap.getRequestSoMap();
-		String id=so.getString("id");
-		String inChannel=so.getString("inChannel");
-		tbBusinessService.adminConfirmIn(id,inChannel);
-		return AjaxJson.getSuccess();
-	}
-
-
-
-	/** 查 - 根据id */  
-	@RequestMapping("getById")
-	public AjaxJson getById(String id){
-		TbBusiness t = tbBusinessService.getById(id);
-		List<TbBusinessItem>items=tbBusinessItemService.findByBusinessId(id);
-		t.setItems(items);
-		return AjaxJson.getSuccessData(t);
-	}
-
-	/** 查集合 - 根据条件(参数为空时代表忽略指定条件) */  
-	@RequestMapping("getList")
-	public AjaxJson getList() { 
-		SoMap so = SoMap.getRequestSoMap();
-		String currentCustomerId=StpUserUtil.getCustomerId();
-		if (!currentCustomerId.equals(UserTypeEnum.PLATFORM_ADMIN.getCustomerId())) {
-			so.put("customerId",currentCustomerId);
-		}
-		List<TbBusiness> list = tbBusinessService.getList(so.startPage());
-		return AjaxJson.getPageData(so.getDataCount(), list);
-	}
-
-	/** 改 */
-	@RequestMapping("pay")
-	public AjaxJson pay(){
-		if (!StpUtil.hasPermissionAnd("tb-business-pay")&&!
-		StrUtil.equals(StpUserUtil.getCustomerId(), UserTypeEnum.PLATFORM_ADMIN.getCustomerId())) {
-			return AjaxJson.getError("无支付权限");
-		}
-		SoMap so = SoMap.getRequestSoMap();
-		String id=so.getString("id");
-		String payTicket=so.getString("payTicket");
-		tbBusinessService.pay(id,payTicket);
-		return AjaxJson.getSuccess();
-	}
-
-	@RequestMapping("adminSetIn")
-	public AjaxJson adminSetIn(){
-		if (!StrUtil.equals(StpUserUtil.getCustomerId(), UserTypeEnum.PLATFORM_ADMIN.getCustomerId())) {
-			return AjaxJson.getError("无入场权限");
-		}
-		SoMap so = SoMap.getRequestSoMap();
-		String id=so.getString("id");
-		Date inTime=so.getDateTime("realInTime");
-		TbBusiness tbBusiness=tbBusinessService.getById(id);
-		tbBusiness.setRealInTime(inTime).setInChannel(so.getString("inChannel"));
-		tbBusinessService.updateById(tbBusiness);
+    /**
+     * 增
+     */
+    @RequestMapping("add")
+    @SaCheckPermission(TbBusiness.PERMISSION_CODE)
+    @Transactional(rollbackFor = Exception.class)
+    public AjaxJson add(TbBusiness t) {
+        return tbBusinessService.addOrUpdate(t);
+    }
+
+    /**
+     * 删
+     */
+    @RequestMapping("delete")
+    @SaCheckPermission(TbBusiness.PERMISSION_INPUT)
+    @Transactional(rollbackFor = Exception.class)
+    public AjaxJson delete(String id) {
+        tbBusinessService.removeById(id);
+        tbBusinessItemService.removeByBusinessId(id);
+        return AjaxJson.getSuccess();
+    }
+
+    /**
+     * 删 - 根据id列表
+     */
+    @RequestMapping("deleteByIds")
+    @SaCheckPermission(TbBusiness.PERMISSION_CODE)
+    @Transactional(rollbackFor = Exception.class)
+    public AjaxJson deleteByIds() {
+        List<Long> ids = SoMap.getRequestSoMap().getListByComma("ids", long.class);
+        ids.forEach(id -> {
+            tbBusinessItemService.removeByBusinessId(id + "");
+        });
+        int line = SP.publicMapper.deleteByIds(TbBusiness.TABLE_NAME, ids);
+        return AjaxJson.getByLine(line);
+    }
+
+    /**
+     * 改
+     */
+    @RequestMapping("update")
+    @SaCheckPermission(TbBusiness.PERMISSION_CODE)
+    public AjaxJson update(TbBusiness t) {
+        tbBusinessService.addOrUpdate(t);
+        return AjaxJson.getSuccess();
+    }
+
+    /**
+     * 确认业务
+     */
+    @RequestMapping("confirm")
+    @Transactional(rollbackFor = Exception.class)
+    public AjaxJson confirm() {
+        if (!StpUtil.hasPermissionAnd(TbBusiness.PERMISSION_CONFIRM) && !
+                StrUtil.equals(StpUserUtil.getCustomerId(), UserTypeEnum.PLATFORM_ADMIN.getCustomerId())) {
+            return AjaxJson.getError("无确认业务权限");
+        }
+        SoMap so = SoMap.getRequestSoMap();
+        List<String> ids = so.getListByComma("ids", String.class);
+        tbBusinessService.confirm(ids);
+        return AjaxJson.getSuccess();
+    }
+
+    /**
+     * 确认业务
+     */
+    @RequestMapping("adminConfirmPay")
+    @Transactional(rollbackFor = Exception.class)
+    public AjaxJson adminConfirmPay() {
+        if (!StrUtil.equals(StpUserUtil.getCustomerId(), UserTypeEnum.PLATFORM_ADMIN.getCustomerId())) {
+            return AjaxJson.getError("无确认支付权限");
+        }
+        SoMap so = SoMap.getRequestSoMap();
+        List<String> ids = so.getListByComma("ids", String.class);
+        String ticket = so.getString("payTicket");
+        tbBusinessService.adminConfirmPay(ids, ticket);
+        return AjaxJson.getSuccess();
+    }
+
+    /**
+     * 手动入场确认
+     */
+    @RequestMapping("adminConfirmIn")
+    @Transactional(rollbackFor = Exception.class)
+    public AjaxJson adminConfirmIn() {
+        if (!StrUtil.equals(StpUserUtil.getCustomerId(), UserTypeEnum.PLATFORM_ADMIN.getCustomerId())) {
+            return AjaxJson.getError("无确认入场权限");
+        }
+        SoMap so = SoMap.getRequestSoMap();
+        String id = so.getString("id");
+        String inChannel = so.getString("inChannel");
+        tbBusinessService.adminConfirmIn(id, inChannel);
+        return AjaxJson.getSuccess();
+    }
+
+
+    /**
+     * 查 - 根据id
+     */
+    @RequestMapping("getById")
+    public AjaxJson getById(String id) {
+        TbBusiness t = tbBusinessService.getById(id);
+        List<TbBusinessItem> items = tbBusinessItemService.findByBusinessId(id);
+        t.setItems(items);
+        return AjaxJson.getSuccessData(t);
+    }
+
+    /**
+     * 查集合 - 根据条件(参数为空时代表忽略指定条件)
+     */
+    @RequestMapping("getList")
+    public AjaxJson getList() {
+        SoMap so = SoMap.getRequestSoMap();
+        String currentCustomerId = StpUserUtil.getCustomerId();
+        if (!currentCustomerId.equals(UserTypeEnum.PLATFORM_ADMIN.getCustomerId())) {
+            so.put("customerId", currentCustomerId);
+        }
+        List<TbBusiness> list = tbBusinessService.getList(so.startPage());
+        return AjaxJson.getPageData(so.getDataCount(), list);
+    }
+
+    /**
+     * 改
+     */
+    @RequestMapping("pay")
+    public AjaxJson pay() {
+        if (!StpUtil.hasPermissionAnd("tb-business-pay") && !
+                StrUtil.equals(StpUserUtil.getCustomerId(), UserTypeEnum.PLATFORM_ADMIN.getCustomerId())) {
+            return AjaxJson.getError("无支付权限");
+        }
+        SoMap so = SoMap.getRequestSoMap();
+        String id = so.getString("id");
+        String payTicket = so.getString("payTicket");
+        tbBusinessService.pay(id, payTicket);
+        return AjaxJson.getSuccess();
+    }
+
+    @RequestMapping("adminSetIn")
+    public AjaxJson adminSetIn() {
+        if (!StrUtil.equals(StpUserUtil.getCustomerId(), UserTypeEnum.PLATFORM_ADMIN.getCustomerId())) {
+            return AjaxJson.getError("无入场权限");
+        }
+        SoMap so = SoMap.getRequestSoMap();
+        String id = so.getString("id");
+        Date inTime = so.getDateTime("realInTime");
+        Date chinaCarInTime = so.getDateTime("chinaCarInTime");
+        TbBusiness tbBusiness = tbBusinessService.getById(id);
+        tbBusiness.setChinaCarInTime(chinaCarInTime).setRealInTime(inTime);
+        tbBusinessService.updateById(tbBusiness);
 
         //更新放行记录
         TbPassRecord record = tbPassRecordService.getByBusinessId(tbBusiness.getId());
         record.setStatus(2).setInTime(tbBusiness.getRealInTime()).setUpdateTime(new Date());
         tbPassRecordService.saveOrUpdate(record);
 
-		return AjaxJson.getSuccess();
-	}
-	@RequestMapping("adminOut")
-	public AjaxJson adminOut()throws Exception{
-		if (!StrUtil.equals(StpUserUtil.getCustomerId(), UserTypeEnum.PLATFORM_ADMIN.getCustomerId())) {
-			return AjaxJson.getError("无离场权限");
-		}
-		SoMap so = SoMap.getRequestSoMap();
-		String id=so.getString("id");
-		tbBusinessService.adminOut(id,so.getDateTime("outDayTime"),so.getString("outChannel"));
-		return AjaxJson.getSuccess();
-	}
-
-
-
-	// ------------------------- 前端接口 -------------------------
-	
-	
-
-	
-	
-	
-	
+        return AjaxJson.getSuccess();
+    }
+
+    @RequestMapping("adminOut")
+    public AjaxJson adminOut(){
+        if (!StrUtil.equals(StpUserUtil.getCustomerId(), UserTypeEnum.PLATFORM_ADMIN.getCustomerId())) {
+            return AjaxJson.getError("无离场权限");
+        }
+        SoMap so = SoMap.getRequestSoMap();
+        String id = so.getString("id");
+       TbBusiness business= tbBusinessService.getById(id);
+       Date outTime=so.getDateTime("outDayTime");
+       Date chinaCarOutTime=so.getDateTime("chinaCarOutTime");
+        business.setOutDayTime(outTime);
+        tbBusinessService. calculationPartMoney("越南车",business);
+        tbBusinessService.updateById(business);
+        business.setChinaCarOutTime(chinaCarOutTime);
+        tbBusinessService. calculationPartMoney("中国车",business);
+        tbBusinessService.updateById(business);
+        return AjaxJson.getSuccess();
+    }
+
+    @RequestMapping("calJwPartMoney")
+    public AjaxJson calJwPartMoney(TbBusiness business) {
+        if (!StrUtil.equals(StpUserUtil.getCustomerId(), UserTypeEnum.PLATFORM_ADMIN.getCustomerId())) {
+            return AjaxJson.getError("无生成账单权限");
+        }
+        tbBusinessService.calculationPartMoney("越南车", business);
+        return AjaxJson.getSuccessData(business);
+    }
+
+    @RequestMapping("calChinaPartMoney")
+    public AjaxJson calChinaPartMoney(TbBusiness business) {
+        if (!StrUtil.equals(StpUserUtil.getCustomerId(), UserTypeEnum.PLATFORM_ADMIN.getCustomerId())) {
+            return AjaxJson.getError("无生成账单权限");
+        }
+        tbBusinessService.calculationPartMoney("中国车", business);
+        return AjaxJson.getSuccessData(business);
+    }
+    @RequestMapping("complete")
+    public AjaxJson complete(TbBusiness business) {
+        if (!StrUtil.equals(StpUserUtil.getCustomerId(), UserTypeEnum.PLATFORM_ADMIN.getCustomerId())) {
+            return AjaxJson.getError("无生成账单权限");
+        }
+        business.setComplete(1);
+        tbBusinessService.updateById(business);
+        return AjaxJson.getSuccessData(business);
+    }
+
+
+    // ------------------------- 前端接口 -------------------------
+
 
 }

+ 80 - 40
sp-server/src/main/java/com/pj/project/tb_business/TbBusinessService.java

@@ -89,17 +89,18 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
     private TbPassRecordService tbPassRecordService;
 
 
-    public TbBusiness checkCarNo(String carNo){
-        QueryWrapper<TbBusiness>ew=new QueryWrapper<>();
-        ew.eq("card_no",carNo).isNotNull("out_day_time");
+    public TbBusiness checkCarNo(String carNo) {
+        QueryWrapper<TbBusiness> ew = new QueryWrapper<>();
+        ew.eq("card_no", carNo).isNotNull("out_day_time");
         return this.getOne(ew);
     }
+
     /**
      * 增
      */
     public AjaxJson addOrUpdate(TbBusiness t) {
-        if (checkCarNo(t.getCardNo())!=null){
-         return AjaxJson.getError("该车辆【"+t.getCardNo()+"】有未完成业务");
+        if (checkCarNo(t.getCardNo()) != null) {
+            return AjaxJson.getError("该车辆【" + t.getCardNo() + "】有未完成业务");
         }
 
         t.setCreateBy(StpUserUtil.getAdmin().getName());
@@ -128,7 +129,7 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
         tbBusinessItemService.removeByBusinessId(t.getId());
         BigDecimal price = new BigDecimal(0);
         for (TbBusinessItem item : items) {
-            Integer num = item.getNum();
+            Double num = NumberUtil.parseDouble(item.getNum());
             TbItem tbItem = tbItemService.getById(item.getItemId());
             price = price.add(NumberUtil.mul(num, tbItem.getPrice()));
             TbItemType tbItemType = tbItemTypeService.getById(tbItem.getTypeId());
@@ -153,18 +154,18 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
 
     private void createBusinessPeople(TbBusiness t) {
         tbBusinessPeopleService.removeByBusinessId(t.getId());
-        List<TbBusinessPeople>peopleList=JSONUtil.toList(t.getPeopleJson(),TbBusinessPeople.class);
+        List<TbBusinessPeople> peopleList = JSONUtil.toList(t.getPeopleJson(), TbBusinessPeople.class);
         peopleList.forEach(tbBusinessPeople -> tbBusinessPeople.setBusinessId(t.getId()).setCreateTime(new Date()));
         tbBusinessPeopleService.saveBatch(peopleList);
     }
 
     private void createCarUnit(TbBusiness t) {
-       TbUnit tbUnit= tbUnitService.findByUnit(t.getCardSize());
-       if (tbUnit==null){
-           tbUnit=new TbUnit();
-           tbUnit.setUnit(t.getCardNo());
-           tbUnitService.save(tbUnit);
-       }
+        TbUnit tbUnit = tbUnitService.findByUnit(t.getCardSize());
+        if (tbUnit == null) {
+            tbUnit = new TbUnit();
+            tbUnit.setUnit(t.getCardNo());
+            tbUnitService.save(tbUnit);
+        }
     }
 
 
@@ -222,12 +223,15 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
     public void confirm(List<String> ids) {
         ids.forEach(id -> {
             TbBusiness business = this.getById(id);
+            if (business.getCustomerType()==2){
+                business.setAdminConfirmPay(1).setPayStatus(3);
+            }
             business.setConfirmInput(1).setConfirmInputTime(new Date()).setConfirmInputBy(StpUserUtil.getAdmin().getName());
             this.updateById(business);
         });
     }
 
-    public void adminConfirmPay(List<String> ids,String ticket) {
+    public void adminConfirmPay(List<String> ids, String ticket) {
         ids.forEach(id -> {
             TbBusiness business = this.getById(id);
             business.setAdminConfirmPayTime(new Date()).setAdminConfirmPay(1).setAdminConfirmPayBy(StpUserUtil.getAdmin().getName())
@@ -244,7 +248,7 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
         return list.isEmpty() ? null : list.get(0);
     }
 
-    public void adminConfirmIn(String id,String inChannel) {
+    public void adminConfirmIn(String id, String inChannel) {
         TbBusiness tbBusiness = this.getById(id);
         tbBusiness.setRealInTime(new Date()).setInChannel(inChannel);
         this.updateById(tbBusiness);
@@ -255,12 +259,11 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
         tbPassRecordService.saveOrUpdate(record);
     }
 
-    public void adminOut(String id, Date outDayTime,String outChannel) throws Exception{
-       TbBusiness tbBusiness= this.getById(id);
-      tbBusiness.setOutDayTime(outDayTime).setOutChannel(outChannel);
-
-      calculationPartMoney(tbBusiness);
-      this.updateById(tbBusiness);
+    public void adminOut(String id, Date outDayTime, String outChannel,String carType)  {
+        TbBusiness tbBusiness = this.getById(id);
+        tbBusiness.setOutDayTime(outDayTime).setOutChannel(outChannel);
+       calculationPartMoney(carType,tbBusiness);
+       this.updateById(tbBusiness);
 
         //更新放行记录
         TbPassRecord record = tbPassRecordService.getByBusinessId(tbBusiness.getId());
@@ -268,28 +271,65 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
         tbPassRecordService.saveOrUpdate(record);
 
     }
-    public void calculationPartMoney(TbBusiness tbBusiness)throws Exception{
-        LocalDateTime inDayTime=  tbBusiness.getRealInTime().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
-        LocalDateTime outDayTime=tbBusiness.getOutDayTime().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
-        long minutes= ChronoUnit.MINUTES.between(inDayTime,outDayTime);
-        if (minutes<0){
-            throw new Exception("离场时间不正确");
+
+    public void calculationPartMoney(String itemType,TbBusiness tbBusiness)  {
+        Date iTime=tbBusiness.getRealInTime();
+        Date oTime=tbBusiness.getOutDayTime();
+        if (itemType.contains("中国")){
+            iTime=tbBusiness.getChinaCarInTime();
+            oTime=tbBusiness.getChinaCarOutTime();
+        }
+       LocalDateTime inDayTime=iTime.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
+        LocalDateTime outDayTime=oTime.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
+        long minutes = ChronoUnit.MINUTES.between(inDayTime, outDayTime);
+        if (minutes < 0) {
+            return ;
+        }
+        double carSize=tbBusiness.getCardSize();
+        if (carSize < partConfig.getFreeCarLength() || minutes <= partConfig.getFreeMinutes()) {
+            return ;
         }
-        if (tbBusiness.getCardSize()<partConfig.getFreeCarLength()||minutes<=partConfig.getFreeMinutes()){
-            return;
+        String businessId=tbBusiness.getId();
+        TbBusinessItem businessItem=tbBusinessItemService.findByBusinessIdAndTypeName(businessId,itemType);
+        if (businessItem==null){
+            businessItem=new TbBusinessItem();
         }
-        LocalTime zero=LocalTime.of(0,0,0);
-        long days= ChronoUnit.DAYS.between(inDayTime.toLocalDate(),outDayTime.toLocalDate());
-        BigDecimal basePrice=partConfig.getBasePrice();
-        BigDecimal extraPrice=partConfig.getExtraPrice();
-        BigDecimal price= basePrice.add(basePrice.multiply(new BigDecimal(days)));
-        LocalTime outTime=outDayTime.toLocalTime();
+        LocalTime zero = LocalTime.of(0, 0, 0);
+        long days = ChronoUnit.DAYS.between(inDayTime.toLocalDate(), outDayTime.toLocalDate());
+        BigDecimal basePrice = partConfig.getBasePrice();
+        BigDecimal extraPrice = partConfig.getExtraPrice();
+        BigDecimal price = basePrice.add(basePrice.multiply(new BigDecimal(days)));
+        LocalTime outTime = outDayTime.toLocalTime();
         if (outTime.isBefore(LocalTime.parse(partConfig.getNightEnd(), DateTimeFormatter.ofPattern("HH:mm:ss")))
-                &&outTime.isAfter(zero)){
-            price=  price.add(extraPrice);
+                && outTime.isAfter(zero)) {
+            price = price.add(extraPrice);
+        }
+        long hour=ChronoUnit.HOURS.between(zero,outTime);
+        if (days==0){
+            hour=ChronoUnit.HOURS.between(inDayTime,outDayTime);
+        }
+        String num=days+"天"+hour+"小时";
+        if (hour==0){
+            num=minutes+"分钟";
         }
-        tbBusiness.setPartMoney(price);
-        tbBusiness.setTotalMoney(tbBusiness.getPartMoney().add(tbBusiness.getItemPrice()))
-                .setPartTime(minutes);
+        businessItem.setTotal(price).setUnit("天").setItemTypeName(itemType).setItemPrice(partConfig.getBasePrice())
+                .setBusinessId(businessId).setItemName("停车费").setNum(num);
+        tbBusinessItemService.saveOrUpdate(businessItem);
+        if (itemType.contains("中国")){
+            tbBusiness.setChinaPartMoney(price).setChinaCarPartTime(minutes);
+        }else {
+            tbBusiness.setPartMoney(price).setPartTime(minutes);;
+        }
+        tbBusiness.setTotalMoney(tbBusiness.getItemPrice().add(tbBusiness.getChinaPartMoney()).add(tbBusiness.getPartMoney()));
     }
+
+    public TbBusiness findByChinaCarNo(String carNo) {
+        QueryWrapper<TbBusiness> ew = new QueryWrapper<>();
+        ew.eq("china_car_no", carNo);
+        ew.orderByDesc("id");
+        List<TbBusiness> list = this.list(ew);
+        return list.isEmpty() ? null : list.get(0);
+    }
+
+
 }

+ 1 - 1
sp-server/src/main/java/com/pj/project/tb_business_item/TbBusinessItem.java

@@ -84,7 +84,7 @@ public class TbBusinessItem extends Model<TbBusinessItem> implements Serializabl
 	/**
 	 * 数量
 	 */
-	private Integer num;
+	private String num;
 	private String unit;
 	private BigDecimal total;
 	private String ticket;

+ 7 - 0
sp-server/src/main/java/com/pj/project/tb_business_item/TbBusinessItemService.java

@@ -58,4 +58,11 @@ public class TbBusinessItemService extends ServiceImpl<TbBusinessItemMapper,TbBu
 		ew.eq("business_id",businessId);
 		return list(ew);
     }
+
+	public TbBusinessItem findByBusinessIdAndTypeName(String businessId, String itemTypeName) {
+		QueryWrapper<TbBusinessItem>ew=new QueryWrapper<>();
+		ew.eq("business_id",businessId);
+		ew.eq("item_type_name",itemTypeName);
+		return getOne(ew);
+	}
 }

+ 2 - 0
sp-server/src/main/java/com/pj/project/tb_goods/TbGoods.java

@@ -61,6 +61,8 @@ public class TbGoods extends Model<TbGoods> implements Serializable {
 	 * 创建时间 
 	 */
 	private Date createTime;
+	private String needIds;
+	private String noNeedIds;
 
 
 

+ 1 - 1
sp-server/src/main/java/com/pj/project/tb_goods/TbGoodsMapper.xml

@@ -41,7 +41,7 @@
 	
 	<!-- 公共查询sql片段 -->
 	<sql id="select_sql">
-		select id, code, name, status, create_time 
+		select *
 		from tb_goods 
 	</sql>
 	

+ 2 - 0
sp-server/src/main/java/com/pj/project/tb_item_type/TbItemType.java

@@ -54,6 +54,8 @@ public class TbItemType extends Model<TbItemType> implements Serializable {
 	 */
 	private int need;
 	private String code;
+	private Integer inc=0;
+
 	@TableField(exist = false)
 	private List<TbItem>items=new ArrayList<>();
 

+ 3 - 1
sp-server/src/main/java/com/pj/utils/so/SoMap.java

@@ -14,6 +14,7 @@ import java.util.regex.Pattern;
 
 import javax.servlet.http.HttpServletRequest;
 
+import cn.hutool.core.util.StrUtil;
 import org.springframework.web.context.request.RequestContextHolder;
 import org.springframework.web.context.request.ServletRequestAttributes;
 
@@ -129,7 +130,8 @@ public class SoMap extends LinkedHashMap<String, Object> {
 	/** 转为Date并返回,根据自定义格式 */
 	public Date getDateByFormat(String key, String format) {
 		try {
-			return new SimpleDateFormat(format).parse(getString(key));
+			String value=getString(key);
+			return	StrUtil.isEmpty(value)?null:new SimpleDateFormat(format).parse(value);
 		} catch (Exception e) {
 			throw new RuntimeException(e);
 		}

+ 3 - 2
sp-server/src/main/resources/application.yml

@@ -64,5 +64,6 @@ mybatis-plus:
         map-underscore-to-camel-case: true
         # 即使属性为null, 也要映射 
         call-setters-on-nulls: true
-
-
+server:
+    servlet:
+        context-path: /pro

+ 110 - 36
sp-server/src/main/resources/logback.xml

@@ -1,51 +1,125 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<configuration xmlns="http://ch.qos.logback/xml/ns/logback"
-	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-	xsi:schemaLocation="http://ch.qos.logback/xml/ns/logback https://raw.githubusercontent.com/enricopulatzo/logback-XSD/master/src/main/xsd/logback.xsd">
-	
-	<!-- 定义日志打印的根目录,不同的项目之间一般只用改这个属性值就够了 -->
-	<property name="LOG_HOME" value="/log/sp-server" />
-	
-	<!-- 输出到控制台 -->
+<configuration>
+	<contextName>pco</contextName>
+	<property name="LOG_PATH" value="logs"/>
+	<property name="APP_DIR" value="pco"/>
+	<property name="log.maxFileSize" value="10MB"/>
+	<property name="log.maxFileCnt" value="30"/>
+	<property name="log.totalSizeCap" value="5GB"/>
+
+	<appender name="FILE_DEBUG" class="ch.qos.logback.core.rolling.RollingFileAppender">
+		<file>${LOG_PATH}/${APP_DIR}/log_debug.log</file>
+		<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
+			<fileNamePattern>${LOG_PATH}/${APP_DIR}/debug/debug-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
+			<maxFileSize>${log.maxFileSize}</maxFileSize>
+			<maxHistory>${log.maxFileCnt}</maxHistory>
+			<totalSizeCap>${log.totalSizeCap}</totalSizeCap>
+		</rollingPolicy>
+		<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
+			<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS}|%-5level{10}[%25.25thread{24}]%-40.40logger{39}|-Line:%-3L:%msg%n
+			</pattern>
+			<charset>utf-8</charset>
+		</encoder>
+		<filter class="ch.qos.logback.classic.filter.LevelFilter">
+			<level>debug</level>
+			<onMatch>ACCEPT</onMatch>
+			<!--            <onMismatch>DENY</onMismatch>-->
+		</filter>
+	</appender>
+
+	<appender name="FILE_INFO" class="ch.qos.logback.core.rolling.RollingFileAppender">
+		<file>${LOG_PATH}/${APP_DIR}/log_info.log</file>
+		<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
+			<fileNamePattern>${LOG_PATH}/${APP_DIR}/info/info-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
+			<maxFileSize>${log.maxFileSize}</maxFileSize>
+			<maxHistory>${log.maxFileCnt}</maxHistory>
+			<totalSizeCap>${log.totalSizeCap}</totalSizeCap>
+		</rollingPolicy>
+		<append>true</append>
+		<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
+			<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS}|%-5level{10}[%25.25thread{24}]%-40.40logger{39}|-Line:%-3L:%msg%n
+			</pattern>
+			<charset>UTF-8</charset>
+		</encoder>
+		<filter class="ch.qos.logback.classic.filter.LevelFilter">
+			<level>info</level>
+			<onMatch>ACCEPT</onMatch>
+			<onMismatch>DENY</onMismatch>
+		</filter>
+	</appender>
+
 	<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
-		<!-- 输出的格式 -->
+		<!--encoder 默认配置为PatternLayoutEncoder-->
+		<encoder>
+			<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS}|%highlight(%-5level{10})[%boldYellow(%25.25thread{24})]%gray(%-50.50logger{49})|-Line:%boldYellow(%-3L):%msg%n
+			</pattern>
+			<charset>UTF-8</charset>
+		</encoder>
+		<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
+			<level>info</level>
+		</filter>
+	</appender>
+
+	<appender name="COMM_LOG" class="ch.qos.logback.core.rolling.RollingFileAppender">
+		<file>${LOG_PATH}/${APP_DIR}/comm_info.log</file>
+		<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
+			<fileNamePattern>${LOG_PATH}/${APP_DIR}/comm/comm_info-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
+			<maxFileSize>${log.maxFileSize}</maxFileSize>
+			<maxHistory>${log.maxFileCnt}</maxHistory>
+			<totalSizeCap>${log.totalSizeCap}</totalSizeCap>
+		</rollingPolicy>
+		<append>true</append>
 		<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
-			<pattern>%-25d{yyyy-MM-dd HH:mm:ss.SSS} %green(%-5level) %boldBlue(-->)  %msg%n</pattern>
-			<!-- <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} %-5level [%thread] --> <!-- %logger{50}: %msg%n</pattern> -->
+			<pattern>%msg%n</pattern>
+			<charset>UTF-8</charset>
 		</encoder>
+		<filter class="ch.qos.logback.classic.filter.LevelFilter">
+			<level>info</level>
+			<onMatch>ACCEPT</onMatch>
+			<onMismatch>DENY</onMismatch>
+		</filter>
 	</appender>
+	<logger name="com.cryann.hsms.driver.netty" additivity="false">
+		<appender-ref ref="COMM_LOG"/>
+	</logger>
 
-	<!-- 文件输出 -->
-	<appender name="FILE"
-		class="ch.qos.logback.core.rolling.RollingFileAppender">
-		<!-- 配置滚动的策略 -->
+	<appender name="SXFX_info_LOG" class="ch.qos.logback.core.rolling.RollingFileAppender">
+		<file>${LOG_PATH}/${APP_DIR}/SxFx_info.log</file>
 		<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
-			<!-- 日志名称的格式:LOG_HOME/年_月/年_月_日/年_月_日_时(索引).log -->
-			<fileNamePattern>${LOG_HOME}/%d{yyyy_MM}/%d{yyyy_MM_dd}/%d{yyyy_MM_dd_HH}(%i).log</fileNamePattern>
-			<!-- 单log文件最大大小 -->
-			<maxFileSize>1MB</maxFileSize> 
-			<!-- 保存的最长时间:天数 -->
-			<maxHistory>3650</maxHistory>
+			<fileNamePattern>${LOG_PATH}/${APP_DIR}/SxFx/SxFx_info-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
+			<maxFileSize>${log.maxFileSize}</maxFileSize>
+			<maxHistory>${log.maxFileCnt}</maxHistory>
+			<totalSizeCap>${log.totalSizeCap}</totalSizeCap>
 		</rollingPolicy>
+		<append>true</append>
 		<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
-			<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} %-5level [%thread] --> : %msg%n</pattern>
+			<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS}|%highlight(%-5level{10})[%boldYellow(%25.25thread{24})]%gray(%-50.50logger{49})|-Line:%boldYellow(%-3L):%msg%n
+			</pattern>
+			<charset>UTF-8</charset>
 		</encoder>
+		<filter class="ch.qos.logback.classic.filter.LevelFilter">
+			<level>info</level>
+			<onMatch>ACCEPT</onMatch>
+			<onMismatch>DENY</onMismatch>
+		</filter>
 	</appender>
+	<logger name="com.cryann.hsms.driver.config.log" additivity="false">
+		<appender-ref ref="SXFX_info_LOG"/>
+	</logger>
 
+	<logger name="org.springframework" level="WARN"/>
+	<logger name="org.hibernate" level="WARN"/>
+	<logger name="com.apache.ibatis" level="TRACE"/>
+	<logger name="java.sql.Connection" level="DEBUG"/>
+	<logger name="java.sql.Statement" level="DEBUG"/>
+	<logger name="java.sql.PreparedStatement" level="DEBUG"/>
 
-	<!-- 相当于logger元素,只是name值已经确定为root了 -->
+	<!-- 生产环境下,将此级别配置为适合的级别,以免日志文件太多或影响程序性能 -->
 	<root level="INFO">
-		<appender-ref ref="STDOUT" />
-		<appender-ref ref="FILE" />
+		<!-- 生产环境将请stdout,testfile去掉 -->
+		<appender-ref ref="STDOUT"/>
+		<appender-ref ref="FILE_DEBUG"/>
+		<!--<appender-ref ref="FILEWARN"/>-->
+		<appender-ref ref="FILE_INFO"/>
 	</root>
-	
-	<!-- 可以设置具体到某个包的日志打印规则 -->
-	<!-- 注意: level属性也可以直接写在logger上,如: <logger name="ws.log.logback.LogbackTest" 
-		additivity="false" level="INFO"> <appender-ref ref="STDOUT" /> </logger> -->
-	<!-- <logger name="com.cr.utils.FC" additivity="false">
-		<level value="DEBUG" />
-		<appender-ref ref="STDOUT" />
-		<appender-ref ref="FILE" />
-	</logger> -->
-	
-</configuration>
+</configuration>

Деякі файли не було показано, через те що забагато файлів було змінено