Commit 95022bda by hanghang.wang

华莱士

parent 04305ea3
......@@ -10,6 +10,8 @@ import com.freemud.api.assortment.datamanager.entity.vo.AssortmentCustomerInfoVo
import com.freemud.application.sdk.api.membercenter.response.QueryReceiveAddressResponse;
import com.freemud.application.sdk.api.ordercenter.enums.OrderClientType;
import com.freemud.application.sdk.api.ordercenter.enums.PayChannelType;
import com.freemud.application.sdk.api.ordercenter.request.OrderExtInfoDto;
import com.freemud.application.sdk.api.ordercenter.request.OrderExtendedReq;
import com.freemud.application.sdk.api.ordercenter.request.create.*;
import com.freemud.application.sdk.api.promotioncenter.request.promotion.ActivityUpdateStockRequest;
import com.freemud.application.sdk.api.storecenter.response.StoreResponse;
......@@ -74,7 +76,9 @@ public class SpellGroupOrderAdapter {
createOrderRequest.setOperator(userLoginInfoDto.getNickName());
createOrderRequest.setAppId(userLoginInfoDto.getAppId());
createOrderRequest.setPayChannelType(createSpellGroupOrderDto.getPayChannelType());
createOrderRequest.getOrderExtended().setSpellGroupCode(createSpellGroupOrderDto.getSpellGroupCode());
OrderExtendedReq orderExtendedReq = new OrderExtendedReq();
orderExtendedReq.setStoreNameEn(storeInfo.getStoreNameEn());
orderExtendedReq.setSpellGroupCode(createSpellGroupOrderDto.getSpellGroupCode());
/**
* 处理商品优惠信息 OrderItemCreateReq
......@@ -97,7 +101,9 @@ public class SpellGroupOrderAdapter {
orderCostCreateReq.setBillType(1);
orderCostCreateReq.setProductId(productInfo.getPid());
orderCostCreateReq.setNote("快递费用备注");
createOrderRequest.getOrderCostDetailList().add(orderCostCreateReq);
List<OrderCostCreateReq> orderCostCreateReqList = new ArrayList<>();
orderCostCreateReqList.add(orderCostCreateReq);
createOrderRequest.setOrderCostDetailList(orderCostCreateReqList);
/**
* 处理结算信息
*/
......@@ -108,7 +114,9 @@ public class SpellGroupOrderAdapter {
orderSettlementCreateReq.setNumber(1);
orderSettlementCreateReq.setShopAmount(goods.getRealAmount());
orderSettlementCreateReq.setIsOnline(true);
createOrderRequest.getOrderSettlementDetailList().add(orderSettlementCreateReq);
List<OrderSettlementCreateReq> orderSettlementCreateReqList = new ArrayList<>();
orderSettlementCreateReqList.add(orderSettlementCreateReq);
createOrderRequest.setOrderSettlementDetailList(orderSettlementCreateReqList);
/**
* 处理快递信息
*/
......@@ -139,7 +147,7 @@ public class SpellGroupOrderAdapter {
});
calculationDiscountRequestDto.setGoods(discountGoodsDtoList);
calculationDiscountRequestDto.setGroupActivityCode(createSpellGroupOrderDto.getSpellGroupCode());
// calculationDiscountRequestDto.setVer();
calculationDiscountRequestDto.setVer(1);
return calculationDiscountRequestDto;
}
......@@ -152,13 +160,14 @@ public class SpellGroupOrderAdapter {
requestDto.setOpenId(userLoginInfoDto.getOpenId());
requestDto.setTotalAmount(data.getActualPayAmount().longValue());
requestDto.setCardAmount(0);
requestDto.setOrderExtInfoDTO(null);
requestDto.setOrderExtInfoDTO(new OrderExtInfoDto());
requestDto.setTransId(data.getOid());
requestDto.setOrderClient(OrderClientType.getOrderClientType(Integer.valueOf(data.getOrderClient())));
requestDto.setProductOrderBean(data);
requestDto.setFatherOrderBean(data);
requestDto.setStoreId(data.getShopId());
requestDto.setChannel("");
return requestDto;
}
......@@ -187,7 +196,9 @@ public class SpellGroupOrderAdapter {
orderItemCreateReq.setOpenId(userLoginInfoDto.getOpenId());
orderItemCreateReq.setNickName(userLoginInfoDto.getNickName());
orderItemCreateReq.setPhotoUrl(userLoginInfoDto.getPhotoUrl());
createOrderRequest.getOrderItemList().add(orderItemCreateReq);
List<OrderItemCreateReq> orderItemList = new ArrayList<>();
orderItemList.add(orderItemCreateReq);
createOrderRequest.setOrderItemList(orderItemList);
}
public ActivityUpdateStockRequest convert2ActivityUpdateStockRequest(QueryOrdersResponse.DataBean.OrderBean orderBean, CreateSpellGroupOrderDto createSpellGroupOrderDto) {
......@@ -216,13 +227,20 @@ public class SpellGroupOrderAdapter {
public void convertToReceiveAddress(QueryReceiveAddressResponse receiveAddressResult, CreateSpellGroupOrderDto createSpellGroupOrderDto) {
DeliveryContactInfoCreateReq deliveryContactInfoCreateReq = new DeliveryContactInfoCreateReq();
deliveryContactInfoCreateReq.setRelateObjectType(1);
deliveryContactInfoCreateReq.setAddressDetail(receiveAddressResult.getReceiveAddress());
// deliveryContactInfoCreateReq.setAddressDetail(receiveAddressResult.getReceiveAddress());
deliveryContactInfoCreateReq.setAddressDetail("receiveAddressResult.getReceiveAddress()");
deliveryContactInfoCreateReq.setInfoType(1);
deliveryContactInfoCreateReq.setLatitude(new BigDecimal(receiveAddressResult.getLatitude()));
deliveryContactInfoCreateReq.setLongitude(new BigDecimal(receiveAddressResult.getLongitude()));
deliveryContactInfoCreateReq.setMobile(StringUtils.isEmpty(receiveAddressResult.getMobile()) ? receiveAddressResult.getReceiveMobile() : receiveAddressResult.getMobile());
deliveryContactInfoCreateReq.setContactsName(receiveAddressResult.getReceiveName());
createSpellGroupOrderDto.getDeliveryContactInfoCreateReqList().add(deliveryContactInfoCreateReq);
// deliveryContactInfoCreateReq.setLatitude(new BigDecimal(receiveAddressResult.getLatitude()));
// deliveryContactInfoCreateReq.setLongitude(new BigDecimal(receiveAddressResult.getLongitude()));
// deliveryContactInfoCreateReq.setMobile(StringUtils.isEmpty(receiveAddressResult.getMobile()) ? receiveAddressResult.getReceiveMobile() : receiveAddressResult.getMobile());
deliveryContactInfoCreateReq.setMobile("18516602251");
// deliveryContactInfoCreateReq.setContactsName(receiveAddressResult.getReceiveName());
deliveryContactInfoCreateReq.setContactsName("receiveAddressResult.getReceiveName()");
List<DeliveryContactInfoCreateReq> list = new ArrayList<>();
list.add(deliveryContactInfoCreateReq);
createSpellGroupOrderDto.setDeliveryContactInfoCreateReqList(list);
}
}
......@@ -82,6 +82,11 @@ public class CreateSpellGroupOrderReq {
private String orderRemark;
/**
* 城市编号。用于查询配送费
*/
private String cityCode;
/**
* 拼团商品
*/
@Data
......
......@@ -242,6 +242,11 @@ public enum ResponseResult {
SPELL_GROUP_THE_CLUB_IS_FULL("80001", "拼团已满员"),
SPELL_GROUP_CREAT_ORDER_ERROR("80002", "创建拼团订单失败"),
SPELL_GROUP_ACTIVITE_AMOUNT_ERROR("80003", "返回的价格是商品原价,则表示库存不足或者活动关闭"),
SPELL_GROUP_QUERY_ORDER_RECEIVE_ADDRESS_ERROR("80004", "获取地址信息异常"),
SPELL_GROUP_QUERY_PRODUCT_INFOS_ERROR("80005", "获取商品信息异常"),
SPELL_GROUP_QUERY_CALCULATION_DISCOUNT_ERROR("80006", "获取算价信息异常"),
;
......
......@@ -56,7 +56,11 @@ public class SpellGroupOrderDataManager {
public StoreResponse getStoreInfo(String partnerId, String shopId, String trackingNo) {
// 获取门店信息
StoreInfoRequest storeInfoRequest = new StoreInfoRequest(partnerId, shopId, null);
return storeCenterService.getStoreInfo(storeInfoRequest, trackingNo);
StoreResponse storeResponse = storeCenterService.getStoreInfo(storeInfoRequest, trackingNo);
if (storeResponse == null || storeResponse.getBizVO() == null) {
throw new ServiceException(ResponseResult.STORE_ITEM_QUERY_ERROR);
}
return storeResponse;
}
......@@ -69,11 +73,10 @@ public class SpellGroupOrderDataManager {
* @return
*/
public QueryReceiveAddressResponse queryOrderReceiveAddress(String receiveId, String partnerId, String trackingNo) {
//校验收货地址是否可配送
QueryReceiveAddressRequest request = new QueryReceiveAddressRequest(receiveId, partnerId);
BaseResponse<QueryReceiveAddressResponse> queryReceiveAddressResponse = memberCenterService.queryReceiveAddressById(request, trackingNo);
if (!ResponseResult.SUCCESS.getCode().equals(queryReceiveAddressResponse.getCode()) || queryReceiveAddressResponse.getData() == null) {
throw new ServiceException(ResponseResult.SPELL_GROUP_THE_CLUB_IS_FULL);
// throw new ServiceException(ResponseResult.SPELL_GROUP_QUERY_ORDER_RECEIVE_ADDRESS_ERROR);
}
QueryReceiveAddressResponse receiveAddressResult = queryReceiveAddressResponse.getData();
return receiveAddressResult;
......@@ -96,8 +99,8 @@ public class SpellGroupOrderDataManager {
getProductInfoReq.setShopId(createSpellGroupOrderDto.getStoreId());
getProductInfoReq.setProductInfoType(1);
ProductInfosDto productInfosReps = storeItemClient.listProductInfos(getProductInfoReq);
if (!ResponseResult.SUCCESS.getCode().equals(productInfosReps.getCode()) || productInfosReps.getData() == null) {
throw new ServiceException(ResponseResult.SPELL_GROUP_THE_CLUB_IS_FULL);
if (!ResponseResult.SUCCESS.getCode().equals(productInfosReps.getErrcode().toString()) || productInfosReps.getData() == null) {
throw new ServiceException(ResponseResult.SPELL_GROUP_QUERY_PRODUCT_INFOS_ERROR);
}
return productInfosReps.getData().getProducts();
}
......@@ -111,7 +114,7 @@ public class SpellGroupOrderDataManager {
public ActivityCalculationDiscountResponseDto queryCalculationDiscount(CalculationDiscountRequestDto calculationDiscountRequestDto) {
ActivityCalculationDiscountResponseDto activityCalculationDiscountResponseDto = promotionDiscountClient.calculationDiscountSharing(calculationDiscountRequestDto);
if (!ResponseResult.SUCCESS.getCode().equals(activityCalculationDiscountResponseDto.getStatusCode()) || activityCalculationDiscountResponseDto.getResult() == null) {
throw new ServiceException(ResponseResult.SPELL_GROUP_THE_CLUB_IS_FULL);
throw new ServiceException(ResponseResult.SPELL_GROUP_QUERY_CALCULATION_DISCOUNT_ERROR);
}
return activityCalculationDiscountResponseDto;
......
......@@ -115,23 +115,22 @@ public class SpellGroupOrderServiceImpl implements SpellGroupOrderService {
if (userLoginInfoDto == null || StringUtils.isEmpty(userLoginInfoDto.getMemberId())) {
throw new ServiceException(ResponseResult.NOT_LOGIN);
}
/*初始化service业务DTO类,后续数据转换依据createSpellGroupOrderDto*/
CreateSpellGroupOrderDto createSpellGroupOrderDto = new CreateSpellGroupOrderDto();
BeanUtils.copyProperties(createSpellGroupOrderReq, createSpellGroupOrderDto);
createSpellGroupOrderDto.setUserId(userLoginInfoDto.getMemberId());
createSpellGroupOrderDto.setNickName(userLoginInfoDto.getNickName());
/*查询会员接口,获取城市等信息*/
//todo
/*获取门店信息,拼单虚拟门店,无需校验*/
StoreResponse storeResponse = spellGroupOrderDataManager.getStoreInfo(createSpellGroupOrderReq.getPartnerId(), createSpellGroupOrderReq.getStoreId(), trackingNo);
if (storeResponse == null || storeResponse.getBizVO() == null) {
throw new ServiceException(ResponseResult.STORE_NOT_FOUND);
}
/*初始化service业务DTO类,后续数据转换依据createSpellGroupOrderDto*/
CreateSpellGroupOrderDto createSpellGroupOrderDto = new CreateSpellGroupOrderDto();
BeanUtils.copyProperties(createSpellGroupOrderReq, createSpellGroupOrderDto);
//门店信息->转换至DTO
//门店信息->转换至DTO
createSpellGroupOrderDto.setStoreResponse(storeResponse);
/*团id不为空,调用促销查询团是否关闭,关闭之后给提示不可下单*/
String getSpellGroupCode = createSpellGroupOrderReq.getSpellGroupCode();
if (1 == 1) {
return ResponseUtil.error(ResponseResult.SPELL_GROUP_THE_CLUB_IS_FULL);
}
// if (1 == 1) {
// return ResponseUtil.error(ResponseResult.SPELL_GROUP_THE_CLUB_IS_FULL);
// }
/*---------团开启 则继续执行-------*/
/*查询配送地址等信息->转换至DTO*/
QueryReceiveAddressResponse queryReceiveAddressResponse = spellGroupOrderDataManager.queryOrderReceiveAddress(createSpellGroupOrderReq.getReceiveId(), createSpellGroupOrderReq.getPartnerId(), trackingNo);
......@@ -144,7 +143,7 @@ public class SpellGroupOrderServiceImpl implements SpellGroupOrderService {
ActivityCalculationDiscountResponseDto activityCalculationDiscountResponseDto = spellGroupOrderDataManager.queryCalculationDiscount(calculationDiscountRequestDto);
//促销和产品给出规则,如果促销返回的价格是商品原价,则表示库存不足或者活动关闭 == 拼团的商品价格,肯定比商品原价低
if (activityCalculationDiscountResponseDto.getResult().getTotalAmount().equals(productInfosDto.get(0).getOriginalPrice())) {
return ResponseUtil.error(ResponseResult.SPELL_GROUP_THE_CLUB_IS_FULL);
// todo return ResponseUtil.error(ResponseResult.SPELL_GROUP_ACTIVITE_AMOUNT_ERROR);
}
createSpellGroupOrderDto.setActivityCalculationDiscountResponseDto(activityCalculationDiscountResponseDto);
//转换类存入费用信息->配送费
......@@ -155,7 +154,7 @@ public class SpellGroupOrderServiceImpl implements SpellGroupOrderService {
com.freemud.application.sdk.api.ordercenter.request.create.CreateOrderRequest createOrderRequest = spellGroupOrderAdapter.convertToCreateOrderRequest(createSpellGroupOrderDto, userLoginInfoDto);
com.freemud.application.sdk.api.ordercenter.response.BaseResponse<OrderInfoReqs> response = orderSdkService.createOrder(createOrderRequest, trackingNo);
CreateOrderResponse createOrderResponse = orderSdkAdapter.convent2NEWOrderInfoReqs(response);
if (createOrderResponse == null || !ResponseResult.SUCCESS.getCode().equals(createOrderResponse.getErrcode()) || createOrderResponse.getData() == null) {
if (createOrderResponse == null || !ResponseResult.SUCCESS.getCode().equals(createOrderResponse.getErrcode().toString()) || createOrderResponse.getData() == null) {
return ResponseUtil.error(ResponseResult.SPELL_GROUP_CREAT_ORDER_ERROR);
}
//调用活动库存
......
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