Browse Source

消息管理列表

lzm 3 years ago
parent
commit
9960a151fe

+ 9 - 9
sp-admin/sa-frame/menu-list.js

@@ -86,15 +86,15 @@ var menuList =	[
 			},
 		]
 	},
-	// {
-	// 	id: 'tb-notices',
-	// 	name: '消息管理',
-	// 	icon: 'el-icon-folder-opened',
-	// 	info: '消息表表数据的维护',
-	// 	childList: [
-	// 		{id: 'tb-notices-list', name: '消息列表', url: 'sa-view/tb-notices/tb-notices-list.html'},
-	// 	]
-	// },
+	{
+		id: 'tb-notices',
+		name: '消息管理',
+		icon: 'el-icon-news',
+		info: '消息表表数据的维护',
+		childList: [
+			{id: 'tb-notices-list', name: '消息列表', url: 'sa-view/tb-notices/tb-notices-list.html'},
+		]
+	},
 
 	// {
 	// 	id: 'tb-driver',

+ 152 - 0
sp-admin/sa-view/tb-notices/tb-notices-add.html

@@ -0,0 +1,152 @@
+<!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="https://unpkg.com/element-ui@2.13.0/lib/theme-chalk/index.css">
+		<link rel="stylesheet" href="../../static/sa.css">
+		<script src="https://unpkg.com/vue@2.6.10/dist/vue.js"></script>
+		<script src="https://unpkg.com/element-ui@2.13.0/lib/index.js"></script>
+		<script src="https://unpkg.com/http-vue-loader@1.4.2/src/httpVueLoader.js"></script>
+		<script src="https://unpkg.com/jquery@3.4.1/dist/jquery.js"></script>
+		<script src="https://www.layuicdn.com/layer-v3.1.1/layer.js"></script>
+		<script src="../../static/sa.js"></script>
+		<script src="../../static/kj/upload-util.js"></script>
+		<script src="https://unpkg.com/wangeditor@4.7.8/dist/wangEditor.min.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 .el-input, .c-panel .el-form .el-textarea__inner{width: 800px;}
+			.c-item-mline{width: 800px;}
+			.editor-box{display: inline-block;}
+			.c-item .editor-box, .editor-box #editor{width: 800px;}
+		</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">
+
+						<sa-item type="text" name="主题" v-model="m.text" br></sa-item>
+						<div class="c-item br" >
+							<label class="c-label">客户:</label>
+							<el-select v-model="m.customerIdList" multiple placeholder="请选择客户" filterable >
+								<el-option label='全选'  @click.native='selectAllCustomer'></el-option>
+								<el-option v-for="(item,index) in customerList" :key="index" :label="item.name"
+										   :value="item.id">
+								</el-option>
+							</el-select>
+						</div>
+						<sa-item type="richtext" name="详情内容" v-model="m.content" br></sa-item>
+<!--						<sa-item type="enum" name="接收类型" v-model="m.receiverType" :jv="{1: '管理员', 2: '企业用户'}" jtype="3" br></sa-item>-->
+<!--						<sa-item type="enum" name="类型" v-model="m.type" :jv="{0:'公告', 1: '业务消息'}" jtype="3" br></sa-item>-->
+						<sa-item name="" class="s-ok" br>
+							<el-button type="primary" icon="el-icon-plus" @click="ok()">保存</el-button>
+						</sa-item>
+					</el-form>
+				</div>
+			</div>
+			<!-- ------- 底部按钮 ------- -->
+			<div class="s-foot">
+				<el-button type="primary" @click="ok()">确定</el-button>
+				<el-button @click="sa.closeCurrIframe()">取消</el-button>
+			</div>
+		</div>
+        <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,		// 实体对象
+					customerList: [],
+				},
+				methods: {
+					// 创建一个 默认Model 
+					createModel: function() {
+						return {
+							id: '',		// 主键
+							businessId: null,	//业务id
+							customerId: '',		// 客户id 
+							text: '',		// 标题
+							content: '',		// 详情内容
+							type: 0,		// 类型(1=业务消息)
+							// updateTime: '',		// 更新时间
+							customerIdList: [],	//商家IdList
+						}
+					},
+					// 提交数据 
+					ok: function(){
+						// 表单校验 
+						let m = this.m;
+						sa.checkNull(m.text, '请输入 [主题]');
+						let customerIds = m.customerIdList.join(',');
+						m.customerIds = customerIds;
+						sa.checkNull(m.customerIds, '请选择 [客户]');
+				
+						// 开始增加或修改
+						this.m.updateTime = undefined;		// 不提交属性:更新时间
+						if(this.id <= 0) {	// 添加
+							sa.ajax('/TbNotices/add', m, function(res){
+								sa.alert('增加成功', this.clean); 
+							}.bind(this));
+						} else {	// 修改
+							sa.ajax('/TbNotices/update', m, function(res){
+								sa.alert('修改成功', this.clean);
+							}.bind(this));
+						}
+					},
+					// 添加/修改 完成后的动作
+					clean: function() {
+						if(this.id == 0) {
+							this.m = this.createModel();
+						} else {
+							parent.app.f5();		// 刷新父页面列表
+							sa.closeCurrIframe();	// 关闭本页 
+						}
+					},
+					getCustomerList(){
+						sa.ajax('/TbCostomer/getAll', function(res) {
+							this.customerList = res.data; // 数据
+						}.bind(this));
+					},
+					selectAllCustomer(){
+						let customerIdList = [];
+						this.customerList.map((item) => {
+							customerIdList.push(item.id);
+						})
+						this.m.customerIdList = customerIdList;
+					},
+				},
+				mounted: function(){
+					// 初始化数据
+					this.getCustomerList();
+					if(this.id <= 0) {	
+						this.m = this.createModel();
+					} else {	
+						sa.ajax('/TbNotices/getById?id=' + this.id, function(res) {
+							let m = res.data;
+							console.log(m);
+							m.customerIdList = m.customerIds.split(",");
+							this.m = m;
+							if(res.data == null) {
+								sa.alert('未能查找到 id=' + this.id + " 详细数据");
+							}
+						}.bind(this))
+					}
+				}
+			})
+			
+		</script>
+	</body>
+</html>

