Ver código fonte

Merge branch 'dev' into debug

qzyReal 3 anos atrás
pai
commit
c6e281cb6a
48 arquivos alterados com 1385 adições e 288 exclusões
  1. 13 4
      app/pages/wx/pay.vue
  2. 3 6
      sp-admin/sa-view/car/tb-business-car-list.html
  3. 21 3
      sp-admin/sa-view/tb-business-car/tb-business-car-add.html
  4. 8 10
      sp-admin/sa-view/tb-business-car/tb-business-car-info.html
  5. 79 18
      sp-admin/sa-view/tb-business-car/tb-business-car-list.html
  6. 2 7
      sp-admin/sa-view/tb-business/tb-business-info.html
  7. 3 2
      sp-admin/sa-view/tb-car/tb-car-list.html
  8. 67 14
      sp-admin/sa-view/tb-fee-statistics/tb-fee-details-list.html
  9. 6 1
      sp-admin/sa-view/tb-fee-statistics/tb-fee-statistics-list.html
  10. 0 0
      sp-admin/static/excel/car-import.xlsx
  11. 0 1
      sp-server/app.pid
  12. 0 1
      sp-server/src/main/java/com/pj/api/h5/ApiController.java
  13. 94 0
      sp-server/src/main/java/com/pj/api/open/bo/InRecordBO.java
  14. 58 0
      sp-server/src/main/java/com/pj/api/open/service/CoverBase64ToImageTask.java
  15. 86 15
      sp-server/src/main/java/com/pj/api/open/service/OpenService.java
  16. 10 0
      sp-server/src/main/java/com/pj/api/open/web/OpenController.java
  17. 12 8
      sp-server/src/main/java/com/pj/api/service/ApiService.java
  18. 5 4
      sp-server/src/main/java/com/pj/api/wx/service/WxService.java
  19. 1 0
      sp-server/src/main/java/com/pj/project/tb_business/TbBusiness.java
  20. 9 1
      sp-server/src/main/java/com/pj/project/tb_business/TbBusinessController.java
  21. 52 21
      sp-server/src/main/java/com/pj/project/tb_business/TbBusinessService.java
  22. 41 0
      sp-server/src/main/java/com/pj/project/tb_business_car/ExportTbBusinessDTO.java
  23. 103 89
      sp-server/src/main/java/com/pj/project/tb_business_car/TbBusinessCar.java
  24. 7 21
      sp-server/src/main/java/com/pj/project/tb_business_car/TbBusinessCarController.java
  25. 21 2
      sp-server/src/main/java/com/pj/project/tb_business_car/TbBusinessCarMapper.xml
  26. 95 19
      sp-server/src/main/java/com/pj/project/tb_business_car/TbBusinessCarService.java
  27. 6 0
      sp-server/src/main/java/com/pj/project/tb_business_people/TbBusinessPeopleService.java
  28. 1 1
      sp-server/src/main/java/com/pj/project/tb_car/ImportCarListener.java
  29. 1 0
      sp-server/src/main/java/com/pj/project/tb_car/TbCar.java
  30. 13 0
      sp-server/src/main/java/com/pj/project/tb_car/TbCarService.java
  31. 60 0
      sp-server/src/main/java/com/pj/project/tb_car_no_color/TbCarNoColor.java
  32. 105 0
      sp-server/src/main/java/com/pj/project/tb_car_no_color/TbCarNoColorController.java
  33. 56 0
      sp-server/src/main/java/com/pj/project/tb_car_no_color/TbCarNoColorMapper.java
  34. 76 0
      sp-server/src/main/java/com/pj/project/tb_car_no_color/TbCarNoColorMapper.xml
  35. 58 0
      sp-server/src/main/java/com/pj/project/tb_car_no_color/TbCarNoColorService.java
  36. 49 0
      sp-server/src/main/java/com/pj/project/tb_car_no_color/TbCarNoColorUtil.java
  37. 2 0
      sp-server/src/main/java/com/pj/project/tb_declare/TbDeclareMapper.java
  38. 3 0
      sp-server/src/main/java/com/pj/project/tb_declare/TbDeclareMapper.xml
  39. 10 0
      sp-server/src/main/java/com/pj/project/tb_declare/TbDeclareService.java
  40. 2 0
      sp-server/src/main/java/com/pj/project/tb_fee_details/ExportFeeDetailDTO.java
  41. 13 1
      sp-server/src/main/java/com/pj/project/tb_fee_details/TbFeeDetails.java
  42. 62 19
      sp-server/src/main/java/com/pj/project/tb_fee_details/TbFeeDetailsService.java
  43. 1 1
      sp-server/src/main/java/com/pj/project/tb_fee_statistics/TbFeeStatistics.java
  44. 40 18
      sp-server/src/main/java/com/pj/project/tb_fee_statistics/TbFeeStatisticsService.java
  45. 30 0
      sp-server/src/main/java/com/pj/utils/ImageUtils.java
  46. 1 1
      sp-server/src/main/resources/application-dev.yml
  47. BIN
      sp-server/src/main/resources/static/day-fee-new.xlsx
  48. BIN
      sp-server/src/main/resources/static/day-fee.xlsx

+ 13 - 4
app/pages/wx/pay.vue

@@ -25,7 +25,7 @@
 						<label class="c-item">
 							<view class="l">
 								<u-checkbox :customStyle="{marginBottom: '8px'}" :name="item.id"
-									:disabled="item.pay==1">
+									:disabled="item.price==0">
 								</u-checkbox>
 							</view>
 							<view class="c">{{item.carNo}}</view>
@@ -91,6 +91,7 @@
 				state: '',
 				list: [],
 				cars: [],
