| | |
| | | List<SalesDetailVO> records = salesDetailVOPage.getRecords(); |
| | | for (SalesDetailVO record : records) { |
| | | List<THuiminRecord> list = huiminRecordService.list(new LambdaQueryWrapper<THuiminRecord>() |
| | | .eq(THuiminRecord::getAppUserId, record.getAppUserId()) |
| | | .eq(THuiminRecord::getHuiminCardId, record.getCarId())); |
| | | .eq(THuiminRecord::getPayId, record.getId())); |
| | | record.setUseTimes(list.size()); |
| | | } |
| | | if (CollUtil.isNotEmpty(records)){ |
| | |
| | | public ResultUtil<?> refund(Integer id) throws AlipayApiException { |
| | | TPayHuimin payHuimin = this.getById(id); |
| | | if (Objects.nonNull(payHuimin)) { |
| | | Integer count = huiminRecordService.lambdaQuery().eq(THuiminRecord::getAppUserId, payHuimin.getAppUserId()) |
| | | .eq(THuiminRecord::getHuiminCardId, payHuimin.getCardId()) |
| | | .lt(THuiminRecord::getInsertTime, DateUtil.addDay(payHuimin.getPaymentTime(),7)) |
| | | Integer count = huiminRecordService.lambdaQuery() |
| | | .eq(THuiminRecord::getPayId, payHuimin.getId()) |
| | | .count(); |
| | | if (count > 0 || new Date().after(DateUtil.addDay(payHuimin.getPaymentTime(),7))) { |
| | | //超过七日或者七日内有使用记录的退款:更改状态,实际退款线下操作。 |
| | |
| | | } else { |
| | | if (payHuimin.getPaymentType() == 1) { |
| | | Map<String, String> map = payMoneyUtil.wxRefund(payHuimin.getOrderNumber(), payHuimin.getCode(), |
| | | payHuimin.getSalesMoney().toString(), payHuimin.getSalesMoney().toString(), "/base/worldCup/wxRefundWorldCupCallback"); |
| | | payHuimin.getSalesMoney().toString(), payHuimin.getSalesMoney().toString(), "/base/huimin/callBack/wxRefundHuiminCallback"); |
| | | if (!"SUCCESS".equals(map.get("return_code"))) { |
| | | System.err.println("-------------微信退款失败---------"); |
| | | System.err.println(map.get("return_msg")); |
| | |
| | | */ |
| | | @Override |
| | | public List<SalesDetailVO> exportData(HuiminPayQuery query) { |
| | | return baseMapper.exportData(query); |
| | | List<SalesDetailVO> records = baseMapper.exportData(query); |
| | | if (CollUtil.isNotEmpty(records)){ |
| | | List<Integer> appUserIdList = records.stream().map(SalesDetailVO::getAppUserId).collect(Collectors.toList()); |
| | | List<AppUser> appUserList = appUserClient.queryAppUserBatch(appUserIdList); |
| | | Map<Integer, AppUser> appUserMap = appUserList.stream().collect(Collectors.toMap(AppUser::getId, appUser -> appUser)); |
| | | records.forEach(item->{ |
| | | AppUser appUser = appUserMap.get(item.getAppUserId()); |
| | | if (Objects.nonNull(appUser)){ |
| | | item.setUserName(appUser.getName()); |
| | | item.setPhone(appUser.getPhone()); |
| | | } |
| | | List<TStudent> studentList = studentClient.getStudentByIds(item.getStudentId()); |
| | | if (CollUtil.isNotEmpty(studentList)){ |
| | | item.setStudentName(studentList.stream().map(TStudent::getName).collect(Collectors.joining(","))); |
| | | } |
| | | }); |
| | | } |
| | | return records; |
| | | } |
| | | } |