qzyReal 3 роки тому
батько
коміт
6c2e6f1894
34 змінених файлів з 864 додано та 200 видалено
  1. 2 3
      app/pages/wx/pay.vue
  2. 2 0
      sp-admin/sa-view/car/tb-business-car-list.html
  3. 16 5
      sp-admin/sa-view/tb-business-car/tb-business-car-add.html
  4. 3 7
      sp-admin/sa-view/tb-business-car/tb-business-car-list.html
  5. 2 7
      sp-admin/sa-view/tb-business/tb-business-info.html
  6. 67 14
      sp-admin/sa-view/tb-fee-statistics/tb-fee-details-list.html
  7. 6 1
      sp-admin/sa-view/tb-fee-statistics/tb-fee-statistics-list.html
  8. 1 1
      sp-server/app.pid
  9. 11 0
      sp-server/src/main/java/com/pj/api/open/bo/InRecordBO.java
  10. 55 14
      sp-server/src/main/java/com/pj/api/open/service/OpenService.java
  11. 9 2
      sp-server/src/main/java/com/pj/api/open/web/OpenController.java
  12. 2 1
      sp-server/src/main/java/com/pj/api/service/ApiService.java
  13. 3 3
      sp-server/src/main/java/com/pj/api/wx/service/WxService.java
  14. 9 1
      sp-server/src/main/java/com/pj/project/tb_business/TbBusinessController.java
  15. 28 3
      sp-server/src/main/java/com/pj/project/tb_business/TbBusinessService.java
  16. 112 103
      sp-server/src/main/java/com/pj/project/tb_business_car/TbBusinessCar.java
  17. 3 3
      sp-server/src/main/java/com/pj/project/tb_business_car/TbBusinessCarMapper.xml
  18. 22 3
      sp-server/src/main/java/com/pj/project/tb_business_car/TbBusinessCarService.java
  19. 60 0
      sp-server/src/main/java/com/pj/project/tb_car_no_color/TbCarNoColor.java
  20. 105 0
      sp-server/src/main/java/com/pj/project/tb_car_no_color/TbCarNoColorController.java
  21. 56 0
      sp-server/src/main/java/com/pj/project/tb_car_no_color/TbCarNoColorMapper.java
  22. 76 0
      sp-server/src/main/java/com/pj/project/tb_car_no_color/TbCarNoColorMapper.xml
  23. 58 0
      sp-server/src/main/java/com/pj/project/tb_car_no_color/TbCarNoColorService.java
  24. 49 0
      sp-server/src/main/java/com/pj/project/tb_car_no_color/TbCarNoColorUtil.java
  25. 2 0
      sp-server/src/main/java/com/pj/project/tb_declare/TbDeclareMapper.java
  26. 3 0
      sp-server/src/main/java/com/pj/project/tb_declare/TbDeclareMapper.xml
  27. 10 0
      sp-server/src/main/java/com/pj/project/tb_declare/TbDeclareService.java
  28. 1 0
      sp-server/src/main/java/com/pj/project/tb_fee_details/ExportFeeDetailDTO.java
  29. 12 0
      sp-server/src/main/java/com/pj/project/tb_fee_details/TbFeeDetails.java
  30. 57 18
      sp-server/src/main/java/com/pj/project/tb_fee_details/TbFeeDetailsService.java
  31. 1 1
      sp-server/src/main/java/com/pj/project/tb_fee_statistics/TbFeeStatistics.java
  32. 21 10
      sp-server/src/main/java/com/pj/project/tb_fee_statistics/TbFeeStatisticsService.java
  33. BIN
      sp-server/src/main/resources/static/day-fee-new.xlsx
  34. BIN
      sp-server/src/main/resources/static/day-fee.xlsx

+ 2 - 3
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>
@@ -201,7 +201,6 @@
 				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
@@ -248,7 +247,7 @@
 					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,

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

@@ -198,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;
@@ -219,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;

+ 16 - 5
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;
@@ -45,8 +46,7 @@
 						<div class="c-item">
 							<label class="c-label">车牌颜色:</label>
 							<el-select v-model="m.color" placeholder="请选择">
-								<el-option label="蓝牌" value="蓝牌"> </el-option>
-								<el-option label="黄牌" value="黄牌"> </el-option>
+								<el-option v-for="item in colorList" :label="item.carNoColor" :value="item.carNoColor"> </el-option>
 							</el-select>
 						</div>
 						<div class="c-item">
