Commit d0e7ec14 by 周晓航

根据模板配置 计算包装费

Signed-off-by: 周晓航 <xiaohang.zhou@freemud.com>
parent c36daef9
package cn.freemud.entities.dto.console;
import lombok.Data;
/**
* @author : xh.Z
* @email : fisherman0510@163.com
* @Date : 2021/7/22 下午3:38
* @description :
*/
@Data
public class BizDTO {
/**
* 业务配置信息
*/
private BusinessInfoDTO businessInfo;
/**
* 配送信息
*/
private DeliveryInfoDTO deliveryInfo;
/**
*
*/
private StoreInfoDTO storeInfo;
}
package cn.freemud.entities.dto.console;
import lombok.Data;
/**
* @author : xh.Z
* @email : fisherman0510@163.com
* @Date : 2021/7/22 下午3:01
* @description : 业务配置信息
*/
@Data
public class BusinessInfoDTO {
/**
* 预约自建外卖制作完成后自动流程时间 1:2小时;2:1小时;3:30分钟;4:15分钟;5:10分钟;6:5分钟;
*/
private Integer appointAutoDeliveryTakeOrderWorkflowFinishTime;
/**
* 预约自提单制作完成后自动流程时间 1:2小时;2:1小时;3:30分钟;4:15分钟;5:10分钟;6:5分钟;
*/
private Integer appointAutoSelfmentionMakerWorkflowFinishTime;
/**
* 预约自提单接单后自动流程时间 1:2小时;2:1小时;3:30分钟;4:15分钟;5:10分钟;6:5分钟;
*/
private Integer appointAutoSelfmentionTakeOrderWorkflowFinishTime;
/**
* 预约自建外卖接单后自动流程时间 1:2小时;2:1小时;3:30分钟;4:15分钟;5:10分钟;6:5分钟;
*/
private Integer appointAutoTakeOutTakeOrderWorkflowFinishTime;
/**
* 三方外卖预订单自动拣货完成时间 1:2小时;2:1小时;3:30分钟;4:15分钟;5:10分钟;6:5分钟;7:3分钟;8:2分钟;
*/
private Integer appointThirdDeliveryPickCompleteWorkflowFinishTime;
/**
* 预约三方外卖制作完成后自动流程时间 1:2小时;2:1小时;3:30分钟;4:15分钟;5:10分钟;6:5分钟;7:3分钟;8:2分钟
*/
private Integer appointThirdDeliveryTakeOrderWorkflowFinishTime;
/**
* 自动退单时间
*/
private Integer autoChargebackOrderTime;
/**
* 退单模式 1手动退单 2自动退单
*/
private Integer autoChargebackOrderType;
/**
* 自建外卖制作完成后自动流程时间 1:2小时;2:1小时;3:30分钟;4:15分钟;5:10分钟;6:5分钟;
*/
private Integer autoDeliveryTakeOrderWorkflowFinishTime;
/**
* 自提单制作完成后自动流程时间 1:2小时;2:1小时;3:30分钟;4:15分钟;5:10分钟;6:5分钟;
*/
private Integer autoSelfmentionMakerWorkflowFinishTime;
/**
* 自提单接单后自动流程时间 1:2小时;2:1小时;3:30分钟;4:15分钟;5:10分钟;6:5分钟;
*/
private Integer autoSelfmentionTakeOrderWorkflowFinishTime;
/**
* 自建外卖接单后自动流程时间 1:2小时;2:1小时;3:30分钟;4:15分钟;5:10分钟;6:5分钟;
*/
private Integer autoTakeOutTakeOrderWorkflowFinishTime;
/**
* 三方外卖订单自动拣货完成时间 1:2小时;2:1小时;3:30分钟;4:15分钟;5:10分钟;6:5分钟;7:3分钟;8:2分钟
*/
private Integer autoThirdDeliveryPickCompleteWorkflowFinishTime;
/**
* 实时三方外卖制作完成后自动流程时间 1:2小时;2:1小时;3:30分钟;4:15分钟;5:10分钟;6:5分钟;7:3分钟;8:2分钟
*/
private Integer autoThirdDeliveryTakeOrderWorkflowFinishTime;
/**
* 是否自动同意退款(同意:1,不同意:0)
*/
private Integer automaticRefund;
/**
* 外卖预约单开关(0:关闭,1:开启)
*/
private Integer deliveryAppoint;
/**
* 外卖预约单时间(分钟) 65分钟、90分钟、120分钟
*/
private Integer deliveryAppointTime;
/**
* 自建外卖订单,商家自配送xx分钟后,订单状态更改为【已完成】
*/
private Integer deliveryFinishedAfterMinute;
/**
* 外卖时间:00:00-23:59
*/
private String deliveryHours;
/**
* 外卖预订单提醒时间{1:15分钟;2:30分钟;3:45分钟;4:60分钟;5:5分钟;6:10分钟}
*/
private String deliveryOrderWarnTime;
/**
* 自建外卖订单-实时单,商家自配送,门店接单xx分钟后,订单状态变更为配送中
*/
private Integer deliveryProcessingAfterMinute;
/**
* 自建外卖订单-预约单,商家自配送,预约商家前xx分钟,订单更改为配送中
*/
private Integer deliveryProcessingBeforeMinute;
/**
* 预计送达时间(分钟)
*/
private Integer expectedTime;
/**
* 商品平均制作时常(分钟)
*/
private Integer goodsAvgTimeOfMaking;
/**
* 是否支持发票 1是 0否
*/
private Integer invoice;
/**
* 发票特殊说明
*/
private String invoiceExplain;
/**
* 是否支持自动接单(1是2否)
*/
private Integer isAutoTakeOrder;
/**
* 最大接单量,单位笔
*/
private Integer maxOrderQuantity;
/**
* 可开票的最小价格
*/
private Integer minPriceForInvoice;
/**
* 预订单打印时间{1:提醒时打印;2:接单时打印}
*/
private String orderPrintConfig;
/**
* 订单进度条,1 开启,2 关闭
*/
private Integer orderProgressBarStatus;
/**
* 点餐方式(,隔开):pickup,delivery
*/
private String orderType;
/**
* 预订单提醒时间{1:15分钟;2:30分钟;3:45分钟;4:60分钟;5:5分钟;6:10分钟}
*/
private String orderWarnTime;
/**
* 超时关单 1开启 2关闭
*/
private Integer overTimeCloseOrder;
/**
* 接单超时关单时间,默认30分钟
*/
private Integer overTimeCloseOrderTime;
/**
* 自提-服务端自动接单时间 1:立即;2:1分钟;3:5分钟(顾客下单XX后,订单状态自动更改为已接单)
*/
private Integer pickupAutomaticOrderTime;
/**
* 自提预约单开关(0:关闭,1:开启)
*/
private Integer selfMentionSwitch;
/**
* 是否需要餐具 1 需要 0 不需要
*/
private Integer tableware;
/**
* 参与结算(1:是、2:否)
*/
private Integer takePartInSettleAccounts;
/**
* 外卖-服务端自动接单时间 1:立即;2:1分钟;3:5分钟(顾客下单XX后,订单状态自动更改为已接单)
*/
private Integer takeoutAutomaticOrderTime;
/**
* 所属商户号
*/
private String partnerId;
/**
* 退款时间,time_type_of_refund 为1时格式为HH:mm:ss,为2时默认48小时
*/
private String timeOfRefund;
/**
* 退款时间类型:1指定时间,2默认48小时后
*/
private Integer timeTypeOfRefund;
/**
* 开启制作时间 1 :是 , 2 :否
*/
private Integer turnOnTimeOfMaking;
/**
* 拓展业务字段
*/
private ExpandFieldsDTO expandFields;
}
package cn.freemud.entities.dto.console;
import lombok.Data;
/**
* @author : xh.Z
* @email : fisherman0510@163.com
* @Date : 2021/7/22 下午2:57
* @description : 门店服务 响应基类
*/
@Data
public class ConsoleResponseDTO<T> {
/**
* 状态码
*/
private String statusCode;
/**
*状态码描述
*/
private String msg;
private T bizVO;
}
package cn.freemud.entities.dto.console;
import lombok.Data;
/**
* @author : xh.Z
* @email : fisherman0510@163.com
* @Date : 2021/7/22 下午3:12
* @description :
*/
@Data
public class DeliveryInfoDTO {
/**
* 每增加公里(单位米)
*/
private String addRange;
/**
* 每增加公里增加配送费(单位分)
*/
private Integer addRangeAmount;
/**
* 基础配送费(分)
*/
private Integer deliveryAmount;
/**
* 配送方式:1-三方物流配送、2-商家自配送
*/
private Integer deliveryMethod;
/**
* 配送半径
*/
private Integer deliveryRadius;
/**
* 基础配送距离(单位米)
*/
private String deliveryRange;
/**
* 手绘经纬度集合
*/
private String deliveryScope;
/**
* 外卖起送条件(1:杯数,2:金额)
*/
private Integer deliveryType;
/**
* 起送杯数
*/
private Integer freeDeliveryCup;
/**
* 起送价格(单位分)
*/
private Integer freeDeliveryPrice;
/**
* 所属商户号
*/
private String partnerId;
/**
* 配送范围类型 1 自定义 2 半径
*/
private Integer scopeConfig;
}
package cn.freemud.entities.dto.console;
import lombok.Data;
/**
* @author : xh.Z
* @email : fisherman0510@163.com
* @Date : 2021/7/22 下午4:30
* @description :
*/
@Data
public class ExpandFieldsDTO {
/**
* 是 or 开启
*/
public static String STR_TRUE = "1";
/**
* 否 or 关闭
*/
public static String STR_FALSE = "0";
/**
* 月销量配置值
*/
private String monthlySalesConfigValue;
/**
* 月销量是否展示(1-是;0-否)
*/
private String monthlySalesShow;
/**
* 点赞数是否展示(1-是;0-否)
*/
private String likesShow;
/**
* 点赞数配置值
*/
private String likesConfigValue;
/**
* 扫桌码下单(1-开启;0-关闭) 开启该配置的门店在下单的时候,需要判断有没有桌号,如果没有桌号需要扫码获取桌号后再下单
*/
private String scanOrderSwitch;
// TODO 省略了 高峰时间配送时间 List<Map> 字段对接 peakTimeDelivery
/**
* 每增加一公里增加的时长(分钟)
*/
private String appendMinutePerKilometer;
/**
* 自提打包是否收取餐具费(1-开启;0-关闭)
*/
private String pickupPackageFeeSwitch;
/**
* 外卖打包是否收取餐具费(1-开启;0-关闭)
*/
private String deliveryPackageFeeSwitch;
}
package cn.freemud.entities.dto.console;
import lombok.Builder;
import lombok.Data;
/**
* @author : xh.Z
* @email : fisherman0510@163.com
* @Date : 2021/7/22 下午2:49
* @description : http://yapi.sandload.cn:3000/project/257/interface/api/60053 接口调用使用
*/
@Data
@Builder
public class GetStoreMixRequest {
/**
* 商户ID
*/
private String partnerId;
/**
* 门店号
*/
private String storeCode;
/**
* 查询数据标志位
*/
private QueryFlag query;
}
package cn.freemud.entities.dto.console;
import lombok.Builder;
import lombok.Data;
/**
* @author : xh.Z
* @email : fisherman0510@163.com
* @Date : 2021/7/22 下午2:53
* @description :
*/
@Data
@Builder
public class QueryFlag {
/**
* 查询门店基本信息
*/
private boolean queryStoreInfo;
/**
* 查询门店的渠道上级列表
*/
private boolean queryParentUntilTop;
/**
* 查询配送设置信息
*/
private boolean queryDeliveryInfo;
/**
* 查询业务设置信息
*/
private boolean queryBusinessInfo;
/**
* 查询门店图片
*/
private boolean queryStoreImage;
/**
* 查询门店繁忙时间
*/
private boolean queryStoreBusyTime;
}
package cn.freemud.entities.dto.console;
import lombok.Data;
/**
* @author : xh.Z
* @email : fisherman0510@163.com
* @Date : 2021/7/22 下午3:28
* @description :
*/
@Data
public class StoreInfoDTO {
/**
* 是否繁忙置休,1-是,0-否
*/
private Integer activeFlag;
/**
* 门店地址
*/
private String address;
/**
* 英文门店地址
*/
private String addressEn;
/**
* 门店简称
*/
private String briefName;
/**
* 营业时间
*/
private String businessHours;
/**
* 当日营业时间
*/
private String businessHoursDay;
/**
* 营业时间类型:1-按天,2-按周
*/
private String businessType;
/**
* 市
*/
private String city;
/**
* 是否开通Delivery{1.是;2.否}
*/
private String delivery;
/**
* 配送时间
*/
private String deliveryHours;
/**
* 当日外卖营业时间
*/
private String deliveryHoursDay;
/**
* 到店自取(1是 2否)
*/
private Integer isSelfMention;
/**
* 纬度
*/
private String latitude;
/**
* 门店logo
*/
private String logoUrl;
/**
* 经度
*/
private String longitude;
/**
* 父级商户编码
*/
private String parentCode;
/**
* 父级商户编号
*/
private String parentId;
/**
* 父级商户名称
*/
private String parentName;
/**
* 商户号
*/
private String partnerId;
/**
* 电话
*/
private String phone;
/**
* 省
*/
private String province;
/**
* 区
*/
private String region;
/**
* 备注
*/
private String remark;
/**
* 是否展示优惠(0-不展示; 1-展示)
*/
private Integer showDiscount;
/**
* 营业状态
*/
private String state;
/**
* 门店营运状态(营运1,停运-2,删除-3)
*/
private String status;
/**
* 门店编号
*/
private String storeCode;
/**
* 门店id
*/
private String storeId;
/**
* 门店名称
*/
private String storeName;
/**
* 英文门店名称
*/
private String storeNameEn;
/**
* 门店公告
*/
private String storeNotice;
/**
* 第三方门店编号
*/
private String thirdPartCode;
}
...@@ -18,8 +18,6 @@ import cn.freemud.adapter.ShoppingCartConvertAdapter; ...@@ -18,8 +18,6 @@ import cn.freemud.adapter.ShoppingCartConvertAdapter;
import cn.freemud.adapter.StoreItemAdapter; import cn.freemud.adapter.StoreItemAdapter;
import cn.freemud.base.entity.BaseResponse; import cn.freemud.base.entity.BaseResponse;
import cn.freemud.base.util.DateUtil; import cn.freemud.base.util.DateUtil;
import cn.freemud.base.util.JsonUtil;
import cn.freemud.constant.ApplicationConstant;
import cn.freemud.constant.ResponseCodeConstant; import cn.freemud.constant.ResponseCodeConstant;
import cn.freemud.constant.ShoppingCartConstant; import cn.freemud.constant.ShoppingCartConstant;
import cn.freemud.demo.controller.ShoppingCartDemoController; import cn.freemud.demo.controller.ShoppingCartDemoController;
...@@ -30,11 +28,11 @@ import cn.freemud.entities.dto.activity.ActivityQueryDto; ...@@ -30,11 +28,11 @@ import cn.freemud.entities.dto.activity.ActivityQueryDto;
import cn.freemud.entities.dto.activity.ActivityQueryResponseDto; import cn.freemud.entities.dto.activity.ActivityQueryResponseDto;
import cn.freemud.entities.dto.calculate.CalculationSharingDiscountRequestDto; import cn.freemud.entities.dto.calculate.CalculationSharingDiscountRequestDto;
import cn.freemud.entities.dto.calculate.CalculationSharingDiscountResponseDto; import cn.freemud.entities.dto.calculate.CalculationSharingDiscountResponseDto;
import cn.freemud.entities.dto.console.*;
import cn.freemud.entities.dto.openplatform.WeixinProductRequestDto; import cn.freemud.entities.dto.openplatform.WeixinProductRequestDto;
import cn.freemud.entities.dto.openplatform.WeixinProductResponseDto; import cn.freemud.entities.dto.openplatform.WeixinProductResponseDto;
import cn.freemud.entities.dto.shoppingCart.SendPoint; import cn.freemud.entities.dto.shoppingCart.SendPoint;
import cn.freemud.entities.dto.shoppingCart.ShoppingCartGoodsDto; import cn.freemud.entities.dto.shoppingCart.ShoppingCartGoodsDto;
import cn.freemud.entities.dto.user.GetSessionUserInfoDto;
import cn.freemud.entities.dto.user.GetUserScoreUseDetailRequest; import cn.freemud.entities.dto.user.GetUserScoreUseDetailRequest;
import cn.freemud.entities.dto.user.GetUserScoreUserDetailResponse; import cn.freemud.entities.dto.user.GetUserScoreUserDetailResponse;
import cn.freemud.entities.vo.*; import cn.freemud.entities.vo.*;
...@@ -209,6 +207,9 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService { ...@@ -209,6 +207,9 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
@Autowired @Autowired
private StoreItemAdapter storeItemAdapter; private StoreItemAdapter storeItemAdapter;
@Autowired
private ConsoleApiClient consoleApiClient;
/** /**
* 从微信卡券向购物车中添加商品 * 从微信卡券向购物车中添加商品
...@@ -2146,6 +2147,9 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService { ...@@ -2146,6 +2147,9 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
return; return;
} }
//========================== 购物车查询特有逻辑 ================================= //========================== 购物车查询特有逻辑 =================================
if (Objects.isNull(shoppingCartInfoRequestVo)) {
return;
}
// 到店自取包装费设为null,外卖要计算包装费,flag为1表示去结算 // 到店自取包装费设为null,外卖要计算包装费,flag为1表示去结算
// 兼容老版本判断null // 兼容老版本判断null
if (Objects.equals(shoppingCartInfoRequestVo.getOrderType(), CreateOrderType.COLLECT_GOODS.getCode()) if (Objects.equals(shoppingCartInfoRequestVo.getOrderType(), CreateOrderType.COLLECT_GOODS.getCode())
...@@ -2155,7 +2159,15 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService { ...@@ -2155,7 +2159,15 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
} else if ((Objects.equals(shoppingCartInfoRequestVo.getOrderType(), CreateOrderType.TAKE_OUT.getCode()) } else if ((Objects.equals(shoppingCartInfoRequestVo.getOrderType(), CreateOrderType.TAKE_OUT.getCode())
|| Objects.equals(shoppingCartInfoRequestVo.getReachStoreType(), OrderType.COLLECT_GOODS.getCode())) || Objects.equals(shoppingCartInfoRequestVo.getReachStoreType(), OrderType.COLLECT_GOODS.getCode()))
&& Objects.equals(shoppingCartInfoRequestVo.getFlag(), CouponFlag.YES.getCode())) { && Objects.equals(shoppingCartInfoRequestVo.getFlag(), CouponFlag.YES.getCode())) {
Long packAmount = shoppingCartGoodsResponseVo.getNewPackAmount() == null ? 0 : shoppingCartGoodsResponseVo.getNewPackAmount(); //fisherman 【ID1033456】自提根据模板配置计算餐具包装费
// 外卖 true 打包带走 false null 为其他业务问题 不进入需求
Boolean isTakeOut = null;
if (Objects.equals(shoppingCartInfoRequestVo.getOrderType(), CreateOrderType.TAKE_OUT.getCode())) {
isTakeOut = true;
} else if (Objects.equals(shoppingCartInfoRequestVo.getReachStoreType(), OrderType.COLLECT_GOODS.getCode())) {
isTakeOut = false;
}
Long packAmount = getPackAmountByStoreConfig(partnerId,storeId,shoppingCartGoodsResponseVo.getNewPackAmount(),isTakeOut);
Long originalTotalAmount = shoppingCartGoodsResponseVo.getOriginalTotalAmount() + packAmount; Long originalTotalAmount = shoppingCartGoodsResponseVo.getOriginalTotalAmount() + packAmount;
Long totalAmount = shoppingCartGoodsResponseVo.getTotalAmount() + packAmount; Long totalAmount = shoppingCartGoodsResponseVo.getTotalAmount() + packAmount;
shoppingCartGoodsResponseVo.setOriginalTotalAmount(originalTotalAmount); shoppingCartGoodsResponseVo.setOriginalTotalAmount(originalTotalAmount);
...@@ -2165,6 +2177,50 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService { ...@@ -2165,6 +2177,50 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
} }
/** /**
*
* fisherman 【ID1033456】自提根据模板配置计算餐具包装费
* @param partnerId 商户号
* @param storeId 门店号
* @param newPackAmount Shop/ValidateShopProduct 接口返回的包装费
* @param isTakeOut 外卖 true 打包带走 false null 为其他业务问题 不进入需求
* @return
*/
private Long getPackAmountByStoreConfig(String partnerId, String storeId, Long newPackAmount,Boolean isTakeOut) {
ApiLog.printLog("自提根据模板配置计算餐具包装费",String.valueOf(newPackAmount),String.valueOf(isTakeOut),null);
if (Objects.isNull(newPackAmount)) {
return 0L;
}
if (Objects.isNull(isTakeOut)) {
return newPackAmount;
}
GetStoreMixRequest request = GetStoreMixRequest.builder().partnerId(partnerId).storeCode(storeId).build();
// 查询 业务设置信息数据
request.setQuery(QueryFlag.builder().queryBusinessInfo(Boolean.TRUE).build());
ConsoleResponseDTO<BizDTO> responseDTO = consoleApiClient.getStoreMix(request);
BizDTO bizVO = responseDTO.getBizVO();
if (Objects.nonNull(bizVO) && Objects.nonNull(bizVO.getBusinessInfo())) {
// 查出 有配置 并且有开关 就判断 否则就走 默认值
ExpandFieldsDTO expandFields = bizVO.getBusinessInfo().getExpandFields();
if (Objects.nonNull(expandFields)) {
if (isTakeOut) {
// 外卖 是否计算 包装费
if (Objects.nonNull(expandFields.getDeliveryPackageFeeSwitch())
&& ExpandFieldsDTO.STR_FALSE.equals(expandFields.getDeliveryPackageFeeSwitch())) {
return 0L;
}
}else {
// 打包带走 是否计算包装费
if (Objects.nonNull(expandFields.getPickupPackageFeeSwitch())
&& ExpandFieldsDTO.STR_FALSE.equals(expandFields.getPickupPackageFeeSwitch())) {
return 0L;
}
}
}
}
return newPackAmount;
}
/**
* 在原价、现价、折扣价上增加第一次使用会员卡的费用 * 在原价、现价、折扣价上增加第一次使用会员卡的费用
* *
* @param shoppingCartInfoRequestVo * @param shoppingCartInfoRequestVo
......
/**
* All rights Reserved, Designed By www.freemud.cn
*
* @Title: StoreItemClient
* @Package cn.freemud.service.thirdparty
* @Description:
* @author: liming.guo
* @date: 2018/5/16 9:39
* @version V1.0
* @Copyright: 2018 www.freemud.cn Inc. All rights reserved.
* 注意:本内容仅限于上海非码科技内部传阅,禁止外泄以及用于其他的商业目
*/
package cn.freemud.service.thirdparty;
import cn.freemud.entities.dto.console.BizDTO;
import cn.freemud.entities.dto.console.ConsoleResponseDTO;
import cn.freemud.entities.dto.console.GetStoreMixRequest;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
@FeignClient("CONSOLE-API")
@RequestMapping(produces = {MediaType.APPLICATION_JSON_UTF8_VALUE})
public interface ConsoleApiClient {
/**
* v2获取门店信息
*
* @param request
* @return
*/
@PostMapping(value = "/api/v2/organization/getStoreMix")
ConsoleResponseDTO<BizDTO> getStoreMix(GetStoreMixRequest request);
}
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