瀏覽代碼

Merge branch 'dev' into hpf

# Conflicts:
#	sp-admin/sa-view-sp/sp-admin/admin-list.html
#	sp-admin/sa-view/tb-business/print-zxbusiness.html
#	sp-admin/sa-view/tb-invoice-info/tb-invoice-info-list.html
#	sp-admin/sa-view/tb-partner/tb-business-item-list.html
#	sp-server/src/main/java/com/pj/api/open/service/OpenService.java
#	sp-server/src/main/java/com/pj/project/tb_business/TbBusinessService.java
#	sp-server/src/main/java/com/pj/project/tb_business_item/TbBusinessItem.java
#	sp-server/src/main/java/com/pj/project/tb_fee_details/TbFeeDetailsService.java
#	sp-server/src/main/java/com/pj/project/tb_invoice_info/TbInvoiceInfo.java
#	sp-server/src/main/java/com/pj/project/tb_invoice_info/TbInvoiceInfoController.java
#	sp-server/src/main/resources/application-dev.yml
qzyReal 2 年之前
父節點
當前提交
d7129a29cf
共有 19 個文件被更改,包括 1330 次插入1118 次删除
  1. 282 295
      sp-admin/sa-view-sp/sp-admin/admin-list.html
  2. 33 30
      sp-admin/sa-view/tb-business/print-zxbusiness.html
  3. 232 229
      sp-admin/sa-view/tb-invoice-info/tb-invoice-info-list.html
  4. 227 226
      sp-admin/sa-view/tb-partner/tb-business-item-list.html
  5. 10 1
      sp-server/src/main/java/com/pj/api/jh/service/JhService.java
  6. 23 0
      sp-server/src/main/java/com/pj/api/open/service/OpenService.java
  7. 4 1
      sp-server/src/main/java/com/pj/api/service/ApiService.java
  8. 7 0
      sp-server/src/main/java/com/pj/project/tb_business/TbBusiness.java
  9. 30 12
      sp-server/src/main/java/com/pj/project/tb_business/TbBusinessService.java
  10. 5 1
      sp-server/src/main/java/com/pj/project/tb_business_car/TbBusinessCarService.java
  11. 109 95
      sp-server/src/main/java/com/pj/project/tb_business_item/TbBusinessItem.java
  12. 1 0
      sp-server/src/main/java/com/pj/project/tb_business_item/TbBusinessItemMapper.xml
  13. 5 1
      sp-server/src/main/java/com/pj/project/tb_business_item/TbBusinessItemService.java
  14. 188 66
      sp-server/src/main/java/com/pj/project/tb_fee_details/TbFeeDetailsService.java
  15. 63 55
      sp-server/src/main/java/com/pj/project/tb_invoice_info/TbInvoiceInfo.java
  16. 87 105
      sp-server/src/main/java/com/pj/project/tb_invoice_info/TbInvoiceInfoController.java
  17. 23 0
      sp-server/src/main/java/com/pj/project/tb_order/TbOrderService.java
  18. 1 1
      sp-server/src/main/resources/application-dev.yml
  19. 二進制
      sp-server/src/main/resources/static/day-fee-new.xlsx

+ 282 - 295
sp-admin/sa-view-sp/sp-admin/admin-list.html

@@ -1,310 +1,297 @@
 <!DOCTYPE html>
 <html>
-<head>
-    <title>管理员列表</title>
-    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
-    <meta name="viewport"
-          content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"/>
-    <!-- 所有的 css & js 资源 -->
-    <link rel="stylesheet" href="../../static/kj/element-ui/theme-chalk/index.css">
-    <link rel="stylesheet" href="../../static/sa.css">
-    <script src="../../static/kj/vue.min.js"></script>
-    <script src="../../static/kj/element-ui/index.js"></script>
-    <script src="https://unpkg.com/http-vue-loader@1.4.2/src/httpVueLoader.js"></script>
-    <script src="../../static/kj/jquery.min.js"></script>
-    <script src="../../static/kj/layer/layer.js"></script>
-    <script src="../../static/sa.js"></script>
-    <script src="../../static/kj/upload-util.js"></script>
-    <style type="text/css">
-        .el-radio {
-            margin-right: 10px;
-        }
-    </style>
-</head>
-<body>
-<div class="vue-box" style="display: none;" :style="'display: block;'">
-    <div class="c-panel">
-        <!-- ------------- 检索参数 ------------- -->
-        <h4 class="c-title">检索参数</h4>
-        <el-form>
-            <sa-item type="text" name="用户名" v-model="p.name"></sa-item>
-            <el-button type="primary" icon="el-icon-search" @click="p.pageNo = 1; f5()">查询</el-button>
-            <br>
-            <!--					<sa-item name="综合排序" class="s-radio-text">-->
-            <!--						<el-radio-group v-model="p.sort_type">-->
-            <!--							<el-radio :label="0">最近添加</el-radio>-->
-            <!--							<el-radio :label="2">最近登录</el-radio>-->
-            <!--							<el-radio :label="3">登录次数</el-radio>-->
-            <!--						</el-radio-group>-->
-            <!--					</sa-item>-->
-        </el-form>
-        <!-- ------------- 快捷按钮 ------------- -->
-        <sa-item type="fast-btn" show="add,get,delete,reset"></sa-item>
-        <!-- ------------- 数据列表 ------------- -->
-        <el-table class="data-table" ref="data-table" :data="dataList">
-            <sa-td type="selection"></sa-td>
-            <sa-td type="text" name="用户名" prop="name" min-width="150px"></sa-td>
-            <sa-td type="text" name="姓名" prop="nickname"></sa-td>
-            <sa-td name="创建人">
-                <template slot-scope="s">
-                    <span v-if="s.row.createByAid == -1">无</span>
-                    <el-link v-else @click="sa.$page.openAdminInfo(s.row.createByAid, s.row.name)">
-                        {{s.row.createByAid}}
-                    </el-link>
-                </template>
-            </sa-td>
-            <sa-td type="datetime" name="创建时间" prop="createTime" width="150px"></sa-td>
-            <sa-td type="datetime" name="最后登录" prop="loginTime" width="150px"></sa-td>
-            <sa-td type="text" name="登录次数" prop="loginCount" not="0" width="100px"></sa-td>
-            <sa-td type="switch" name="账号状态" prop="status" :jv="{1: '正常', 2: '禁用[#ff4949]'}"
-                   @change="s => updateStatus(s.row)" width="120px"></sa-td>
-            <el-table-column label="操作" fixed="right" width="390px">
-                <template slot-scope="s">
+	<head>
+	    <title>管理员列表</title>
+	    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+	    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
+		<!-- 所有的 css & js 资源 -->
+		<link rel="stylesheet" href="../../static/kj/element-ui/theme-chalk/index.css">
+		<link rel="stylesheet" href="../../static/sa.css"> 
+		<script src="../../static/kj/vue.min.js"></script>
+		<script src="../../static/kj/element-ui/index.js"></script>
+		<script src="https://unpkg.com/http-vue-loader@1.4.2/src/httpVueLoader.js"></script>
+		<script src="../../static/kj/jquery.min.js"></script>
+		<script src="../../static/kj/layer/layer.js"></script>
+		<script src="../../static/sa.js"></script>
+		<script src="../../static/kj/upload-util.js"></script>
+		<style type="text/css">
+			.el-radio{margin-right: 10px;}
+		</style>
+	</head>
+	<body>
+		<div class="vue-box" style="display: none;" :style="'display: block;'">
+			<div class="c-panel">
+				<!-- ------------- 检索参数 ------------- -->
+				<h4 class="c-title">检索参数</h4>
+				<el-form>
+					<sa-item type="text" name="用户名" v-model="p.name"></sa-item>
+					<el-button type="primary" icon="el-icon-search" @click="p.pageNo = 1; f5()">查询</el-button>
+					<br>
+				</el-form>
+				<!-- ------------- 快捷按钮 ------------- -->
+				<sa-item type="fast-btn" show="add,get,delete,reset"></sa-item>
+				<!-- ------------- 数据列表 ------------- -->
+				<el-table class="data-table" ref="data-table" :data="dataList">
+					<sa-td type="selection"></sa-td>
+					<sa-td type="text" name="用户名" prop="name" min-width="150px"></sa-td>
+					<sa-td type="text" name="姓名" prop="nickname"></sa-td>
+					<sa-td name="创建人" >
+						<template slot-scope="s">
+							<span v-if="s.row.createByAid == -1">无</span>
+							<el-link v-else @click="sa.$page.openAdminInfo(s.row.createByAid, s.row.name)">{{s.row.createByAid}}</el-link>
+						</template>
+					</sa-td>
+					<sa-td type="datetime" name="创建时间" prop="createTime" width="150px"></sa-td>
+					<sa-td type="datetime" name="最后登录" prop="loginTime" width="150px"></sa-td>
+					<sa-td type="text" name="登录次数" prop="loginCount" not="0" width="100px"></sa-td>
+					<sa-td type="switch" name="账号状态" prop="status" :jv="{1: '正常', 2: '禁用[#ff4949]'}" @change="s => updateStatus(s.row)" width="120px"></sa-td>
+					<el-table-column label="操作" fixed="right" width="390px">
+						<template slot-scope="s">
 							<span @click="getInfo(s.row)">
 								<el-button type="success" class="c-btn">查看</el-button>
 							</span>
-                    <span @click="updateName(s.row)">
-								<el-button type="primary" class="c-btn">改登录名</el-button>
+							<span @click="updateName(s.row)">
+								<el-button type="primary" class="c-btn" >改登录名</el-button>
 							</span>
-                    <span @click="updateNickname(s.row)">
-								<el-button type="primary" class="c-btn">改姓名</el-button>
+							<span @click="updateNickname(s.row)">
+								<el-button type="primary" class="c-btn" >改姓名</el-button>
 							</span>
-                    <span @click="updateAvatar(s.row)">
-								<el-button type="primary" class="c-btn">改头像</el-button>
+							<span @click="updateAvatar(s.row)">
+								<el-button type="primary" class="c-btn" >改头像</el-button>
 							</span>
-                    <span @click="updatePassword(s.row)">
-								<el-button type="primary" class="c-btn">改密码</el-button>
+							<span @click="updatePassword(s.row)">
+								<el-button type="primary" class="c-btn" >改密码</el-button>
 							</span>
-                    <span @click="roleFn(s.row)">
-								<el-button type="primary" class="c-btn">角色</el-button>
+							<span @click="roleFn(s.row)">
+								<el-button type="primary" class="c-btn" >角色</el-button>
 							</span>
-                    <span @click="del(s.row)">
-								<el-button type="danger" class="c-btn">删除</el-button>
+							<span @click="del(s.row)">
+								<el-button type="danger" class="c-btn" >删除</el-button>
 							</span>
-                </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>
-    <el-dialog
-            :title="roleDialog.title"
-            :visible.sync="roleDialog.visible"
-            width="30%">
-        <div>
-            <el-checkbox @change="handleCheckAllChange">全选</el-checkbox>
-            <div style="margin: 15px 0;"></div>
-            <el-checkbox-group v-model="roleDialog.form.roleId">
-                <el-checkbox v-for="role in roleList" :label="role.id+''" :key="role.id">{{role.name}}</el-checkbox>
-            </el-checkbox-group>
-        </div>
-        <span slot="footer" class="dialog-footer">
+						</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>
+			<el-dialog
+			  :title="roleDialog.title"
+			  :visible.sync="roleDialog.visible"
+			  width="30%">
+			  <div >
+			  	 <el-checkbox   @change="handleCheckAllChange">全选</el-checkbox>
+			  	  <div style="margin: 15px 0;"></div>
+			  	  <el-checkbox-group v-model="roleDialog.form.roleId">
+			  	    <el-checkbox v-for="role in roleList" :label="role.id+''" :key="role.id">{{role.name}}</el-checkbox>
+			  	  </el-checkbox-group>
+			  </div>
+			  <span slot="footer" class="dialog-footer">
 			    <el-button @click="roleDialog.visible = false">取 消</el-button>
 			    <el-button type="primary" @click="confirmSetRole">确 定</el-button>
 			  </span>
