瀏覽代碼

支付测试

qzyReal 3 年之前
父節點
當前提交
bafefbc8ef
共有 23 個文件被更改,包括 235 次插入197 次删除
  1. 23 3
      app/pages/wx/pay.vue
  2. 1 14
      sp-admin/sa-view/car/tb-business-car-list.html
  3. 24 17
      sp-admin/sa-view/relation-goods-type/tb-item-type-select.html
  4. 7 3
      sp-admin/sa-view/tb-business/tb-car-disincle-add.html
  5. 1 2
      sp-admin/sa-view/tb-business/tb-car-disincle-edit.html
  6. 8 2
      sp-admin/sa-view/tb-goods/tb-goods-list.html
  7. 10 9
      sp-admin/sa-view/tb-item-type/tb-item-edit.html
  8. 11 3
      sp-admin/sa-view/tb-item-type/tb-item-select.html
  9. 0 1
      sp-admin/sa-view/tb-item-type/tb-item-type-list.html
  10. 5 5
      sp-admin/sa-view/tb-item-type/tb-item.html
  11. 17 20
      sp-server/src/main/java/com/pj/api/jh/service/JhService.java
  12. 40 44
      sp-server/src/main/java/com/pj/api/open/service/OpenService.java
  13. 0 47
      sp-server/src/main/java/com/pj/api/service/ApiService.java
  14. 1 5
      sp-server/src/main/java/com/pj/api/wx/service/WxService.java
  15. 7 0
      sp-server/src/main/java/com/pj/project/relation_business_car/RelationBusinessCarService.java
  16. 4 1
      sp-server/src/main/java/com/pj/project/tb_business/TbBusinessMapper.xml
  17. 43 8
      sp-server/src/main/java/com/pj/project/tb_business/TbBusinessService.java
  18. 5 0
      sp-server/src/main/java/com/pj/project/tb_business_car/TbBusinessCarController.java
  19. 1 1
      sp-server/src/main/java/com/pj/project/tb_business_car/TbBusinessCarMapper.xml
  20. 2 7
      sp-server/src/main/java/com/pj/project/tb_business_car/TbBusinessCarService.java
  21. 18 0
      sp-server/src/main/java/com/pj/project/tb_goods/TbGoodsController.java
  22. 0 2
      sp-server/src/main/java/com/pj/project/tb_item_type/TbItemTypeController.java
  23. 7 3
      sp-server/src/main/java/com/pj/project/tb_item_type/TbItemTypeService.java

+ 23 - 3
app/pages/wx/pay.vue

@@ -58,7 +58,19 @@
 				</u-checkbox-group>
 			</view>
 		</view>
-
+		<view v-if="showTips">
+			<view class="tips">
+				<view>
+					未查询到相关费用,可能原因:
+				</view>
+				<view>
+					1、车辆无需缴费。
+				</view>
+				<view>
+					2、业务订单需管理员确认后方可缴费。
+				</view>
+			</view>
+		</view>
 		<view class="bottom bgc-f bottom-safety" v-if="total>0">
 			<view class="box">
 				<view class="l">
@@ -110,6 +122,7 @@
 					partMoney: 0,
 					payType: 3
 				},
+				showTips: false,
 
 			}
 		},
@@ -213,9 +226,9 @@
 				} else if (type == 1) {
 					let itemSelect = this.itemSelect;
 					let itemStr = this.item.list
-						.filter(obj => itemSelect.indexOf(obj.id) !== -1).map(obj => obj.name.substr(0,obj.name.indexOf('(')))
+						.filter(obj => itemSelect.indexOf(obj.id) !== -1).map(obj => obj.name.substr(0, obj.name.indexOf(
+							'(')))
 						.join('、');
-					console.log(itemStr)
 					con = 'A1-' + itemStr;
 					tradeType = 'PORT_OPERATION_FEE';
 				}
@@ -303,9 +316,11 @@
 					this.itemSelect = data.itemList.filter(obj => obj.pay == 0).map(obj => obj.id)
 					this.businessSelect = this.itemSelect.length == 0 ? [] : [1]
 					this.list = [];
+					this.showTips=this.cars.length==0&&data.itemsPrice==0
 				})
 			},
 			searchFn() {
+				this.showTips=false;
 				this.list = [];
 				this.cars = [];
 				this.carsSelect = [];
@@ -343,6 +358,11 @@
 		}
 	}
 
