Commit 2b69d21f by zhiheng.zhang

Merge remote-tracking branch 'origin/master'

parents b74dff22 36c1fb8e
......@@ -10,7 +10,7 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>assortment-shoppingcart-sdk</artifactId>
<version>1.1.6.RELEASE</version>
<version>1.1.7.RELEASE</version>
<dependencies>
<dependency>
......
......@@ -6,4 +6,5 @@
| 1.1.2.RELEASE| 券码接口修改为channel_code | 胡超 | 2020-06-08 |
| 1.1.3.RELEASE| 增加统计分类classificationId  ,setClassificationName | | 2020-06-16 |
| 1.1.5.RELEASE| 商品加料  | | 2020-08-24 |
| 1.1.6.RELEASE| 新增商品券名称字段| 孙昱 | 2020-11-09 |
\ No newline at end of file
| 1.1.6.RELEASE| 新增商品券名称字段| 孙昱 | 2020-11-09 |
| 1.1.7.RELEASE| 标识套餐类型| 孙昱 | 2020-12-01 |
\ No newline at end of file
......@@ -315,6 +315,7 @@ public class ShoppingCartAdapter {
updateComboxGoodsInfoNew(productGroup, spuProduct, false);
}
}
cartGoods.setGoodsType(GoodsTypeEnum.SET_MEAL_GOODS.getGoodsType());
}
//更新当前商品行价格
Long newOrigOriginalPrice = 0L;
......
......@@ -938,6 +938,11 @@ public class OrderAdapter {
if (QueryOrderStatus.ORDER_CANCEL.getCode().equals(queryOrderDto.getQueryOrderStatus())) {
queryOrdersDto.setStatus(new Integer[]{OrderStatus.CALCEL.getCode()});
}
if (QueryOrderStatus.ORDER_CANCEL_MIXUE.getCode().equals(queryOrderDto.getQueryOrderStatus())) {
queryOrdersDto.setStatus(new Integer[]{OrderStatus.CALCEL.getCode()});
queryOrdersDto.setPayStatus(new Integer[]{PayStatus.NOT_PAY.getCode()});
}
}
// 兼容历史版本,如果传参是4 查询拆程4和5
......
......@@ -208,6 +208,15 @@ public class OrderController {
}
/**
* 取消支付订单
*/
@ApiAnnotation(logMessage = "cancelPayOrder")
@PostMapping("/cancelPayOrder")
public BaseResponse cancelPayOrder(@Validated @LogParams @RequestBody DeleteOrderVo deleteOrderVo) {
return orderservice.cancelPayOrder(deleteOrderVo);
}
/**
* 取消支付删除订单
*/
@ApiAnnotation(logMessage = "deleteOrder")
......
......@@ -68,4 +68,9 @@ public class PaysuccessNoticeMessage {
* 会员规则ID
*/
private String ruleId;
/**
* 消息来源
*/
private Integer source;
}
......@@ -34,7 +34,7 @@ public class QueryOrderVo {
*/
private String oid;
/**
* 订单状态 enum queryOrderStatus 全部订单 1 待取餐 2 已完成 3 全部 4.退款,5 待支付 ,6 已取消
* 订单状态 enum queryOrderStatus 全部订单 1 待取餐 2 已完成 3 全部 4.退款,5 待支付 ,6 已取消 7未支付取消
*/
private Integer queryOrderStatus;
/**
......
package cn.freemud.enums;
/**
* All rights Reserved, Designed By www.freemud.cn
*
* @Title: cn.freemud.service.thirdparty SvcClient
* @Description: TDO 描述....
* @author: 铁牌灵魂工程师
* @date: 2020/12/01
* @Copyright: www.freemud.cn Inc. All rights reserved.
* 注意:本内容仅限于上海非码科技内部传阅,禁止外泄以及用于其他的商业目
*/
public enum PaySuccessSource {
INSIDE(1,"内部直接调用"),
OUTSIDE(2,"外部回调");
private Integer source;
private String desc;
PaySuccessSource(Integer source,String desc) {
this.source = source;
this.desc = desc;
}
public Integer getSource() {
return source;
}
public String getDesc() {
return desc;
}
}
......@@ -20,7 +20,10 @@ public enum QueryOrderStatus {
ALL_BILL(3, "全部"),
REFUND_BILL(4, "退款"),
NO_PAY(5, "待支付"),
ORDER_CANCEL(6, "已取消");
ORDER_CANCEL(6, "已取消"),
//密雪
ORDER_CANCEL_MIXUE(7, "未支付已取消");
private Integer code;
......
......@@ -62,6 +62,8 @@ public interface Orderservice {
*/
BaseResponse deleteOrder(DeleteOrderVo deleteOrderVo);
BaseResponse cancelPayOrder(DeleteOrderVo deleteOrderVo);
/**
* 支付取消删除订单
*/
......
......@@ -528,9 +528,11 @@ public class OrderServiceImpl implements Orderservice {
}
//支付回掉成功标记
redisCache.save(RedisKeyConstant.KGD_PAYMENT_CALLBACK_FMID + message.getOut_trade_no(), message.getOut_trade_no(), 10L, TimeUnit.MINUTES);
log.info("调用券码核销==" + message.getTrans_id());
verificationCoupon(message.getTrans_id());
log.info("调用券码结束=="+ message.getTrans_id());
if (message.getSource().equals(PaySuccessSource.OUTSIDE.getSource())) {
log.info("调用券码核销==" + message.getTrans_id());
verificationCoupon(message.getTrans_id());
log.info("调用券码结束=="+ message.getTrans_id());
}
return sendPaySuccessNoticeMessage();
}
......@@ -602,6 +604,7 @@ public class OrderServiceImpl implements Orderservice {
message.setPlatformMchId(newMessage.getPlatformMchId());
message.setTerminalId(newMessage.getAppId());
message.setRuleId(newMessage.getRuleId());
message.setSource(PaySuccessSource.OUTSIDE.getSource());
String res = orderAdapterService.paySuccessCallback(message);
JSONObject jsonObject = JSONObject.parseObject(res);
if (jsonObject.containsKey("code")) {
......@@ -1507,6 +1510,49 @@ public class OrderServiceImpl implements Orderservice {
}
@Override
public BaseResponse cancelPayOrder(DeleteOrderVo deleteOrderVo) {
if (StringUtils.isBlank(deleteOrderVo.getOid())) {
return ResponseUtil.error(ResponseResult.PARAMETER_MISSING.getCode(), "oid不能为空");
}
BaseQueryOrderRequest baseQueryOrderRequest = new BaseQueryOrderRequest();
baseQueryOrderRequest.setOrderId(deleteOrderVo.getOid());
baseQueryOrderRequest.setTrackingNo(LogTreadLocal.getTrackingNo());
QueryOrderByIdResponse queryOrderByIdResponse = orderCenterSdkService.queryOrderById(baseQueryOrderRequest);
String string = JSONObject.toJSONString(queryOrderByIdResponse);
JSONObject jsonObject = JSONObject.parseObject(string);
QueryOrderByIdResponseDto responseDto = jsonObject.toJavaObject(QueryOrderByIdResponseDto.class);
if (!RESPONSE_SUCCESS_CODE.equals(responseDto.getErrcode()) || responseDto.getData() == null) {
return ResponseUtil.error(ResponseResult.ORDER_QUERYORDER_ERROR);
}
OrderBean orderBean = responseDto.getData();
if (!PayStatus.NOT_PAY.getCode().equals(orderBean.getPayStatus())) {
return ResponseUtil.error(ResponseResult.ORDER_DELETE_ERROR.getCode(), "订单状态不允许取消");
}
if (!OrderStatus.WAIT_PAY.getCode().equals(orderBean.getStatus())) {
return ResponseUtil.error(ResponseResult.ORDER_DELETE_ERROR.getCode(), "订单状态不允许取消");
}
//
CancelOrderRequest var1 = new CancelOrderRequest();
var1.setOrderId(deleteOrderVo.getOid());
var1.setPartnerId(deleteOrderVo.getPartnerId());
var1.setAfterSalesType(AfterSalesType.SYSTEM_CANCEL);
var1.setReason(null);
var1.setTrackingNo(LogTreadLocal.getTrackingNo());
var1.setRefundSerialNo(null);
var1.setReqRemark("未支付取消");
var1.setOperator("admin");
//若为4,默认做【创建】+【同意并退款完成】,售后单状态为【完成】
var1.setCreateEvent(4);
BaseOrderResponse baseOrderResponse = orderCenterSdkService.orderCancel(var1);
if (!RESPONSE_SUCCESS_CODE.equals(baseOrderResponse.getErrcode())) {
return ResponseUtil.error(ResponseResult.ORDER_CANCEL_ERROR.getCode(),baseOrderResponse.getErrmsg());
}
// TODO: 2019/9/10 删除订单通知
backOrdersStatusChange(orderBean.getOid(), orderBean.getStatus());
return ResponseUtil.success();
}
@Override
public BaseResponse deleteOrderById(DeleteOrderVo deleteOrderVo) {
if (StringUtils.isBlank(deleteOrderVo.getOid())) {
return ResponseUtil.error(ResponseResult.PARAMETER_MISSING.getCode(), "oid不能为空");
......@@ -1533,7 +1579,7 @@ public class OrderServiceImpl implements Orderservice {
DeleteOrderRequest var1 = new DeleteOrderRequest();
var1.setOrderId(deleteOrderDto.getOrderId());
var1.setTrackingNo(LogTreadLocal.getTrackingNo());
var1.setOperator("未支付删除");
var1.setOperator("未支付取消");
BaseOrderResponse baseOrderResponse = orderCenterSdkService.deleteOrder(var1);
if (!RESPONSE_SUCCESS_CODE.equals(baseOrderResponse.getErrcode())) {
......@@ -2301,6 +2347,10 @@ public class OrderServiceImpl implements Orderservice {
return ResponseUtil.success(createOrderResponse);
} else {
//如果是商品券支付0元,调用回调接口
/**
* - 老的svc卡或是0元订单下单成功直接核销 这里不处理
* - 混合支付纯svc支付 需要直接内部核销 其他支付方式需依靠外部回调
*/
PaysuccessNoticeMessage message = new PaysuccessNoticeMessage();
message.setResult_code(100);
message.setOut_trade_no(createOrderResponse.getFmId());
......@@ -2309,6 +2359,10 @@ public class OrderServiceImpl implements Orderservice {
message.setOpenid(createPrepayRequestDto.getOpenId());
message.setPlatform_coupon(0);
message.setMerchant_coupon(0);
message.setSource(PaySuccessSource.INSIDE.getSource());
if (StringUtils.isNotBlank(orderPayResponse.getPayMode()) && PayChannelType.SVC.getEbcode().equals(orderPayResponse.getPayMode())) {
message.setSource(PaySuccessSource.OUTSIDE.getSource());
}
orderAdapterService.paySuccessCallback(message);
return ResponseUtil.success(createOrderResponse);
}
......@@ -3199,7 +3253,7 @@ public class OrderServiceImpl implements Orderservice {
String ebCode = this.getPayCodeByChanel(paymentRequest.getWxAppId(), channel, storeId);
OrderPayResponse orderPayResponse = new OrderPayResponse();;
if (StringUtils.isBlank(ebCode)) {
orderPayResponse.setMsg("渠道码没有配置");
orderPayResponse.setMsg("请先联系相关人员配置商户对应的支付渠道");
return orderPayResponse;
}
......@@ -3236,7 +3290,7 @@ public class OrderServiceImpl implements Orderservice {
.orElse(null);
//现金+svc 现金
if (payPlatforms.size()==2 || payPlatforms.size()==1 && cashPay!=null) {
if (payPlatforms.size()==2 || (payPlatforms.size()==1 && cashPay!=null)) {
orderPayResponse = orderAdapter.convent2OrderCombPayResponse(combPayResponse.getData().getPayPlatformResponseList(),orderBean.getCompanyId(),storeId);
orderPayResponse.setOpenId(paymentRequest.getOpenId());
orderPayResponse.setWxAppid(paymentRequest.getWxAppId());
......
......@@ -45,7 +45,7 @@
<dependency>
<groupId>cn.freemud</groupId>
<artifactId>assortment-shoppingcart-sdk</artifactId>
<version>1.1.6.RELEASE</version>
<version>1.1.7.RELEASE</version>
</dependency>
<!-- 再来一单查询订单信息 -->
<dependency>
......
......@@ -332,6 +332,10 @@ public class ActivityCalculationDiscountResponseDto {
@Data
public static class SendGoods {
/**
* 买一赠一时,存赠送主商品的cartGoodsUid 用于标记是那个商品送的
*/
private String originalGoodsUid;
/**
* 赠送商品ID
*/
private String goodsId;
......
......@@ -95,6 +95,7 @@ public enum ResponseResult {
SHOPPING_CART_HG_COUPON_NOT_EXIST("44027", "换购券不存在"),
SHOPPING_CART_LIMIT_ADD("44025", "加购数量超过限制"),
SHOPPING_CART_GOODS_CHECK_ERROR("44028", "当前餐盘中没有可用券的饮品"),
SHOPPING_CART_NO_MEAL("44029", "请至少选择一个可选商品"),
/**
* 订单状态码
......
......@@ -237,13 +237,12 @@ public class BuySendPromotionService implements IPromotionService {
}
if (manyOrSingle) {
// 多规格
if (!Objects.equals(sendGoodsMap.get(cartGood.getSkuId()).getGoodsId(), cartGood.getSkuId())) {
if (!Objects.equals(sendGoodsMap.get(cartGood.getSkuId()).getOriginalGoodsUid(), cartGood.getCartGoodsUid())) {
return;
}
} else {
// 单品
List<String> spuIds = newCartGoodsList.stream().map(CartGoods::getSpuId).collect(Collectors.toList());
if (spuIds.contains(cartGood.getSpuId())) {
if (!Objects.equals(sendGoodsMap.get(cartGood.getSpuId()).getOriginalGoodsUid(), cartGood.getCartGoodsUid())) {
return;
}
}
......
......@@ -951,6 +951,14 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
}
}
}
if (GoodsTypeEnum.SET_MEAL_GOODS.getGoodsType().equals(cartGoods.getGoodsType())) {
if (CollectionUtils.isEmpty(cartGoods.getProductGroupList()) && CollectionUtils.isEmpty(cartGoods.getProductComboList())) {
cartGoodsList.remove(i);
assortmentSdkService.setShoppingCart(partnerId, storeId, userId, cartGoodsList, null, null, this.shoppingCartBaseService);
throw new ServiceException(ResponseResult.SHOPPING_CART_NO_MEAL);
}
}
}
// 当加价购商品不为空时
if (CollectionUtils.isNotEmpty(sendGoodsList)) {
......
......@@ -334,7 +334,12 @@ public class CalculationCommonService {
if (cartGoods.isWeightType()) {
cartGoodsDetailDto.setProductType(ProductType.WEIGHT_PRODUCT.getCode());
}
cartGoodsDetailDto.setOriginalPrice(cartGoods.getOriginalPrice());
if (calculationGoods!=null) {
cartGoodsDetailDto.setOriginalPrice(calculationGoods.getOriginalPrice());
}
else {
cartGoodsDetailDto.setOriginalPrice(cartGoods.getOriginalPrice());
}
if (calculationGoods!=null) {
cartGoodsDetailDto.setTotalDiscountAmount(calculationGoods.getDiscountAmount().intValue());
//cartGoodsDetailDto.setOriginalPrice(calculationGoods.getOriginalPrice());
......@@ -418,6 +423,7 @@ public class CalculationCommonService {
originalPriceSum += goodsDetailDto.getOriginalPrice() * (goodsDetailDto.getQty() / cartGoods.getQty());
//originalPriceSum += goodsDetailDto.getOriginalPrice() * goodsDetailDto.getQty();
}
cartGoodsDetailDto.setProductType(ProductType.SETMEAL.getCode());
cartGoodsDetailDto.setOriginalPrice(cartGoodsDetailDto.getOriginalPrice() + originalPriceSum);
}
cartGoodsDetailDto.setComboProducts(combs);
......
......@@ -120,6 +120,15 @@ public class CalculationSharingDiscountService {
}
}
}
if (GoodsTypeEnum.SET_MEAL_GOODS.getGoodsType().equals(cartGoods.getGoodsType())) {
if (CollectionUtils.isEmpty(cartGoods.getProductGroupList()) && CollectionUtils.isEmpty(cartGoods.getProductComboList())) {
cartGoodsList.remove(i);
assortmentSdkService.setShoppingCart(partnerId, storeId, userId, cartGoodsList, null, null, this.shoppingCartBaseService);
throw new ServiceException(ResponseResult.SHOPPING_CART_NO_MEAL);
}
}
}
/*加价购商品不为空*/
......
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