| | |
| | | import com.dsh.activity.util.DateUtil; |
| | | import com.dsh.activity.util.PayMoneyUtil; |
| | | import com.dsh.activity.util.ResultUtil; |
| | | import com.sun.org.apache.bcel.internal.generic.NEW; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | |
| | | .eq(THuiminRecord::getPayId, record.getId())); |
| | | record.setUseTimes(list.size()); |
| | | } |
| | | 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()); |
| | | for (SalesDetailVO record : records) { |
| | | AppUser appUser = appUserClient.queryAppUser(record.getAppUserId()); |
| | | if (Objects.nonNull(appUser)){ |
| | | item.setUserName(appUser.getName()); |
| | | item.setPhone(appUser.getPhone()); |
| | | record.setUserName(appUser.getName()); |
| | | record.setPhone(appUser.getPhone()); |
| | | } |
| | | List<TStudent> studentList = studentClient.getStudentByIds(item.getStudentId()); |
| | | if (CollUtil.isNotEmpty(studentList)){ |
| | | item.setStudentName(studentList.stream().map(TStudent::getName).collect(Collectors.joining(","))); |
| | | StringBuilder stringBuilder = new StringBuilder(); |
| | | String[] split = record.getStudentId().split(","); |
| | | for (String s : split) { |
| | | String replace = s.replace(" ", ""); |
| | | List<TStudent> studentById = studentClient.getStudentByIds(replace); |
| | | if (!studentById.isEmpty()){ |
| | | stringBuilder.append(studentById.get(0).getName()+","); |
| | | } |
| | | }); |
| | | |
| | | } |
| | | String string = stringBuilder.toString(); |
| | | if (StringUtils.hasLength(string)) { |
| | | String stringWithoutLastCharacter = string.substring(0, string.length() - 1); |
| | | record.setStudentName(stringWithoutLastCharacter); |
| | | } |
| | | } |
| | | // 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 salesDetailVOPage; |
| | | } |
| | | |
| | |
| | | public ResultUtil<?> refund(Integer id) throws AlipayApiException { |
| | | TPayHuimin payHuimin = this.getById(id); |
| | | if (Objects.nonNull(payHuimin)) { |
| | | // 后台录入订单直接修改为已退款 |
| | | if (payHuimin.getPaymentType()==3){ |
| | | payHuimin.setStatus(3); |
| | | payHuimin.setRefundStatus(3); |
| | | payHuimin.setRefundNumber(payHuimin.getCode()); |
| | | payHuimin.setRefundTime(new Date()); |
| | | this.updateById(payHuimin); |
| | | return ResultUtil.success(); |
| | | } |
| | | Integer count = huiminRecordService.lambdaQuery() |
| | | .eq(THuiminRecord::getPayId, payHuimin.getId()) |
| | | .count(); |