+				type:0,
 				businessAble: true,
 				item: {
 					itemsPrice: 0,
@@ -177,6 +178,7 @@
 			confirmPayFn() {
 				let carIds = this.carsSelect
 				let cars = this.cars.filter(obj => carIds.indexOf(obj.id) !== -1);
+				let carNos=this.cars.map(obj=>obj.carNo).join('、')
 				let p = {
 					b: this.businessSelect.length > 0 ? this.item.businessId : '',
 					c: JSON.stringify(cars.map(obj => {
@@ -189,10 +191,16 @@
 					tradeType: "JSAPI",
 					openid: this.openid
 				}
-				p.desc=p.b?'A1-业务费用':'A1-停车费';
+				let type=this.type;
+				let con='A1停车费';
+				if(type==2){
+					con='A1整车业务';
+				}else if(type==1){
+					con='A1车辆消杀'
+				}
+				p.desc=con+'-'+carNos;
 				this.$api.getPrePay(this.$common.removeNull(p)).then(resp => {
 					let data = resp.data;
-					console.log(data);
 					let that = this;
 					jweixin.chooseWXPay({
 						timestamp: data
@@ -237,8 +245,9 @@
 				}).then(resp => {
 					let data = resp.data;
 					this.cars = data.carList;
+					this.type=data.type;
 					let list = data.itemList;
-					this.carsSelect = this.cars.filter(obj => obj.id == carId && obj.pay == 0).map(obj => obj.id)
+					this.carsSelect = this.cars.filter(obj => obj.id == carId &&obj.price>0).map(obj => obj.id)
 					Object.assign(this.item, {
 						itemsPrice: data.itemsPrice,
 						businessId: data.businessId,

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

@@ -37,12 +37,7 @@
 							<el-button type="primary" @click="checkFn(s.row)">查看</el-button>
 						</template>
 					</el-table-column>
-					<el-table-column label="预交停车费">
-						<template slot-scope="s">
-							<label>{{s.row.basePartMoney}}</label>
-						</template>
-					</el-table-column>
-					<el-table-column label="已交费用">
+					<el-table-column label="停车费">
 						<template slot-scope="s">
 							<label v-if="s.row.money">{{s.row.money}}</label>
 							<label v-else>-</label>
@@ -203,6 +198,7 @@
 							sa.error('请填写入场通道')
 							return;
 						}
+						this.out.form.timeUpdate=sa.forDatetime(new Date());
 						sa.ajax('/TbBusinessCar/update', this.rc.form, function(res) {
 							sa.alert('操作成功');
 							this.rc.visible = false;
@@ -224,6 +220,7 @@
 							sa.error('请填写离场通道')
 							return;
 						}
+						this.out.form.timeUpdate=sa.forDatetime(new Date());
 						sa.ajax('/TbBusinessCar/update', this.out.form, function(res) {
 							sa.alert('操作成功');
 							this.out.visible = false;

+ 21 - 3
sp-admin/sa-view/tb-business-car/tb-business-car-add.html

@@ -14,6 +14,7 @@
 		<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">
 			.c-panel .el-form .c-label {
 				width: 7em !important;
@@ -43,6 +44,12 @@
 								:min="4.2" :max="50"></el-input-number>
 						</div>
 						<div class="c-item">
+							<label class="c-label">车牌颜色:</label>
+							<el-select v-model="m.color" placeholder="请选择">
+								<el-option v-for="item in colorList" :label="item.carNoColor" :value="item.carNoColor"> </el-option>
+							</el-select>
+						</div>
+						<div class="c-item">
 							<label class="c-label">联系人:</label>
 							<el-input v-model="m.driverName" placeholder="联系人" readonly>
 							</el-input>
@@ -56,10 +63,13 @@
 							<label class="c-label">入场时间:</label>
 							<el-date-picker type="datetime" value-format="yyyy-MM-dd HH:mm:ss" v-model="m.realInTime"></el-date-picker>
 						</div>
-						<div class="c-item" v-if="id>0 && m.isLock==0 && m.pay==1" >
+						<sa-item  type="img" name="入场图片" v-model="m.inImage" br></sa-item>
+
+						<div class="c-item" v-if="(id>0&&m.businessId!=null&&m.isLock==0&&m.pay==1) || (id>0&&m.businessId==null)" >
 							<label class="c-label">离场时间:</label>
 							<el-date-picker type="datetime" value-format="yyyy-MM-dd HH:mm:ss" v-model="m.realOutTime"></el-date-picker>
 						</div>
+						<sa-item v-if="(id>0&&m.businessId!=null&&m.isLock==0&&m.pay==1) || (id>0&&m.businessId==null)" type="img" name="出场图片" v-model="m.outImage" br></sa-item>
 						<sa-item name="" class="s-ok" br>
 							<el-button type="primary" icon="el-icon-plus" @click="ok()">保存</el-button>
 						</sa-item>
@@ -79,6 +89,7 @@
 				},
 				el: '.vue-box',
 				data: {
+					colorList:[],
 					id: sa.p('id', 0), // 获取超链接中的id参数(0=添加,非0=修改) 
 					m: {
 						id: '', //  
@@ -88,20 +99,26 @@
 						driverName: '', //  
 						money: '', //  
 						driverPhone: '', //
+						image: '',
 						realInTime: '',
 						realOutTime: '',
 						pay: '',
 						isLock: '',
+						inImage: '',
+						outImage: '',
 					}, // 实体对象
 				},
 				methods: {
+					getCadNoColor(){
+					sa.ajax('/TbCarNoColor/getList',function(resp){
+						this.colorList=resp.data;
+					}.bind(this))	
+					},
 					// 提交数据 
 					ok: function() {
 						// 表单校验 
 						let m = this.m;
 						sa.checkNull(m.carNo, '请输入 [车牌号]');
-						sa.checkNull(m.carSize, '请输入 [车辆规格]');
-						sa.checkNull(m.realInTime, '请输入 [入场时间]');
 						let phone = m.driverPhone;
 						if (phone && !sa.isPhone(phone)) {
 							sa.error('联系号码不正确')
@@ -130,6 +147,7 @@
 					}
 				},
 				mounted: function() {
+					this.getCadNoColor();
 					// 初始化数据 
 					if (this.id > 0) {
 						sa.ajax('/TbBusinessCar/getById?id=' + this.id, function(res) {

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

@@ -29,19 +29,17 @@
 						<el-row>
 							<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.realInTime}}</sa-info>
-								<sa-info name="离场时间" br>{{m.realOutTime}}</sa-info>
-								<sa-info name="停车费" br>{{m.money}}元</sa-info>
-									<sa-info type="img" name="入场图片" :value="m.inImage" br></sa-info>
+								<sa-info name="入场通道" br>{{m.inChannel}}</sa-info>
+								<sa-info type="img" name="入场图片" :value="m.inImage" br></sa-info>
 							</el-col>
 							<el-col span=12>
-								<sa-info name="联系人" br>{{m.driverName}}</sa-info>
-								<sa-info name="联系号码" br>{{m.driverPhone}}</sa-info>
-								<sa-info name="状态" br>
-									<label v-if="m.isLock==1">锁定</label>
-									<label v-else>正常</label>
-								</sa-info>
-									<sa-info type="img" name="离场图片" :value="m.outImage" br></sa-info>
+								<sa-info name="离场时间" br>{{m.realOutTime}}</sa-info>
+								<sa-info name="离场通道" br>{{m.outChannel}}</sa-info>
+								<sa-info name="停车费" br>{{m.money}}元</sa-info>
+								<sa-info name="支付状态" br>{{m.payType}}</sa-info>
+								<sa-info type="img" name="离场图片" :value="m.outImage" br></sa-info>
 							</el-col>
 						</el-row>
 					</el-form>

+ 79 - 18
sp-admin/sa-view/tb-business-car/tb-business-car-list.html

@@ -29,39 +29,67 @@
 							<el-option label="已支付" value="1"> </el-option>
 						</el-select>
 					</div>
+					<div class="c-item" style="width: 120px;">
+						<label class="c-label">是否离场:</label>
+						<el-select v-model="p.leave" placeholder="请选择">
+							<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-form>
+				<el-form>
+					<div class="c-item">
+						<label class="c-label">入场时间:</label>
+						<el-date-picker :clearable="false" v-model="inTime" type="datetimerange" range-separator="至"
+							start-placeholder="开始日期" end-placeholder="结束日期">
+						</el-date-picker>
+					</div>
+					<div class="c-item">
+						<label class="c-label">离场时间:</label>
+						<el-date-picker :clearable="false" v-model="leveTime" type="datetimerange" range-separator="至"
+							start-placeholder="开始日期" end-placeholder="结束日期">
+						</el-date-picker>
+					</div>
 					<el-button type="primary" icon="el-icon-search" @click="p.pageNo = 1; f5()">查询</el-button>
+					<el-button size="mini" type="primary" @click="exportFn">导出</el-button>
 					<el-button size="mini" type="info" @click="sa.f5()">重置</el-button>
-					<el-button size="mini" type="primary"  @click="add()">
+					<el-button size="mini" type="primary" @click="add()">
 						新增</el-button>
 				</el-form>
 				<!-- ------------- 数据列表 ------------- -->
 				<el-table class="data-table" ref="data-table" :data="dataList">
+					<sa-td name="业务流水号" prop="no" width=140></sa-td>
 					<sa-td name="车牌号" prop="carNo" width=120></sa-td>
-					<sa-td name="车辆规格" prop="carSize"></sa-td>
-					<sa-td width="130" name="支付状态" prop="pay" type="enum" :jv="{0: '未支付[#ff0000]', 1: '已支付[#005500]'}">
-					</sa-td>
-<!--					<sa-td width="130" name="车辆状态" prop="pay" type="enum" :jv="{0: '锁定[#ff0000]', 1: '正常[#005500]'}">-->
-					</sa-td>
-					<sa-td name="联系人" prop="driverName"></sa-td>
-					<sa-td name="联系号码" prop="driverPhone"></sa-td>
-					<sa-td name="入场时间" prop="realInTime" width=180></sa-td>
-					<sa-td name="离场时间" prop="realOutTime" width=180></sa-td>
-					<el-table-column label="预交停车费">
+					<el-table-column label="车辆规格">
+						<template slot-scope="s">
+							<label v-if="!s.row.carSize">-</label>
+							<label v-else>{{s.row.carSize}}</label>
+						</template>
+					</el-table-column>
+					<el-table-column label="车牌颜色">
 						<template slot-scope="s">
-							<label>{{s.row.basePartMoney}}</label>
+							<label v-if="!s.row.color">-</label>
+							<label v-else>{{s.row.color}}</label>
 						</template>
 					</el-table-column>
-					<el-table-column label="实际停车费">
+					<sa-td name="入场通道" prop="inChannel"></sa-td>
+					<sa-td name="离场通道" prop="outChannel"></sa-td>
+					<sa-td name="入场时间" prop="realInTime" width=180></sa-td>
+					<sa-td name="离场时间" prop="realOutTime" 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>
+							<label v-else>-</label>
 						</template>
 					</el-table-column>
+					<sa-td name="支付状态" prop="payType"></sa-td>
 					<el-table-column label="操作" width="200px">
 						<template slot-scope="s">
 							<el-button class="c-btn" type="success" icon="el-icon-view" @click="get(s.row)">查看
 							</el-button>
-							<el-button v-if="sa.isAuth('tb-business-edit')" class="c-btn" type="primary" icon="el-icon-edit" @click="update(s.row)">修改
+							<el-button v-if="sa.isAuth('tb-business-edit')" class="c-btn" type="primary"
+								icon="el-icon-edit" @click="update(s.row)">修改
 							</el-button>
 						</template>
 					</el-table-column>
@@ -79,21 +107,54 @@
 				},
 				el: '.vue-box',
 				data: {
-					p: { // 查询参数  
+					leveTime: [],
+					inTime: [],
+					p: { // 查询参数
 						id: '', //  
 						businessId: sa.p('id', ''), //  
 						carNo: '', //  
-						pay:'',  
+						leave: '1',
+						pay: '',
+						leaveStart: '',
+						leaveEnd: '',
 						pageNo: 1, // 当前页 
 						pageSize: 10, // 页大小 
-						sortType: 0 // 排序方式 
+						sortType: 10 // 排序方式
 					},
 					dataCount: 0,
 					dataList: [], // 数据集合 
 				},
 				methods: {
+					exportFn() {
+						this.$confirm('确定导出符合条件的数据?', '提示', {
+							confirmButtonText: '确定',
+							cancelButtonText: '取消',
+							type: 'warning'
+						}).then(() => {
+							sa.ajax('/TbBusinessCar/export', sa.removeNull(this.p), function(resp) {
+								window.location.href = resp.data;
+							}.bind(this))
+						}).catch(() => {
+
+						});
+					},
 					// 刷新
 					f5: function() {
+
+						if (this.inTime && this.inTime.length > 0) {
+							this.p.inStart = sa.forDatetime(this.inTime[0]);
+							this.p.inEnd = sa.forDatetime(this.inTime[1]);
+						} else {
+							this.p.inStart = '';
+							this.p.inEnd = '';
+						}
+						if (this.leveTime && this.leveTime.length > 0) {
+							this.p.leaveStart = sa.forDatetime(this.leveTime[0]);
+							this.p.leaveEnd = sa.forDatetime(this.leveTime[1]);
+						} else {
+							this.p.leaveStart = '';
+							this.p.leaveEnd = '';
+						}
 						sa.ajax('/TbBusinessCar/getList', sa.removeNull(this.p), function(res) {
 							this.dataList = res.data; // 数据
 							this.dataCount = res.dataCount; // 数据总数 

+ 2 - 7
sp-admin/sa-view/tb-business/tb-business-info.html

@@ -52,7 +52,6 @@
 												<sa-info name="录入时间" br>{{m.createTime}}</sa-info>
 												<sa-info name="录入人" br>{{m.createBy}}</sa-info>
 												<sa-info name="中国车牌" br>{{m.chinaCarNo}}</sa-info>
-												<sa-info name="预交停车费" br>{{m.partMoney+m.chinaPartMoney}}(元)</sa-info>
 												<sa-info name="业务费用" br>{{m.itemPrice}}(元)</sa-info>
 												<sa-info name="合计费用" br>{{m.totalMoney}}(元)</sa-info>
 												<sa-info name="支付时间" br>{{m.payTime}}</sa-info>
@@ -80,12 +79,8 @@
 										<sa-td width="120" name="车辆状态" prop="isLock" type="enum"
 											:jv="{1: '锁定[#ff0000]', 0: '正常[#005500]'}">
 										</sa-td>
-										<el-table-column label="预交停车费">
-											<template slot-scope="s">
-												<label>{{s.row.basePartMoney}}</label>
-											</template>
-										</el-table-column>
-										<el-table-column label="已交费用">
+										
+										<el-table-column label="停车费">
 											<template slot-scope="s">
 												<label v-if="s.row.money">{{s.row.money}}</label>
 												<label v-else>-</label>

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

@@ -46,7 +46,7 @@
 				<!--				<el-button type="success" icon="el-icon-view" @click="getBySelect()">查看</el-button>-->
 				<el-button type="danger" icon="el-icon-delete" @click="deleteByIds()" v-if="sa.isAuth('tb-car-del')">删除
 				</el-button>
-				
+
 				<!-- ------------- 数据列表 ------------- -->
 				<el-table class="data-table" ref="data-table" :data="dataList" style="margin-top: 10px;">
 					<sa-td type="selection"></sa-td>
@@ -76,6 +76,7 @@
 						:on-success="successFn" :on-error="errorFn" :action="sa.cfg.api_url+'/TbCar/importExcel'">
 						<i class="el-icon-upload"></i>
 						<div class="el-upload__text">选择excel文档</em></div>
+						<div class="el-upload__tip" slot="tip">只能上传jpg/png文件,且不超过500kb</div>
 					</el-upload>
 				</div>
 				<span slot="footer" class="dialog-footer">
@@ -112,7 +113,7 @@
 				},
 				methods: {
 					importTemplate() {
-						window.location.href = '../../static/excel/批量导入车辆.xlsx';
+						window.location.href = '../../static/excel/car-import.xlsx';
 					},
 					importFn() {
 						Object.assign(this.modal, {

+ 67 - 14
sp-admin/sa-view/tb-fee-statistics/tb-fee-details-list.html

@@ -88,13 +88,19 @@
 					<sa-td name="不含税金额(元)" prop="noTaxPrice" ></sa-td>
 					<sa-td name="收款方式" prop="payType" type="enum" :jv="{3: '微信支付'}"></sa-td>
 					<sa-td name="收款种类" prop="payMode" type="enum" :jv="{1: '直接收款'}"></sa-td>
-					<sa-td name="系统流水号" prop="" ></sa-td>
-					<sa-td name="订单编号" prop="businessNo" width="140px" ></sa-td>
+<!--					<sa-td name="系统流水号" prop="tradeNo" width="140px" ></sa-td>-->
+					<el-table-column label="系统流水号" width="140px">
+						<template slot-scope="s">
+							<span v-if="s.row.businessId != null && s.row.businessId != ''" >{{s.row.businessNo}}</span>
+							<span v-else>{{s.row.businessCarNo}}</span>
+						</template>
+					</el-table-column>
+					<sa-td name="订单编号" prop="transactionId" width="220px" ></sa-td>
 					<sa-td name="作业编号" prop="businessItemNo" width="145px" ></sa-td>
 					<sa-td name="企业名称" prop="pickCustomerName" ></sa-td>
 					<sa-td name="发票号" prop="" ></sa-td>
-					<sa-td name="生成时间" prop="createTime" width="90px" ></sa-td>
-					<sa-td name="付款时间" prop="payTime"  width="90px" ></sa-td>
+					<sa-td name="生成时间" prop="createTime" width="150px" ></sa-td>
+					<sa-td name="付款时间" prop="payTime"  width="150px" ></sa-td>
 					<sa-td name="备注" prop="remark" ></sa-td>
 
 <!--					<el-table-column label="操作" fixed="right"  width="240px">-->
@@ -108,13 +114,40 @@
 				<!-- ------------- 分页 ------------- -->
 				<sa-item type="page" :curr.sync="p.pageNo" :size.sync="p.pageSize" :total="dataCount" @change="f5()"></sa-item>
 			</div>
-			<el-dialog title="提示" :visible.sync="emodel.visible" width="30%">
-				<el-form size="mini">
-					<div class="c-item">
-						<label class="c-label">日期:</label>
-						<el-date-picker type="date" value-format="yyyy-MM-dd" v-model="emodel.form.payDay"></el-date-picker>
-					</div>
-				</el-form>
+			<el-dialog title="提示" :visible.sync="emodel.visible" width="38%">
+<!--				<el-form size="mini">-->
+<!--					<div class="c-item">-->
+<!--						<label class="c-label">日期:</label>-->
+<!--						<el-date-picker type="date" value-format="yyyy-MM-dd" v-model="emodel.form.payDay"></el-date-picker>-->
+<!--					</div>-->
+<!--				</el-form>-->
+				<div class="c-item">
+					<label class="c-label">收费项目:</label>
+					<el-select v-model="emodel.form.feeType" placeholder="请选择" filterable>
+						<el-option label="核酸检测" value="1"></el-option>
+						<el-option label="消杀作业" value="2"></el-option>
+						<el-option label="装卸作业" value="3"></el-option>
+						<el-option label="停车费" value="4"></el-option>
+						<el-option label="过磅费" value="5"></el-option>
+						<el-option label="入场管理费" value="6"> </el-option>
+						<el-option label="充电打冷作业" value="7"> </el-option>
+					</el-select>
+				</div>
+				<div class="c-item">
+					<label class="c-label">业务类型:</label>
+					<el-select v-model="emodel.form.itemTypeName" placeholder="请选择" filterable>
+						<el-option v-for="item in itemTypeList" :key="item.id"
+								   :label="item.name" :value="item.name">
+						</el-option>
+					</el-select>
+				</div>
+				<div class="c-item">
+					<label class="c-label"><span style="color: red;">*</span>日期范围:</label>
+					<el-date-picker size="mini" v-model="exportTime" type="daterange" unlink-panels="false"
+									range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期"
+									format="yyyy 年 MM 月 dd 日" value-format="yyyy-MM-dd">
+					</el-date-picker>
+				</div>
 				<span slot="footer" class="dialog-footer">
 					<el-button @click="emodel.visible = false">取 消</el-button>
 					<el-button type="primary" @click="sureExport">确 定</el-button>
@@ -154,10 +187,15 @@
 						beginTime: '', //查询开始时间
 						endTime: '', //查询结束时间
 					},
+					exportTime:[],
 					emodel: {
 						visible: false,
 						form: {
-							payDay: ''
+							// payDay: ''
+							feeType: '',
+							itemTypeName: '',
+							beginTime: '', //查询开始时间
+							endTime: '', //查询结束时间
 						}
 					},
 				},
@@ -166,10 +204,25 @@
 						Object.assign(this.emodel, {
 							visible: true,
 						})
+						this.exportTime = [];
+						this.emodel.form.feeType = '';
+						this.emodel.form.itemTypeName = '';
+						this.emodel.form.beginTime = '';
+						this.emodel.form.endTime = '';
 					},
 					sureExport() {
-						if (this.emodel.form.payDay == '') {
-							sa.msg("请选择日期");
+						if ( this.exportTime != null && this.exportTime.length != 0) {
+							this.emodel.form.beginTime = this.exportTime[0];
+							this.emodel.form.endTime = this.exportTime[1];
+						}
+						if (this.emodel.form.beginTime == '' || this.emodel.form.endTime == '') {
+							sa.msg("请选择日期范围");
+							return;
+						}
+						const begin = new Date(this.emodel.form.beginTime);
+						const end = new Date(this.emodel.form.endTime);
+						if(end.getTime()-begin.getTime() > 3600 * 1000 * 24 * 31) {
+							sa.msg("日期范围不可超过一个月");
 							return;
 						}
 						sa.ajax('/TbFeeDetails/export/details', this.emodel.form,  function(resp) {

+ 6 - 1
sp-admin/sa-view/tb-fee-statistics/tb-fee-statistics-list.html

@@ -62,7 +62,12 @@
 					<sa-td name="日期" type="date" prop="dayTime" ></sa-td>
 					<sa-td name="数量" prop="num" ></sa-td>
 					<sa-td name="含税收入(元)" prop="taxMoney" ></sa-td>
-					<sa-td name="税率" prop="taxRate" ></sa-td>
+<!--					<sa-td name="税率" prop="taxRate" ></sa-td>-->
+					<el-table-column label="税率(%)" >
+						<template slot-scope="s">
+							<span>{{s.row.taxRate * 100}}</span>
+						</template>
+					</el-table-column>
 					<sa-td name="不含税收入(元)" prop="noTaxMoney" ></sa-td>
 					<sa-td name="支付方式" prop="payType" type="enum" :jv="{3: '微信支付'}"></sa-td>
 <!--					<el-table-column label="操作" fixed="right"  width="240px">-->

+ 0 - 0
sp-admin/static/excel/批量导入车辆.xlsx → sp-admin/static/excel/car-import.xlsx


+ 0 - 1
sp-server/app.pid

@@ -1 +0,0 @@
-32340

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

@@ -105,7 +105,6 @@ public class ApiController {
     public AjaxJson searchPartCar(String carNo) {
         carNo=carNo.toUpperCase();
         List<TbBusinessCar> list = apiService.searchPartCar(carNo);
-
         return AjaxJson.getSuccessData(list);
     }
 

+ 94 - 0
sp-server/src/main/java/com/pj/api/open/bo/InRecordBO.java

@@ -0,0 +1,94 @@
+package com.pj.api.open.bo;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+import java.io.Serializable;
+
+
+public class InRecordBO implements Serializable {
+    /**
+     * 当前设别车牌的通道名称
+     */
+   private String ChannelName;
+    private String    CarNumber;
+    /**
+     * 1 入场 2 出场
+     */
+    private int  EventType;
+    /**
+     * 入场时间
+     */
+    private String  InTime;
+    /**
+     * 流水号
+     */
+    private String     Parkingserial;
+    /**
+     * 操作员
+     */
+    private String OperationUserName;
+
+    private String CarColor;
+
+    @JsonProperty("ChannelName")
+    public String getChannelName() {
+        return ChannelName;
+    }
+
+    public void setChannelName(String channelName) {
+        ChannelName = channelName;
+    }
+
+
+    @JsonProperty("CarNumber")
+    public String getCarNumber() {
+        return CarNumber;
+    }
+
+    public void setCarNumber(String carNumber) {
+        CarNumber = carNumber;
+    }
+
+
+    @JsonProperty("EventType")
+    public int getEventType() {
+        return EventType;
+    }
+
+    public void setEventType(int eventType) {
+        EventType = eventType;
+    }
+    @JsonProperty("InTime")
+    public String getInTime() {
+        return InTime;
+    }
+
+    public void setInTime(String inTime) {
+        InTime = inTime;
+    }
+    @JsonProperty("Parkingserial")
+    public String getParkingserial() {
+        return Parkingserial;
+    }
+
+    public void setParkingserial(String parkingserial) {
+        Parkingserial = parkingserial;
+    }
+    @JsonProperty("OperationUserName")
+    public String getOperationUserName() {
+        return OperationUserName;
+    }
+
+    public void setOperationUserName(String operationUserName) {
+        OperationUserName = operationUserName;
+    }
+
+    @JsonProperty("CarColor")
+    public String getCarColor() {
+        return CarColor;
+    }
+
+    public void setCarColor(String carColor) {
+        CarColor = carColor;
+    }
+}

+ 58 - 0
sp-server/src/main/java/com/pj/api/open/service/CoverBase64ToImageTask.java

@@ -0,0 +1,58 @@
+package com.pj.api.open.service;
+
+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.extra.spring.SpringUtil;
+import com.pj.current.config.SystemObject;
+import com.pj.current.task.Task;
+import com.pj.project.tb_business_car.TbBusinessCar;
+import com.pj.project.tb_business_car.TbBusinessCarService;
+import com.pj.project4sp.uploadfile.UploadConfig;
+import com.pj.utils.ImageUtils;
+import lombok.Data;
+import lombok.extern.slf4j.Slf4j;
+
+import javax.annotation.Resource;
+import java.io.File;
+
+@Slf4j
+public class CoverBase64ToImageTask extends Task {
+    private String carId;
+    private String imageData;
+    private int inOrOut;
+
+    public CoverBase64ToImageTask(String id, long delayInMilliseconds, String carId, String imageData, int inOrOut) {
+        super(id, delayInMilliseconds);
+        this.carId = carId;
+        this.imageData = imageData;
+        this.inOrOut = inOrOut;
+    }
+
+    @Override
+    public void run() {
+        UploadConfig uploadConfig = SpringUtil.getBean(UploadConfig.class);
+        TbBusinessCarService tbBusinessCarService = SpringUtil.getBean(TbBusinessCarService.class);
+        String flieTypeFolder = "/channel/";
+        String currDateFolder = DateUtil.today();
+        String fileName = RandomUtil.randomString(32) + ".jpg";
+        String imgFilePath = new File(uploadConfig.rootFolder).getAbsolutePath() + "/" +
+                uploadConfig.httpPrefix + flieTypeFolder + currDateFolder + "/";
+        if (!FileUtil.exist(imgFilePath)){
+            FileUtil.mkdir(imgFilePath);
+        }
+        // 对外暴露的http路径
+        String httpUrl = SystemObject.config.getDomain() + uploadConfig.httpPrefix + flieTypeFolder + currDateFolder + "/" + fileName;
+        ImageUtils.generateImage(imageData, imgFilePath + fileName);
+        TbBusinessCar tbBusinessCar = tbBusinessCarService.getById(carId);
+        if (tbBusinessCar != null) {
+            if (inOrOut == 1) {
+                tbBusinessCar.setInImage(httpUrl);
+            } else {
+                tbBusinessCar.setOutImage(httpUrl);
+            }
+        }
+        tbBusinessCarService.updateById(tbBusinessCar);
+    }
+}

+ 86 - 15
sp-server/src/main/java/com/pj/api/open/service/OpenService.java

@@ -3,10 +3,17 @@ 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 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_business.BusinessMessageManager;
 import com.pj.project.tb_business.TbBusiness;
 import com.pj.project.tb_business.TbBusinessService;
@@ -15,18 +22,29 @@ 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;
+import com.pj.project.tb_car_no_color.TbCarNoColorService;
+import com.pj.project4sp.uploadfile.UploadConfig;
 import com.pj.utils.cache.RedisUtil;
 import com.sun.org.apache.bcel.internal.generic.IF_ACMPEQ;
 import org.springframework.context.annotation.Lazy;
 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.Date;
 import java.util.List;
 import java.util.stream.Collectors;
@@ -46,6 +64,13 @@ public class OpenService {
     @Resource
     private TbCarService tbCarService;
 
+    @Resource
+    TaskService taskService;
+    @Resource
+    TbCarNoColorService tbCarNoColorService;
+    @Resource
+    private TbBusinessPeopleService tbBusinessPeopleService;
+
     private final List<String> CAR_LIST = StrUtil.splitTrim("浙,粤,京,津,冀,晋,蒙,辽,黑,沪,吉,苏,皖,赣,鲁,豫,鄂,湘,桂,琼,渝,川,贵,云,藏, 陕, 甘, 青, 宁", ",");
 
 
@@ -65,16 +90,20 @@ public class OpenService {
         carNo = carNo.toUpperCase();
         TbBusinessCar tbBusinessCar = tbBusinessCarService.findTheLastRecord(carNo);
         Date now = new Date();
-        checkFree(carNo, 1, now);
-        if (tbBusinessCar == null || (tbBusinessCar.getRealInTime() != null && tbBusinessCar.getRealOutTime() != null)) {
+        TbCar tbCar = tbCarService.findByCardNo(carNo);
+        if (tbBusinessCar == null || (tbBusinessCar.getRealInTime() != null && tbBusinessCar.getRealOutTime() != null)||tbBusinessCar.getPay()==1) {
             tbBusinessCar = new TbBusinessCar();
-            tbBusinessCar.setCarNo(carNo).setPay(0).setCarSize(3D).setIsLock(0).setInImage(image)
-                    .setInChannel(channel).setRealInTime(now).setBasePartMoney(new BigDecimal("0"));
+            tbBusinessCar.setCarNo(carNo).setPay(0).setCarSize(0D).setIsLock(0).setCarCompany(tbCar != null ? tbCar.getCustomerName() : "临时")
+                    .setInChannel(channel).setRealInTime(now).setBasePartMoney(new BigDecimal("0")).setTimeUpdate(now)
+                    .setNo(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmm")) + RandomUtil.randomNumbers(4));
             tbBusinessCarService.save(tbBusinessCar);
+            CoverBase64ToUrl(image, tbBusinessCar.getId(), 1);
             return;
         }
-        tbBusinessCar.setRealInTime(now).setInChannel(channel).setInImage(image);
+        tbBusinessCar.setRealInTime(now).setInChannel(channel).setTimeUpdate(now)
+                .setCarCompany(tbCar != null ? tbCar.getCustomerName() : "临时");
         tbBusinessCarService.saveOrUpdate(tbBusinessCar);
+        CoverBase64ToUrl(image, tbBusinessCar.getId(), 1);
         if (!CAR_LIST.contains(carNo)) {
             TbBusiness tbBusiness = tbBusinessService.getById(tbBusinessCar.getBusinessId());
             if (tbBusiness != null) {
@@ -85,34 +114,61 @@ public class OpenService {
 
     }
 
+    private void CoverBase64ToUrl(String base64image, String carId, int inOrOut) {
+        if (StrUtil.isEmpty(base64image)) {
+            return;
+        }
+        taskService.addTask(new CoverBase64ToImageTask("=======" + carId + "", 2000, carId, base64image, inOrOut));
+
+    }
+
     private ResultJson handlerOut(String carNo, String channel, String image) {
         carNo = carNo.toUpperCase();
-        TbBusinessCar tbBusinessCar = tbBusinessCarService.findNotOutCar(carNo);
+        TbBusinessCar tbBusinessCar = tbBusinessCarService.findTheLastRecord(carNo);
         if (tbBusinessCar == null) {
             return ResultJson.error("未查询到入场记录");
         }
         Date now = new Date();
+        if (StrUtil.isNotEmpty(tbBusinessCar.getColor())) {
+            List<TbCarNoColor> freeList = tbCarNoColorService.getFreeColor();
+            List<String> colorList = freeList.stream().map(f -> f.getCarNoColor().substring(0, 1)).collect(Collectors.toList());
+            String color = tbBusinessCar.getColor().substring(0, 1);
+            if (colorList.contains(color)) {
+                tbBusinessCar.setRealOutTime(now).setTimeUpdate(now).setOutChannel(channel);
+                tbBusinessCarService.updateById(tbBusinessCar);
+                CoverBase64ToUrl(image, tbBusinessCar.getId(), 2);
+                return ResultJson.success();
+            }
+        }
+
         if (checkFree(carNo, 2, now)) {
-            tbBusinessCar.setRealOutTime(now).setOutImage(image);
+            tbBusinessCar.setRealOutTime(now).setTimeUpdate(now).setOutChannel(channel);
             tbBusinessCarService.updateById(tbBusinessCar);
+            CoverBase64ToUrl(image, tbBusinessCar.getId(), 2);
             return ResultJson.success();
         }
         if (tbBusinessCar.getIsLock() == 1) {
             return ResultJson.error("车辆已锁定");
         }
-
         String businessId = tbBusinessCar.getBusinessId();
-        BigDecimal price = tbBusinessService.calculationPartMoney(tbBusinessCar.getRealInTime(), now, StrUtil.isNotEmpty(businessId));
-        double dif = price.subtract(tbBusinessCar.getMoney()).doubleValue();
+        BigDecimal price = new BigDecimal("0");
+        if (CAR_LIST.contains(carNo.substring(0, 1))) {
+            Date inTime=tbBusinessCar.getRealInTime();
+            if (tbBusinessCar.getPay()==1){
+                inTime=tbBusinessCar.getPayTime();
+            }
+            price = tbBusinessService.calculationPartMoney(inTime, now);
+        }
+//        double dif = price.subtract(tbBusinessCar.getMoney()).doubleValue();
+        double dif = price.doubleValue();
         if (dif > 0) {
-            tbBusinessCar.setPay(0).setOutImage(image);
-            tbBusinessCarService.updateById(tbBusinessCar);
             RedisUtil.set(channel, carNo);
             return ResultJson.error("请缴停车费" + dif + "元");
         }
         if (StrUtil.isEmpty(businessId)) {
-            tbBusinessCar.setRealOutTime(now).setOutChannel(channel).setOutImage(image);
+            tbBusinessCar.setRealOutTime(now).setOutChannel(channel).setTimeUpdate(now);
             tbBusinessCarService.updateById(tbBusinessCar);
+            CoverBase64ToUrl(image, tbBusinessCar.getId(), 2);
             return ResultJson.success();
         }
         TbBusiness business = tbBusinessService.getById(businessId);
@@ -120,9 +176,10 @@ public class OpenService {
                 .stream().filter(tbBusinessItem -> tbBusinessItem.getPayStatus() == 1).collect(Collectors.toList());
         BigDecimal itemPayPrice = new BigDecimal("0");
         for (TbBusinessItem tbBusinessItem : items) {
-            itemPayPrice = itemPayPrice.add(tbBusinessItem.getItemPrice());
+            itemPayPrice = itemPayPrice.add(tbBusinessItem.getItemPrice().multiply(new BigDecimal(tbBusinessItem.getNum())));
         }
 
+
         if (!CAR_LIST.contains(StrUtil.sub(carNo, 0, 1))) {
             if (!business.getItemPrice().equals(itemPayPrice) && business.getCustomerType() != 2) {
                 return ResultJson.error("请缴纳业务费用");
@@ -132,8 +189,9 @@ public class OpenService {
         if (TbBusiness.BusinessType.CAR_DISINCLE.getCode().equals(business.getBusinessType()) && !business.getItemPrice().equals(itemPayPrice)) {
             return ResultJson.error("请缴纳业务费用");
         }
-        tbBusinessCar.setRealOutTime(now).setOutChannel(channel).setOutImage(image);
+        tbBusinessCar.setRealOutTime(now).setOutChannel(channel).setTimeUpdate(now);
         tbBusinessCarService.updateById(tbBusinessCar);
+        CoverBase64ToUrl(image, tbBusinessCar.getId(), 2);
         return ResultJson.success();
     }
 
@@ -151,4 +209,17 @@ public class OpenService {
     }
 
 
+    public void handlerInRecord(InRecordBO inRecordBO) {
+        String carNo = inRecordBO.getCarNumber().trim().toUpperCase();
+        // 入场==>取车牌颜色
+        List<TbBusinessCar> cars = tbBusinessCarService.findByCarNo(carNo);
+        cars.stream().filter(obj -> StrUtil.isEmpty(obj.getColor()))
+                .forEach(tbBusinessCar -> {
+                    tbBusinessCar.setColor(inRecordBO.getCarColor());
+                    tbBusinessCarService.updateById(tbBusinessCar);
+                });
+        if (cars.isEmpty()) {
+            //handlerIn(carNo, inRecordBO.getChannelName(), null);
+        }
+    }
 }

+ 10 - 0
sp-server/src/main/java/com/pj/api/open/web/OpenController.java

@@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.json.JSONUtil;
 import com.pj.api.open.ResultJson;
 import com.pj.api.open.bo.CheckCarNumberBO;
+import com.pj.api.open.bo.InRecordBO;
 import com.pj.api.open.service.OpenService;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.http.HttpRequest;
@@ -31,10 +32,19 @@ public class OpenController {
         if ("CheckCarNumber".equals(dataType)) {
             CheckCarNumberBO checkCarNumberBO = BeanUtil.toBean(params, CheckCarNumberBO.class);
             return checkCarNumber(checkCarNumberBO);
+        }else  if ("Inrecord".equals(dataType)) {
+            InRecordBO inRecordBO = BeanUtil.toBean(params, InRecordBO.class);
+            return handlerInRecord(inRecordBO);
         }
         return ResultJson.error("未知异常");
     }
 
+    private ResultJson handlerInRecord(InRecordBO inRecordBO) {
+        log.info("handler in record:{}", JSONUtil.toJsonStr(inRecordBO));
+        openService.handlerInRecord(inRecordBO);
+        return ResultJson.success();
+    }
+
     private ResultJson checkCarNumber(CheckCarNumberBO checkCarNumberBO) {
         log.info("check car number:{}", JSONUtil.toJsonStr(checkCarNumberBO));
         return openService.checkCarNumber(checkCarNumberBO);

+ 12 - 8
sp-server/src/main/java/com/pj/api/service/ApiService.java

@@ -24,6 +24,8 @@ 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_car.TbCar;
+import com.pj.project.tb_car.TbCarService;
 import com.pj.project.tb_costomer.TbCostomer;
 import com.pj.project.tb_costomer.TbCostomerService;
 import com.pj.project.tb_declare.TbDeclare;
@@ -94,7 +96,7 @@ public class ApiService {
     @Resource
     private MyConfig myConfig;
     @Resource
-    private PartConfig partConfig;
+    private TbCarService tbCarService;
 
     private final List<String> CAR_LIST = StrUtil.splitTrim("浙,粤,京,津,冀,晋,蒙,辽,黑,沪,吉,苏,皖,赣,鲁,豫,鄂,湘,桂,琼,渝,川,贵,云,藏, 陕, 甘, 青, 宁", ",");
 
@@ -135,6 +137,7 @@ public class ApiService {
             return tbBusiness.getAdminConfirmInput() == 1;
         }).collect(Collectors.toList());
        List<TbBusinessCar>cars= tbBusinessCarService.findTheNoBusinessCar(carNo);
+       //过滤掉不用缴费的车
        list.addAll(cars);
         return list;
     }
@@ -155,7 +158,7 @@ public class ApiService {
             return result;
         }
         Date now = new Date();
-        BigDecimal price = tbBusinessService.calculationPartMoney(tbBusinessCar.getRealInTime(), now,StrUtil.isNotEmpty(tbBusinessCar.getBusinessId()));
+        BigDecimal price = tbBusinessService.calculationPartMoney(tbBusinessCar.getRealInTime(), now);
         BigDecimal dif = price.subtract(tbBusinessCar.getMoney());
         Map<String, Object> car = new HashMap<>();
         car.put("id", tbBusinessCar.getId());
@@ -263,7 +266,8 @@ public class ApiService {
             throw new BusinessException("该车辆有未完成作业");
         }
         db = new TbBusinessCar();
-        db.setCarNo(carNo).setIsLock(0);
+        TbCar tbCar = tbCarService.findByCardNo(carNo);
+        db.setCarNo(carNo).setIsLock(0).setCarCompany(tbCar!=null?tbCar.getCustomerName():"临时");
         TbBusiness tbBusiness = new TbBusiness();
         if (StpUserUtil.isLogin()) {
             String customerId = StpUserUtil.getCustomerId();
@@ -289,12 +293,11 @@ public class ApiService {
             itemList.add(item);
             index++;
         }
-        BigDecimal initCarPartMoney = partConfig.getBasePrice();
-        tbBusiness.setPartMoney(initCarPartMoney)
+//        BigDecimal initCarPartMoney = partConfig.getBasePrice();
+        tbBusiness
                 .setNo(no).setGoodsName(carType)
                 .setCreateTime(new Date()).setBusinessType(TbBusiness.BusinessType.CAR_DISINCLE.getCode())
-                .setItemPrice(price)
-                .setTotalMoney(price.add(initCarPartMoney));
+                .setItemPrice(price);
         String prefix = carNo.substring(0, 1);
         if (CAR_LIST.contains(prefix)) {
             tbBusiness.setChinaCarNo(carNo);
@@ -302,7 +305,8 @@ public class ApiService {
             tbBusiness.setCardNo(carNo);
         }
         tbBusinessService.save(tbBusiness);
-        db.setBusinessId(tbBusiness.getId());
+        db.setBusinessId(tbBusiness.getId())
+        .setNo(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmm")) + RandomUtil.randomNumbers(4));
         tbBusinessCarService.save(db);
         itemList.forEach(tbBusinessItem -> tbBusinessItem.setBusinessId(tbBusiness.getId()));
         tbBusinessItemService.saveBatch(itemList);

+ 5 - 4
sp-server/src/main/java/com/pj/api/wx/service/WxService.java

@@ -199,11 +199,11 @@ public class WxService {
         if (StrUtil.isNotEmpty(attachStr)) {
             Attach attach = JSONUtil.toBean(attachStr, Attach.class);
             List<PriceBO> cars = JSONUtil.toList(attach.getC(), PriceBO.class);
-            tbFeeStatisticsService.countParkFee(cars);//停车费日统计
+
             for (PriceBO bo1 : cars) {
                 TbBusinessCar car = tbBusinessCarService.getById(bo1.getId());
                 BigDecimal price = bo1.getP();
-                car.setPay(1).setMoney(car.getMoney().add(price));
+                car.setPay(1).setMoney(car.getMoney().add(price)).setPayTime(now);
                 tbBusinessCarService.updateById(car);
                 TbBusiness business = tbBusinessService.getById(car.getBusinessId());
                 if (business != null) {
@@ -212,11 +212,12 @@ public class WxService {
                     tbBusinessService.updateById(business);
                 }
             }
-            tbFeeDetailsService.chargeParkFee(cars);//添加cars的收费明细
+            tbFeeStatisticsService.countParkFee(cars);//停车费日统计
+            tbFeeDetailsService.chargeParkFee(cars, transactionId);//添加cars的收费明细
             String businessId = attach.getB();
             if (StrUtil.isNotEmpty(businessId)) {
                 List<TbBusinessItem> items = tbBusinessItemService.findByBusinessId(businessId);
-                tbFeeStatisticsService.countBusinessFee(items);//业务费日统计
+                tbFeeStatisticsService.countBusinessFee(items, transactionId);//业务费日统计
                 items.forEach(tbBusinessItem -> tbBusinessItem.setPayStatus(1).setPayTime(now));
                 tbBusinessItemService.updateBatchById(items);
                 TbBusiness tbBusiness = tbBusinessService.getById(businessId);

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

@@ -46,6 +46,7 @@ public class TbBusiness extends Model<TbBusiness> implements Serializable {
     public static final String PERMISSION_CONFIRM = "tb-business-confirm";
     public static final String PERMISSION_PAY = "tb-business-pay";
     public static final String PERMISSION_INPUT = "tb-business-add";
+    public static final String PERMISSION_EXPORT = "tb-business-car-export";
 
 
     // ---------- 表中字段 ----------

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

@@ -11,6 +11,8 @@ 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_declare.TbDeclare;
+import com.pj.project.tb_declare.TbDeclareService;
 import com.pj.project.tb_notices.TbNoticesService;
 import com.pj.project.tb_pass_record.TbPassRecord;
 import com.pj.project.tb_pass_record.TbPassRecordService;
@@ -49,6 +51,8 @@ public class TbBusinessController {
     private TbNoticesService tbNoticesService;
     @Resource
     private TbBusinessCarService tbBusinessCarService;
+    @Resource
+    private TbDeclareService tbDeclareService;
 
 
     @RequestMapping(value = "getMsg")
@@ -81,6 +85,8 @@ public class TbBusinessController {
         tbBusinessItemService.removeByBusinessId(id);
 
         tbBusinessCarService.removeByBusinessId(id);
+        tbDeclareService.removeBusinessId(id);
+
         return AjaxJson.getSuccess();
     }
 
@@ -171,6 +177,7 @@ public class TbBusinessController {
         List<TbBusiness> list = tbBusinessService.getList(so.startPage());
         return AjaxJson.getPageData(so.getDataCount(), list);
     }
+
     /**
      * 查集合 - 根据条件(参数为空时代表忽略指定条件)
      */
@@ -184,6 +191,7 @@ public class TbBusinessController {
         List<CarDisincle> list = tbBusinessService.getCarDisincleList(so.startPage());
         return AjaxJson.getPageData(so.getDataCount(), list);
     }
+
     /**
      * 改
      */
@@ -291,7 +299,7 @@ public class TbBusinessController {
     }
 
     @RequestMapping("uploadReport")
-    public AjaxJson uploadReport(@RequestBody TbBusiness tbBusiness){
+    public AjaxJson uploadReport(@RequestBody TbBusiness tbBusiness) {
         tbBusinessService.uploadReport(tbBusiness);
         return AjaxJson.getSuccess();
     }

+ 52 - 21
sp-server/src/main/java/com/pj/project/tb_business/TbBusinessService.java

@@ -19,6 +19,7 @@ import cn.hutool.json.JSONUtil;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.pj.api.open.ResultJson;
 import com.pj.api.wx.bo.MsgDataBO;
 import com.pj.api.wx.service.WxService;
 import com.pj.constants.UserTypeEnum;
@@ -35,6 +36,8 @@ 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;
+import com.pj.project.tb_car_no_color.TbCarNoColorService;
 import com.pj.project.tb_costomer.TbCostomer;
 import com.pj.project.tb_costomer.TbCostomerService;
 import com.pj.project.tb_declare.TbDeclare;
@@ -110,6 +113,10 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
 
     @Resource
     private TbNoticesService tbNoticesService;
+
+    @Resource
+    private TbCarNoColorService tbCarNoColorService;
+
     @Resource
     TbBusinessCarService tbBusinessCarService;
     @Resource
@@ -122,6 +129,7 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
     WxService wxService;
     @Resource
     MyConfig myConfig;
+    private final List<String> CAR_LIST = StrUtil.splitTrim("浙,粤,京,津,冀,晋,蒙,辽,黑,沪,吉,苏,皖,赣,鲁,豫,鄂,湘,桂,琼,渝,川,贵,云,藏, 陕, 甘, 青, 宁", ",");
 
 
     public TbBusiness checkCarNo(String carNo) {
@@ -208,9 +216,14 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
             if (car != null) {
                 tbBusinessCar.setId(car.getId()).setRealInTime(car.getRealInTime());
             }
+            TbCar tbCar = tbCarService.findByCardNo(carNo);
             tbBusinessCar.setBusinessId(t.getId());
-            tbBusinessCar.setCarNo(carNo);
+            tbBusinessCar.setCarNo(carNo).setCarCompany(tbCar!=null?tbCar.getCustomerName():"临时");
             tbBusinessCar.setBusinessId(t.getId()).setCustomerId(t.getCustomerId());
+            if(StrUtil.isEmpty(tbBusinessCar.getNo())){
+                tbBusinessCar.setNo(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmm")) + RandomUtil.randomNumbers(4));
+            }
+
         });
         String yueCarNo = t.getCardNo().toUpperCase();
         TbBusinessCar yueCar = tbBusinessCarService.findInAndNoBusinessCar(yueCarNo);
@@ -221,13 +234,14 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
             }
         }
         yueCar.setBusinessId(t.getId()).setCarSize(t.getCardSize()).setCarNo(yueCarNo).setCustomerId(t.getCustomerId());
+        if(StrUtil.isEmpty(yueCar.getNo())){
+            yueCar.setNo(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmm")) + RandomUtil.randomNumbers(4));
+        }
         carList.add(yueCar);
         tbBusinessCarService.saveOrUpdateBatch(carList);
-        BigDecimal initCarPartMoney = partConfig.getBasePrice();
+//        BigDecimal initCarPartMoney = partConfig.getBasePrice();
         t.setItemPrice(price)
-                .setTotalMoney(price.add(initCarPartMoney.multiply(new BigDecimal(carList.size()))))
-                .setChinaPartMoney(initCarPartMoney.multiply(new BigDecimal(carList.size() - 1)))
-                .setPartMoney(initCarPartMoney);
+                .setTotalMoney(price);
         this.saveOrUpdate(t);
         if (StrUtil.isNotEmpty(t.getDeclareNo())) {
             TbDeclare tbDeclare = tbDeclareService.findByDeclareNo(t.getDeclareNo());
@@ -405,6 +419,7 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
     }
 
     @Async
+    @Deprecated
     public void calculationPartMoney(String itemType, TbBusiness tbBusiness) {
         Date iTime = tbBusiness.getRealInTime();
         Date oTime = tbBusiness.getOutDayTime();
@@ -412,7 +427,7 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
             iTime = tbBusiness.getChinaCarInTime();
             oTime = tbBusiness.getChinaCarOutTime();
         }
-        BigDecimal price = calculationPartMoney(iTime, oTime, true);
+        BigDecimal price = calculationPartMoney(iTime, oTime);
         if (itemType.contains("中国")) {
             int len = tbBusiness.getCardNo().split(" ").length;
             tbBusiness.setChinaPartMoney(price.multiply(new BigDecimal(len)));
@@ -422,7 +437,7 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
         tbBusiness.setTotalMoney(tbBusiness.getItemPrice().add(tbBusiness.getChinaPartMoney()).add(tbBusiness.getPartMoney()));
     }
 
-    public BigDecimal calculationPartMoney(Date iTime, Date oTime, boolean businessCar) {
+    public BigDecimal calculationPartMoney(Date iTime, Date oTime) {
         LocalDateTime inDayTime = iTime.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
         LocalDateTime outDayTime = oTime.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
         long minutes = ChronoUnit.MINUTES.between(inDayTime, outDayTime);
@@ -431,15 +446,13 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
             return zero;
         }
         long days = ChronoUnit.DAYS.between(inDayTime.toLocalDate(), outDayTime.toLocalDate());
-        long hour = ChronoUnit.HOURS.between(inDayTime, outDayTime);
-        BigDecimal basePrice = businessCar ? partConfig.getBasePrice() : new BigDecimal("0");
         BigDecimal p = partConfig.getBasePrice();//乘积因子
         BigDecimal extraPrice = partConfig.getExtraPrice();
-        BigDecimal unit = new BigDecimal(hour / 24);
-        if (minutes > partConfig.getFreeMinutes() && minutes < 24 * 60) {
-            unit = new BigDecimal("1");
+        int unit = (int) Math.ceil(NumberUtil.div(minutes, 24 * 60));
+        if (minutes < partConfig.getFreeMinutes()) {
+            unit = 0;
         }
-        return basePrice.add(p.multiply(unit)).add(new BigDecimal(days).multiply(extraPrice));
+        return p.multiply(new BigDecimal(unit)).add(new BigDecimal(days).multiply(extraPrice));
     }
 
 
@@ -473,6 +486,7 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
         TbBusinessCar car = tbBusinessCarService.getById(carId);
         String businessId = car.getBusinessId();
         result.put("businessId", businessId);
+        result.put("type", 0);
         List<TbBusinessCar> cars = tbBusinessCarService.findByBusinessId(businessId);
         if (cars.isEmpty()) {
             cars.add(car);
@@ -480,13 +494,24 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
         Date now = new Date();
         List<Map<String, Object>> carsList = new ArrayList<>();
         for (TbBusinessCar tbBusinessCar : cars) {
-            BigDecimal basePrice = StrUtil.isEmpty(tbBusinessCar.getBusinessId()) ? new BigDecimal("0") : tbBusinessCar.getBasePartMoney();
-            double partMoney = basePrice.doubleValue();
             Date inTime = tbBusinessCar.getRealInTime();
-            if (inTime != null) {
-                BigDecimal price = this.calculationPartMoney(inTime, now, StrUtil.isNotEmpty(tbBusinessCar.getBusinessId()));
-                BigDecimal money = tbBusinessCar.getMoney();
-                partMoney = money == null ? price.subtract(basePrice).doubleValue() : price.subtract(money).doubleValue();
+            BigDecimal partMoney = new BigDecimal("0");
+            String carNo = tbBusinessCar.getCarNo().substring(0, 1);
+            if (inTime != null && CAR_LIST.contains(carNo)) {
+                if (tbBusinessCar.getPay()==1){
+                    inTime=tbBusinessCar.getPayTime();
+                }
+                partMoney = this.calculationPartMoney(inTime, now);
+            }
+//            BigDecimal hasPayMoney = tbBusinessCar.getMoney();
+//            partMoney = partMoney.subtract(hasPayMoney);
+            if (StrUtil.isNotEmpty(tbBusinessCar.getColor())) {
+                List<TbCarNoColor> freeList = tbCarNoColorService.getFreeColor();
+                List<String> colorList = freeList.stream().map(f -> f.getCarNoColor().substring(0, 1)).collect(Collectors.toList());
+                String color = tbBusinessCar.getColor().substring(0, 1);
+                if (colorList.contains(color)) {
+                    partMoney=new BigDecimal("0");
+                }
             }
             Map<String, Object> carMap = new HashMap<>();
             carMap.put("price", partMoney);
@@ -499,6 +524,12 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
             }
             carsList.add(carMap);
         }
+        if (StrUtil.isNotEmpty(businessId)){
+            TbBusiness tbBusiness=this.getById(businessId);
+            if (tbBusiness!=null){
+                result.put("type", tbBusiness.getBusinessType());
+            }
+        }
         result.put("carList", carsList);
         result.put("itemList", Collections.emptyList());
         TbBusiness tbBusiness = this.getById(businessId);
@@ -510,8 +541,8 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
             for (TbBusinessItem item : items) {
                 Map<String, Object> itemMap = new HashMap<>();
                 itemMap.put("id", item.getId());
-                itemMap.put("name", item.getItemName());
-                itemMap.put("price", item.getItemPrice());
+                itemMap.put("name", item.getItemName()+"("+item.getItemTypeName()+")");
+                itemMap.put("price", item.getItemPrice().multiply(new BigDecimal(item.getNum())));
                 itemMap.put("pay", item.getPayStatus());
                 itemList.add(itemMap);
             }

+ 41 - 0
sp-server/src/main/java/com/pj/project/tb_business_car/ExportTbBusinessDTO.java

@@ -0,0 +1,41 @@
+package com.pj.project.tb_business_car;
+
+import com.alibaba.excel.annotation.ExcelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+@Data
+@EqualsAndHashCode
+public class ExportTbBusinessDTO {
+    @ExcelProperty("车牌号")
+    private String carNo;
+
+    @ExcelProperty("车牌颜色")
+    private String color;
+
+    @ExcelProperty("车辆规格")
+    private String size;
+
+    @ExcelProperty("入场时间")
+    private Date realInTime;
+
+    @ExcelProperty("入场通道")
+    private String inChannel;
+
+    @ExcelProperty("离场时间")
+    private Date realOutTime;
+    @ExcelProperty("离场通道")
+    private String outChannel;
+
+    @ExcelProperty("停车费")
+    private BigDecimal money;
+
+    @ExcelProperty("支付状态")
+    private String payType;
+
+    @ExcelProperty("支付时间")
+    private Date payTime;
+}

+ 103 - 89
sp-server/src/main/java/com/pj/project/tb_business_car/TbBusinessCar.java

@@ -2,10 +2,17 @@ package com.pj.project.tb_business_car;
 
 import java.io.Serializable;
 import java.math.BigDecimal;
+import java.time.LocalDateTime;
+import java.time.ZoneId;
+import java.time.temporal.ChronoUnit;
 import java.util.Date;
+import java.util.List;
 
+import cn.hutool.core.util.StrUtil;
+import cn.hutool.extra.spring.SpringUtil;
 import com.baomidou.mybatisplus.annotation.*;
 import com.baomidou.mybatisplus.extension.activerecord.Model;
+import com.pj.current.config.PartConfig;
 import lombok.EqualsAndHashCode;
 
 import lombok.Data;
@@ -13,8 +20,9 @@ import lombok.experimental.Accessors;
 import org.springframework.data.annotation.Id;
 
 /**
- * Model: tb_business_car -- 
- * @author qzy 
+ * Model: tb_business_car --
+ *
+ * @author qzy
  */
 @Data
 @Accessors(chain = true)
@@ -22,93 +30,99 @@ import org.springframework.data.annotation.Id;
 @EqualsAndHashCode(callSuper = false)
 public class TbBusinessCar extends Model<TbBusinessCar> implements Serializable {
 
-	// ---------- 模块常量 ----------
-	/**
-	 * 序列化版本id 
-	 */
-	private static final long serialVersionUID = 1L;	
-	/**
-	 * 此模块对应的表名 
-	 */
-	public static final String TABLE_NAME = "tb_business_car";	
-	/**
-	 * 此模块对应的权限码 
-	 */
-	public static final String PERMISSION_CODE = "tb-business-car";
-	public static final String PERMISSION_LIST = "tb-business-car-list";
-
-
-	// ---------- 表中字段 ----------
-	/**
-	 *  
-	 */
-	@TableId(type = IdType.AUTO)
-	private String id;
-
-	/**
-	 *  
-	 */
-	private String businessId;
-
-	private String customerId;
-
-	/**
-	 *  
-	 */
-	private String carNo;	
-
-	/**
-	 *  
-	 */
-	private Date preInTime;
-
-	/**
-	 *  
-	 */
-	private Date preOutTime;
-
-	/**
-	 *  
-	 */
-	private Date realInTime;
-
-	/**
-	 *  
-	 */
-	private Date realOutTime;
-
-	/**
-	 *  
-	 */
-	private BigDecimal money=new BigDecimal("0");
-
-	/**
-	 *  
-	 */
-	private String driverPhone;
-	private String driverName;
-
-	private Double carSize;
-	/**
-	 * 是否支付 0 否 1 是
-	 */
-	private Integer pay;
-	private Date payTime;
-	private BigDecimal basePartMoney;
-	private String inChannel;
-	private String outChannel;
-
-	@TableField(value = "is_lock")
-	private Integer isLock;
-
-	private String inImage;
-	private String outImage;
-
-
-
-
-
-	
+    // ---------- 模块常量 ----------
+    /**
+     * 序列化版本id
+     */
+    private static final long serialVersionUID = 1L;
+    /**
+     * 此模块对应的表名
+     */
+    public static final String TABLE_NAME = "tb_business_car";
+    /**
+     * 此模块对应的权限码
+     */
+    public static final String PERMISSION_CODE = "tb-business-car";
+    public static final String PERMISSION_LIST = "tb-business-car-list";
+
+
+    // ---------- 表中字段 ----------
+    /**
+     *
+     */
+    @TableId(type = IdType.AUTO)
+    private String id;
+
+    /**
+     *
+     */
+    private String businessId;
+
+    private String customerId;
+
+    /**
+     *
+     */
+    private String carNo;
+    private String color;
+
+    /**
+     *
+     */
+    private Date preInTime;
+
+    /**
+     *
+     */
+    private Date preOutTime;
+
+    /**
+     *
+     */
+    private Date realInTime;
+
+    /**
+     *
+     */
+    private Date realOutTime;
+
+    /**
+     *
+     */
+    private BigDecimal money = new BigDecimal("0");
+
+    /**
+     *
+     */
+    private String driverPhone;
+    private String driverName;
+    private String carCompany;
+
+    private Double carSize;
+    /**
+     * 是否支付 0 否 1 是
+     */
+    private Integer pay;
+    private Date payTime;
+    private BigDecimal basePartMoney;
+    private String inChannel;
+    private String outChannel;
+
+    @TableField(value = "is_lock")
+    private Integer isLock;
+
+    private String inImage;
+    private String outImage;
+
+    private String no;
+
+    private Date timeUpdate;
+
+
+    @TableField(exist = false)
+    private String payType;
+
+
 
 
 }

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

@@ -98,28 +98,14 @@ public class TbBusinessCarController {
         tbBusinessCarService.updateCarRecord(t);
         return AjaxJson.getSuccess();
     }
+    @RequestMapping("export")
+    @SaCheckPermission(TbBusiness.PERMISSION_CODE)
+    public AjaxJson export() {
+    	SoMap soMap=SoMap.getRequestSoMap();
+        return AjaxJson.getSuccessData( tbBusinessCarService.export(soMap));
+    }
+
 
-	
-	
-	
-	
-	// ------------------------- 前端接口 -------------------------
-	
-	
-	/** 改 - 不传不改 [G] */
-	@RequestMapping("updateByNotNull")
-	public AjaxJson updateByNotNull(Long id){
-		AjaxError.throwBy(true, "如需正常调用此接口,请删除此行代码");
-		// 鉴别身份,是否为数据创建者 
-		long userId = SP.publicMapper.getColumnByIdToLong(TbBusinessCar.TABLE_NAME, "user_id", id);
-		AjaxError.throwBy(userId != StpUserUtil.getLoginIdAsLong(), "此数据您无权限修改");
-		// 开始修改 (请只保留需要修改的字段)
-		SoMap so = SoMap.getRequestSoMap();
-		so.clearNotIn("id", "businessId", "carNo", "preInTime", "preOutTime", "realInTime", "realOutTime", "money", "driverPhone").clearNull().humpToLineCase();	
-		int line = SP.publicMapper.updateBySoMapById(TbBusinessCar.TABLE_NAME, so, id);
-		return AjaxJson.getByLine(line);
-	}
-	
 	
 	
 	

+ 21 - 2
sp-server/src/main/java/com/pj/project/tb_business_car/TbBusinessCarMapper.xml

@@ -38,6 +38,24 @@
             <if test=' this.has("money") '>and money = #{money}</if>
             <if test=' this.has("driverPhone") '>and driver_phone = #{driverPhone}</if>
             <if test=' this.has("pay") '>and pay = #{pay}</if>
+            <if test='leave==2 '>
+              and   real_out_time is not null
+            </if>
+            <if test='leave==3 '>
+                and   real_out_time is  null
+            </if>
+            <if test="leaveStart!=null and leaveStart !=''">
+              and  date_format(real_out_time,'%Y-%m-%d %H:%m:%s') &gt;=#{leaveStart}
+            </if>
+            <if test="leaveEnd!=null and leaveEnd !=''">
+                and  date_format(real_out_time,'%Y-%m-%d %H:%m:%s') &lt;=#{leaveEnd}
+            </if>
+            <if test="inStart!=null and inStart !=''">
+                and  date_format(real_in_time,'%Y-%m-%d %H:%m:%s') &gt;=#{inStart}
+            </if>
+            <if test="inEnd!=null and inEnd !=''">
+                and  date_format(real_in_time,'%Y-%m-%d %H:%m:%s') &lt;=#{inEnd}
+            </if>
         </where>
         order by
         <choose>
@@ -50,6 +68,7 @@
             <when test='sortType == 7'>real_out_time desc</when>
             <when test='sortType == 8'>money desc</when>
             <when test='sortType == 9'>driver_phone desc</when>
+            <when test='sortType == 10'>time_update desc</when>
             <otherwise>id desc</otherwise>
         </choose>
     </select>
@@ -61,8 +80,9 @@
             tb_business b
         where
             a.business_id = b.id
-            AND b.total_money> b.pay_money
+            AND (b.total_money> b.pay_money or a.pay=0)
             AND a.car_no LIKE CONCAT( '%', #{carNo}, '%' )
+
 	</select>
     <select id="findTheNoBusinessCar" resultType="com.pj.project.tb_business_car.TbBusinessCar">
             SELECT * from tb_business_car
@@ -70,7 +90,6 @@
              and car_no like CONCAT('%',#{carNo},'%')
              and real_in_time is not null
              and real_out_time is null
-             AND pay=0
     </select>
 
 

+ 95 - 19
sp-server/src/main/java/com/pj/project/tb_business_car/TbBusinessCarService.java

@@ -1,19 +1,38 @@
 package com.pj.project.tb_business_car;
 
+import java.io.File;
+import java.time.LocalDateTime;
+import java.time.ZoneId;
+import java.time.temporal.ChronoUnit;
+import java.math.BigDecimal;
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
 import java.util.*;
 import java.util.stream.Collectors;
 
+import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.date.DateUtil;
+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.extra.spring.SpringUtil;
+import com.alibaba.excel.EasyExcel;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.pj.current.config.PartConfig;
+import com.pj.current.config.SystemObject;
 import com.pj.project.tb_business.TbBusiness;
 import com.pj.project.tb_business.TbBusinessService;
 import com.pj.project.tb_business_item.TbBusinessItem;
 import com.pj.project.tb_business_item.TbBusinessItemService;
+import com.pj.project.tb_car.TbCar;
+import com.pj.project.tb_car.TbCarService;
+import com.pj.project.tb_car_no_color.TbCarNoColorService;
 import com.pj.project.tb_fee_details.TbFeeDetails;
 import com.pj.project.tb_fee_details.TbFeeDetailsService;
+import com.pj.project4sp.uploadfile.UploadConfig;
 import com.pj.utils.so.SoMap;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Lazy;
@@ -43,17 +62,43 @@ public class TbBusinessCarService extends ServiceImpl<TbBusinessCarMapper, TbBus
     @Lazy
     private TbBusinessService tbBusinessService;
     @Resource
-    PartConfig partConfig;
+    TbCarService tbCarService;
     @Resource
     @Lazy
     TbFeeDetailsService tbFeeDetailsService;
 
+    @Resource
+    private UploadConfig uploadConfig;
+
 
     /**
      * 查集合 - 根据条件(参数为空时代表忽略指定条件)
      */
     List<TbBusinessCar> getList(SoMap so) {
-        return tbBusinessCarMapper.getList(so);
+        List<TbBusinessCar> list=tbBusinessCarMapper.getList(so);
+        for (TbBusinessCar tbBusinessCar : list) {
+            TbCar tbCar = tbCarService.findByCardNo(tbBusinessCar.getCarNo());
+            if (tbCar != null && !TbCar.CarTypeEnum.BUSINESS_CAR.getType().equals(tbCar.getCarType())) {
+                tbBusinessCar.setPayType("免费");
+                continue;
+            }
+            final List<String> CAR_LIST = StrUtil.splitTrim("浙,粤,京,津,冀,晋,蒙,辽,黑,沪,吉,苏,皖,赣,鲁,豫,鄂,湘,桂,琼,渝,川,贵,云,藏, 陕, 甘, 青, 宁", ",");
+            Date inTime = tbBusinessCar.getRealInTime();
+            Date outTime = tbBusinessCar.getRealOutTime();
+            if (inTime != null && outTime != null) {
+                LocalDateTime inDayTime = inTime.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
+                LocalDateTime outDayTime = outTime.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
+                long minutes = ChronoUnit.MINUTES.between(inDayTime, outDayTime);
+                PartConfig partConfig = SpringUtil.getBean(PartConfig.class);
+                if (minutes < partConfig.getFreeMinutes() || !CAR_LIST.contains(tbBusinessCar.getCarNo().substring(0, 1))) {
+                    tbBusinessCar.setPayType("免费");
+                    continue;
+                }
+            }
+            String type = tbBusinessCar.getPay() == null || tbBusinessCar.getPay() == 0 ? "未支付" : "已支付";
+            tbBusinessCar.setPayType(type);
+        }
+        return list;
     }
 
     public TbBusinessCar findByBusinessIdAndCarNo(String businessId, String carNo) {
@@ -91,7 +136,7 @@ public class TbBusinessCarService extends ServiceImpl<TbBusinessCarMapper, TbBus
 
 
     public List<TbBusinessCar> searchPartCar(String carNo) {
-        return   tbBusinessCarMapper.searchPartCar(carNo.toUpperCase());
+        return tbBusinessCarMapper.searchPartCar(carNo.toUpperCase());
     }
 
 
@@ -132,9 +177,8 @@ public class TbBusinessCarService extends ServiceImpl<TbBusinessCarMapper, TbBus
             tbBusiness.setCardNo(carNo);
             tbBusiness.setCardSize(t.getCarSize());
         }
-        tbBusiness.setChinaPartMoney(tbBusiness.getChinaPartMoney().add(partConfig.getBasePrice()))
-                .setTotalMoney(tbBusiness.getTotalMoney().add(partConfig.getBasePrice()));
         tbBusinessService.updateById(tbBusiness);
+        t.setNo(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmm")) + RandomUtil.randomNumbers(4));
         this.save(t);
     }
 
@@ -179,13 +223,6 @@ public class TbBusinessCarService extends ServiceImpl<TbBusinessCarMapper, TbBus
             return AjaxJson.getError("越南车不能删除");
         }
         this.removeById(id);
-        TbBusiness tbBusiness = tbBusinessService.getById(db.getBusinessId());
-
-        if (tbBusiness != null) {
-            tbBusiness.setChinaPartMoney(tbBusiness.getChinaPartMoney().subtract(partConfig.getBasePrice()))
-                    .setTotalMoney(tbBusiness.getTotalMoney().subtract(partConfig.getBasePrice()));
-            tbBusinessService.updateById(tbBusiness);
-        }
         return AjaxJson.getSuccess();
     }
 
@@ -210,15 +247,16 @@ public class TbBusinessCarService extends ServiceImpl<TbBusinessCarMapper, TbBus
         if (db != null) {
             throw new Exception("该车有未完成业务");
         }
-        t.setPay(0);
+        t.setCarNo(carNo).setPay(0).setCarSize(0D).setIsLock(0).setBasePartMoney(new BigDecimal("0"))
+                .setNo(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmm")) + RandomUtil.randomNumbers(4));
         this.save(t);
     }
 
     public void updateCarRecord(TbBusinessCar t) throws Exception {
-        if(StrUtil.isEmpty(t.getBusinessId())) {
+        if (StrUtil.isEmpty(t.getBusinessId())) {
             t.setBusinessId(null);
         }
-        if(StrUtil.isEmpty(t.getCustomerId())) {
+        if (StrUtil.isEmpty(t.getCustomerId())) {
             t.setCustomerId(null);
         }
         String carNo = t.getCarNo().toUpperCase();
@@ -233,15 +271,15 @@ public class TbBusinessCarService extends ServiceImpl<TbBusinessCarMapper, TbBus
         if (businessCar != null && !StrUtil.equals(t.getId(), businessCar.getId())) {
             throw new Exception("车辆已存在");
         }
-
+        t.setCarNo(carNo);
         this.updateById(t);
         TbBusiness tbBusiness = tbBusinessService.getById(t.getBusinessId());
-        if(tbBusiness != null) {
-            if (!CAR_LIST.contains(carNo.substring(0,1))) {
+        if (tbBusiness != null) {
+            if (!CAR_LIST.contains(carNo.substring(0, 1))) {
                 tbBusiness.setCardNo(carNo);
             } else {
                 List<TbBusinessCar> cars = this.findByBusinessId(t.getBusinessId());
-                String chiaCarNo = cars.stream().filter(obj -> CAR_LIST.contains(obj.getCarNo().substring(0,1))).map(TbBusinessCar::getCarNo).collect(Collectors.joining("、"));
+                String chiaCarNo = cars.stream().filter(obj -> CAR_LIST.contains(obj.getCarNo().substring(0, 1))).map(TbBusinessCar::getCarNo).collect(Collectors.joining("、"));
                 tbBusiness.setChinaCarNo(chiaCarNo);
             }
             tbBusinessService.updateById(tbBusiness);
@@ -249,6 +287,12 @@ public class TbBusinessCarService extends ServiceImpl<TbBusinessCarMapper, TbBus
             List<TbFeeDetails> feeDetailsLIst = tbFeeDetailsService.getByBusinessIdAndCarNo(businessId, oldCarNo);
             feeDetailsLIst.forEach(fee -> fee.setCarNo(carNo));
             tbFeeDetailsService.updateBatchById(feeDetailsLIst);
+        } else{
+            TbFeeDetails feeDetail = tbFeeDetailsService.getByBusinessCarIdAndCarNoAndFeeType(t.getId(), oldCarNo, TbFeeDetails.fee.PARK_FEE.getCode());
+            if(feeDetail != null){
+                feeDetail.setCarNo(carNo);
+                tbFeeDetailsService.updateById(feeDetail);
+            }
         }
 
     }
@@ -256,4 +300,36 @@ public class TbBusinessCarService extends ServiceImpl<TbBusinessCarMapper, TbBus
     public List<TbBusinessCar> findTheNoBusinessCar(String carNo) {
         return tbBusinessCarMapper.findTheNoBusinessCar(carNo);
     }
+
+    public String export(SoMap soMap) {
+        List<TbBusinessCar> cars = this.getList(soMap);
+        List<ExportTbBusinessDTO> list = new ArrayList<>(cars.size());
+        cars.forEach(tbBusinessCar -> {
+            ExportTbBusinessDTO dto = new ExportTbBusinessDTO();
+            BeanUtil.copyProperties(tbBusinessCar, dto);
+            Double carSize = tbBusinessCar.getCarSize();
+            dto.setSize(carSize + "");
+            if (carSize == null || carSize == 0) {
+                dto.setSize("-");
+            }
+            list.add(dto);
+        });
+        String flieTypeFolder = "/export/";
+        String currDateFolder = DateUtil.today();
+        String fileName = "car-record-" + RandomUtil.randomNumbers(6) + ".xlsx";
+        String fileFolder = new File(uploadConfig.rootFolder).getAbsolutePath() +
+                uploadConfig.httpPrefix + flieTypeFolder + currDateFolder + "/";
+        if (!FileUtil.exist(fileFolder)) {
+            FileUtil.mkdir(fileFolder);
+        }
+        EasyExcel.write(fileFolder + fileName, ExportTbBusinessDTO.class).sheet("车辆放行记录")
+                .doWrite(() -> list);
+        return SystemObject.config.getDomain() + uploadConfig.httpPrefix + flieTypeFolder + currDateFolder + "/" + fileName;
+    }
+
+    public List<TbBusinessCar> findByCarNo(String carNo) {
+        QueryWrapper<TbBusinessCar>ew=new QueryWrapper<>();
+        ew.eq("car_no",carNo);
+        return list(ew);
+    }
 }

+ 6 - 0
sp-server/src/main/java/com/pj/project/tb_business_people/TbBusinessPeopleService.java

@@ -52,4 +52,10 @@ public class TbBusinessPeopleService extends ServiceImpl<TbBusinessPeopleMapper,
 		ew.eq("business_id",businessId);
 		this.remove(ew);
 	}
+
+	public List<TbBusinessPeople> findByBusinessId(String businessId) {
+		QueryWrapper<TbBusinessPeople>ew=new QueryWrapper<>();
+		ew.eq("business_id",businessId);
+		return list(ew);
+	}
 }

+ 1 - 1
sp-server/src/main/java/com/pj/project/tb_car/ImportCarListener.java

@@ -52,7 +52,7 @@ public class ImportCarListener extends AnalysisEventListener<ImportCarBO> {
             if (StrUtil.isEmpty(carNo)) {
                 throw new BusinessException(customerName + "的车牌号不能为空");
             }
-            carNo = carNo.toUpperCase();
+            carNo = carNo.toUpperCase().trim();
             TbCar db = tbCarService.findByCardNo(carNo);
             if (db == null) {
                 db = new TbCar();

+ 1 - 0
sp-server/src/main/java/com/pj/project/tb_car/TbCar.java

@@ -71,6 +71,7 @@ public class TbCar extends Model<TbCar> implements Serializable {
 
 
     private String countryName;
+    private String remark;
 
     /**
      * 最后一次运输商品

+ 13 - 0
sp-server/src/main/java/com/pj/project/tb_car/TbCarService.java

@@ -42,12 +42,19 @@ public class TbCarService extends ServiceImpl<TbCarMapper, TbCar> implements ISe
      * 增
      */
     void add(TbCar t) {
+        String cardNo=t.getCardNo().trim();
+        TbCar db = this.findByCardNo(cardNo);
+        if (db!=null){
+            throw new BusinessException("车辆已存在");
+        }
         if (StrUtil.isEmpty(t.getCustomerId())) {
             throw new BusinessException("请选择车辆所属");
         }
+        t.setCardNo(cardNo);
         super.save(t);
     }
 
+
     /**
      * 删
      */
@@ -59,6 +66,12 @@ public class TbCarService extends ServiceImpl<TbCarMapper, TbCar> implements ISe
      * 改
      */
     void update(TbCar t) {
+        String cardNo=t.getCardNo().trim();
+        TbCar db = this.findByCardNo(cardNo);
+        if (db!=null&&!StrUtil.equals(t.getId(),db.getId())) {
+            throw new BusinessException("车辆已存在");
+        }
+        t.setCardNo(cardNo);
         super.updateById(t);
     }
 

+ 60 - 0
sp-server/src/main/java/com/pj/project/tb_car_no_color/TbCarNoColor.java

@@ -0,0 +1,60 @@
+package com.pj.project.tb_car_no_color;
+
+import java.io.Serializable;
+import com.baomidou.mybatisplus.annotation.*;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import lombok.EqualsAndHashCode;
+
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+/**
+ * Model: tb_car_no_color -- 车牌颜色
+ * @author qzy 
+ */
+@Data
+@Accessors(chain = true)
+@TableName(TbCarNoColor.TABLE_NAME)
+@EqualsAndHashCode(callSuper = false)
+public class TbCarNoColor extends Model<TbCarNoColor> implements Serializable {
+
+	// ---------- 模块常量 ----------
+	/**
+	 * 序列化版本id 
+	 */
+	private static final long serialVersionUID = 1L;	
+	/**
+	 * 此模块对应的表名 
+	 */
+	public static final String TABLE_NAME = "tb_car_no_color";	
+	/**
+	 * 此模块对应的权限码 
+	 */
+	public static final String PERMISSION_CODE = "tb-car-no-color";	
+
+
+	// ---------- 表中字段 ----------
+	/**
+	 * 主键 
+	 */
+	@TableId(type = IdType.AUTO)
+	private Long id;	
+
+	/**
+	 * 颜色 
+	 */
+	private String carNoColor;	
+
+	/**
+	 * 状态(0=禁用;1=启用) 
+	 */
+	private String status;	
+
+
+
+
+
+	
+
+
+}

+ 105 - 0
sp-server/src/main/java/com/pj/project/tb_car_no_color/TbCarNoColorController.java

@@ -0,0 +1,105 @@
+package com.pj.project.tb_car_no_color;
+
+import java.util.List;
+
+import com.pj.utils.so.SoMap;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.bind.annotation.*;
+
+import com.pj.utils.sg.*;
+import com.pj.project4sp.SP;
+
+import com.pj.current.satoken.StpUserUtil;
+import cn.dev33.satoken.annotation.SaCheckPermission;
+
+
+/**
+ * Controller: tb_car_no_color -- 车牌颜色
+ * @author qzy 
+ */
+@RestController
+@RequestMapping("/TbCarNoColor/")
+public class TbCarNoColorController {
+
+	/** 底层 Service 对象 */
+	@Autowired
+	TbCarNoColorService tbCarNoColorService;
+
+	/** 增 */  
+	@RequestMapping("add")
+	@SaCheckPermission(TbCarNoColor.PERMISSION_CODE)
+	@Transactional(rollbackFor = Exception.class)
+	public AjaxJson add(TbCarNoColor t){
+		tbCarNoColorService.add(t);
+		t = tbCarNoColorService.getById(SP.publicMapper.getPrimarykey());
+		return AjaxJson.getSuccessData(t);
+	}
+
+	/** 删 */  
+	@RequestMapping("delete")
+	@SaCheckPermission(TbCarNoColor.PERMISSION_CODE)
+	public AjaxJson delete(Long id){
+		int line = tbCarNoColorService.delete(id);
+		return AjaxJson.getByLine(line);
+	}
+	
+	/** 删 - 根据id列表 */  
+	@RequestMapping("deleteByIds")
+	@SaCheckPermission(TbCarNoColor.PERMISSION_CODE)
+	public AjaxJson deleteByIds(){
+		List<Long> ids = SoMap.getRequestSoMap().getListByComma("ids", long.class);
+		int line = SP.publicMapper.deleteByIds(TbCarNoColor.TABLE_NAME, ids);
+		return AjaxJson.getByLine(line);
+	}
+	
+	/** 改 */  
+	@RequestMapping("update")
+	@SaCheckPermission(TbCarNoColor.PERMISSION_CODE)
+	public AjaxJson update(TbCarNoColor t){
+		int line = tbCarNoColorService.update(t);
+		return AjaxJson.getByLine(line);
+	}
+
+	/** 查 - 根据id */  
+	@RequestMapping("getById")
+	public AjaxJson getById(Long id){
+		TbCarNoColor t = tbCarNoColorService.getById(id);
+		return AjaxJson.getSuccessData(t);
+	}
+
+	/** 查集合 - 根据条件(参数为空时代表忽略指定条件) */  
+	@RequestMapping("getList")
+	public AjaxJson getList() { 
+		SoMap so = SoMap.getRequestSoMap();
+		List<TbCarNoColor> list = tbCarNoColorService.getList(so.startPage());
+		return AjaxJson.getPageData(so.getDataCount(), list);
+	}
+	
+	
+	
+	
+	// ------------------------- 前端接口 -------------------------
+	
+	
+	/** 改 - 不传不改 [G] */
+	@RequestMapping("updateByNotNull")
+	public AjaxJson updateByNotNull(Long id){
+		AjaxError.throwBy(true, "如需正常调用此接口,请删除此行代码");
+		// 鉴别身份,是否为数据创建者 
+		long userId = SP.publicMapper.getColumnByIdToLong(TbCarNoColor.TABLE_NAME, "user_id", id);
+		AjaxError.throwBy(userId != StpUserUtil.getLoginIdAsLong(), "此数据您无权限修改");
+		// 开始修改 (请只保留需要修改的字段)
+		SoMap so = SoMap.getRequestSoMap();
+		so.clearNotIn("id", "carNoColor", "status").clearNull().humpToLineCase();	
+		int line = SP.publicMapper.updateBySoMapById(TbCarNoColor.TABLE_NAME, so, id);
+		return AjaxJson.getByLine(line);
+	}
+	
+	
+	
+	
+	
+	
+
+}

+ 56 - 0
sp-server/src/main/java/com/pj/project/tb_car_no_color/TbCarNoColorMapper.java

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

+ 76 - 0
sp-server/src/main/java/com/pj/project/tb_car_no_color/TbCarNoColorMapper.xml

@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.pj.project.tb_car_no_color.TbCarNoColorMapper">
+
+	<!-- 增 [G] -->
+	<insert id="add">
+		insert into 
+		tb_car_no_color (id, car_no_color, status) 
+		values (#{id}, #{carNoColor}, #{status}) 
+	</insert>
+
+	<!-- 删 -->
+	<delete id="delete">
+		delete from tb_car_no_color 
+		where id = #{id}
+	</delete>
+
+	<!-- 改 [G] -->
+	<update id="update">
+		update tb_car_no_color set
+		id = #{id}, 
+		car_no_color = #{carNoColor}, 
+		status = #{status}
+		where id = #{id}
+	</update>
+
+
+	<!-- ================================== 查询相关 ================================== -->
+	<!-- select id, car_no_color, status from tb_car_no_color  -->
+	
+	<!-- 通用映射:手动模式 -->
+	<resultMap id="model" type="com.pj.project.tb_car_no_color.TbCarNoColor">
+		<result property="id" column="id" />
+		<result property="carNoColor" column="car_no_color" />
+		<result property="status" column="status" />
+	</resultMap>
+	
+	<!-- 公共查询sql片段 -->
+	<sql id="select_sql">
+		select * 
+		from tb_car_no_color 
+	</sql>
+	
+	<!-- 查 - 根据id -->
+	<select id="getById" resultMap="model">
+		<include refid="select_sql"></include>
+		where id = #{id}
+	</select>
+	
+	<!-- 查集合 - 根据条件(参数为空时代表忽略指定条件) [G] -->
+	<select id="getList" resultMap="model">
+		<include refid="select_sql"></include>
+		<where>
+			<if test=' this.has("id") '> and id = #{id} </if>
+			<if test=' this.has("carNoColor") '> and car_no_color = #{carNoColor} </if>
+			<if test=' this.has("status") '> and status = #{status} </if>
+		</where>
+		order by
+		<choose>
+			<when test='sortType == 1'> id desc </when>
+			<when test='sortType == 2'> car_no_color desc </when>
+			<when test='sortType == 3'> status desc </when>
+			<otherwise> id asc </otherwise>
+		</choose>
+	</select>
+	
+	
+	
+	
+	
+	
+	
+	
+	
+
+</mapper>

+ 58 - 0
sp-server/src/main/java/com/pj/project/tb_car_no_color/TbCarNoColorService.java

@@ -0,0 +1,58 @@
+package com.pj.project.tb_car_no_color;
+
+import java.util.List;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.pj.project.tb_business_car.TbBusinessCar;
+import com.pj.project.tb_business_car.TbBusinessCarMapper;
+import com.pj.utils.so.SoMap;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import com.pj.utils.sg.*;
+
+/**
+ * Service: tb_car_no_color -- 车牌颜色
+ * @author qzy 
+ */
+@Service
+public class TbCarNoColorService extends ServiceImpl<TbCarNoColorMapper, TbCarNoColor> implements IService<TbCarNoColor> {
+
+	/** 底层 Mapper 对象 */
+	@Autowired
+	TbCarNoColorMapper tbCarNoColorMapper;
+
+	/** 增 */
+	int add(TbCarNoColor t){
+		return tbCarNoColorMapper.add(t);
+	}
+
+	/** 删 */
+	int delete(Long id){
+		return tbCarNoColorMapper.delete(id);
+	}
+
+	/** 改 */
+	int update(TbCarNoColor t){
+		return tbCarNoColorMapper.update(t);
+	}
+
+	/** 查 */
+	TbCarNoColor getById(Long id){
+		return tbCarNoColorMapper.getById(id);
+	}
+
+	/** 查集合 - 根据条件(参数为空时代表忽略指定条件) */  
+	List<TbCarNoColor> getList(SoMap so) {
+		return tbCarNoColorMapper.getList(so);	
+	}
+
+
+	public List<TbCarNoColor> getFreeColor() {
+		QueryWrapper<TbCarNoColor>ew=new QueryWrapper<>();
+		ew.eq("fee",1);
+		return list(ew);
+	}
+}

+ 49 - 0
sp-server/src/main/java/com/pj/project/tb_car_no_color/TbCarNoColorUtil.java

@@ -0,0 +1,49 @@
+package com.pj.project.tb_car_no_color;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import com.pj.utils.sg.*;
+
+/**
+ * 工具类:tb_car_no_color -- 车牌颜色
+ * @author qzy 
+ *
+ */
+@Component
+public class TbCarNoColorUtil {
+
+	
+	/** 底层 Mapper 对象 */
+	public static TbCarNoColorMapper tbCarNoColorMapper;
+	@Autowired
+	private void setTbCarNoColorMapper(TbCarNoColorMapper tbCarNoColorMapper) {
+		TbCarNoColorUtil.tbCarNoColorMapper = tbCarNoColorMapper;
+	}
+	
+	
+	/** 
+	 * 将一个 TbCarNoColor 对象进行进行数据完整性校验 (方便add/update等接口数据校验) [G] 
+	 */
+	static void check(TbCarNoColor t) {
+		AjaxError.throwByIsNull(t.getId(), "[主键] 不能为空");		// 验证: 主键 
+		AjaxError.throwByIsNull(t.getCarNoColor(), "[颜色] 不能为空");		// 验证: 颜色 
+		AjaxError.throwByIsNull(t.getStatus(), "[状态] 不能为空");		// 验证: 状态(0=禁用;1=启用) 
+	}
+
+	/** 
+	 * 获取一个TbCarNoColor (方便复制代码用) [G] 
+	 */ 
+	static TbCarNoColor getTbCarNoColor() {
+		TbCarNoColor t = new TbCarNoColor();	// 声明对象 
+		t.setId(0L);		// 主键 
+		t.setCarNoColor("");		// 颜色 
+		t.setStatus("");		// 状态(0=禁用;1=启用) 
+		return t;
+	}
+	
+	
+	
+	
+	
+}

+ 2 - 0
sp-server/src/main/java/com/pj/project/tb_declare/TbDeclareMapper.java

@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import org.apache.ibatis.annotations.Mapper;
 
 import com.pj.utils.so.*;
+import org.apache.ibatis.annotations.Param;
 import org.springframework.stereotype.Repository;
 
 /**
@@ -53,4 +54,5 @@ public interface TbDeclareMapper extends BaseMapper<TbDeclare> {
 	List<TbDeclare> getList(SoMap so);
 
 
+    void removeBusinessId(@Param("businessId") String businessId);
 }

+ 3 - 0
sp-server/src/main/java/com/pj/project/tb_declare/TbDeclareMapper.xml

@@ -46,6 +46,9 @@
 		container_code = #{containerCode}
 		where id = #{id}
 	</update>
+    <update id="removeBusinessId">
+        update tb_declare set business_id=null  where business_id=#{businessId}
+    </update>
 
 
     <!-- ================================== 查询相关 ================================== -->

+ 10 - 0
sp-server/src/main/java/com/pj/project/tb_declare/TbDeclareService.java

@@ -65,4 +65,14 @@ public class TbDeclareService extends ServiceImpl<TbDeclareMapper, TbDeclare> im
 		ew.eq("declare_no",declareNo);
 		return getOne(ew);
 	}
+
+	public TbDeclare findByBusinessId(String businessId) {
+		QueryWrapper<TbDeclare>ew=new QueryWrapper<>();
+		ew.eq("business_id",businessId);
+		return this.getOne(ew);
+	}
+
+	public void removeBusinessId(String businessId) {
+		tbDeclareMapper.removeBusinessId(businessId);
+	}
 }

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

@@ -38,6 +38,8 @@ public class ExportFeeDetailDTO {
     private String payMode;
     private String businessNo;
     private String payTime;
+    private String tradeNo;
+    private String pickCustomerName;
 
 
 

+ 13 - 1
sp-server/src/main/java/com/pj/project/tb_fee_details/TbFeeDetails.java

@@ -140,7 +140,7 @@ public class TbFeeDetails implements Serializable {
     /**
      * 数量
      */
-    private Integer num;
+    private Integer num = 0;
 
     /**
      * 是否结算(0=未结算, 1=已结算)
@@ -162,6 +162,18 @@ public class TbFeeDetails implements Serializable {
      */
     private String invoice;
 
+    /**
+     * 微信支付订单号
+     */
+    private String transactionId;
+
+    /**
+     *
+     */
+    private String businessCarId;
+
+    private String businessCarNo;
+
 
 
     @Getter

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

@@ -3,6 +3,7 @@ package com.pj.project.tb_fee_details;
 import java.io.File;
 import java.io.InputStream;
 import java.math.BigDecimal;
+import java.math.RoundingMode;
 import java.util.*;
 
 import cn.hutool.core.date.DateUtil;
@@ -21,6 +22,7 @@ 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_fee_statistics.TbFeeStatistics;
 import com.pj.project4sp.uploadfile.UploadUtil;
 import com.pj.utils.so.SoMap;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -120,28 +122,46 @@ public class TbFeeDetailsService extends ServiceImpl<TbFeeDetailsMapper, TbFeeDe
         return getOne(qw);
     }
 
+    public TbFeeDetails getByBusinessCarIdAndCarNoAndFeeType(String businessCarId, String carNo, Integer feeType){
+        QueryWrapper<TbFeeDetails> qw = new QueryWrapper<>();
+        qw.eq("business_car_id", businessCarId);
+        qw.eq("car_no", carNo);
+        qw.eq("fee_type", feeType);
+        return getOne(qw);
+    }
+
 
-    public void chargeParkFee(List<PriceBO> cars) {
+    public void chargeParkFee(List<PriceBO> cars, String transactionId) {
         Date now = new Date();
         String nowStr = DateUtil.format(now, "yyyy-MM-dd HH:mm:ss");
         String toDay = DateUtil.format(now, "yyyy-MM-dd");
         for (PriceBO bo1 : cars) {
+            if(bo1.getP().compareTo(BigDecimal.valueOf(0)) == 0){
+                continue;
+            }
             TbBusinessCar car = tbBusinessCarService.getById(bo1.getId());
             TbBusiness business = tbBusinessService.getById(car.getBusinessId());
             String carNo = car.getCarNo();
-            TbFeeDetails parkFee = getByBusinessIdAndCarNoAndFeeType(car.getBusinessId(), carNo, TbFeeDetails.fee.PARK_FEE.getCode());
-            if (parkFee == null) {
+            TbFeeDetails parkFee;
+            if(business != null){
+                parkFee = getByBusinessIdAndCarNoAndFeeType(car.getBusinessId(), carNo, TbFeeDetails.fee.PARK_FEE.getCode());
+            } else {
+                parkFee = getByBusinessCarIdAndCarNoAndFeeType(car.getId(), carNo, TbFeeDetails.fee.PARK_FEE.getCode());
+            }
+            if(parkFee == null){
                 parkFee = new TbFeeDetails();
                 parkFee.setTaxRate(partConfig.getTaxRate());
             }
-            BigDecimal noTaxPrice = car.getMoney().subtract(car.getMoney().multiply(parkFee.getTaxRate()));
-            BigDecimal taxPrice = car.getMoney().multiply(parkFee.getTaxRate());
-            parkFee.setBusinessId(car.getBusinessId())
+            BigDecimal taxPrice = car.getMoney().divide(BigDecimal.valueOf(1).add(parkFee.getTaxRate()),2, BigDecimal.ROUND_HALF_UP).multiply(parkFee.getTaxRate());
+            BigDecimal noTaxPrice = car.getMoney().subtract(taxPrice);
+            parkFee.setBusinessId(car.getBusinessId()).setBusinessCarId(car.getId())
                     .setCarNo(car.getCarNo())
                     .setItemPrice(car.getMoney()).setUnitPrice(car.getMoney()).setNoTaxPrice(noTaxPrice).setTaxPrice(taxPrice)
                     .setFeeType(TbFeeDetails.fee.PARK_FEE.getCode()).setItemTypeName("停车业务")
                     .setPayDay(toDay).setPayType(3).setCreateTime(now)
-                    .setNum(1).setIsSettle(1).setPayMode(1).setPayTime(nowStr);
+                    .setNum(1).setIsSettle(1).setPayMode(1).setPayTime(nowStr)
+                    .setTransactionId(transactionId)
+                    .setBusinessCarNo(car.getNo());
             if (business!=null){
                 parkFee.setWeight(business.getNetWeight()).setBusinessNo(business.getNo());
             }
@@ -152,6 +172,7 @@ public class TbFeeDetailsService extends ServiceImpl<TbFeeDetailsMapper, TbFeeDe
     //@Async
     public void chargeBusinessFee(List<TbBusinessItem> items) {
         Date now = new Date();
+        String nowStr = DateUtil.format(now, "yyyy-MM-dd HH:mm:ss");
         String toDay = DateUtil.format(now, "yyyy-MM-dd");
         for (TbBusinessItem item : items) {
             int feeType = -1;
@@ -170,26 +191,41 @@ public class TbFeeDetailsService extends ServiceImpl<TbFeeDetailsMapper, TbFeeDe
                 feeType = TbFeeDetails.fee.CHARGE_FEE.getCode();
             }
             TbBusiness business = tbBusinessService.getById(item.getBusinessId());
-            TbFeeDetails businessFee = getByBusinessIdAndCarNoAndItemType(item.getBusinessId(), business.getCardNo(), item.getItemTypeId());
-            if (businessFee == null) {
-                businessFee = new TbFeeDetails();
+            TbFeeDetails businessFeeDetail = this.getByBusinessIdAndCarNoAndItemType(item.getBusinessId(), business.getCardNo(), item.getItemTypeId());
+            if (businessFeeDetail == null) {
+                businessFeeDetail = new TbFeeDetails();
+                businessFeeDetail.setTaxRate(BigDecimal.valueOf(TbFeeStatistics.taxRate.BUSINESS.getValue()));
+            }
+            BigDecimal taxPrice = item.getItemPrice()
+                    .divide(BigDecimal.valueOf(1).add(businessFeeDetail.getTaxRate()),2, BigDecimal.ROUND_HALF_UP)
+                    .multiply(businessFeeDetail.getTaxRate());
+            BigDecimal noTaxPrice = item.getItemPrice().subtract(taxPrice);
+
+            String carNo = business.getCardNo();
+            if(StrUtil.isEmpty(business.getCardNo())){
+                carNo = business.getChinaCarNo();
             }
-            businessFee.setBusinessId(item.getBusinessId()).setBusinessNo(business.getNo())
-                    .setCarNo(business.getCardNo())
-                    .setItemPrice(item.getItemPrice())
+            businessFeeDetail.setBusinessId(item.getBusinessId()).setBusinessNo(business.getNo())
+                    .setBusinessItemNo(item.getNo())
+                    .setCarNo(carNo)
+                    .setItemPrice(item.getItemPrice()).setUnitPrice(item.getItemPrice()).setNoTaxPrice(noTaxPrice).setTaxPrice(taxPrice)
                     .setFeeType(feeType)
                     .setItemTypeId(item.getItemTypeId()).setItemTypeName(item.getItemTypeName())
                     .setItemId(item.getItemId()).setItemName(item.getItemName())
-                    .setPayDay(toDay).setPayType(3).setCreateTime(now);
-            saveOrUpdate(businessFee);
+                    .setPayDay(toDay).setPayType(3).setCreateTime(now)
+                    .setBusinessItemId(item.getId() + "")
+                    .setPickCustomerName(item.getPickCustomerName())
+                    .setNum(1).setIsSettle(1).setPayMode(1).setPayTime(nowStr).setWeight(business.getNetWeight());
+            this.saveOrUpdate(businessFeeDetail);
         }
     }
 
     public String export(SoMap so) throws Exception{
         Date now = new Date();
         String nowStr = DateUtil.format(now, "yyyy-MM-dd HH:mm");
+        String time = so.getString("beginTime") + "至" + so.getString("endTime");
         Map<String, String> head = new HashMap<>();
-        head.put("time", so.getString("payDay"));
+        head.put("time", time);
         head.put("exportTime", nowStr);
 	    List<ExportFeeDetailDTO> exportList = new ArrayList<>();
         List<TbFeeDetails> list = this.getList(so);
@@ -204,7 +240,14 @@ public class TbFeeDetailsService extends ServiceImpl<TbFeeDetailsMapper, TbFeeDe
                     .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());
+                    .setTaxPrice(feeDetails.getTaxPrice()).setNoTaxPrice(feeDetails.getNoTaxPrice()).setPayTime(feeDetails.getPayTime())
+                    .setPickCustomerName(feeDetails.getPickCustomerName());
+            if(!StrUtil.isEmpty(feeDetails.getBusinessId())){
+                detailDTO.setBusinessNo(feeDetails.getBusinessNo());
+            }else {
+                detailDTO.setBusinessNo(feeDetails.getBusinessCarNo());
+            }
+
             exportList.add(detailDTO);
         }
 
@@ -213,7 +256,7 @@ public class TbFeeDetailsService extends ServiceImpl<TbFeeDetailsMapper, TbFeeDe
         String rootPath = UploadUtil.uploadConfig.rootFolder + separator + UploadUtil.uploadConfig.httpPrefix;
         String prefix = myConfig.getDomain() + UploadUtil.uploadConfig.httpPrefix;
         String extPath = "feeDetails" + separator + today + separator;
-        String fileName = "收费明细表_" + today + ".xlsx";
+        String fileName = "收费明细表_" + time + ".xlsx";
         String savePath = rootPath + separator + extPath;
         File saveFIle = new File(savePath);
         if (!saveFIle.exists()) {
@@ -229,7 +272,7 @@ public class TbFeeDetailsService extends ServiceImpl<TbFeeDetailsMapper, TbFeeDe
         excelWriter.fill(exportList, writeSheet);
         excelWriter.fill(head, writeSheet);
         excelWriter.finish();
-        return prefix + "/feeDetails/" + today + "/收费明细表_" + today + ".xlsx";
+        return prefix + "/feeDetails/" + today + "/收费明细表_" + time + ".xlsx";
     }
 
 }

+ 1 - 1
sp-server/src/main/java/com/pj/project/tb_fee_statistics/TbFeeStatistics.java

@@ -85,7 +85,7 @@ public class TbFeeStatistics implements Serializable {
     private Integer num = 0;
 
 	/**
-	 * 税款 
+	 * 含税收入
 	 */
 	public BigDecimal taxMoney = new BigDecimal(0);
 

+ 40 - 18
sp-server/src/main/java/com/pj/project/tb_fee_statistics/TbFeeStatisticsService.java

@@ -96,7 +96,6 @@ public class TbFeeStatisticsService extends ServiceImpl<TbFeeStatisticsMapper, T
     }
 
     public TbFeeStatistics getByDayAndFeeType(String day, Integer feeType) {
-//        TbFeeStatistics Fee = tbFeeStatisticsMapper.getByDayAndFeeType(Day, feeType);
         QueryWrapper<TbFeeStatistics> qw = new QueryWrapper<>();
         qw.eq("day", day);
         qw.eq("fee_type", feeType);
@@ -112,17 +111,29 @@ public class TbFeeStatisticsService extends ServiceImpl<TbFeeStatisticsMapper, T
         TbFeeStatistics parkFee = this.getByDayAndFeeType(toDay, TbFeeStatistics.feeType.PARK_FEE.getCode());
         if (parkFee == null) {
             parkFee = new TbFeeStatistics();
-            parkFee.setTaxRate(new BigDecimal(TbFeeStatistics.taxRate.PARK.getValue()));
+            parkFee.setTaxRate(BigDecimal.valueOf(TbFeeStatistics.taxRate.PARK.getValue()));
         }
+        BigDecimal totalPrice = BigDecimal.valueOf(0);
+        Integer totalNum = parkFee.getNum();
         for (PriceBO bo1 : cars) {
             BigDecimal price = bo1.getP();
-            TbBusinessCar car = tbBusinessCarService.getById(bo1.getId());
-            if (car.getMoney().compareTo(new BigDecimal(0)) == 0) {
-                parkFee.setNum(parkFee.getNum() + 1);
+            if(price.compareTo(BigDecimal.valueOf(0)) != 0){
+                totalPrice = totalPrice.add(price);
+                TbBusinessCar car = tbBusinessCarService.getById(bo1.getId());
+                if(car.getMoney().compareTo(partConfig.getBasePrice()) == -1 || car.getMoney().compareTo(partConfig.getBasePrice()) == 0){
+                    totalNum++;
+                }
             }
-            parkFee.setTaxMoney(parkFee.getTaxMoney().add(price));
         }
-        BigDecimal noTaxMoney = parkFee.getTaxMoney().subtract(parkFee.getTaxMoney().multiply(parkFee.getTaxRate()));
+        if(totalPrice.compareTo(BigDecimal.valueOf(0)) == 0){
+            return;
+        }
+        parkFee.setNum(totalNum).setTaxMoney(parkFee.getTaxMoney().add(totalPrice));
+        BigDecimal taxes = parkFee.getTaxMoney()
+                .divide(BigDecimal.valueOf(1).add(parkFee.getTaxRate()),2, BigDecimal.ROUND_HALF_UP)
+                .multiply(parkFee.getTaxRate());
+        BigDecimal noTaxMoney = parkFee.getTaxMoney().subtract(taxes);
+//        BigDecimal noTaxMoney = parkFee.getTaxMoney().subtract(parkFee.getTaxMoney().multiply(parkFee.getTaxRate()));
         parkFee.setNoTaxMoney(noTaxMoney);
         parkFee.setDayTime(now).setMonth(thisMonth).setYear(thisYear).setDay(toDay)
                 .setFeeType(TbFeeStatistics.feeType.PARK_FEE.getCode()).setItemTypeName(TbFeeStatistics.feeType.PARK_FEE.getDesc())
@@ -131,7 +142,7 @@ public class TbFeeStatisticsService extends ServiceImpl<TbFeeStatisticsMapper, T
     }
 
     //@Async
-    public void countBusinessFee(List<TbBusinessItem> items) {
+    public void countBusinessFee(List<TbBusinessItem> items, String transactionId) {
         Date now = new Date();
         String nowStr = DateUtil.format(now, "yyyy-MM-dd HH:mm:ss");
         String toDay = DateUtil.format(now, "yyyy-MM-dd");
@@ -156,11 +167,16 @@ public class TbFeeStatisticsService extends ServiceImpl<TbFeeStatisticsMapper, T
             TbFeeStatistics businessFee = this.getByDayAndFeeType(toDay, feeType);
             if (businessFee == null) {
                 businessFee = new TbFeeStatistics();
-                businessFee.setTaxRate(new BigDecimal(TbFeeStatistics.taxRate.BUSINESS.getValue()));
+                businessFee.setTaxRate(BigDecimal.valueOf(TbFeeStatistics.taxRate.BUSINESS.getValue()));
             }
-            businessFee.setTaxMoney(businessFee.getTaxMoney().add(item.getItemPrice()));
-            businessFee.setNum(businessFee.getNum() + 1);
-            BigDecimal noTaxMoney = businessFee.getTaxMoney().subtract(businessFee.getTaxMoney().multiply(businessFee.getTaxRate()));
+            businessFee.setTaxMoney(businessFee.getTaxMoney().add(item.getTotal()));//含税收入
+            //businessFee.setNum(businessFee.getNum() + 1);
+            businessFee.setNum(businessFee.getNum() + Integer.valueOf(item.getNum()));
+            BigDecimal taxes = businessFee.getTaxMoney()
+                    .divide(BigDecimal.valueOf(1).add(businessFee.getTaxRate()),2, BigDecimal.ROUND_HALF_UP)
+                    .multiply(businessFee.getTaxRate());
+            BigDecimal noTaxMoney = businessFee.getTaxMoney().subtract(taxes);
+
             businessFee.setNoTaxMoney(noTaxMoney);
             businessFee.setDayTime(now).setMonth(thisMonth).setYear(thisYear).setDay(toDay)
                     .setFeeType(feeType)
@@ -173,26 +189,32 @@ public class TbFeeStatisticsService extends ServiceImpl<TbFeeStatisticsMapper, T
             TbFeeDetails businessFeeDetail = tbFeeDetailsService.getByBusinessIdAndCarNoAndItemType(item.getBusinessId(), business.getCardNo(), item.getItemTypeId());
             if (businessFeeDetail == null) {
                 businessFeeDetail = new TbFeeDetails();
-                businessFeeDetail.setTaxRate(new BigDecimal(TbFeeStatistics.taxRate.BUSINESS.getValue()));
+                businessFeeDetail.setTaxRate(BigDecimal.valueOf(TbFeeStatistics.taxRate.BUSINESS.getValue()));
             }
 
-            BigDecimal noTaxPrice = item.getItemPrice().subtract(item.getItemPrice().multiply(businessFeeDetail.getTaxRate()));
-            BigDecimal taxPrice = item.getItemPrice().multiply(businessFeeDetail.getTaxRate());
+            BigDecimal taxPrice = item.getItemPrice()
+                    .divide(BigDecimal.valueOf(1).add(businessFeeDetail.getTaxRate()),2, BigDecimal.ROUND_HALF_UP)
+                    .multiply(businessFeeDetail.getTaxRate());
+            BigDecimal noTaxPrice = item.getItemPrice().subtract(taxPrice);
             String carNo = business.getCardNo();
             if(StrUtil.isEmpty(business.getCardNo())){
                 carNo = business.getChinaCarNo();
             }
+            TbBusinessCar businessCar = tbBusinessCarService.findByBusinessIdAndCarNo(item.getBusinessId(), carNo);
             businessFeeDetail.setBusinessId(item.getBusinessId()).setBusinessNo(business.getNo())
-                    .setBusinessItemNo(item.getNo())
+                    .setBusinessItemNo(item.getNo()).setBusinessCarId(businessCar.getId()).setBusinessCarNo(businessCar.getNo())
                     .setCarNo(carNo)
-                    .setItemPrice(item.getItemPrice()).setUnitPrice(item.getItemPrice()).setNoTaxPrice(noTaxPrice).setTaxPrice(taxPrice)
+
+                    .setItemPrice(item.getTotal()).setUnitPrice(item.getItemPrice()).setNoTaxPrice(noTaxPrice).setTaxPrice(taxPrice)
                     .setFeeType(feeType)
                     .setItemTypeId(item.getItemTypeId()).setItemTypeName(item.getItemTypeName())
                     .setItemId(item.getItemId()).setItemName(item.getItemName())
                     .setPayDay(toDay).setPayType(3).setCreateTime(now)
                     .setBusinessItemId(item.getId() + "")
                     .setPickCustomerName(item.getPickCustomerName())
-                    .setNum(1).setIsSettle(1).setPayMode(1).setPayTime(nowStr).setWeight(business.getNetWeight());
+                    .setIsSettle(1).setPayMode(1).setPayTime(nowStr).setWeight(business.getNetWeight())
+                    .setTransactionId(transactionId)
+                    .setNum(Integer.valueOf(item.getNum()));
             tbFeeDetailsService.saveOrUpdate(businessFeeDetail);
         }
     }

+ 30 - 0
sp-server/src/main/java/com/pj/utils/ImageUtils.java

@@ -0,0 +1,30 @@
+package com.pj.utils;
+
+import sun.misc.BASE64Decoder;
+
+import java.io.FileOutputStream;
+import java.io.OutputStream;
+
+public class ImageUtils {
+    public static boolean generateImage(String imgStr, String imgFilePath) {
+        BASE64Decoder decoder = new BASE64Decoder();
+        try {
+            // Base64解码
+            byte[] bytes = decoder.decodeBuffer(imgStr);
+            for (int i = 0; i < bytes.length; ++i) {
+                if (bytes[i] < 0) {// 调整异常数据
+                    bytes[i] += 256;
+                }
+            }
+            // 生成jpeg图片
+            OutputStream out = new FileOutputStream(imgFilePath);
+            out.write(bytes);
+            out.flush();
+            out.close();
+            return true;
+        } catch (Exception e) {
+            e.printStackTrace();
+            return false;
+        }
+    }
+}

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

@@ -45,7 +45,7 @@ spring:
     # 项目自定义配置
     myconfig:
         # 本项目部署到的服务器域名(文件上传等等模块  要用到)
-        domain: https://127.0.0.1:8099/pro
+        domain: http://127.0.0.1:8099/pro
         web-domain: https://127.0.0.1:8080
 part-config:
     base-price: 30 #基础费用

BIN
sp-server/src/main/resources/static/day-fee-new.xlsx


BIN
sp-server/src/main/resources/static/day-fee.xlsx