|
@@ -10,10 +10,7 @@ import com.community.commom.session.UserElement;
|
10
|
10
|
import com.community.commom.utils.PayPriceUtils;
|
11
|
11
|
import com.community.huiju.dao.*;
|
12
|
12
|
import com.community.huiju.exception.WisdomException;
|
13
|
|
-import com.community.huiju.model.Bill;
|
14
|
|
-import com.community.huiju.model.BillInvoice;
|
15
|
|
-import com.community.huiju.model.TaUser;
|
16
|
|
-import com.community.huiju.model.TpBuildingOwnerInfo;
|
|
13
|
+import com.community.huiju.model.*;
|
17
|
14
|
import com.community.huiju.service.IBillInvoiceService;
|
18
|
15
|
import com.google.common.collect.Maps;
|
19
|
16
|
import org.apache.poi.hssf.usermodel.*;
|
|
@@ -153,7 +150,36 @@ public class BillInvoiceServiceImpl extends ServiceImpl<BillInvoiceMapper, BillI
|
153
|
150
|
}
|
154
|
151
|
|
155
|
152
|
billInvoice.setBillStatus("2");
|
156
|
|
- billInvoiceMapper.updateById(billInvoice);
|
|
153
|
+ int rows = billInvoiceMapper.updateById(billInvoice);
|
|
154
|
+ if (rows > 0) {
|
|
155
|
+ TpBuildingOwnerInfo buildingOwnerInfo = tpBuildingOwnerInfoMapper.selectById(billInvoice.getBuildingOwnerInfoId());
|
|
156
|
+
|
|
157
|
+ // 插入流水
|
|
158
|
+ BillStatement billStatement = new BillStatement();
|
|
159
|
+ billStatement.setCommunityId(userElement.getCommunityId());
|
|
160
|
+ billStatement.setBillInvoiceId(billInvoice.getId());
|
|
161
|
+ billStatement.setTaUserId(billInvoice.getTaUserId());
|
|
162
|
+ billStatement.setPayPrice(billInvoice.getPayPrice());
|
|
163
|
+ billStatement.setPayName(buildingOwnerInfo.getOwnerName());
|
|
164
|
+ billStatement.setPayRemark(billInvoice.getBillInvoiceExplain());
|
|
165
|
+ billStatement.setPayType("1");
|
|
166
|
+ billStatement.setCreateTime(new Date());
|
|
167
|
+ billStatementMapper.insert(billStatement);
|
|
168
|
+
|
|
169
|
+ // 更新缴费单信息
|
|
170
|
+ billInvoice.setBillStatementId(billStatement.getId());
|
|
171
|
+ billInvoice.setPayName(billStatement.getPayName());
|
|
172
|
+ billInvoice.setPayDate(new Date());
|
|
173
|
+ billInvoice.setOutTradeNo(String.valueOf(System.currentTimeMillis()) + billInvoice.getId());
|
|
174
|
+ billInvoiceMapper.updateById(billInvoice);
|
|
175
|
+
|
|
176
|
+ // 修改缴费户数
|
|
177
|
+ Bill bill = billMapper.selectById(billInvoice.getBillId());
|
|
178
|
+ bill.setPayedNum(bill.getPayedNum() + 1);
|
|
179
|
+ bill.setUnpayedNum(bill.getUnpayedNum() - 1);
|
|
180
|
+ billMapper.updateById(bill);
|
|
181
|
+
|
|
182
|
+ }
|
157
|
183
|
});
|
158
|
184
|
|
159
|
185
|
responseBean.addSuccess("操作成功");
|
|
@@ -181,7 +207,7 @@ public class BillInvoiceServiceImpl extends ServiceImpl<BillInvoiceMapper, BillI
|
181
|
207
|
// 收费单说明
|
182
|
208
|
String billInvoiceExplain = jsonObject.getString("billInvoiceExplain");
|
183
|
209
|
// 收费金额
|
184
|
|
- Integer payPrice = jsonObject.getInteger("payPrice");
|
|
210
|
+ Double payPrice = jsonObject.getDouble("payPrice");
|
185
|
211
|
|
186
|
212
|
// 楼栋资料库
|
187
|
213
|
QueryWrapper<TpBuildingOwnerInfo> queryWrapper = new QueryWrapper<>();
|
|
@@ -198,6 +224,11 @@ public class BillInvoiceServiceImpl extends ServiceImpl<BillInvoiceMapper, BillI
|
198
|
224
|
userQueryWrapper.eq("login_name", buildingOwnerInfo.getOwnerTel());
|
199
|
225
|
TaUser taUser = taUserMapper.selectOne(userQueryWrapper);
|
200
|
226
|
|
|
227
|
+ if (null == taUser) {
|
|
228
|
+ responseBean.addError("该业主未绑定app, 无法操作!");
|
|
229
|
+ return responseBean;
|
|
230
|
+ }
|
|
231
|
+
|
201
|
232
|
|
202
|
233
|
BillInvoice billInvoice = new BillInvoice();
|
203
|
234
|
billInvoice.setBillId(billId);
|
|
@@ -210,6 +241,7 @@ public class BillInvoiceServiceImpl extends ServiceImpl<BillInvoiceMapper, BillI
|
210
|
241
|
billInvoice.setCreateUser(userElement.getId());
|
211
|
242
|
billInvoice.setCreateDate(new Date());
|
212
|
243
|
billInvoice.setStatus(0);
|
|
244
|
+ billInvoice.setOutTradeNo("");
|
213
|
245
|
|
214
|
246
|
int result = billInvoiceMapper.insert(billInvoice);
|
215
|
247
|
billInvoice.setOutTradeNo(String.valueOf(System.currentTimeMillis()) + billInvoice.getId());
|
|
@@ -236,6 +268,12 @@ public class BillInvoiceServiceImpl extends ServiceImpl<BillInvoiceMapper, BillI
|
236
|
268
|
}).collect(Collectors.toList());
|
237
|
269
|
|
238
|
270
|
boolean b = this.updateBatchById(billInvoices);
|
|
271
|
+ // 修改为有效时, 修改应缴费户数
|
|
272
|
+ Bill bill = billMapper.selectById(billInvoices.get(0).getBillId());
|
|
273
|
+ bill.setPayTotalNum(bill.getPayTotalNum() + billInvoices.size());
|
|
274
|
+ bill.setUnpayedNum(bill.getUnpayedNum() + billInvoices.size());
|
|
275
|
+ billMapper.updateById(bill);
|
|
276
|
+
|
239
|
277
|
if (b == false) {
|
240
|
278
|
throw new WisdomException("操作失败");
|
241
|
279
|
}
|
|
@@ -287,7 +325,8 @@ public class BillInvoiceServiceImpl extends ServiceImpl<BillInvoiceMapper, BillI
|
287
|
325
|
responseBean.addError("不能修改已缴费");
|
288
|
326
|
return responseBean;
|
289
|
327
|
}
|
290
|
|
- billInvoice.setPayPrice(PayPriceUtils.yuanConversionPoints(payPrice));
|
|
328
|
+ // 此处存储的是已经转换过的金额
|
|
329
|
+ billInvoice.setPayPrice(payPrice);
|
291
|
330
|
billInvoice.setUpdateUser(userElement.getId());
|
292
|
331
|
billInvoice.setUpdateDate(new Date());
|
293
|
332
|
|