Kaynağa Gözat

消息通告

qzyReal 3 yıl önce
ebeveyn
işleme
e4639ed3b7

+ 20 - 20
app/pages/business-entering/business-edit.vue

@@ -46,9 +46,26 @@
 					</picker>
 				</view>
 			</view>
-
 			<view class="item">
-				<view class="l">境外车牌:</view>
+				<view class="l">货物:</view>
+				<view class="r">
+					<picker v-if="goods.goodsList.length>0" class="p-picker" id="hw" @change="whChange($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">
+					<u-input type="number" placeholder="输入载重"  v-model="form.netWeight">
+						<text slot="suffix">吨</text>
+					</u-input>
+				</view>
+			</view>
+			<view class="item">
+				<view class="l" >境外车牌:</view>
 				<view class="r">
 					<u-input placeholder="输入车牌号"  v-model="form.cardNo" />
 				</view>
@@ -89,24 +106,7 @@
 					<u-input placeholder="司机联系号码"  type="number" v-model="form.driverPhone" />
 				</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="whChange($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">
-					<u-input type="number" placeholder="输入载重"  v-model="form.netWeight">
-						<text slot="suffix">吨</text>
-					</u-input>
-				</view>
-			</view>
+			
 			<view class="item-line">
 				业务项
 			</view>

+ 32 - 30
app/pages/business-entering/business-entering.vue

@@ -46,7 +46,24 @@
 					</picker>
 				</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="whChange($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">
+					<u-input type="number" placeholder="输入载重" @input="handler()" v-model="form.netWeight">
+						<text slot="suffix">吨</text>
+					</u-input>
+				</view>
+			</view>
 			<view class="item">
 				<view class="l">境外车牌:</view>
 				<view class="r">
@@ -56,7 +73,8 @@
 			<view class="item">
 				<view class="l">境外车规格:</view>
 				<view class="r">
-					<u-input type="number" placeholder="输入车辆规格" @blur="car.carInput=false" @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 +84,7 @@
 				<view class="l">预计入场:</view>
 				<view class="r">
 					<view class="r">
-						<uni-datetime-picker placeholder="请选择" @change="expectDayChange" :clear-icon="false" 
+						<uni-datetime-picker placeholder="请选择" @change="expectDayChange" :clear-icon="false"
 							:start="exprctStart" type="datetime" v-model="form.expectInDay" @close="closeFn" />
 					</view>
 				</view>
@@ -89,24 +107,8 @@
 					<u-input placeholder="司机联系号码" @input="handler()" type="number" v-model="form.driverPhone" />
 				</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="whChange($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">
-					<u-input type="number" placeholder="输入载重" @input="handler()" v-model="form.netWeight">
-						<text slot="suffix">吨</text>
-					</u-input>
-				</view>
-			</view>
+
+			
 			<view class="item-line">
 				业务项
 			</view>
@@ -157,7 +159,7 @@
 			<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;">
+						v-if="item.carLength>=form.cardSize&&item.maxWeight>=form.netWeight" style="margin-top: 30rpx;">
 					</u-radio>
 				</u-radio-group>
 			</view>
@@ -190,7 +192,7 @@
 				itemList: [],
 				filterItemList: [],
 				needTypeId: [],
-				noNeedIds:[],
+				noNeedIds: [],
 				form: {
 					customerId: '',
 					customerIndex: 0,
@@ -275,7 +277,7 @@
 				let goods = this.goods.goodsList[index];
 				let noNeedIds = goods.noNeedIds.split(',');
 				this.needTypeId = goods.needIds.split(',');
-				this.noNeedIds=goods.noNeedIds.split(',')
+				this.noNeedIds = goods.noNeedIds.split(',')
 				this.filterItemList = this.itemList.filter(obj => noNeedIds.indexOf(obj.id) == -1);
 				this.handler();
 			},
@@ -354,7 +356,7 @@
 					let goods = resp.data[0];
 					let noNeedIds = goods.noNeedIds.split(',');
 					this.needTypeId = goods.needIds.split(',')