@@ -63,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>
@@ -86,6 +89,7 @@
 				},
 				el: '.vue-box',
 				data: {
+					colorList:[],
 					id: sa.p('id', 0), // 获取超链接中的id参数(0=添加,非0=修改) 
 					m: {
 						id: '', //  
@@ -95,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('联系号码不正确')
@@ -137,6 +147,7 @@
 					}
 				},
 				mounted: function() {
+					this.getCadNoColor();
 					// 初始化数据 
 					if (this.id > 0) {
 						sa.ajax('/TbBusinessCar/getById?id=' + this.id, function(res) {

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

@@ -15,11 +15,6 @@
 		<script src="../../static/kj/layer/layer.js"></script>
 		<script src="../../static/sa.js"></script>
 	</head>
-	<style>
-		.self .el-input__inner {
-			width: 130px;
-		}
-	</style>
 	<body>
 		<div class="vue-box" style="display: none;" :style="'display: block;'">
 			<div class="c-panel">
@@ -64,6 +59,7 @@
 				</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>
 					<el-table-column label="车辆规格">
 						<template slot-scope="s">
@@ -113,7 +109,7 @@
 				data: {
 					leveTime: [],
 					inTime: [],
-					p: { // 查询参数  
+					p: { // 查询参数
 						id: '', //  
 						businessId: sa.p('id', ''), //  
 						carNo: '', //  
@@ -123,7 +119,7 @@
 						leaveEnd: '',
 						pageNo: 1, // 当前页 
 						pageSize: 10, // 页大小 
-						sortType: 10 // 排序方式 
+						sortType: 10 // 排序方式
 					},
 					dataCount: 0,
 					dataList: [], // 数据集合 

+ 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>

+ 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">-->

+ 1 - 1
sp-server/app.pid

@@ -1 +1 @@
-18924
+1440

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

@@ -28,6 +28,8 @@ public class InRecordBO implements Serializable {
      */
     private String OperationUserName;
 
+    private String CarColor;
+
     @JsonProperty("ChannelName")
     public String getChannelName() {
         return ChannelName;
@@ -80,4 +82,13 @@ public class InRecordBO implements Serializable {
     public void setOperationUserName(String operationUserName) {
         OperationUserName = operationUserName;
     }
+
+    @JsonProperty("CarColor")
+    public String getCarColor() {
+        return CarColor;
+    }
+
+    public void setCarColor(String carColor) {
+        CarColor = carColor;
+    }
 }

+ 55 - 14
sp-server/src/main/java/com/pj/api/open/service/OpenService.java

@@ -6,9 +6,11 @@ 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;
@@ -22,6 +24,8 @@ 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.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;
@@ -37,6 +41,8 @@ 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;
@@ -58,6 +64,8 @@ public class OpenService {
 
     @Resource
     TaskService taskService;
+    @Resource
+    TbCarNoColorService tbCarNoColorService;
 
     private final List<String> CAR_LIST = StrUtil.splitTrim("浙,粤,京,津,冀,晋,蒙,辽,黑,沪,吉,苏,皖,赣,鲁,豫,鄂,湘,桂,琼,渝,川,贵,云,藏, 陕, 甘, 青, 宁", ",");
 
@@ -79,15 +87,17 @@ public class OpenService {
         TbBusinessCar tbBusinessCar = tbBusinessCarService.findTheLastRecord(carNo);
         Date now = new Date();
         TbCar tbCar = tbCarService.findByCardNo(carNo);
-        if (tbBusinessCar == null || (tbBusinessCar.getRealInTime() != null && tbBusinessCar.getRealOutTime() != null)) {
+        if (tbBusinessCar == null || (tbBusinessCar.getRealInTime() != null && tbBusinessCar.getRealOutTime() != null)||tbBusinessCar.getPay()==1) {
             tbBusinessCar = new TbBusinessCar();
-            tbBusinessCar.setCarNo(carNo).setPay(0).setCarSize(0D).setIsLock(0).setCarCompany(tbCar!=null?tbCar.getCustomerName():"临时")
-                    .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).setCarCompany(tbCar!=null?tbCar.getCustomerName():"临时");
+        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)) {
@@ -101,19 +111,34 @@ 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);
+            tbBusinessCar.setRealOutTime(now).setTimeUpdate(now).setOutChannel(channel);
             tbBusinessCarService.updateById(tbBusinessCar);
             CoverBase64ToUrl(image, tbBusinessCar.getId(), 2);
             return ResultJson.success();
@@ -122,19 +147,22 @@ public class OpenService {
             return ResultJson.error("车辆已锁定");
         }
         String businessId = tbBusinessCar.getBusinessId();
-        BigDecimal price =new BigDecimal("0");
-        if (CAR_LIST.contains(carNo.substring(0,1))){
-             price = tbBusinessService.calculationPartMoney(tbBusinessCar.getRealInTime(), now);
+        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.subtract(tbBusinessCar.getMoney()).doubleValue();
+        double dif = price.doubleValue();
         if (dif > 0) {
-            tbBusinessCar.setPay(0);
-            tbBusinessCarService.updateById(tbBusinessCar);
             RedisUtil.set(channel, carNo);
             return ResultJson.error("请缴停车费" + dif + "元");
         }
         if (StrUtil.isEmpty(businessId)) {
-            tbBusinessCar.setRealOutTime(now).setOutChannel(channel);
+            tbBusinessCar.setRealOutTime(now).setOutChannel(channel).setTimeUpdate(now);
             tbBusinessCarService.updateById(tbBusinessCar);
             CoverBase64ToUrl(image, tbBusinessCar.getId(), 2);
             return ResultJson.success();
@@ -156,7 +184,7 @@ public class OpenService {
         if (TbBusiness.BusinessType.CAR_DISINCLE.getCode().equals(business.getBusinessType()) && !business.getItemPrice().equals(itemPayPrice)) {
             return ResultJson.error("请缴纳业务费用");
         }
-        tbBusinessCar.setRealOutTime(now).setOutChannel(channel);
+        tbBusinessCar.setRealOutTime(now).setOutChannel(channel).setTimeUpdate(now);
         tbBusinessCarService.updateById(tbBusinessCar);
         CoverBase64ToUrl(image, tbBusinessCar.getId(), 2);
         return ResultJson.success();
@@ -176,4 +204,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);
+        }
+    }
 }

+ 9 - 2
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;
@@ -32,12 +33,18 @@ public class OpenController {
             CheckCarNumberBO checkCarNumberBO = BeanUtil.toBean(params, CheckCarNumberBO.class);
             return checkCarNumber(checkCarNumberBO);
         }else  if ("Inrecord".equals(dataType)) {
-            CheckCarNumberBO checkCarNumberBO = BeanUtil.toBean(params, CheckCarNumberBO.class);
-            return checkCarNumber(checkCarNumberBO);
+            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);

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

@@ -304,7 +304,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);

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

@@ -203,7 +203,7 @@ public class WxService {
             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,11 @@ public class WxService {
                     tbBusinessService.updateById(business);
                 }
             }
-            tbFeeDetailsService.chargeParkFee(cars);//添加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);

+ 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();
     }

+ 28 - 3
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
@@ -213,6 +220,10 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
             tbBusinessCar.setBusinessId(t.getId());
             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);
@@ -223,6 +234,9 @@ 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();
@@ -484,10 +498,21 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
             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);
+//            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);
             carMap.put("id", tbBusinessCar.getId());
@@ -516,7 +541,7 @@ 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("name", item.getItemName()+"("+item.getItemTypeName()+")");
                 itemMap.put("price", item.getItemPrice());
                 itemMap.put("pay", item.getPayStatus());
                 itemList.add(itemMap);

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

@@ -6,7 +6,9 @@ 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;
@@ -18,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)
@@ -27,107 +30,113 @@ 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 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;
-
-	@TableField(exist = false)
-	private String payType;
-
-	public String getPayType() {
-		Date inTime = this.getRealInTime();
-		Date outTime = this.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()) {
-				return "免费";
-			}
-		}
-		return this.pay==null||this.pay==0?"未支付":"已支付";
-	}
+    // ---------- 模块常量 ----------
+    /**
+     * 序列化版本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;
+
+    public String getPayType() {
+        final List<String> CAR_LIST = StrUtil.splitTrim("浙,粤,京,津,冀,晋,蒙,辽,黑,沪,吉,苏,皖,赣,鲁,豫,鄂,湘,桂,琼,渝,川,贵,云,藏, 陕, 甘, 青, 宁", ",");
+        Date inTime = this.getRealInTime();
+        Date outTime = this.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(this.carNo.substring(0, 1))) {
+                return "免费";
+            }
+        }
+        return this.pay == null || this.pay == 0 ? "未支付" : "已支付";
+    }
 
 
 }

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

@@ -68,7 +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'>real_out_time desc,real_in_time desc</when>
+            <when test='sortType == 10'>time_update desc</when>
             <otherwise>id desc</otherwise>
         </choose>
     </select>
@@ -80,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
@@ -89,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>
 
 

+ 22 - 3
sp-server/src/main/java/com/pj/project/tb_business_car/TbBusinessCarService.java

@@ -4,6 +4,9 @@ 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;
 
@@ -11,6 +14,7 @@ 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 com.alibaba.excel.EasyExcel;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -22,6 +26,7 @@ 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_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;
@@ -54,7 +59,7 @@ public class TbBusinessCarService extends ServiceImpl<TbBusinessCarMapper, TbBus
     @Lazy
     private TbBusinessService tbBusinessService;
     @Resource
-    PartConfig partConfig;
+    TbCarNoColorService tbCarNoColorService;
     @Resource
     @Lazy
     TbFeeDetailsService tbFeeDetailsService;
@@ -147,6 +152,7 @@ public class TbBusinessCarService extends ServiceImpl<TbBusinessCarMapper, TbBus
             tbBusiness.setCardSize(t.getCarSize());
         }
         tbBusinessService.updateById(tbBusiness);
+        t.setNo(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmm")) + RandomUtil.randomNumbers(4));
         this.save(t);
     }
 
@@ -215,7 +221,8 @@ 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);
     }
 
@@ -238,7 +245,7 @@ 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) {
@@ -254,6 +261,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);
+            }
         }
 
     }
@@ -287,4 +300,10 @@ public class TbBusinessCarService extends ServiceImpl<TbBusinessCarMapper, TbBus
                 .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);
+    }
 }

+ 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);
+	}
 }

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

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

+ 12 - 0
sp-server/src/main/java/com/pj/project/tb_fee_details/TbFeeDetails.java

@@ -162,6 +162,18 @@ public class TbFeeDetails implements Serializable {
      */
     private String invoice;
 
+    /**
+     * 微信支付订单号
+     */
+    private String transactionId;
+
+    /**
+     *
+     */
+    private String businessCarId;
+
+    private String businessCarNo;
+
 
 
     @Getter

+ 57 - 18
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,8 +122,16 @@ 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");
@@ -129,19 +139,26 @@ public class TbFeeDetailsService extends ServiceImpl<TbFeeDetailsMapper, TbFeeDe
             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 +169,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 +188,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);
