浏览代码

Merge branch 'dev' into debug

# Conflicts:
#	sp-server/src/main/java/com/pj/api/open/service/OpenService.java
qzyReal 2 年之前
父节点
当前提交
ee8d39f189
共有 27 个文件被更改,包括 662 次插入332 次删除
  1. 5 0
      sp-admin/sa-frame/menu-list-sp.js
  2. 209 207
      sp-admin/sa-view/car/tb-business-car-list.html
  3. 6 6
      sp-admin/sa-view/tb-business-car/tb-business-car-info.html
  4. 2 11
      sp-admin/sa-view/tb-business-car/tb-business-car-list.html
  5. 49 3
      sp-admin/sa-view/tb-business/tb-car-disincle-info.html
  6. 58 13
      sp-admin/sa-view/tb-business/tb-car-disincle-list.html
  7. 25 1
      sp-admin/sa-view/tb-deduction-record/tb-deduction-record-list.html
  8. 10 8
      sp-server/src/main/java/com/pj/api/open/service/OpenService.java
  9. 6 5
      sp-server/src/main/java/com/pj/api/pushfee/task/FeeDetailSyncTask.java
  10. 6 4
      sp-server/src/main/java/com/pj/project/tb_account/AutomaticPay.java
  11. 12 0
      sp-server/src/main/java/com/pj/project/tb_account/TbAccountController.java
  12. 17 1
      sp-server/src/main/java/com/pj/project/tb_business/TbBusiness.java
  13. 30 1
      sp-server/src/main/java/com/pj/project/tb_business/TbBusinessController.java
  14. 1 0
      sp-server/src/main/java/com/pj/project/tb_business/TbBusinessMapper.xml
  15. 149 37
      sp-server/src/main/java/com/pj/project/tb_business/TbBusinessService.java
  16. 1 1
      sp-server/src/main/java/com/pj/project/tb_business_car/TbBusinessCarController.java
  17. 0 10
      sp-server/src/main/java/com/pj/project/tb_business_car/TbBusinessCarService.java
  18. 13 1
      sp-server/src/main/java/com/pj/project/tb_deduction_record/TbDeductionRecordController.java
  19. 7 2
      sp-server/src/main/java/com/pj/project/tb_deduction_record/TbDeductionRecordMapper.xml
  20. 19 13
      sp-server/src/main/java/com/pj/project/tb_deduction_record/TbDeductionRecordService.java
  21. 15 4
      sp-server/src/main/java/com/pj/project/tb_fee_details/TbFeeDetailsMapper.xml
  22. 2 2
      sp-server/src/main/java/com/pj/project/tb_fee_details/TbFeeDetailsService.java
  23. 4 0
      sp-server/src/main/java/com/pj/project/tb_invoice_order/TbInvoiceOrder.java
  24. 5 0
      sp-server/src/main/java/com/pj/project/tb_invoice_order/TbInvoiceOrderService.java
  25. 9 0
      sp-server/src/main/java/com/pj/project/tb_refund_record/TbRefundRecordController.java
  26. 1 1
      sp-server/src/main/java/com/pj/utils/sg/AjaxJson.java
  27. 1 1
      sp-server/src/main/resources/application-dev.yml

+ 5 - 0
sp-admin/sa-frame/menu-list-sp.js