-					this.noNeedIds=goods.noNeedIds.split(',')
+					this.noNeedIds = goods.noNeedIds.split(',')
 					this.$api.getItemList().then(resp => {
 						let list = resp.data;
 						this.itemList = list;
@@ -514,7 +516,7 @@
 					this.$common.toast('司机联系号码不正确')
 					return false;
 				}
-				if (!this.form.netWeight||!this.$common.isNum(this.form.netWeight)) {
+				if (!this.form.netWeight || !this.$common.isNum(this.form.netWeight)) {
 					this.$common.toast('载重必须输入数字')
 					return false;
 				}
@@ -523,8 +525,8 @@
 					this.$common.toast('至少选择一项业务项')
 					return false;
 				}
-				let noNeedIds=this.noNeedIds;
-				let filterItemList = this.filterItemList.filter(obj=>noNeedIds.indexOf(obj.id)==-1);
+				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) {
@@ -535,7 +537,7 @@
 						}
 					}
 				}
-				let peopleList=this.hs.list;
+				let peopleList = this.hs.list;
 				if (typeList.filter(obj => obj.name.indexOf('人') !== -1 &&
 						obj.name.indexOf('核酸') !== -1).length > 0 &&
 					peopleList.length == 0) {
@@ -559,7 +561,7 @@
 					})
 				}
 				this.form.itemJson = JSON.stringify(list);
-				this.form.peopleJson=JSON.stringify(peopleList);
+				this.form.peopleJson = JSON.stringify(peopleList);
 				this.form.items = null;
 				if (this.customerId == '1') {
 					this.form.customerId = this.customer.customerList[this.customer.index].id;

+ 10 - 4
sp-admin/sa-view/tb-business/tb-business-add.html

@@ -74,6 +74,8 @@
 												</el-option>
 											</el-select>
 										</div>
+										<sa-item type="num" name="载重(吨)" placeholder="请输入车辆载重" v-model="m.netWeight" br>
+										</sa-item>
 										<sa-item type="text" name="境外车牌号" placeholder="请输入境外车牌号" v-model="m.cardNo" br>
 										</sa-item>
 										</sa-item>
@@ -84,8 +86,7 @@
 												:fetch-suggestions="queryCaSizerAsync">
 											</el-autocomplete>
 										</div>
-										<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"
@@ -109,7 +110,7 @@
 											<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"
+												<el-option v-for="item in type.items" :key="item.id" v-if="item.carLength>=m.cardSize&&item.maxWeight>=m.netWeight"
 													:label="item.itemName" :value="item.id">
 												</el-option>
 											</el-select>
@@ -143,7 +144,7 @@
 			<!-- ------- 底部按钮 ------- -->
 			<div class="s-foot">
 				<el-button type="primary" @click="ok()">确定</el-button>
-				<el-button @click="sa.closeCurrIframe()">取消</el-button>
+				<el-button @click="closeFn()">取消</el-button>
 			</div>
 			<el-dialog title="人员核酸检测" :visible.sync="modal.visible" width="80%">
 				<el-card class="box-card">
@@ -262,6 +263,7 @@
 					}
 				},
 				methods: {
+					
 					goodsChange(value) {
 						let goods = this.goodsList.filter(obj => obj.name === value).pop();
 						let noNeedIds = goods.noNeedIds.split(',');
@@ -399,6 +401,10 @@
 							this.currentCustomerId = id;
 						}.bind(this));
 					},