+	.tips {
+		margin: 140rpx 0 0 80rpx;
+		line-height: 60rpx;
+	}
+
 	.content {
 		display: flex;
 		flex-direction: column;

+ 1 - 14
sp-admin/sa-view/car/tb-business-car-list.html

@@ -59,9 +59,6 @@
 						</template>
 					</el-table-column>
 				</el-table>
-				<!-- ------------- 分页 ------------- -->
-				<sa-item type="page" :curr.sync="p.pageNo" :size.sync="p.pageSize" :total="dataCount" @change="f5()">
-				</sa-item>
 			</div>
 			<el-dialog title="确认入场" :visible.sync="rc.visible" width="400px">
 				<el-form label-position="left">
@@ -134,18 +131,8 @@
 					payStatus: sa.p('payStatus', 1),
 					confirm: sa.p('confirm', 0),
 					p: { // 查询参数  
-						id: '', //  
 						businessId: sa.p('id', ''), //  
 						carNo: '', //  
-						preInTime: '', //  
-						preOutTime: '', //  
-						realInTime: '', //  
-						realOutTime: '', //  
-						money: '', //  
-						driverPhone: '', //  
-						pageNo: 1, // 当前页 
-						pageSize: 10, // 页大小 
-						sortType: 0 // 排序方式 
 					},
 					dataCount: 0,
 					dataList: [], // 数据集合 
@@ -219,7 +206,7 @@
 					},
 					// 刷新
 					f5: function() {
-						sa.ajax('/TbBusinessCar/getList', sa.removeNull(this.p), function(res) {
+						sa.ajax('/TbBusinessCar/getBusinessByBusinessCarId', sa.removeNull(this.p), function(res) {
 							this.dataList = res.data; // 数据
 							this.dataCount = res.dataCount; // 数据总数 
 							sa.f5TableHeight(); // 刷新表格高度 

+ 24 - 17
sp-admin/sa-view/relation-goods-type/tb-item-type-select.html

@@ -24,26 +24,27 @@
 					<sa-item type="text" name="项目名称" v-model="p.name"></sa-item>
 					<el-button type="primary" icon="el-icon-search" @click="p.pageNo = 1; f5()">查询</el-button>
 					<sa-item type="fast-btn" show="reset" style="display: inline;"></sa-item>
-					<el-button  type="primary" icon="el-icon-plus" @click="selectBatch()">确定
+					<el-button type="primary" icon="el-icon-plus" @click="selectBatch()">确定
 					</el-button>
 					<br />
 				</el-form>
 				<!-- ------------- 数据列表 ------------- -->
 				<el-table class="data-table" ref="data-table" :data="dataList">
 					<sa-td type="selection"></sa-td>
-					<sa-td name="收费项名称" prop="name" ></sa-td>
-					<sa-td name="付款步骤" prop="payStep" type="enum" :jv="{1: '下单后', 2: '确认后'}"></sa-td>
+					<sa-td name="收费项名称" prop="name"></sa-td>
+					<!-- <sa-td name="付款步骤" prop="payStep" type="enum" :jv="{1: '下单后', 2: '确认后'}"></sa-td> -->
 					<sa-td name="排序" prop="sort"></sa-td>
 					<el-table-column label="操作" fixed="right">
 						<template slot-scope="s">
-							<el-button  class="c-btn" type="primary" icon="el-icon-edit" @click="selectOne(s.row)">选择
+							<el-button class="c-btn" type="primary" icon="el-icon-edit" @click="selectOne(s.row)">选择
 							</el-button>
 						</template>
 					</el-table-column>
 				</el-table>
-				<!-- ------------- 分页 ------------- -->
-				<sa-item type="page" :curr.sync="p.pageNo" :size.sync="p.pageSize" :total="dataCount" @change="f5()">
-				</sa-item>
+				<el-pagination :page-size="p.pageSize" :current-page="p.pageNo"
+				 layout="prev, pager, next" :total="dataCount"
+				 @current-change="pageChange">
+				</el-pagination>
 			</div>
 		</div>
 		<script>
@@ -54,18 +55,18 @@
 				},
 				el: '.vue-box',
 				data: {
-					ids:sa.p('idStr',''),
-					goodsId:sa.p('goodsId',''),
+					ids: sa.p('idStr', ''),
+					goodsId: sa.p('goodsId', ''),
 					p: { // 查询参数  
 						id: '', // 主键
 						name: '', // 项目名称 
-						business: 0,
 						pageNo: 1, // 当前页 
-						pageSize: 20, // 页大小 
+						pageSize: 15, // 页大小 
 						sortType: 0 // 排序方式 
 					},
 					dataCount: 0,
 					dataList: [], // 数据集合
+					selection:[]
 				},
 				methods: {
 					// 新增
@@ -74,8 +75,9 @@
 						if (selection.length == 0) {
 							return sa.msg('至少选择一条数据')
 						}
-						let obj={
-							goodsId:this.goodsId,
+						selection=selection.concat(this.selection);
+						let obj = {
+							goodsId: this.goodsId,
 							typeIds: selection.map(obj => obj.id).join(',')
 						}
 						sa.ajax('/RelationGoodsType/saveBatch', obj, function(res) {
@@ -88,16 +90,21 @@
 					},
 					// 删除
 					selectOne: function(data) {
-						let obj={
-							goodsId:this.goodsId,
+						let obj = {
+							goodsId: this.goodsId,
 							typeId: data.id
 						}
 						sa.ajax('/RelationGoodsType/saveSingle', obj, function(res) {
 							sa.alert('添加成功');
-							this.ids=this.ids+','+data.id;
+							this.ids = this.ids + ',' + data.id;
 							this.f5();
 						}.bind(this));
 					},
+					pageChange(p) {
+						this.selection=this.selection.concat(this.$refs['data-table'].selection);
+						this.p.pageNo = p;
+						this.f5();
+					},
 					// 刷新
 					f5: function() {
 						sa.ajax('/TbItemType/getList', sa.removeNull(this.p), function(res) {
@@ -105,8 +112,8 @@
 							this.dataList = list; // 数据
 							this.dataCount = res.dataCount; // 数据总数 
 							let ids = this.ids.split(',');
+							ids=ids.concat(this.selection);
 							list.forEach(row => {
-								console.log(ids.indexOf(row.id) !== -1)
 								if (ids.indexOf(row.id) !== -1) {
 									this.$nextTick(() => {
 										this.$refs['data-table'].toggleRowSelection(row,

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

@@ -441,6 +441,7 @@
 						if (item) {
 							type.inc = item.inc;
 							type.price = item.price;
+							type.needRemark=item.needRemark
 						}
 					},
 					confirmAdd() {
@@ -536,8 +537,7 @@
 					getGoods() {
 						sa.ajax('/TbGoods/getList', {
 							pageNo: 1,
-							pageSize: 10,
-							businessType: 1
+							pageSize: 10
 						}, function(resp) {
 							let list = resp.data;
 							if (list.length >= 1) {
@@ -628,7 +628,11 @@
 						for (let i in typeList) {
 							let type = typeList[i];
 							if (type.need == 1 && !type.itemId) {
-								sa.error(type.name + '必选');
+								sa.error('【'+type.name + '】必选');
+								return false;
+							}
+							if (type.needRemark == 1 && !type.remark) {
+								sa.error('请输入【'+type.name + '】的备注');
 								return false;
 							}
 							if (type.itemId) {

+ 1 - 2
sp-admin/sa-view/tb-business/tb-car-disincle-edit.html

@@ -527,8 +527,7 @@
 					getGoods() {
 						sa.ajaxNoLoading('/TbGoods/getList', {
 							pageNo: 1,
-							pageSize: 10,
-							businessType: 1
+							pageSize: 10
 						}, function(resp) {
 							let list = resp.data;
 							this.goods = list.filter(goods => goods.id == this.m.goodsId).pop();

+ 8 - 2
sp-admin/sa-view/tb-goods/tb-goods-list.html

@@ -125,12 +125,18 @@
 							id:v.id,
 							chinaCarLeave:v.chinaCarLeave
 						}
-						sa.ajax('/TbGoods/chinaLeaveChange',function(resp){
+						sa.ajax('/TbGoods/chinaLeaveChange',obj,function(resp){
 							
 						}.bind(this))
-						console.log(v)
 					},
 					vietnamLeaveChange(v) {
+						let obj={
+							id:v.id,
+							vietnamCarLeave:v.vietnamCarLeave
+						}
+						sa.ajax('/TbGoods/vietnamLeaveChange',obj,function(resp){
+							
+						}.bind(this))
 						console.log(v)
 					},
 					// 查看

+ 10 - 9
sp-admin/sa-view/tb-item-type/tb-item-edit.html

@@ -115,7 +115,7 @@
 						itemName: '',
 						price: '400',
 						payType: '',
-						taxRate:6,
+						taxRate: 6,
 						businessType: '',
 						unit: '元/车',
 						minLength: '4.2',
@@ -127,19 +127,19 @@
 					itemTypeList: [],
 					payTypeList: [],
 					businessTypeList: [],
-					carTypeList:[],
-					itemType:[]
+					carTypeList: [],
+					itemType: []
 				},
 				methods: {
 					getItemType() {
 						sa.ajax('/TbItem/getItemType', function(resp) {
-							this.carTypeList= resp.data;
+							this.carTypeList = resp.data;
 						}.bind(this))
 					},
 					getBusinessTypeList() {
 						sa.ajax('/TbCostomer/getTypeList', function(resp) {
 							let list = resp.data;
-							
+
 							this.businessTypeList = list
 						}.bind(this))
 					},
@@ -175,13 +175,14 @@
 						}
 						let payTypeList = this.payTypeList;
 						let payType = payTypeList.filter(obj => obj.id == m.payType).pop();
+						sa.checkNull(payType, '请选择收费分类');
 						m.payType = payType.id;
 						m.payTypeName = payType.name;
 						let businessTypeList = this.businessTypeList;
 						let businessType = businessTypeList.filter(obj => obj.id == m.businessType).pop();
 						m.businessType = businessType.id;
 						m.businessTypeName = businessType.name;
-						m.itemType=this.itemType.join(',')
+						m.itemType = this.itemType.join(',')
 						// 开始增加或修改
 						sa.ajax('/TbItem/update', m, function(res) {
 							sa.alert('修改成功', this.clean);
@@ -198,12 +199,12 @@
 				mounted: function() {
 					sa.ajax('/TbItem/getById?id=' + this.id, function(res) {
 						this.m = res.data;
-						this.itemType=this.m.itemType.split(',')
+						this.itemType = this.m.itemType ? this.m.itemType.split(',') : []
 					}.bind(this))
 					this.getBusinessTypeList();
 					this.getPayTypeList();
-					this.getItemType();				
-					}
+					this.getItemType();
+				}
 			})
 		</script>
 	</body>

+ 11 - 3
sp-admin/sa-view/tb-item-type/tb-item-select.html

@@ -52,8 +52,9 @@
 					</el-table-column>
 				</el-table>
 				<!-- ------------- 分页 ------------- -->
-				<sa-item type="page" :curr.sync="p.pageNo" :size.sync="p.pageSize" :total="dataCount" @change="f5()">
-				</sa-item>
+				<el-pagination :page-size="p.pageSize" :current-page="p.pageNo" layout="prev, pager, next"
+					:total="dataCount" @current-change="pageChange">
+				</el-pagination>
 			</div>
 		</div>
 		<script>
@@ -75,6 +76,7 @@
 					},
 					dataCount: 0,
 					dataList: [], // 数据集合
+					selection: []
 				},
 				methods: {
 					// 新增
@@ -83,6 +85,7 @@
 						if (selection.length == 0) {
 							return sa.msg('至少选择一条数据')
 						}
+						selection = selection.concat(this.selection);
 						let obj = {
 							typeId: this.typeId,
 							itemIds: selection.map(obj => obj.id).join(',')
@@ -108,7 +111,11 @@
 							}, 1000)
 						}.bind(this))
 					},
-
+					pageChange(p) {
+						this.selection = this.selection.concat(this.$refs['data-table'].selection);
+						this.p.pageNo = p;
+						this.f5();
+					},
 					// 刷新
 					f5: function() {
 						sa.ajax('/TbItem/getList', sa.removeNull(this.p), function(res) {
@@ -116,6 +123,7 @@
 							this.dataList = list; // 数据
 							this.dataCount = res.dataCount; // 数据总数 
 							let ids = this.ids.split(',');
+							ids=ids.concat(this.selection);
 							list.forEach(row => {
 								if (ids.indexOf(row.id) !== -1) {
 									this.$nextTick(() => {

+ 0 - 1
sp-admin/sa-view/tb-item-type/tb-item-type-list.html

@@ -64,7 +64,6 @@
 					p: { // 查询参数  
 						id: '', // 主键
 						name: '', // 项目名称 
-						business: 0,
 						pageNo: 1, // 当前页 
 						pageSize: 20, // 页大小 
 						sortType: 0 // 排序方式 

+ 5 - 5
sp-admin/sa-view/tb-item-type/tb-item.html

@@ -45,13 +45,13 @@
 					</sa-td>
 
 					<sa-td name="明细数量" prop="inc" type="switch" :jv="{1: '多个[#005500]', 0: '单个[#ff0000]'}"
-						@change="s => updateNum(s.row)"></sa-td>
+						@change="s => updateNum(s.row)" width="100"></sa-td>
 					<sa-td name="是否必须" prop="need" type="switch" :jv="{1: '是[#005500]', 0: '否[#ff0000]'}"
 						@change="s => updateStatus(s.row)"></sa-td>
-					<sa-td name="备注" prop="needRemark" type="switch" :jv="{1: '有[#005500]', 0: '无[#ff0000]'}"
-						@change="s => updateRemarkNeed(s.row)"></sa-td>
-					<sa-td name="备注状态" prop="mustRemark" type="switch" :jv="{1: '必填[#005500]', 0: '选填[#ff0000]'}"
-						@change="s => updateRemarkMust(s.row)"></sa-td>
+					<sa-td name="备注" prop="needRemark" type="switch" :jv="{1: '必填[#005500]', 0: '选填[#ff0000]'}"
+						@change="s => updateRemarkNeed(s.row)" width="100"></sa-td>
+					<!-- <sa-td name="状态" prop="mustRemark" type="switch" :jv="{1: '必填[#005500]', 0: '选填[#ff0000]'}"
+						@change="s => updateRemarkMust(s.row)"></sa-td> -->
 					<el-table-column label="操作" fixed="right">
 						<template slot-scope="s">
 							<el-button class="c-btn" type="danger" @click="del(s.row)">移除

+ 17 - 20
sp-server/src/main/java/com/pj/api/jh/service/JhService.java

@@ -70,16 +70,12 @@ public class JhService {
             throw new BusinessException("金额不正确");
         }
         String openid = request.getParameter("openid");
-        String type = request.getParameter("type");
         String desc = request.getParameter("desc");
         String businessId = request.getParameter("b");
         String c = request.getParameter("c");
         String a = request.getParameter("a");
         String tradeType = request.getParameter("tradeType");
         String businessType = request.getParameter("businessType");
-        if (StrUtil.isEmpty(type)){
-            throw new BusinessException("参数异常");
-        }
         Attach atchMap = new Attach();
         atchMap.setC(c).setB(businessId).setA(a);
         String out_trade_no = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss")) + RandomUtil.randomNumbers(6);
@@ -107,28 +103,29 @@ public class JhService {
         String sign = MerchantApiUtil.getSign(params, paySecrit);
         params.put("sign", sign);
         String jsonParam = JSONUtil.toJsonStr(params);
-        String initPayUrl = jhConfig.getServerUrl() + "/uaps-web-gateway/cnpPay/initPay";
-        String result = jhHttpUtils.postJson(initPayUrl, jsonParam);
-        StaticLog.info("调用聚合支付返回:{}", result);
-        JSONObject jsonResult = JSONUtil.parseObj(result);
-        if (StrUtil.equals("0000", jsonResult.getStr("resultCode"))) {
-            JSONObject payMessage = JSONUtil.parseObj(jsonResult.getStr("payMessage"));
-            String p = payMessage.getStr("package");
-            Map<String, String> r = wxService.getPayP(payMessage.getStr("timeStamp"), payMessage.getStr("nonceStr"), openid, p);
-            StaticLog.info("re:{}", JSONUtil.toJsonStr(r));
-            JSONObject object = JSONUtil.parseObj(payMessage);
-
-            object.set("outTradeNo", out_trade_no);
+//        String initPayUrl = jhConfig.getServerUrl() + "/uaps-web-gateway/cnpPay/initPay";
+//        String result = jhHttpUtils.postJson(initPayUrl, jsonParam);
+//        StaticLog.info("调用聚合支付返回:{}", result);
+//        JSONObject jsonResult = JSONUtil.parseObj(result);
+//        if (StrUtil.equals("0000", jsonResult.getStr("resultCode"))) {
+//            JSONObject payMessage = JSONUtil.parseObj(jsonResult.getStr("payMessage"));
+//            String p = payMessage.getStr("package");
+//            Map<String, String> r = wxService.getPayP(payMessage.getStr("timeStamp"), payMessage.getStr("nonceStr"), openid, p);
+//            StaticLog.info("re:{}", JSONUtil.toJsonStr(r));
+//            JSONObject object = JSONUtil.parseObj(payMessage);
+//
+//            object.set("outTradeNo", out_trade_no);
             TbOrder tbOrder = new TbOrder();
             tbOrder.setAttach(JSONUtil.toJsonStr(atchMap))
                     .setOpenid(openid)
-                    .setOrderTime(new Date()).setBusinessType(Integer.valueOf(type))
+                    .setOrderTime(new Date())
                     .setOutTradeNo(out_trade_no).setPrice(money);
             tbOrderService.save(tbOrder);
             taskService.addTask(new CheckPayStatusTask(RandomUtil.randomNumbers(12), 2000, out_trade_no));
-            return BeanUtil.beanToMap(object);
-        }
-        throw new Exception("生成订单失败");
+//            return BeanUtil.beanToMap(object);
+//        }
+//        throw new Exception("生成订单失败");
+        return new HashMap<>();
     }
 
     public Map<String, Object> buildCheckParams(String outTradeNo) {

+ 40 - 44
sp-server/src/main/java/com/pj/api/open/service/OpenService.java

@@ -31,6 +31,7 @@ import com.pj.project.tb_car_no_color.TbCarNoColor;
 import com.pj.project.tb_car_no_color.TbCarNoColorService;
 import com.pj.project.tb_goods.TbGoods;
 import com.pj.project.tb_goods.TbGoodsService;
+import com.pj.project4sp.global.BusinessException;
 import com.pj.project4sp.uploadfile.UploadConfig;
 import com.pj.utils.cache.RedisUtil;
 import com.sun.org.apache.bcel.internal.generic.IF_ACMPEQ;
@@ -164,13 +165,13 @@ public class OpenService {
             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)) {
-                freeOut(tbBusinessCar,now,channel,image);
+                freeOut(tbBusinessCar, now, channel, image);
                 return ResultJson.success();
             }
         }
         //是否行政车辆=====
         if (checkFree(carNo, 2, now)) {
-            freeOut(tbBusinessCar,now,channel,image);
+            freeOut(tbBusinessCar, now, channel, image);
             return ResultJson.success();
         }
         if (tbBusinessCar.getIsLock() == 1) {
@@ -179,97 +180,92 @@ public class OpenService {
             return ResultJson.error("车辆已锁定");
         }
         String businessCarId = tbBusinessCar.getId();
+        String carNoPrefix = StrUtil.sub(carNo, 0, 1);
         List<TbBusiness> businessList = tbBusinessService.findOtherBusinessByCarId(businessCarId);
         if (businessList.isEmpty()) {//无业务车辆===>计算停车费
             //如果已经支付过,则从支付时间算起,重新计算停车费
-            double dif=caulatePrice(tbBusinessCar,now);
+            double dif = caulatePrice(tbBusinessCar, now);
             if (dif > 0) {
                 RedisUtil.setByMINUTES(channel, carNo, 1);
                 log.error("请求返回:请缴停车费:{},{}元", carNo, dif);
                 return ResultJson.error("请缴停车费" + dif + "元");
-            }else {
-                freeOut(tbBusinessCar,now,channel,image);
+            } else {
+                freeOut(tbBusinessCar, now, channel, image);
                 return ResultJson.success();
             }
         } else {
             //有业务的车
             //1、分越南车和中国车
-            String carNoPrefix = StrUtil.sub(carNo, 0, 1);
             //中国车是否收费
-            if (CAR_LIST.contains(carNoPrefix)){
+            if (CAR_LIST.contains(carNoPrefix)) {
                 boolean chinaCarPay = businessList.stream().anyMatch(tbBusiness -> {
                     TbGoods tbGoods = tbGoodsService.getById(tbBusiness.getGoodsId());
                     return tbGoods.getChinaCarPay() == 1;
                 });
-                if (!chinaCarPay){
-                    freeOut(tbBusinessCar,now,channel,image);
-                    return ResultJson.success();
-                }else {
-                    double dif=caulatePrice(tbBusinessCar,now);
+                if (chinaCarPay) {
+                    double dif = caulatePrice(tbBusinessCar, now);
                     if (dif > 0) {
                         RedisUtil.setByMINUTES(channel, carNo, 1);
                         log.error("请求返回:请缴停车费:{},{}元", carNo, dif);
                         return ResultJson.error("请缴停车费" + dif + "元");
-                    }else {
-                        freeOut(tbBusinessCar,now,channel,image);
-                        return ResultJson.success();
                     }
                 }
-            }else {//越南车
+            } else {//越南车
                 boolean vietnamCarPay = businessList.stream().anyMatch(tbBusiness -> {
                     TbGoods tbGoods = tbGoodsService.getById(tbBusiness.getGoodsId());
                     return tbGoods.getVietnamCarPay() == 1;
                 });
-                if (!vietnamCarPay){
-                    freeOut(tbBusinessCar,now,channel,image);
-                    return ResultJson.success();
-                }else {
-                    double dif=caulatePrice(tbBusinessCar,now);
+                if (vietnamCarPay) {
+                    double dif = caulatePrice(tbBusinessCar, now);
                     if (dif > 0) {
                         RedisUtil.setByMINUTES(channel, carNo, 1);
                         log.error("请求返回:请缴停车费:{},{}元", carNo, dif);
                         return ResultJson.error("请缴停车费" + dif + "元");
-                    }else {
-                        freeOut(tbBusinessCar,now,channel,image);
-                        return ResultJson.success();
                     }
                 }
             }
         }
         //============业务费计算是否交完
-        List<TbBusinessItem> items;
-        if (TbBusiness.BusinessType.HOLD_CAR.getCode().equals(businessType)) {
-            items = tbBusinessItemService.findByBusinessId(businessId);
-        } else {
-            List<TbBusiness> businessList = tbBusinessService.findOtherBusinessByCarId(tbBusinessCar.getId());
-            items = tbBusinessItemService.findByBusinessIdList(businessList.stream().map(TbBusiness::getId).collect(Collectors.toList()));
-        }
-        long count = items.stream().filter(tbBusinessItem -> tbBusinessItem.getPayStatus() == 0).count();
-        if (count > 0) {
-            RedisUtil.setByMINUTES(channel, carNo, 1);
-            log.error("请求返回:请缴纳业务费用:{}", carNo);
-            return ResultJson.error("请缴纳业务费用");
+        for (TbBusiness tbBusiness : businessList) {
+            TbGoods tbGoods = tbGoodsService.getById(tbBusiness.getGoodsId());
+            int vietnamLeave = tbGoods.getVietnamCarLeave();
+            int chinaCarLeave = tbGoods.getChinaCarLeave();
+            boolean pay = tbBusiness.getPayMoney().doubleValue() >= tbBusiness.getItemPrice().doubleValue();
+            //需要交业务费
+            if (!CAR_LIST.contains(carNoPrefix)) {//越南车
+                if (TbGoods.LeaveEnum.PART_MONEY.getCode() != vietnamLeave
+                        && !pay) {
+                    RedisUtil.setByMINUTES(channel, carNo, 1);
+                    log.error("请求返回:请缴纳业务费用:{}", carNo);
+                    return ResultJson.error("请缴纳业务费用");
+                }
+            } else {
+                if (TbGoods.LeaveEnum.PART_MONEY.getCode() != chinaCarLeave
+                        && !pay) {
+                    RedisUtil.setByMINUTES(channel, carNo, 1);
+                    log.error("请求返回:请缴纳业务费用:{}", carNo);
+                    return ResultJson.error("请缴纳业务费用");
+                }
+            }
         }
-        tbBusinessCar.setRealOutTime(now).setOutChannel(channel).setTimeUpdate(now);
-        tbBusinessCarService.updateById(tbBusinessCar);
-        CoverBase64ToUrl(image, tbBusinessCar.getId(), carNo, 2);
-        RedisUtil.del(channel);
+        freeOut(tbBusinessCar, now, channel, image);
         return ResultJson.success();
     }
 
 
-    private double caulatePrice(TbBusinessCar tbBusinessCar,Date now){
-        Date inTime=tbBusinessCar.getRealInTime();
+    private double caulatePrice(TbBusinessCar tbBusinessCar, Date now) {
+        Date inTime = tbBusinessCar.getRealInTime();
         if (tbBusinessCar.getPay() == 1 && tbBusinessCar.getRealOutTime() == null && tbBusinessCar.getPayTime() != null) {
             inTime = tbBusinessCar.getPayTime();
         }
         BigDecimal price = tbBusinessService.calculationPartMoney(inTime, now);
         return price.doubleValue();
     }
-    private void freeOut(TbBusinessCar tbBusinessCar,Date now,String outChannel,String base64Image){
+
+    private void freeOut(TbBusinessCar tbBusinessCar, Date now, String outChannel, String base64Image) {
         tbBusinessCar.setRealOutTime(now).setTimeUpdate(now).setOutChannel(outChannel);
         tbBusinessCarService.updateById(tbBusinessCar);
-        String carNo=tbBusinessCar.getCarNo();
+        String carNo = tbBusinessCar.getCarNo();
         CoverBase64ToUrl(base64Image, tbBusinessCar.getId(), carNo, 2);
         RedisUtil.del(outChannel);
         log.error("请求返回【放行】:{}", carNo);

+ 0 - 47
sp-server/src/main/java/com/pj/api/service/ApiService.java

@@ -285,51 +285,4 @@ public class ApiService {
         return list;
     }
 
-
-    private void checkOtherBusiness(OtherBusinessBO otherBusinessBO, List<TbItem> tbItems, String carNo) {
-        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
-        String itemTypeId = otherBusinessBO.getItemTypeId();
-        TbBusinessSort sort = tbBusinessSortService.findByItemTypeId(itemTypeId);
-        List<TbBusinessSort> sorts = tbBusinessSortService.findByGroupId(sort.getGroupId());
-        LocalDateTime operateTime = LocalDateTime.parse(otherBusinessBO.getOperateTime(), formatter);
-        int i = 0;
-        for (TbBusinessSort tbBusinessSort : sorts) {
-            if (i == 0 && StrUtil.equals(tbBusinessSort.getTypeId(), otherBusinessBO.getItemTypeId()) && sorts.size() > 1) {
-                TbBusinessSort afterItem = sorts.get(i + 1);
-                String typeId = afterItem.getTypeId();
-                Integer interval = afterItem.getIntervalTime();
-                LocalDateTime endTime = operateTime.plusMinutes(interval);
-                if (afterItem.getIntervalTime() > 0) {
-                    int count = tbBusinessService.checkCarBusinessType(typeId, carNo, endTime.format(formatter), 1);
-                    if (count > 0) {
-                        throw new BusinessException("车辆:[" + carNo + "]" + tbBusinessSort.getTypeName() + "后" + afterItem.getIntervalTime() + "分钟才可以执行" + afterItem.getTypeName());
-                    }
-                }
-            }
-            if (i > 0 && StrUtil.equals(tbBusinessSort.getTypeId(), otherBusinessBO.getItemTypeId())) {
-                TbBusinessSort beforeItem = sorts.get(i - 1);
-                String typeId = beforeItem.getTypeId();
-                Integer interval = tbBusinessSort.getIntervalTime();
-                LocalDateTime endTime = operateTime.minusMinutes(interval);
-                if (tbBusinessSort.getIntervalTime() > 0) {
-                    int count = tbBusinessService.checkCarBusinessType(typeId, carNo, endTime.format(formatter), 0);
-                    if (count > 0) {
-                        throw new BusinessException("车辆:[" + carNo + "]" + beforeItem.getTypeName() + "后" + tbBusinessSort.getIntervalTime() + "分钟才可以执行" + tbBusinessSort.getTypeName());
-                    }
-                }
-            }
-            String typeId = otherBusinessBO.getItemTypeId();
-            Integer singleIntervalTime = tbBusinessSort.getSingleIntervalTime();
-            String timeStart = operateTime.minusHours(singleIntervalTime).format(formatter);
-            String businessId = otherBusinessBO.getId();
-            String timeEnd = operateTime.plusHours(singleIntervalTime).format(formatter);
-            int count = tbBusinessService.checkCarBusinessType(typeId, carNo, timeStart, timeEnd, businessId);
-            if (count > 0) {
-                throw new BusinessException("车辆:[" + carNo + "]" + singleIntervalTime + "小时内已有相同作业");
-            }
-            i++;
-        }
-    }
-
-
 }

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

@@ -95,10 +95,6 @@ public class WxService {
         if (Double.valueOf(money) <= 0) {
             throw new BusinessException("金额不正确");
         }
-        String type = request.getParameter("type");
-        if (StrUtil.isEmpty(type)) {
-            throw new BusinessException("参数异常");
-        }
         String openid = request.getParameter("openid");
         String desc = request.getParameter("desc");
 //        String openid = "oDWvn5w-hVkzUuKeY7OBXBV_l1rU";
@@ -148,7 +144,7 @@ public class WxService {
             TbOrder tbOrder = new TbOrder();
             tbOrder.setAttach(JSONUtil.toJsonStr(atchMap))
                     .setOpenid(openid)
-                    .setOrderTime(new Date()).setBusinessType(Integer.valueOf(type))
+                    .setOrderTime(new Date())
                     .setOutTradeNo(out_trade_no).setPrice(money);
             return payParams;
         }

+ 7 - 0
sp-server/src/main/java/com/pj/project/relation_business_car/RelationBusinessCarService.java

@@ -67,4 +67,11 @@ public class RelationBusinessCarService extends ServiceImpl<RelationBusinessCarM
         ew.eq("business_car_id",businessCarId);
         return list(ew);
     }
+
+	public void removeByBusinessIdAndCarId(String businessId, String businessCarId) {
+		QueryWrapper<RelationBusinessCar>ew=new QueryWrapper<>();
+		ew.eq("business_id",businessId);
+		ew.eq("business_car_id",businessCarId);
+		this.remove(ew);
+	}
 }

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

@@ -170,7 +170,10 @@
         select * from tb_item where business_id=#{id}
     </select>
     <select id="findOtherBusinessByCarId" resultType="com.pj.project.tb_business.TbBusiness">
-        select a.* from tb_business a,relation_business_car b where  a.id=b.business_id and b.business_car_id=#{businessCarId}
+        select distinct a.*
+        from tb_business a,relation_business_car b
+        where  a.id=b.business_id
+        and b.business_car_id=#{businessCarId}
     </select>
 
 </mapper>

+ 43 - 8
sp-server/src/main/java/com/pj/project/tb_business/TbBusinessService.java

@@ -490,7 +490,7 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
     public Map<String, Object> getBusinessMoney(String businessCarId, String state) {
         Map<String, Object> result = new HashMap<>();
         List<TbBusiness> businessList = this.findOtherBusinessByCarId(businessCarId);
-        List<TbBusinessCar> cars = new ArrayList<>();
+        Set<TbBusinessCar> cars = new HashSet<>();
         //越南车是否需要支付
         int vietnamCarPay = businessList.stream().anyMatch(tbBusiness -> {
             TbGoods tbGoods = tbGoodsService.getById(tbBusiness.getGoodsId());
@@ -563,7 +563,7 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
             }
             carsList.add(carMap);
         }
-        result.put("carList", carsList);
+        result.put("carList",carsList.stream().sorted(Comparator.comparingDouble(obj->Double.valueOf(obj.get("price").toString()))).collect(Collectors.toList()));
         BigDecimal itemsPrice = new BigDecimal("0");
         List<Map<String, Object>> itemList = new ArrayList<>();
         for (TbBusinessItem item : items) {
@@ -740,6 +740,10 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
         for (TbBusinessCar car : cars) {
             String carNo = car.getCarNo().trim().toUpperCase();
             String carPrefix = StrUtil.sub(carNo, 0, 1);
+            List<TbBusinessCar> notOutRecords = tbBusinessCarService.findNotOutCar(carNo);
+            if (notOutRecords.size() > 1) {
+                throw new BusinessException(carNo + "有多个未出场记录,请先处理");
+            }
             //最新一条记录
             TbBusinessCar db = tbBusinessCarService.findTheLastRecord(carNo);
             //不存在,或者已离场记录--->新建记录;
@@ -754,9 +758,9 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
                 db.setPayType(TbBusinessCar.PayTypeEnum.FEE_TYPE.getType());
             }
             TbCar tbCar = tbCarService.findByCardNo(carNo);
-            if (tbCar!=null){
+            if (tbCar != null) {
                 db.setCarCompany(tbCar.getCustomerName());
-                if (!TbCar.CarTypeEnum.BUSINESS_CAR.getType().equals(tbCar.getCarType())){
+                if (!TbCar.CarTypeEnum.BUSINESS_CAR.getType().equals(tbCar.getCarType())) {
                     db.setPayType(TbBusinessCar.PayTypeEnum.FEE_TYPE.getType());
                 }
             }
@@ -845,10 +849,38 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
             }
             String carPrefix = StrUtil.sub(carNo, 0, 1);
             if (StrUtil.isNotEmpty(businessCarId)) {
+                //原来已存在的
                 TbBusinessCar dbBusinessCar = tbBusinessCarService.getById(businessCarId);
-                dbBusinessCar.setNetWeight(tbBusinessCar.getNetWeight()).setCarType(tbBusinessCar.getCarType())
-                        .setCarSize(tbBusinessCar.getCarSize()).setCarNo(carNo);
-                tbBusinessCarService.updateById(dbBusinessCar);
+                //如果修改了车牌号
+                if (!StrUtil.equals(carNo, dbBusiness.getCardNo())) {
+                    //把关联删除掉,然后添加新的关联
+                    relationBusinessCarService.removeByBusinessIdAndCarId(dbBusiness.getId(),businessCarId);
+                    TbBusinessCar otherCar = tbBusinessCarService.findTheLastRecord(carNo);
+                    if (otherCar == null ||//不存在或者已离场===>新建
+                            (otherCar.getRealInTime() != null && otherCar.getRealOutTime() != null)) {
+                        otherCar = new TbBusinessCar();
+                        otherCar.setCreateTime(now).setPay(0).setNo(carBuseinssNo + RandomUtil.randomNumbers(4))
+                                .setCarNo(carNo).setCarType(tbBusinessCar.getCarType()).setCarSize(tbBusinessCar.getCarSize())
+                                .setNetWeight(tbBusinessCar.getNetWeight()).setCustomerId(dbBusiness.getCustomerId())
+                                .setTimeUpdate(now).setIsLock(0);
+                        if ((CAR_LIST.contains(carPrefix) && chinaCarPay == 0) || (!CAR_LIST.contains(carPrefix) && vietnamCarPay == 0)) {
+                            otherCar.setPayType(TbBusinessCar.PayTypeEnum.FEE_TYPE.getType());
+                        }
+                        tbBusinessCarService.save(otherCar);
+                    } else {
+                        List<TbBusiness> tbBusinessList = this.findOtherBusinessByCarId(businessCarId);
+                        if (tbBusinessList.size() == 1&&dbBusinessCar.getRealInTime()==null) {
+                            tbBusinessCarService.removeById(businessCarId);
+                        }
+                    }
+                    RelationBusinessCar relationBusinessCar = new RelationBusinessCar();
+                    relationBusinessCar.setBusinessId(dbBusiness.getId()).setBusinessCarId(otherCar.getId());
+                    relationBusinessCarService.save(relationBusinessCar);
+                } else {
+                    dbBusinessCar.setNetWeight(tbBusinessCar.getNetWeight()).setCarType(tbBusinessCar.getCarType())
+                            .setCarSize(tbBusinessCar.getCarSize());
+                    tbBusinessCarService.updateById(dbBusinessCar);
+                }
             } else {
                 TbBusinessCar checkCar = tbBusinessCarService.findTheLastRecord(carNo);
                 if (checkCar == null ||
@@ -859,7 +891,7 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
                 checkCar.setCarNo(carNo).setCarType(tbBusinessCar.getCarType()).setCarSize(tbBusinessCar.getCarSize())
                         .setNetWeight(tbBusinessCar.getNetWeight()).setCustomerId(dbBusiness.getCustomerId())
                         .setTimeUpdate(now).setIsLock(0);
-                if ((CAR_LIST.contains(carPrefix) && chinaCarPay == 1) || (!CAR_LIST.contains(carPrefix) && vietnamCarPay == 1)) {
+                if ((CAR_LIST.contains(carPrefix) && chinaCarPay == 0) || (!CAR_LIST.contains(carPrefix) && vietnamCarPay == 0)) {
                     checkCar.setPayType(TbBusinessCar.PayTypeEnum.FEE_TYPE.getType());
                 }
                 tbBusinessCarService.saveOrUpdate(checkCar);
@@ -913,6 +945,9 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
     private void checkOtherBusiness(String itemTypeId, String operateTimeStr, String businessId, String carNo) {
         DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
         TbBusinessSort sort = tbBusinessSortService.findByItemTypeId(itemTypeId);
+        if (sort==null){
+            return;
+        }
         List<TbBusinessSort> sorts = tbBusinessSortService.findByGroupId(sort.getGroupId());
         LocalDateTime operateTime = LocalDateTime.parse(operateTimeStr, formatter);
         int i = 0;

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

@@ -122,6 +122,11 @@ public class TbBusinessCarController {
         return AjaxJson.getPageData(so.getDataCount(), list);
     }
 
+    @RequestMapping("getBusinessByBusinessCarId")
+    public AjaxJson getBusinessByBusinessCarId(String businessId){
+        List<TbBusinessCar> list= tbBusinessCarService.findOtherBusinessCar(businessId);
+        return AjaxJson.getSuccessData(list);
+    }
     @RequestMapping("searchByNo")
     public AjaxJson searchByNo(String carNo){
         List<TbBusinessCar> list= tbBusinessCarService.searchByNo(carNo);

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

@@ -150,7 +150,7 @@
         and DATE_FORMAT(b.operate_time,'%Y-%m-%d %H:%i:%s') &gt;#{timeEnd}
     </select>
     <select id="findOtherBusinessCar" resultType="com.pj.project.tb_business_car.TbBusinessCar">
-        select a.* from  tb_business_car a,relation_business_car b where  a.id=b.business_car_id and b.business_id=#{businessId}
+        select distinct a.* from  tb_business_car a,relation_business_car b where  a.id=b.business_car_id and b.business_id=#{businessId}
     </select>
     <select id="searchForPayCar" resultType="com.pj.project.tb_business_car.TbBusinessCar">
         SELECT

+ 2 - 7
sp-server/src/main/java/com/pj/project/tb_business_car/TbBusinessCarService.java

@@ -156,16 +156,12 @@ public class TbBusinessCarService extends ServiceImpl<TbBusinessCarMapper, TbBus
         return list.isEmpty() ? null : list.get(0);
     }
 
-    public TbBusinessCar findNotOutCar(String carNo) {
+    public List<TbBusinessCar> findNotOutCar(String carNo) {
         QueryWrapper<TbBusinessCar> ew = new QueryWrapper<>();
         ew.eq("car_no", carNo.toUpperCase())
                 .isNull("real_out_time")
                 .isNotNull("real_in_time");
-        List<TbBusinessCar> list = list(ew);
-        if (list.size() > 1) {
-            throw new BusinessException("该车" + carNo + "有多个未出场记录");
-        }
-        return getOne(ew);
+        return list(ew);
     }
 
     public TbBusinessCar check(String carNo) {
@@ -395,7 +391,6 @@ public class TbBusinessCarService extends ServiceImpl<TbBusinessCarMapper, TbBus
     }
 
     public List<TbBusinessCar> findOtherBusinessCar(String businessId) {
-
         return tbBusinessCarMapper.findOtherBusinessCar(businessId);
     }
 

+ 18 - 0
sp-server/src/main/java/com/pj/project/tb_goods/TbGoodsController.java

@@ -154,6 +154,24 @@ public class TbGoodsController {
         int line = SP.publicMapper.updateColumnById(TbGoods.TABLE_NAME, "china_car_pay", value, id);
         return AjaxJson.getByLine(line);
     }
+    /**
+     * 改 - 申报时间是否必填(1=是,0=否)
+     */
+    @RequestMapping("chinaLeaveChange")
+    @SaCheckPermission(TbGoods.PERMISSION_CODE_EDIT)
+    public AjaxJson chinaLeaveChange(Long id, String chinaCarLeave) {
+        int line = SP.publicMapper.updateColumnById(TbGoods.TABLE_NAME, "china_car_leave", chinaCarLeave, id);
+        return AjaxJson.getByLine(line);
+    }
+    /**
+     * 改 - 申报时间是否必填(1=是,0=否)
+     */
+    @RequestMapping("vietnamLeaveChange")
+    @SaCheckPermission(TbGoods.PERMISSION_CODE_EDIT)
+    public AjaxJson vietnamLeaveChange(Long id, String vietnamCarLeave) {
+        int line = SP.publicMapper.updateColumnById(TbGoods.TABLE_NAME, "vietnam_car_leave", vietnamCarLeave, id);
+        return AjaxJson.getByLine(line);
+    }
 
 
     @RequestMapping("getPayStep")

+ 0 - 2
sp-server/src/main/java/com/pj/project/tb_item_type/TbItemTypeController.java

@@ -100,8 +100,6 @@ public class TbItemTypeController {
     @RequestMapping("getList")
     public AjaxJson getList() {
         SoMap so = SoMap.getRequestSoMap();
-
-
         List<TbItemType> list = tbItemTypeService.getList(so.startPage());
         return AjaxJson.getPageData(so.getDataCount(), list);
     }

+ 7 - 3
sp-server/src/main/java/com/pj/project/tb_item_type/TbItemTypeService.java

@@ -115,15 +115,19 @@ public class TbItemTypeService extends ServiceImpl<TbItemTypeMapper, TbItemType>
         for (RelationGoodsType relationGoodsType : relationGoodsTypes) {
             String typeId = relationGoodsType.getTypeId();
             List<RelationTypeItem> list = relationTypeItemService.findByTypeId(typeId);
+            List<String> itemIds = list.stream().map(RelationTypeItem::getItemId).collect(Collectors.toList());
+
             TbItemType tbItemType = this.getById(typeId);
             tbItemType.setNeed(relationGoodsType.getNeedSelect());
-            List<String> itemIds = list.stream().map(RelationTypeItem::getItemId).collect(Collectors.toList());
-            List<TbItem> items = tbItemService.listByIds(itemIds);
+            List<TbItem> items =new ArrayList<>();
+            if (!itemIds.isEmpty()){
+                items= tbItemService.listByIds(itemIds);
+            }
             for (TbItem item : items) {
                 list.stream()
                         .filter(relationTypeItem -> relationTypeItem.getItemId().equals(item.getId()) && relationTypeItem.getTypeId().equals(typeId))
                         .findFirst().ifPresent(relationTypeItem -> {
-                    item.setInc(relationTypeItem.getInc());
+                    item.setInc(relationTypeItem.getInc()).setNeedRemark(relationTypeItem.getNeedRemark());
                 });
             }
             tbItemType.setItems(items);