@@ -205,6 +238,12 @@ public class TbFeeDetailsService extends ServiceImpl<TbFeeDetailsMapper, TbFeeDe
                     .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());
+            if(!StrUtil.isEmpty(feeDetails.getBusinessId())){
+                detailDTO.setBusinessNo(feeDetails.getBusinessNo());
+            }else {
+                detailDTO.setBusinessNo(feeDetails.getBusinessCarNo());
+            }
+
             exportList.add(detailDTO);
         }
 
@@ -213,7 +252,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 +268,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);
 

+ 21 - 10
sp-server/src/main/java/com/pj/project/tb_fee_statistics/TbFeeStatisticsService.java

@@ -112,7 +112,7 @@ 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()));
         }
         for (PriceBO bo1 : cars) {
             BigDecimal price = bo1.getP();
@@ -122,7 +122,11 @@ public class TbFeeStatisticsService extends ServiceImpl<TbFeeStatisticsMapper, T
             }
             parkFee.setTaxMoney(parkFee.getTaxMoney().add(price));
         }
-        BigDecimal noTaxMoney = parkFee.getTaxMoney().subtract(parkFee.getTaxMoney().multiply(parkFee.getTaxRate()));
+        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 +135,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 +160,15 @@ 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.setTaxMoney(businessFee.getTaxMoney().add(item.getItemPrice()));//含税收入
             businessFee.setNum(businessFee.getNum() + 1);
-            BigDecimal noTaxMoney = businessFee.getTaxMoney().subtract(businessFee.getTaxMoney().multiply(businessFee.getTaxRate()));
+            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,11 +181,13 @@ 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();
@@ -192,7 +202,8 @@ public class TbFeeStatisticsService extends ServiceImpl<TbFeeStatisticsMapper, T
                     .setPayDay(toDay).setPayType(3).setCreateTime(now)
                     .setBusinessItemId(item.getId() + "")
                     .setPickCustomerName(item.getPickCustomerName())
-                    .setNum(1).setIsSettle(1).setPayMode(1).setPayTime(nowStr).setWeight(business.getNetWeight());
+                    .setNum(1).setIsSettle(1).setPayMode(1).setPayTime(nowStr).setWeight(business.getNetWeight())
+                    .setTransactionId(transactionId);
             tbFeeDetailsService.saveOrUpdate(businessFeeDetail);
         }
     }

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


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