-    </el-dialog>
-</div>
-<script>
-    var app = new Vue({
-        components: {
-            "sa-item": httpVueLoader('../../sa-frame/com/sa-item.vue'),
-            "sa-td": httpVueLoader('../../sa-frame/com/sa-td.vue')
-        },
-        el: '.vue-box',
-        data: {
-            roleDialog: {
-                visible: false,
-                title: '',
-                form: {
-                    id: '',
-                    roleId: [],
-                }
-            },
-            sa: sa, 	// 超级对象
-            p: {		// 查询参数
-                id: '',
-                name: '',
-                roleId: '',
-                sort_type: 0,
-                pageNo: 1,
-                pageSize: 10,
-            },
-            dataCount: 0,
-            dataList: [],	// 数据集合
-            roleList: [],	// 角色集合
-        },
-        methods: {
-            roleFn(data) {
-                Object.assign(this.roleDialog, {
-                    visible: true,
-                    title: '设置[' + data.name + ']角色属性',
-                    form: {
-                        id: data.id,
-                        roleId: data.roleId.split(',')
-                    }
-                })
-            },
-            handleCheckAllChange() {
-                let roleId = this.roleDialog.form.roleId;
-                let allIds = this.roleList.map(obj => obj.id + '');
-                this.roleDialog.form.roleId = roleId.length != allIds.length ? allIds : [];
-            },
-            confirmSetRole() {
-                let roleId = this.roleDialog.form.roleId;
-                if (roleId.length == 0) {
-                    return sa.msg('请选择一个角色')
-                }
-                let o = {
-                    id: this.roleDialog.form.id,
-                    roleId: this.roleDialog.form.roleId.join(',')
-                }
-                sa.ajax('/admin/setRole', o, function (resp) {
-                    this.f5();
-                    this.roleDialog.visible = false;
-                }.bind(this))
-            },
-            updateNickname(data) {
-                layer.prompt({title: '修改名称'}, function (pass, index) {
-                    layer.close(index);
-                    sa.ajax('/admin/updateNickname', {id: data.id, nickname: pass}, function (res) {
-                        data.nickname = pass;
-                        layer.msg('修改成功');
-                    }.bind(this))
-                });
-            },
-            // 刷新
-            f5: function (isPage) {
-                sa.ajax('/admin/getList', this.p, function (res) {
-                    this.dataList = res.data;	// 数据
-                    this.dataCount = res.dataCount;
-                    sa.f5TableHeight();		// 刷新表格高度
-                }.bind(this));
-            },
-            // 新增
-            add: function () {
-                sa.showIframe('添加详情', 'admin-add.html', '700px', '80%');
-            },
-            // 查看详情
-            getInfo: function (data) {
-                //sa.showIframe('账号详情', 'admin-info.html?id=' + data.id, '700px', '80%');
-                sa.$page.openAdminInfo(data.id, data.name);
-            },
-            // 查看 - 根据选中的
-            getBySelect: function (data) {
-                var selection = this.$refs['data-table'].selection;
-                if (selection.length == 0) {
-                    return sa.msg('请选择一条数据')
-                }
-                this.getInfo(selection[0]);
-            },
-            // 修改名称
-            updateName: function (data) {
-                layer.prompt({title: '修改账号名称'}, function (pass, index) {
-                    layer.close(index);
-                    sa.ajax('/admin/update', {id: data.id, name: pass}, function (res) {
-                        data.name = pass;
-                        layer.msg('修改成功');
-                    })
-                });
-            },
-            // 修改头像
-            updateAvatar: function (data) {
-                sa.uploadImage(function (src) {
-                    var p = {id: data.id, avatar: src};
-                    sa.ajax('/admin/updateAvatar', p, function (res) {
-                        sa.msg('上传成功');
-                        data.avatar = src;
-                    }.bind(this));
-                })
-            },
-            // 修改密码
-            updatePassword: function (data) {
-                layer.prompt({title: '修改密码'}, function (pass, index) {
-                    layer.close(index);
-                    if (pass.length < 4) {
-                        return layer.msg('新密码长度请不要低于4位');
-                    }
-                    sa.ajax('/admin/updatePassword', {id: data.id, password: pass}, function (res) {
-                        layer.msg('修改成功');
-                    })
-                });
-            },
-            // 修改角色
-            updateRoleId: function (data, roleId, roleName) {
-                if (data.id == sa.$sys.getCurrUser().id) {
-                    return sa.alert('不能自己修改自己的角色');
-                }
-                if (data.roleId == roleId) {
-                    return sa.alert('该用户已经是' + roleName + '了');
-                }
-                var str = '将此账号修改为 [' + roleName + '], 请确认?';
-                layer.confirm(str, {title: '请确认'}, function () {
-                    sa.ajax('/admin/updateRole', {id: data.id, roleId: roleId}, function (res) {
-                        sa.msg('修改成功');
-                        data.roleId = roleId;
-                        data.roleName = roleName;
-                    }.bind(this));
-                }.bind(this));
-            },
-            // 修改用户的状态
-            updateStatus: function (data) {
-                if (data.id == sa.$sys.getCurrUser().id) {
-                    data.status = 3 - data.status;
-                    return sa.alert('不能自己封禁自己');
-                }
-                var is_ok = false;	// 记录是否成功
-                var ajax = sa.ajax('/admin/updateStatus', {adminId: data.id, status: data.status}, function (res) {
-                    sa.msg('修改成功');
-                    is_ok = true;
-                }.bind(this));
-                // 如果未能修改成功, 则回滚
-                $.when(ajax).done(function () {
-                    if (is_ok == false) {
-                        data.status = 3 - data.status;
-                    }
-                })
-            },
-            // 删除
-            del: function (data) {
-                sa.confirm('是否删除,此操作不可撤销', function () {
-                    sa.ajax('/admin/delete', {id: data.id}, function (res) {
-                        sa.arrayDelete(app.dataList, data);
-                        sa.ok('删除成功');
-                        sa.f5TableHeight();		// 刷新表格高度
-                    })
-                });
-            },
-            // 批量删除
-            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('/admin/deleteByIds', {ids: ids.join(',')}, function (res) {
-                        sa.arrayDelete(this.dataList, selection);
-                        sa.ok('删除成功');
-                        sa.f5TableHeight();		// 刷新表格高度
-                    }.bind(this))
-                }.bind(this));
-            },
-            getRoleList() {
-                // 加载角色
-                sa.ajax('/role/getList', function (res) {
-                    this.roleList = res.data;	// 数据
-                }.bind(this), {msg: null});
-            }
-        },
-        created: function () {
-            this.f5();
-            sa.onInputEnter();	// 监听回车执行查询
-            this.getRoleList();
-        }
-    })
-
-</script>
-</body>
+			</el-dialog>
+		</div>
+        <script>
+			var app = new Vue({
+				components: {
+					"sa-item": httpVueLoader('../../sa-frame/com/sa-item.vue'),
+					"sa-td": httpVueLoader('../../sa-frame/com/sa-td.vue')
+				},
+				el: '.vue-box',
+				data: {
+					roleDialog:{
+						visible:false,
+						title:'',
+						form:{
+							id:'',
+							roleId:[],
+						}
+					},
+					sa: sa, 	// 超级对象
+					p: {		// 查询参数
+						id: '',
+						name: '',
+						roleId: '',
+						sort_type: 0,
+						pageNo: 1,
+						pageSize: 10,
+					},
+					dataCount: 0,
+					dataList: [],	// 数据集合
+					roleList: [],	// 角色集合 
+				},
+				methods: {
+					roleFn(data){
+						Object.assign(this.roleDialog,{
+							visible:true,
+							title:'设置['+data.name+']角色属性',
+							form:{
+								id:data.id,
+								roleId:data.roleId.split(',')
+							}
+						})
+					},
+					handleCheckAllChange(){
+						let roleId=this.roleDialog.form.roleId;
+						let allIds=this.roleList.map(obj=>obj.id+'');
+						this.roleDialog.form.roleId=roleId.length!=allIds.length?allIds:[];
+					},
+					confirmSetRole(){
+						let roleId=this.roleDialog.form.roleId;
+						if(roleId.length == 0) {
+							return sa.msg('请选择一个角色')
+						}
+						let o={
+							id:this.roleDialog.form.id,
+							roleId:this.roleDialog.form.roleId.join(',')
+						}
+						sa.ajax('/admin/setRole',o,function(resp){
+							this.f5();
+							this.roleDialog.visible=false;
+						}.bind(this))
+					},
+					updateNickname(data){
+						layer.prompt({title: '修改名称'}, function(pass, index){
+							layer.close(index);
+							sa.ajax('/admin/updateNickname', {id: data.id, nickname: pass}, function(res){
+								data.nickname = pass;
+								layer.msg('修改成功');
+							}.bind(this))
+						});
+					},
+					// 刷新
+					f5: function(isPage){
+						sa.ajax('/admin/getList', this.p, function(res){
+							this.dataList = res.data;	// 数据
+							this.dataCount = res.dataCount;
+							sa.f5TableHeight();		// 刷新表格高度 
+						}.bind(this));
+					},
+					// 新增
+					add: function() {
+						sa.showIframe('添加详情', 'admin-add.html', '700px', '80%');
+					},
+					// 查看详情
+					getInfo: function(data) {
+						//sa.showIframe('账号详情', 'admin-info.html?id=' + data.id, '700px', '80%');
+						sa.$page.openAdminInfo(data.id, data.name);
+					},
+					// 查看 - 根据选中的
+					getBySelect: function(data) {
+						var selection = this.$refs['data-table'].selection;
+						if(selection.length == 0) {
+							return sa.msg('请选择一条数据')
+						}
+						this.getInfo(selection[0]);
+					},
+					// 修改名称 
+					updateName: function(data) {
+						layer.prompt({title: '修改账号名称'}, function(pass, index){
+							layer.close(index);
+							sa.ajax('/admin/update', {id: data.id, name: pass}, function(res){
+								data.name = pass;
+								layer.msg('修改成功');
+							})
+						});
+					},
+					// 修改头像 
+					updateAvatar: function(data) {
+						sa.uploadImage(function(src) {
+							var p = {id: data.id, avatar: src};
+							sa.ajax('/admin/updateAvatar', p, function(res) {
+								sa.msg('上传成功');
+								data.avatar = src;  
+							}.bind(this));
+						})
+					},
+					// 修改密码
+					updatePassword: function(data) {
+						layer.prompt({title: '修改密码'}, function(pass, index){
+							layer.close(index);
+							if(pass.length < 4) {
+								return layer.msg('新密码长度请不要低于4位');
+							}
+							sa.ajax('/admin/updatePassword', {id: data.id, password: pass}, function(res){
+								layer.msg('修改成功');
+							})
+						});
+					},
+					// 修改角色 
+					updateRoleId: function(data, roleId, roleName) {
+						if(data.id == sa.$sys.getCurrUser().id) {
+							return sa.alert('不能自己修改自己的角色');  
+						}
+						if(data.roleId == roleId) {
+							return sa.alert('该用户已经是' + roleName + '了');	
+						}
+						var str = '将此账号修改为 [' + roleName + '], 请确认?';
+						layer.confirm(str, {title: '请确认'}, function() {
+							sa.ajax('/admin/updateRole', {id: data.id, roleId: roleId}, function(res) {
+								sa.msg('修改成功');
+								data.roleId = roleId;
+								data.roleName = roleName;
+							}.bind(this));
+						}.bind(this));
+					},
+					// 修改用户的状态
+					updateStatus: function(data) {
+						if(data.id == sa.$sys.getCurrUser().id) {
+							data.status = 3 - data.status;  
+							return sa.alert('不能自己封禁自己');  
+						}
+						var is_ok = false;	// 记录是否成功 
+						var ajax = sa.ajax('/admin/updateStatus', {adminId: data.id, status: data.status}, function(res) {
+							sa.msg('修改成功');
+							is_ok = true;
+						}.bind(this));
+						// 如果未能修改成功, 则回滚 
+						$.when(ajax).done(function() {
+							if(is_ok == false) {
+								data.status = 3 - data.status; 
+							}
+						})
+					},
+					// 删除 
+					del: function (data) {
+						sa.confirm('是否删除,此操作不可撤销', function(){
+							sa.ajax('/admin/delete', {id: data.id},function(res){
+								sa.arrayDelete(app.dataList, data);
+								sa.ok('删除成功');
+								sa.f5TableHeight();		// 刷新表格高度 
+							})
+						});
+					},
+					// 批量删除
+					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('/admin/deleteByIds', {ids: ids.join(',')}, function(res) {
+								sa.arrayDelete(this.dataList, selection);
+								sa.ok('删除成功');
+								sa.f5TableHeight();		// 刷新表格高度 
+							}.bind(this))
+						}.bind(this));
+					},
+					getRoleList(){
+						// 加载角色
+						sa.ajax('/role/getList', function(res){
+							this.roleList = res.data;	// 数据  
+						}.bind(this), {msg: null});
+					}
+				},
+				created: function(){
+					this.f5();
+					sa.onInputEnter();	// 监听回车执行查询 
+					this.getRoleList();
+				}
+			})
+			
+		</script>
+	</body>
 </html>

+ 33 - 30
sp-admin/sa-view/tb-business/print-zxbusiness.html

@@ -64,21 +64,21 @@
                         <td style="border:solid #000 1px;text-align: center;">停车费</td>
                     </tr>
                 </table>
-                <!--                <table id="two" width="100%" style="border-collapse:collapse;border:none;">-->
-                <!--                    <tr height="80">-->
-                <!--                        <td style="border:solid #000 1px;text-align: left;" colspan="7"><b>具体业务项:</b></td>-->
-                <!--                    </tr>-->
-                <!--                    <tr height="80">-->
-                <!--                        <td style="border:solid #000 1px;text-align: center;">收费项</td>-->
-                <!--                        <td style="border:solid #000 1px;text-align: center;">收费明细项</td>-->
-                <!--                        <td style="border:solid #000 1px;text-align: center;">单价</td>-->
-                <!--                        <td style="border:solid #000 1px;text-align: center;">计费标准</td>-->
-                <!--                        <td style="border:solid #000 1px;text-align: center;">数量</td>-->
-                <!--                        <td style="border:solid #000 1px;text-align: center;">合计</td>-->
-                <!--                        <td style="border:solid #000 1px;text-align: center;">支付状态</td>-->
-                <!--                    </tr>-->
-
-                <!--                </table>-->
+<!--                <table id="two" width="100%" style="border-collapse:collapse;border:none;">-->
+<!--                    <tr height="80">-->
+<!--                        <td style="border:solid #000 1px;text-align: left;" colspan="7"><b>具体业务项:</b></td>-->
+<!--                    </tr>-->
+<!--                    <tr height="80">-->
+<!--                        <td style="border:solid #000 1px;text-align: center;">收费项</td>-->
+<!--                        <td style="border:solid #000 1px;text-align: center;">收费明细项</td>-->
+<!--                        <td style="border:solid #000 1px;text-align: center;">单价</td>-->
+<!--                        <td style="border:solid #000 1px;text-align: center;">计费标准</td>-->
+<!--                        <td style="border:solid #000 1px;text-align: center;">数量</td>-->
+<!--                        <td style="border:solid #000 1px;text-align: center;">合计</td>-->
+<!--                        <td style="border:solid #000 1px;text-align: center;">支付状态</td>-->
+<!--                    </tr>-->
+
+<!--                </table>-->
                 <br/><br/>
 
             </div>
@@ -107,7 +107,6 @@
         }
 
         var id = getUrlParam('id');
