Bläddra i källkod

Merge branch 'master' of http://47.101.143.145:8090/77975466/pco

# Conflicts:
#	app/pages/customer-management/customer-management.vue
#	sp-server/app.pid
#	sp-server/src/main/java/com/pj/project/tb_business/TbBusinessController.java
#	sp-server/src/main/java/com/pj/project/tb_business/TbBusinessService.java
qzyReal 3 år sedan
förälder
incheckning
7c4c77f7d3

+ 17 - 16
app/pages/business-entering/business-edit.vue

@@ -56,7 +56,7 @@
 			<view class="item">
 				<view class="l">境外车规格:</view>
 				<view class="r">
-					<u-input type="number" placeholder="输入车辆规格" @input="carSizeInput" v-model="form.cardSize">
+					<u-input type="number" placeholder="输入车辆规格" @blur="car.carInput=false" @input="carSizeInput" v-model="form.cardSize">
 						<text slot="suffix">米</text>
 					</u-input>
 				</view>
@@ -66,7 +66,7 @@
 				<view class="l">预计入场:</view>
 				<view class="r">
 					<view class="r">
-						<uni-datetime-picker placeholder="请选择" @change="expectDayChange" :clear-icon="false" hide-second
+						<uni-datetime-picker placeholder="请选择" @change="expectDayChange" :clear-icon="false" 
 							:start="exprctStart" type="datetime" v-model="form.expectInDay" @close="closeFn" />
 					</view>
 				</view>
@@ -86,7 +86,7 @@
 			<view class="item">
 				<view class="l">联系号码:</view>
 				<view class="r">
-					<u-input placeholder="司机联系号码"  v-model="form.driverPhone" />
+					<u-input placeholder="司机联系号码"  type="number" v-model="form.driverPhone" />
 				</view>
 			</view>
 			<view class="item">
