|
@@ -1,20 +1,20 @@
|
1
|
1
|
package com.community.huiju.service.impl;
|
2
|
2
|
|
|
3
|
+import com.community.commom.mode.ResponseBean;
|
3
|
4
|
import com.community.commom.session.UserElement;
|
4
|
5
|
import com.community.huiju.dao.*;
|
5
|
|
-import com.community.huiju.model.TaSysRole;
|
6
|
|
-import com.community.huiju.model.TaUser;
|
7
|
|
-import com.community.huiju.model.TaUserVerify;
|
8
|
|
-import com.community.huiju.model.TpBuildingOwnerInfo;
|
|
6
|
+import com.community.huiju.model.*;
|
9
|
7
|
import com.community.huiju.service.BillServiceI;
|
10
|
8
|
import com.github.pagehelper.Page;
|
11
|
9
|
import com.github.pagehelper.PageHelper;
|
12
|
10
|
import com.google.common.collect.Maps;
|
|
11
|
+import org.apache.commons.collections.CollectionUtils;
|
13
|
12
|
import org.springframework.beans.factory.annotation.Autowired;
|
14
|
13
|
import org.springframework.stereotype.Service;
|
15
|
14
|
|
16
|
15
|
import java.util.List;
|
17
|
16
|
import java.util.Map;
|
|
17
|
+import java.util.stream.Collectors;
|
18
|
18
|
|
19
|
19
|
/**
|
20
|
20
|
* @author FXF
|
|
@@ -37,6 +37,15 @@ public class BillServiceImpl implements BillServiceI {
|
37
|
37
|
|
38
|
38
|
@Autowired
|
39
|
39
|
private TpBuildingOwnerInfoMapper tpBuildingOwnerInfoMapper;
|
|
40
|
+
|
|
41
|
+ @Autowired
|
|
42
|
+ private TpBillOrderMapper tpBillOrderMapper;
|
|
43
|
+
|
|
44
|
+ @Autowired
|
|
45
|
+ private TpBillMapper tpBillMapper;
|
|
46
|
+
|
|
47
|
+ @Autowired
|
|
48
|
+ private TpBillStatementMapper tpBillStatementMapper;
|
40
|
49
|
|
41
|
50
|
/**
|
42
|
51
|
* 根据payType分页获取缴费或未缴费的数据
|
|
@@ -54,17 +63,6 @@ public class BillServiceImpl implements BillServiceI {
|
54
|
63
|
* 账单 关联的是房产,
|
55
|
64
|
*/
|
56
|
65
|
|
57
|
|
-// TaUserVerify userVerify = taUserVerifyMapper.selectCommunityAndAddressAndRoleId(userElement.getCommunityId(),
|
58
|
|
-// userElement.getPhaseId(), userElement.getBuildingId(), userElement.getUnitId(),
|
59
|
|
-// userElement.getLevelId(), userElement.getRoomNoId());
|
60
|
|
-// // 业主信息
|
61
|
|
-// TaUser user = taUserMapper.selectByPrimaryKey(userVerify.getUserId());
|
62
|
|
-//
|
63
|
|
-// TpBuildingOwnerInfo tpBuildingOwnerInfo = tpBuildingOwnerInfoMapper.selectCommunityAndAddressAndPhone(userElement.getCommunityId(),
|
64
|
|
-// userElement.getPhaseId(), userElement.getBuildingId(), userElement.getUnitId(),
|
65
|
|
-// userElement.getLevelId(), userElement.getRoomNoId(), user.getLoginName());
|
66
|
|
-
|
67
|
|
-
|
68
|
66
|
//使用分页插件
|
69
|
67
|
Page<Map<String,Object>> page = PageHelper.startPage(pageNum, pageSize);
|
70
|
68
|
List<Map<String,Object>> billsList = tpBillInvoiceMapper.getBillsList(userElement.getCommunityId(), userElement.getRoomNoId(), payType);
|
|
@@ -92,4 +90,71 @@ public class BillServiceImpl implements BillServiceI {
|
92
|
90
|
billInvoiceDetail.put("payPrice", payPriceDouble);
|
93
|
91
|
return billInvoiceDetail;
|
94
|
92
|
}
|
|
93
|
+
|
|
94
|
+ @Override
|
|
95
|
+ public ResponseBean payHistory(UserElement userElement) {
|
|
96
|
+ ResponseBean responseBean = new ResponseBean();
|
|
97
|
+
|
|
98
|
+ //1. 查询所有订单
|
|
99
|
+ //2. 根据订单
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+ // 所有订单
|
|
103
|
+ List<TpBillOrder> billOrderList = tpBillOrderMapper.selectByRoomNoId(userElement.getRoomNoId());
|
|
104
|
+ billOrderList.forEach(e->{
|
|
105
|
+ // 缴费组
|
|
106
|
+ List<TpBill> billsCollect = billOrderList.stream().map(billOrder -> tpBillMapper.selectByPrimaryKey(billOrder.getTpBillId())).collect(Collectors.toList());
|
|
107
|
+ // 所有缴费组的总额
|
|
108
|
+ Long billCountPrice = billsCollect.stream().map(billCount -> Integer.parseInt(billCount.getPayPrice())).count();
|
|
109
|
+
|
|
110
|
+ e.setBillList(billsCollect);
|
|
111
|
+ e.setSumPrice(billCountPrice);
|
|
112
|
+ });
|
|
113
|
+
|
|
114
|
+ responseBean.addSuccess(billOrderList);
|
|
115
|
+ return responseBean;
|
|
116
|
+ }
|
|
117
|
+
|
|
118
|
+ @Override
|
|
119
|
+ public ResponseBean getOrderInfo(String orderNumber) {
|
|
120
|
+ ResponseBean responseBean = new ResponseBean();
|
|
121
|
+
|
|
122
|
+ /**
|
|
123
|
+ * 1.根据订单号获取所有缴费组
|
|
124
|
+ * 2.获取其中的一条缴费订单数据, 因为订单号再库里面是多条,取第一条就可以
|
|
125
|
+ * 3.计算出所有缴费组的总额
|
|
126
|
+ * 4.获取一个缴费的流水记录, 因为 订单号对应多个缴费单,每一个缴费单对应一个缴费流水, 然后通过缴费流水可以知道缴费人,缴费类型,缴费备注等等
|
|
127
|
+ */
|
|
128
|
+
|
|
129
|
+ // 这个订单所有的缴费组记录, 拿到每一个缴费组的id
|
|
130
|
+ List<TpBillOrder> billOrderList = tpBillOrderMapper.selectByOrderNumberBill(orderNumber);
|
|
131
|
+ if (CollectionUtils.isEmpty(billOrderList)) {
|
|
132
|
+ responseBean.addError("订单号不存在!");
|
|
133
|
+ return responseBean;
|
|
134
|
+ }
|
|
135
|
+ // 每个缴费组数据
|
|
136
|
+ List<TpBill> tpBillList = billOrderList.stream().map(e -> tpBillMapper.selectByPrimaryKey(e.getTpBillId())).collect(Collectors.toList());
|
|
137
|
+ // 所有缴费组的总额
|
|
138
|
+ Long billCountPrice = tpBillList.stream().map(billCount -> Integer.parseInt(billCount.getPayPrice())).count();
|
|
139
|
+
|
|
140
|
+ // 因为订单号是多条,取第一条即可
|
|
141
|
+ TpBillOrder tpBillOrder = billOrderList.get(0);
|
|
142
|
+
|
|
143
|
+ // 获取一条流水
|
|
144
|
+ TpBillStatement tpBillStatement = tpBillStatementMapper.selectByCommunityIdAndBillInvoiceId(tpBillOrder.getCommunityId(), tpBillOrder.getTpBillInvoiceId());
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+ Map<String, Object> map = Maps.newHashMap();
|
|
148
|
+ map.put("orderNumber", orderNumber);
|
|
149
|
+ map.put("createDate", tpBillOrder.getCreateDate());
|
|
150
|
+ map.put("sumPrice", billCountPrice);
|
|
151
|
+ map.put("payName", tpBillStatement.getPayName());
|
|
152
|
+ map.put("updateDate", tpBillOrder.getUpdateDate());
|
|
153
|
+ map.put("payType", tpBillStatement.getPayType());
|
|
154
|
+ map.put("payRemark", tpBillStatement.getPayRemark());
|
|
155
|
+ map.put("list", tpBillList);
|
|
156
|
+
|
|
157
|
+ responseBean.addSuccess(map);
|
|
158
|
+ return responseBean;
|
|
159
|
+ }
|
95
|
160
|
}
|