| | |
| | | import com.ruoyi.system.domain.dto.PayCallbackDTO; |
| | | import com.ruoyi.system.domain.dto.UserPolicyDto; |
| | | import com.ruoyi.im.service.UserPolicyService; |
| | | import com.ruoyi.system.service.PaymentRecordService; |
| | | import com.ruoyi.system.service.UserAccountService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.catalina.User; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | |
| | | @Autowired |
| | | InsuranceProductService insuranceProductService; |
| | | |
| | | @Autowired |
| | | private PayService payService; |
| | | PaymentRecordService paymentRecordService; |
| | | |
| | | @Value("${pay.key}") |
| | | private String key; |
| | |
| | | |
| | | |
| | | /** |
| | | * 保单列表 |
| | | */ |
| | | @GetMapping("/PaymentRecordList") |
| | | public TableDataInfo PaymentRecordList(@RequestParam(value = "payOrdeNo",required = false) String payOrdeNo, |
| | | @RequestParam(value = "paymentStatus",required = false) Integer paymentStatus) { |
| | | startPage(); |
| | | |
| | | LambdaQueryWrapper<PaymentRecord> wrapper = new LambdaQueryWrapper<>(); |
| | | |
| | | // 产品名称模糊查询 |
| | | if (StringUtils.isNotEmpty(payOrdeNo)) { |
| | | wrapper.eq(PaymentRecord::getPayOrdeNo, payOrdeNo); |
| | | } |
| | | if (paymentStatus != null) { |
| | | wrapper.eq(PaymentRecord::getPaymentStatus, paymentStatus); |
| | | } |
| | | // 按创建时间倒序排列 |
| | | wrapper.orderByDesc(PaymentRecord::getCreateTime); |
| | | |
| | | List<PaymentRecord> list = paymentRecordService.list(wrapper); |
| | | return getDataTable(list); |
| | | } |
| | | |
| | | /** |
| | | * 保单审批 |
| | | */ |
| | | @GetMapping("/examine") |
| | |
| | | } |
| | | |
| | | //计算到期时间 |
| | | LocalDate expirationTime = calculateInsuranceEndDate(LocalDate.now(), userPolicy.getNumberDays()); |
| | | LocalDate expirationTime = calculateInsuranceEndDate(LocalDate.now(), userPolicy.getTerm()); |
| | | //保险金领取到期时间 |
| | | LocalDate insuranceBenefitExpiryDate = calculateInsuranceEndDateToDay(LocalDate.now(), userPolicy.getNumberDays()); |
| | | |
| | | userPolicy.setApprovalStatus(approvalStatus); |
| | | userPolicy.setMessage(message); |
| | | userPolicy.setStartDate(LocalDate.now()); |
| | | userPolicy.setEndDate(expirationTime); |
| | | userPolicy.setInsuranceBenefitExpiryDate(insuranceBenefitExpiryDate); |
| | | userPolicy.setPolicyStatus(UserPolicy.PolicyStatus.ACTIVE); |
| | | userPolicy.setUpdatedAt(new Date()); |
| | | userPolicyService.updateById(userPolicy); |
| | |
| | | medicalInsuranceAccount.setAlreadyReceived(BigDecimal.ZERO); |
| | | medicalInsuranceAccount.setAmountAlreadyUsed(BigDecimal.ZERO); |
| | | medicalInsuranceAccount.setEffectiveDate(userPolicy.getStartDate()); |
| | | medicalInsuranceAccount.setInsuranceBenefitExpiryDate(userPolicy.getInsuranceBenefitExpiryDate()); |
| | | medicalInsuranceAccount.setExpiryDate(userPolicy.getEndDate()); |
| | | medicalInsuranceAccount.setAccountStatus(MedicalInsuranceAccount.AccountStatus.ACTIVE); |
| | | medicalInsuranceAccount.setCreatedAt(new Date()); |
| | |
| | | userPolicy.setUpdatedAt(new Date()); |
| | | |
| | | boolean updateResult = userPolicyService.updateById(userPolicy); |
| | | |
| | | PaymentRecord paymentRecord = paymentRecordService.getOne(new LambdaQueryWrapper<PaymentRecord>() |
| | | .eq(PaymentRecord::getPayOrdeNo, callbackDTO.getOrderId()) |
| | | ); |
| | | if(ObjectUtil.isNotEmpty(paymentRecord)){ |
| | | paymentRecord.setPaymentStatus(PaymentRecord.PaymentStatus.PAID.getCode()); |
| | | paymentRecordService.updateById(paymentRecord); |
| | | } |
| | | if (updateResult) { |
| | | log.info("支付成功处理完成: {}", callbackDTO.getOrderId()); |
| | | return true; |
| | |
| | | userPolicy.setUpdatedAt(new Date()); |
| | | |
| | | boolean updateResult = userPolicyService.updateById(userPolicy); |
| | | |
| | | PaymentRecord paymentRecord = paymentRecordService.getOne(new LambdaQueryWrapper<PaymentRecord>() |
| | | .eq(PaymentRecord::getPayOrdeNo, callbackDTO.getOrderId()) |
| | | ); |
| | | if(ObjectUtil.isNotEmpty(paymentRecord)){ |
| | | paymentRecord.setPaymentStatus(PaymentRecord.PaymentStatus.EXPIRED.getCode()); |
| | | paymentRecordService.updateById(paymentRecord); |
| | | } |
| | | if (updateResult) { |
| | | log.info("支付超时处理完成: {}", callbackDTO.getOrderId()); |
| | | return true; |