+					closeFn() {
+						parent.app.f5();
+						sa.closeCurrIframe();
+					},
 					// 提交数据 
 					ok: function() {
 						// 表单校验

+ 14 - 7
sp-admin/sa-view/tb-business/tb-business-edit.html

@@ -74,6 +74,8 @@
 												</el-option>
 											</el-select>
 										</div>
+										<sa-item type="num" name="载重(吨)" placeholder="请输入车辆载重" v-model="m.netWeight" br>
+										</sa-item>
 										<sa-item type="text" name="境外车牌号" placeholder="请输入境外车牌号" v-model="m.cardNo" br>
 										</sa-item>
 										</sa-item>
@@ -84,8 +86,7 @@
 												:fetch-suggestions="queryCaSizerAsync">
 											</el-autocomplete>
 										</div>
-										<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"
@@ -109,8 +110,9 @@
 											<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 v-for="item in type.items"
+													v-if="item.carLength>=m.cardSize&&item.maxWeight>=m.netWeight"
+													:key="item.id" :label="item.itemName" :value="item.id">
 												</el-option>
 											</el-select>
 											<el-input-number style="margin-left: 60px;" class="item-num"
@@ -143,7 +145,7 @@
 			<!-- ------- 底部按钮 ------- -->
 			<div class="s-foot">
 				<el-button type="primary" @click="ok()">确定</el-button>
-				<el-button @click="sa.closeCurrIframe()">取消</el-button>
+				<el-button @click="closeFn()">取消</el-button>
 			</div>
 			<el-dialog title="人员核酸检测" :visible.sync="modal.visible" width="80%">
 				<el-card class="box-card">
@@ -422,6 +424,10 @@
 							this.currentCustomerId = id;
 						}.bind(this));
 					},
+					closeFn() {
+						parent.app.f5();
+						sa.closeCurrIframe();
+					},
 					// 提交数据 
 					ok: function() {
 						// 表单校验
@@ -469,8 +475,9 @@
 								num: type.num
 							})
 						}