@@ -281,12 +281,15 @@
 				}).then(resp => {
 					let data = resp.data;
 					this.form = data;
+					let goodsName=data.goodsName;
 					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);
+					this.goods.index = this.goods.goodsList.map(o => o.name).indexOf(goodsName);
+					let goods=this.goods.goodsList[this.goods.index];
 					let items = data.items;
-					let names = items.map(obj => obj.itemTypeName);
-					let itemTypeList = this.itemList.filter(obj => names.indexOf(obj.name) !== -1);
+					let noNeedIds = goods.noNeedIds.split(',');
+					let itemTypeList = this.itemList.filter(obj => noNeedIds.indexOf(obj.id) == -1);
+					this.filterItemList=itemTypeList;
 					for (let i in itemTypeList) {
 						let type = itemTypeList[i];
 						for (let j in items) {
@@ -399,15 +402,13 @@
 			getGoodsList() {
 				this.$api.getGoodsList().then(resp => {
 					this.goods.goodsList = resp.data;
-					let goods = resp.data[0];
-					let noNeedIds = goods.noNeedIds.split(',');
-					this.needTypeId = goods.needIds.split(',')
-					this.$api.getItemList().then(resp => {
-						let list = resp.data;
-						this.itemList = list;
-						this.filterItemList = list.filter(obj => noNeedIds.indexOf(obj.id) == -1);
-						this.getBusinessById();
-					})
+					this.getItemList();
+				})
+			},
+			getItemList(){
+				this.$api.getItemList().then(resp => {
+					this.itemList = resp.data;
+					this.getBusinessById();
 				})
 			},
 			handlerTypeItem(goods) {
@@ -483,7 +484,7 @@
 					this.$common.toast('司机联系号码不正确')
 					return false;
 				}
-				if (!this.$common.isNum(this.form.netWeight)) {
+				if (!this.form.netWeight||!this.$common.isNum(this.form.netWeight)) {
 					this.$common.toast('载重必须输入数字')
 					return false;
 				}

+ 10 - 6
app/pages/business-entering/business-entering.vue

@@ -56,7 +56,7 @@
 			<view class="item">
 				<view class="l">境外车规格:</view>
 				<view class="r">
-					<u-input type="number" placeholder="输入车辆规格" @input="carSizeInput" v-model="form.cardSize">
+					<u-input type="number" placeholder="输入车辆规格" @blur="car.carInput=false" @input="carSizeInput" v-model="form.cardSize">
 						<text slot="suffix">米</text>
 					</u-input>
 				</view>
@@ -66,7 +66,7 @@
 				<view class="l">预计入场:</view>
 				<view class="r">
 					<view class="r">
-						<uni-datetime-picker placeholder="请选择" @change="expectDayChange" :clear-icon="false" hide-second
+						<uni-datetime-picker placeholder="请选择" @change="expectDayChange" :clear-icon="false" 
 							:start="exprctStart" type="datetime" v-model="form.expectInDay" @close="closeFn" />
 					</view>
 				</view>
@@ -86,7 +86,7 @@
 			<view class="item">
 				<view class="l">联系号码:</view>
 				<view class="r">
-					<u-input placeholder="司机联系号码" @input="handler()" v-model="form.driverPhone" />
+					<u-input placeholder="司机联系号码" @input="handler()" type="number" v-model="form.driverPhone" />
 				</view>
 			</view>
 			<view class="item">
@@ -190,6 +190,7 @@
 				itemList: [],
 				filterItemList: [],
 				needTypeId: [],
+				noNeedIds:[],
 				form: {
 					customerId: '',
 					customerIndex: 0,
@@ -273,7 +274,8 @@
 				this.goods.index = index;
 				let goods = this.goods.goodsList[index];
 				let noNeedIds = goods.noNeedIds.split(',');
-				this.needTypeId = goods.needIds.split(',')
+				this.needTypeId = goods.needIds.split(',');
+				this.noNeedIds=goods.noNeedIds.split(',')
 				this.filterItemList = this.itemList.filter(obj => noNeedIds.indexOf(obj.id) == -1);
 				this.handler();
 			},
@@ -352,6 +354,7 @@
 					let goods = resp.data[0];
 					let noNeedIds = goods.noNeedIds.split(',');
 					this.needTypeId = goods.needIds.split(',')
+					this.noNeedIds=goods.noNeedIds.split(',')
 					this.$api.getItemList().then(resp => {
 						let list = resp.data;
 						this.itemList = list;
@@ -511,7 +514,7 @@
 					this.$common.toast('司机联系号码不正确')
 					return false;
 				}
-				if (!this.$common.isNum(this.form.netWeight)) {
+				if (!this.form.netWeight||!this.$common.isNum(this.form.netWeight)) {
 					this.$common.toast('载重必须输入数字')
 					return false;
 				}
@@ -520,7 +523,8 @@
 					this.$common.toast('至少选择一项业务项')
 					return false;
 				}
-				let filterItemList = this.filterItemList;
+				let noNeedIds=this.noNeedIds;
+				let filterItemList = this.filterItemList.filter(obj=>noNeedIds.indexOf(obj.id)==-1);
 				for (let j in this.needTypeId) {
 					let id = this.needTypeId[j];
 					for (let i in filterItemList) {

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

@@ -139,7 +139,7 @@
 		},
 		onBackPress() {
 			this.$common.to('/pages/index/index')
-			return false;
+			return true;
 		},
 		methods: {
 			toDetail(data) {

+ 5 - 3
app/pages/customer-management/customer-info.vue

@@ -27,10 +27,10 @@
 				<view class="r">
 					<radio-group @change="payChange">
 						<label class="radio">
-							<radio value="1" checked />现结
+							<radio value="1" :disabled="customerId!=='1'" :checked="form.payType==1" />现结
 						</label>
 						<label class="radio" style="margin-left: 20rpx;">
-							<radio value="2" />月结
+							<radio value="2" :disabled="customerId!=='1'" :checked="form.payType==2"/>月结
 						</label>
 					</radio-group>
 				</view>
@@ -74,11 +74,13 @@
 					phone: '',
 					payType: '1',
 					businessLicence: ''
-				}
+				},
+				customerId:''
 			}
 		},
 		mounted() {
 			let id = uni.getStorageSync('info').customerId;
+			this.customerId=id;
 			this.getCustomerById(id);
 		},
 		methods: {

+ 7 - 14
app/pages/customer-management/customer-management.vue

@@ -48,7 +48,7 @@
 		<noData v-if="customerItemList.length==0"></noData>
 		<u-loadmore style="margin: 30rpx;" :status="status" />
 		<uni-popup ref="shpopup" type="center">
-			<uni-popup-dialog type="success" title="确定审核吗?" :duration="2000" @confirm="shconfirm"></uni-popup-dialog>
+			<uni-popup-dialog mode="input" type="success" title="确定审核吗?" placeholder="请输审核意见" :duration="2000" @confirm="shconfirm"></uni-popup-dialog>
 		</uni-popup>
 
 	</view>
@@ -77,14 +77,7 @@
 						name: '禁用',
 					}
 				],
-				customerItemList: [{
-					name: '',
-					dutyPeople: '',
-					phone: '',
-					businessLicence: '',
-					judgeStatus: '',
-					btnShow: 0
-				}, ],
+				customerItemList: [],
 				confirmCustomerId: '',
 				judgeContent: '',
 				perList: []
@@ -109,7 +102,6 @@
 					dataCount: this.dataCount,
 				}).then(resp => {
 					let customerList = resp.data;
-					//todo 还要判断当前用户是否为admin
 					for (let i in customerList) {
 						if (customerList[i].judgeStatus == 1) {
 							customerList[i].btnShow = 1;
@@ -123,7 +115,8 @@
 			},
 			confirmCustomer() {
 				this.$api.confirmCustomer({
-					customerId: this.confirmCustomerId
+					customerId: this.confirmCustomerId,
+					judgeContent: this.judgeContent,
 				}).then(resp => {
 					if (resp.code == 200) {
 						this.getCustomerList();
@@ -142,7 +135,8 @@
 				this.confirmCustomerId = id;
 				this.$refs.shpopup.open('center')
 			},
-			shconfirm(index) {
+			shconfirm(val) {
+				this.judgeContent = val;
 				this.confirmCustomer();
 				this.$refs.shpopup.close()
 			},
@@ -153,14 +147,13 @@
 
 			//------------------------------------------
 			//上拉加载更多,分页模拟数据
-			
+
 		},
 		onLoad() {
 			console.log(222)
 		},
 		created() {
 			this.perList = uni.getStorageSync('perList');
-			console.log(this.perList)
 			this.getCustomerList();
 		},
 		onShow() {

+ 1 - 2
app/pages/index/index.vue

@@ -58,8 +58,7 @@
 			this.setList();
 		},
 		onBackPress() {
-			this.$common.to('/pages/index/index')
-			return false;
+			return true;
 		},
 		methods: {
 			setList(){

+ 7 - 6
app/pages/inout-record/inout-record.vue

@@ -26,13 +26,13 @@
 						<text class="p1">联系电话:</text>
 						<text class="p2">{{recordItem.customerContact}}</text>
 					</view>
-					<view class="item" v-if="recordItem.realInTime != null">
+					<view class="item" v-if="recordItem.inTime != null">
 						<text class="p1">入场时间:</text>
-						<text class="p2">{{recordItem.realInTime}}</text>
+						<text class="p2">{{recordItem.inTime}}</text>
 					</view>
-					<view class="item" v-if="recordItem.outDayTime != null">
+					<view class="item" v-if="recordItem.outTime != null">
 						<text class="p1">出场时间:</text>
-						<text class="p2">{{recordItem.outDayTime}}</text>
+						<text class="p2">{{recordItem.outTime}}</text>
 					</view>
 					<view class="item">
 						<text class="p1">状态:</text>
@@ -82,10 +82,11 @@
 					{
 						customerName:'',
 						cardNo:'',
+						carCountryName: '',
 						dutyPeople:'',
 						customerContact:'',
-						realInTime:'',
-						outDayTime:'',
+						inTime:'',
+						outTime:'',
 						status:''
 					},
 				],

+ 53 - 45
sp-admin/sa-view/tb-costomer/tb-costomer-add.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">
@@ -15,8 +16,14 @@
 		<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 .el-input, .c-panel .el-form .el-textarea__inner{width: 250px;}
+			.c-panel .el-form .c-label {
+				width: 7em !important;
+			}
+
+			.c-panel .el-form .el-input,
+			.c-panel .el-form .el-textarea__inner {
+				width: 250px;
+			}
 		</style>
 	</head>
 	<body>
@@ -24,19 +31,20 @@
 			<!-- ------- 内容部分 ------- -->
 			<div class="s-body">
 				<div class="c-panel">
-                    <div class="c-title" v-if="id == 0">数据添加</div>
+					<div class="c-title" v-if="id == 0">数据添加</div>
 					<div class="c-title" v-else>数据修改</div>
 					<el-form v-if="m">
 						<el-row>
 							<sa-item type="text" name="企业名称" v-model="m.name" placeholder="请输入企业名称" br></sa-item>
 							<sa-item type="text" name="联系人" v-model="m.dutyPeople" placeholder="请输入联系人" br></sa-item>
 							<sa-item type="text" name="联系电话" v-model="m.phone" placeholder="请输入联系号码" 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"
-									:options="options" :props={value:'id',label:'district'}></el-cascader>
-							</div> -->
+							<div class="c-item">
+								<label class="c-label">结算类型:</label>
+								<el-radio-group v-model="m.payType">
+									<el-radio :label="1" :disabled="currentCustomerId!=='1'">现结</el-radio>
+									<el-radio :label="2" :disabled="currentCustomerId!=='1'">月结</el-radio>
+								</el-radio-group>
+							</div>
 							<sa-item type="img" name="营业执照" v-model="m.businessLicence" br></sa-item>
 						</el-row>
 						<sa-item name="" class="s-ok" br>
@@ -51,45 +59,45 @@
 				<el-button @click="sa.closeCurrIframe()">取消</el-button>
 			</div>
 		</div>
-        <script>
-			
+		<script>
 			var app = new Vue({
 				components: {
 					"sa-item": httpVueLoader('../../sa-frame/com/sa-item.vue')
 				},
 				el: '.vue-box',
 				data: {
-					id: sa.p('id', 0),		// 获取超链接中的id参数(0=添加,非0=修改) 
-					m: null,		// 实体对象 
+					id: sa.p('id', 0), // 获取超链接中的id参数(0=添加,非0=修改) 
+					m: null, // 实体对象 
 					options: [],
+					currentCustomerId: '1',
 				},
 				methods: {
-					getAddress() {
-						sa.ajax('/TbDistrict/getTreeData', function(resp) {
-							this.options = resp.data;
+					getCurrendCustomer() {
+						sa.ajax('/TbCostomer/getCurrentCustomerId', function(resp) {
+							this.currentCustomerId = resp.data;
 						}.bind(this));
 					},
 					// 创建一个 默认Model 
 					createModel: function() {
 						return {
-							name: '',		// 名称 
-							phone: '',		// 联系号码 
-							dutyPeople: '',		// 负责人 
-							addressIds: '',		// 地址id 
-							addressStr: '',		// 地址 
-							businessLicence: '',		// 营业执照 
-							address_arry:[],
-							payType:1,
-							status: '1',		// 状态(0=否,1=是) 
-							judgeStatus: '2',		// 审核状态(1=未审核,2审核通过,3审核不通过) 
+							name: '', // 名称 
+							phone: '', // 联系号码 
+							dutyPeople: '', // 负责人 
+							addressIds: '', // 地址id 
+							addressStr: '', // 地址 
+							businessLicence: '', // 营业执照 
+							address_arry: [],
+							payType: 1,
+							status: '1', // 状态(0=否,1=是) 
+							judgeStatus: '2', // 审核状态(1=未审核,2审核通过,3审核不通过) 
 						}
 					},
 					// 提交数据 
-					ok: function(){
+					ok: function() {
 						// 表单校验 
 						let m = this.m;
 						sa.checkNull(m.name, '请输入 [企业名称]');
-						if(!sa.isPhone(m.phone)){
+						if (!sa.isPhone(m.phone)) {
 							sa.error('联系号码不正确')
 							return;
 						}
@@ -97,43 +105,43 @@
 						// this.m.addressIds = this.m.address_arry.join(',');
 						// sa.checkNull(m.addressIds, '请选择 [地址信息]');
 						// 开始增加或修改
-						if(this.id <= 0) {	// 添加
-							sa.ajax('/TbCostomer/add', m, function(res){
-								sa.alert('增加成功', this.clean); 
+						if (this.id <= 0) { // 添加
+							sa.ajax('/TbCostomer/add', m, function(res) {
+								sa.alert('增加成功', this.clean);
 							}.bind(this));
-						} else {	// 修改
-							sa.ajax('/TbCostomer/update', m, function(res){
+						} else { // 修改
+							sa.ajax('/TbCostomer/update', m, function(res) {
 								sa.alert('修改成功', this.clean);
 							}.bind(this));
 						}
 					},
 					// 添加/修改 完成后的动作
 					clean: function() {
-						if(this.id == 0) {
+						if (this.id == 0) {
 							this.m = this.createModel();
 						} else {
-							parent.app.f5();		// 刷新父页面列表
-							sa.closeCurrIframe();	// 关闭本页 
+							parent.app.f5(); // 刷新父页面列表
+							sa.closeCurrIframe(); // 关闭本页 
 						}
 					}
 				},
-				mounted: function(){
+				mounted: function() {
+					this.getCurrendCustomer()
 					// 初始化数据 
-					if(this.id <= 0) {	
+					if (this.id <= 0) {
 						this.m = this.createModel();
-					} else {	
+					} else {
 						sa.ajax('/TbCostomer/getById?id=' + this.id, function(res) {
 							this.m = res.data;
-							this.m.address_arry=res.data?res.data.addressIds.split(",").map(id=>parseInt(id)):[];
-							if(res.data == null) {
+							this.m.address_arry = res.data ? res.data.addressIds.split(",").map(id =>
+								parseInt(id)) : [];
+							if (res.data == null) {
 								sa.alert('未能查找到 id=' + this.id + " 详细数据");
 							}
 						}.bind(this))
 					}
-					this.getAddress();
 				}
 			})
-			
 		</script>
 	</body>
-</html>
+</html>

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

@@ -176,7 +176,7 @@
 					},
 					// 查看
 					get: function(data) {
-						sa.showIframe('数据详情', 'tb-costomer-info.html?id=' + data.id, '800px', '60%');
+						sa.showIframe('数据详情', 'tb-costomer-info.html?id=' + data.id, '800px', '80%');
 					},
 					// 查看 - 根据选中的
 					getBySelect: function(data) {

+ 1 - 1
sp-admin/sa-view/tb-costomer/tb-costomer-maintain.html

@@ -104,7 +104,7 @@
       },
       // 查看
       get: function(data) {
-        sa.showIframe('数据详情', 'tb-costomer-info.html?id=' + data.id, '800px', '60%');
+        sa.showIframe('数据详情', 'tb-costomer-info.html?id=' + data.id, '800px', '80%');
       },
       // 查看 - 根据选中的
       getBySelect: function(data) {

+ 3 - 1
sp-admin/sa-view/tb-pass-record/tb-pass-record-list.html

@@ -36,6 +36,7 @@
 <!--					<sa-td name="客户id" prop="customerId" ></sa-td>-->
 					<sa-td name="企业名称" prop="customerName" ></sa-td>
 					<sa-td name="车牌号码" prop="cardNo" ></sa-td>
+					<sa-td name="车牌国籍" prop="carCountryName" ></sa-td>
 					<sa-td name="入场时间" prop="inTime" ></sa-td>
 					<sa-td name="出场时间" prop="outTime" ></sa-td>
 					<sa-td name="状态" prop="status" type="enum" :jv="{1: '未入场', 2: '已入场', 3: '已出场'}"></sa-td>
@@ -63,7 +64,8 @@
 						businessId: '',		// 业务id 
 						customerId: '',		// 客户id 
 						customerName: '',		// 客户名称 
-						cardNo: '',		// 车牌号 
+						cardNo: '',		// 车牌号
+						carCountryName: '',	//车牌国籍
 						status: '',		// 状态(=未入场, 2=已入场, 3=已出场) 
 						inTime: '',		// 进境时间 
 						outTime: '',		// 离境时间 

+ 1 - 1
sp-server/app.pid

@@ -1 +1 @@
-18268
+18884

+ 8 - 2
sp-server/src/main/java/com/pj/api/bo/InOutRecordBO.java

@@ -6,6 +6,7 @@ import lombok.experimental.Accessors;
 import java.util.Date;
 
 /**
+ * 出入记录
  */
 @Data
 @Accessors(chain = true)
@@ -28,14 +29,19 @@ public class InOutRecordBO {
     private String cardNo;
 
     /**
+     * 车牌国籍
+     */
+    private String carCountryName;
+
+    /**
      * 实际进境时间
      */
-    private Date realInTime;
+    private Date inTime;
 
     /**
      * 离境时间
      */
-    private Date outDayTime;
+    private Date outTime;
 
     /**
      * 状态(1=未入场, 2=已入场, 3=已出场)

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

@@ -77,8 +77,8 @@ public class ApiController {
     }
 
     @PostMapping(value = "confirmCustomer")
-    public AjaxJson confirmCustomer(Long customerId){
-        apiService.confirmCustomer(customerId);
+    public AjaxJson confirmCustomer(Long customerId, String judgeContent){
+        apiService.confirmCustomer(customerId, judgeContent);
         return AjaxJson.getSuccess();
     }
     @PostMapping(value = "confirm")

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

@@ -6,6 +6,8 @@ import com.pj.project.tb_business.TbBusiness;
 import com.pj.project.tb_business.TbBusinessService;
 import com.pj.project.tb_costomer.TbCostomer;
 import com.pj.project.tb_costomer.TbCostomerService;
+import com.pj.project.tb_pass_record.TbPassRecord;
+import com.pj.project.tb_pass_record.TbPassRecordService;
 import com.pj.utils.so.SoMap;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Service;
@@ -27,22 +29,17 @@ public class ApiService {
     TbCostomerService tbCostomerService;
     @Resource
     TbBusinessService tbBusinessService;
+    @Resource
+    TbPassRecordService tbPassRecordService;
 
     public List<InOutRecordBO> getInOutRecord(SoMap so){
-        List<TbBusiness> businessList = tbBusinessService.getList(so);
+        List<TbPassRecord> passRecords = tbPassRecordService.getList(so);
         List<InOutRecordBO> recordList = new ArrayList<>();
-        for (TbBusiness business : businessList) {
+        for (TbPassRecord passRecord : passRecords) {
             InOutRecordBO record = new InOutRecordBO();
-            BeanUtil.copyProperties(business, record);
-            TbCostomer costomer = tbCostomerService.getById(business.getCustomerId());
-            record.setBusinessId(business.getId()).setCustomerContact(costomer.getPhone()).setDutyPeople(costomer.getDutyPeople());
-            if(record.getRealInTime() != null && record.getOutDayTime() != null){
-                record.setStatus(3);//已出场
-            }else if(record.getRealInTime() != null && record.getOutDayTime() == null){
-                record.setStatus(2);//已入场
-            }else{
-                record.setStatus(1);//未入场
-            }
+            BeanUtil.copyProperties(passRecord, record);
+            TbCostomer costomer = tbCostomerService.getById(passRecord.getCustomerId());
+            record.setCustomerContact(costomer.getPhone()).setDutyPeople(costomer.getDutyPeople());
             recordList.add(record);
         }
         return recordList;
@@ -53,11 +50,10 @@ public class ApiService {
         return list;
     }
 
-    public void confirmCustomer(Long customerId) {
-        //
+    public void confirmCustomer(Long customerId, String judgeContent) {
         TbCostomer costomer = tbCostomerService.getById(customerId);
         if(costomer != null && costomer.getJudgeStatus() == 1){
-            tbCostomerService.judge(customerId + "", 2, "H5端审核");
+            tbCostomerService.judge(customerId + "", 2, judgeContent);
         }
     }
 }

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

@@ -62,6 +62,7 @@ public class TbBusinessController {
     public AjaxJson delete(String id) {
         tbBusinessService.removeById(id);
         tbBusinessItemService.removeByBusinessId(id);
+        tbPassRecordService.removeByBusinessId(id);
         return AjaxJson.getSuccess();
     }
 
@@ -193,10 +194,12 @@ public class TbBusinessController {
         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);
+        //更新境外车入场记录
+        tbPassRecordService.addOrUpdate(tbBusiness.getId(), tbBusiness.getCustomerId(), tbBusiness.getCustomerName(),
+                tbBusiness.getCardNo(), 2, tbBusiness.getRealInTime(), null, tbBusiness.getCountryName());
+        //更新中国车入场记录
+        tbPassRecordService.addOrUpdate(tbBusiness.getId(), tbBusiness.getCustomerId(), tbBusiness.getCustomerName(),
+                tbBusiness.getChinaCarNo(), 2, tbBusiness.getChinaCarInTime(), null, "中国车");
 
         return AjaxJson.getSuccess();
     }
@@ -210,13 +213,27 @@ public class TbBusinessController {
         String id = so.getString("id");
        TbBusiness business= tbBusinessService.getById(id);
        Date outTime=so.getDateTime("outDayTime");
-       Date chinaCarOutTime=so.getDateTime("chinaCarOutTime");
+        if (business.getRealInTime().getTime()>outTime.getTime()) {
+            return AjaxJson.getError("离场时间须大于出场时间");
+        }
         business.setOutDayTime(outTime);
         tbBusinessService. calculationPartMoney("越南车",business);
         tbBusinessService.updateById(business);
+        Date chinaCarOutTime=so.getDateTime("chinaCarOutTime");
+        if (chinaCarOutTime.getTime()<business.getChinaCarInTime().getTime()){
+            return AjaxJson.getError("离场时间须大于出场时间");
+        }
         business.setChinaCarOutTime(chinaCarOutTime);
         tbBusinessService. calculationPartMoney("中国车",business);
         tbBusinessService.updateById(business);
+        //更新境外车出场记录
+        tbPassRecordService.addOrUpdate(business.getId(), business.getCustomerId(), business.getCustomerName(),
+                business.getCardNo(), 3,
+                business.getRealInTime(), business.getOutDayTime(), business.getCountryName());
+        //更新中国车出场记录
+        tbPassRecordService.addOrUpdate(business.getId(), business.getCustomerId(), business.getCustomerName(),
+                business.getChinaCarNo(), 3,
+                business.getChinaCarInTime(), business.getChinaCarOutTime(), "中国车");
         return AjaxJson.getSuccess();
     }
 

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

@@ -45,6 +45,7 @@ import com.pj.project4sp.role4permission.SpRolePermissionService;
 import com.pj.utils.so.SoMap;
 import org.aspectj.weaver.loadtime.Aj;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Service;
 
 import com.pj.utils.sg.*;
@@ -99,7 +100,7 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
      * 增
      */
     public AjaxJson addOrUpdate(TbBusiness t) {
-        if (checkCarNo(t.getCardNo()) != null) {
+        if (checkCarNo(t.getCardNo()) != null&&StrUtil.isEmpty(t.getId())) {
             return AjaxJson.getError("该车辆【" + t.getCardNo() + "】有未完成业务");
         }
 
@@ -142,12 +143,12 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
         this.saveOrUpdate(t);
         tbBusinessItemService.saveBatch(items);
 
-        //增加一条放行记录
-//        TbPassRecord record = new TbPassRecord();
-//        record.setBusinessId(t.getId()).setCustomerId(t.getCustomerId())
-//                .setCardNo(t.getCardNo()).setCustomerName(t.getCustomerName())
-//                .setStatus(1).setUpdateTime(new Date());
-//        tbPassRecordService.saveOrUpdate(record);
+        //增加或修改一条境外车未入场记录
+        tbPassRecordService.addOrUpdate(t.getId(), t.getCustomerId(), t.getCustomerName(),
+                t.getCardNo(), 1, null, null, t.getCountryName());
+        //增加或修改一条中国车未入场记录
+        tbPassRecordService.addOrUpdate(t.getId(), t.getCustomerId(), t.getCustomerName(),
+                t.getChinaCarNo(), 1, null, null, "中国车");
 
         return AjaxJson.getSuccess();
     }
@@ -250,10 +251,12 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
         tbBusiness.setRealInTime(new Date()).setInChannel(inChannel);
         this.updateById(tbBusiness);
 
-        //更新放行记录
-        TbPassRecord record = tbPassRecordService.getByBusinessId(tbBusiness.getId());
-        record.setStatus(2).setInTime(tbBusiness.getRealInTime()).setUpdateTime(new Date());
-        tbPassRecordService.saveOrUpdate(record);
+        //更新境外车入场记录
+        tbPassRecordService.addOrUpdate(tbBusiness.getId(), tbBusiness.getCustomerId(), tbBusiness.getCustomerName(),
+                tbBusiness.getCardNo(), 2, tbBusiness.getRealInTime(), null, tbBusiness.getCountryName());
+        //更新中国车入场记录
+        tbPassRecordService.addOrUpdate(tbBusiness.getId(), tbBusiness.getCustomerId(), tbBusiness.getCustomerName(),
+                tbBusiness.getChinaCarNo(), 2, tbBusiness.getChinaCarInTime(), null, "中国车");
     }
 
     public void adminOut(String id, Date outDayTime, String outChannel, String carType) {
@@ -262,13 +265,17 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
         calculationPartMoney(carType, tbBusiness);
         this.updateById(tbBusiness);
 
-        //更新放行记录
-        TbPassRecord record = tbPassRecordService.getByBusinessId(tbBusiness.getId());
-        record.setStatus(3).setOutTime(tbBusiness.getOutDayTime()).setUpdateTime(new Date());
-        tbPassRecordService.saveOrUpdate(record);
+        //更新境外车出场记录
+        tbPassRecordService.addOrUpdate(tbBusiness.getId(), tbBusiness.getCustomerId(), tbBusiness.getCustomerName(),
+                tbBusiness.getCardNo(), 3,
+                tbBusiness.getRealInTime(), tbBusiness.getOutDayTime(), tbBusiness.getCountryName());
+        //更新中国车出场记录
+        tbPassRecordService.addOrUpdate(tbBusiness.getId(), tbBusiness.getCustomerId(), tbBusiness.getCustomerName(),
+                tbBusiness.getChinaCarNo(), 3,
+                tbBusiness.getChinaCarInTime(), tbBusiness.getChinaCarOutTime(), "中国车");
 
     }
-
+    @Async
     public void calculationPartMoney(String itemType, TbBusiness tbBusiness) {
         Date iTime = tbBusiness.getRealInTime();
         Date oTime = tbBusiness.getOutDayTime();
@@ -286,44 +293,15 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
         if (carSize < 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());
+        long hour = ChronoUnit.HOURS.between(inDayTime, outDayTime);
         BigDecimal basePrice = partConfig.getBasePrice();
         BigDecimal extraPrice = partConfig.getExtraPrice();
-        BigDecimal price = basePrice;
-        LocalTime outTime = outDayTime.toLocalTime();
-        LocalTime nigthEnd = LocalTime.parse(partConfig.getNightEnd(), DateTimeFormatter.ofPattern("HH:mm:ss"));
-        if (days >= 1) {
-            price = basePrice.add(basePrice.multiply(new BigDecimal(days - 1)));
-            if (outTime.isAfter(nigthEnd)){
-                price = basePrice.add(basePrice.multiply(new BigDecimal(days)));
-            }
-            if (outTime.isAfter(zero)&&outTime.isBefore(nigthEnd)){
-                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 + "分钟";
-        }
-
-//        businessItem.setTotal(price).setUnit("天").setItemTypeName(itemType).setItemPrice(partConfig.getBasePrice())
-//                .setBusinessId(businessId).setItemName("停车费").setNum(num);
-//        tbBusinessItemService.saveOrUpdate(businessItem);
+        BigDecimal price = basePrice.add(basePrice.multiply(new BigDecimal(hour/24))).add(new BigDecimal(days).multiply(extraPrice));
         if (itemType.contains("中国")) {
             tbBusiness.setChinaPartMoney(price).setChinaCarPartTime(minutes);
         } else {
             tbBusiness.setPartMoney(price).setPartTime(minutes);
-            ;
         }
         tbBusiness.setTotalMoney(tbBusiness.getItemPrice().add(tbBusiness.getChinaPartMoney()).add(tbBusiness.getPartMoney()));
     }

+ 7 - 2
sp-server/src/main/java/com/pj/project/tb_pass_record/TbPassRecord.java

@@ -4,7 +4,7 @@ import java.io.Serializable;
 import java.util.Date;
 
 import com.baomidou.mybatisplus.annotation.TableName;
-import com.pj.project.tb_item_type.TbItemType;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
@@ -17,7 +17,7 @@ import lombok.experimental.Accessors;
 @Accessors(chain = true)
 @TableName(TbPassRecord.TABLE_NAME)
 @EqualsAndHashCode(callSuper = false)
-public class TbPassRecord implements Serializable {
+public class TbPassRecord extends Model<TbPassRecord> implements Serializable {
 
 	// ---------- 模块常量 ----------
 	/**
@@ -60,6 +60,11 @@ public class TbPassRecord implements Serializable {
 	 */
     private String cardNo;
 
+    /**
+     * 车辆所属国家
+     */
+    private String carCountryName;
+
 	/**
 	 * 状态(=未入场, 2=已入场, 3=已出场) 
 	 */

+ 2 - 0
sp-server/src/main/java/com/pj/project/tb_pass_record/TbPassRecordMapper.java

@@ -55,5 +55,7 @@ public interface TbPassRecordMapper extends BaseMapper<TbPassRecord> {
 
     TbPassRecord getByBusinessId(@Param("businessId") String businessId);
 
+    TbPassRecord getByBusinessIdAndCountryName(@Param("businessId")String businessId, @Param("carCountryName")String carCountryName);
 
+    void deleteByBusinessId(String businessId);
 }

+ 18 - 3
sp-server/src/main/java/com/pj/project/tb_pass_record/TbPassRecordMapper.xml

@@ -5,8 +5,8 @@
 	<!-- 增 [G] -->
 	<insert id="add">
 		insert into 
-		tb_pass_record (id, business_id, customer_id, customer_name, card_no, status, in_time, out_time, update_time)
-		values (#{id}, #{businessId}, #{customerId}, #{customerName}, #{cardNo}, #{status}, #{inTime}, #{outTime}, #{updateTime}) 
+		tb_pass_record (id, business_id, customer_id, customer_name, card_no, car_country_name, status, in_time, out_time, update_time)
+		values (#{id}, #{businessId}, #{customerId}, #{customerName}, #{cardNo}, #{carCountryName}, #{status}, #{inTime}, #{outTime}, #{updateTime})
 	</insert>
 
 	<!-- 删 -->
@@ -15,6 +15,12 @@
 		where id = #{id}
 	</delete>
 
+    <!-- 删 -->
+    <delete id="deleteByBusinessId">
+		delete from tb_pass_record
+		where business_id = #{businessId}
+	</delete>
+
 	<!-- 改 [G] -->
 	<update id="update">
 		update tb_pass_record set
@@ -22,7 +28,8 @@
 		business_id = #{businessId}, 
 		customer_id = #{customerId}, 
 		customer_name = #{customerName}, 
-		card_no = #{cardNo}, 
+		card_no = #{cardNo},
+		car_country_name = #{carCountryName},
 		status = #{status}, 
 		in_time = #{inTime}, 
 		out_time = #{outTime}, 
@@ -41,6 +48,7 @@
 		<result property="customerId" column="customer_id" />
 		<result property="customerName" column="customer_name" />
 		<result property="cardNo" column="card_no" />
+        <result property="carCountryName" column="car_country_name" />
 		<result property="status" column="status" />
 		<result property="inTime" column="in_time" />
 		<result property="outTime" column="out_time" />
@@ -64,6 +72,12 @@
         <include refid="select_sql"></include>
         where business_id = #{businessId}
     </select>
+
+    <!-- 查 - 根据businessId和CountryName -->
+    <select id="getByBusinessIdAndCountryName" resultMap="model">
+        <include refid="select_sql"></include>
+        where business_id = #{businessId} and car_country_name = #{carCountryName}
+    </select>
 	
 	<!-- 查集合 - 根据条件(参数为空时代表忽略指定条件) [G] -->
 	<select id="getList" resultMap="model">
@@ -75,6 +89,7 @@
 			<if test=' this.has("customerId") '> and customer_id = #{customerId} </if>
 			<if test=' this.has("customerName") '> and customer_name like concat('%',#{customerName},'%') </if>
 			<if test=' this.has("cardNo") '> and card_no like concat('%',#{cardNo},'%') </if>
+            <if test=' this.has("carCountryName") '> and car_country_name = #{carCountryName} </if>
 			<if test=' this.has("status") '> and status = #{status} </if>
 			<if test=' this.has("inTime") '> and in_time = #{inTime} </if>
 			<if test=' this.has("outTime") '> and out_time = #{outTime} </if>

+ 30 - 4
sp-server/src/main/java/com/pj/project/tb_pass_record/TbPassRecordService.java

@@ -1,12 +1,16 @@
 package com.pj.project.tb_pass_record;
 
+import java.util.Date;
 import java.util.List;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.pj.utils.so.SoMap;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 
 
 /**
@@ -14,6 +18,7 @@ import org.springframework.stereotype.Service;
  * @author lzm 
  */
 @Service
+@Transactional
 public class TbPassRecordService extends ServiceImpl<TbPassRecordMapper, TbPassRecord> implements IService<TbPassRecord> {
 
 	/** 底层 Mapper 对象 */
@@ -40,14 +45,35 @@ public class TbPassRecordService extends ServiceImpl<TbPassRecordMapper, TbPassR
 		return tbPassRecordMapper.getById(id);
 	}
 
-	/** 查集合 - 根据条件(参数为空时代表忽略指定条件) */  
-	List<TbPassRecord> getList(SoMap so) {
-		return tbPassRecordMapper.getList(so);	
+	/** 查集合 - 根据条件(参数为空时代表忽略指定条件) */
+        public List<TbPassRecord> getList(SoMap so) {
+            return tbPassRecordMapper.getList(so);
 	}
 
     public TbPassRecord getByBusinessId(String businessId){
         return tbPassRecordMapper.getByBusinessId(businessId);
     }
-	
 
+    public TbPassRecord getByBusinessIdAndCountryName(String businessId, String carCountryName){
+        return tbPassRecordMapper.getByBusinessIdAndCountryName(businessId, carCountryName);
+    }
+
+    /** 初始化或更新一条出入记录, 越南车和中国车分开 */
+    @Async
+    public void addOrUpdate(String businessId, String customerId, String customerName, String carNo, int status, Date inTime, Date outTime, String carCountryName){
+        TbPassRecord record = this.getByBusinessIdAndCountryName(businessId, carCountryName);
+        if(record == null)
+            record = new TbPassRecord();
+        record.setBusinessId(businessId)
+                .setCustomerId(customerId).setCustomerName(customerName)
+                .setCardNo(carNo).setStatus(status)
+                .setInTime(inTime).setOutTime(outTime)
+                .setCarCountryName(carCountryName)
+                .setUpdateTime(new Date());
+        saveOrUpdate(record);
+    }
+
+    public void removeByBusinessId(String businessId) {
+       tbPassRecordMapper.deleteByBusinessId(businessId);
+    }
 }

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

@@ -50,5 +50,5 @@ part-config:
     base-price: 30 #基础费用
     extra-price: 10 #过夜额外收费
     night-end: 06:00:00 #夜间结束时间
-    free-minutes: 20
+    free-minutes: 30
     free-car-length: 4.2