+ 72 - 0
sp-admin/sa-view/tb-notices/tb-notices-info.html

@@ -0,0 +1,72 @@
+<!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="https://unpkg.com/element-ui@2.13.0/lib/theme-chalk/index.css">
+		<link rel="stylesheet" href="../../static/sa.css">
+		<script src="https://unpkg.com/vue@2.6.10/dist/vue.min.js"></script>
+		<script src="https://unpkg.com/element-ui@2.13.0/lib/index.js"></script>
+		<script src="https://unpkg.com/http-vue-loader@1.4.2/src/httpVueLoader.js"></script>
+		<script src="https://unpkg.com/jquery@3.4.1/dist/jquery.js"></script>
+		<script src="https://www.layuicdn.com/layer-v3.1.1/layer.js"></script>
+		<script src="../../static/sa.js"></script>
+		<style type="text/css">
+			.c-panel .c-label{width: 8em;}
+			/* 富文本样式 */
+			.content-box{width: 800px; min-height: 100px; border: 1px #ddd solid; padding: 1em; transition: all 0.2s;overflow: hidden;}
+			.content-box img{max-width: 200px !important;}
+			.c-item-mline{width: 800px;}
+		</style>
+	</head>
+	<body>
+		<div class="vue-box sbot" style="display: none;" :style="'display: block;'">
+			<!-- ------- 内容部分 ------- -->
+			<div class="s-body">
+				<div class="c-panel">
+					<el-form v-if="m">
+<!--						<sa-info type="num" name="主键" :value="m.id" br></sa-info>-->
+						<sa-info name="业务单号" br>{{m.businessNo}}</sa-info>
+<!--						<sa-info name="客户id" br>{{m.customerId}}</sa-info>-->
+						<sa-info name="主题" br>{{m.text}}</sa-info>
+
+<!--						<sa-info type="enum" name="接收人类型" :value="m.receiverType" :jv="{1: '管理员', 2: '企业用户'}" br></sa-info>-->
+						<sa-info type="enum" name="类型" :value="m.type" :jv="{0:'公告', 1: '业务消息'}" br></sa-info>
+						<sa-info type="datetime" name="更新时间" :value="m.updateTime" br></sa-info>
+						<sa-info type="richtext" name="详情内容" :value="m.content" br></sa-info>
+					</el-form>
+				</div>
+			</div>
+			<!-- ------- 底部按钮 ------- -->
+			<div class="s-foot">
+				<el-button type="success" @click="sa.closeCurrIframe()">确定</el-button>
+				<el-button @click="sa.closeCurrIframe()">取消</el-button>
+			</div>
+		</div>
+		<script>
+			var app = new Vue({
+				components: {
+					"sa-info": httpVueLoader('../../sa-frame/com/sa-info.vue')
+				},
+				el: '.vue-box',
+				data: {
+					id: sa.p('id', 0),	// 获取数据ID 
+					m: null
+				},
+				methods: {
+				},
+				mounted: function() {
+					sa.ajax('/TbNotices/getById?id=' + this.id, function(res) {
+						this.m = res.data;
+						if(res.data == null) {
+							sa.alert('未能查找到 id=' + this.id + " 详细数据");
+						}
+					}.bind(this))
+				}
+			})
+			
+		</script>
+	</body>
+</html>

+ 153 - 0
sp-admin/sa-view/tb-notices/tb-notices-list.html

@@ -0,0 +1,153 @@
+<!DOCTYPE html>
+<html>
+	<head>
+		<title>消息表-列表</title>
+		<meta charset="utf-8">
+		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
+		<!-- 所有的 css & js 资源 -->
+		<link rel="stylesheet" href="https://unpkg.com/element-ui@2.13.0/lib/theme-chalk/index.css">
+		<link rel="stylesheet" href="../../static/sa.css">
+		<script src="https://unpkg.com/vue@2.6.10/dist/vue.js"></script>
+		<script src="https://unpkg.com/element-ui@2.13.0/lib/index.js"></script>
+		<script src="https://unpkg.com/http-vue-loader@1.4.2/src/httpVueLoader.js"></script>
+		<script src="https://unpkg.com/jquery@3.4.1/dist/jquery.js"></script>
+		<script src="https://www.layuicdn.com/layer-v3.1.1/layer.js"></script>
+		<script src="../../static/sa.js"></script>
+	</head>
+	<body>
+		<div class="vue-box" style="display: none;" :style="'display: block;'">
+			<div class="c-panel">
+				<!-- ------------- 检索参数 ------------- -->
+				<div class="c-title">检索参数</div>
+				<el-form ref="form" :model='p' @submit.native.prevent>
+					<sa-item type="text" name="主题" v-model="p.text"></sa-item>
+<!--					<sa-item type="enum" name="类型" v-model="p.receiverType" -->
+<!--						:jv="{1: '管理员', 2: '企业用户'}" jtype="2" def="不限"></sa-item>-->
+					<sa-item type="enum" name="类型" v-model="p.type"
+						:jv="{0:'公告', 1: '业务消息'}" jtype="2" def="不限"></sa-item>
+					<el-button type="primary" icon="el-icon-search" @click="p.pageNo = 1; f5()">查询</el-button>
+					<br />
+				</el-form>
+				<el-button type="primary" icon="el-icon-plus" @click="add()" v-if="currentCustomerId=='1'">新增</el-button>
+<!--				<el-button type="danger" icon="el-icon-delete" @click="deleteByIds()" v-if="currentCustomerId=='1'">删除</el-button>-->
+				<el-button type="info" icon="el-icon-refresh" @click="sa.f5()">重置</el-button>
+
+				<!-- ------------- 数据列表 ------------- -->
+				<el-table class="data-table" ref="data-table" :data="dataList" >
+					<sa-td type="selection"></sa-td>
+<!--					<sa-td name="主键" prop="id" ></sa-td>-->
+					<sa-td name="业务单号" prop="businessNo" ></sa-td>
+<!--					<sa-td name="客户id" prop="customerId" ></sa-td>-->
+					<sa-td name="主题" prop="text" ></sa-td>
+<!--					<sa-td name="详情内容" prop="content" type="richtext"></sa-td>-->
+					<sa-td name="类型" prop="type" type="enum" :jv="{0: '公告消息', 1: '业务消息'}"></sa-td>
+					<sa-td name="更新时间" prop="updateTime" type="datetime"></sa-td>
+					<el-table-column label="操作" fixed="right"  width="240px">
+						<template slot-scope="s">
+							<el-button class="c-btn" type="success" icon="el-icon-view"  @click="get(s.row)">查看</el-button>
+							<el-button class="c-btn" type="primary" icon="el-icon-edit"  @click="update(s.row)" v-if="currentCustomerId=='1'&&s.row.type==0">修改</el-button>
+							<el-button class="c-btn" type="danger" icon="el-icon-delete" @click="del(s.row)" v-if="currentCustomerId=='1'&&s.row.type==0">删除</el-button>
+						</template>
+					</el-table-column>
+				</el-table>
+				<!-- ------------- 分页 ------------- -->
+				<sa-item type="page" :curr.sync="p.pageNo" :size.sync="p.pageSize" :total="dataCount" @change="f5()"></sa-item>
+			</div>
+		</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: {
+					p: { // 查询参数  
+						id: '',		// 主键 
+						businessId: '',		// 业务id
+						businessNo: '',		//业务单号
+						customerId: '',		// 客户id 
+						text: '',		// 主题
+						content: '',		// 详情内容 
+						receiverType: '',		// 类型(1=管理员, 2=企业用户) 
+						type: '',		// 类型(1=业务消息) 
+						pageNo: 1,		// 当前页 
+						pageSize: 10,	// 页大小 
+						sortType: 0		// 排序方式 
+					},
+					dataCount: 0,
+					dataList: [], // 数据集合
+					currentCustomerId: [],
+				},
+				methods: {
+					// 刷新
+					f5: function() {
+						sa.ajax('/TbNotices/getList', sa.removeNull(this.p), function(res) {
+							this.dataList = res.data; // 数据
+							console.log(res.data)
+							this.dataCount = res.dataCount; // 数据总数 
+							sa.f5TableHeight();		// 刷新表格高度 
+						}.bind(this));
+					},
+					// 查看
+					get: function(data) {
+						sa.showIframe('数据详情', 'tb-notices-info.html?id=' + data.id, '980px', '90%');
+					},
+					// 查看 - 根据选中的
+					getBySelect: function(data) {
+						var selection = this.$refs['data-table'].selection;
+						if(selection.length == 0) {
+							return sa.msg('请选择一条数据')
+						}
+						this.get(selection[0]);
+					},
+					// 修改
+					update: function(data) {
+						sa.showIframe('修改数据', 'tb-notices-add.html?id=' + data.id, '980px', '90%');
+					},
+					// 新增
+					add: function(data) {
+						sa.showIframe('新增数据', 'tb-notices-add.html?id=-1', '980px', '90%');
+					},
+					// 删除
+					del: function(data) {
+						sa.confirm('是否删除,此操作不可撤销', function() {
+							sa.ajax('/TbNotices/delete?id=' + data.id, function(res) {
+								sa.arrayDelete(this.dataList, data);
+								sa.ok('删除成功');
+								sa.f5TableHeight();		// 刷新表格高度 
+							}.bind(this))
+						}.bind(this));
+					},
+					// 批量删除
+					deleteByIds: function() {
+						// 获取选中元素的id列表 
+						let selection = this.$refs['data-table'].selection;
+						let ids = sa.getArrayField(selection, 'id');
+						if(selection.length == 0) {
+							return sa.msg('请至少选择一条数据')
+						}
+						// 提交删除 
+						sa.confirm('是否批量删除选中数据?此操作不可撤销', function() {
+							sa.ajax('/TbNotices/deleteByIds', {ids: ids.join(',')}, function(res) {
+								sa.arrayDelete(this.dataList, selection);
+								sa.ok('删除成功');
+								sa.f5TableHeight();		// 刷新表格高度 
+							}.bind(this))
+						}.bind(this));
+					},
+					getCustomer() {
+						sa.ajax('/TbCostomer/getCurrentCustomerId', function(resp) {
+							this.currentCustomerId = resp.data;
+						}.bind(this));
+					},
+				},
+				created: function() {
+					this.f5();
+					this.getCustomer();
+					sa.onInputEnter();
+				}
+			})
+		</script>
+	</body>
+</html>

