整理核销以及驳回接口
This commit is contained in:
		| @ -1,7 +1,8 @@ | |||||||
| package com.sczx.order.service; | package com.sczx.order.service; | ||||||
|  |  | ||||||
| import com.sczx.order.dto.GroupBuyOrderInfoDto; | import com.sczx.order.dto.RentCarThirdPlatformOrderReq; | ||||||
| import com.sczx.order.dto.SimpleUserInfoDTO; | import com.sczx.order.dto.SimpleUserInfoDTO; | ||||||
|  | import com.sczx.order.dto.VerifyGroupBuyCouponsReq; | ||||||
|  |  | ||||||
| /** 团购券服务 | /** 团购券服务 | ||||||
|  * @Author: 张黎 |  * @Author: 张黎 | ||||||
| @ -17,10 +18,10 @@ public interface GroupBuyCouponService { | |||||||
|     SimpleUserInfoDTO getGroupBuyOrderInfoDto(String mobile); |     SimpleUserInfoDTO getGroupBuyOrderInfoDto(String mobile); | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 校验团购券码 |      * 验券获取三方平台订单信息 | ||||||
|      * @param couponCode 团购券码 |      * @param userInfoDTO | ||||||
|      * @param couponType 团购券类型 |      * @param req | ||||||
|      * @return |      * @return | ||||||
|      */ |      */ | ||||||
|     boolean checkCouponCode(String couponCode, String couponType); |     RentCarThirdPlatformOrderReq getThirdPlatformOrder(SimpleUserInfoDTO userInfoDTO, VerifyGroupBuyCouponsReq req); | ||||||
| } | } | ||||||
|  | |||||||
| @ -1,16 +1,33 @@ | |||||||
| package com.sczx.order.service.impl; | package com.sczx.order.service.impl; | ||||||
|  |  | ||||||
|  | import com.douyin.openapi.client.models.CertificatePrepareRequest; | ||||||
|  | import com.douyin.openapi.client.models.CertificatePrepareResponse; | ||||||
|  | import com.douyin.openapi.client.models.CertificateVerifyRequest; | ||||||
|  | import com.douyin.openapi.client.models.CertificateVerifyResponse; | ||||||
|  | import com.meituan.sdk.MeituanResponse; | ||||||
|  | import com.meituan.sdk.model.ddzh.tuangou.tuangouReceiptConsume.TuangouReceiptConsumeResponse; | ||||||
|  | import com.meituan.sdk.model.ddzh.tuangou.tuangouReceiptPrepare.TuangouReceiptPrepareResponse; | ||||||
| import com.sczx.order.common.enums.CouponTypeEnum; | import com.sczx.order.common.enums.CouponTypeEnum; | ||||||
| import com.sczx.order.dto.GroupBuyOrderInfoDto; | import com.sczx.order.dto.RentCarThirdPlatformOrderReq; | ||||||
| import com.sczx.order.dto.SimpleUserInfoDTO; | import com.sczx.order.dto.SimpleUserInfoDTO; | ||||||
|  | import com.sczx.order.dto.VerifyGroupBuyCouponsReq; | ||||||
| import com.sczx.order.exception.BizException; | import com.sczx.order.exception.BizException; | ||||||
|  | import com.sczx.order.service.DouyinService; | ||||||
| import com.sczx.order.service.GroupBuyCouponService; | import com.sczx.order.service.GroupBuyCouponService; | ||||||
| import com.sczx.order.service.MeiTuanService; | import com.sczx.order.service.MeiTuanService; | ||||||
|  | import com.sczx.order.thirdpart.dto.CarModelPackageDTO; | ||||||
|  | import com.sczx.order.thirdpart.dto.CompanyStoreDTO; | ||||||
|  | import com.sczx.order.thirdpart.integration.CarInteg; | ||||||
|  | import com.sczx.order.thirdpart.integration.StoreInteg; | ||||||
| import com.sczx.order.thirdpart.integration.UserInteg; | import com.sczx.order.thirdpart.integration.UserInteg; | ||||||
| import lombok.extern.slf4j.Slf4j; | import lombok.extern.slf4j.Slf4j; | ||||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||||
| import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||||
|  |  | ||||||
|  | import java.util.HashMap; | ||||||
|  | import java.util.Map; | ||||||
|  | import java.util.concurrent.atomic.AtomicReference; | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * @Author: 张黎 |  * @Author: 张黎 | ||||||
|  * @Date: 2025/10/27/20:48 |  * @Date: 2025/10/27/20:48 | ||||||
| @ -27,6 +44,15 @@ public class GroupBuyCouponServiceImpl implements GroupBuyCouponService { | |||||||
|     @Autowired |     @Autowired | ||||||
|     private MeiTuanService meiTuanService; |     private MeiTuanService meiTuanService; | ||||||
|  |  | ||||||
|  |     @Autowired | ||||||
|  |     private DouyinService douyinService; | ||||||
|  |  | ||||||
|  |     @Autowired | ||||||
|  |     private CarInteg carInteg; | ||||||
|  |  | ||||||
|  |     @Autowired | ||||||
|  |     private StoreInteg storeInteg; | ||||||
|  |  | ||||||
|     @Override |     @Override | ||||||
|     public SimpleUserInfoDTO getGroupBuyOrderInfoDto(String mobile) { |     public SimpleUserInfoDTO getGroupBuyOrderInfoDto(String mobile) { | ||||||
|         SimpleUserInfoDTO userInfoDTO = userInteg.getUInfoByMobile(mobile); |         SimpleUserInfoDTO userInfoDTO = userInteg.getUInfoByMobile(mobile); | ||||||
| @ -36,14 +62,128 @@ public class GroupBuyCouponServiceImpl implements GroupBuyCouponService { | |||||||
|         if(userInfoDTO.getAuthed()==0){ |         if(userInfoDTO.getAuthed()==0){ | ||||||
|             throw new BizException("用户未实名认证"); |             throw new BizException("用户未实名认证"); | ||||||
|         } |         } | ||||||
|         return null; |         return userInfoDTO; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     @Override |     @Override | ||||||
|     public boolean checkCouponCode(String couponCode, String couponType) { |     public RentCarThirdPlatformOrderReq getThirdPlatformOrder(SimpleUserInfoDTO userInfoDTO, VerifyGroupBuyCouponsReq req) { | ||||||
|         if(CouponTypeEnum.MT.getCode().equals(couponType)){ |  | ||||||
|  |  | ||||||
|  |         RentCarThirdPlatformOrderReq thirdRentCarOrder = new RentCarThirdPlatformOrderReq(); | ||||||
|  |         Map<String, String> productIdMap = new HashMap<>(); | ||||||
|  |         if (CouponTypeEnum.MT.getCode().equalsIgnoreCase(req.getCouponType())){ | ||||||
|  |             //美团验券 | ||||||
|  |             MeituanResponse<TuangouReceiptPrepareResponse> prepareResponse =meiTuanService.prepare( req); | ||||||
|  |             String phone = prepareResponse.getData().getMobile(); | ||||||
|  |             if (phone != null && !phone.isEmpty()){ | ||||||
|  |                 if (comparePhoneNumbers(phone, req.getMobile())){ | ||||||
|  |                     throw new BizException("所提供的手机号码与团购手机号不一致"); | ||||||
|                 } |                 } | ||||||
|         return false; |             } | ||||||
|  |             //使用输入的手机号进行后续操作 | ||||||
|  |             //核销团购券 | ||||||
|  |             MeituanResponse<TuangouReceiptConsumeResponse> consumeResponse =meiTuanService.consume( req); | ||||||
|  |             consumeResponse.getData().getResult().forEach(result -> { | ||||||
|  |                 productIdMap.put("mtOrderId",String.valueOf(result.getDealId())); | ||||||
|  |                 productIdMap.put("mtProductId",  String.valueOf(result.getDealGroupId())); | ||||||
|  |             }); | ||||||
|  |  | ||||||
|  |  | ||||||
|  |             //生成第三方订单 | ||||||
|  |             CarModelPackageDTO carModelPackageDTO = carInteg.getCarModelPackageByThireId(productIdMap.get("mtProductId"),null); | ||||||
|  |             if (carModelPackageDTO == null){ | ||||||
|  |                 throw new BizException("无此对应团购套餐"); | ||||||
|  |             } | ||||||
|  |  | ||||||
|  |             thirdRentCarOrder.setCarModelId(carModelPackageDTO.getCarModelId()); | ||||||
|  |             thirdRentCarOrder.setRentCarRuleId(carModelPackageDTO.getCarRuleId()); | ||||||
|  |             thirdRentCarOrder.setCustomerId(userInfoDTO.getUserId().longValue()); | ||||||
|  |             thirdRentCarOrder.setStoreId(req.getStoreId()); | ||||||
|  |             thirdRentCarOrder.setOrderSource(CouponTypeEnum.MT.getCode()); | ||||||
|  |             thirdRentCarOrder.setCustomerName(userInfoDTO.getUserName()); | ||||||
|  |             thirdRentCarOrder.setCustomerPhone(userInfoDTO.getPhoneNumber()); | ||||||
|  |             thirdRentCarOrder.setThirdOrderNo(productIdMap.get("mtOrderId")); | ||||||
|  |             thirdRentCarOrder.setCouponCode(req.getCouponCode()); | ||||||
|  |             thirdRentCarOrder.setRentBatteyRuleId(carModelPackageDTO.getBatteyRuleId()); | ||||||
|  |  | ||||||
|  |         } else if (CouponTypeEnum.DY.getCode().equalsIgnoreCase(req.getCouponType())){ | ||||||
|  |  | ||||||
|  |             //根据门店ID获取抖音门店ID | ||||||
|  |             CompanyStoreDTO store = storeInteg.getStoreById(req.getStoreId().intValue()); | ||||||
|  |             String poiId = store.getDyStoreId(); | ||||||
|  |  | ||||||
|  |             //调用抖音验券接口 | ||||||
|  |             CertificatePrepareRequest prepareRequest = new CertificatePrepareRequest(); | ||||||
|  |  | ||||||
|  |             prepareRequest.setPoiId(poiId); | ||||||
|  |             prepareRequest.setEncryptedData(req.getCouponCode()); | ||||||
|  |  | ||||||
|  |             CertificatePrepareResponse response =douyinService.prepare(prepareRequest); | ||||||
|  |             //获取核销所需信息 | ||||||
|  |             String verifyToken = response.getData().getVerifyToken(); | ||||||
|  |             AtomicReference<String> phone = new AtomicReference<>(""); | ||||||
|  |             response.getData().getCertificates().forEach(certificate -> { | ||||||
|  |                 productIdMap.put("dyOrderId",String.valueOf(certificate.getCertificateId())); | ||||||
|  |                 productIdMap.put("dyProductId",  String.valueOf(certificate.getSku().getSkuId())); | ||||||
|  |                 certificate.getReserveInfo().getOrderReserveUserInfoList().forEach(orderReserveUserInfo -> { | ||||||
|  |                     phone.set(orderReserveUserInfo.getPhone()); | ||||||
|  |                 }); | ||||||
|  |             }); | ||||||
|  |  | ||||||
|  |             String finalPhone = phone.get(); | ||||||
|  |  | ||||||
|  |             if (finalPhone != null && !finalPhone.isEmpty()) { | ||||||
|  |                 if (comparePhoneNumbers(finalPhone, req.getMobile())){ | ||||||
|  |                     throw new BizException("所提供的手机号码与团购手机号不一致"); | ||||||
|  |                 } | ||||||
|  |             } | ||||||
|  |  | ||||||
|  |             //核销抖音团购券 | ||||||
|  |             CertificateVerifyRequest verifyRequest = new CertificateVerifyRequest(); | ||||||
|  |             verifyRequest.setVerifyToken(verifyToken); | ||||||
|  |             verifyRequest.setPoiId(poiId); | ||||||
|  |  | ||||||
|  |             CertificateVerifyResponse verifyResponse =douyinService.verify(verifyRequest); | ||||||
|  |  | ||||||
|  |             verifyResponse.getData().getVerifyResults().forEach(verifyResult -> { | ||||||
|  |                 //撤销验券需要下面两个值 | ||||||
|  |                 productIdMap.put("dyCertificateId",verifyResult.getCertificateId()); | ||||||
|  |                 productIdMap.put("dyVerifyId",verifyResult.getVerifyId()); | ||||||
|  |             }); | ||||||
|  |  | ||||||
|  |             //生成第三方订单 | ||||||
|  |             CarModelPackageDTO carModelPackageDTO = carInteg.getCarModelPackageByThireId(null,productIdMap.get("dyProductId")); | ||||||
|  |             if (carModelPackageDTO == null){ | ||||||
|  |                 throw new BizException("无此对应团购套餐"); | ||||||
|  |             } | ||||||
|  |             thirdRentCarOrder.setCarModelId(carModelPackageDTO.getCarModelId()); | ||||||
|  |             thirdRentCarOrder.setRentCarRuleId(carModelPackageDTO.getCarRuleId()); | ||||||
|  |             thirdRentCarOrder.setCustomerId(userInfoDTO.getUserId().longValue()); | ||||||
|  |             thirdRentCarOrder.setStoreId(req.getStoreId()); | ||||||
|  |             thirdRentCarOrder.setOrderSource(CouponTypeEnum.DY.getCode()); | ||||||
|  |             thirdRentCarOrder.setCustomerName(userInfoDTO.getUserName()); | ||||||
|  |             thirdRentCarOrder.setCustomerPhone(userInfoDTO.getPhoneNumber()); | ||||||
|  |             thirdRentCarOrder.setThirdOrderNo(productIdMap.get("dyCertificateId")); | ||||||
|  |             thirdRentCarOrder.setCouponCode(productIdMap.get("dyVerifyId")); | ||||||
|  |             thirdRentCarOrder.setRentBatteyRuleId(carModelPackageDTO.getBatteyRuleId()); | ||||||
|  |         } | ||||||
|  |         return thirdRentCarOrder; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     private boolean comparePhoneNumbers(String maskedPhone, String actualPhone) { | ||||||
|  |         // 检查输入参数 | ||||||
|  |         if (maskedPhone == null || actualPhone == null) { | ||||||
|  |             return true; | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         // 比较前3位 | ||||||
|  |         String prefix1 = maskedPhone.substring(0, 3); | ||||||
|  |         String prefix2 = actualPhone.substring(0, 3); | ||||||
|  |  | ||||||
|  |         // 比较后4位 | ||||||
|  |         String suffix1 = maskedPhone.substring(maskedPhone.length() - 4); | ||||||
|  |         String suffix2 = actualPhone.substring(actualPhone.length() - 4); | ||||||
|  |  | ||||||
|  |         // 返回比对结果 | ||||||
|  |         return !prefix1.equals(prefix2) || !suffix1.equals(suffix2); | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  | |||||||
| @ -3,13 +3,6 @@ package com.sczx.order.service.impl; | |||||||
| import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | ||||||
| import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; | ||||||
| import com.baomidou.mybatisplus.core.metadata.IPage; | import com.baomidou.mybatisplus.core.metadata.IPage; | ||||||
| import com.douyin.openapi.client.models.CertificatePrepareRequest; |  | ||||||
| import com.douyin.openapi.client.models.CertificatePrepareResponse; |  | ||||||
| import com.douyin.openapi.client.models.CertificateVerifyRequest; |  | ||||||
| import com.douyin.openapi.client.models.CertificateVerifyResponse; |  | ||||||
| import com.meituan.sdk.MeituanResponse; |  | ||||||
| import com.meituan.sdk.model.ddzh.tuangou.tuangouReceiptConsume.TuangouReceiptConsumeResponse; |  | ||||||
| import com.meituan.sdk.model.ddzh.tuangou.tuangouReceiptPrepare.TuangouReceiptPrepareResponse; |  | ||||||
| import com.sczx.order.common.constant.RedisKeyConstants; | import com.sczx.order.common.constant.RedisKeyConstants; | ||||||
| import com.sczx.order.common.enums.*; | import com.sczx.order.common.enums.*; | ||||||
| import com.sczx.order.convert.OrderCarImgConvert; | import com.sczx.order.convert.OrderCarImgConvert; | ||||||
| @ -22,8 +15,13 @@ import com.sczx.order.po.*; | |||||||
| import com.sczx.order.repository.*; | import com.sczx.order.repository.*; | ||||||
| import com.sczx.order.service.*; | import com.sczx.order.service.*; | ||||||
| import com.sczx.order.thirdpart.dto.*; | import com.sczx.order.thirdpart.dto.*; | ||||||
| import com.sczx.order.thirdpart.dto.req.*; | import com.sczx.order.thirdpart.dto.req.AlipayCloseRequest; | ||||||
| import com.sczx.order.thirdpart.integration.*; | import com.sczx.order.thirdpart.dto.req.AlipayQueryFreezeRequest; | ||||||
|  | import com.sczx.order.thirdpart.dto.req.CarQueryConditionReq; | ||||||
|  | import com.sczx.order.thirdpart.integration.CarInteg; | ||||||
|  | import com.sczx.order.thirdpart.integration.PayInteg; | ||||||
|  | import com.sczx.order.thirdpart.integration.StoreInteg; | ||||||
|  | import com.sczx.order.thirdpart.integration.SyncInteg; | ||||||
| import com.sczx.order.utils.JwtUtil; | import com.sczx.order.utils.JwtUtil; | ||||||
| import com.sczx.order.utils.OrderUtil; | import com.sczx.order.utils.OrderUtil; | ||||||
| import com.sczx.order.utils.RedisUtil; | import com.sczx.order.utils.RedisUtil; | ||||||
| @ -38,7 +36,6 @@ import org.springframework.util.CollectionUtils; | |||||||
| import java.math.BigDecimal; | import java.math.BigDecimal; | ||||||
| import java.time.LocalDateTime; | import java.time.LocalDateTime; | ||||||
| import java.util.*; | import java.util.*; | ||||||
| import java.util.concurrent.atomic.AtomicReference; |  | ||||||
| import java.util.stream.Collectors; | import java.util.stream.Collectors; | ||||||
|  |  | ||||||
| @Slf4j | @Slf4j | ||||||
| @ -108,116 +105,10 @@ public class OrderServiceImpl implements OrderService { | |||||||
|     public RentCarOrderResultDTO verifyGroupBuyCoupons(VerifyGroupBuyCouponsReq req){ |     public RentCarOrderResultDTO verifyGroupBuyCoupons(VerifyGroupBuyCouponsReq req){ | ||||||
|         //校验用户是否存在,是否实名认证 |         //校验用户是否存在,是否实名认证 | ||||||
|         SimpleUserInfoDTO  userInfoDTO = groupBuyCouponService.getGroupBuyOrderInfoDto(req.getMobile()); |         SimpleUserInfoDTO  userInfoDTO = groupBuyCouponService.getGroupBuyOrderInfoDto(req.getMobile()); | ||||||
|  |         //获取三方平台订单信息 | ||||||
|         RentCarThirdPlatformOrderReq thirdRentCarOrder = new RentCarThirdPlatformOrderReq(); |         RentCarThirdPlatformOrderReq thirdRentCarOrder = groupBuyCouponService.getThirdPlatformOrder(userInfoDTO, req); | ||||||
|         Map<String, String> productIdMap = new HashMap<>(); |         //生成订单 | ||||||
|  |         return thirdPlatformRentCarOrder(thirdRentCarOrder); | ||||||
|         if (req.getCouponType() == CouponTypeEnum.MT.getCode()){ |  | ||||||
|             //TODO 调用美团验券接口 |  | ||||||
|             //美团验券 |  | ||||||
|             MeituanResponse<TuangouReceiptPrepareResponse> prepareResponse =meiTuanService.prepare( req); |  | ||||||
|             String phone = prepareResponse.getData().getMobile(); |  | ||||||
|             if (phone != null && !phone.isEmpty()){ |  | ||||||
|                 if (!comparePhoneNumbers(phone, req.getMobile())){ |  | ||||||
|                     throw new BizException("所提供的手机号码与团购手机号不一致"); |  | ||||||
|                 } |  | ||||||
|             } |  | ||||||
|             //使用输入的手机号进行后续操作 |  | ||||||
|             //核销团购券 |  | ||||||
|             MeituanResponse<TuangouReceiptConsumeResponse> consumeResponse =meiTuanService.consume( req); |  | ||||||
|             consumeResponse.getData().getResult().forEach(result -> { |  | ||||||
|                 productIdMap.put("mtOrderId",String.valueOf(result.getDealId())); |  | ||||||
|                 productIdMap.put("mtProductId",  String.valueOf(result.getDealGroupId())); |  | ||||||
|             }); |  | ||||||
|  |  | ||||||
|  |  | ||||||
|             //生成第三方订单 |  | ||||||
|             CarModelPackageDTO carModelPackageDTO = carInteg.getCarModelPackageByThireId(productIdMap.get("mtProductId"),null); |  | ||||||
|             if (carModelPackageDTO == null){ |  | ||||||
|                 throw new BizException("无此对应团购套餐"); |  | ||||||
|             } |  | ||||||
|  |  | ||||||
|             thirdRentCarOrder.setCarModelId(carModelPackageDTO.getCarModelId()); |  | ||||||
|             thirdRentCarOrder.setRentCarRuleId(carModelPackageDTO.getCarRuleId()); |  | ||||||
|             thirdRentCarOrder.setCustomerId(userInfoDTO.getUserId().longValue()); |  | ||||||
|             thirdRentCarOrder.setStoreId(req.getStoreId()); |  | ||||||
|             thirdRentCarOrder.setOrderSource(CouponTypeEnum.MT.getCode()); |  | ||||||
|             thirdRentCarOrder.setCustomerName(userInfoDTO.getUserName()); |  | ||||||
|             thirdRentCarOrder.setCustomerPhone(userInfoDTO.getPhoneNumber()); |  | ||||||
|             thirdRentCarOrder.setThirdOrderNo(productIdMap.get("mtOrderId")); |  | ||||||
|             thirdRentCarOrder.setCouponCode(req.getCouponCode()); |  | ||||||
|             thirdRentCarOrder.setRentBatteyRuleId(carModelPackageDTO.getBatteyRuleId()); |  | ||||||
|  |  | ||||||
|             RentCarOrderResultDTO rentCarOrderResultDTO = thirdPlatformRentCarOrder(thirdRentCarOrder); |  | ||||||
|             return rentCarOrderResultDTO; |  | ||||||
|  |  | ||||||
|         }else if (req.getCouponType() == CouponTypeEnum.DY.getCode()){ |  | ||||||
|  |  | ||||||
|             //根据门店ID获取抖音门店ID |  | ||||||
|             CompanyStoreDTO store = storeInteg.getStoreById(req.getStoreId().intValue()); |  | ||||||
|             String poiId = store.getDyStoreId(); |  | ||||||
|  |  | ||||||
|             //调用抖音验券接口 |  | ||||||
|             CertificatePrepareRequest prepareRequest = new CertificatePrepareRequest(); |  | ||||||
|  |  | ||||||
|             prepareRequest.setPoiId(poiId); |  | ||||||
|             prepareRequest.setEncryptedData(req.getCouponCode()); |  | ||||||
|  |  | ||||||
|             CertificatePrepareResponse response =douyinService.prepare(prepareRequest); |  | ||||||
|             //获取核销所需信息 |  | ||||||
|             String verifyToken = response.getData().getVerifyToken(); |  | ||||||
|             AtomicReference<String> phone = new AtomicReference<>(""); |  | ||||||
|             response.getData().getCertificates().forEach(certificate -> { |  | ||||||
|                 productIdMap.put("dyOrderId",String.valueOf(certificate.getCertificateId())); |  | ||||||
|                 productIdMap.put("dyProductId",  String.valueOf(certificate.getSku().getSkuId())); |  | ||||||
|                 certificate.getReserveInfo().getOrderReserveUserInfoList().forEach(orderReserveUserInfo -> { |  | ||||||
|                     phone.set(orderReserveUserInfo.getPhone()); |  | ||||||
|                 }); |  | ||||||
|             }); |  | ||||||
|  |  | ||||||
|             String finalPhone = phone.get(); |  | ||||||
|  |  | ||||||
|             if (finalPhone != null && !finalPhone.isEmpty()) { |  | ||||||
|                 if (!comparePhoneNumbers(finalPhone, req.getMobile())){ |  | ||||||
|                     throw new BizException("所提供的手机号码与团购手机号不一致"); |  | ||||||
|                 } |  | ||||||
|             } |  | ||||||
|  |  | ||||||
|             //核销抖音团购券 |  | ||||||
|             CertificateVerifyRequest verifyRequest = new CertificateVerifyRequest(); |  | ||||||
|             verifyRequest.setVerifyToken(verifyToken); |  | ||||||
|             verifyRequest.setPoiId(poiId); |  | ||||||
|  |  | ||||||
|             CertificateVerifyResponse verifyResponse =douyinService.verify(verifyRequest); |  | ||||||
|  |  | ||||||
|             verifyResponse.getData().getVerifyResults().forEach(verifyResult -> { |  | ||||||
|                 //撤销验券需要下面两个值 |  | ||||||
|                 productIdMap.put("dyCertificateId",verifyResult.getCertificateId()); |  | ||||||
|                 productIdMap.put("dyVerifyId",verifyResult.getVerifyId()); |  | ||||||
|             }); |  | ||||||
|  |  | ||||||
|             //TODO  生成订单 |  | ||||||
|             //生成第三方订单 |  | ||||||
|             CarModelPackageDTO carModelPackageDTO = carInteg.getCarModelPackageByThireId(null,productIdMap.get("dyProductId")); |  | ||||||
|             if (carModelPackageDTO == null){ |  | ||||||
|                 throw new BizException("无此对应团购套餐"); |  | ||||||
|             } |  | ||||||
|             thirdRentCarOrder.setCarModelId(carModelPackageDTO.getCarModelId()); |  | ||||||
|             thirdRentCarOrder.setRentCarRuleId(carModelPackageDTO.getCarRuleId()); |  | ||||||
|             thirdRentCarOrder.setCustomerId(userInfoDTO.getUserId().longValue()); |  | ||||||
|             thirdRentCarOrder.setStoreId(req.getStoreId()); |  | ||||||
|             thirdRentCarOrder.setOrderSource(CouponTypeEnum.DY.getCode()); |  | ||||||
|             thirdRentCarOrder.setCustomerName(userInfoDTO.getUserName()); |  | ||||||
|             thirdRentCarOrder.setCustomerPhone(userInfoDTO.getPhoneNumber()); |  | ||||||
|             thirdRentCarOrder.setThirdOrderNo(productIdMap.get("dyCertificateId")); |  | ||||||
|             thirdRentCarOrder.setCouponCode(productIdMap.get("dyVerifyId")); |  | ||||||
|             thirdRentCarOrder.setRentBatteyRuleId(carModelPackageDTO.getBatteyRuleId()); |  | ||||||
|  |  | ||||||
|             RentCarOrderResultDTO rentCarOrderResultDTO = thirdPlatformRentCarOrder(thirdRentCarOrder); |  | ||||||
|  |  | ||||||
|             return rentCarOrderResultDTO; |  | ||||||
|         } |  | ||||||
|         throw new BizException("券码类型错误"); |  | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     public boolean comparePhoneNumbers(String maskedPhone, String actualPhone) { |     public boolean comparePhoneNumbers(String maskedPhone, String actualPhone) { | ||||||
| @ -1384,12 +1275,6 @@ public class OrderServiceImpl implements OrderService { | |||||||
|                     .eq(OrderSubPO::getPayStatus, PayStatusEnum.SUCCESS).last(" limit 1"); |                     .eq(OrderSubPO::getPayStatus, PayStatusEnum.SUCCESS).last(" limit 1"); | ||||||
|             OrderSubPO orderSubPO = orderSubRepo.getOne(orderSubWrapper); |             OrderSubPO orderSubPO = orderSubRepo.getOne(orderSubWrapper); | ||||||
|  |  | ||||||
|             if(orderSubPO.getPaymentMethod().equals(PaymentTypeEnum.MT.getCode())){ |  | ||||||
|                 meiTuanService.reverseconsume(orderMainPO.getStoreId().intValue(), orderSubPO.getPaymentId(), orderSubPO.getTransactionId()); |  | ||||||
|             }else if (orderSubPO.getPaymentMethod().equals(PaymentTypeEnum.DY.getCode())){ |  | ||||||
|                 douyinService.cancel(orderSubPO.getTransactionId(), orderSubPO.getPaymentId()); |  | ||||||
|             } |  | ||||||
|  |  | ||||||
|             //异步退款订单 |             //异步退款订单 | ||||||
|             ThreadPoolUtils.getThreadPool().execute(() -> { |             ThreadPoolUtils.getThreadPool().execute(() -> { | ||||||
|                 //变更订单状态,记录结束订单时间,记录订单备注 |                 //变更订单状态,记录结束订单时间,记录订单备注 | ||||||
| @ -1400,6 +1285,11 @@ public class OrderServiceImpl implements OrderService { | |||||||
|                 updateWrapper.eq(OrderMainPO::getOrderNo, rejectOrderReq.getOrderNo()); |                 updateWrapper.eq(OrderMainPO::getOrderNo, rejectOrderReq.getOrderNo()); | ||||||
|                 orderMainRepo.update(updateWrapper); |                 orderMainRepo.update(updateWrapper); | ||||||
|                 if (Objects.nonNull(orderSubPO)) { |                 if (Objects.nonNull(orderSubPO)) { | ||||||
|  |                     if(orderSubPO.getPaymentMethod().equals(PaymentTypeEnum.MT.getCode())){ | ||||||
|  |                         meiTuanService.reverseconsume(orderMainPO.getStoreId().intValue(), orderSubPO.getPaymentId(), orderSubPO.getTransactionId()); | ||||||
|  |                     }else if (orderSubPO.getPaymentMethod().equals(PaymentTypeEnum.DY.getCode())){ | ||||||
|  |                         douyinService.cancel(orderSubPO.getTransactionId(), orderSubPO.getPaymentId()); | ||||||
|  |                     } else { | ||||||
|                         //退款调用成功则添加退款子订单 |                         //退款调用成功则添加退款子订单 | ||||||
|                         String outRefundNo = payService.refundOrder(orderSubPO.getPaymentMethod(), orderMainPO.getOperatorId(), orderSubPO.getPaymentId(), orderMainPO.getOrderAmount(), orderMainPO.getOrderAmount()); |                         String outRefundNo = payService.refundOrder(orderSubPO.getPaymentMethod(), orderMainPO.getOperatorId(), orderSubPO.getPaymentId(), orderMainPO.getOrderAmount(), orderMainPO.getOrderAmount()); | ||||||
|                         if (StringUtils.isNotBlank(outRefundNo)) { |                         if (StringUtils.isNotBlank(outRefundNo)) { | ||||||
| @ -1417,6 +1307,7 @@ public class OrderServiceImpl implements OrderService { | |||||||
|                             orderSubRepo.save(fdSubOrder); |                             orderSubRepo.save(fdSubOrder); | ||||||
|                         } |                         } | ||||||
|                     } |                     } | ||||||
|  |                 } | ||||||
|  |  | ||||||
|                 LambdaQueryWrapper<OrderSubPO> noDipoSubWrapper = new LambdaQueryWrapper<>(); |                 LambdaQueryWrapper<OrderSubPO> noDipoSubWrapper = new LambdaQueryWrapper<>(); | ||||||
|                 noDipoSubWrapper.eq(OrderSubPO::getOrderId, orderMainPO.getOrderId()) |                 noDipoSubWrapper.eq(OrderSubPO::getOrderId, orderMainPO.getOrderId()) | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user