Commit 39029bb0 by 徐康

麦咖啡随单购改造

parent 5cd709d7
...@@ -173,7 +173,7 @@ public class CreateOrderProductRequest extends BaseConfig { ...@@ -173,7 +173,7 @@ public class CreateOrderProductRequest extends BaseConfig {
private String category; private String category;
/** 商品税率**/ /** 商品税率**/
private double tax; private Double tax;
private String taxId; private String taxId;
......
...@@ -109,6 +109,12 @@ public class OrderAdapter { ...@@ -109,6 +109,12 @@ public class OrderAdapter {
private String mcCafePartnerId; private String mcCafePartnerId;
@Value("${mcCafe.refund.interval}") @Value("${mcCafe.refund.interval}")
private String mccafeRefundInterval; private String mccafeRefundInterval;
@Value("${macafe.waimai.tag}")
private String maCafeWaimaiTag;
@Value("${macafe.pick.tag}")
private String maCafePickTag;
@Value("${mccafe.monthCard.goodsId}")
private String mccafeMonthCardGoodsId;
@Value("${saas.reverseNotifyiDcUrl}") @Value("${saas.reverseNotifyiDcUrl}")
private String reverseNotifyiDcUrl; private String reverseNotifyiDcUrl;
...@@ -118,10 +124,6 @@ public class OrderAdapter { ...@@ -118,10 +124,6 @@ public class OrderAdapter {
private String backOrdersChangeOrderStatusConsumerQueue; private String backOrdersChangeOrderStatusConsumerQueue;
@Value("${program.backorders_notify_activity_exchange}") @Value("${program.backorders_notify_activity_exchange}")
private String backOrdersNotifyActivityExchange; private String backOrdersNotifyActivityExchange;
@Value("${macafe.waimai.tag}")
private String maCafeWaimaiTag;
@Value("${macafe.pick.tag}")
private String maCafePickTag;
@Autowired @Autowired
private ShoppingCartAdapter shoppingCartAdapter; private ShoppingCartAdapter shoppingCartAdapter;
@Autowired @Autowired
...@@ -183,6 +185,43 @@ public class OrderAdapter { ...@@ -183,6 +185,43 @@ public class OrderAdapter {
} }
} }
} }
if(null != shoppingCartGoodsDto.getPayCardFee() && 0l != shoppingCartGoodsDto.getPayCardFee() && StringUtils.isNotBlank(createOrderVo.getCardKeyCode())) {
CreateOrderProductRequest createOrderProductDemoDto = new CreateOrderProductRequest();
createOrderProductDemoDto.setProductId(mccafeMonthCardGoodsId);
createOrderProductDemoDto.setProductName("啡常月享卡");
createOrderProductDemoDto.setSpecification(mccafeMonthCardGoodsId);
createOrderProductDemoDto.setSpecificationName("啡常月享卡");
createOrderProductDemoDto.setPrice(shoppingCartGoodsDto.getPayCardFee());
createOrderProductDemoDto.setSalePrice(shoppingCartGoodsDto.getPayCardFee());
createOrderProductDemoDto.setTotalDiscountAmount(0l);
createOrderProductDemoDto.setNumber(1);
createOrderProductDemoDto.setProductType(ProductTypeEnum.WITH_ORDER_VIRTUAL_PRODUCT.getCode());
createOrderProductDemoDto.setParentProductId("0");
createOrderProductDemoDto.setIsFixedProduct(null);
createOrderProductDemoDto.setCustomerCode(createOrderVo.getCardKeyCode());
createOrderProductDemoDto.setProductCode(createOrderVo.getCardKeyCode());
createOrderProductDemoDto.setHasStockProudct(false);
createOrderProductDemoDto.setWeight(0d);
createOrderProductDemoDto.setStapleFood(0);
createOrderProductDemoDto.setTax(0d);
createOrderProductDemoDto.setTaxId("");
if(products.get(products.size()-1).getProductType().equals(ProductTypeEnum.TABLEWARE_PRODUCT.getCode())) {
products.add(products.size()-1, createOrderProductDemoDto);
} else {
products.add(createOrderProductDemoDto);
}
CreateOrderAccountRequest createOrderAccountDto = CreateOrderAccountRequest.builder()
.accountId("")
.name("啡常月享卡")
.price(shoppingCartGoodsDto.getPayCardFee())
.accountType(QueryOrderAccountType.MCCAFE_MONTH_CARD)
.sequence(orderAccountIndex++)
.productId(createOrderVo.getCardKeyCode())
.build();
orderAccountDtos.add(createOrderAccountDto);
}
createOrderDto.setProducts(products); createOrderDto.setProducts(products);
boolean hasDeliveryMonthCard = false; boolean hasDeliveryMonthCard = false;
for (ActivityDiscountsDto activityDiscountsDto : activityDiscountsDtos) { for (ActivityDiscountsDto activityDiscountsDto : activityDiscountsDtos) {
...@@ -271,17 +310,6 @@ public class OrderAdapter { ...@@ -271,17 +310,6 @@ public class OrderAdapter {
.build(); .build();
orderAccountDtos.add(createOrderAccountDto); orderAccountDtos.add(createOrderAccountDto);
} }
if(null != shoppingCartGoodsDto.getPayCardFee() && 0l != shoppingCartGoodsDto.getPayCardFee() && StringUtils.isNotBlank(createOrderVo.getCardKeyCode())) {
CreateOrderAccountRequest createOrderAccountDto = CreateOrderAccountRequest.builder()
.accountId("")
.name("啡常月享卡")
.price(shoppingCartGoodsDto.getPayCardFee())
.accountType(QueryOrderAccountType.MCCAFE_MONTH_CARD)
.sequence(orderAccountIndex++)
.productId(createOrderVo.getCardKeyCode())
.build();
orderAccountDtos.add(createOrderAccountDto);
}
createOrderDto.setAccounts(CollectionUtils.isNotEmpty(orderAccountDtos) ? orderAccountDtos : Collections.emptyList()); createOrderDto.setAccounts(CollectionUtils.isNotEmpty(orderAccountDtos) ? orderAccountDtos : Collections.emptyList());
// update by miaohui 20201030 for 【ID1018638】【C端服务端】活动库存接口调整对接 // update by miaohui 20201030 for 【ID1018638】【C端服务端】活动库存接口调整对接
...@@ -1284,19 +1312,6 @@ public class OrderAdapter { ...@@ -1284,19 +1312,6 @@ public class OrderAdapter {
//商品信息转换 //商品信息转换
convent2ProductVos(ordersBean.getProductList(), responseVo,ordersBean.getCompanyId()); convent2ProductVos(ordersBean.getProductList(), responseVo,ordersBean.getCompanyId());
responseVo.setOrderAccounts(convent2OrderAccountVo(ordersBean.getApportionDetails())); responseVo.setOrderAccounts(convent2OrderAccountVo(ordersBean.getApportionDetails()));
if(CollectionUtils.isNotEmpty(ordersBean.getOrderCostDetailList())) {
ordersBean.getOrderCostDetailList().forEach(o -> {
if(o.getCostType() == 10 && o.getBillType() == 1) {
ProductVo productVo = new ProductVo();
productVo.setQty(1);
productVo.setName(o.getCostName());
productVo.setSpuName(o.getCostName());
productVo.setFinalPrice(o.getCostAmount().longValue());
productVo.setOriginalPrice(o.getActualCostAmount().longValue());
responseVo.getProducts().add(productVo);
}
});
}
Long promotionAmount = 0L; Long promotionAmount = 0L;
Long deliveryAmount = 0L; Long deliveryAmount = 0L;
Long packageAmount = 0L; Long packageAmount = 0L;
......
package cn.freemud.service.impl; package cn.freemud.service.impl;
import cn.freemud.entities.vo.CreateOrderVo;
import cn.freemud.management.entities.dto.request.order.OrderManagerRequest; import cn.freemud.management.entities.dto.request.order.OrderManagerRequest;
import cn.freemud.management.service.adapter.OrderManagerAdapter; import cn.freemud.management.service.adapter.OrderManagerAdapter;
import cn.freemud.management.thirdparty.MulitiPaymentClient; import cn.freemud.management.thirdparty.MulitiPaymentClient;
...@@ -8,6 +9,8 @@ import com.freemud.application.sdk.api.ordercenter.request.OrderConditionsReq; ...@@ -8,6 +9,8 @@ import com.freemud.application.sdk.api.ordercenter.request.OrderConditionsReq;
import com.freemud.application.sdk.api.ordercenter.service.OrderDownLoadSdkService; import com.freemud.application.sdk.api.ordercenter.service.OrderDownLoadSdkService;
import com.freemud.sdk.api.assortment.order.request.order.MultiOrderRefundRequest; import com.freemud.sdk.api.assortment.order.request.order.MultiOrderRefundRequest;
import com.freemud.sdk.api.assortment.order.response.order.MultiOrderRefundResponse; import com.freemud.sdk.api.assortment.order.response.order.MultiOrderRefundResponse;
import org.hibernate.validator.HibernateValidator;
import org.hibernate.validator.HibernateValidatorConfiguration;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -18,6 +21,11 @@ import org.springframework.cloud.netflix.feign.EnableFeignClients; ...@@ -18,6 +21,11 @@ import org.springframework.cloud.netflix.feign.EnableFeignClients;
import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.context.junit4.SpringRunner;
import springfox.documentation.spring.web.json.Json; import springfox.documentation.spring.web.json.Json;
import javax.validation.ConstraintViolation;
import javax.validation.Validation;
import javax.validation.ValidatorFactory;
import java.util.Set;
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
@SpringBootTest @SpringBootTest
@EnableDiscoveryClient @EnableDiscoveryClient
...@@ -56,6 +64,16 @@ public class MallOrderServiceImplTest { ...@@ -56,6 +64,16 @@ public class MallOrderServiceImplTest {
// new OrderExtendedReq(), // new OrderExtendedReq(),
// OrderClientType.SAAS,"www"); // OrderClientType.SAAS,"www");
// } // }
@Test
public void f2() {
HibernateValidatorConfiguration configuration = Validation.byProvider(HibernateValidator.class)
.configure()
.failFast(false);
ValidatorFactory validatorFactory = configuration.buildValidatorFactory();
Set<ConstraintViolation<CreateOrderVo>> set = validatorFactory.getValidator().validate(new CreateOrderVo());
}
// //
// @Test // @Test
// public void testPaySuccess() { // public void testPaySuccess() {
......
...@@ -25,6 +25,7 @@ public enum ProductTypeEnum { ...@@ -25,6 +25,7 @@ public enum ProductTypeEnum {
TABLEWARE_PRODUCT(12,"餐具商品"), TABLEWARE_PRODUCT(12,"餐具商品"),
MATERIAL_PRODUCT(88,"加料商品"), MATERIAL_PRODUCT(88,"加料商品"),
LITTLE_MATERIAL_PRODUCT(89,"小料"), LITTLE_MATERIAL_PRODUCT(89,"小料"),
WITH_ORDER_VIRTUAL_PRODUCT(90,"随单购虚拟商品"),
; ;
......
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