+ 0 - 1
sp-server/app.pid

@@ -1 +0,0 @@
-9100

+ 4 - 3
sp-server/src/main/java/com/pj/constants/RoleEnum.java

@@ -3,6 +3,7 @@ package com.pj.constants;
 import com.pj.current.satoken.AuthConst;
 import com.pj.project.tb_business.TbBusiness;
 import com.pj.project.tb_costomer.TbCostomer;
+import com.pj.project.tb_notices.TbNotices;
 import com.pj.project.tb_pass_record.TbPassRecord;
 import lombok.AllArgsConstructor;
 import lombok.Getter;
@@ -17,11 +18,11 @@ import java.util.List;
 @AllArgsConstructor
 public enum RoleEnum {
     INPUT_ROLE("input","业务录入",
-            Arrays.asList(AuthConst.ADMIN_LIST, TbPassRecord.PERMISSION_CODE,TbPassRecord.PERMISSION_LIST, TbCostomer.PERMISSION_CODE, TbCostomer.PERMISSION_INFO,TbBusiness.PERMISSION_CODE,TbBusiness.PERMISSION_LIST,TbBusiness.PERMISSION_INPUT)),
+            Arrays.asList(AuthConst.ADMIN_LIST, TbNotices.PERMISSION_CODE,TbNotices.PERMISSION_LIST,TbPassRecord.PERMISSION_CODE,TbPassRecord.PERMISSION_LIST, TbCostomer.PERMISSION_CODE, TbCostomer.PERMISSION_INFO,TbBusiness.PERMISSION_CODE,TbBusiness.PERMISSION_LIST,TbBusiness.PERMISSION_INPUT)),
     CONFIRM_ROLE("confirm","业务确认",
-            Arrays.asList(AuthConst.ADMIN_LIST,TbPassRecord.PERMISSION_CODE,TbPassRecord.PERMISSION_LIST,TbCostomer.PERMISSION_CODE,TbCostomer.PERMISSION_INFO,TbBusiness.PERMISSION_CODE,TbBusiness.PERMISSION_LIST,TbBusiness.PERMISSION_CONFIRM)),
+            Arrays.asList(AuthConst.ADMIN_LIST,TbNotices.PERMISSION_CODE,TbNotices.PERMISSION_LIST,TbPassRecord.PERMISSION_CODE,TbPassRecord.PERMISSION_LIST,TbCostomer.PERMISSION_CODE,TbCostomer.PERMISSION_INFO,TbBusiness.PERMISSION_CODE,TbBusiness.PERMISSION_LIST,TbBusiness.PERMISSION_CONFIRM)),
     PAY_ROLE("pay","业务支付",
-            Arrays.asList(AuthConst.ADMIN_LIST,TbPassRecord.PERMISSION_CODE,TbPassRecord.PERMISSION_LIST,TbCostomer.PERMISSION_CODE,TbCostomer.PERMISSION_INFO,TbBusiness.PERMISSION_CODE,TbBusiness.PERMISSION_LIST,TbBusiness.PERMISSION_PAY)),
+            Arrays.asList(AuthConst.ADMIN_LIST,TbNotices.PERMISSION_CODE,TbNotices.PERMISSION_LIST,TbPassRecord.PERMISSION_CODE,TbPassRecord.PERMISSION_LIST,TbCostomer.PERMISSION_CODE,TbCostomer.PERMISSION_INFO,TbBusiness.PERMISSION_CODE,TbBusiness.PERMISSION_LIST,TbBusiness.PERMISSION_PAY)),
     ADMIN_ROLE("admin","管理员", Collections.emptyList()),
     SUPER_ROLE("super","超级管理员", Collections.emptyList());
     private String type;

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

