Commit 1ddbb4b1 by ping.wu

可能空指针的代码修复,查询小程序配送配置删除,蜜雪定制代码删除

parent eb50901b
......@@ -547,8 +547,8 @@ public class OrderAdapter {
} else if (Objects.equals(createOrderVo.getOrderType(), OrderType.MALL.getCode())) {
orderType = OrderType.MALL.getCode();
receiveAddress = (userDeliveryInfoDto != null ? userDeliveryInfoDto.getReceiveProvince() + userDeliveryInfoDto.getReceiveCity() + userDeliveryInfoDto.getReceiveRegion() + userDeliveryInfoDto.getReceiveAddress() : "");
createOrderVo.setMobile(userDeliveryInfoDto.getReceiveMobile());
createOrderVo.setContactsName(userDeliveryInfoDto.getReceiveUserName());
createOrderVo.setMobile(userDeliveryInfoDto != null ? userDeliveryInfoDto.getReceiveMobile() : "");
createOrderVo.setContactsName(userDeliveryInfoDto != null ? userDeliveryInfoDto.getReceiveUserName() : "");
} else {
throw new ServiceException(ResponseResult.PARAMETER_MISSING, "非法的订单类型");
}
......
......@@ -32,6 +32,7 @@ import cn.freemud.entities.vo.CreateOrderVo;
import cn.freemud.entities.vo.GetMemberCouponRequestVo;
import cn.freemud.entities.vo.SellCouponCreateOrderVo;
import cn.freemud.entities.vo.ShoppingCartInfoRequestVo;
import cn.freemud.entities.vo.order.CreateOrderCouponCodeVo;
import cn.freemud.enums.*;
import cn.freemud.interceptor.ServiceException;
import cn.freemud.service.CouponService;
......@@ -368,13 +369,13 @@ public class CheckOrder {
}
// 校验小程序是否支持到店或者外卖
String appId = userLoginInfoDto.getWxAppId();
AssortmentOpenPlatformIappWxappConfig config = openPlatformIappWxappConfigManager.selectIappWxappConfigByWxAppId(appId);
// AssortmentOpenPlatformIappWxappConfig config = openPlatformIappWxappConfigManager.selectIappWxappConfigByWxAppId(appId);
// 自提校验
BusinessInfoDto businessInfoDto = storeMixResponseDto.getBusinessInfo();
if (CreateOrderType.COLLECT_GOODS.getCode().equals(createOrderVo.getOrderType())) {
if (config == null || config.getTakeInside() == null || config.getTakeInside() != 1) {
throw new ServiceException(ResponseResult.ORDER_WXAPP_NOT_ENABLE_COLLECT_GOODS);
}
// if (config == null || config.getTakeInside() == null || config.getTakeInside() != 1) {
// throw new ServiceException(ResponseResult.ORDER_WXAPP_NOT_ENABLE_COLLECT_GOODS);
// }
if (storeResponseDto.getIsSelfMention() == null || storeResponseDto.getIsSelfMention() != 1) {
throw new ServiceException(ResponseResult.STORE_NOT_ENABLE_COLLECT_GOODS);
}
......@@ -417,9 +418,9 @@ public class CheckOrder {
// 校验外卖信息
if (CreateOrderType.TAKE_OUT.getCode().equals(createOrderVo.getOrderType())) {
if (config == null || config.getTakeaway() == null || config.getTakeaway() == 0) {
throw new ServiceException(ResponseResult.STORE_ITEM_NOT_DELIVERY);
}
// if (config == null || config.getTakeaway() == null || config.getTakeaway() == 0) {
// throw new ServiceException(ResponseResult.STORE_ITEM_NOT_DELIVERY);
// }
if (storeResponseDto.getDelivery() == null || storeResponseDto.getDelivery() == 2) {
throw new ServiceException(ResponseResult.STORE_ITEM_NOT_DELIVERY);
}
......@@ -427,7 +428,7 @@ public class CheckOrder {
throw new ServiceException(ResponseResult.STORE_ITEM_NOT_DELIVERY);
}
//获取门店配送信息
StoreDeliveryInfoDto storeDeliveryInfoDto = getNewStoreDeliveryInfo(storeResponseDto, config);
StoreDeliveryInfoDto storeDeliveryInfoDto = getNewStoreDeliveryInfo(storeResponseDto);
//coco自配送提前45分钟,禁止下单 代码已删除
//外卖起送条件(1:杯数,2:金额)
if (!Arrays.asList(1, 2).contains(storeDeliveryInfoDto.getDeliveryCondition())) {
......@@ -698,8 +699,9 @@ public class CheckOrder {
// buyMemberCard.setPaidId(createOrderVo.getBuyMemberCard().getPaidId());
// buyMemberCard.setRuleId(createOrderVo.getBuyMemberCard().getRuleId());
// }
String partnerId = createOrderVo.getPartnerId();
ShoppingCartInfoRequestVo shoppingCartInfoRequestVo = ShoppingCartInfoRequestVo.builder()
.partnerId(createOrderVo.getPartnerId())
.partnerId(partnerId)
.shopId(createOrderVo.getShopId())
.version(createOrderVo.getVersion())
.sessionId(createOrderVo.getSessionId())
......@@ -716,57 +718,71 @@ public class CheckOrder {
.bizType(createOrderVo.getBizType())
.build();
// 如果使用优惠券或者商品券,校验 couponCode
// if (StringUtils.isNotBlank(createOrderVo.getCouponCode())) {
// // 校验couponCode
// GetCouponDetailResponseDto getCouponDetailResponseDto = couponService.getMemberCoupon(GetMemberCouponRequestVo.builder()
// .partnerId(createOrderVo.getPartnerId())
// .couponCode(createOrderVo.getCouponCode()).build());
// if (Objects.equals(getCouponDetailResponseDto, null) || CollectionUtils.isEmpty(getCouponDetailResponseDto.getDetails())
// || getCouponDetailResponseDto.getDetails().get(0).getActive() == null
// || getCouponDetailResponseDto.getDetails().get(0).getActive().getActiveCode() == null) {
// // 返回信息为空
// throw new ServiceException(ResponseResult.COUPON_GETINFO_INVAILD);
// }
// List<GetCouponDetailResponseDto.ActiveRedeemTimeInterval> activeRedeemTimeIntervalList = getCouponDetailResponseDto.getDetails().get(0).getActiveRedeemTimeIntervalList();
// checkCouonRedeemTime(activeRedeemTimeIntervalList);
// String activeCode = getCouponDetailResponseDto.getDetails().get(0).getActive().getActiveCode();
// // 校验点餐方式,查询购物车接口内部已校验
// shoppingCartInfoRequestVo.setCouponCode(createOrderVo.getCouponCode());
// // 活动code
// shoppingCartInfoRequestVo.setActivityCode(activeCode);
// shoppingCartInfoRequestVo.setCardCode(createOrderVo.getCardCode());
// }
Set<String> codes = new HashSet<>();
if (StringUtils.isNotBlank(createOrderVo.getCouponCode())) {
codes.add(createOrderVo.getCouponCode());
}
if (CollectionUtils.isNotEmpty(createOrderVo.getCouponCodes())) {
for (CreateOrderCouponCodeVo createOrderCouponCodeVo : createOrderVo.getCouponCodes()){
codes.add(createOrderCouponCodeVo.getCouponCode());
}
}
// 如果批量使用优惠券或者商品券,校验 couponCode
List<ShoppingCartInfoRequestVo.couponCode> couponCodes = new ArrayList();
if (CollectionUtils.isNotEmpty(codes)) {
StringBuilder queryCodes = new StringBuilder();
for (String code : codes){
queryCodes = queryCodes.append(code).append(",");
}
// 校验couponCode
GetCouponDetailResponseDto getCouponDetailResponseDto = couponService.getMemberCoupon(GetMemberCouponRequestVo.builder()
.partnerId(createOrderVo.getPartnerId())
.couponCode(createOrderVo.getCouponCode()).build());
.partnerId(partnerId)
.couponCode(queryCodes.toString()).build());
if (Objects.equals(getCouponDetailResponseDto, null) || CollectionUtils.isEmpty(getCouponDetailResponseDto.getDetails())
|| getCouponDetailResponseDto.getDetails().get(0).getActive() == null
|| getCouponDetailResponseDto.getDetails().get(0).getActive().getActiveCode() == null) {
// 返回信息为空
throw new ServiceException(ResponseResult.COUPON_GETINFO_INVAILD);
}
List<GetCouponDetailResponseDto.ActiveRedeemTimeInterval> activeRedeemTimeIntervalList = getCouponDetailResponseDto.getDetails().get(0).getActiveRedeemTimeIntervalList();
checkCouonRedeemTime(activeRedeemTimeIntervalList);
String activeCode = getCouponDetailResponseDto.getDetails().get(0).getActive().getActiveCode();
// 校验点餐方式,查询购物车接口内部已校验
shoppingCartInfoRequestVo.setCouponCode(createOrderVo.getCouponCode());
// 活动code
shoppingCartInfoRequestVo.setActivityCode(activeCode);
shoppingCartInfoRequestVo.setCardCode(createOrderVo.getCardCode());
}
// 如果批量使用优惠券或者商品券,校验 couponCode
List<ShoppingCartInfoRequestVo.couponCode> couponCodes = new ArrayList();
if (createOrderVo.getCouponCodes() != null && !createOrderVo.getCouponCodes().isEmpty()) {
createOrderVo.getCouponCodes().forEach(couponCode -> {
// 校验couponCode
GetCouponDetailResponseDto getCouponDetailResponseDto = couponService.getMemberCoupon(GetMemberCouponRequestVo.builder()
.partnerId(createOrderVo.getPartnerId())
.couponCode(couponCode.getCouponCode()).build());
if (Objects.equals(getCouponDetailResponseDto, null) || CollectionUtils.isEmpty(getCouponDetailResponseDto.getDetails())
|| getCouponDetailResponseDto.getDetails().get(0).getActive() == null
|| getCouponDetailResponseDto.getDetails().get(0).getActive().getActiveCode() == null) {
// 返回信息为空
throw new ServiceException(ResponseResult.COUPON_GETINFO_INVAILD);
}
String activeCode = getCouponDetailResponseDto.getDetails().get(0).getActive().getActiveCode();
if(codes.size() != getCouponDetailResponseDto.getDetails().size()){
throw new ServiceException(ResponseResult.COUPON_QUERY_ERROR);
}
int i = 1;
for (GetCouponDetailResponseDto.Details details : getCouponDetailResponseDto.getDetails()){
ShoppingCartInfoRequestVo.couponCode coupon = new ShoppingCartInfoRequestVo.couponCode();
coupon.setCouponCode(couponCode.getCouponCode());
coupon.setActivityCode(activeCode);
coupon.setIndex(couponCode.getIndex());
coupon.setCouponType(getCouponDetailResponseDto.getDetails().get(0).getType());
coupon.setCouponCode(details.getCode());
coupon.setActivityCode(details.getActive().getActiveCode());
coupon.setIndex(i);
i = i+1;
coupon.setCouponType(details.getType());
couponCodes.add(coupon);
});
if (StringUtils.isEmpty(shoppingCartInfoRequestVo.getCardCode())) {
shoppingCartInfoRequestVo.setCardCode(createOrderVo.getCardCode());
}
}
shoppingCartInfoRequestVo.setCouponCodes(couponCodes);
if (StringUtils.isEmpty(shoppingCartInfoRequestVo.getCardCode())) {
shoppingCartInfoRequestVo.setCardCode(createOrderVo.getCardCode());
}
// 通过购物车获取优惠信息
GetShoppingCartGoodsApportionDto requestDto = new GetShoppingCartGoodsApportionDto();
// 设置用户选择的买一赠一商品信息
......@@ -944,8 +960,7 @@ public class CheckOrder {
/**
* 获取门店配送信息
*/
public StoreDeliveryInfoDto getNewStoreDeliveryInfo(StoreResponseDto storeResponseDto,
AssortmentOpenPlatformIappWxappConfig openPlatformIappWxappConfig) {
public StoreDeliveryInfoDto getNewStoreDeliveryInfo(StoreResponseDto storeResponseDto) {
String trackingNo = LogThreadLocal.getTrackingNo();
StoreDeliveryInfoDto storeDeliveryInfoDto = new StoreDeliveryInfoDto();
storeDeliveryInfoDto.setPartnerId(storeResponseDto.getPartnerId());
......@@ -980,10 +995,12 @@ public class CheckOrder {
// if (openPlatformIappWxappConfig == null) {
// openPlatformIappWxappConfig = openPlatformIappWxappConfigManager.selectIappWxappConfigByWxAppId(wxAppid);
// }
if (openPlatformIappWxappConfig == null) {
storeDeliveryInfoDto.setDeliveryType("self");
storeDeliveryInfoDto.setPushOrderTime(0);
} else {
storeDeliveryInfoDto.setDeliveryType("self");
storeDeliveryInfoDto.setPushOrderTime(0);
// if (openPlatformIappWxappConfig == null) {
// storeDeliveryInfoDto.setDeliveryType("self");
// storeDeliveryInfoDto.setPushOrderTime(0);
// } else {
//如果是coco查询配送服务判断是平台配送还是自配送
// if (cocoPartnerId.equals(storeResponseDto.getPartnerId())) {
// GetDeliveryFlagRequest getDeliveryFlagRequest = new GetDeliveryFlagRequest();
......@@ -998,15 +1015,15 @@ public class CheckOrder {
// storeDeliveryInfoDto.setPushOrderTime(0);
// }
// } else {
if (ObjectUtils.equals(openPlatformIappWxappConfig.getTakeType(), 1)) {
storeDeliveryInfoDto.setDeliveryType("self");
storeDeliveryInfoDto.setPushOrderTime(0);
} else {
storeDeliveryInfoDto.setDeliveryType("third");
storeDeliveryInfoDto.setPushOrderTime(0);
}
// if (ObjectUtils.equals(openPlatformIappWxappConfig.getTakeType(), 1)) {
// storeDeliveryInfoDto.setDeliveryType("self");
// storeDeliveryInfoDto.setPushOrderTime(0);
// } else {
// storeDeliveryInfoDto.setDeliveryType("third");
// storeDeliveryInfoDto.setPushOrderTime(0);
// }
// }
}
// }
storeDeliveryInfoDto.setDeliveryCondition(deliveryDetail.getDeliveryType());
storeDeliveryInfoDto.setFreeDeliveryCup(deliveryDetail.getFreeDeliveryCup());
return storeDeliveryInfoDto;
......
......@@ -250,10 +250,10 @@ public class PayServiceImpl {
AssortmentOpenPlatformWxapp wxApp = openPlatformWxappManager.findByPartnerIdAndWxappId(partnerId, wxAppId);
paymentRequest.setPrincipalName(wxApp.getPrincipalName());
// fisherman 2227 测试商户号, 下个版本需要删除
if ("2080".equals(partnerId)) {
//【ID1035981】【蜜雪冰城】订单C端,拼接order_body字段:蜜雪冰城+门店编号
paymentRequest.setPrincipalName("蜜雪冰城" + orderBean.getShopId() + "店");
}
// if ("2080".equals(partnerId)) {
// //【ID1035981】【蜜雪冰城】订单C端,拼接order_body字段:蜜雪冰城+门店编号
// paymentRequest.setPrincipalName("蜜雪冰城" + orderBean.getShopId() + "店");
// }
paymentRequest.setReverseNotifyiDcUrl(reverseNotifyiDcUrl);
//修改订单信息
OrderExtInfoDto orderExtInfoDto = JSONObject.parseObject(orderBean.getExtInfo(), OrderExtInfoDto.class) == null ? new OrderExtInfoDto() : JSONObject.parseObject(orderBean.getExtInfo(), OrderExtInfoDto.class);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment