Commit be74b261 by 刘鹏飞

Merge remote-tracking branch 'remotes/origin/feature/20201022-refundReform-刘鹏飞' into develop

# Conflicts:
#	assortment-ordercenter-sdk/pom.xml
#	assortment-ordercenter-sdk/src/main/java/com/freemud/sdk/api/assortment/order/adapter/OrderSdkAdapter.java
#	order-application-service/pom.xml
#	shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/ShoppingCartMCoffeeServiceImpl.java
parents e090c8ee eaf6f3a2
......@@ -10,7 +10,7 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>assortment-ordercenter-sdk</artifactId>
<version>2.0.17-SNAPSHOT</version>
<version>2.0.18-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
......@@ -55,7 +55,7 @@
<dependency>
<groupId>com.freemud.application.service.sdk</groupId>
<artifactId>storecenter-sdk</artifactId>
<version>2.8.RELEASE</version>
<version>3.2.9-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
......
......@@ -522,30 +522,53 @@ public class OrderCenterSdkServiceImpl implements OrderCenterSdkService {
&& !ObjectUtils.equals("0", configuration.getAutoChargebackOrderTime())) {
request.setTimeOut(AutoOrderConfigTime.getTime(configuration.getAutoChargebackOrderTime()));
}
OrderTaskReq orderTask = setAfterSalesOrderTimeOutTask();
OrderTaskReq orderTask = setAfterSalesOrderTimeOutTask(configuration);
request.setOrderTask(orderTask);
com.freemud.application.sdk.api.ordercenter.response.BaseResponse response = orderSdkService.createAfterSalesOrder(request, orderRefundRequest.getTrackingNo());
return orderSdkAdapter.convent2BaseOrderResponse(response);
}
/**
* 设置申请退款48小时后回调任务
* 设置申请退款时间
* 如果时间的类型是2表示采用原来的48小时逻辑
* 如果时间的类型是1表示在指定的时间之后进行退款
* 为了防止同一时刻的退款量太大,需要将退款的订单分散到指定的时间后半小时内
*/
private OrderTaskReq setAfterSalesOrderTimeOutTask() {
OrderTaskReq orderTask = new OrderTaskReq();
orderTask.setTaskType(4);
orderTask.setTimeout(1);
//1000*60*60*24*2 毫秒(48小时)
long timeout = 172800000;
long timeMillis = System.currentTimeMillis();
Date processingDate = new Date(timeMillis + timeout - 60000);
Date taskTime = new Date(timeMillis + timeout);
orderTask.setTaskTime(DateUtil.convert2String(taskTime, DateUtil.FORMAT_YYYY_MM_DD_HHMMSS));
//处理时间,当前时间加48小时减1分钟
orderTask.setProcessingTime(DateUtil.convert2String(processingDate, DateUtil.FORMAT_YYYY_MM_DD_HHMMSS));
return orderTask;
// request.setOrderTask(orderTask);
private OrderTaskReq setAfterSalesOrderTimeOutTask(StoreResponse.Configuration configuration) {
if(configuration != null && (configuration.getTimeTypeOfRefund() != null && 2 == configuration.getTimeTypeOfRefund().intValue()) || configuration.getTimeTypeOfRefund() == null){// 48小时之后
OrderTaskReq orderTask = new OrderTaskReq();
orderTask.setTaskType(4);
orderTask.setTimeout(1);
//1000*60*60*24*2 毫秒(48小时)
long timeout = 172800000;
long timeMillis = System.currentTimeMillis();
Date processingDate = new Date(timeMillis + timeout - 60000);
Date taskTime = new Date(timeMillis + timeout);
orderTask.setTaskTime(DateUtil.convert2String(taskTime, DateUtil.FORMAT_YYYY_MM_DD_HHMMSS));
//处理时间,当前时间加48小时减1分钟
orderTask.setProcessingTime(DateUtil.convert2String(processingDate, DateUtil.FORMAT_YYYY_MM_DD_HHMMSS));
return orderTask;
}else if(configuration != null && configuration.getTimeTypeOfRefund() != null && 1 == configuration.getTimeTypeOfRefund().intValue()){// 指定时间
OrderTaskReq orderTask = new OrderTaskReq();
orderTask.setTaskType(4);
orderTask.setTimeout(1);
// 获取门店配置的当天指定的退款时间
String timeOfRefund = configuration.getTimeOfRefund();
// 获取半小时的随机数
Random r = new Random();
int minute = r.ints(1,31).findFirst().getAsInt() * 60000;
String today = DateUtil.getCurrentDate(DateUtil.FORMAT_YMD);
Date configTime = DateUtil.convert2Date(today+" "+timeOfRefund, DateUtil.FORMAT_YYYY_MM_DD_HHMMSS);
Date processingDate = new Date(configTime.getTime() + minute);
String processingStr = DateUtil.convert2String(processingDate, DateUtil.FORMAT_YYYY_MM_DD_HHMMSS);
orderTask.setTaskTime(processingStr);
orderTask.setProcessingTime(processingStr);
return orderTask;
}
return null;
}
/**
......@@ -668,7 +691,7 @@ public class OrderCenterSdkServiceImpl implements OrderCenterSdkService {
&& !ObjectUtils.equals("0", configuration.getAutoChargebackOrderTime())) {
request.setTimeOut(AutoOrderConfigTime.getTime(configuration.getAutoChargebackOrderTime()));
}
OrderTaskReq orderTask = setAfterSalesOrderTimeOutTask();
OrderTaskReq orderTask = setAfterSalesOrderTimeOutTask(configuration);
request.setOrderTask(orderTask);
}
request.setRefundDeliveryAmount(cancelOrderRequest.isRefundDeliveryAmount());
......
......@@ -18,4 +18,6 @@ public class CommonsConstant {
public final static Integer WEIGHT_PRODUCT = 1;
public final static Integer COUPON_TYPE = 0;
}
......@@ -40,7 +40,7 @@
<dependency>
<groupId>cn.freemud</groupId>
<artifactId>assortment-ordercenter-sdk</artifactId>
<version>2.0.17-SNAPSHOT</version>
<version>2.0.18-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.freemud.application.service.sdk</groupId>
......@@ -88,7 +88,7 @@
<dependency>
<groupId>com.freemud.application.service.sdk</groupId>
<artifactId>storecenter-sdk</artifactId>
<version>3.2.1-SNAPSHOT</version>
<version>3.2.9-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>cn.freemud</groupId>
......
......@@ -1221,9 +1221,9 @@ public class OrderServiceImpl implements Orderservice {
&& queryOrderResponseVo.getRefundStatus() != null && queryOrderResponseVo.getRefundStatus() == 1) {
Integer automaticRefund = storeInfo.getBizVO().getStoreConfig().getAutomaticRefund();
if(automaticRefund != null && automaticRefund == 1){
queryOrderResponseVo.setRefundTips("若48小时后商家未处理,自动同意");
queryOrderResponseVo.setRefundTips("若48小时内未成功退款,请联系商家人工处理");
}else {
queryOrderResponseVo.setRefundTips("若48小时后商家未处理,拒绝退款");
queryOrderResponseVo.setRefundTips("若48小时内未成功退款,请联系商家人工处理");
}
}
......@@ -1348,9 +1348,9 @@ public class OrderServiceImpl implements Orderservice {
&& queryOrderResponseVo.getRefundStatus() != null && queryOrderResponseVo.getRefundStatus() == 1) {
Integer automaticRefund = storeInfo.getBizVO().getStoreConfig().getAutomaticRefund();
if(automaticRefund != null && automaticRefund == 1){
queryOrderResponseVo.setRefundTips("若48小时后商家未处理,自动同意");
queryOrderResponseVo.setRefundTips("若48小时内未成功退款,请联系商家人工处理");
}else {
queryOrderResponseVo.setRefundTips("若48小时后商家未处理,拒绝退款");
queryOrderResponseVo.setRefundTips("若48小时内未成功退款,请联系商家人工处理");
}
}
......
......@@ -65,7 +65,7 @@
<dependency>
<groupId>cn.freemud</groupId>
<artifactId>assortment-ordercenter-sdk</artifactId>
<version>2.0.17-SNAPSHOT</version>
<version>2.0.13-RELEASE</version>
<scope>provided</scope>
</dependency>
<dependency>
......
......@@ -162,6 +162,10 @@ public class ActivityCalculationDiscountResponseDto {
* 运费月卡入机字段
*/
private String tenderId;
/**
* 1-运费券 2-运费月卡券 3-月卡券 4-万能券 5-啡常月享卡 6-通用券
*/
private Integer extendType;
}
@Data
......
......@@ -25,6 +25,10 @@ public class ActivityDiscountsDto {
* 运费月卡入机字段
*/
private String tenderId;
/**
* 1-运费券 2-运费月卡券 3-月卡券 4-万能券 5-啡常月享卡 6-通用券
*/
private Integer extendType;
/**
* 实际参与活动商品数量
......
......@@ -22,6 +22,7 @@ public enum GoodsTypeEnum {
SKU_GOODS(4, "sku商品"),
SPU_GOODS(5, "spu商品"),
REDUCE_PRICE_GOODS(6,"超值加购商品"),
ALL_COUPON_GOODS(8, "万能券商品"),
MATERIAL(88, "有加料的商品"),
EXCEPTION_GOODS(99, "异常商品:商品菜单变化导致和购物车不商品匹配");
private Integer goodsType;
......
......@@ -349,7 +349,7 @@ public class ShoppingCartMCoffeeServiceImpl {
// 获取购物车商品
List<CartGoods> cartGoodsList = assortmentSdkService.getShoppingCart(partnerId, storeId, userId, sessionId, "", shoppingCartBaseService);
log.info("cartGoodsList: {}",JSONObject.toJSONString(cartGoodsList));
// 如果购物车商品不为空, 则check购物车中所有商品
if (CollectionUtils.isNotEmpty(cartGoodsList)) {
// check购物车中所有商品
......@@ -567,6 +567,7 @@ public class ShoppingCartMCoffeeServiceImpl {
// 获取购物车商品
List<CartGoods> cartGoodsList = assortmentSdkService.getShoppingCart(partnerId, storeId, userId, null, tableNumber, shoppingCartBaseService);
log.info("cartGoodsList: {}",JSONObject.toJSONString(cartGoodsList));
if (cartGoodsList == null || CollectionUtils.isEmpty(cartGoodsList)) {
throw new ServiceException(ResponseResult.SHOPPING_CART_GETINFO_INVAILD);
}
......@@ -1149,6 +1150,9 @@ public class ShoppingCartMCoffeeServiceImpl {
} else if (CollectionUtils.isNotEmpty(addShoppingCartGoodsRequestVo.getProductComboList()) || CollectionUtils.isNotEmpty(addShoppingCartGoodsRequestVo.getProductGroupList())) {
goodsType = GoodsTypeEnum.SET_MEAL_GOODS.getGoodsType();
}
/*else if (CommonsConstant.COUPON_TYPE == addShoppingCartGoodsRequestVo.getCouponType()){
goodsType = GoodsTypeEnum.ALL_COUPON_GOODS.getGoodsType();
}*/
if (addShoppingCartGoodsRequestVo.getOperationType() != null && addShoppingCartGoodsRequestVo.getOperationType() == 2) {
goodsType = GoodsTypeEnum.REDUCE_PRICE_GOODS.getGoodsType();
}
......
......@@ -208,6 +208,7 @@ public class CalculationServiceImpl {
activityDiscountsDto.setActivityType(discountType);
activityDiscountsDto.setDiscountAmount(0 - discountAmount);
activityDiscountsDto.setTenderId(discount.getTenderId());
activityDiscountsDto.setExtendType(discount.getExtendType());
activityDiscountsDtos.add(activityDiscountsDto);
}
}
......@@ -251,7 +252,7 @@ public class CalculationServiceImpl {
// couponPromotionVO.setOrderType(orderType);
// couponPromotionVO.setFlg(CouponFlag.YES.getCode());
//优惠券
couponDiscountCalculation.updateShoppingCartGoodsApportion(calculationDiscountResult, shoppingCartGoodsDto);
couponDiscountCalculation.updateShoppingCartGoodsApportion(calculationDiscountResult, shoppingCartGoodsDto, shoppingCartInfoRequestVo);
setMealCalculation.updateShoppingCartGoodsApportion(shoppingCartGoodsResponseVo, calculationDiscountResult, shoppingCartGoodsDto);
......
package cn.freemud.service.impl.mcoffee.calculation;
import cn.freemud.adapter.CouponAdapter;
import cn.freemud.base.entity.BaseResponse;
import cn.freemud.base.util.DateUtil;
import cn.freemud.entities.dto.*;
import cn.freemud.entities.dto.activity.ActivityDiscountsDto;
......@@ -9,6 +10,7 @@ import cn.freemud.entities.vo.*;
import cn.freemud.enums.*;
import cn.freemud.interceptor.ServiceException;
import cn.freemud.service.CommonService;
import cn.freemud.service.impl.ItemServiceImpl;
import cn.freemud.service.impl.mcoffee.entity.CouponAvailableReq;
import cn.freemud.service.impl.mcoffee.entity.CouponAvailableResp;
import cn.freemud.service.impl.mcoffee.entity.CouponProductVo;
......@@ -49,7 +51,8 @@ public class CouponDiscountCalculation {
@Autowired
private CustomerExtendClient customerExtendClient;
@Autowired
private ItemServiceImpl itemService;
@Autowired
private CommonService commonService;
......@@ -133,7 +136,7 @@ public class CouponDiscountCalculation {
/**
* 商品均摊
*/
public void updateShoppingCartGoodsApportion(ActivityCalculationDiscountResponseDto.CalculationDiscountResult calculationDiscountResult, ShoppingCartGoodsDto shoppingCartGoodsDto){
public void updateShoppingCartGoodsApportion(ActivityCalculationDiscountResponseDto.CalculationDiscountResult calculationDiscountResult, ShoppingCartGoodsDto shoppingCartGoodsDto, ShoppingCartInfoRequestVo shoppingCartInfoRequestVo){
if (calculationDiscountResult == null || CollectionUtils.isEmpty(calculationDiscountResult.getDiscounts())
|| !calculationDiscountResult.getDiscounts().stream().anyMatch(discount -> (ActivityTypeEnum.TYPE_3.getCode().equals(discount.getType())
......@@ -159,6 +162,10 @@ public class CouponDiscountCalculation {
for (ShoppingCartGoodsDto.CartGoodsDetailDto cartGoods : shoppingCartGoodsDto.getProducts()) {
//商品券商品
if (StringUtils.isNotEmpty(cartGoods.getCouponCode())) {
if (goodsMap.get(cartGoods.getCartGoodsUid()) == null) {
continue;
}
List<ActivityDiscountsDto> productActivityDiscountsDtos = new ArrayList<>();
if (CollectionUtils.isNotEmpty(discounts)) {
for (ActivityCalculationDiscountResponseDto.CalculationDiscountResult.Discount couponDiscount : discounts) {
......@@ -168,8 +175,24 @@ public class CouponDiscountCalculation {
activityDiscountsDto.setActivityName(couponDiscount.getActivityName());
activityDiscountsDto.setActivityType(couponDiscount.getType());
activityDiscountsDto.setDiscountAmount(0 - couponDiscount.getDiscount());
Integer extendType = couponDiscount.getExtendType();
activityDiscountsDto.setExtendType(extendType);
activityDiscountsDto.setTenderId(goodsMap.get(cartGoods.getCartGoodsUid()).getArtNo());
productActivityDiscountsDtos.add(activityDiscountsDto);
if (extendType != null && extendType == 4 ) {
//调用商品的接口获取商品键位
List<String> productIds=Arrays.asList(cartGoods.getSkuId());
BaseResponse<Map<String, GetMenuResponseDto.DataBean.RootNodeBean.ChildrenBeanFirst.ChildrenBeanSecond.ProductBean>> baseResponse = itemService.getProducts(shoppingCartInfoRequestVo.getPartnerId(),
shoppingCartInfoRequestVo.getShopId(), productIds, false, shoppingCartInfoRequestVo.getMenuType());
if (ResponseResult.SUCCESS.getCode().equals(baseResponse.getCode()) && baseResponse.getResult() != null){
GetMenuResponseDto.DataBean.RootNodeBean.ChildrenBeanFirst.ChildrenBeanSecond.ProductBean productBean = baseResponse.getResult().get(cartGoods.getSkuId());
cartGoods.setCustomerCode(productBean.getCustomerCode());
}
}else {
cartGoods.setCustomerCode(goodsMap.get(cartGoods.getCartGoodsUid()).getArtNo());
}
cartGoods.setTotalDiscountAmount(-activityDiscountsDto.getDiscountAmount());
cartGoods.setSalePrice(0L);
cartGoods.setActivityDiscountsDtos(productActivityDiscountsDtos);
......@@ -177,16 +200,6 @@ public class CouponDiscountCalculation {
}
}
if (goodsMap.get(cartGoods.getCartGoodsUid()) == null) {
continue;
}
//商品券键位编号为空
if(StringUtils.isBlank(goodsMap.get(cartGoods.getCartGoodsUid()).getArtNo())){
//直接抛出异常导致同一个 普通商品 和万能券商品 校验有问题,故促销未返回,默认为空
// throw new ServiceException(ResponseResult.SHOPPING_CART_SEAT_EMPTY);
cartGoods.setCustomerCode("");
}
cartGoods.setCustomerCode(goodsMap.get(cartGoods.getCartGoodsUid()).getArtNo());
}
}
......
......@@ -119,6 +119,11 @@ public class MCoffeeAddGoodsRequestVo {
private Integer operationType;
/**
* 券类型 0:商品券
*/
private Integer couponType;
/**
* 优惠券号
*/
private String couponCode;
......
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