@@ -8,6 +8,7 @@ import cn.hutool.core.util.StrUtil;
 import com.pj.constants.UserTypeEnum;
 import com.pj.project.tb_business_item.TbBusinessItem;
 import com.pj.project.tb_business_item.TbBusinessItemService;
+import com.pj.project.tb_notices.TbNoticesService;
 import com.pj.project.tb_pass_record.TbPassRecord;
 import com.pj.project.tb_pass_record.TbPassRecordService;
 import com.pj.utils.so.SoMap;
@@ -42,6 +43,8 @@ public class TbBusinessController {
     private TbBusinessItemService tbBusinessItemService;
     @Resource
     private TbPassRecordService tbPassRecordService;
+    @Resource
+    private TbNoticesService tbNoticesService;
 
     /**
      * 增
@@ -200,6 +203,9 @@ public class TbBusinessController {
         //更新中国车入场记录
         tbPassRecordService.addOrUpdate(tbBusiness.getId(), tbBusiness.getCustomerId(), tbBusiness.getCustomerName(),
                 tbBusiness.getChinaCarNo(), 2, tbBusiness.getChinaCarInTime(), null, "中国车");
+        //发送消息
+        String text = "您的车辆已入场,业务单号["+ tbBusiness.getNo() + "]";
+        tbNoticesService.sendNotice(tbBusiness.getId(), tbBusiness.getNo(), tbBusiness.getCustomerId(), text);
 
         return AjaxJson.getSuccess();
     }
@@ -235,6 +241,9 @@ public class TbBusinessController {
         tbPassRecordService.addOrUpdate(business.getId(), business.getCustomerId(), business.getCustomerName(),
                 business.getChinaCarNo(), 3,
                 business.getChinaCarInTime(), business.getChinaCarOutTime(), "中国车");
+        //发送消息
+        String text = "您的车辆已离场,业务单号["+ business.getNo() + "]";
+        tbNoticesService.sendNotice(business.getId(), business.getNo(), business.getCustomerId(), text);
         return AjaxJson.getSuccess();
     }
 
@@ -262,6 +271,9 @@ public class TbBusinessController {
         }
         business.setComplete(1);
         tbBusinessService.updateById(business);
+        //发送消息
+        String text = "您的账单已生成,业务单号["+ business.getNo() + "]";
+        tbNoticesService.sendNotice(business.getId(), business.getNo(), business.getCustomerId(), text);
         return AjaxJson.getSuccessData(business);
     }
 

+ 17 - 0
sp-server/src/main/java/com/pj/project/tb_business/TbBusinessService.java

@@ -35,6 +35,8 @@ import com.pj.project.tb_item.TbItem;
 import com.pj.project.tb_item.TbItemService;
 import com.pj.project.tb_item_type.TbItemType;
 import com.pj.project.tb_item_type.TbItemTypeService;
+import com.pj.project.tb_notices.TbNoticesMapper;
+import com.pj.project.tb_notices.TbNoticesService;
 import com.pj.project.tb_pass_record.TbPassRecord;
 import com.pj.project.tb_pass_record.TbPassRecordService;
 import com.pj.project.tb_unit.TbUnit;
@@ -88,6 +90,8 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
 
     @Resource
     private TbPassRecordService tbPassRecordService;
+    @Resource
+    private TbNoticesService tbNoticesService;
 
 
     public TbBusiness checkCarNo(String carNo) {
@@ -218,6 +222,9 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
                     .setAdminConfirmPayBy(admin.getName()).setAdminConfirmPayTime(new Date());
         }
         this.updateById(tbBusiness);
+        //发送消息
+        String text = "您的费用已支付,业务单号["+ tbBusiness.getNo() + "]";
+        tbNoticesService.sendNotice(tbBusiness.getId(), tbBusiness.getNo(), tbBusiness.getCustomerId(), text);
     }
 
     public void confirm(List<String> ids) {
@@ -234,6 +241,9 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
             business.setAdminConfirmPayTime(new Date()).setAdminConfirmPay(1).setAdminConfirmPayBy(StpUserUtil.getAdmin().getName())
                     .setPayStatus(3).setPayTicket(ticket);
             this.updateById(business);
+            //发送消息
+            String text = "您的费用已支付,业务单号["+ business.getNo() + "]";
+            tbNoticesService.sendNotice(business.getId(), business.getNo(), business.getCustomerId(), text);
         });
     }
 
@@ -259,6 +269,10 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
         //更新中国车入场记录
         tbPassRecordService.addOrUpdate(tbBusiness.getId(), tbBusiness.getCustomerId(), tbBusiness.getCustomerName(),
                 tbBusiness.getChinaCarNo(), 2, tbBusiness.getChinaCarInTime(), null, "中国车");
+        //发送消息
+        String text = "您的车辆已入场,业务单号["+ tbBusiness.getNo() + "]";
+        tbNoticesService.sendNotice(tbBusiness.getId(), tbBusiness.getNo(), tbBusiness.getCustomerId(), text);
+
     }
 
     public void adminOut(String id, Date outDayTime, String outChannel, String carType) {
@@ -275,6 +289,9 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
         tbPassRecordService.addOrUpdate(tbBusiness.getId(), tbBusiness.getCustomerId(), tbBusiness.getCustomerName(),
                 tbBusiness.getChinaCarNo(), 3,
                 tbBusiness.getChinaCarInTime(), tbBusiness.getChinaCarOutTime(), "中国车");
+        //发送消息
+        String text = "您的车辆已离场,业务单号["+ tbBusiness.getNo() + "]";
+        tbNoticesService.sendNotice(tbBusiness.getId(), tbBusiness.getNo(), tbBusiness.getCustomerId(), text);
 
     }
     @Async

+ 9 - 2
sp-server/src/main/java/com/pj/project/tb_costomer/TbCostomerController.java

@@ -83,8 +83,15 @@ public class TbCostomerController {
         List<TbCostomer> list = tbCostomerService.getList(so.startPage());
         return AjaxJson.getPageData(so.getDataCount(), list);
     }
-	
-	
+
+    @RequestMapping("getAll")
+    public AjaxJson getAll(){
+        SoMap so = SoMap.getRequestSoMap();
+        so.put("status", 1);
+        so.put("judgeStatus", 2);
+        List<TbCostomer> list = tbCostomerService.getList(so);
+        return AjaxJson.getSuccessData(list);
+    }
 	
 	/** 改 - 状态(0=否,1=是) */  
 	@RequestMapping("updateStatus")

+ 2 - 44
sp-server/src/main/java/com/pj/project/tb_item/TbItemMapper.xml

@@ -5,8 +5,8 @@
     <!-- 增 [G] -->
     <insert id="add">
 		insert into 
-		tb_item (id, type_id, type_name, item_code, item_name, price, unit, car_length, max_weight, status)
-		values (#{id}, #{typeId}, #{typeName}, #{itemCode}, #{itemName}, #{price}, #{unit}, #{carLength}, #{maxWeight}, #{status})
+		tb_item (id, type_id, item_code, item_name, price, unit, car_length, max_weight, status)
+		values (#{id}, #{typeId}, #{itemCode}, #{itemName}, #{price}, #{unit}, #{carLength}, #{maxWeight}, #{status})
 	</insert>
 
     <!-- 删 -->
@@ -20,7 +20,6 @@
 		update tb_item set
 		id = #{id},
 		type_id = #{typeId},
-		type_name = #{typeName},
 		item_code = #{itemCode},
 		item_name = #{itemName},
 		price = #{price},
@@ -39,7 +38,6 @@
     <resultMap id="model" type="com.pj.project.tb_item.TbItem">
         <result property="id" column="id" />
         <result property="typeId" column="type_id" />
-        <result property="typeName" column="type_name" />
         <result property="itemCode" column="item_code" />
         <result property="itemName" column="item_name" />
         <result property="price" column="price" />
@@ -97,44 +95,4 @@
 
 
 
-    <!-- 查 - 根据id -->
-    <select id="getById" resultMap="model">
-        <include refid="select_sql"></include>
-        where id = #{id}
-    </select>
-
-    <!-- 查集合 - 根据条件(参数为空时代表忽略指定条件) [G] -->
-    <select id="getList" resultMap="model">
-        <include refid="select_sql"></include>
-        <where>
-            <if test=' this.has("id") '> and id = #{id} </if>
-            <if test=' this.has("typeId") '> and type_id = #{typeId} </if>
-            <if test=' this.has("typeName") '> and type_name = #{typeName} </if>
-            <if test=' this.has("itemCode") '> and item_code = #{itemCode} </if>
-            <if test=' this.has("itemName") '> and item_name like concat('%', #{itemName} ,'%') </if>
-            <if test=' this.has("price") '> and price = #{price} </if>
-            <if test=' this.has("unit") '> and unit = #{unit} </if>
-        </where>
-        order by
-        <choose>
-            <when test='sortType == 1'> id desc </when>
-            <when test='sortType == 2'> type_id desc </when>
-            <when test='sortType == 3'> type_name desc </when>
-            <when test='sortType == 4'> item_code desc </when>
-            <when test='sortType == 5'> item_name desc </when>
-            <when test='sortType == 6'> price desc </when>
-            <when test='sortType == 7'> unit desc </when>
-            <otherwise> id desc </otherwise>
-        </choose>
-    </select>
-
-
-
-
-
-
-
-
-
-
 </mapper>

+ 94 - 0
sp-server/src/main/java/com/pj/project/tb_notices/TbNotices.java

@@ -0,0 +1,94 @@
+package com.pj.project.tb_notices;
+
+import java.io.Serializable;
+import java.util.*;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+/**
+ * Model: tb_notices -- 消息表
+ * @author lzm 
+ */
+@Data
+@Accessors(chain = true)
+@TableName(TbNotices.TABLE_NAME)
+@EqualsAndHashCode(callSuper = false)
+public class TbNotices extends Model<TbNotices> implements Serializable {
+
+	// ---------- 模块常量 ----------
+	/**
+	 * 序列化版本id 
+	 */
+	private static final long serialVersionUID = 1L;	
+	/**
+	 * 此模块对应的表名 
+	 */
+	public static final String TABLE_NAME = "tb_notices";	
+	/**
+	 * 此模块对应的权限码 
+	 */
+	public static final String PERMISSION_CODE = "tb-notices";
+
+    public static final String PERMISSION_LIST = "tb-notices-list";
+
+
+    // ---------- 表中字段 ----------
+	/**
+	 * 主键 
+	 */
+	public String id;
+
+	/**
+	 * 业务id 
+	 */
+	public String businessId;
+
+    /**
+     * 业务单号
+     */
+    public String businessNo;
+
+	/**
+	 * 客户id 
+	 */
+	public String customerIds;
+
+	/**
+	 * 主题
+	 */
+	public String text;
+
+	/**
+	 * 详情内容 
+	 */
+	public String content;	
+
+
+
+	/**
+	 * 类型(1=业务消息) 
+	 */
+	public int type;
+
+    /**
+     * 发送时间
+     */
+    public Date sendTime;
+
+    /**
+	 * 更新时间 
+	 */
+	public Date updateTime;	
+
+
+
+
+
+	
+
+
+}

+ 110 - 0
sp-server/src/main/java/com/pj/project/tb_notices/TbNoticesController.java

@@ -0,0 +1,110 @@
+package com.pj.project.tb_notices;
+
+import java.util.List;
+
+import com.pj.constants.UserTypeEnum;
+import com.pj.utils.so.SoMap;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.bind.annotation.*;
+
+import com.pj.utils.sg.*;
+import com.pj.project4sp.SP;
+
+import com.pj.current.satoken.StpUserUtil;
+import cn.dev33.satoken.annotation.SaCheckPermission;
+
+
+/**
+ * Controller: tb_notices -- 消息表
+ * @author lzm 
+ */
+@RestController
+@RequestMapping("/TbNotices/")
+public class TbNoticesController {
+
+	/** 底层 Service 对象 */
+	@Autowired
+	TbNoticesService tbNoticesService;
+
+	/** 增 */  
+	@RequestMapping("add")
+	@SaCheckPermission(TbNotices.PERMISSION_CODE)
+	@Transactional(rollbackFor = Exception.class)
+	public AjaxJson add(TbNotices t){
+		tbNoticesService.add(t);
+		t = tbNoticesService.getById(SP.publicMapper.getPrimarykey());
+		return AjaxJson.getSuccessData(t);
+	}
+
+	/** 删 */  
+	@RequestMapping("delete")
+	@SaCheckPermission(TbNotices.PERMISSION_CODE)
+	public AjaxJson delete(Long id){
+		int line = tbNoticesService.delete(id);
+		return AjaxJson.getByLine(line);
+	}
+	
+	/** 删 - 根据id列表 */  
+	@RequestMapping("deleteByIds")
+	@SaCheckPermission(TbNotices.PERMISSION_CODE)
+	public AjaxJson deleteByIds(){
+		List<Long> ids = SoMap.getRequestSoMap().getListByComma("ids", long.class);
+		int line = SP.publicMapper.deleteByIds(TbNotices.TABLE_NAME, ids);
+		return AjaxJson.getByLine(line);
+	}
+	
+	/** 改 */  
+	@RequestMapping("update")
+	@SaCheckPermission(TbNotices.PERMISSION_CODE)
+	public AjaxJson update(TbNotices t){
+		int line = tbNoticesService.update(t);
+		return AjaxJson.getByLine(line);
+	}
+
+	/** 查 - 根据id */  
+	@RequestMapping("getById")
+	public AjaxJson getById(Long id){
+		TbNotices t = tbNoticesService.getById(id);
+		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<TbNotices> list = tbNoticesService.getList(so.startPage());
+		return AjaxJson.getPageData(so.getDataCount(), list);
+	}
+	
+	
+	
+	
+	// ------------------------- 前端接口 -------------------------
+	
+	
+	/** 改 - 不传不改 [G] */
+	@RequestMapping("updateByNotNull")
+	public AjaxJson updateByNotNull(Long id){
+		AjaxError.throwBy(true, "如需正常调用此接口,请删除此行代码");
+		// 鉴别身份,是否为数据创建者 
+		long userId = SP.publicMapper.getColumnByIdToLong(TbNotices.TABLE_NAME, "user_id", id);
+		AjaxError.throwBy(userId != StpUserUtil.getLoginIdAsLong(), "此数据您无权限修改");
+		// 开始修改 (请只保留需要修改的字段)
+		SoMap so = SoMap.getRequestSoMap();
+		so.clearNotIn("id", "businessId", "customerId", "title", "content", "receiverType", "type", "updateTime").clearNull().humpToLineCase();	
+		int line = SP.publicMapper.updateBySoMapById(TbNotices.TABLE_NAME, so, id);
+		return AjaxJson.getByLine(line);
+	}
+	
+	
+	
+	
+	
+	
+
+}

+ 56 - 0
sp-server/src/main/java/com/pj/project/tb_notices/TbNoticesMapper.java

@@ -0,0 +1,56 @@
+package com.pj.project.tb_notices;
+
+import java.util.List;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+
+import com.pj.utils.so.*;
+import org.springframework.stereotype.Repository;
+
+/**
+ * Mapper: tb_notices -- 消息表
+ * @author lzm 
+ */
+
+@Mapper
+@Repository
+public interface TbNoticesMapper extends BaseMapper<TbNotices> {
+
+	/**
+	 * 增  
+	 * @param t 实体对象 
+	 * @return 受影响行数 
+	 */
+	int add(TbNotices t);
+
+	/**
+	 * 删  
+	 * @param id 要删除的数据id  
+	 * @return 受影响行数 
+	 */
+	int delete(Long id);	 
+
+	/** 
+	 * 改  
+	 * @param t 实体对象 
+	 * @return 受影响行数 
+	 */
+	int update(TbNotices t);
+
+	/** 
+	 * 查 - 根据id  
+	 * @param id 要查询的数据id 
+	 * @return 实体对象 
+	 */
+	TbNotices getById(Long id);	 
+
+	/**
+	 * 查集合 - 根据条件(参数为空时代表忽略指定条件)
+	 * @param so 参数集合 
+	 * @return 数据列表 
+	 */
+	List<TbNotices> getList(SoMap so);
+
+
+}

+ 95 - 0
sp-server/src/main/java/com/pj/project/tb_notices/TbNoticesMapper.xml

@@ -0,0 +1,95 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.pj.project.tb_notices.TbNoticesMapper">
+
+	<!-- 增 [G] -->
+	<insert id="add">
+		insert into 
+		tb_notices (id, business_id, business_no, customer_ids, text, content, type, send_time, update_time )
+		values (#{id}, #{businessId}, #{businessNo}, #{customerIds}, #{text}, #{content}, #{type}, #{sendTime}, now() )
+	</insert>
+
+	<!-- 删 -->
+	<delete id="delete">
+		delete from tb_notices 
+		where id = #{id}
+	</delete>
+
+	<!-- 改 [G] -->
+	<update id="update">
+		update tb_notices set
+		id = #{id}, 
+		business_id = #{businessId},
+		business_No = #{businessNo},
+		customer_ids = #{customerIds},
+		text = #{text},
+		content = #{content},
+		type = #{type},
+		send_time = #{sendTime},
+		update_time = now()
+		where id = #{id}
+	</update>
+
+
+	<!-- ================================== 查询相关 ================================== -->
+	<!-- select id, business_id, customer_id, text, content, receiver_type, type, update_time from tb_notices  -->
+	
+	<!-- 通用映射:手动模式 -->
+	<resultMap id="model" type="com.pj.project.tb_notices.TbNotices">
+		<result property="id" column="id" />
+		<result property="businessId" column="business_id" />
+        <result property="businessNo" column="business_no" />
+		<result property="customerIds" column="customer_ids" />
+		<result property="text" column="text" />
+		<result property="content" column="content" />
+		<result property="type" column="type" />
+        <result property="sendTime" column="send_time" />
+		<result property="updateTime" column="update_time" />
+	</resultMap>
+	
+	<!-- 公共查询sql片段 -->
+	<sql id="select_sql">
+		select * 
+		from tb_notices 
+	</sql>
+	
+	<!-- 查 - 根据id -->
+	<select id="getById" resultMap="model">
+		<include refid="select_sql"></include>
+		where id = #{id}
+	</select>
+	
+	<!-- 查集合 - 根据条件(参数为空时代表忽略指定条件) [G] -->
+	<select id="getList" resultMap="model">
+		<include refid="select_sql"></include>
+		<where>
+			<if test=' this.has("id") '> and id = #{id} </if>
+			<if test=' this.has("businessId") '> and business_id = #{businessId} </if>
+            <if test=' this.has("businessId") '> and business_no= #{businessNo} </if>
+			<if test=' this.has("customerId") '> and find_in_set( #{customerId}, customer_ids) </if>
+			<if test=' this.has("text") '> and text like concat('%',#{text},'%') </if>
+			<if test=' this.has("content") '> and content = #{content} </if>
+			<if test=' this.has("type") '> and type = #{type} </if>
+		</where>
+		order by
+		<choose>
+			<when test='sortType == 1'> id desc </when>
+			<when test='sortType == 2'> business_id desc </when>
+			<when test='sortType == 3'> customer_ids desc </when>
+			<when test='sortType == 4'> text desc </when>
+			<when test='sortType == 6'> type desc </when>
+			<when test='sortType == 7'> update_time desc </when>
+			<otherwise> update_time desc </otherwise>
+		</choose>
+	</select>
+	
+	
+	
+	
+	
+	
+	
+	
+	
+
+</mapper>

+ 65 - 0
sp-server/src/main/java/com/pj/project/tb_notices/TbNoticesService.java

@@ -0,0 +1,65 @@
+package com.pj.project.tb_notices;
+
+import java.util.Date;
+import java.util.List;
+
+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 com.pj.utils.sg.*;
+import org.springframework.transaction.annotation.Transactional;
+
+/**
+ * Service: tb_notices -- 消息表
+ * @author lzm 
+ */
+@Service
+@Transactional
+public class TbNoticesService extends ServiceImpl<TbNoticesMapper, TbNotices> implements IService<TbNotices> {
+
+	/** 底层 Mapper 对象 */
+	@Autowired
+	TbNoticesMapper tbNoticesMapper;
+
+	/** 增 */
+	int add(TbNotices t){
+		return tbNoticesMapper.add(t);
+	}
+
+	/** 删 */
+	int delete(Long id){
+		return tbNoticesMapper.delete(id);
+	}
+
+	/** 改 */
+	int update(TbNotices t){
+		return tbNoticesMapper.update(t);
+	}
+
+	/** 查 */
+	TbNotices getById(Long id){
+		return tbNoticesMapper.getById(id);
+	}
+
+	/** 查集合 - 根据条件(参数为空时代表忽略指定条件) */  
+	List<TbNotices> getList(SoMap so) {
+		return tbNoticesMapper.getList(so);	
+	}
+
+	/** 发送业务消息
+     * @param text
+     * */
+
+	public void sendNotice(String businessId,String businessNo, String customerId, String text){
+        TbNotices notice = new TbNotices();
+        notice.setBusinessId(businessId).setBusinessNo(businessNo).setCustomerIds(customerId).setText(text).setSendTime(new Date()).setType(1);
+        add(notice);
+    }
+
+	
+
+}