-        var kaiDanPeople = '';
         $.ajax({
             url: sa.cfg.api_url + '/TbBusiness/getZxBusinessById?id=' + id,
             type: 'post',
@@ -125,9 +124,9 @@
                     let payType = item.payType
                     let isLock = item.isLock;
                     let money = item.money;
-                    if (isLock === 0) {
+                    if(isLock === 0){
                         isLock = "正常"
-                    } else if (isLock === 1) {
+                    }else if(isLock === 1) {
                         isLock = "锁定"
                     }
                     html.push(
@@ -161,7 +160,7 @@
                 var pickCustomerName = '';
                 var itemList = data.data.items;
                 $.each(itemList, function (index, item) {
-                    pickCustomerName = pickCustomerName + item.pickCustomerName + ',';
+                    pickCustomerName = pickCustomerName + item.pickBy + ',';
                     let itemTypeName = item.itemTypeName;
                     let itemName = item.itemName;
                     let itemPrice = item.itemPrice;
@@ -169,9 +168,9 @@
                     let num = item.num
                     let total = item.total;
                     let payStatus = item.payStatus;
-                    if (payStatus === 0) {
+                    if(payStatus === 0){
                         payStatus = "未支付"
-                    } else if (payStatus === 1) {
+                    }else if(payStatus === 1) {
                         payStatus = "已支付"
                     }
                     html.push(
@@ -186,19 +185,23 @@
                         + "<tr>"
                     );
                 })
-                pickCustomerName = pickCustomerName.substr(0, pickCustomerName.length - 1);
-                if (pickCustomerName === "null" || pickCustomerName == null) {
+                pickCustomerName = pickCustomerName.substr(0, pickCustomerName.length-1);
+                if(pickCustomerName === "null" || pickCustomerName == null){
                     pickCustomerName = '';
                 }
-                var customerName = data.data.customerName
+                var customerName = data.data.createBy;
+                var kaiDanPeople = data.data.confirmBy;
+                if(kaiDanPeople === "null" || kaiDanPeople == null){
+                    kaiDanPeople = '';
+                }
                 html.push(
                     "<tr height=\"50\">"
-                    + "<td style=\"border:solid #000 1px;text-align: center;\">" + "客户" + "</td>"
-                    + "<td style=\"border:solid #000 1px;text-align: center;\"></td>"
-                    + "<td style=\"border:solid #000 1px;text-align: center;\">" + "开单员" + "</td>"
-                    + "<td style=\"border:solid #000 1px;text-align: center;\"></td>"
-                    + "<td style=\"border:solid #000 1px;text-align: center;\">" + "装卸公司" + "</td>"
-                    + "<td style=\"border:solid #000 1px;text-align: center;\" colspan=\"2\"></td>"
+                    + "<td style=\"border:solid #000 1px;text-align: center;\">"+ "客户" +"</td>"
+                    + "<td style=\"border:solid #000 1px;text-align: center;\">"+ customerName +"</td>"
+                    + "<td style=\"border:solid #000 1px;text-align: center;\">"+ "开单员" +"</td>"
+                    + "<td style=\"border:solid #000 1px;text-align: center;\">"+ kaiDanPeople +"</td>"
+                    + "<td style=\"border:solid #000 1px;text-align: center;\">"+ "装卸公司" +"</td>"
+                    + "<td style=\"border:solid #000 1px;text-align: center;\" colspan=\"2\">"+ pickCustomerName +"</td>"
                     + "<tr>"
                 );
                 $("#one").append(html.join(''));

+ 232 - 229
sp-admin/sa-view/tb-invoice-info/tb-invoice-info-list.html

@@ -1,238 +1,241 @@
 <!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="../../static/kj/element-ui/theme-chalk/index.css">
-    <link rel="stylesheet" href="../../static/sa.css">
-    <script src="../../static/kj/vue.min.js"></script>
-    <script src="../../static/kj/element-ui/index.js"></script>
-    <script src="../../static/kj/httpVueLoader.js"></script>
-    <script src="../../static/kj/jquery.min.js"></script>
-    <script src="../../static/kj/layer/layer.js"></script>
-    <script src="../../static/sa.js"></script>
-</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>
+	<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="../../static/kj/element-ui/theme-chalk/index.css">
+		<link rel="stylesheet" href="../../static/sa.css">
+		<script src="../../static/kj/vue.min.js"></script>
+		<script src="../../static/kj/element-ui/index.js"></script>
+		<script src="../../static/kj/httpVueLoader.js"></script>
+		<script src="../../static/kj/jquery.min.js"></script>
+		<script src="../../static/kj/layer/layer.js"></script>
+		<script src="../../static/sa.js"></script>
+	</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.customerName"></sa-item>
-            <div class="c-item">
-                <label class="c-label">开票状态:</label>
-                <el-select v-model="p.status" placeholder="请选择">
-                    <el-option label="不限" value=""></el-option>
-                    <el-option label="未开票" :value="0"></el-option>
-                    <el-option label="已开票" :value="1"></el-option>
-                </el-select>
-            </div>
-            <div class="c-item">
-                <label class="c-label">开票时间:</label>
-                <el-date-picker size="mini" v-model="selectTime" type="daterange"
-                                range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期"
-                                format="yyyy 年 MM 月 dd 日" value-format="yyyy-MM-dd">
-                </el-date-picker>
-            </div>
-            <el-button type="primary" icon="el-icon-search" @click="p.pageNo = 1; f5()">查询</el-button>
-            <el-button size="mini" type="info" @click="sa.f5()">刷新</el-button>
-            <br/>
-        </el-form>
-        <!-- ------------- 快捷按钮 ------------- -->
+					<sa-item type="text" name="客户名称" v-model="p.customerName"></sa-item>
+					<div class="c-item">
+						<label class="c-label">开票状态:</label>
+						<el-select v-model="p.status" placeholder="请选择">
+							<el-option label="不限" value=""></el-option>
+							<el-option label="未开票" :value="0"></el-option>
+							<el-option label="已开票" :value="1"></el-option>
+						</el-select>
+					</div>
+					<div class="c-item">
+						<label class="c-label">开票时间:</label>
+						<el-date-picker size="mini" v-model="selectTime" type="daterange"
+										range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期"
+										format="yyyy 年 MM 月 dd 日" value-format="yyyy-MM-dd">
+						</el-date-picker>
+					</div>
+					<el-button type="primary" icon="el-icon-search" @click="p.pageNo = 1; f5()">查询</el-button>
+					<el-button size="mini" type="info" @click="sa.f5()">刷新</el-button>
+					<br />
+				</el-form>
+				<!-- ------------- 快捷按钮 ------------- -->
 
-        <!-- ------------- 数据列表 ------------- -->
-        <el-table class="data-table" ref="data-table" :data="dataList">
-            <sa-td type="selection"></sa-td>
-            <sa-td name="编号" prop="no" width="129"></sa-td>
-            <sa-td name="客户名称" prop="customerName"></sa-td>
-            <sa-td name="账单金额" prop="totalMoney"></sa-td>
-            <sa-td name="开票状态" prop="status" type="enum" :jv="{0: '未开票', 1: '已开票'}"></sa-td>
-            <sa-td name="开票种类" prop="isElec" type="enum" :jv="{0: '纸质普票', 1: '电子普票', 2:'纸质专票'}"></sa-td>
-            <sa-td name="开票时间" prop="invoiceTime"></sa-td>
-            <sa-td name="发票号" prop="invoiceNo" width="150"></sa-td>
-            <el-table-column label="主体名称">
-                <template slot-scope="s">
-                    <span>{{s.row.entityName}}</span>
-                </template>
-            </el-table-column>
-            <el-table-column label="税号" width="156">
-                <template slot-scope="s">
-                    <span>{{s.row.taxIdNo}}</span>
-                </template>
-            </el-table-column>
-            <!--					<sa-td name="地址" prop="address" ></sa-td>-->
-            <!--					<sa-td name="电话" prop="phone" ></sa-td>-->
-            <!--					<sa-td name="开户银行" prop="bank" ></sa-td>-->
-            <!--					<sa-td name="银行账号" prop="bankNo" ></sa-td>-->
-            <!--					<sa-td name="邮箱" prop="email" ></sa-td>-->
-            <el-table-column label="操作" width="240px">
-                <template slot-scope="s">
-                    <el-button v-if="s.row.status==0 && currentCustomerId==1" class="c-btn" type="primary"
-                               @click="completeFn(s.row.id)">完成开票
-                    </el-button>
-                    <el-button class="c-btn" type="success" icon="el-icon-view" @click="get(s.row)">查看</el-button>
-                    <el-button v-if="s.row.status==0" class="c-btn" type="primary" icon="el-icon-edit"
-                               @click="update(s.row)">修改
-                    </el-button>
-                    <el-button v-if="s.row.status==0 && currentCustomerId==1" class="c-btn" type="danger"
-                               icon="el-icon-delete" @click="del(s.row)">删除
-                    </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>
-    <el-dialog title="完成开票" :visible.sync="completeDate.visible" width="38%">
-        <div class="c-item">
-            <label class="c-label">开票时间:</label>
-            <el-date-picker type="datetime" value-format="yyyy-MM-dd HH:mm:ss"
-                            v-model="completeDate.form.invoiceTime"></el-date-picker>
-        </div>
-        <sa-item type="text" name="发票号" v-model="completeDate.form.invoiceNo"></sa-item>
-        <span slot="footer" class="dialog-footer">
+				<!-- ------------- 数据列表 ------------- -->
+				<el-table class="data-table" ref="data-table" :data="dataList" >
+					<sa-td type="selection"></sa-td>
+					<sa-td name="编号" prop="no" width="129"></sa-td>
+					<sa-td name="客户名称" prop="customerName" width="180"></sa-td>
+					<sa-td name="账单金额" prop="totalMoney" ></sa-td>
+					<sa-td name="开票状态" prop="status" type="enum" :jv="{0: '未开票', 1: '已开票'}"></sa-td>
+					<sa-td name="开票种类" prop="isElec" type="enum" :jv="{0: '纸质普票', 1: '电子普票', 2:'纸质专票'}"></sa-td>
+					<sa-td name="开票时间" prop="invoiceTime" ></sa-td>
+					<sa-td name="发票号" prop="invoiceNo" width="150">
+						<template slot-scope="s">
+							<div>{{s.row.invoiceNo}}
+							<i @click="updateInvoiceNo(s.row)" class="el-icon-edit" v-if="s.row.status===1" style="cursor: pointer;padding-left: 10px;color: blue;"></i>
+							</div>
+						</template>
+					</sa-td>
+					<el-table-column label="主体名称" width="180">
+						<template slot-scope="s">
+							<span>{{s.row.entityName}}</span>
+						</template>
+					</el-table-column>
+					<el-table-column label="税号" width="156">
+						<template slot-scope="s">
+							<span>{{s.row.taxIdNo}}</span>
+						</template>
+					</el-table-column>
+					<el-table-column label="操作"  width="280px">
+						<template slot-scope="s">
+							<el-button v-if="s.row.status==0 && currentCustomerId==1" class="c-btn" type="primary"  @click="completeFn(s.row.id)">线下开票</el-button>
+							<el-button class="c-btn" type="success" icon="el-icon-view" @click="get(s.row)">查看</el-button>
+							<el-button v-if="s.row.status==0" class="c-btn" type="primary" icon="el-icon-edit" @click="update(s.row)">修改</el-button>
+							<el-button v-if="s.row.status==0 && currentCustomerId==1" class="c-btn" type="danger" icon="el-icon-delete" @click="del(s.row)">删除</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>
+			<el-dialog title="线下开票" :visible.sync="completeDate.visible" width="400px">
+				<div class="c-item">
+					<label class="c-label">开票时间:</label>
+					<el-date-picker type="datetime" value-format="yyyy-MM-dd HH:mm:ss" v-model="completeDate.form.invoiceTime"></el-date-picker>
+				</div>
+				<br />
+				<sa-item type="text" name="发票号" v-model="completeDate.form.invoiceNo"></sa-item>
+				<span slot="footer" class="dialog-footer">
 					<el-button @click="completeDate.visible = false">取 消</el-button>
 					<el-button type="primary" @click="complete">确 定</el-button>
 				</span>
-    </el-dialog>
-</div>
-<script>
-    var app = new Vue({
-        components: {
-            "sa-item": httpVueLoader('../../sa-frame/com/sa-item.vue'),
-            "sa-td": httpVueLoader('../../sa-frame/com/sa-td.vue'),
-        },
-        el: '.vue-box',
-        data: {
-            p: { // 查询参数
-                id: '',		// 主键
-                customerId: '',		// 客户id
-                customerName: '',		// 客户名称
-                totalMoney: '',		// 账单金额
-                status: '',		// 支付状态(0=未开票,1=已开票)
-                invoiceTime: '',		// 开票时间
-                invoiceNo: '',		// 发票号
-                entityId: '',		// 主体id
-                entityName: '',		// 主体名称
-                taxIdNo: '',		// 税号
-                address: '',		// 地址
-                phone: '',		// 电话
-                bank: '',		// 开户银行
-                bankNo: '',		// 银行账号
-                email: '',		// 邮箱
-                createTime: '',		// 创建时间
-                beginTime: '', //查询开始时间
-                endTime: '', //查询结束时间
-                pageNo: 1,		// 当前页
-                pageSize: 10,	// 页大小
-                sortType: 0		// 排序方式
-            },
-            dataCount: 0,
-            dataList: [], // 数据集合
-            completeDate: {
-                visible: false,
-                form: {
-                    id: '',
-                    invoiceTime: '',
-                    invoiceNo: '',
-                },
-            },
-            currentCustomerId: '1',
-            selectTime: [],
-            selectTimeRange: {
-                beginTime: '', //查询开始时间
-                endTime: '', //查询结束时间
-            },
-        },
-        methods: {
-            completeFn(id) {
-                this.completeDate.visible = true;
-                this.completeDate.form.id = id;
-            },
-            complete() {
-                sa.checkNull(this.completeDate.form.invoiceTime, '请选择 [开票时间]');
-                sa.checkNull(this.completeDate.form.invoiceNo, '输入 [发票号]');
-                sa.ajax('/TbInvoiceInfo/complete?', this.completeDate.form, function (res) {
-                    this.completeDate.visible = false;
-                    sa.alert('开票成功', this.f5);
-                }.bind(this))
-            },
-            getCustomer() {
-                sa.ajax('/TbCostomer/getCurrentCustomerId', function (resp) {
-                    this.currentCustomerId = resp.data;
-                }.bind(this));
-            },
-            // 刷新
-            f5: function () {
-                if (this.selectTime != null && this.selectTime.length != 0) {
-                    this.p.beginTime = this.selectTime[0];
-                    this.p.endTime = this.selectTime[1];
-                }
-                sa.ajax('/TbInvoiceInfo/getList', sa.removeNull(this.p), function (res) {
-                    this.dataList = res.data; // 数据
-                    this.dataCount = res.dataCount; // 数据总数
+			</el-dialog>
+		</div>
+		<script>
+			var app = new Vue({
+				components: {
+					"sa-item": httpVueLoader('../../sa-frame/com/sa-item.vue'),  
+					"sa-td": httpVueLoader('../../sa-frame/com/sa-td.vue'),		
+				},
+				el: '.vue-box',
+				data: {
+					p: { // 查询参数  
+						id: '',		// 主键 
+						customerId: '',		// 客户id 
+						customerName: '',		// 客户名称 
+						totalMoney: '',		// 账单金额 
+						status: '',		// 支付状态(0=未开票,1=已开票) 
+						invoiceTime: '',		// 开票时间 
+						invoiceNo: '',		// 发票号 
+						entityId: '',		// 主体id 
+						entityName: '',		// 主体名称 
+						taxIdNo: '',		// 税号 
+						address: '',		// 地址 
+						phone: '',		// 电话 
+						bank: '',		// 开户银行 
+						bankNo: '',		// 银行账号 
+						email: '',		// 邮箱 
+						createTime: '',		// 创建时间
+						beginTime: '', //查询开始时间
+						endTime: '', //查询结束时间
+						pageNo: 1,		// 当前页 
+						pageSize: 10,	// 页大小 
+						sortType: 0		// 排序方式 
+					},
+					dataCount: 0,
+					dataList: [], // 数据集合
+					completeDate: {
+						visible: false,
+						form: {
+							id:'',
+							invoiceTime: '',
+							invoiceNo: '',
+						},
+					},
+					currentCustomerId: '1',
+					selectTime:[],
+					selectTimeRange: {
+						beginTime: '', //查询开始时间
+						endTime: '', //查询结束时间
+					},
+				},
+				methods: {
+					updateInvoiceNo(data){
+						layer.prompt({title: '修改发票号'}, function(pass, index){
+							layer.close(index);
+							sa.ajax('/TbInvoiceInfo/updateInvoiceNo', {id: data.id, invoiceNo: pass}, function(res){
+								data.invoiceNo = pass;
+								layer.msg('修改成功');
+							}.bind(this))
+						});
+					},
+					completeFn(id){
+						this.completeDate.visible = true;
+						this.completeDate.form.id = id;
+					},
+					complete(){
+						sa.checkNull(this.completeDate.form.invoiceTime, '请选择 [开票时间]');
+						sa.checkNull(this.completeDate.form.invoiceNo, '输入 [发票号]');
+						sa.ajax('/TbInvoiceInfo/complete?' , this.completeDate.form, function(res) {
+							this.completeDate.visible = false;
+							sa.alert('开票成功', this.f5);
+						}.bind(this))
+					},
+					getCustomer() {
+						sa.ajax('/TbCostomer/getCurrentCustomerId', function(resp) {
+							this.currentCustomerId = resp.data;
+						}.bind(this));
+					},
+					// 刷新
+					f5: function() {
+						if ( this.selectTime != null && this.selectTime.length != 0) {
+							this.p.beginTime = this.selectTime[0];
+							this.p.endTime = this.selectTime[1];
+						}
+						sa.ajax('/TbInvoiceInfo/getList', sa.removeNull(this.p), function(res) {
+							this.dataList = res.data; // 数据
+							this.dataCount = res.dataCount; // 数据总数
 
-                    sa.f5TableHeight();		// 刷新表格高度
-                }.bind(this));
-            },
-            // 查看
-            get: function (data) {
-                sa.showIframe('数据详情', 'tb-invoice-info-info.html?id=' + data.id, '1050px', '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-invoice-info-add.html?id=' + data.id, '550px', '80%');
-            },
-            // 新增
-            add: function (data) {
-                sa.showIframe('新增数据', 'tb-invoice-info-add.html?id=-1&customerId=' + this.currentCustomerId, '550px', '80%');
-            },
-            // 删除
-            del: function (data) {
-                sa.confirm('是否删除,此操作不可撤销', function () {
-                    sa.ajax('/TbInvoiceInfo/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('/TbInvoiceInfo/deleteByIds', {ids: ids.join(',')}, function (res) {
-                        sa.arrayDelete(this.dataList, selection);
-                        sa.ok('删除成功');
-                        sa.f5TableHeight();		// 刷新表格高度
-                    }.bind(this))
-                }.bind(this));
-            },
-        },
-        created: function () {
-            this.f5();
-            this.getCustomer();
-            sa.onInputEnter();
-        }
-    })
-</script>
-</body>
+							sa.f5TableHeight();		// 刷新表格高度 
+						}.bind(this));
+					},
+					// 查看
+					get: function(data) {
+						sa.showIframe('数据详情', 'tb-invoice-info-info.html?id=' + data.id, '1050px', '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-invoice-info-add.html?id=' + data.id, '550px', '80%');
+					},
+					// 新增
+					add: function(data) {
+						sa.showIframe('新增数据', 'tb-invoice-info-add.html?id=-1&customerId=' + this.currentCustomerId, '550px', '80%');
+					},
+					// 删除
+					del: function(data) {
+						sa.confirm('是否删除,此操作不可撤销', function() {
+							sa.ajax('/TbInvoiceInfo/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('/TbInvoiceInfo/deleteByIds', {ids: ids.join(',')}, function(res) {
+								sa.arrayDelete(this.dataList, selection);
+								sa.ok('删除成功');
+								sa.f5TableHeight();		// 刷新表格高度 
+							}.bind(this))
+						}.bind(this));
+					},
+				},
+				created: function() {
+					this.f5();
+					this.getCustomer();
+					sa.onInputEnter();
+				}
+			})
+		</script>
+	</body>
 </html>

+ 227 - 226
sp-admin/sa-view/tb-partner/tb-business-item-list.html

@@ -1,237 +1,238 @@
 <!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="../../static/kj/element-ui/theme-chalk/index.css">
-    <link rel="stylesheet" href="../../static/sa.css">
-    <script src="../../static/kj/vue.min.js"></script>
-    <script src="../../static/kj/element-ui/index.js"></script>
-    <script src="../../static/kj/httpVueLoader.js"></script>
-    <script src="../../static/kj/jquery.min.js"></script>
-    <script src="../../static/kj/layer/layer.js"></script>
-    <script src="../../static/sa.js"></script>
-</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>
+	<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="../../static/kj/element-ui/theme-chalk/index.css">
+		<link rel="stylesheet" href="../../static/sa.css">
+		<script src="../../static/kj/vue.min.js"></script>
+		<script src="../../static/kj/element-ui/index.js"></script>
+		<script src="../../static/kj/httpVueLoader.js"></script>
+		<script src="../../static/kj/jquery.min.js"></script>
+		<script src="../../static/kj/layer/layer.js"></script>
+		<script src="../../static/sa.js"></script>
+	</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.businessNo"></sa-item>
+					<sa-item type="text" name="项目名称" v-model="p.itemName"></sa-item>
+					<sa-item type="text" name="越南车" v-model="p.cardNo"></sa-item>
+					<sa-item type="text" name="中国车" v-model="p.chinaCarNo"></sa-item>
+					<sa-item type="text" name="货物" v-model="p.goodsName"></sa-item>
+					<div class="c-item">
+						<label class="c-label">业务项:</label>
+						<el-select v-model="p.goodsId" placeholder="请选择" filterable>
+							<el-option v-for="item in goodsList" :key="item.id" :label="item.name" :value="item.id">
+							</el-option>
+						</el-select>
+					</div>
+					<el-button type="primary" icon="el-icon-search" @click="p.pageNo = 1; f5()">查询</el-button>
+					<el-button style="display: inline;" type="info" icon="el-icon-refresh" @click="sa.f5()">刷新
+					</el-button>
+					<el-button type="warning" icon="el-icon-download" @click="exportFn()">导出</el-button>
 
-            <sa-item type="text" name="项目名称" v-model="p.itemName"></sa-item>
-            <sa-item type="text" name="越南车" v-model="p.cardNo"></sa-item>
-            <sa-item type="text" name="中国车" v-model="p.chinaCarNo"></sa-item>
-            <sa-item type="text" name="货物" v-model="p.goodsName"></sa-item>
-            <div class="c-item">
-                <label class="c-label">业务项:</label>
-                <el-select v-model="p.goodsId" placeholder="请选择" filterable>
-                    <el-option v-for="item in goodsList" :key="item.id" :label="item.name" :value="item.id">
-                    </el-option>
-                </el-select>
-            </div>
-            <el-button type="primary" icon="el-icon-search" @click="p.pageNo = 1; f5()">查询</el-button>
-            <el-button style="display: inline;" type="info" icon="el-icon-refresh" @click="sa.f5()">刷新
-            </el-button>
-            <el-button type="warning" icon="el-icon-download" @click="exportFn()">导出</el-button>
+					<br>
+				</el-form>
+				<!-- ------------- 快捷按钮 ------------- -->
+				<div class="fast-btn">
 
-            <br>
-        </el-form>
-        <!-- ------------- 快捷按钮 ------------- -->
-        <div class="fast-btn">
-
-        </div>
-        <!-- ------------- 数据列表 ------------- -->
-        <el-table class="data-table" ref="data-table" :data="dataList">
-            <sa-td name="单号" prop="no" width="160"></sa-td>
-            <sa-td name="业务项" prop="goodsName" width="120"></sa-td>
-            <sa-td name="收费类型" prop="itemTypeName" width="120"></sa-td>
-            <sa-td name="收费项" prop="itemName" width="140"></sa-td>
-            <sa-td name="越南车" prop="cardNo"></sa-td>
-            <sa-td name="中国车" prop="chinaCarNo"></sa-td>
-            <sa-td name="作业公司" prop="pickCustomerName"></sa-td>
-            <sa-td name="计费标准" prop="unit">
-                <template slot-scope="s">
-                    {{s.row.itemPrice}}{{s.row.unit}}
-                </template>
-            </sa-td>
-            <!-- 	<sa-td name="状态" prop="status" type="enum" :jv="{0: '未完成', 1: '已完成'}"></sa-td>
-            <sa-td name="作业时间" prop="operateTime"></sa-td> -->
-            <sa-td name="创建时间" prop="createTime" width="160"></sa-td>
-            <sa-td name="接单时间" prop="pickTime" width="160"></sa-td>
-            <sa-td name="确认时间" prop="confirmTime" width="160"></sa-td>
-            <el-table-column label="操作" fixed="right" width="200px" v-if="currentCustomerId=='1'">
-                <template slot-scope="s">
-                    <el-button v-if="s.row.pickTime&&!s.row.confirmTime" class="c-btn" type="success"
-                               icon="el-icon-edit" @click="confirmFn(s.row)">确认
-                    </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>
-    <el-dialog title="提示" :visible.sync="confirm.visible" width="30%">
-        <span>是否进行接单确认?</span>
-        <span slot="footer" class="dialog-footer">
+				</div>
+				<!-- ------------- 数据列表 ------------- -->
+				<el-table class="data-table" ref="data-table" :data="dataList">
+					<sa-td name="单号" prop="no" width="160"></sa-td>
+					<sa-td name="业务项" prop="goodsName" width="120"></sa-td>
+					<sa-td name="收费类型" prop="itemTypeName" width="120"></sa-td>
+					<sa-td name="收费项" prop="itemName" width="140"></sa-td>
+					<sa-td name="越南车" prop="cardNo"></sa-td>
+					<sa-td name="中国车" prop="chinaCarNo"></sa-td>
+					<sa-td name="作业公司" prop="pickCustomerName"></sa-td>
+					<sa-td name="计费标准" prop="unit">
+						<template slot-scope="s">
+							{{s.row.itemPrice}}{{s.row.unit}}
+						</template>
+					</sa-td>
+					<!-- 	<sa-td name="状态" prop="status" type="enum" :jv="{0: '未完成', 1: '已完成'}"></sa-td>
+					<sa-td name="作业时间" prop="operateTime"></sa-td> -->
+					<sa-td name="创建时间" prop="createTime" width="160"></sa-td>
+					<sa-td name="接单时间" prop="pickTime" width="160"></sa-td>
+					<sa-td name="确认时间" prop="confirmTime" width="160"></sa-td>
+					<el-table-column label="操作" fixed="right" width="200px" v-if="currentCustomerId=='1'">
+						<template slot-scope="s">
+							<el-button v-if="s.row.pickTime&&!s.row.confirmTime" class="c-btn" type="success"
+								icon="el-icon-edit" @click="confirmFn(s.row)">确认
+							</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>
+			<el-dialog title="提示" :visible.sync="confirm.visible" width="30%">
+				<span>是否进行接单确认?</span>
+				<span slot="footer" class="dialog-footer">
 					<el-button @click="confirm.visible = false">取 消</el-button>
 					<el-button type="primary" @click="sureConfirm">确 定</el-button>
 				</span>
-    </el-dialog>
-    <el-dialog title="提示" :visible.sync="emodel.visible" width="30%">
-        <span>日期范围:</span>
-        <el-form size="mini">
-            <div class="c-item">
-                <el-date-picker size="mini" v-model="dataTime" type="daterange" unlink-panels="false"
-                                range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期"
-                                format="yyyy 年 MM 月 dd 日" value-format="yyyy-MM-dd">
-                </el-date-picker>
-            </div>
-        </el-form>
-        <span slot="footer" class="dialog-footer">
+			</el-dialog>
+			<el-dialog title="提示" :visible.sync="emodel.visible" width="30%">
+				<span>日期范围:</span>
+				<el-form size="mini">
+					<div class="c-item">
+						<el-date-picker size="mini" v-model="dataTime" type="daterange" unlink-panels="false"
+							range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期"
+							format="yyyy 年 MM 月 dd 日" value-format="yyyy-MM-dd">
+						</el-date-picker>
+					</div>
+				</el-form>
+				<span slot="footer" class="dialog-footer">
 					<el-button @click="emodel.visible = false">取 消</el-button>
 					<el-button type="primary" @click="sureExport">确 定</el-button>
 				</span>
-    </el-dialog>
-</div>
-<script>
-    var app = new Vue({
-        components: {
-            "sa-item": httpVueLoader('../../sa-frame/com/sa-item.vue'),
-            "sa-td": httpVueLoader('../../sa-frame/com/sa-td.vue'),
-        },
-        el: '.vue-box',
-        data: {
-            p: { // 查询参数
-                id: '', // 主键
-                itemName: '', // 项目名称
-                cardNo: '',
-                chinaCarNo: '',
-                businessType: '',
-                goodsId: '',
-                goodsName: '',
-                pageNo: 1, // 当前页
-                pageSize: 10, // 页大小
-                sortType: 10 // 排序方式
-            },
-            dataCount: 0,
-            dataList: [], // 数据集合
-            goodsList: [],
-            currentCustomerId: '1',
-            itemTypeList: [],
-            confirm: {
-                visible: false,
-                form: {
-                    id: ''
-                }
-            },
-            emodel: {
-                visible: false,
-                form: {
-                    beginTime: '',
-                    endTime: ''
-                }
-            },
-            dataTime: [],
-        },
-        methods: {
-            getGoods: function () {
-                sa.ajax('/TbGoods/all', sa.removeNull(this.p), function (res) {
-                    let list = [{id: '', name: '全部'}];
-                    list = list.concat(res.data)
-                    this.goodsList = list; // 数据
-                }.bind(this));
-            },
-            exportFn() {
-                Object.assign(this.emodel, {
-                    visible: true,
-                })
-            },
-            sureExport() {
-                if (this.dataTime.length != 0) {
-                    this.emodel.form.beginTime = this.dataTime[0];
-                    this.emodel.form.endTime = this.dataTime[1];
-                } else {
-                    sa.msg("请选择日期范围");
-                    return;
-                }
-                sa.ajax('/TbBusinessItem/export/items', this.emodel.form, function (resp) {
-                    window.open(resp.data);
-                    this.emodel.visible = false;
-                }.bind(this));
-            },
-            confirmFn(data) {
-                Object.assign(this.confirm, {
-                    visible: true,
-                    form: {
-                        id: data.id
-                    }
-                })
-            },
-            sureConfirm() {
-                sa.ajax('/TbBusinessItem/confirm', {
-                    id: this.confirm.form.id
-                }, function (resp) {
-                    this.confirm.visible = false;
-                    this.f5();
-                }.bind(this));
-            },
-            getCustomer() {
-                sa.ajax('/TbCostomer/getCurrentCustomerId', function (resp) {
-                    this.currentCustomerId = resp.data;
-                }.bind(this));
-            },
-            // 刷新
-            f5: function () {
-                sa.ajax('/TbBusinessItem/getList', sa.removeNull(this.p), function (res) {
-                    this.dataList = res.data; // 数据
-                    this.dataCount = res.dataCount; // 数据总数
-                    sa.f5TableHeight(); // 刷新表格高度
-                }.bind(this));
-            },
-            // 查看
-            get: function (data) {
-                sa.showIframe('数据详情', 'tb-business-item-info.html?id=' + data.id, '1050px', '90%');
-            },
-            // 查看 - 根据选中的
-            getBySelect: function (data) {
-                var selection = this.$refs['data-table'].selection;
-                if (selection.length == 0) {
-                    return sa.msg('请选择一条数据')
-                }
-                this.get(selection[0]);
-            },
-            // 批量删除
-            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('/TbBusinessItem/deleteByIds', {
-                        ids: ids.join(',')
-                    }, function (res) {
-                        sa.arrayDelete(this.dataList, selection);
-                        sa.ok('删除成功');
-                        sa.f5TableHeight(); // 刷新表格高度
-                    }.bind(this))
-                }.bind(this));
-            },
-        },
-        created: function () {
-            this.getCustomer();
-            this.getGoods();
-            this.f5();
-            sa.onInputEnter();
-        }
-    })
-</script>
-</body>
+			</el-dialog>
+		</div>
+		<script>
+			var app = new Vue({
+				components: {
+					"sa-item": httpVueLoader('../../sa-frame/com/sa-item.vue'),
+					"sa-td": httpVueLoader('../../sa-frame/com/sa-td.vue'),
+				},
+				el: '.vue-box',
+				data: {
+					p: { // 查询参数  
+						id: '', // 主键 
+						itemName: '', // 项目名称
+						cardNo: '',
+						chinaCarNo: '',
+						businessType: '',
+						goodsId: '',
+						goodsName: '',
+						businessNo: '',
+						pageNo: 1, // 当前页
+						pageSize: 10, // 页大小 
+						sortType: 10 // 排序方式
+					},
+					dataCount: 0,
+					dataList: [], // 数据集合 
+					goodsList:[],
+					currentCustomerId: '1',
+					itemTypeList: [],
+					confirm: {
+						visible: false,
+						form: {
+							id: ''
+						}
+					},
+					emodel: {
+						visible: false,
+						form: {
+							beginTime: '',
+							endTime: ''
+						}
+					},
+					dataTime: [],
+				},
+				methods: {
+					getGoods: function() {
+						sa.ajax('/TbGoods/all', sa.removeNull(this.p), function(res) {
+							let list=[{id:'',name:'全部'}];
+							list=list.concat(res.data)
+							this.goodsList =list ; // 数据
+						}.bind(this));
+					},
+					exportFn() {
+						Object.assign(this.emodel, {
+							visible: true,
+						})
+					},
+					sureExport() {
+						if (this.dataTime.length != 0) {
+							this.emodel.form.beginTime = this.dataTime[0];
+							this.emodel.form.endTime = this.dataTime[1];
+						} else {
+							sa.msg("请选择日期范围");
+							return;
+						}
+						sa.ajax('/TbBusinessItem/export/items', this.emodel.form, function(resp) {
+							window.open(resp.data);
+							this.emodel.visible = false;
+						}.bind(this));
+					},
+					confirmFn(data) {
+						Object.assign(this.confirm, {
+							visible: true,
+							form: {
+								id: data.id
+							}
+						})
+					},
+					sureConfirm() {
+						sa.ajax('/TbBusinessItem/confirm', {
+							id: this.confirm.form.id
+						}, function(resp) {
+							this.confirm.visible = false;
+							this.f5();
+						}.bind(this));
+					},
+					getCustomer() {
+						sa.ajax('/TbCostomer/getCurrentCustomerId', function(resp) {
+							this.currentCustomerId = resp.data;
+						}.bind(this));
+					},
+					// 刷新
+					f5: function() {
+						sa.ajax('/TbBusinessItem/getList', sa.removeNull(this.p), function(res) {
+							this.dataList = res.data; // 数据
+							this.dataCount = res.dataCount; // 数据总数 
+							sa.f5TableHeight(); // 刷新表格高度 
+						}.bind(this));
+					},
+					// 查看
+					get: function(data) {
+						sa.showIframe('数据详情', 'tb-business-item-info.html?id=' + data.id, '1050px', '90%');
+					},
+					// 查看 - 根据选中的
+					getBySelect: function(data) {
+						var selection = this.$refs['data-table'].selection;
+						if (selection.length == 0) {
+							return sa.msg('请选择一条数据')
+						}
+						this.get(selection[0]);
+					},
+					// 批量删除
+					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('/TbBusinessItem/deleteByIds', {
+								ids: ids.join(',')
+							}, function(res) {
+								sa.arrayDelete(this.dataList, selection);
+								sa.ok('删除成功');
+								sa.f5TableHeight(); // 刷新表格高度 
+							}.bind(this))
+						}.bind(this));
+					},
+				},
+				created: function() {
+					this.getCustomer();
+					this.getGoods();
+					this.f5();
+					sa.onInputEnter();
+				}
+			})
+		</script>
+	</body>
 </html>