-						if (typeList.filter(obj => obj.name.indexOf('人')!==-1&&obj.name.indexOf('核酸')!==-1).length > 0
-						&& this.modal.list
+						if (typeList.filter(obj => obj.name.indexOf('人') !== -1 && obj.name.indexOf('核酸') !== -1)
+							.length > 0 &&
+							this.modal.list
 							.length == 0) {
 							sa.error('请添加核酸检测人员');
 							return false;

+ 6 - 5
sp-admin/sa-view/tb-business/tb-business-list.html

@@ -204,7 +204,7 @@
 				},
 				el: '.vue-box',
 				data: {
-					value:'',
+					value: '',
 					currentCustomerId: '1',
 					confirm: {
 						visible: false,
@@ -285,8 +285,8 @@
 					}
 				},
 				methods: {
-					blurFn(){
-					console.log(123)	
+					blurFn() {
+						console.log(123)
 					},
 					stopTimmer() {
 						if (this.timmer != null) {
@@ -498,12 +498,13 @@
 					},
 				},
 				created: function() {
-					this.f5();
-					this.restartTimmer();
 					sa.onInputEnter();
 					this.getCurrendCustomer();
 					this.getPcodeByCurrRid();
 				},
+				mounted() {
+					this.f5();
+				},
 				beforeDestroy() {
 					this.stopTimmer();
 				}

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

@@ -22,7 +22,7 @@ var sa = {
 		api_url: 'http://116.252.74.16:8099/pro',
 		web_url: 'http://www.baidu.com'
 	}
-	sa.cfg = cfg_prod; // 最终环境 , 上线前请选择正确的环境
+	sa.cfg = cfg_dev; // 最终环境 , 上线前请选择正确的环境
 })();
 
 
@@ -200,7 +200,6 @@ var sa = {
 				}
 			},
 			success: function(res){
-				console.log('返回数据:', res);
 				setTimeout(function() {
 					sa.hideLoading();
 					// 如果相应的处理函数存在
@@ -250,15 +249,9 @@ var sa = {
 		// 开始loding 
 		sa.loading(cfg.msg);
 		
-		// 打印请求地址和参数, 以便调试 
-		console.log("======= 模拟ajax =======");
-		console.log("请求地址:" + cfg.baseUrl + url);
-		console.log("请求参数:" + JSON.stringify(data));
-		
 		// 模拟ajax的延时 
 		setTimeout(function() {
 			sa.hideLoading();	// 隐藏掉转圈圈 
-			console.log('返回数据:', cfg.res);
 			success200(cfg.res);
 		}, cfg.sleep)
 	};
@@ -1184,7 +1177,6 @@ var sa = {
 				if(window.layer_title_last_click_time) {
 					var cz = new Date().getTime() - window.layer_title_last_click_time;
 					if(cz < 250) {
-						console.log('双击');
 						$(this).parent().find('.layui-layer-max').click();
 					}
 				}
@@ -1230,7 +1222,6 @@ var sa = {
 	
 	// 如果未登录,则强制跳转到登录 
 	me.checkLogin = function(not_login_url){
-		console.log(me.getCurrUser());
 		if(me.getCurrUser().id == 0) {
 			location.href= not_login_url || '../../login.html';
 			throw '未登录,请先登录';

+ 1 - 1
sp-server/app.pid

@@ -1 +1 @@
-9460
+16032

+ 10 - 4
sp-server/src/main/java/com/pj/api/open/service/OpenService.java

@@ -1,8 +1,10 @@
 package com.pj.api.open.service;
 
+import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.util.StrUtil;
 import com.pj.api.open.ResultJson;
 import com.pj.api.open.bo.CheckCarNumberBO;
+import com.pj.constants.UserTypeEnum;
 import com.pj.project.tb_business.BusinessMessageManager;
 import com.pj.project.tb_business.TbBusiness;
 import com.pj.project.tb_business.TbBusinessService;
@@ -50,7 +52,8 @@ public class OpenService {
                 tbBusiness.setAdminConfirmIn(1);
             }
             tbBusinessService.updateById(tbBusiness);
-            BusinessMessageManager.set(tbBusiness.getCustomerId(),"您的订单号【"+tbBusiness.getNo()+"】,车辆"+tbBusiness.getChinaCarNo()+"已入场");
+            BusinessMessageManager.set(UserTypeEnum.PLATFORM_ADMIN.getCustomerId(),"订单号【"+tbBusiness.getNo()+"】,车辆【"+tbBusiness.getChinaCarNo()+"】已入场。"+ DateUtil.now()+"。");
+            BusinessMessageManager.set(tbBusiness.getCustomerId(),"您的订单号【"+tbBusiness.getNo()+"】,车辆【"+tbBusiness.getChinaCarNo()+"】已入场。"+ DateUtil.now()+"。");
             return ResultJson.success();
         }else {
             if (tbBusiness.getAdminConfirmPay() ==0&&tbBusiness.getCustomerType()==1) {
@@ -65,7 +68,8 @@ public class OpenService {
             }
             tbBusinessService.calculationPartMoney("越南车", tbBusiness);
             tbBusinessService.updateById(tbBusiness);
-            BusinessMessageManager.set(tbBusiness.getCustomerId(),"您的订单号【"+tbBusiness.getNo()+"】,车辆"+tbBusiness.getChinaCarNo()+"已完成业务离场");
+            BusinessMessageManager.set(UserTypeEnum.PLATFORM_ADMIN.getCustomerId(),"订单号【"+tbBusiness.getNo()+"】,车辆【"+tbBusiness.getChinaCarNo()+"】已完成业务离场。"+ DateUtil.now()+"。");
+            BusinessMessageManager.set(tbBusiness.getCustomerId(),"您的订单号【"+tbBusiness.getNo()+"】,车辆"+tbBusiness.getChinaCarNo()+"已完成业务离场。"+ DateUtil.now()+"。");
             return ResultJson.success();
         }
     }
@@ -84,7 +88,8 @@ public class OpenService {
             if (StrUtil.isNotEmpty(cb.getInChannel())||cb.getRealInTime()!=null){
                 cb.setAdminConfirmIn(1);
             }
-            BusinessMessageManager.set(cb.getCustomerId(),"您的订单号【"+cb.getNo()+"】,车辆"+cb.getChinaCarNo()+"已入场");
+            BusinessMessageManager.set(UserTypeEnum.PLATFORM_ADMIN.getCustomerId(),"订单号【"+cb.getNo()+"】,车辆【"+cb.getChinaCarNo()+"】已入场。"+DateUtil.now()+"。");
+            BusinessMessageManager.set(cb.getCustomerId(),"您的订单号【"+cb.getNo()+"】,车辆【"+cb.getChinaCarNo()+"】已入场。"+DateUtil.now()+"。");
             tbBusinessService.updateById(cb);
             return ResultJson.success();
         }else  {
@@ -101,7 +106,8 @@ public class OpenService {
             }
             tbBusinessService.calculationPartMoney("中国车", cb);
             tbBusinessService.updateById(cb);
-            BusinessMessageManager.set(cb.getCustomerId(),"您的订单号【"+cb.getNo()+"】,车辆"+cb.getChinaCarNo()+"已完成业务离场");
+            BusinessMessageManager.set(cb.getCustomerId(),"您的订单号【"+cb.getNo()+"】,车辆【"+cb.getChinaCarNo()+"】已完成业务离场");
+            BusinessMessageManager.set(UserTypeEnum.PLATFORM_ADMIN.getCustomerId(),"业务订单号【"+cb.getNo()+"】,车辆【"+cb.getChinaCarNo()+"】已完成业务离场");
             return ResultJson.success();
         }
     }

+ 13 - 0
sp-server/src/main/java/com/pj/current/config/CarConfig.java

@@ -0,0 +1,13 @@
+package com.pj.current.config;
+
+import lombok.Data;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.stereotype.Component;
+
+@Component
+@ConfigurationProperties(prefix = "car")
+@Data
+public class CarConfig {
+    private double maxLength;
+    private double maxWeight;
+}

+ 5 - 0
sp-server/src/main/java/com/pj/project/tb_business/BusinessMessageManager.java

@@ -13,6 +13,11 @@ public class BusinessMessageManager {
     private static long EXP_TIME_SECOND = 24 * 60;
 
     public static void set(String customerId, String content) {
+        List<Object> list = RedisUtil.forListGet(MES_PREFIX + customerId);
+        List<String>checkList=list.stream().map(Object::toString).collect(Collectors.toList());
+        if (checkList.contains(content)) {
+            return;
+        }
         RedisUtil.forListAdd(MES_PREFIX + customerId, content);
     }
 

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

@@ -4,6 +4,7 @@ import java.util.Date;
 import java.util.List;
 
 import cn.dev33.satoken.stp.StpUtil;
+import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.util.StrUtil;
 import com.pj.constants.UserTypeEnum;
 import com.pj.project.tb_business_item.TbBusinessItem;
@@ -69,7 +70,7 @@ public class TbBusinessController {
     public AjaxJson delete(String id) {
       TbBusiness db=  tbBusinessService.getById(id);
       if (db!=null){
-          BusinessMessageManager.set(db.getCustomerId(),"您的业务订单【"+db.getNo()+"】已删除");
+          tbBusinessService.storeMsg(db.getCustomerId(),"业务订单【"+db.getNo()+"】已删除。"+ DateUtil.now()+"。");
       }
         tbBusinessService.removeById(id);
         tbBusinessItemService.removeByBusinessId(id);
@@ -247,7 +248,7 @@ public class TbBusinessController {
         tbPassRecordService.addOrUpdate(business.getId(), business.getCustomerId(), business.getCustomerName(),
                 business.getChinaCarNo(), 3,
                 business.getChinaCarInTime(), business.getChinaCarOutTime(), "中国车");
-        BusinessMessageManager.set(business.getCustomerId(),"您的订单【"+business.getNo()+"】完成业务离场");
+        tbBusinessService.storeMsg(business.getCustomerId(), "业务订单【"+business.getNo()+"】已完成作业离场"+ DateUtil.now()+"。");
         return AjaxJson.getSuccess();
     }
 
@@ -275,7 +276,7 @@ public class TbBusinessController {
         }
         business.setComplete(1);
         tbBusinessService.updateById(business);
-        BusinessMessageManager.set(business.getCustomerId(),"你的业务订单【"+business.getNo()+"】账单已生成!");
+        tbBusinessService.storeMsg(business.getCustomerId(), "业务订单【"+business.getNo()+"】账单已生成!"+ DateUtil.now()+"。");
         return AjaxJson.getSuccessData(business);
     }
 

+ 44 - 22
sp-server/src/main/java/com/pj/project/tb_business/TbBusinessService.java

@@ -19,6 +19,7 @@ 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.constants.UserTypeEnum;
+import com.pj.current.config.CarConfig;
 import com.pj.current.config.PartConfig;
 import com.pj.current.satoken.StpUserUtil;
 import com.pj.project.tb_business_item.TbBusinessItem;
@@ -45,6 +46,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.beans.factory.annotation.Value;
 import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Service;
 
@@ -85,6 +87,8 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
     TbBusinessPeopleService tbBusinessPeopleService;
     @Resource
     private PartConfig partConfig;
+    @Resource
+    private CarConfig carConfig;
 
     @Resource
     private TbPassRecordService tbPassRecordService;
@@ -93,7 +97,7 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
     public TbBusiness checkCarNo(String carNo) {
         QueryWrapper<TbBusiness> ew = new QueryWrapper<>();
         ew.eq("card_no", carNo)
-                .eq("admin_confirm_out",0);
+                .eq("admin_confirm_out", 0);
         return this.getOne(ew);
     }
 
@@ -101,12 +105,20 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
      * 增
      */
     public AjaxJson addOrUpdate(TbBusiness t) {
-        if (checkCarNo(t.getCardNo()) != null&&StrUtil.isEmpty(t.getId())) {
+        if (checkCarNo(t.getCardNo()) != null && StrUtil.isEmpty(t.getId())) {
             return AjaxJson.getError("该车辆【" + t.getCardNo() + "】有未完成业务");
         }
-        if (checkCarNo(t.getChinaCarNo()) != null&&StrUtil.isEmpty(t.getId())) {
+        if (checkCarNo(t.getChinaCarNo()) != null && StrUtil.isEmpty(t.getId())) {
             return AjaxJson.getError("该车辆【" + t.getChinaCarNo() + "】有未完成业务");
         }
+        double carSize = t.getCardSize();
+        if (carSize > carConfig.getMaxLength()) {
+            return AjaxJson.getError("车辆规格不能大于" + carConfig.getMaxLength());
+        }
+        double netWeight = t.getNetWeight();
+        if (netWeight > carConfig.getMaxWeight()) {
+            return AjaxJson.getError("车辆载重不能大于" + carConfig.getMaxWeight());
+        }
         t.setCreateBy(StpUserUtil.getAdmin().getName());
         createCarUnit(t);
         String customerId = t.getCustomerId();
@@ -120,9 +132,9 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
         if (StrUtil.isEmpty(t.getId())) {
             t.setCreateTime(new Date());
             t.setNo(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmm")) + RandomUtil.randomNumbers(4));
-            BusinessMessageManager.set(t.getCustomerId(),"您有一条新的业务数据:【"+t.getNo()+"】");
-        }else {
-            BusinessMessageManager.set(t.getCustomerId(),"您的业务数据:【"+t.getNo()+"】发生更改");
+            storeMsg(t.getCustomerId(), "新增一条业务数据:【" + t.getNo() + "】" + DateUtil.now() + "。");
+        } else {
+            storeMsg(t.getCustomerId(), "业务订单:【" + t.getNo() + "】数据发生更改," + DateUtil.now() + "。");
         }
         List<TbBusinessItem> items = JSONUtil.toList(t.getItemJson(), TbBusinessItem.class);
         saveOrUpdate(t);
@@ -153,6 +165,15 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
         return AjaxJson.getSuccess();
     }
 
+    public void storeMsg(String businessCustomerId, String content) {
+        String currentCustomerId = StpUserUtil.getCustomerId();
+        if (StrUtil.equals(currentCustomerId, UserTypeEnum.PLATFORM_ADMIN.getCustomerId())) {
+            BusinessMessageManager.set(businessCustomerId, content);
+        } else {
+            BusinessMessageManager.set(UserTypeEnum.PLATFORM_ADMIN.getCustomerId(), content);
+        }
+    }
+
     private void createBusinessPeople(TbBusiness t) {
         tbBusinessPeopleService.removeByBusinessId(t.getId());
         List<TbBusinessPeople> peopleList = JSONUtil.toList(t.getPeopleJson(), TbBusinessPeople.class);
@@ -219,7 +240,7 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
                     .setAdminConfirmPayBy(admin.getName()).setAdminConfirmPayTime(new Date());
         }
         this.updateById(tbBusiness);
-        BusinessMessageManager.set(tbBusiness.getCustomerId(),"您的业务订单【"+tbBusiness.getNo()+"】已支付");
+        storeMsg(tbBusiness.getCustomerId(), "业务订单【" + tbBusiness.getNo() + "】已支付" + DateUtil.now() + "。");
     }
 
     public void confirm(List<String> ids) {
@@ -227,7 +248,7 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
             TbBusiness business = this.getById(id);
             business.setConfirmInput(1).setConfirmInputTime(new Date()).setConfirmInputBy(StpUserUtil.getAdmin().getName());
             this.updateById(business);
-            BusinessMessageManager.set(business.getCustomerId(),"您的业务订单【"+business.getNo()+"】已确认");
+            storeMsg(business.getCustomerId(), "业务订单【" + business.getNo() + "】已确认" + DateUtil.now() + "。");
         });
     }
 
@@ -237,20 +258,21 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
             business.setAdminConfirmPayTime(new Date()).setAdminConfirmPay(1).setAdminConfirmPayBy(StpUserUtil.getAdmin().getName())
                     .setPayStatus(3).setPayTicket(ticket);
             this.updateById(business);
-            BusinessMessageManager.set(business.getCustomerId(),"您的业务订单【"+business.getNo()+"】已确认支付");
+            storeMsg(business.getCustomerId(), "业务订单【" + business.getNo() + "】已确认支付" + DateUtil.now() + "。");
         });
     }
 
-    public TbBusiness findCarTheNewRecord(String carNo,int inOrOut) {
+    public TbBusiness findCarTheNewRecord(String carNo, int inOrOut) {
         QueryWrapper<TbBusiness> ew = new QueryWrapper<>();
         ew.eq("card_no", carNo);
-        if (inOrOut==1){
-            ew.eq("admin_confirm_in",0).isNull("in_channel");
-        }else {
-            ew.eq("admin_confirm_out",0).isNull("out_channel").isNotNull("real_in_time");
+        if (inOrOut == 1) {
+            ew.eq("admin_confirm_in", 0).isNull("in_channel");
+        } else {
+            ew.eq("admin_confirm_out", 0).isNull("out_channel").isNotNull("real_in_time");
         }
         return getOne(ew);
     }
+
     @Deprecated
     public void adminConfirmIn(String id, String inChannel) {
         TbBusiness tbBusiness = this.getById(id);
@@ -281,6 +303,7 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
                 tbBusiness.getChinaCarInTime(), tbBusiness.getChinaCarOutTime(), "中国车");
 
     }
+
     @Async
     public void calculationPartMoney(String itemType, TbBusiness tbBusiness) {
         Date iTime = tbBusiness.getRealInTime();
@@ -303,7 +326,7 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
         long hour = ChronoUnit.HOURS.between(inDayTime, outDayTime);
         BigDecimal basePrice = partConfig.getBasePrice();
         BigDecimal extraPrice = partConfig.getExtraPrice();
-        BigDecimal price = basePrice.add(basePrice.multiply(new BigDecimal(hour/24))).add(new BigDecimal(days).multiply(extraPrice));
+        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 {
@@ -313,22 +336,21 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
     }
 
     /**
-     *
      * @param carNo
      * @param inOrOut 1入 2出
      * @return
      */
-    public TbBusiness findByChinaCarNo(String carNo,int inOrOut) {
+    public TbBusiness findByChinaCarNo(String carNo, int inOrOut) {
         QueryWrapper<TbBusiness> ew = new QueryWrapper<>();
         ew.eq("china_car_no", carNo);
-        if (inOrOut==1){
-            ew.eq("admin_confirm_in",0).isNull("china_car_in_channel");
-        }else {
-            ew.eq("admin_confirm_out",0)
+        if (inOrOut == 1) {
+            ew.eq("admin_confirm_in", 0).isNull("china_car_in_channel");
+        } else {
+            ew.eq("admin_confirm_out", 0)
                     .isNull("china_car_out_channel")
                     .isNotNull("china_car_in_time");
         }
-      return this.getOne(ew);
+        return this.getOne(ew);
     }
 
 

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

@@ -52,3 +52,6 @@ part-config:
     night-end: 06:00:00 #夜间结束时间
     free-minutes: 30
     free-car-length: 4.2
+car:
+    max-length: 20
+    max-weight: 50