无关风月
17 小时以前 b1fb83530b7105e4aa73e4101727dea945eb01c2
cloud-server-account/src/main/java/com/dsh/account/controller/FinanceController.java
@@ -6,6 +6,7 @@
import com.dsh.account.entity.RechargeRecords;
import com.dsh.account.entity.TAppUser;
import com.dsh.account.entity.VipPayment;
import com.dsh.account.feignclient.activity.UserConponClient;
import com.dsh.account.model.IncomeQuery;
import com.dsh.account.model.dto.VipPaymentDto;
import com.dsh.account.model.dto.VipRefundDto;
@@ -38,6 +39,8 @@
    private IVipPaymentService vipPaymentService;
    @Autowired
    private TAppUserService appUserService;
    @Autowired
    private UserConponClient userConponClient;
    /**
@@ -105,33 +108,44 @@
        if (parse.before(new Date())){
            appUser.setIsVip(0);
        }
        vipPayment.setRemark(vipRefundDto.getRemark());
        appUserService.updateById(appUser);
        vipPayment.setState(3);
        vipPayment.setPayStatus(3);
        vipPaymentService.updateById(vipPayment);
        // 将未使用的门票优惠券设置为已过期
        userConponClient.setStatusVipDetail(vipPayment.getId());
        return "200";
    }
    @ResponseBody
    @RequestMapping("/finance/vipPayment")
    @PostMapping("/finance/vipPayment")
    List<VipPaymentListVO> vipPayment(@RequestBody VipPaymentDto vipPaymentDto){
        List<VipPaymentListVO> vipPaymentListVOS = new ArrayList<>();
        List<Integer> payStatus = new ArrayList<>();
        payStatus.add(2);
        LambdaQueryWrapper<VipPayment> vipPaymentLambdaQueryWrapper = new LambdaQueryWrapper<>();
        vipPaymentLambdaQueryWrapper.in(!vipPaymentDto.getUserIds().isEmpty(),VipPayment::getAppUserId, vipPaymentDto.getUserIds());
        vipPaymentLambdaQueryWrapper.in(!vipPaymentDto.getVipIds().isEmpty(),VipPayment::getVipId, vipPaymentDto.getVipIds());
        vipPaymentLambdaQueryWrapper.in(VipPayment::getPayStatus,payStatus);
        vipPaymentLambdaQueryWrapper.in(vipPaymentDto.getUserIds()!=null&&!vipPaymentDto.getUserIds().isEmpty(),VipPayment::getAppUserId, vipPaymentDto.getUserIds());
        vipPaymentLambdaQueryWrapper.in(vipPaymentDto.getVipIds()!=null&&!vipPaymentDto.getVipIds().isEmpty(),VipPayment::getVipId, vipPaymentDto.getVipIds());
        vipPaymentLambdaQueryWrapper.ge(StringUtils.hasLength(vipPaymentDto.getStartTime()), VipPayment::getInsertTime, vipPaymentDto.getStartTime());
        vipPaymentLambdaQueryWrapper.le(StringUtils.hasLength(vipPaymentDto.getEndTime()), VipPayment::getInsertTime, vipPaymentDto.getEndTime());
        if (vipPaymentDto.getIsRefund()==null){
            payStatus.add(3);
            payStatus.add(2);
        }
        if (vipPaymentDto.getIsRefund()!=null&&vipPaymentDto.getIsRefund()==1){
            payStatus.add(3);
        }
        if (vipPaymentDto.getIsRefund()!=null&&vipPaymentDto.getIsRefund()==2){
            payStatus.add(2);
        }
        vipPaymentLambdaQueryWrapper.in(VipPayment::getPayStatus,payStatus);
        vipPaymentLambdaQueryWrapper.orderByDesc(VipPayment::getInsertTime);
        List<VipPayment> list = vipPaymentService.list(vipPaymentLambdaQueryWrapper);
        // 使用 Stream + 手动拷贝提升性能和可读性(或使用 MapStruct)
        vipPaymentListVOS = list.stream().map(vipDetail -> {
                VipPaymentListVO vo = new VipPaymentListVO();
            BeanUtils.copyProperties(vo, vipDetail); // 注意参数顺序是否正确
            BeanUtils.copyProperties(vipDetail,vo); // 注意参数顺序是否正确
            return vo;
        }).collect(Collectors.toList());
        for (VipPaymentListVO vipPaymentListVO : vipPaymentListVOS) {