+ 10 - 1
sp-server/src/main/java/com/pj/api/jh/service/JhService.java

@@ -77,6 +77,15 @@ public class JhService {
         String businessType = request.getParameter("businessType");
         Attach atchMap = new Attach();
         atchMap.setC(c).setB(businessId).setA(a);
+        String attchStr = JSONUtil.toJsonStr(atchMap);
+        TbOrder dbOrder = tbOrderService.find30Seconds(attchStr, LocalDateTime.now().minusSeconds(30).format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
+        if (dbOrder!=null&&!StrUtil.equals(dbOrder.getOpenid(),openid)){
+            throw new Exception("其他人正在付款....");
+        }
+        TbOrder successOrder=tbOrderService.findSuccessOrder(attchStr);
+        if (successOrder!=null){
+            throw new Exception("业务订单已支付....");
+        }
         String out_trade_no = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss")) + RandomUtil.randomNumbers(6);
         Map<String, Object> params = new HashMap<>();
         // params.put("attach", JSONUtil.toJsonStr(atchMap));
@@ -113,7 +122,7 @@ public class JhService {
 
             object.set("outTradeNo", out_trade_no);
             TbOrder tbOrder = new TbOrder();
-            tbOrder.setAttach(JSONUtil.toJsonStr(atchMap))
+            tbOrder.setAttach(attchStr)
                     .setOpenid(openid)
                     .setOrderTime(new Date())
                     .setOutTradeNo(out_trade_no).setPrice(money);

+ 23 - 0
sp-server/src/main/java/com/pj/api/open/service/OpenService.java

@@ -2,19 +2,29 @@ package com.pj.api.open.service;
 
 import cn.hutool.cache.CacheUtil;
 import cn.hutool.cache.impl.TimedCache;
+import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.img.ImgUtil;
+import cn.hutool.core.io.FileUtil;
+import cn.hutool.core.util.RandomUtil;
 import cn.hutool.core.util.RandomUtil;
 import cn.hutool.core.util.StrUtil;
 import cn.hutool.log.StaticLog;
 import com.pj.api.open.ResultJson;
 import com.pj.api.open.bo.CheckCarNumberBO;
 import com.pj.api.open.bo.InRecordBO;
+import com.pj.constants.UserTypeEnum;
+import com.pj.current.config.SystemObject;
 import com.pj.current.task.TaskService;
 import com.pj.project.tb_account.AutomaticPay;
 import com.pj.project.tb_business.TbBusiness;
 import com.pj.project.tb_business.TbBusinessService;
+
 import com.pj.project.tb_business_car.TbBusinessCar;
 import com.pj.project.tb_business_car.TbBusinessCarService;
+import com.pj.project.tb_business_item.TbBusinessItem;
 import com.pj.project.tb_business_item.TbBusinessItemService;
+import com.pj.project.tb_business_people.TbBusinessPeople;
+import com.pj.project.tb_business_people.TbBusinessPeopleService;
 import com.pj.project.tb_car.TbCar;
 import com.pj.project.tb_car.TbCarService;
 import com.pj.project.tb_car_no_color.TbCarNoColor;
@@ -22,19 +32,32 @@ import com.pj.project.tb_car_no_color.TbCarNoColorService;
 import com.pj.project.tb_goods.TbGoods;
 import com.pj.project.tb_goods.TbGoodsService;
 import com.pj.project.tb_item.TbItem;
+import com.pj.project.tb_item_type.TbItemType;
+import com.pj.project4sp.global.BusinessException;
+import com.pj.project4sp.uploadfile.UploadConfig;
 import com.pj.utils.cache.RedisUtil;
+import com.pj.utils.sg.AjaxJson;
+import com.sun.org.apache.bcel.internal.generic.IF_ACMPEQ;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.context.annotation.Lazy;
 import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
+import sun.misc.BASE64Decoder;
 
 import javax.annotation.Resource;
+import javax.xml.crypto.Data;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.OutputStream;
 import java.math.BigDecimal;
 import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
+import java.util.Collections;
 import java.util.Date;
 import java.util.List;
+import java.util.Objects;
 import java.util.stream.Collectors;
 
 @Service

+ 4 - 1
sp-server/src/main/java/com/pj/api/service/ApiService.java

@@ -231,9 +231,12 @@ public class ApiService {
         if (tbBusinessItem.getPick() == 1) {
             return AjaxJson.getError("您慢了一步,其他用户已接单");
         }
+        String adminId = spAdmin.getId()+"";
+        String adminName = StrUtil.isNotEmpty(spAdmin.getNickname()) ? spAdmin.getNickname():spAdmin.getName();
         String customerId = spAdmin.getCustomerId();
         TbCostomer tbCostomer = tbCostomerService.getById(customerId);
-        tbBusinessItem.setPick(1).setPickTime(new Date()).setPickCustomerId(tbCostomer.getId()).setPickCustomerName(tbCostomer.getName());
+        tbBusinessItem.setPick(1).setPickTime(new Date()).setPickCustomerId(tbCostomer.getId()).setPickCustomerName(tbCostomer.getName())
+            .setPickBy(adminName).setPickByAdminId(adminId);
         tbBusinessItemService.updateById(tbBusinessItem);
         //todo 通知录入人员 已接单
         List<SpAdmin> spAdminList = spAdminService.findByCustomerId(UserTypeEnum.PLATFORM_ADMIN.getCustomerId());

+ 7 - 0
sp-server/src/main/java/com/pj/project/tb_business/TbBusiness.java

@@ -247,6 +247,13 @@ public class TbBusiness extends Model<TbBusiness> implements Serializable {
     private transient String itemJson;
     private transient String peopleJson;
     private transient String carJson;
+
+    /**
+     * 确认账单操作人
+     */
+    private String confirmBy;
+    private String confirmByAdminId;
+
     @TableField(exist = false)
     private List<TbBusinessItem> items = new ArrayList<>();
     @TableField(exist = false)

+ 30 - 12
sp-server/src/main/java/com/pj/project/tb_business/TbBusinessService.java

@@ -1,5 +1,13 @@
 package com.pj.project.tb_business;
 
+import java.math.BigDecimal;
+import java.time.LocalDateTime;
+import java.time.ZoneId;
+import java.time.format.DateTimeFormatter;
+import java.time.temporal.ChronoUnit;
+import java.util.*;
+import java.util.stream.Collectors;
+
 import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.util.NumberUtil;
 import cn.hutool.core.util.RandomUtil;
@@ -39,6 +47,8 @@ import com.pj.project.tb_declare.TbDeclare;
 import com.pj.project.tb_declare.TbDeclareService;
 import com.pj.project.tb_driver.TbDriver;
 import com.pj.project.tb_driver.TbDriverService;
+import com.pj.project.tb_fee_details.TbFeeDetails;
+import com.pj.project.tb_fee_details.TbFeeDetailsService;
 import com.pj.project.tb_goods.TbGoods;
 import com.pj.project.tb_goods.TbGoodsService;
 import com.pj.project.tb_item.TbItem;
@@ -58,16 +68,11 @@ import com.pj.utils.so.SoMap;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Lazy;
 import org.springframework.stereotype.Service;
+
+import com.pj.utils.sg.*;
 import org.springframework.transaction.annotation.Transactional;
 
 import javax.annotation.Resource;
-import java.math.BigDecimal;
-import java.time.LocalDateTime;
-import java.time.ZoneId;
-import java.time.format.DateTimeFormatter;
-import java.time.temporal.ChronoUnit;
-import java.util.*;
-import java.util.stream.Collectors;
 
 /**
  * Service: tb_business -- 入境登记
@@ -141,6 +146,8 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
     private AutomaticPay automaticPay;
 
 
+    @Resource
+    private TbFeeDetailsService tbFeeDetailsService;
 
     private final List<String> CAR_LIST = StrUtil.splitTrim("浙,粤,京,津,冀,晋,蒙,辽,黑,沪,吉,苏,皖,赣,鲁,豫,鄂,湘,桂,琼,渝,川,贵,云,藏, 陕, 甘, 青, 宁", ",");
 
@@ -342,9 +349,12 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
     public void confirm(List<String> ids) {
         ids.forEach(id -> {
             TbBusiness business = this.getById(id);
+            SpAdmin currAdmin = StpUserUtil.getAdmin();
+            String adminName = StrUtil.isNotEmpty(currAdmin.getNickname()) ? currAdmin.getNickname():currAdmin.getName();
             business.setConfirmInput(1).setAdminConfirmInput(1)
                     .setConfirmInputTime(new Date())
-                    .setConfirmInputBy(StpUserUtil.getAdmin().getName());
+                    .setConfirmInputBy(StpUserUtil.getAdmin().getName())
+                    .setConfirmBy(adminName).setConfirmByAdminId(currAdmin.getId()+"");
             this.updateById(business);
             List<TbBusinessCar> cars = tbBusinessCarService.findOtherBusinessCar(business.getId());
             String carNoStr = cars.stream().map(TbBusinessCar::getCarNo).collect(Collectors.joining("、"));
@@ -371,6 +381,11 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
                         item.setPickCustomerId(customerId).setPick(1)
                                 .setPickCustomerName(tbCostomer.getName()).setPickTime(now)
                                 .setConfirm(1).setConfirmTime(now);
+                        TbFeeDetails feeDetails = tbFeeDetailsService.getByBusinessItemId(item.getId() + "");
+                        if (feeDetails != null) {
+                            feeDetails.setPickCustomerName(item.getPickCustomerName());
+                            tbFeeDetailsService.updateById(feeDetails);
+                        }
                         tbBusinessItemService.updateById(item);
                         List<String> customerMessageType = StrUtil.splitTrim(tbCostomer.getMessageType(), ",");
                         if (customerMessageType.contains(messageType)) {
@@ -601,10 +616,7 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
         tbBusiness.setCars(cars);
         return tbBusiness;
     }
-
-    /**
-     * 获取业务信息,但只取装卸类型的收费项
-     */
+    /**获取业务信息,但只取装卸类型的收费项*/
     public TbBusiness getZxBusinessById(String id) {
         TbBusiness tbBusiness = this.getById(id);
         List<TbBusinessItem> tbBusinessItems = tbBusinessItemService.findZxByBusinessId(id);
@@ -1010,4 +1022,10 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
         ew.eq("date_format(pay_time,'%Y-%m-%d')", day).orderByDesc("id");
         return this.list(ew);
     }
+
+    public TbBusiness findByNo(String no) {
+        QueryWrapper<TbBusiness> ew = new QueryWrapper<>();
+        ew.eq("no", no);
+        return this.getOne(ew);
+    }
 }

+ 5 - 1
sp-server/src/main/java/com/pj/project/tb_business_car/TbBusinessCarService.java

@@ -194,12 +194,16 @@ public class TbBusinessCarService extends ServiceImpl<TbBusinessCarMapper, TbBus
         TbBusinessCar db = this.getById(t.getId());
         String oldCarNo = db.getCarNo();
         String newCarNo = t.getCarNo();
+        Date now = new Date();
         db.setRealInTime(t.getRealInTime()).setColor(t.getColor())
                 .setRealOutTime(t.getRealOutTime()).setInImage(t.getInImage())
                 .setOutImage(t.getOutImage())
                 .setCarSize(t.getCarSize())
                 .setDriverName(t.getDriverName())
-                .setDriverPhone(t.getDriverPhone()).setTimeUpdate(new Date());
+                .setDriverPhone(t.getDriverPhone()).setTimeUpdate(now);
+        if(t.getRealOutTime() != null && db.getPay() == 0){
+            db.setPay(1).setPayType("已支付");
+        }
         //车牌没改
         if (StrUtil.equals(oldCarNo, newCarNo)) {
             this.updateById(db);

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

@@ -1,10 +1,13 @@
 package com.pj.project.tb_business_item;
 
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableField;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableName;
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.Date;
+
+import com.baomidou.mybatisplus.annotation.*;
 import com.baomidou.mybatisplus.extension.activerecord.Model;
+import lombok.EqualsAndHashCode;
+
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
@@ -15,8 +18,7 @@ import java.util.Date;
 
 /**
  * Model: tb_business_item -- 业务作业项
- *
- * @author qzy
+ * @author qzy 
  */
 @Data
 @Accessors(chain = true)
@@ -24,104 +26,116 @@ import java.util.Date;
 @EqualsAndHashCode(callSuper = false)
 public class TbBusinessItem extends Model<TbBusinessItem> implements Serializable {
 
-    // ---------- 模块常量 ----------
-    /**
-     * 序列化版本id
-     */
-    private static final long serialVersionUID = 1L;
-    /**
-     * 此模块对应的表名
-     */
-    public static final String TABLE_NAME = "tb_business_item";
-    /**
-     * 此模块对应的权限码
-     */
-    public static final String PERMISSION_CODE = "tb-business-item";
-
+	// ---------- 模块常量 ----------
+	/**
+	 * 序列化版本id 
+	 */
+	private static final long serialVersionUID = 1L;	
+	/**
+	 * 此模块对应的表名 
+	 */
+	public static final String TABLE_NAME = "tb_business_item";	
+	/**
+	 * 此模块对应的权限码 
+	 */
+	public static final String PERMISSION_CODE = "tb-business-item";	
+
+
+	// ---------- 表中字段 ----------
+	/**
+	 * 主键 
+	 */
+	@TableId(type = IdType.AUTO)
+	private Long id;
+
+	/**
+	 * 等级表id 
+	 */
+	private String businessId;
+
+	/**
+	 * 项目编号 
+	 */
+	private String itemCode;
+	private String itemId;
+
+	/**
+	 * 项目金额(元) 
+	 */
+	private BigDecimal itemPrice;
+
+	/**
+	 * 项目名称 
+	 */
+	private String itemName;	
+
+	/**
+	 * 状态(1=未完成,2=已完成) 
+	 */
+	private int status;
+
+	/**
+	 * 操作时间 
+	 */
+	private Date operateTime;
+
+	private String itemTypeId;
+
+	private String itemTypeName;
+
+	/**
+	 * 操作人员 
+	 */
+	private String operaror;
+	/**
+	 * 数量
+	 */
+	private String num;
+	private String unit;
+	private BigDecimal total;
+	private String ticket;
+
+	private Integer payStatus;
+	private Date payTime;
+	private Date createTime;
+	private Integer pick;
+	private Date pickTime;
+	private Integer confirm;
+	private Date confirmTime;
+	private String pickCustomerId;
+	private String pickCustomerName;
+	private String businessType;
+	private String no;
+	private String remark;
+
+	/**
+	 * 收费分类
+	 */
+	private Integer payType;
+	private String payTypeName;
+	/**
+	 * 税率
+	 */
+	private Double taxRate;
 
-    // ---------- 表中字段 ----------
     /**
-     * 主键
+     * 接单操作人
      */
-    @TableId(type = IdType.AUTO)
-    private Long id;
+    private String pickBy;
+    private String pickByAdminId;
 
-    /**
-     * 等级表id
-     */
-    private String businessId;
+	@TableField(exist = false)
+	private String goodsName;
+	@TableField(exist = false)
+	private String cardNo;
+	@TableField(exist = false)
+	private String chinaCarNo;
 
-    /**
-     * 项目编号
-     */
-    private String itemCode;
-    private String itemId;
 
-    /**
-     * 项目金额(元)
-     */
-    private BigDecimal itemPrice;
 
-    /**
-     * 项目名称
-     */
-    private String itemName;
-
-    /**
-     * 状态(1=未完成,2=已完成)
-     */
-    private int status;
-
-    /**
-     * 操作时间
-     */
-    private Date operateTime;
-
-    private String itemTypeId;
 
-    private String itemTypeName;
 
-    /**
-     * 操作人员
-     */
-    private String operaror;
-    /**
-     * 数量
-     */
-    private String num;
-    private String unit;
-    private BigDecimal total;
-    private String ticket;
-
-    private Integer payStatus;
-    private Date payTime;
-    private Date createTime;
-    private Integer pick;
-    private Date pickTime;
-    private Integer confirm;
-    private Date confirmTime;
-    private String pickCustomerId;
-    private String pickCustomerName;
-    private String businessType;
-    private String no;
-    private String remark;
-
-    /**
-     * 收费分类
-     */
-    private Integer payType;
-    private String payTypeName;
-    /**
-     * 税率
-     */
-    private Double taxRate;
-
-    @TableField(exist = false)
-    private String goodsName;
-    @TableField(exist = false)
-    private String cardNo;
-    @TableField(exist = false)
-    private String chinaCarNo;
+	
 
 
 }

+ 1 - 0
sp-server/src/main/java/com/pj/project/tb_business_item/TbBusinessItemMapper.xml

@@ -60,6 +60,7 @@
         from tb_business_item a,tb_business b where a.business_id=b.id
         <if test=' this.has("id") '>and a.id = #{id}</if>
         <if test=' this.has("goodsId") '>and b.goods_id = #{goodsId}</if>
+        <if test=' this.has("businessNo") '>and b.no = #{businessNo}</if>
         <if test=' this.has("businessId") '>and a.business_id = #{businessId}</if>
         <if test=' this.has("pickCustomerId") '>and a.pick_customer_id = #{pickCustomerId}</if>
         <if test=' this.has("itemCode") '>and a.item_code = #{itemCode}</if>

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

@@ -12,6 +12,7 @@ import com.pj.api.wx.service.WxService;
 import com.pj.constants.UserTypeEnum;
 import com.pj.current.config.MyConfig;
 import com.pj.current.config.WxConfig;
+import com.pj.current.satoken.StpUserUtil;
 import com.pj.current.task.TaskService;
 import com.pj.project.tb_business.TbBusiness;
 import com.pj.project.tb_business.TbBusinessService;
@@ -200,9 +201,12 @@ public class TbBusinessItemService extends ServiceImpl<TbBusinessItemMapper, TbB
             return AjaxJson.getError("您慢了一步,其他用户已接单");
         }
         TbCostomer tbCostomer = tbCostomerService.getById(customerId);
+        SpAdmin currAdmin = StpUserUtil.getAdmin();
+        String adminName = StrUtil.isNotEmpty(currAdmin.getNickname()) ? currAdmin.getNickname():currAdmin.getName();
         tbBusinessItem.setPick(1).setPickTime(new Date())
                 .setPickCustomerId(tbCostomer.getId())
-                .setPickCustomerName(tbCostomer.getName());
+                .setPickCustomerName(tbCostomer.getName())
+                .setPickBy(adminName).setPickByAdminId(currAdmin.getId()+"");
         this.updateById(tbBusinessItem);
         //todo 通知录入人员 已接单
         List<SpAdmin> spAdminList = spAdminService.findByCustomerId(UserTypeEnum.PLATFORM_ADMIN.getCustomerId());

+ 188 - 66
sp-server/src/main/java/com/pj/project/tb_fee_details/TbFeeDetailsService.java

@@ -1,12 +1,22 @@
 package com.pj.project.tb_fee_details;
 
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.math.BigDecimal;
+import java.util.*;
+import java.util.stream.Collectors;
+
 import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.util.StrUtil;
 import cn.hutool.json.JSONUtil;
 import com.alibaba.excel.EasyExcel;
 import com.alibaba.excel.ExcelWriter;
+import com.alibaba.excel.util.ListUtils;
 import com.alibaba.excel.write.metadata.WriteSheet;
 import com.alibaba.excel.write.metadata.fill.FillConfig;
+import com.alibaba.excel.write.metadata.style.WriteCellStyle;
+import com.alibaba.excel.write.style.HorizontalCellStyleStrategy;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -39,6 +49,7 @@ import com.pj.project4sp.role.SpRoleMapper;
 import com.pj.project4sp.uploadfile.UploadUtil;
 import com.pj.utils.so.SoMap;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.poi.ss.usermodel.BorderStyle;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Lazy;
 import org.springframework.core.io.ClassPathResource;
@@ -170,7 +181,7 @@ public class TbFeeDetailsService extends ServiceImpl<TbFeeDetailsMapper, TbFeeDe
         return list(qw);
     }
 
-    public TbFeeDetails findBuCarIdAndCarNoAndFeeTypeAndItemTypeName(String businessCarId, String carNo, Integer feeType, String itemTypeName) {
+    public TbFeeDetails findBuCarIdAndCarNoAndFeeTypeAndItemTypeName(String businessCarId, String carNo, Integer feeType, String itemTypeName){
         QueryWrapper<TbFeeDetails> qw = new QueryWrapper<>();
         qw.eq("business_car_id", businessCarId);
         qw.eq("car_no", carNo);
@@ -201,12 +212,12 @@ public class TbFeeDetailsService extends ServiceImpl<TbFeeDetailsMapper, TbFeeDe
             //不是当前日期,当前放行记录的车辆在之前的日期付的钱
             BigDecimal notToDayMoney = new BigDecimal(0);
             for (TbFeeDetails d : thisCarAllFeeList) {
-                if (!StrUtil.equals(payDay, d.getPayDay())) {
+                if(!StrUtil.equals(payDay, d.getPayDay())){
                     notToDayMoney = notToDayMoney.add(d.getItemPrice());
                 }
             }
             //当前日期付的钱 = 改放行记录总的停车费-之前日前的钱
-            BigDecimal thisDayMoney = car.getMoney().subtract(notToDayMoney);
+            BigDecimal thisDayMoney  = car.getMoney().subtract(notToDayMoney);
 
             //oldFeeList是当前日期的白天停车和夜间停车明细
             List<TbFeeDetails> oldFeeList = getByBusinessCarIdAndCarNoAndFeeTypeAndPayDay(car.getId(), car.getCarNo(), TbFeeDetails.fee.PARK_FEE.getCode(), payDay);
@@ -215,14 +226,14 @@ public class TbFeeDetailsService extends ServiceImpl<TbFeeDetailsMapper, TbFeeDe
             String transactionIdStr = "";
             String outTradeNoStr = "";
             for (TbFeeDetails oldFee : oldFeeList) {
-                if (!StrUtil.isEmpty(oldFee.getTransactionId())) {
+                if(!StrUtil.isEmpty(oldFee.getTransactionId())){
                     transactionIdStr = oldFee.getTransactionId();
                     outTradeNoStr = oldFee.getOutTradeNo();
                 }
-                if (StrUtil.equals(oldFee.getItemTypeName(), "白天停车")) {
+                if(StrUtil.equals(oldFee.getItemTypeName(), "白天停车")){
                     dayParkFee = oldFee;
                 }
-                if (StrUtil.equals(oldFee.getItemTypeName(), "夜间停车")) {
+                if(StrUtil.equals(oldFee.getItemTypeName(), "夜间停车")){
                     nightParkFee = oldFee;
                 }
             }
@@ -231,16 +242,16 @@ public class TbFeeDetailsService extends ServiceImpl<TbFeeDetailsMapper, TbFeeDe
             BigDecimal baseNightPrice = partConfig.getBasePrice().add(partConfig.getExtraPrice());
             BigDecimal[] qr = thisDayMoney.divideAndRemainder(baseNightPrice);//商和余数的数组,商为夜间停车次数,余数为白天停车费用。
             BigDecimal nightFeeNum = qr[0];
-            if (nightFeeNum.compareTo(BigDecimal.valueOf(0)) > 0) {
-                nightParkFee.setNum(nightFeeNum.intValue()).setItemTypeName("夜间停车")
-                        .setUnitPrice(baseNightPrice).setItemPrice(baseNightPrice.multiply(nightFeeNum));
-                setFee(nightParkFee, car, transactionIdStr, outTradeNoStr, now);
-                saveOrUpdate(nightParkFee);
-                if (qr[1].compareTo(BigDecimal.valueOf(0)) == 0 && dayParkFee.getId() != null) {
-                    delete(Long.valueOf(dayParkFee.getId()));
-                }
+            if(nightFeeNum.compareTo(BigDecimal.valueOf(0)) > 0){
+                    nightParkFee.setNum(nightFeeNum.intValue()).setItemTypeName("夜间停车")
+                            .setUnitPrice(baseNightPrice).setItemPrice(baseNightPrice.multiply(nightFeeNum));
+                    setFee(nightParkFee, car, transactionIdStr, outTradeNoStr, now);
+                    saveOrUpdate(nightParkFee);
+                    if(qr[1].compareTo(BigDecimal.valueOf(0)) == 0 && dayParkFee.getId() != null){
+                        delete(Long.valueOf(dayParkFee.getId()));
+                    }
             }
-            if (qr[1].compareTo(BigDecimal.valueOf(0)) > 0) {
+            if(qr[1].compareTo(BigDecimal.valueOf(0)) > 0){
                 dayParkFee.setNum(1).setItemTypeName("白天停车").setUnitPrice(qr[1]).setItemPrice(qr[1]);
                 setFee(dayParkFee, car, transactionIdStr, outTradeNoStr, now);
                 saveOrUpdate(dayParkFee);
@@ -249,11 +260,11 @@ public class TbFeeDetailsService extends ServiceImpl<TbFeeDetailsMapper, TbFeeDe
         }
     }
 
-    private void setFee(TbFeeDetails parkFee, TbBusinessCar car, String transactionId, String outTradeNo, Date now) {
+    private void setFee(TbFeeDetails parkFee, TbBusinessCar car, String transactionId, String outTradeNo, Date now){
         String nowStr = DateUtil.format(now, "yyyy-MM-dd HH:mm:ss");
         String toDay = DateUtil.format(now, "yyyy-MM-dd");
         parkFee.setTaxRate(partConfig.getTaxRate());
-        BigDecimal taxPrice = parkFee.getItemPrice().divide(BigDecimal.valueOf(1).add(parkFee.getTaxRate()), 2, BigDecimal.ROUND_HALF_UP).multiply(parkFee.getTaxRate());
+        BigDecimal taxPrice = parkFee.getItemPrice().divide(BigDecimal.valueOf(1).add(parkFee.getTaxRate()),2, BigDecimal.ROUND_HALF_UP).multiply(parkFee.getTaxRate());
         taxPrice = taxPrice.setScale(2, BigDecimal.ROUND_HALF_UP);
         BigDecimal noTaxPrice = parkFee.getItemPrice().subtract(taxPrice);
         noTaxPrice = noTaxPrice.setScale(2, BigDecimal.ROUND_HALF_UP);
@@ -265,14 +276,13 @@ public class TbFeeDetailsService extends ServiceImpl<TbFeeDetailsMapper, TbFeeDe
                 .setIsSettle(1).setPayMode(1).setPayTime(nowStr)
                 .setTransactionId(transactionId).setOutTradeNo(outTradeNo)
                 .setBusinessCarNo(car.getNo());
-        if (StrUtil.isNotEmpty(car.getCustomerId())) {
+        if(StrUtil.isNotEmpty(car.getCustomerId())){
             TbCostomer costomer = tbCostomerService.getById(car.getCustomerId());
-            if (costomer != null) {
+            if(costomer != null){
                 parkFee.setCustomerName(costomer.getName());
             }
         }
     }
-
     public void chargeBusinessFee(List<TbBusinessItem> items, String transactionId, String outTradeNo, Date now) {
 
         String nowStr = DateUtil.format(now, "yyyy-MM-dd HH:mm:ss");
@@ -346,7 +356,7 @@ public class TbFeeDetailsService extends ServiceImpl<TbFeeDetailsMapper, TbFeeDe
         }
     }
 
-    public String export(SoMap so) throws Exception {
+    /*public String export(SoMap so) throws Exception{
         Date now = new Date();
         String nowStr = DateUtil.format(now, "yyyy-MM-dd HH:mm");
         String beginTime = so.getString("beginTime");
@@ -359,7 +369,7 @@ public class TbFeeDetailsService extends ServiceImpl<TbFeeDetailsMapper, TbFeeDe
         String outPayCarNum = "";
         String notOutCarNum = "";
         boolean isIn = checkTimeRange(beginTime, endTime, now);
-        if (isIn) {
+        if(isIn){
             inCarNum = getInCarNum(now) + "";
             outPayCarNum = getOutAndPayCarNum(now) + "";
             notOutCarNum = getNotOutCarNum(now) + "";
@@ -373,7 +383,7 @@ public class TbFeeDetailsService extends ServiceImpl<TbFeeDetailsMapper, TbFeeDe
         BigDecimal allParkFee = new BigDecimal(0);
         BigDecimal allDayTaxes = new BigDecimal(0);
         BigDecimal allDayNoTaxFee = new BigDecimal(0);
-        List<ExportFeeDetailDTO> exportList = new ArrayList<>();
+	    List<ExportFeeDetailDTO> exportList = new ArrayList<>();
         List<TbFeeDetails> list = this.getList(so);
         Integer index = 1;
         for (TbFeeDetails feeDetails : list) {
@@ -393,16 +403,16 @@ public class TbFeeDetailsService extends ServiceImpl<TbFeeDetailsMapper, TbFeeDe
                     .setKaiDanPerson(feeDetails.getKaiDanPerson())
                     .setJiChaPerson(feeDetails.getJiChaPerson())
                     .setDiaoDuPerson(feeDetails.getDiaoDuPerson());
-            if (!StrUtil.isEmpty(feeDetails.getBusinessId())) {
+            if(!StrUtil.isEmpty(feeDetails.getBusinessId())){
                 detailDTO.setBusinessNo(feeDetails.getBusinessNo());
-            } else {
+            }else {
                 detailDTO.setBusinessNo(feeDetails.getBusinessCarNo());
             }
             exportList.add(detailDTO);
-            if (checkTimeRange(nowStr, nowStr, feeDetails.getCreateTime()) && feeDetails.getFeeType() == TbFeeDetails.fee.PARK_FEE.getCode()) {
+            if(checkTimeRange(nowStr, nowStr, feeDetails.getCreateTime()) && feeDetails.getFeeType()==TbFeeDetails.fee.PARK_FEE.getCode()){
                 toDayFee = toDayFee.add(feeDetails.getItemPrice());
             }
-            if (feeDetails.getFeeType() == TbFeeDetails.fee.PARK_FEE.getCode()) {
+            if(feeDetails.getFeeType()==TbFeeDetails.fee.PARK_FEE.getCode()){
                 allParkFee = allParkFee.add(feeDetails.getItemPrice());
             }
             allDayFee = allDayFee.add(feeDetails.getItemPrice());
@@ -429,7 +439,7 @@ public class TbFeeDetailsService extends ServiceImpl<TbFeeDetailsMapper, TbFeeDe
         }
 
         ClassPathResource classPathResource = new ClassPathResource("static/day-fee-new.xlsx");
-        InputStream tempInputStream = classPathResource.getInputStream();
+        InputStream tempInputStream =classPathResource.getInputStream();
 
         ExcelWriter excelWriter = EasyExcel.write(savePath + fileName, ExportFeeDetailDTO.class)
                 .withTemplate(tempInputStream).build();
@@ -439,6 +449,119 @@ public class TbFeeDetailsService extends ServiceImpl<TbFeeDetailsMapper, TbFeeDe
         excelWriter.fill(exportList, fillConfig, writeSheet);
         excelWriter.finish();
         return prefix + "/feeDetails/" + today + "/收费明细表_" + time + ".xlsx";
+    }*/
+
+    public String export(SoMap so) {
+        Date now = new Date();
+        String nowStr = DateUtil.format(now, "yyyy-MM-dd HH:mm");
+        String beginTime = so.getString("beginTime");
+        String endTime = so.getString("endTime");
+        String time = beginTime + "至" + endTime;
+        Map<String, String> head = new HashMap<>();
+        head.put("time", time);
+        head.put("exportTime", nowStr);
+
+        BigDecimal allDayFee = new BigDecimal(0);
+        BigDecimal allDayTaxes = new BigDecimal(0);
+        BigDecimal allDayNoTaxFee = new BigDecimal(0);
+        List<ExportFeeDetailDTO> exportList = new ArrayList<>();
+        List<TbFeeDetails> list = this.getList(so);
+        Integer index = 1;
+        for (TbFeeDetails feeDetails : list) {
+            String feeType = TbFeeDetails.fee.getDesc(feeDetails.getFeeType());
+            ExportFeeDetailDTO detailDTO = new ExportFeeDetailDTO();
+            detailDTO.setBusinessNo(feeDetails.getBusinessNo()).setCarNo(feeDetails.getCarNo())
+                    .setFeeType(feeType).setItemTypeName(feeDetails.getItemTypeName())
+                    .setItemName(feeDetails.getItemName()).setItemPrice(feeDetails.getItemPrice())
+                    .setPayType("微信支付").setIndex(index++)
+                    .setPayMode("直接收款")
+                    .setWeight(feeDetails.getWeight()).setNum(feeDetails.getNum()).setUnitPrice(feeDetails.getUnitPrice())
+                    .setSettle("已结算").setTaxRate(feeDetails.getTaxRate().multiply(new BigDecimal(100)))
+                    .setTaxPrice(feeDetails.getTaxPrice()).setNoTaxPrice(feeDetails.getNoTaxPrice()).setPayTime(feeDetails.getPayTime())
+                    .setPickCustomerName(feeDetails.getPickCustomerName())
+                    .setTransactionId(feeDetails.getTransactionId())
+                    .setKaiDanPerson(feeDetails.getKaiDanPerson())
+                    .setJiChaPerson(feeDetails.getJiChaPerson())
+                    .setDiaoDuPerson(feeDetails.getDiaoDuPerson());
+            if(!StrUtil.isEmpty(feeDetails.getBusinessId())){
+                detailDTO.setBusinessNo(feeDetails.getBusinessNo());
+            }else {
+                detailDTO.setBusinessNo(feeDetails.getBusinessCarNo());
+            }
+            exportList.add(detailDTO);
+            allDayFee = allDayFee.add(feeDetails.getItemPrice());
+            allDayTaxes = allDayTaxes.add(feeDetails.getTaxPrice());
+            allDayNoTaxFee = allDayNoTaxFee.add(feeDetails.getNoTaxPrice());
+        }
+
+
+        String separator = File.separator;
+        String today = DateUtil.today();
+        String rootPath = UploadUtil.uploadConfig.rootFolder + separator + UploadUtil.uploadConfig.httpPrefix;
+        String prefix = myConfig.getDomain() + UploadUtil.uploadConfig.httpPrefix;
+        String extPath = "feeDetails" + separator + today + separator;
+        String fileName = "收费明细表_" + time + ".xlsx";
+        String savePath = rootPath + separator + extPath;
+        File saveFIle = new File(savePath);
+        if (!saveFIle.exists()) {
+            saveFIle.mkdirs();
+        }
+
+        ClassPathResource classPathResource = new ClassPathResource("static/day-fee-new.xlsx");
+        //InputStream tempInputStream =classPathResource.getInputStream();
+        WriteCellStyle contentWriteCellStyle = new WriteCellStyle();
+        contentWriteCellStyle.setBorderLeft(BorderStyle.THIN);
+        contentWriteCellStyle.setBorderTop(BorderStyle.THIN);
+        contentWriteCellStyle.setBorderRight(BorderStyle.THIN);
+        contentWriteCellStyle.setBorderBottom(BorderStyle.THIN);
+        HorizontalCellStyleStrategy horizontalCellStyleStrategy = new HorizontalCellStyleStrategy(
+                contentWriteCellStyle,contentWriteCellStyle);
+        ExcelWriter excelWriter = null;
+        try {
+            excelWriter = EasyExcel.write(savePath + fileName, ExportFeeDetailDTO.class)
+                    .registerWriteHandler(horizontalCellStyleStrategy)
+                    .withTemplate(classPathResource.getInputStream()).build();
+            WriteSheet writeSheet = EasyExcel.writerSheet().build();
+            // FillConfig fillConfig = FillConfig.builder().forceNewRow(true).build();//换行
+            excelWriter.fill(exportList, writeSheet);
+            excelWriter.fill(head, writeSheet);
+            List<List<String>> totalListList = ListUtils.newArrayList();//动态添加行集合
+            List<String> totalList2 = ListUtils.newArrayList();//倒数第2行
+            List<String> totalList1 = ListUtils.newArrayList();//倒数第1行
+            totalListList.add(totalList2);
+            totalListList.add(totalList1);
+            for (int i=0;i<22;i++){
+                if(i==0){
+                    totalList2.add("合计");
+                }else if(i==8){
+                    totalList2.add(allDayFee.toString());
+                }else if(i==11){
+                    totalList2.add(allDayTaxes.toString());
+                }else if(i==12){
+                    totalList2.add(allDayNoTaxFee.toString());
+                }else {
+                    totalList2.add(null);
+                }
+                if(i==2){
+                    totalList1.add("收费核对员:");
+                }else if(i==10){
+                    totalList1.add("收费统计员:");
+                }else if(i==18){
+                    totalList1.add("收费员:");
+                }else {
+                    totalList1.add(null);
+                }
+            }
+            excelWriter.write(totalListList, writeSheet);
+        } catch (IOException e) {
+            e.printStackTrace();
+        }finally {
+            if(excelWriter!=null){
+                excelWriter.finish();
+            }
+        }
+
+        return prefix + "/feeDetails/" + today + "/收费明细表_" + time + ".xlsx";
     }
 
     private boolean checkTimeRange(String begin, String end, Date now) {
@@ -461,7 +584,7 @@ public class TbFeeDetailsService extends ServiceImpl<TbFeeDetailsMapper, TbFeeDe
         return list != null ? list.size() : 0;
     }
 
-    private Integer getOutAndPayCarNum(Date now) {
+    private Integer getOutAndPayCarNum(Date now){
         Date beginOfDay = DateUtil.beginOfDay(now);
         Date endOfDay = DateUtil.endOfDay(now);
         QueryWrapper<TbBusinessCar> qw = new QueryWrapper();
@@ -473,7 +596,7 @@ public class TbFeeDetailsService extends ServiceImpl<TbFeeDetailsMapper, TbFeeDe
         return list != null ? list.size() : 0;
     }
 
-    private Integer getNotOutCarNum(Date now) {
+    private Integer getNotOutCarNum(Date now){
         Date beginOfDay = DateUtil.beginOfDay(now);
         Date endOfDay = DateUtil.endOfDay(now);
         QueryWrapper<TbBusinessCar> qw = new QueryWrapper();
@@ -486,9 +609,9 @@ public class TbFeeDetailsService extends ServiceImpl<TbFeeDetailsMapper, TbFeeDe
     }
 
     public List<TbFeeDetails> findByBusinessCarId(String businessCarId, int feeType) {
-        QueryWrapper<TbFeeDetails> ew = new QueryWrapper<>();
-        ew.eq("business_car_id", businessCarId);
-        ew.eq("fee_type", feeType);
+        QueryWrapper<TbFeeDetails>ew=new QueryWrapper<>();
+        ew.eq("business_car_id",businessCarId);
+        ew.eq("fee_type",feeType);
         return list(ew);
     }
 
@@ -522,12 +645,12 @@ public class TbFeeDetailsService extends ServiceImpl<TbFeeDetailsMapper, TbFeeDe
                     .setTaxPrice(feeDetails.getTaxPrice()).setNoTaxPrice(feeDetails.getNoTaxPrice()).setPayTime(feeDetails.getPayTime())
                     .setPickCustomerName(feeDetails.getPickCustomerName())
                     .setCustomerName(feeDetails.getCustomerName())
-                    .setKaiDanPerson(feeDetails.getKaiDanPerson() != null ? feeDetails.getKaiDanPerson() : "")
-                    .setJiChaPerson(feeDetails.getJiChaPerson() != null ? feeDetails.getJiChaPerson() : "")
-                    .setDiaoDuPerson(feeDetails.getDiaoDuPerson() != null ? feeDetails.getDiaoDuPerson() : "");
-            if (!StrUtil.isEmpty(feeDetails.getBusinessId())) {
+                    .setKaiDanPerson(feeDetails.getKaiDanPerson()!=null?feeDetails.getKaiDanPerson():"")
+                    .setJiChaPerson(feeDetails.getJiChaPerson()!=null?feeDetails.getJiChaPerson():"")
+                    .setDiaoDuPerson(feeDetails.getDiaoDuPerson()!=null?feeDetails.getDiaoDuPerson():"");
+            if(!StrUtil.isEmpty(feeDetails.getBusinessId())){
                 detailDTO.setBusinessNo(feeDetails.getBusinessNo());
-            } else {
+            }else {
                 detailDTO.setBusinessNo(feeDetails.getBusinessCarNo());
             }
             printList.add(detailDTO);
@@ -543,20 +666,20 @@ public class TbFeeDetailsService extends ServiceImpl<TbFeeDetailsMapper, TbFeeDe
     }
 
     public List<FeeTypeStatics> getFeeTypeStatics(String startDay, String endDay) {
-        List<FeeTypeStatics> list = tbFeeDetailsMapper.getFeeTypeStatics(startDay, endDay);
-        Double totalPrice = list.stream().collect(Collectors.summarizingDouble(FeeTypeStatics::getPrice)).getSum();
-        Long total = list.stream().collect(Collectors.summarizingLong(FeeTypeStatics::getTotal)).getSum();
-        FeeTypeStatics feeTypeStatics = new FeeTypeStatics();
+        List<FeeTypeStatics> list=tbFeeDetailsMapper.getFeeTypeStatics(startDay,endDay);
+       Double totalPrice= list.stream().collect(Collectors.summarizingDouble(FeeTypeStatics::getPrice)).getSum();
+       Long total= list.stream().collect(Collectors.summarizingLong(FeeTypeStatics::getTotal)).getSum();
+        FeeTypeStatics feeTypeStatics=new FeeTypeStatics();
         feeTypeStatics.setName("总计").setPrice(totalPrice).setTotal(total);
         list.add(feeTypeStatics);
         return list;
     }
 
     public List<FeeTypeStatics> itemTypeStatics(String startDay, String endDay) {
-        List<FeeTypeStatics> list = tbFeeDetailsMapper.itemTypeStatics(startDay, endDay);
-        Double totalPrice = list.stream().collect(Collectors.summarizingDouble(FeeTypeStatics::getPrice)).getSum();
-        Long total = list.stream().collect(Collectors.summarizingLong(FeeTypeStatics::getTotal)).getSum();
-        FeeTypeStatics feeTypeStatics = new FeeTypeStatics();
+        List<FeeTypeStatics> list=tbFeeDetailsMapper.itemTypeStatics(startDay,endDay);
+        Double totalPrice= list.stream().collect(Collectors.summarizingDouble(FeeTypeStatics::getPrice)).getSum();
+        Long total= list.stream().collect(Collectors.summarizingLong(FeeTypeStatics::getTotal)).getSum();
+        FeeTypeStatics feeTypeStatics=new FeeTypeStatics();
         feeTypeStatics.setName("总计").setPrice(totalPrice).setTotal(total);
         list.add(feeTypeStatics);
         return list;
@@ -565,14 +688,14 @@ public class TbFeeDetailsService extends ServiceImpl<TbFeeDetailsMapper, TbFeeDe
     public void jiChaConfirm(List<Long> ids) {
         SpAdmin admin = StpUserUtil.getAdmin();
         SpRole role = spRoleMapper.getById(Long.valueOf(admin.getRoleId()));
-        if (!StrUtil.equals(TbFeeDetails.personEnum.JICHA.getDesc(), role.getName()) && !StrUtil.equals("admin", role.getType())) {
+        if(!StrUtil.equals(TbFeeDetails.personEnum.JICHA.getDesc(), role.getName()) && !StrUtil.equals("admin", role.getType())){
             throw new BusinessException("无操作权限");
         }
         List<TbFeeDetails> detailsList = this.listByIds(ids);
         Set<String> days = new HashSet<>();
         for (TbFeeDetails detail : detailsList) {
             String name = admin.getName();
-            if (StrUtil.isNotEmpty(admin.getNickname())) {
+            if(StrUtil.isNotEmpty(admin.getNickname())){
                 name = admin.getNickname();
             }
             detail.setJiChaPerson(name).setUpdateTime(new Date());
@@ -586,14 +709,14 @@ public class TbFeeDetailsService extends ServiceImpl<TbFeeDetailsMapper, TbFeeDe
     public void kaiDanConfirm(List<Long> ids) {
         SpAdmin admin = StpUserUtil.getAdmin();
         SpRole role = spRoleMapper.getById(Long.valueOf(admin.getRoleId()));
-        if (!StrUtil.equals(TbFeeDetails.personEnum.KAIDAN.getDesc(), role.getName()) && !StrUtil.equals("admin", role.getType())) {
+        if(!StrUtil.equals(TbFeeDetails.personEnum.KAIDAN.getDesc(), role.getName()) && !StrUtil.equals("admin", role.getType())){
             throw new BusinessException("无操作权限");
         }
         List<TbFeeDetails> detailsList = this.listByIds(ids);
         Set<String> days = new HashSet<>();
         for (TbFeeDetails detail : detailsList) {
             String name = admin.getName();
-            if (StrUtil.isNotEmpty(admin.getNickname())) {
+            if(StrUtil.isNotEmpty(admin.getNickname())){
                 name = admin.getNickname();
             }
             detail.setKaiDanPerson(name).setUpdateTime(new Date());
@@ -607,14 +730,14 @@ public class TbFeeDetailsService extends ServiceImpl<TbFeeDetailsMapper, TbFeeDe
     public void diaoDuConfirm(List<Long> ids) {
         SpAdmin admin = StpUserUtil.getAdmin();
         SpRole role = spRoleMapper.getById(Long.valueOf(admin.getRoleId()));
-        if (!StrUtil.equals(TbFeeDetails.personEnum.FUHE.getDesc(), role.getName()) && !StrUtil.equals("admin", role.getType())) {
+        if(!StrUtil.equals(TbFeeDetails.personEnum.FUHE.getDesc(), role.getName()) && !StrUtil.equals("admin", role.getType())){
             throw new BusinessException("无操作权限");
         }
         List<TbFeeDetails> detailsList = this.listByIds(ids);
         Set<String> days = new HashSet<>();
         for (TbFeeDetails detail : detailsList) {
             String name = admin.getName();
-            if (StrUtil.isNotEmpty(admin.getNickname())) {
+            if(StrUtil.isNotEmpty(admin.getNickname())){
                 name = admin.getNickname();
             }
             detail.setDiaoDuPerson(name).setUpdateTime(new Date());
@@ -627,11 +750,11 @@ public class TbFeeDetailsService extends ServiceImpl<TbFeeDetailsMapper, TbFeeDe
 
     private void changeStats(Set<String> days, String personType) {
         String personColumn = "";
-        if (StrUtil.equals(personType, TbFeeDetails.personEnum.JICHA.getDesc())) {
+        if(StrUtil.equals(personType, TbFeeDetails.personEnum.JICHA.getDesc())){
             personColumn = "ji_cha_person";
-        } else if (StrUtil.equals(personType, TbFeeDetails.personEnum.KAIDAN.getDesc())) {
+        }else if(StrUtil.equals(personType, TbFeeDetails.personEnum.KAIDAN.getDesc())){
             personColumn = "kai_dan_person";
-        } else {
+        }else{
             personColumn = "diao_du_person";
         }
         for (String day : days) {
@@ -653,20 +776,20 @@ public class TbFeeDetailsService extends ServiceImpl<TbFeeDetailsMapper, TbFeeDe
                     }
                 }
                 String personName = StrUtil.join(",", names);
-                QueryWrapper<TbFeeStatistics> ew3 = new QueryWrapper<>();
+                QueryWrapper<TbFeeStatistics> ew3= new QueryWrapper<>();
                 ew3.eq("day_time", day);
                 List<TbFeeStatistics> statsList = tbFeeStatisticsService.list(ew3);
                 for (TbFeeStatistics thisDayStats : statsList) {
-                    if (StrUtil.equals(personType, TbFeeDetails.personEnum.JICHA.getDesc())) {
+                    if(StrUtil.equals(personType, TbFeeDetails.personEnum.JICHA.getDesc())){
                         thisDayStats.setJiChaPerson(personName);
-                    } else if (StrUtil.equals(personType, TbFeeDetails.personEnum.KAIDAN.getDesc())) {
+                    }else if(StrUtil.equals(personType, TbFeeDetails.personEnum.KAIDAN.getDesc())){
                         thisDayStats.setKaiDanPerson(personName);
-                    } else {
+                    }else{
                         thisDayStats.setDiaoDuPerson(personName);
                     }
                 }
                 tbFeeStatisticsService.updateBatchById(statsList);
-            } else {
+            }else{
                 continue;
             }
         }
@@ -675,7 +798,7 @@ public class TbFeeDetailsService extends ServiceImpl<TbFeeDetailsMapper, TbFeeDe
     public void jiChaCancel(List<Long> ids) {
         SpAdmin admin = StpUserUtil.getAdmin();
         SpRole role = spRoleMapper.getById(Long.valueOf(admin.getRoleId()));
-        if (!StrUtil.equals(TbFeeDetails.personEnum.JICHA.getDesc(), role.getName()) && !StrUtil.equals("admin", role.getType())) {
+        if(!StrUtil.equals(TbFeeDetails.personEnum.JICHA.getDesc(), role.getName()) && !StrUtil.equals("admin", role.getType())){
             throw new BusinessException("该操作需要统计稽查员的权限");
         }
         List<TbFeeDetails> detailsList = this.listByIds(ids);
@@ -688,10 +811,9 @@ public class TbFeeDetailsService extends ServiceImpl<TbFeeDetailsMapper, TbFeeDe
         this.updateBatchById(detailsList);
         changeStats(days);
     }
-
     private void changeStats(Set<String> days) {
         for (String day : days) {
-            QueryWrapper<TbFeeStatistics> ew3 = new QueryWrapper<>();
+            QueryWrapper<TbFeeStatistics> ew3= new QueryWrapper<>();
             ew3.eq("day_time", day);
             List<TbFeeStatistics> statsList = tbFeeStatisticsService.list(ew3);
             for (TbFeeStatistics thisDayStats : statsList) {
@@ -707,9 +829,9 @@ public class TbFeeDetailsService extends ServiceImpl<TbFeeDetailsMapper, TbFeeDe
     }
 
     public List<TbFeeDetails> findByBusinessNo(String businessNo) {
-        QueryWrapper<TbFeeDetails> ew = new QueryWrapper<>();
-        ew.eq("business_no", businessNo);
-        return list(ew);
+        QueryWrapper<TbFeeDetails>ew=new QueryWrapper<>();
+        ew.eq("business_no",businessNo);
+       return list(ew);
     }
 
     public List<TbFeeStatistics> getDayStatistics(String toDay) {

+ 63 - 55
sp-server/src/main/java/com/pj/project/tb_invoice_info/TbInvoiceInfo.java

@@ -1,22 +1,22 @@
 package com.pj.project.tb_invoice_info;
 
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableName;
+import com.pj.project.tb_entity.TbEntity;
 import com.pj.project.tb_fee_details.TbFeeDetails;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
 
-import java.io.Serializable;
-import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-
 /**
  * Model: tb_invoice_info -- 开票信息表
- *
- * @author lzm
+ * @author lzm 
  */
 @Data
 @Accessors(chain = true)
@@ -24,47 +24,47 @@ import java.util.List;
 @EqualsAndHashCode(callSuper = false)
 public class TbInvoiceInfo implements Serializable {
 
-    // ---------- 模块常量 ----------
-    /**
-     * 序列化版本id
-     */
-    private static final long serialVersionUID = 1L;
-    /**
-     * 此模块对应的表名
-     */
-    public static final String TABLE_NAME = "tb_invoice_info";
-    /**
-     * 此模块对应的权限码
-     */
-    public static final String PERMISSION_CODE = "tb-invoice-info-list";
-
-
-    // ---------- 表中字段 ----------
-    /**
-     * 主键
-     */
+	// ---------- 模块常量 ----------
+	/**
+	 * 序列化版本id 
+	 */
+	private static final long serialVersionUID = 1L;	
+	/**
+	 * 此模块对应的表名 
+	 */
+	public static final String TABLE_NAME = "tb_invoice_info";	
+	/**
+	 * 此模块对应的权限码 
+	 */
+	public static final String PERMISSION_CODE = "tb-invoice-info-list";
+
+
+	// ---------- 表中字段 ----------
+	/**
+	 * 主键 
+	 */
     private String id;
 
     private String no;
 
-    /**
-     * 客户id
-     */
-    public String customerId;
+	/**
+	 * 客户id 
+	 */
+	public String customerId;
 
-    /**
-     * 客户名称
-     */
+	/**
+	 * 客户名称 
+	 */
     private String customerName;
 
-    /**
-     * 账单金额
-     */
+	/**
+	 * 账单金额 
+	 */
     private BigDecimal totalMoney;
 
-    /**
-     * 支付状态(0=未开票,1=已开票)
-     */
+	/**
+	 * 支付状态(0=未开票,1=已开票) 
+	 */
     private Integer status;
 
     /**
@@ -72,32 +72,34 @@ public class TbInvoiceInfo implements Serializable {
      */
     private String isElec;
 
-    /**
-     * 开票时间
-     */
+	/**
+	 * 开票时间 
+	 */
     private Date invoiceTime;
 
-    /**
-     * 发票号
-     */
+	/**
+	 * 发票号 
+	 */
     private String invoiceNo;
 
-    /**
-     * 主体id
-     */
-    private String entityId;
+	/**
+	 * 主体id 
+	 */
+    private String  entityId;
 
 
-    /**
-     * 创建时间
-     */
-    private Date createTime;
+	/**
+	 * 创建时间 
+	 */
+	private Date createTime;
+	private String updateBy;
+	private Date updateTime;
 
 
     /**
      * 主体名称
      */
-    private String entityName;
+    private String  entityName;
 
     /**
      * 税号
@@ -133,4 +135,10 @@ public class TbInvoiceInfo implements Serializable {
     private List<TbFeeDetails> feeDetails = new ArrayList<>();
 
 
+
+
+
+	
+
+
 }

+ 87 - 105
sp-server/src/main/java/com/pj/project/tb_invoice_info/TbInvoiceInfoController.java

@@ -1,129 +1,131 @@
 package com.pj.project.tb_invoice_info;
 
+import java.util.Date;
+import java.util.List;
+
 import cn.dev33.satoken.annotation.SaCheckPermission;
 import cn.hutool.core.util.StrUtil;
 import com.pj.constants.UserTypeEnum;
-import com.pj.current.satoken.StpUserUtil;
+import com.pj.project.tb_fee_details.TbFeeDetails;
 import com.pj.project.tb_invoice_info.dto.FeeDeatilsGroup;
-import com.pj.project4sp.SP;
-import com.pj.utils.sg.AjaxError;
-import com.pj.utils.sg.AjaxJson;
 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.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
-import java.util.List;
+import com.pj.utils.sg.*;
+import com.pj.project4sp.SP;
+
+import com.pj.current.satoken.StpUserUtil;
+import cn.dev33.satoken.annotation.SaCheckPermission;
 
 
 /**
  * Controller: tb_invoice_info -- 开票信息表
- *
- * @author lzm
+ * @author lzm 
  */
 @RestController
 @RequestMapping("/TbInvoiceInfo/")
 public class TbInvoiceInfoController {
 
-    /**
-     * 底层 Service 对象
-     */
-    @Autowired
-    TbInvoiceInfoService tbInvoiceInfoService;
-
-    /**
-     * 增
-     */
-    @RequestMapping("add")
-    @SaCheckPermission(TbInvoiceInfo.PERMISSION_CODE)
-    @Transactional(rollbackFor = Exception.class)
-    public AjaxJson add(TbInvoiceInfo t) {
-        tbInvoiceInfoService.add(t);
-        t = tbInvoiceInfoService.getById(SP.publicMapper.getPrimarykey());
-        return AjaxJson.getSuccessData(t);
-    }
-
-    /**
-     * 删
-     */
-    @RequestMapping("delete")
-    @SaCheckPermission(TbInvoiceInfo.PERMISSION_CODE)
-    public AjaxJson delete(Long id) {
-        int line = tbInvoiceInfoService.delete(id);
-        return AjaxJson.getByLine(line);
-    }
-
-    /**
-     * 删 - 根据id列表
-     */
-    @RequestMapping("deleteByIds")
-    @SaCheckPermission(TbInvoiceInfo.PERMISSION_CODE)
-    public AjaxJson deleteByIds() {
-        List<Long> ids = SoMap.getRequestSoMap().getListByComma("ids", long.class);
-        int line = SP.publicMapper.deleteByIds(TbInvoiceInfo.TABLE_NAME, ids);
-        return AjaxJson.getByLine(line);
-    }
-
-    /**
-     * 改
-     */
-    @RequestMapping("update")
-    @SaCheckPermission(TbInvoiceInfo.PERMISSION_CODE)
-    public AjaxJson update(TbInvoiceInfo t) {
-        int line = tbInvoiceInfoService.update(t);
-        return AjaxJson.getByLine(line);
-    }
-
-    /**
-     * 查 - 根据id
-     */
-    @RequestMapping("getById")
-    public AjaxJson getById(Long id) {
-        TbInvoiceInfo t = tbInvoiceInfoService.getById(id);
-        return AjaxJson.getSuccessData(t);
-    }
-
-    /**
-     * 查 - 根据id
-     */
+	/** 底层 Service 对象 */
+	@Autowired
+	TbInvoiceInfoService tbInvoiceInfoService;
+
+	/** 增 */  
+	@RequestMapping("add")
+	@SaCheckPermission(TbInvoiceInfo.PERMISSION_CODE)
+	@Transactional(rollbackFor = Exception.class)
+	public AjaxJson add(TbInvoiceInfo t){
+		tbInvoiceInfoService.add(t);
+		t = tbInvoiceInfoService.getById(SP.publicMapper.getPrimarykey());
+		return AjaxJson.getSuccessData(t);
+	}
+
+	/** 删 */  
+	@RequestMapping("delete")
+	@SaCheckPermission(TbInvoiceInfo.PERMISSION_CODE)
+	public AjaxJson delete(Long id){
+		int line = tbInvoiceInfoService.delete(id);
+		return AjaxJson.getByLine(line);
+	}
+	
+	/** 删 - 根据id列表 */  
+	@RequestMapping("deleteByIds")
+	@SaCheckPermission(TbInvoiceInfo.PERMISSION_CODE)
+	public AjaxJson deleteByIds(){
+		List<Long> ids = SoMap.getRequestSoMap().getListByComma("ids", long.class);
+		int line = SP.publicMapper.deleteByIds(TbInvoiceInfo.TABLE_NAME, ids);
+		return AjaxJson.getByLine(line);
+	}
+	
+	/** 改 */  
+	@RequestMapping("update")
+	@SaCheckPermission(TbInvoiceInfo.PERMISSION_CODE)
+	public AjaxJson update(TbInvoiceInfo t){
+		int line = tbInvoiceInfoService.update(t);
+		return AjaxJson.getByLine(line);
+	}
+
+	/** 查 - 根据id */  
+	@RequestMapping("getById")
+	public AjaxJson getById(Long id){
+		TbInvoiceInfo t = tbInvoiceInfoService.getById(id);
+		return AjaxJson.getSuccessData(t);
+	}
+
+    /** 查 - 根据id */
     @RequestMapping("getEntityById")
-    public AjaxJson getEntityById(Long id) {
+    public AjaxJson getEntityById(Long id){
         TbInvoiceInfo t = tbInvoiceInfoService.getEntityById(id);
         return AjaxJson.getSuccessData(t);
     }
 
-    /**
-     * 查集合 - 根据条件(参数为空时代表忽略指定条件)
-     */
-    @RequestMapping("getList")
-    public AjaxJson getList() {
-        SoMap so = SoMap.getRequestSoMap();
+	/** 查集合 - 根据条件(参数为空时代表忽略指定条件) */  
+	@RequestMapping("getList")
+	public AjaxJson getList() { 
+		SoMap so = SoMap.getRequestSoMap();
         String cusotmerId = StpUserUtil.getCustomerId();
         if (!StrUtil.equals(UserTypeEnum.PLATFORM_ADMIN.getCustomerId(), cusotmerId)) {
             so.put("customerId", cusotmerId);
         }
-        List<TbInvoiceInfo> list = tbInvoiceInfoService.getList(so.startPage());
-        return AjaxJson.getPageData(so.getDataCount(), list);
-    }
+		List<TbInvoiceInfo> list = tbInvoiceInfoService.getList(so.startPage());
+		return AjaxJson.getPageData(so.getDataCount(), list);
+	}
 
-    /**
-     * 生成信息
-     */
+    /** 生成信息 */
     @RequestMapping("generate")
     @Transactional(rollbackFor = Exception.class)
-    public AjaxJson generate() {
+    public AjaxJson generate(){
         SoMap so = SoMap.getRequestSoMap();
         tbInvoiceInfoService.generate(so);
         return AjaxJson.getSuccess();
     }
 
     /**
+     * 修改发票号
+     * @param id
+     * @param invoiceNo
+     * @return
+     */
+    @RequestMapping("updateInvoiceNo")
+    @Transactional(rollbackFor = Exception.class)
+    public AjaxJson updateInvoiceNo(@RequestParam Long id, @RequestParam String invoiceNo) {
+        TbInvoiceInfo tbInvoiceInfo = tbInvoiceInfoService.getById(id);
+        tbInvoiceInfo.setInvoiceNo(invoiceNo)
+                .setUpdateBy(StpUserUtil.getAdmin().getName())
+                .setUpdateTime(new Date());
+        tbInvoiceInfoService.updateById(tbInvoiceInfo);
+        return AjaxJson.getSuccess();
+    }
+
+
+    /**
      * 生成信息
      */
     @RequestMapping("complete")
     @Transactional(rollbackFor = Exception.class)
-    public AjaxJson complete() {
+    public AjaxJson complete(){
         SoMap so = SoMap.getRequestSoMap();
         tbInvoiceInfoService.complete(so);
         return AjaxJson.getSuccess();
@@ -139,24 +141,4 @@ public class TbInvoiceInfoController {
     }
 
 
-    // ------------------------- 前端接口 -------------------------
-
-
-    /**
-     * 改 - 不传不改 [G]
-     */
-    @RequestMapping("updateByNotNull")
-    public AjaxJson updateByNotNull(Long id) {
-        AjaxError.throwBy(true, "如需正常调用此接口,请删除此行代码");
-        // 鉴别身份,是否为数据创建者
-        long userId = SP.publicMapper.getColumnByIdToLong(TbInvoiceInfo.TABLE_NAME, "user_id", id);
-        AjaxError.throwBy(userId != StpUserUtil.getLoginIdAsLong(), "此数据您无权限修改");
-        // 开始修改 (请只保留需要修改的字段)
-        SoMap so = SoMap.getRequestSoMap();
-        so.clearNotIn("id", "customerId", "customerName", "totalMoney", "status", "invoiceTime", "invoiceNo", "entityId", "entityName", "taxIdNo", "address", "phone", "bank", "bankNo", "email", "createTime").clearNull().humpToLineCase();
-        int line = SP.publicMapper.updateBySoMapById(TbInvoiceInfo.TABLE_NAME, so, id);
-        return AjaxJson.getByLine(line);
-    }
-
-
 }

+ 23 - 0
sp-server/src/main/java/com/pj/project/tb_order/TbOrderService.java

@@ -85,4 +85,27 @@ public class TbOrderService extends ServiceImpl<TbOrderMapper, TbOrder> implemen
         ew.eq("order_status", "SUCCESS");
         return getOne(ew);
     }
+
+    /**
+     * 30秒内最新的一条
+     * @param attchStr
+     * @param orderTime
+     * @return
+     */
+    public TbOrder find30Seconds(String attchStr, String orderTime) {
+        QueryWrapper<TbOrder> ew = new QueryWrapper<>();
+        ew.lambda().eq(TbOrder::getAttach,attchStr).orderByDesc(TbOrder::getOrderTime);
+        ew.ge("date_format(order_time,'%Y-%m-%d %H:%i:%s')",orderTime);
+        List<TbOrder>list=list(ew);
+        return list.isEmpty()?null:list.get(0);
+    }
+
+    public TbOrder findSuccessOrder(String attchStr) {
+        QueryWrapper<TbOrder> ew = new QueryWrapper<>();
+        ew.lambda().eq(TbOrder::getAttach,attchStr)
+                .eq(TbOrder::getOrderStatus,"SUCCESS")
+                .orderByDesc(TbOrder::getOrderTime);
+        List<TbOrder>list=list(ew);
+        return list.isEmpty()?null:list.get(0);
+    }
 }

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

@@ -6,7 +6,7 @@ spring:
     # 数据源配置
     datasource:
         type: com.alibaba.druid.pool.DruidDataSource
-        url: jdbc:mysql://localhost:3306/pco_system?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=GMT%2B8
+        url: jdbc:mysql://127.0.0.1:3306/pco_system?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=GMT%2B8
         username: root
         password: 123456
         # 是否打开sql监控台  (生产环境请务必关闭此选项)

二進制
sp-server/src/main/resources/static/day-fee-new.xlsx