@@ -399,6 +399,11 @@ window.menuList.unshift({
 						isShow: false
 					},
 					{
+						id: 'tb-flex-business-judge',
+						name: '业务审核',
+						isShow: false
+					},
+					{
 
 						id: 'tb-business-car-bind',
 						name: '车辆绑定',

+ 209 - 207
sp-admin/sa-view/car/tb-business-car-list.html

@@ -1,215 +1,217 @@
 <!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>
-	<style>
-		.car-size .el-input__inner {
-		    width: 130px;
-		}
-	</style>
-</head>
-<body>
-<div class="vue-box" style="display: none;" :style="'display: block;'">
-    <div class="c-panel">
-        <div class="fast-btn">
-            <el-button size="mini" type="primary" @click="add()"
-                       v-if="sa.isAuth('tb-flex-business-edit')">
-                新增
-            </el-button>
-            <el-button size="mini" type="info" @click="sa.f5()">刷新</el-button>
-        </div>
-        <!-- ------------- 数据列表 ------------- -->
-        <el-table class="data-table" ref="data-table" :data="dataList">
-            <sa-td name="车牌号" prop="carNo" width=120></sa-td>
-            <sa-td width="130" name="支付状态" prop="payType">
-            </sa-td>
-            <el-table-column label="停车费">
-                <template slot-scope="s">
-                    <label v-if="s.row.money">{{s.row.money}}</label>
-                    <label v-else>-</label>
-                </template>
-            </el-table-column>
-            <sa-td name="入场时间" prop="realInTime" width=160></sa-td>
-            <sa-td name="入场通道" prop="inChannel" width=180></sa-td>
-            <sa-td name="离场时间" prop="realOutTime" width=160></sa-td>
-            <sa-td name="离场通道" prop="outChannel" width=180></sa-td>
-            <el-table-column label="操作" width="100px" fixed="right">
-                <template slot-scope="s">
-                    <el-button
-                            v-if="sa.isAuth('tb-flex-business-edit')&&s.row.pay==0&&s.row.confirmJudge==0"
-                            class="c-btn" type="danger" @click="del(s.row)">删除
-                    </el-button>
-                </template>
-            </el-table-column>
-        </el-table>
-    </div>
-    <el-dialog title="添加车辆" :visible.sync="modal.visible" width="400px">
-        <el-form >
-            <sa-item type="text" name="车牌号" v-model="modal.form.carNo" br need></sa-item>
-			<div class="c-item">
-				<label class="c-label">车辆类型:</label>
-				<el-select v-model="modal.form.carType" placeholder="请选择">
-					<el-option :label="item.name" :value="item.name" v-for="(item,index) in carTypeList">
-					</el-option>
-				</el-select>
+	<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>
+		<style>
+			.car-size .el-input__inner {
+				width: 130px;
+			}
+		</style>
+	</head>
+	<body>
+		<div class="vue-box" style="display: none;" :style="'display: block;'">
+			<div class="c-panel">
+				<div class="fast-btn">
+					<el-button size="mini" type="primary" @click="add()" 
+					v-if="sa.isAuth('tb-flex-business-edit')&&confirm==0">
+						新增
+					</el-button>
+					<el-button size="mini" type="info" @click="sa.f5()">刷新</el-button>
+				</div>
+				<!-- ------------- 数据列表 ------------- -->
+				<el-table class="data-table" ref="data-table" :data="dataList">
+					<sa-td name="车牌号" prop="carNo" width=120></sa-td>
+					<sa-td name="入场时间" prop="realInTime" width=160></sa-td>
+					<sa-td name="离场时间" prop="realOutTime" width=160></sa-td>
+					<sa-td name="入场通道" prop="inChannel" width=180></sa-td>
+					<sa-td name="离场通道" prop="outChannel" width=180></sa-td>
+					<el-table-column label="停车费">
+						<template slot-scope="s">
+							<label v-if="s.row.money">{{s.row.money}}</label>
+							<label v-else>-</label>
+						</template>
+					</el-table-column>
+					<sa-td width="130" name="支付状态" prop="payType">
+					</sa-td>
+					<el-table-column label="操作" width="100px" fixed="right">
+						<template slot-scope="s">
+							<el-button v-if="sa.isAuth('tb-flex-business-edit')
+							&&s.row.pay==0
+							&&s.row.payUnloadMoney==0" class="c-btn" type="danger" @click="del(s.row)">删除
+							</el-button>
+						</template>
+					</el-table-column>
+				</el-table>
 			</div>
-			<div class="c-item">
-			    <label class="c-label"><span style="color: red;">*</span>车辆规格:</label>
-			    <el-input-number class="car-size" v-model="modal.form.carSize" controls-position="right"
-			                     :min="4.2" :max="50"></el-input-number>
-			</div>
-			<div class="c-item" v-if="modal.form.carType.indexOf('空')==-1">
-				<label class="c-label">
-					<span ></span>
-					载重(kg):</label>
-				<el-input-number class="car-size" v-model="modal.form.netWeight" :min="1" :max="999999">
-				</el-input-number>
-			</div>
-        </el-form>
-        <span slot="footer" class="dialog-footer">
+			<el-dialog title="添加车辆" :visible.sync="modal.visible" width="400px">
+				<el-form>
+					<sa-item type="text" name="车牌号" v-model="modal.form.carNo" br need></sa-item>
+					<div class="c-item">
+						<label class="c-label">车辆类型:</label>
+						<el-select v-model="modal.form.carType" placeholder="请选择">
+							<el-option :label="item.name" :value="item.name" v-for="(item,index) in carTypeList">
+							</el-option>
+						</el-select>
+					</div>
+					<div class="c-item">
+			 		<label class="c-label"><span style="color: red;">*</span>车辆规格:</label>
+						<el-input-number class="car-size" v-model="modal.form.carSize" controls-position="right"
+							:min="4.2" :max="50"></el-input-number>
+					</div>
+					<div class="c-item" v-if="modal.form.carType.indexOf('空')==-1">
+						<label class="c-label">
+							<span></span>
+							载重(kg):</label>
+						<el-input-number class="car-size" v-model="modal.form.netWeight" :min="1" :max="999999">
+						</el-input-number>
+					</div>
+				</el-form>
+				<span slot="footer" class="dialog-footer">
 					<el-button @click="modal.visible = false">取 消</el-button>
 					<el-button type="primary" @click="sureAddFn">确 认</el-button>
 				</span>
-    </el-dialog>
-</div>
-<script>
-    var app = new Vue({
-        components: {
-            "sa-item": httpVueLoader('../../sa-frame/com/sa-item.vue'),
-            "sa-info": httpVueLoader('../../sa-frame/com/sa-info.vue'),
-            "sa-td": httpVueLoader('../../sa-frame/com/sa-td.vue'),
-        },
-        el: '.vue-box',
-        data: {
-            report: {
-                visible: false,
-                business: {},
-            },
-            payStatus: sa.p('payStatus', 1),
-            confirm: sa.p('confirm', 0),
-            p: { // 查询参数
-                businessId: sa.p('id', ''), //
-                carNo: '', //
-            },
-            dataCount: 0,
-            dataList: [], // 数据集合
-			carTypeList:[],
-            modal: {
-                visible: false,
-                form: {
-                    carNo: '',
-                    carSize: 13,
-					carType:'载重',
-					netWeight:0
-                }
-            },
-        },
-        methods: {
-			getItemType() {
-				sa.ajax('/TbItem/getItemType', function(resp) {
-					let list = resp.data;
-					if (list.length > 0) {
-						this.modal.form.carType = list[0].name;
-					}
-					this.carTypeList = list;
-				}.bind(this))
-			},
-         
-            sureAddFn() {
-				let data=this.modal.form;
-				if(!data.carNo){
-					  sa.error('请填写车牌号')
-					return;
+			</el-dialog>
+		</div>
+		<script>
+			var app = new Vue({
+				components: {
+					"sa-item": httpVueLoader('../../sa-frame/com/sa-item.vue'),
+					"sa-info": httpVueLoader('../../sa-frame/com/sa-info.vue'),
+					"sa-td": httpVueLoader('../../sa-frame/com/sa-td.vue'),
+				},
+				el: '.vue-box',
+				data: {
+					report: {
+						visible: false,
+						business: {},
+					},
+					payStatus: sa.p('payStatus', 1),
+					confirm: sa.p('confirm', 0),
+					p: { // 查询参数
+						businessId: sa.p('id', ''), //
+						carNo: '', //
+					},
+					dataCount: 0,
+					dataList: [], // 数据集合
+					carTypeList: [],
+					modal: {
+						visible: false,
+						form: {
+							carNo: '',
+							carSize: 13,
+							carType: '载重',
+							netWeight: 0
+						}
+					},
+				},
+				methods: {
+					getItemType() {
+						sa.ajax('/TbItem/getItemType', function(resp) {
+							let list = resp.data;
+							if (list.length > 0) {
+								this.modal.form.carType = list[0].name;
+							}
+							this.carTypeList = list;
+						}.bind(this))
+					},
+
+					sureAddFn() {
+						let data = this.modal.form;
+						if (!data.carNo) {
+							sa.error('请填写车牌号')
+							return;
+						}
+						data.businessId = this.p.businessId;
+						sa.ajax('/TbBusiness/addCar', data, function(res) {
+							sa.alert('添加成功');
+							this.modal.visible = false;
+							this.f5();
+						}.bind(this));
+					},
+					// 刷新
+					f5: function() {
+						sa.ajax('/TbBusinessCar/getBusinessByBusinessCarId', 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-car-info.html?id=' + data.id + '&businessId=' + this.p
+							.businessId, '800px', '80%');
+					},
+					// 修改
+					update: function(data) {
+						sa.showIframe('修改数据', 'tb-business-car-add.html?id=' + data.id + '&businessId=' + this.p
+							.businessId, '500px', '70%');
+					},
+					// 新增
+					add: function(data) {
+						Object.assign(this.modal, {
+							visible: true,
+							form: {
+								carNo: '',
+								carSize: 13,
+								carType: '重车',
+								netWeight: 0
+							}
+						})
+					},
+					// 删除
+					del: function(data) {
+						sa.confirm('是否删除,此操作不可撤销', function() {
+							sa.ajax('/TbBusiness/deleteBusinessCar?id=' + data.id + '&businessId=' + this.p
+								.businessId,
+								function(res) {
+									sa.arrayDelete(this.dataList, data);
+									sa.ok('删除成功');
+									sa.f5TableHeight(); // 刷新表格高度
+								}.bind(this))
+						}.bind(this));
+					},
+					// 改 - 状态(0=否,1=是)
+					updateStatus: function(data) {
+						if (!sa.isAuth('tb-business-car-change')) {
+							sa.error('无权限')
+							return false;
+						}
+						// 声明变量记录是否成功
+						var isOk = false;
+						var oldValue = data.isLock;
+						var ajax = sa.ajax('/TbBusinessCar/updateStatus', {
+							id: data.id,
+							value: data.isLock
+						}, function(res) {
+							isOk = true;
+							sa.msg('修改成功');
+						}.bind(this));
+						// 如果未能修改成功, 则回滚
+						$.when(ajax).done(function() {
+							if (isOk == false) {
+								data.isLock = oldValue;
+							}
+						})
+					},
+				},
+				created: function() {
+					this.f5();
+					this.getItemType();
+					sa.onInputEnter();
 				}
-				data.businessId=this.p.businessId;
-                sa.ajax('/TbBusiness/addCar',data, function (res) {
-                    sa.alert('添加成功');
-                    this.modal.visible = false;
-                    this.f5();
-                }.bind(this));
-            },
-            // 刷新
-            f5: function () {
-                sa.ajax('/TbBusinessCar/getBusinessByBusinessCarId', 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-car-info.html?id=' + data.id + '&businessId=' + this.p
-                    .businessId, '800px', '80%');
-            },
-            // 修改
-            update: function (data) {
-                sa.showIframe('修改数据', 'tb-business-car-add.html?id=' + data.id + '&businessId=' + this.p
-                    .businessId, '500px', '70%');
-            },
-            // 新增
-            add: function (data) {
-                Object.assign(this.modal,{
-					visible:true,
-					form:{
-						carNo:'',
-						carSize:13,
-						carType:'重车',
-						netWeight:0
-					}
-				})
-            },
-            // 删除
-            del: function (data) {
-                sa.confirm('是否删除,此操作不可撤销', function () {
-                    sa.ajax('/TbBusiness/deleteBusinessCar?id=' + data.id+'&businessId='+this.p.businessId, function (res) {
-                        sa.arrayDelete(this.dataList, data);
-                        sa.ok('删除成功');
-                        sa.f5TableHeight(); // 刷新表格高度
-                    }.bind(this))
-                }.bind(this));
-            },
-            // 改 - 状态(0=否,1=是)
-            updateStatus: function (data) {
-                if (!sa.isAuth('tb-business-car-change')) {
-                    sa.error('无权限')
-                    return false;
-                }
-                // 声明变量记录是否成功
-                var isOk = false;
-                var oldValue = data.isLock;
-                var ajax = sa.ajax('/TbBusinessCar/updateStatus', {
-                    id: data.id,
-                    value: data.isLock
-                }, function (res) {
-                    isOk = true;
-                    sa.msg('修改成功');
-                }.bind(this));
-                // 如果未能修改成功, 则回滚
-                $.when(ajax).done(function () {
-                    if (isOk == false) {
-                        data.isLock = oldValue;
-                    }
-                })
-            },
-        },
-        created: function () {
-            this.f5();
-			this.getItemType();
-            sa.onInputEnter();
-        }
-    })
-</script>
-</body>
+			})
+		</script>
+	</body>
 </html>

+ 6 - 6
sp-admin/sa-view/tb-business-car/tb-business-car-info.html

@@ -38,7 +38,7 @@
 				<div class="c-panel">
 					<el-form v-if="m">
 						<el-row>
-							<el-col :span="m.businessType==1?8:12">
+							<el-col span="12">
 								<sa-info name="车牌号" br>{{m.carNo}}</sa-info>
 								<sa-info name="车牌颜色" br>{{m.color}}</sa-info>
 								<sa-info name="车牌规格(米)" br>{{m.carSize}}</sa-info>
@@ -50,7 +50,7 @@
 								<sa-info name="备注" br v-if="m.remark">{{m.remark}}</sa-info>
 								<sa-info type="img" name="入场图片" :value="m.inImage" br></sa-info>
 							</el-col>
-							<el-col :span="m.businessType==1?8:12">
+							<el-col span="12">
 								<sa-info name="离场时间" br>{{m.realOutTime}}<label
 										v-if="m.outTimeSupplement===1">(补)</label></sa-info>
 								<sa-info name="补录时间" br v-if="m.outTimeSupplementTime">{{m.outTimeSupplementTime}}
@@ -61,7 +61,7 @@
 								<sa-info name="出场确认说明" br v-if="m.outRemark">{{m.outRemark}}</sa-info>
 								<sa-info type="img" name="离场图片" :value="m.outImage" br></sa-info>
 							</el-col>
-							<el-col span=8 v-if="m.businessType==1">
+							<!-- <el-col span=8 v-if="m.businessType==1">
 								<sa-info style="margin-top: 0;" type="enum" name="审核状态" :value="m.confirmJudge"
 									:jv="{0: '未审核', 1: '审核通过', 2: '审核驳回'}" br>
 								</sa-info>
@@ -72,7 +72,7 @@
 								<sa-info name="审核意见" br v-if="m.confirmJudgeContent">
 									{{m.confirmJudgeContent}}
 								</sa-info>
-							</el-col>
+							</el-col> -->
 						</el-row>
 						<el-row v-if="businessList.length>0">
 							<el-collapse value='1'>
@@ -141,10 +141,10 @@
 			</div>
 			<!-- ------- 底部按钮 ------- -->
 			<div class="s-foot">
-				<el-button v-if="sa.isAuth('tb-business-car-judge')&&m.businessType===1&&m.confirmJudge!=1"
+			<!-- 	<el-button v-if="sa.isAuth('tb-business-car-judge')&&m.businessType===1&&m.confirmJudge!=1"
 					class="c-btn" type="success" icon="el-icon" @click="pass()">审核通过</el-button>
 				<el-button v-if="sa.isAuth('tb-business-car-judge')&&m.businessType===1&&m.confirmJudge==1"
-					class="c-btn" type="warning" icon="el-icon" @click="callback()">审核驳回</el-button>
+					class="c-btn" type="warning" icon="el-icon" @click="callback()">审核驳回</el-button> -->
 				<el-button v-if="sa.isAuth('tb-business-car-print')&&m.pay===1&&m.businessType===1" type="success"
 					@click="printFn()">打印</el-button>
 				<el-button type="success" @click="sa.closeCurrIframe()">关闭</el-button>

+ 2 - 11
sp-admin/sa-view/tb-business-car/tb-business-car-list.html

@@ -68,16 +68,7 @@
 							<el-option label="免费车" value="1"></el-option>
 						</el-select>
 					</div>
-					<div class="c-item">
-						<label class="c-label">审核状态:</label>
-						<el-select v-model="p.confirmJudge">
-							<el-option label="全部" value=""></el-option>
-							<el-option label="未审核" :value="0"></el-option>
-							<el-option label="审核通过" :value="1"></el-option>
-							<el-option label="审核驳回" :value="2"></el-option>
-							<el-option label="无需审核" :value="3"></el-option>
-						</el-select>
-					</div>
+				
 					<el-button type="primary" icon="el-icon-search" @click="p.pageNo = 1; f5()">查询</el-button>
 					<el-button size="mini" type="primary" @click="exportFn" v-if="sa.isAuth('tb-business-car-export')">
 						导出
@@ -128,7 +119,7 @@
 							</label>
 						</template>
 					</el-table-column>
-					<sa-td name="审核状态" prop="confirmJudge" type="enum" :jv="{0: '未审核', 1:'审核通过',2:'审核驳回',3:'无需审核'}"></sa-td>
+					
 					<sa-td name="支付状态" prop="payType"></sa-td>
 					<sa-td name="支付时间" prop="payTime" width="140"></sa-td>
 					<sa-td name="出场确认说明" prop="outRemark" width="180"></sa-td>

+ 49 - 3
sp-admin/sa-view/tb-business/tb-car-disincle-info.html

@@ -36,7 +36,7 @@
 									</div>
 									<div>
 										<el-row>
-											<el-col span="12">
+											<el-col span="8">
 												<sa-info name="客户名称" br v-if="m.customerName">{{m.customerName}}
 												</sa-info>
 												<sa-info name="业务项目" br>{{m.goodsName}}</sa-info>
@@ -59,7 +59,7 @@
 												</sa-info>
 
 											</el-col>
-											<el-col span="12">
+											<el-col span="8">
 												<sa-info name="企业" br v-if="m.pickCustomerName">{{m.pickCustomerName}}
 												</sa-info>
 												<sa-info name="业务编号" br>{{m.no}}</sa-info>
@@ -75,6 +75,18 @@
 												<sa-info name="审批结果" br v-if="m.oaResult">{{m.oaResult}}</sa-info>
 												<sa-info name="审批意见" br v-if="m.oaContent">{{m.oaContent}}</sa-info>
 											</el-col>
+											<el-col span=8 >
+												<sa-info style="margin-top: 0;" type="enum" name="审核状态" :value="m.confirmJudge"
+													:jv="{0: '未审核', 1: '审核通过', 2: '审核驳回'}" br>
+												</sa-info>
+												<sa-info style="margin-top: 0;" name="审核人" br>
+													{{m.judgeBy}}
+												</sa-info>
+												<sa-info name="审核时间" br>{{m.confirmJudgeTime}}</sa-info>
+												<sa-info name="审核意见" br v-if="m.confirmJudgeContent">
+													{{m.confirmJudgeContent}}
+												</sa-info>
+											</el-col>
 										</el-row>
 									</div>
 								</el-collapse-item>
@@ -164,6 +176,10 @@
 			<!-- ------- 底部按钮 ------- -->
 			<div class="s-foot">
 				<!-- <el-button class="c-btn" type="success" icon="el-icon" @click="print()">打印单据</el-button> -->
+				<!-- <el-button v-if="sa.isAuth('tb-flex-business-judge')&&m.confirmJudge!=1"
+					class="c-btn" type="success" icon="el-icon" @click="pass()">审核通过</el-button>
+				<el-button v-if="sa.isAuth('tb-flex-business-judge')&&m.confirmJudge==1"
+					class="c-btn" type="warning" icon="el-icon" @click="callback()">审核驳回</el-button> -->
 				<el-button type="success" @click="sa.closeCurrIframe()">关闭</el-button>
 			</div>
 
@@ -188,7 +204,7 @@
 				el: '.vue-box',
 				data: {
 					id: sa.p('id', 0), // 获取数据ID
-					m: null,
+					m: {},
 					tableData: [],
 					upload: {
 						visible: false,
@@ -199,6 +215,36 @@
 					}
 				},
 				methods: {
+					pass() {
+						sa.ajax('/TbBusiness/confirmJudgePass', {
+							id: this.id
+						}, function(res) {
+							let msg = res.msg;
+							if (msg) {
+								sa.alert(msg, this.clean);
+								return;
+							}
+							sa.alert('审核通过', this.clean);
+						}.bind(this))
+					},
+					callback() {
+						let that = this;
+						layer.prompt({
+							title: '填写审核意见'
+						}, function(content, index) {
+							layer.close(index);
+							sa.ajax('/TbBusiness/callback', {
+								id: that.id,
+								judgeContent: content
+							}, function(res) {
+								sa.alert('已驳回', that.clean);
+							})
+						});
+					},
+					clean() {
+						parent.app.f5();
+						sa.closeCurrIframe();
+					},
 					delFn(data) {
 						sa.confirm('是否确认删除该收费项?', function() {
 							sa.ajax('/TbBusinessItem/del', {

+ 58 - 13
sp-admin/sa-view/tb-business/tb-car-disincle-list.html

@@ -43,14 +43,14 @@
 					<sa-item type="text" name="车牌号" placeholder="车牌号" v-model="p.carNo"></sa-item>
 					<sa-item type="text" name="客户" placeholder="客户" v-model="p.customerName"></sa-item>
 					<sa-item type="text" name="合作伙伴" placeholder="合作伙伴" v-model="p.pickCustomerName"></sa-item>
-					<div class="c-item">
+					<!-- <div class="c-item">
 						<label class="c-label">确认状态:</label>
 						<el-select v-model="p.adminConfirmInput" placeholder="请选择" @change="f5()">
 							<el-option label="全部" :value="-1"></el-option>
 							<el-option label="已确认" :value="1"></el-option>
 							<el-option label="未确认" :value="0"></el-option>
 						</el-select>
-					</div>
+					</div> -->
 					<div class="c-item">
 						<label class="c-label">状态:</label>
 						<el-select v-model="p.hasError" placeholder="请选择" @change="f5()">
@@ -66,10 +66,20 @@
 							</el-option>
 						</el-select>
 					</div>
+					<div class="c-item">
+						<label class="c-label">审核状态:</label>
+						<el-select v-model="p.confirmJudge">
+							<el-option label="全部" value=""></el-option>
+							<el-option label="未审核" :value="0"></el-option>
+							<el-option label="审核通过" :value="1"></el-option>
+							<el-option label="审核驳回" :value="2"></el-option>
+						</el-select>
+					</div>
 					<div>
 						<el-button type="primary" icon="el-icon-search" @click="p.pageNo = 1; f5()">查询</el-button>
 						<el-button type="info" icon="el-icon-search"
-							@click="p.carNo = '';p.adminConfirmInput=-1;p.customerName='';p.pickCustomerName='';p.owner='';p.no=''; f5()">重置
+							@click="p.carNo = '';p.confirmJudge='';p.customerName='';p.pickCustomerName='';p.owner='';p.no=''; f5()">
+							重置
 						</el-button>
 						<el-button v-if="sa.isAuth('tb-flex-business-add')" size="mini" type="primary" @click="add()">
 							新增
@@ -90,22 +100,27 @@
 						</template>
 					</el-table-column>
 					<sa-td name="支付时间" prop="payTime" width="160"></sa-td>
-
-					<sa-td name="确认" prop="adminConfirmInput" type="enum" :jv="{1: '已确认', 0: '未确认'}"></sa-td>
-					<sa-td name="已支付(元)" prop="payMoney" width="140"></sa-td>
+					<sa-td name="审核状态" prop="confirmJudge" type="enum" :jv="{0: '未审核', 1:'审核通过',2:'审核驳回'}">
+					</sa-td>
+					<sa-td name="审核时间" prop="confirmJudgeTime" width="160"></sa-td>
+					<!-- <sa-td name="确认" prop="adminConfirmInput" type="enum" :jv="{1: '已确认', 0: '未确认'}"></sa-td> -->
 					<sa-td name="业务费用(元)" prop="itemPrice" width="120"></sa-td>
+					<sa-td name="已支付(元)" prop="payMoney" width="140"></sa-td>
 					<sa-td name="业务状态" prop="hasError" type="enum" :jv="{1: '异常[#ff0000]', 0: '正常[#005500]'}"></sa-td>
 					<sa-td width="160" name="创建时间" prop="createTime"></sa-td>
 					</sa-td>
-					<el-table-column label="操作" width="300px" fixed="right">
+					<el-table-column label="操作" width="230px" fixed="right">
 						<template slot-scope="s">
-							<el-button class="c-btn" type="primary" v-if="sa.isAuth('tb-flex-business-confirm')
+							<!-- <el-button class="c-btn" type="primary" v-if="sa.isAuth('tb-flex-business-confirm')
 								&&currentCustomerId=='1'&&s.row.adminConfirmInput==0" @click="confirmFn(s.row)">账单确认
-							</el-button>
+							</el-button> -->
+							
 							<el-button class="c-btn" type="primary" v-if="sa.isAuth('tb-business-confirm')
 									&&currentCustomerId=='1'&&s.row.adminConfirmInput==1" @click="checkConfirmFn(s.row)">查看账单
 							</el-button>
 							<el-button class="c-btn" type="success" @click="get(s.row)">查看</el-button>
+							<el-button class="c-btn" type="success" v-if="sa.isAuth('tb-flex-business-judge')&&s.row.confirmJudge!=1" @click="pass(s.row)">审核</el-button>
+							<el-button class="c-btn" type="warning" v-if="sa.isAuth('tb-flex-business-judge')&&s.row.confirmJudge==1" @click="callback(s.row)">驳回</el-button>
 							<el-button class="c-btn" type="primary"
 								v-if="currentCustomerId=='1'||(s.row.adminConfirmInput==0&&sa.isAuth('tb-flex-business-edit'))"
 								@click="update(s.row)">
@@ -122,7 +137,7 @@
 								type="success" @click="zxPrint(s.row.id)">装卸打印
 							</el-button>
 							<el-button class="c-btn" type="danger"
-								v-if="sa.isAuth('tb-flex-business-del')&&s.row.adminConfirmInput==0&&s.row.payMoney==0"
+								v-if="sa.isAuth('tb-flex-business-del')&&s.row.adminConfirmInput==0&&s.row.payMoney==0&&s.row.confirmJudge!=1"
 								@click="del(s.row)">删除
 							</el-button>
 							<el-button class="c-btn" type="warning" v-if="s.row.hasError==1" @click="addErrorFn(s.row)">
@@ -207,7 +222,7 @@
 					p: { // 查询参数
 						hasError: -1,
 						adminConfirmInput: -1,
-						pickCustomerName:'',
+						pickCustomerName: '',
 						confirmJudge: '',
 						customerName: '',
 						supplement: 0,
@@ -229,6 +244,28 @@
 					goodsList: [],
 				},
 				methods: {
+					pass(data) {
+						sa.ajax('/TbBusiness/confirmJudgePass', {
+							id: data.id
+						}, function(res) {
+							sa.alert('审核通过', this.f5);
+						}.bind(this))
+					},
+					callback(data) {
+						let that = this;
+						console.log(data);
+						layer.prompt({
+							title: '填写驳回原因'
+						}, function(content, index) {
+							layer.close(index);
+							sa.ajax('/TbBusiness/callback', {
+								id: data.id,
+								judgeContent: content
+							}, function(res) {
+								sa.alert('已驳回', that.f5);
+							})
+						});
+					},
 					sureAddFn() {
 
 					},
@@ -287,8 +324,8 @@
 					},
 					carFn(data) {
 						this.stopTimmer();
-						sa.showIframe('车辆管理', '../car/tb-business-car-list.html?id=' + data.id + '&payStatus=' + data
-							.payStatus + '&confirm=' + data.adminConfirmInput, '1050px', '75%');
+						sa.showIframe('业务车辆管理', '../car/tb-business-car-list.html?id=' + data.id + '&payStatus=' + data
+							.payStatus + '&confirm=' + data.confirmJudge, '1050px', '75%');
 					},
 					handlerPay(data) {
 						this.stopTimmer();
@@ -309,6 +346,10 @@
 						sa.showIframe('新增数据', 'tb-car-disincle-add.html?id=-1', '1080px', '90%');
 					},
 					update(data) {
+						if(data.confirmJudge==1){
+							sa.error('业务已审核,请驳回后修改')
+							return;
+						}
 						sa.showIframe('修改数据', 'tb-car-disincle-edit.html?id=' + data.id, '1080px', '90%');
 					},
 					getPcodeByCurrRid() {
@@ -344,6 +385,10 @@
 					},
 					// 删除
 					del: function(data) {
+						if(data.confirmJudge==1){
+							sa.error('业务已审核,无法删除')
+							return;
+						}
 						sa.confirm('是否删除,此操作不可撤销', function() {
 							sa.ajax('/TbBusiness/deleteOtherBusiness?id=' + data.id + '&businessCarId=' +
 								data.businessCarId,

+ 25 - 1
sp-admin/sa-view/tb-deduction-record/tb-deduction-record-list.html

@@ -54,7 +54,7 @@
 							</el-option>
 						</el-select>
 					</sa-item>
-					<sa-item type="text" name="支付时间">
+					<sa-item type="text" name="扣款时间">
 						<el-date-picker v-model="p.payTime" type="daterange" align="right" unlink-panels
 							value-format="yyyy-MM-dd" range-separator="至" start-placeholder="开始日期"
 							end-placeholder="结束日期" :picker-options="pickerOptions">
@@ -239,11 +239,27 @@
 				},
 				methods: {
 					getSum(){
+						let p=this.p;
+						if(p.payTime){
+							p.startTime=p.payTime[0];
+							p.endTime=p.payTime[1];
+						}else{
+							p.startTime='';
+							p.endTime='';
+						}
 						sa.ajax('/TbDeductionRecord/getSum', sa.removeNull(this.p), function(res) {
 							this.totalMoney=res.data;
 						}.bind(this));
 					},
 					exportFn () {
+						let p=this.p;
+						if(p.payTime){
+							p.startTime=p.payTime[0];
+							p.endTime=p.payTime[1];
+						}else{
+							p.startTime='';
+							p.endTime='';
+						}
 						sa.confirm('是否导出符合筛选条件的扣费记录', function() {
 							sa.ajax('/TbDeductionRecord/export', sa.removeNull(this.p),
 								function(res) {
@@ -268,6 +284,14 @@
 					},
 					// 刷新
 					f5: function() {
+						let p=this.p;
+						if(p.payTime){
+							p.startTime=p.payTime[0];
+							p.endTime=p.payTime[1];
+						}else{
+							p.startTime='';
+							p.endTime='';
+						}
 						sa.ajax('/TbDeductionRecord/getList', sa.removeNull(this.p), function(res) {
 							this.dataList = res.data; // 数据
 							this.dataCount = res.dataCount; // 数据总数 

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

@@ -172,12 +172,7 @@ public class OpenService {
             StaticLog.error("缓存离场图片,{}", carNo);
             IMAGE_CACHE.put(carNo, image);
         }
-        if (CarEnum.BusinessTypeEnum.BUSINESS_CAR.getType().equals(tbBusinessCar.getBusinessType())) {
-            if (tbBusinessCar.getConfirmJudge() != CarEnum.ConfirmJudgeEnum.JUDGE_PASS.getCode()) {
-                log.error("请求返回【业务未审核】:{}", carNo);
-                return ResultJson.error("业务未审核");
-            }
-        }
+
         //判断是否4.2米以下蓝色车牌===免停车费
         if (StrUtil.isNotEmpty(tbBusinessCar.getColor())) {
             String freeColor = partConfig.getFreeColor();
@@ -199,6 +194,13 @@ public class OpenService {
         IOrderPriceRes businessRes = new IOrderPriceRes();
         List<IOrderItem> expenses = new ArrayList<>();
         List<TbBusiness> businessList = tbBusinessService.findOtherBusinessByCarId(businessCarId);
+        long judgeCount = businessList.stream().filter(tbBusiness -> tbBusiness.getConfirmJudge() == CarEnum.ConfirmJudgeEnum.JUDGE_PASS.getCode()).count();
+        int size = businessList.size();
+        if (size > judgeCount) {
+            //业务未审核完
+            log.error("请求返回【业务未审核】:{}", carNo);
+            return ResultJson.error("业务未审核");
+        }
         BigDecimal hasPayPartMoney = tbBusinessCar.getMoney();
         if (businessList.isEmpty()) {
             //无业务车辆===>计算停车费
@@ -290,12 +292,12 @@ public class OpenService {
             }
             RedisUtil.setByMINUTES(channel, carNo, 5);
             // boolean flag = automaticPay.payBusinessAndPartMoney(businessList, tbBusinessCar, partMoneyRes);
-            // if (flag) {
+            //  if (flag) {
             //
             //   log.error("预存款扣款成功,返回:{},{}", carNo, desc);
             //    freeOut(tbBusinessCar, now, channel, image);
             //   return ResultJson.success();
-            //   }
+            //  }
             log.error("请求返回:{},{}", carNo, desc);
             return ResultJson.error(desc);
         }

+ 6 - 5
sp-server/src/main/java/com/pj/api/pushfee/task/FeeDetailSyncTask.java

@@ -79,14 +79,14 @@ public class FeeDetailSyncTask extends Task {
         TbFeeItemService tbFeeItemService = SpringUtil.getBean(TbFeeItemService.class);
         TbItemService tbItemService = SpringUtil.getBean(TbItemService.class);
         TbFeeItem tbFeeItem = tbFeeItemService.getById(tbFeeDetails.getFeeType());
-      TbItem tbItem= tbItemService.getById(tbFeeDetails.getItemId());
-        String subBillNo = StrUtil.isEmpty(tbFeeDetails.getBusinessNo()) ? tbFeeDetails.getBusinessCarNo() : tbFeeDetails.getBusinessCarNo();
+        TbItem tbItem= tbItemService.getById(tbFeeDetails.getItemId());
+        String subBillNo = StrUtil.isEmpty(tbFeeDetails.getBusinessNo()) ? tbFeeDetails.getBusinessCarNo() : tbFeeDetails.getBusinessNo();
         String classifyPath = tbFeeDetails.getFeeType() + "-" + itemTypeId + "-" + itemId;
         opd.setSyncType(syncType)
                 .setSubjectNo(tbFeeDetails.getCarNo())
                 .setSubjectName(tbFeeDetails.getCarNo())
-                .setSubBillNo(subBillNo)
-                .setBizTypeNo(itemTypeId).setPayStatus("1")
+                .setSubBillNo(subBillNo).setCalculateId(tbFeeDetails.getCalculateId())
+                .setBizTypeNo(tbItem.getItemCode()).setPayStatus("1")
                 .setPayStatusDesc("已支付")
                 .setGoodNo(tbItem.getItemCode()).setGoodName(tbItem.getItemName())
                 .setBillStatusDesc(tbFeeDetails.getItemTypeName()+tbFeeDetails.getItemName())
@@ -121,7 +121,7 @@ public class FeeDetailSyncTask extends Task {
             return;
         }
         HelpService helpService = SpringUtil.getBean(HelpService.class);
-        log.info("开始同步订单信息:{}", detailId);
+
         TbFeeDetailsService tbFeeDetailsService = SpringUtil.getBean(TbFeeDetailsService.class);
         TbFeeDetails tbFeeDetails = tbFeeDetailsService.getById(detailId);
         if (tbFeeDetails == null || tbFeeDetails.getSyncStatus() == 1) {
@@ -131,6 +131,7 @@ public class FeeDetailSyncTask extends Task {
         List<SyncBillParam> list = buildParams(tbFeeDetails);
         SyncBillRequest detail = new SyncBillRequest();
         detail.setBillList(list);
+        log.info("同步订单信息:{}", JSONUtil.toJsonStr(list));
         SyncResultBO response = helpService.req("/data/sync/bill", detail);
         if (response.getCode() == 200) {
             tbFeeDetails.setSyncStatus(1);

+ 6 - 4
sp-server/src/main/java/com/pj/project/tb_account/AutomaticPay.java

@@ -2,6 +2,7 @@ package com.pj.project.tb_account;
 
 
 import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.util.NumberUtil;
 import cn.hutool.core.util.RandomUtil;
 import cn.hutool.core.util.StrUtil;
@@ -103,7 +104,7 @@ public class AutomaticPay {
     /**
      * 生成扣费记录
      */
-    public void createTbDeductionRecord(TbFeeDetails feeDetails, BigDecimal originalMoney, BigDecimal balance,
+    public TbDeductionRecord createTbDeductionRecord(TbFeeDetails feeDetails, BigDecimal originalMoney, BigDecimal balance,
                                         String customerId,String customerName,String plate, String businessCarId, FeeTypeEnum feeTypeEnum) {
         TbDeductionRecord deductionRecord = BeanUtil.toBean(feeDetails, TbDeductionRecord.class);
         BigDecimal itemPrice = feeDetails.getItemPrice();
@@ -120,11 +121,12 @@ public class AutomaticPay {
                 .setReviewStatus(0).setFeeType(feeTypeEnum.getCode()).setFeeTypeName(feeTypeEnum.getDesc())
                 .setCarNo(plate).setBusinessItemId(feeDetails.getBusinessItemId())
                 .setFeeDetailsId(feeDetails.getId())
-                .setBusinessNo(feeDetails.getBusinessNo())
-                .setPreOrderNum(no);
+                .setBusinessNo(feeDetails.getBusinessNo());
         deductionRecord.insert();
-        feeDetails.setPreOrderNum(no);
+        String preNo= DateUtil.format(new Date(),"yyyyMMddHHmm")+RandomUtil.randomString(5);
+        feeDetails.setPreOrderNum(preNo);
         tbFeeDetailsService.updateById(feeDetails);
+        return deductionRecord;
     }
 
     /**

+ 12 - 0
sp-server/src/main/java/com/pj/project/tb_account/TbAccountController.java

@@ -55,6 +55,10 @@ public class TbAccountController {
     @SaCheckPermission(TbAccount.TB_ACCOUNT_BALANCE_LIST)
     public AjaxJson getBalance() {
         SoMap soMap = SoMap.getRequestSoMap();
+        String currentCustomerId = StpUserUtil.getCustomerId();
+        if (!currentCustomerId.equals(UserTypeEnum.PLATFORM_ADMIN.getCustomerId())) {
+            soMap.put("customerId", currentCustomerId);
+        }
         Page<TbBalanceBO> page = tbAccountService.getBalancePage(soMap);
         return AjaxJson.getPageData(page.getSize(), page.getRecords());
     }
@@ -70,12 +74,20 @@ public class TbAccountController {
     @SaCheckPermission(TbAccount.TB_ACCOUNT_BALANCE_LIST)
     public AjaxJson export() {
         SoMap soMap = SoMap.getRequestSoMap();
+        String currentCustomerId = StpUserUtil.getCustomerId();
+        if (!currentCustomerId.equals(UserTypeEnum.PLATFORM_ADMIN.getCustomerId())) {
+            soMap.put("customerId", currentCustomerId);
+        }
         return AjaxJson.getSuccessData(tbAccountService.export(soMap));
     }
     @RequestMapping(value = "getSum")
     @SaCheckPermission(TbAccount.TB_ACCOUNT_BALANCE_LIST)
     public AjaxJson getSum() {
         SoMap soMap = SoMap.getRequestSoMap();
+        String currentCustomerId = StpUserUtil.getCustomerId();
+        if (!currentCustomerId.equals(UserTypeEnum.PLATFORM_ADMIN.getCustomerId())) {
+            soMap.put("customerId", currentCustomerId);
+        }
         return AjaxJson.getSuccessData(tbAccountService.getSum(soMap));
     }
 

+ 17 - 1
sp-server/src/main/java/com/pj/project/tb_business/TbBusiness.java

@@ -47,6 +47,7 @@ public class TbBusiness extends Model<TbBusiness> implements Serializable {
     public static final String PERMISSION_PAY = "tb-business-pay";
     public static final String PERMISSION_INPUT = "tb-business-add";
     public static final String PERMISSION_MANUAL_PAY = "tb-flex-business-pay";
+    public static final String PERMISSION__JUDGE = "tb-flex-business-judge";
     //其他业务
     public static final String PERMISSION_FLAX_BUSINESS_ADD = "tb-flex-business-add";
     public static final String PERMISSION_FLAX_BUSINESS_EDIT = "tb-flex-business-edit";
@@ -315,7 +316,22 @@ public class TbBusiness extends Model<TbBusiness> implements Serializable {
      */
     private int hasError=0;
 
-
+    /**
+     * 确认审核(0=未审核,1=审核通过,2=审核驳回)[j]
+     */
+    private Integer confirmJudge=0;
+    /**
+     * 审核时间
+     */
+    private Date confirmJudgeTime;
+    /**
+     * 审核意见
+     */
+    private String confirmJudgeContent;
+    /**
+     * 审核人
+     */
+    private String judgeBy;
 
 
     @TableField(exist = false)

+ 30 - 1
sp-server/src/main/java/com/pj/project/tb_business/TbBusinessController.java

@@ -367,13 +367,14 @@ public class TbBusinessController {
         if (StrUtil.isEmpty(tbBusinessCar.getCarNo())) {
             return AjaxJson.getError("请输入车牌号");
         }
+
         tbBusinessService.addBusinessCar(tbBusinessCar);
 
         return AjaxJson.getSuccess();
     }
 
     /**
-     * 
+     * 删除车辆
      */
     @RequestMapping("deleteBusinessCar")
     @SaCheckPermission(TbBusiness.PERMISSION_FLAX_BUSINESS_EDIT)
@@ -381,4 +382,32 @@ public class TbBusinessController {
         tbBusinessService.deleteBusinessCar(id,businessId);
         return AjaxJson.getSuccess();
     }
+
+    /**
+     * 审核通过
+     *
+     * @return
+     */
+    @RequestMapping("confirmJudgePass")
+    @SaCheckPermission(TbBusiness.PERMISSION__JUDGE)
+    public AjaxJson confirmJudge() {
+        SoMap soMap = SoMap.getRequestSoMap();
+        String id = soMap.getString("id");
+       tbBusinessService.confirmJudgePass(id);
+        return AjaxJson.getSuccess("审核通过");
+    }
+    /**
+     * 驳回
+     *
+     * @return
+     */
+    @RequestMapping("callback")
+    @SaCheckPermission(TbBusiness.PERMISSION__JUDGE)
+    public AjaxJson callback() {
+        SoMap soMap = SoMap.getRequestSoMap();
+        String id = soMap.getString("id");
+        String judgeContent = soMap.getString("judgeContent");
+        tbBusinessService.callback(id,judgeContent);
+        return AjaxJson.getSuccess();
+    }
 }

+ 1 - 0
sp-server/src/main/java/com/pj/project/tb_business/TbBusinessMapper.xml

@@ -22,6 +22,7 @@
             <if test=' this.has("businessGoodsName") '>and business_goods_name like concat('%', #{businessGoodsName},'%')</if>
             <if test=' this.has("cardNo") '>and card_no like concat('%', #{cardNo} ,'%')</if>
             <if test=' this.has("cardSize") '>and card_size = #{cardSize}</if>
+            <if test=' this.has("confirmJudge") '>and confirm_judge = #{confirmJudge}</if>
             <if test=' this.has("netWeight") '>and net_weight = #{netWeight}</if>
             <if test=' this.has("goodsId") '>and goods_id = #{goodsId}</if>
             <if test=' this.has("goodsName") '>and goods_name = #{goodsName}</if>

+ 149 - 37
sp-server/src/main/java/com/pj/project/tb_business/TbBusinessService.java

@@ -62,6 +62,7 @@ import com.pj.project.tb_declare.TbDeclare;
 import com.pj.project.tb_declare.TbDeclareService;
 import com.pj.project.tb_deduction_bind.TbDeductionBind;
 import com.pj.project.tb_deduction_bind.TbDeductionBindService;
+import com.pj.project.tb_deduction_record.TbDeductionRecord;
 import com.pj.project.tb_driver.TbDriver;
 import com.pj.project.tb_driver.TbDriverService;
 import com.pj.project.tb_fee_details.TbFeeDetails;
@@ -69,6 +70,8 @@ import com.pj.project.tb_fee_details.TbFeeDetailsService;
 import com.pj.project.tb_fee_statistics.TbFeeStatisticsService;
 import com.pj.project.tb_goods.TbGoods;
 import com.pj.project.tb_goods.TbGoodsService;
+import com.pj.project.tb_invoice_order.TbInvoiceOrder;
+import com.pj.project.tb_invoice_order.TbInvoiceOrderService;
 import com.pj.project.tb_item.TbItem;
 import com.pj.project.tb_item.TbItemService;
 import com.pj.project.tb_item_fac.TbItemFac;
@@ -90,6 +93,7 @@ import com.pj.utils.cache.RedisUtil;
 import com.pj.utils.sg.AjaxJson;
 import com.pj.utils.so.SoMap;
 import lombok.extern.slf4j.Slf4j;
+import org.aspectj.weaver.loadtime.Aj;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Lazy;
 import org.springframework.stereotype.Service;
@@ -177,7 +181,7 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
     private TbFeeDetailsService tbFeeDetailsService;
 
     @Resource
-    private TbDeductionBindService tbDeductionBindService;
+    private TbInvoiceOrderService tbInvoiceOrderService;
     @Resource
     @Lazy
     private TbFeeStatisticsService tbFeeStatisticsService;
@@ -455,14 +459,11 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
 
         List<String> businessIdList = businessList.stream().map(TbBusiness::getId).collect(Collectors.toList());
         String businessIds = StrUtil.join(",", businessIdList);
+        long judgeCount = businessList.stream().filter(tbBusiness -> tbBusiness.getConfirmJudge() == CarEnum.ConfirmJudgeEnum.JUDGE_PASS.getCode()).count();
+        int size = businessList.size();
         result.put("showPay", true);
         result.put("businessId", businessIds);
-        result.put("noJudgeCount", 0);
-        if (CarEnum.BusinessTypeEnum.BUSINESS_CAR.getType().equals(tbBusinessCar.getBusinessType())) {
-            if (tbBusinessCar.getConfirmJudge() != CarEnum.ConfirmJudgeEnum.JUDGE_PASS.getCode()) {
-                result.put("noJudgeCount", 1);
-            }
-        }
+        result.put("noJudgeCount", judgeCount == size ? 0 : 1);
         List<TbBusinessItem> items = tbBusinessItemService.findByBusinessIdList(businessIdList);
         Date inTime = tbBusinessCar.getRealInTime();
         int pay = tbBusinessCar.getPay();
@@ -781,10 +782,6 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
             }
             //最新一条记录
             TbBusinessCar db = tbBusinessCarService.findTheLastRecord(carNo);
-            //存在并且未离场+已审核
-            if (db != null && db.getConfirmJudge() == CarEnum.ConfirmJudgeEnum.JUDGE_PASS.getCode() && db.getRealOutTime() == null) {
-                throw new BusinessException("车辆【" + carNo + "】已审核,请驳回再录入业务");
-            }
             if (!tbGoods.getName().contains("整车")) {
                 //记录不存在或者已离场
                 if (db == null || db.getRealOutTime() != null) {
@@ -839,15 +836,18 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
         String id = otherBusinessBO.getId();
         TbBusiness dbBusiness = this.getById(id);
         if (dbBusiness == null) {
-            throw new BusinessException("记录不存在");
+            throw new AjaxError("记录不存在");
+        }
+        if (dbBusiness.getConfirmJudge() == CarEnum.ConfirmJudgeEnum.JUDGE_PASS.getCode()) {
+            throw new AjaxError("业务已审核,请驳回后修改");
         }
         List<TbItem> tbItems = otherBusinessBO.getItems();
         if (tbItems.isEmpty()) {
-            throw new BusinessException("请选择收费明细");
+            throw new AjaxError("请选择收费明细");
         }
         List<TbBusinessCar> cars = otherBusinessBO.getCars();
         if (cars.isEmpty()) {
-            throw new BusinessException("作业车辆不能为空");
+            throw new AjaxError("作业车辆不能为空");
         }
 
         Date now = new Date();
@@ -914,16 +914,12 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
             if (StrUtil.isNotEmpty(businessCarId)) {
                 //原来已存在的
                 TbBusinessCar dbBusinessCar = tbBusinessCarService.getById(businessCarId);
-                if (dbBusinessCar.getConfirmJudge() == CarEnum.ConfirmJudgeEnum.JUDGE_PASS.getCode()) {
-                    throw new BusinessException("车辆【" + carNo + "】已审核,请驳回再录入业务");
-                }
                 //如果修改了车牌号
                 String dbCarNo = dbBusinessCar.getCarNo();
                 if (!dbCarNo.equals(carNo)) {
                     //把关联删除掉,然后添加新的关联
                     relationBusinessCarService.removeByBusinessIdAndCarId(dbBusiness.getId(), businessCarId);
                     TbBusinessCar otherCar = tbBusinessCarService.findTheLastRecord(carNo);
-
                     if (otherCar == null ||//不存在或者已离场===>新建
                             (otherCar.getRealInTime() != null && otherCar.getRealOutTime() != null)) {
                         otherCar = new TbBusinessCar();
@@ -950,12 +946,6 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
                 }
             } else {
                 TbBusinessCar checkCar = tbBusinessCarService.findTheLastRecord(carNo);
-                //存在+审核+未离场的
-                if (checkCar != null
-                        && checkCar.getConfirmJudge() == CarEnum.ConfirmJudgeEnum.JUDGE_PASS.getCode()
-                        && checkCar.getRealOutTime() == null) {
-                    throw new BusinessException("车辆【" + carNo + "】已审核,请驳回再录入业务");
-                }
                 //不存在或者已经离场的
                 if (checkCar == null ||
                         (checkCar.getRealInTime() != null && checkCar.getRealOutTime() != null)) {
@@ -978,14 +968,14 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
             dbBusiness.setGoodsId(otherBusinessBO.getGoodsId())
                     .setGoodsName(tbGoods.getName()).setPayStep(tbGoods.getPayStep());
         }
-        String customerId=otherBusinessBO.getCustomerId();
-        if (StrUtil.isNotEmpty(customerId)){
-            TbCostomer tbCostomer=tbCostomerService.getById(customerId);
+        String customerId = otherBusinessBO.getCustomerId();
+        if (StrUtil.isNotEmpty(customerId)) {
+            TbCostomer tbCostomer = tbCostomerService.getById(customerId);
             dbBusiness.setCustomerId(customerId).setCustomerName(tbCostomer.getName());
         }
-        String pickCustomerId=otherBusinessBO.getPickCustomerId();
-        if (StrUtil.isNotEmpty(pickCustomerId)){
-            TbCostomer tbCostomer=tbCostomerService.getById(pickCustomerId);
+        String pickCustomerId = otherBusinessBO.getPickCustomerId();
+        if (StrUtil.isNotEmpty(pickCustomerId)) {
+            TbCostomer tbCostomer = tbCostomerService.getById(pickCustomerId);
             dbBusiness.setPickCustomerId(pickCustomerId).setPickCustomerName(tbCostomer.getName());
         }
 
@@ -1006,11 +996,10 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
 
     public void bindOtherBusinessCar(String businessId, List<String> businessCarIdList) {
         TbBusiness tbBusiness = this.getById(businessId);
-        List<TbBusinessCar> list = tbBusinessCarService.findOtherBusinessCar(businessId);
-        long count = list.stream().filter(tbBusinessCar -> tbBusinessCar.getConfirmJudge() == 1).count();
-        if (count > 0) {
-            throw new AjaxError("业务已审核,请先驳回审核");
+        if (tbBusiness.getConfirmJudge() == CarEnum.ConfirmJudgeEnum.JUDGE_PASS.getCode()) {
+            throw new AjaxError("业务已审核,请先驳回");
         }
+        List<TbBusinessCar> list = tbBusinessCarService.findOtherBusinessCar(businessId);
         list.stream().filter(tbBusinessCar -> !businessCarIdList.contains(tbBusinessCar.getId()) && tbBusinessCar.getRealInTime() == null)
                 .forEach(tbBusinessCar -> tbBusinessCarService.removeById(tbBusinessCar.getId()));
         relationBusinessCarService.removeByBusinessId(businessId);
@@ -1538,6 +1527,9 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
     public void addBusinessCar(TbBusinessCar tbBusinessCar) {
         String businessId = tbBusinessCar.getBusinessId();
         TbBusiness tbBusiness = this.getById(businessId);
+        if (tbBusiness.getConfirmJudge() == CarEnum.ConfirmJudgeEnum.JUDGE_PASS.getCode()) {
+            throw new AjaxError("业务已审核,不能绑定新车辆");
+        }
         String carNo = tbBusinessCar.getCarNo().trim().toUpperCase();
         TbBusinessCar lastRecord = tbBusinessCarService.findTheLastRecord(carNo);
         String businessCarId;
@@ -1556,8 +1548,10 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
             businessCarId = tbBusinessCar.getId();
         } else {
             businessCarId = lastRecord.getId();
-            lastRecord.setPayType(CarEnum.PayTypeEnum.NO_PAY_TYPE.getType()).setCustomerId(tbBusiness.getCustomerId())
-                    .setCarNo(carNo).setConfirmJudge(CarEnum.ConfirmJudgeEnum.NO_JUDGE.getCode()).setPayUnloadMoney(0)
+            lastRecord.setPayType(CarEnum.PayTypeEnum.NO_PAY_TYPE.getType())
+                    .setCustomerId(tbBusiness.getCustomerId())
+                    .setCarNo(carNo).setConfirmJudge(CarEnum.ConfirmJudgeEnum.NO_JUDGE.getCode())
+                    .setPayUnloadMoney(lastRecord.getPayUnloadMoney())
                     .setTimeUpdate(now)
                     .setBusinessType(CarEnum.BusinessTypeEnum.BUSINESS_CAR.getType());
             tbBusinessCarService.updateById(lastRecord);
@@ -1586,4 +1580,122 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
             }
         }
     }
-}
+
+    /**
+     * 审核通过
+     * @param id
+     */
+    public void confirmJudgePass(String id) {
+        TbBusiness tbBusiness = this.getById(id);
+        if (tbBusiness == null) {
+            throw new AjaxError("业务不存在");
+        }
+        Date now = new Date();
+        List<TbBusinessCar> tbBusinessCars = tbBusinessCarService.findOtherBusinessCar(tbBusiness.getId());
+        //审核
+        List<TbBusinessItem> tbBusinessItems = tbBusinessItemService.findByBusinessId(tbBusiness.getId());
+        String customerId = tbBusiness.getPickCustomerId();
+        TbAccount tbAccount = tbAccountService.getAccountByCustomerId(customerId);
+        for (TbBusinessCar tbBusinessCar : tbBusinessCars) {
+            for (TbBusinessItem item : tbBusinessItems) {
+                String itemName = item.getItemName();
+                // todo 扣除 人工、机械装卸车辆---->每辆车都要支付----->
+                if (SystemObject.config.getEveryCarPay().contains(itemName) && tbBusinessCar.getPayUnloadMoney() == 0) {
+                    List<IOrderItem> expenses = new ArrayList<>();
+                    IOrderItem orderItem = new IOrderItem();
+                    orderItem.setExpenseNum(Integer.parseInt(item.getNum()))
+                            .setUniqExpenseId(item.getItemCode());
+                    expenses.add(orderItem);
+                    IOrderPriceRes res = syncService.orderPriceCal(expenses);
+                    BigDecimal price = res.getTotalOrderPrice();
+                    BigDecimal balance = tbAccount.getTotalMoney();
+                    if (price.compareTo(balance) > 0) {
+                        throw new AjaxError("[" + tbAccount.getCustomerName() + "]账户余额不足扣除" + item.getItemName());
+                    } else {
+                        tbBusinessCar.setPayUnloadMoney(1);
+                        tbBusinessCarService.updateById(tbBusinessCar);
+                        item.setPayTime(now).setPayStatus(1).setPayType(PayEnum.PayType.PER_PAY.getCode())
+                                .setPayTypeName(PayEnum.PayType.PER_PAY.getDesc());
+                        tbBusinessItemService.updateById(item);
+                        tbBusiness.setPayMoney(price.add(tbBusiness.getPayMoney()));
+                        BigDecimal afterBalance = balance.subtract(price);
+                        tbAccount.setTotalMoney(afterBalance);//增加累计扣款
+                        tbAccountService.updateById(tbAccount);
+                        TbFeeDetails details = tbFeeDetailsService.savePrePayDetails(res, item, tbBusinessCar, tbBusiness, FeeTypeEnum.STEVEDORE_FEE);
+                        tbFeeStatisticsService.addOrUpdateStatistic(now, PayEnum.PayType.PER_PAY.getCode());//更新当前日期的日统计
+                        TbDeductionRecord record=  automaticPay.createTbDeductionRecord(details, balance, afterBalance, tbBusiness.getPickCustomerId(), tbBusiness.getPickCustomerName(), tbBusinessCar.getCarNo(), tbBusinessCar.getId(), FeeTypeEnum.STEVEDORE_FEE);
+                        addInvoiceOrder(tbBusiness, res.getTotalOrderPrice(),details,record);
+                    }
+                }
+            }
+        }
+        //其他费项 装卸业务管理费” 进行预存款扣除
+        for (TbBusinessItem item : tbBusinessItems) {
+            //业务类型是装卸业务管理费且未支付的进行扣款
+            if (item.getPayStatus() == 0 && SystemObject.config.getUnLoadItem().contains(item.getItemTypeName())) {
+                List<IOrderItem> expenses = new ArrayList<>();
+                IOrderItem orderItem = new IOrderItem();
+                orderItem.setExpenseNum(Integer.parseInt(item.getNum()))
+                        .setUniqExpenseId(item.getItemCode());
+                expenses.add(orderItem);
+                IOrderPriceRes res = syncService.orderPriceCal(expenses);
+                BigDecimal price = res.getTotalOrderPrice();
+                BigDecimal balance = tbAccount.getTotalMoney();
+                if (price.compareTo(balance) > 0) {
+                    throw new AjaxError("[" + tbAccount.getCustomerName() + "]账户余额不足扣除" + item.getItemName());
+                } else {
+                    BigDecimal afterBalance = balance.subtract(price);
+                    tbAccount.setTotalMoney(afterBalance);//增加累计扣款
+                    tbAccountService.updateById(tbAccount);
+                    item.setPayTime(now).setPayStatus(1).setPayType(PayEnum.PayType.PER_PAY.getCode())
+                            .setPayTypeName(PayEnum.PayType.PER_PAY.getDesc());
+                    tbBusinessItemService.updateById(item);
+                    tbBusiness.setPayMoney(price.add(tbBusiness.getPayMoney()));
+                    //查找越南车--->统计以
+                    TbBusinessCar tbBusinessCar = tbBusinessCars.stream().filter(car -> !CAR_LIST.contains(car.getCarNo().substring(0, 1)))
+                            .findAny().orElse(tbBusinessCars.get(0));
+                    TbFeeDetails details = tbFeeDetailsService.savePrePayDetails(res, item, tbBusinessCar, tbBusiness, FeeTypeEnum.STEVEDORE_FEE);
+                    tbFeeStatisticsService.addOrUpdateStatistic(now, PayEnum.PayType.PER_PAY.getCode());//更新当前日期的日统计
+                    TbDeductionRecord record=  automaticPay.createTbDeductionRecord(details, balance, afterBalance, tbBusiness.getPickCustomerId(), tbBusiness.getPickCustomerName(), tbBusinessCar.getCarNo(), tbBusinessCar.getId(), FeeTypeEnum.STEVEDORE_FEE);
+                    addInvoiceOrder(tbBusiness, res.getTotalOrderPrice(),details,record);
+                }
+            }
+        }
+        tbBusiness.setConfirmJudgeTime(now).setConfirmJudgeContent("审核通过")
+                .setConfirmJudge(CarEnum.ConfirmJudgeEnum.JUDGE_PASS.getCode())
+                .setJudgeBy(StpUserUtil.getCreateBy()).setPayTime(now);
+        this.updateById(tbBusiness);
+    }
+
+    /**
+     * 添加开票订单
+     * @param tbBusiness
+     * @param billMoney
+     */
+    private void addInvoiceOrder(TbBusiness tbBusiness, BigDecimal billMoney,TbFeeDetails details,TbDeductionRecord record) {
+        TbInvoiceOrder t = new TbInvoiceOrder();
+        t.setBusinessName(tbBusiness.getGoodsName())
+                .setBusinessNo(tbBusiness.getNo())
+                .setCarNo(tbBusiness.getCarNoStr())
+                .setBusinessId(tbBusiness.getId())
+                .setCustomerId(tbBusiness.getCustomerId())
+                .setBillMoney(billMoney).setDetailId(details.getId())
+                .setPreOrderNum(details.getPreOrderNum())
+                .setDeductionRecordId(record.getId())
+                .setStatus(0).setCreateTime(new Date());
+        tbInvoiceOrderService.save(t);
+    }
+
+    /**
+     * 审核驳回
+     * @param id
+     * @param judgeContent
+     */
+    public void callback(String id, String judgeContent) {
+        TbBusiness db = this.getById(id);
+        db.setConfirmJudge(CarEnum.ConfirmJudgeEnum.CALL_BACK.getCode())
+                .setConfirmJudgeContent(judgeContent).setConfirmJudgeTime(new Date())
+                .setJudgeBy(StpUserUtil.getCreateBy());
+        this.updateById(db);
+    }
+}

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

@@ -218,6 +218,7 @@ public class TbBusinessCarController {
      */
     @RequestMapping("confirmJudgePass")
     @SaCheckPermission(TbBusinessCar.PERMISSION__JUDGE)
+    @Deprecated
     public AjaxJson confirmJudge() {
         SoMap soMap = SoMap.getRequestSoMap();
         String id = soMap.getString("id");
@@ -238,7 +239,6 @@ public class TbBusinessCarController {
         String judgeContent = soMap.getString("judgeContent");
         tbBusinessCarService.callback(id,judgeContent);
         return AjaxJson.getSuccess();
-
     }
     @RequestMapping("getListByCarId")
     public AjaxJson getListByCarId(String businessCarId) {

+ 0 - 10
sp-server/src/main/java/com/pj/project/tb_business_car/TbBusinessCarService.java

@@ -495,16 +495,6 @@ public class TbBusinessCarService extends ServiceImpl<TbBusinessCarMapper, TbBus
                 .setConfirmJudgeContent(judgeContent).setConfirmJudgeTime(new Date())
                 .setConfirmJudgeBy(StpUserUtil.getCreateBy());
         this.updateById(db);
-        List<TbBusiness> businessList = tbBusinessService.findOtherBusinessByCarId(id);
-        businessList.forEach(tbBusiness -> {
-            List<TbBusinessCar> tbBusinessCars = this.findOtherBusinessCar(tbBusiness.getId());
-            tbBusinessCars.stream().filter(tbBusinessCar -> !StrUtil.equals(tbBusinessCar.getId(), id)).forEach(tbBusinessCar -> {
-                tbBusinessCar.setConfirmJudge(CarEnum.ConfirmJudgeEnum.CALL_BACK.getCode())
-                        .setConfirmJudgeContent(judgeContent).setConfirmJudgeTime(new Date())
-                        .setConfirmJudgeBy(StpUserUtil.getCreateBy());
-                this.updateById(tbBusinessCar);
-            });
-        });
     }
 
     /**

+ 13 - 1
sp-server/src/main/java/com/pj/project/tb_deduction_record/TbDeductionRecordController.java

@@ -1,6 +1,7 @@
 package com.pj.project.tb_deduction_record;
 
 import cn.dev33.satoken.annotation.SaCheckPermission;
+import com.pj.constants.UserTypeEnum;
 import com.pj.current.satoken.StpUserUtil;
 import com.pj.project.tb_charge_record.TbChargeRecord;
 import com.pj.project4sp.SP;
@@ -49,6 +50,10 @@ public class TbDeductionRecordController {
 	@RequestMapping("getList")
 	public AjaxJson getList() { 
 		SoMap so = SoMap.getRequestSoMap();
+		String currentCustomerId = StpUserUtil.getCustomerId();
+		if (!currentCustomerId.equals(UserTypeEnum.PLATFORM_ADMIN.getCustomerId())) {
+			so.put("customerId", currentCustomerId);
+		}
 		List<TbDeductionRecord> list = tbDeductionRecordService.getList(so.startPage());
 		return AjaxJson.getPageData(so.getDataCount(), list);
 	}
@@ -85,14 +90,21 @@ public class TbDeductionRecordController {
 	@SaCheckPermission(TbDeductionRecord.PERMISSION_LIST_EXPORT)
 	public AjaxJson export() {
 		SoMap so = SoMap.getRequestSoMap();
+		String currentCustomerId = StpUserUtil.getCustomerId();
+		if (!currentCustomerId.equals(UserTypeEnum.PLATFORM_ADMIN.getCustomerId())) {
+			so.put("customerId", currentCustomerId);
+		}
 		String url = tbDeductionRecordService.export(so);
 		return AjaxJson.getSuccessData(url);
 	}
 
 	@RequestMapping("getSum")
-	@SaCheckPermission(TbDeductionRecord.PERMISSION_LIST_EXPORT)
 	public AjaxJson getSum() {
 		SoMap so = SoMap.getRequestSoMap();
+		String currentCustomerId = StpUserUtil.getCustomerId();
+		if (!currentCustomerId.equals(UserTypeEnum.PLATFORM_ADMIN.getCustomerId())) {
+			so.put("customerId", currentCustomerId);
+		}
 		return AjaxJson.getSuccessData(tbDeductionRecordService.getSum(so));
 	}
 	

+ 7 - 2
sp-server/src/main/java/com/pj/project/tb_deduction_record/TbDeductionRecordMapper.xml

@@ -151,6 +151,7 @@
 		<where>
 			<if test=' this.has("id") '> and id = #{id} </if>
 			<if test=' this.has("businessId") '> and business_id = #{businessId} </if>
+			<if test=' this.has("customerId") '> and customer_id = #{customerId} </if>
 			<if test=' this.has("status") and status !=-1 '> and status = #{status} </if>
 			<if test=' this.has("businessNo") '> and business_no like "%" #{businessNo} "%" </if>
 			<if test=' this.has("carNo") '> and car_no like "%" #{carNo} "%" </if>
@@ -195,8 +196,12 @@
 			<if test=' this.has("originalMoney") '> and original_money = #{originalMoney} </if>
 			<if test=' this.has("totalMoney") '> and total_money = #{totalMoney} </if>
 			<if test=' this.has("reviewStatus") and reviewStatus!=2 '> and review_status = #{reviewStatus} </if>
-			<if test=' this.has("startTime") '> and date(pay_time) between #{startTime} and #{endTime} </if>
-
+			<if test=' this.has("startTime") '>
+			 and date_format(pay_time,'%Y-%m-%d') &gt;=#{startTime}
+			  </if>
+			<if test=' this.has("endTime") '>
+				and date_format(pay_time,'%Y-%m-%d') &lt;=#{endTime}
+			</if>
 		</where>
 		order by
 		<choose>

+ 19 - 13
sp-server/src/main/java/com/pj/project/tb_deduction_record/TbDeductionRecordService.java

@@ -4,6 +4,7 @@ import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.io.FileUtil;
 import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.core.util.RandomUtil;
+import cn.hutool.core.util.StrUtil;
 import cn.hutool.http.HttpUtil;
 import cn.hutool.json.JSONArray;
 import cn.hutool.json.JSONUtil;
@@ -26,6 +27,9 @@ import com.pj.project.tb_business_item.TbBusinessItemService;
 import com.pj.project.tb_charge_record.TbChargeRecord;
 import com.pj.project.tb_charge_record.TbChargeRecordMapper;
 import com.pj.project.tb_charge_record.TbChargeRecordService;
+import com.pj.project.tb_invoice_info.TbInvoiceInfoService;
+import com.pj.project.tb_invoice_order.TbInvoiceOrder;
+import com.pj.project.tb_invoice_order.TbInvoiceOrderService;
 import com.pj.project.tb_mild_car.TbMildCar;
 import com.pj.project.tb_refund_record.TbRefundRecord;
 import com.pj.project.tb_refund_record.TbRefundRecordService;
@@ -74,6 +78,10 @@ public class TbDeductionRecordService extends ServiceImpl<TbDeductionRecordMappe
     private TbRefundRecordService tbRefundRecordService;
     @Resource
     private UploadConfig uploadConfig;
+    @Resource
+    private TbInvoiceOrderService tbInvoiceOrderService;
+    @Resource
+    private TbInvoiceInfoService tbInvoiceInfoService;
 
     /**
      * 增
@@ -112,17 +120,6 @@ public class TbDeductionRecordService extends ServiceImpl<TbDeductionRecordMappe
      * 查集合 - 根据条件(参数为空时代表忽略指定条件)
      */
     List<TbDeductionRecord> getList(SoMap so) {
-        String customerId = StpUserUtil.getCustomerId();
-        if (!UserTypeEnum.PLATFORM_ADMIN.getCustomerId().equals(customerId)) {
-            so.put("customerId", customerId);
-        }
-        if (ObjectUtil.isNotEmpty(so.get("parTime[]"))) {
-            JSONArray jsonArray = JSONUtil.parseArray(so.getString("parTime[]"));
-            if (jsonArray.size() == 2) {
-                so.put("startTime", jsonArray.get(0));
-                so.put("endTime", jsonArray.get(1));
-            }
-        }
         return tbDeductionRecordMapper.getList(so);
     }
 
@@ -144,6 +141,14 @@ public class TbDeductionRecordService extends ServiceImpl<TbDeductionRecordMappe
         if (record == null) {
             throw new AjaxError("记录不存在");
         }
+        TbInvoiceOrder order = tbInvoiceOrderService.findByRecord(record.getId());
+        if (order != null) {
+            if ((order.getStatus() == 2 || StrUtil.isNotEmpty(order.getInfoId()))) {
+                throw new AjaxError("订单已开发票,不允许设置为异常单");
+            }
+            tbInvoiceOrderService.removeById(order.getId());
+            tbInvoiceInfoService.removeById(order.getInfoId());
+        }
         String businessId = record.getBusinessId();
         TbBusiness tbBusiness = tbBusinessService.getById(businessId);
         tbBusiness.setHasError(1);
@@ -232,7 +237,8 @@ public class TbDeductionRecordService extends ServiceImpl<TbDeductionRecordMappe
     }
 
     /**
-     *某个时间段的扣款记录
+     * 某个时间段的扣款记录
+     *
      * @param eDay
      * @return
      */
@@ -266,6 +272,6 @@ public class TbDeductionRecordService extends ServiceImpl<TbDeductionRecordMappe
 
     public Double getSum(SoMap so) {
         List<TbDeductionRecord> list = tbDeductionRecordMapper.getList(so);
-        return   list.stream().collect(Collectors.summarizingDouble(record->record.getDeductMoney().doubleValue())).getSum();
+        return list.stream().collect(Collectors.summarizingDouble(record -> record.getDeductMoney().doubleValue())).getSum();
     }
 }

+ 15 - 4
sp-server/src/main/java/com/pj/project/tb_fee_details/TbFeeDetailsMapper.xml

@@ -139,23 +139,34 @@
         SELECT SUM(item_price) as item_price_sum, SUM(tax_price) as tax_price_sum, SUM(no_tax_price) as no_tax_price_sum
         FROM tb_fee_details
         <where>
+            <if test=' this.has("id") '>and id = #{id}</if>
+            <if test=' this.has("businessId") '>and business_id = #{businessId}</if>
+
+            <if test=' this.has("businessNo") '>and (business_no like concat('%',#{businessNo},'%')
+                or business_car_no like concat('%',#{businessNo},'%'))
+            </if>
             <if test=' this.has("carNo") '>and car_no like concat('%',#{carNo},'%')</if>
+            <if test=' this.has("transactionId") '>and transaction_id like concat('%',#{transactionId},'%')</if>
+            <if test=' this.has("pickCustomerName") '>and pick_customer_name like concat('%',#{pickCustomerName},'%')
+            </if>
             <if test=' this.has("feeType") '>and fee_type = #{feeType}</if>
             <if test=' this.has("itemTypeId") '>and item_type_id = #{itemTypeId}</if>
             <if test=' this.has("itemTypeName") '>and item_type_name = #{itemTypeName}</if>
             <if test=' this.has("itemId") '>and item_id = #{itemId}</if>
-            <if test=' this.has("transactionId") '>and transaction_id = #{transactionId}</if>
-            <if test=' this.has("itemName") '>and item_name = #{itemName}</if>
+            <if test=' this.has("itemName") '>and item_name like concat('%',#{itemName},'%')</if>
+            <if test=' this.has("itemPrice") '>and item_price = #{itemPrice}</if>
             <if test=' this.has("payDay") '>and pay_day = #{payDay}</if>
             <if test=' this.has("payType") '>and pay_type = #{payType}</if>
             <if test=' this.has("createTime") '>and create_time = #{createTime}</if>
-            <if test=' this.has("pickCustomerName") '>and pick_customer_name like concat('%',#{pickCustomerName},'%')
-            </if>
             <if test=' this.has("beginTime") and this.has("endTime") '>
                 and pay_day >= #{beginTime}
                 and pay_day &lt;= #{endTime}
             </if>
             <if test=' this.has("type")'>and fee_type in (${type})</if>
+            <if test=' this.has("isInvoice")'>
+                <if test=' isInvoice == 0'>and invoice is null</if>
+                <if test=' isInvoice == 1'>and invoice is not null</if>
+            </if>
         </where>
     </select>
 

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

@@ -400,7 +400,7 @@ public class TbFeeDetailsService extends ServiceImpl<TbFeeDetailsMapper, TbFeeDe
             detailDTO.setBusinessNo(feeDetails.getBusinessNo()).setCarNo(feeDetails.getCarNo())
                     .setFeeType(tbFeeItem.getName()).setItemTypeName(feeDetails.getItemTypeName())
                     .setItemName(feeDetails.getItemName()).setItemPrice(feeDetails.getItemPrice())
-                    .setPayType(PayEnum.PayType.WX_PAY.getDesc()).setIndex(index++)
+                    .setPayType(PayEnum.PayType.getDescByCode(feeDetails.getPayType())).setIndex(index++)
                     .setPayMode(PayEnum.PayType.CASH_PAY.getDesc())
                     .setWeight(feeDetails.getWeight()).setNum(feeDetails.getNum()).setUnitPrice(feeDetails.getUnitPrice())
                     .setSettle("已结算").setTaxRate(feeDetails.getTaxRate().multiply(new BigDecimal(100)))
@@ -528,7 +528,7 @@ public class TbFeeDetailsService extends ServiceImpl<TbFeeDetailsMapper, TbFeeDe
                     .setFeeType(tbFeeItem.getName()).setItemTypeName(feeDetails.getItemTypeName())
                     .setItemName(feeDetails.getItemName()).setItemPrice(feeDetails.getItemPrice())
                     .setPayType(PayEnum.PayType.getDescByCode(feeDetails.getPayType())).setIndex(index++)
-                    .setPayMode("直接收款")
+                    .setPayMode(PayEnum.PayType.getDescByCode(feeDetails.getPayType()))
                     .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())

+ 4 - 0
sp-server/src/main/java/com/pj/project/tb_invoice_order/TbInvoiceOrder.java

@@ -112,6 +112,10 @@ public class TbInvoiceOrder implements Serializable {
      * 开票信息明细Id
      */
     public String detailId;
+	/**
+	 * 扣费记录ID
+	 */
+	public String deductionRecordId;
 
 
 

+ 5 - 0
sp-server/src/main/java/com/pj/project/tb_invoice_order/TbInvoiceOrderService.java

@@ -326,4 +326,9 @@ public class TbInvoiceOrderService extends ServiceImpl<TbInvoiceOrderMapper, TbI
         return list(ew);
     }
 
+    public TbInvoiceOrder findByRecord(String recordId) {
+        QueryWrapper<TbInvoiceOrder> ew = new QueryWrapper<>();
+        ew.lambda().eq(TbInvoiceOrder::getDeductionRecordId,recordId);
+        return getOne(ew);
+    }
 }

+ 9 - 0
sp-server/src/main/java/com/pj/project/tb_refund_record/TbRefundRecordController.java

@@ -2,6 +2,7 @@ package com.pj.project.tb_refund_record;
 
 import java.util.List;
 
+import com.pj.constants.UserTypeEnum;
 import com.pj.utils.so.SoMap;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.transaction.annotation.Transactional;
@@ -31,6 +32,10 @@ public class TbRefundRecordController {
 	@RequestMapping("getList")
 	public AjaxJson getList() { 
 		SoMap so = SoMap.getRequestSoMap();
+		String currentCustomerId = StpUserUtil.getCustomerId();
+		if (!currentCustomerId.equals(UserTypeEnum.PLATFORM_ADMIN.getCustomerId())) {
+			so.put("customerId", currentCustomerId);
+		}
 		List<TbRefundRecord> list = tbRefundRecordService.getList(so.startPage());
 		return AjaxJson.getPageData(so.getDataCount(), list);
 	}
@@ -38,6 +43,10 @@ public class TbRefundRecordController {
 	@SaCheckPermission(value = TbRefundRecord.PERMISSION_CODE_EXPORT)
 	public AjaxJson export() {
 		SoMap so = SoMap.getRequestSoMap();
+		String currentCustomerId = StpUserUtil.getCustomerId();
+		if (!currentCustomerId.equals(UserTypeEnum.PLATFORM_ADMIN.getCustomerId())) {
+			so.put("customerId", currentCustomerId);
+		}
 		String url = tbRefundRecordService.export(so);
 		return AjaxJson.getSuccessData(url);
 	}

+ 1 - 1
sp-server/src/main/java/com/pj/utils/sg/AjaxJson.java

@@ -177,7 +177,7 @@ public class AjaxJson extends LinkedHashMap<String, Object> implements Serializa
      * 返回成功
      */
     public static AjaxJson getSuccess() {
-        return new AjaxJson(CODE_SUCCESS, "ok", null, null);
+        return new AjaxJson(CODE_SUCCESS, "操作成功", null, null);
     }
 
     public static AjaxJson getSuccess(String msg) {

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

@@ -100,7 +100,7 @@ ocr-config:
     bash: /opt/ocrpic/tesseract.sh
     analysis: /opt/ocrpic/ocrtxt/PIC_NAME.txt
 pushfee-config:
-    enable: false
+    enable: true
     remote-public-key-base6: MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCb5yK85EKqwiQU+z1jyjOng6ecssQpEjC6STbCuSWN6KHLkijBxdqrCumXhbIyOVx4lHK9Rg5EjzlQxoaXQTgJdItaGjLC+UTE+NNAnnaFLg0x4jajNpLo473zdZxTYQaT3q/aKnTeXuKHw11PPUe4hmmfxPcdt9yJ0Iqo/XxV3QIDAQAB
     sync-url: http://117.141.148.233:3101/gateway/
     sys-id: "0110"