Commit 99a0e2ca by xiaoer.li@freemud.com

fix

parent 5c9a0c0b
......@@ -3188,14 +3188,20 @@ public class OrderAdapter {
Object value = redisCache.hashGet(hashKey, type);
JSONArray jsonArray = value != null ? JSONArray.parseArray(value.toString()) : new JSONArray();
if(null != jsonArray && jsonArray.size() >0){
for(int i=0;i<jsonArray.size();i++){
for (int i = 0; i < jsonArray.size(); i++) {
JSONObject jsonObject = (JSONObject) jsonArray.get(i);
jsonObject.remove("@type");
}
}
return (value != null ? JSONObject.parseArray(jsonArray.toString(), AssortmentOpenPlatformPartnerWxappConfig.class) : new ArrayList());
return (value != null ? JSONObject.parseArray(jsonArray.toString(), AssortmentOpenPlatformPartnerWxappConfig.class) : new ArrayList());
} else {
return new ArrayList();
}
}
public DeleteOrderDto convent2DeleteOrderDto(String oId) {
DeleteOrderDto deleteOrderDto = new DeleteOrderDto();
deleteOrderDto.setOrderId(oId);
return deleteOrderDto;
}
}
......@@ -217,6 +217,15 @@ public class OrderController {
}
/**
* 取消支付删除订单
*/
@ApiAnnotation(logMessage = "deleteOrderById")
@PostMapping("/deleteOrderById")
public BaseResponse deleteOrderById(@Validated @LogParams @RequestBody DeleteOrderVo deleteOrderVo) {
return orderservice.deleteOrderById(deleteOrderVo);
}
/**
* 用户申请退款
*/
@ApiAnnotation(logMessage = "refund")
......
......@@ -55,7 +55,7 @@ public interface Orderservice {
* @param oid 订单ID
* @return
*/
BaseResponse queryOrderById(Integer operation,String sessionId, String oid, String partnerId,String channel);
BaseResponse queryOrderById(Integer operation, String sessionId, String oid, String partnerId, String channel);
/**
* 支付取消删除订单
......@@ -63,6 +63,11 @@ public interface Orderservice {
BaseResponse deleteOrder(DeleteOrderVo deleteOrderVo);
/**
* 支付取消删除订单
*/
BaseResponse deleteOrderById(DeleteOrderVo deleteOrderVo);
/**
* 订单申请退款
*/
BaseResponse orderRefund(OrderRefundVo orderRefundVo);
......
......@@ -1477,6 +1477,44 @@ public class OrderServiceImpl implements Orderservice {
}
@Override
public BaseResponse deleteOrderById(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(), "订单状态不允许删除");
}
DeleteOrderDto deleteOrderDto = orderAdapter.convent2DeleteOrderDto(deleteOrderVo.getOid());
//
DeleteOrderRequest var1 = new DeleteOrderRequest();
var1.setOrderId(deleteOrderDto.getOrderId());
var1.setTrackingNo(LogTreadLocal.getTrackingNo());
var1.setOperator("未支付删除");
BaseOrderResponse baseOrderResponse = orderCenterSdkService.deleteOrder(var1);
if (!RESPONSE_SUCCESS_CODE.equals(baseOrderResponse.getErrcode())) {
return ResponseUtil.error(ResponseResult.ORDER_DELETE_ERROR);
}
// TODO: 2019/9/10 删除订单通知
backOrdersStatusChange(orderBean.getOid(), orderBean.getStatus());
return ResponseUtil.success();
}
@Override
public BaseResponse orderRefund(OrderRefundVo orderRefundVo) {
if (StringUtils.isEmpty(orderRefundVo.getReason())) {
orderRefundVo.setReason("退款");
......
package cn.freemud.entities.dto;
import cn.freemud.entities.vo.CartGoods;
import lombok.Data;
import java.util.List;
@Data
public class CheckSpqInfoResponseDto {
private String spuId;
......@@ -26,4 +29,7 @@ public class CheckSpqInfoResponseDto {
private String couponCode;
private Long price;
private String picture;
private String defaultSpecId;
private String defaultSpecName;
private List<CartGoods.CartGoodsExtra> extras;
}
......@@ -45,4 +45,7 @@ public class GetProductsVo {
* 分类名称
*/
private String categoryName;
private String defaultSpecId;
private String defaultSpecName;
private List<CartGoods.CartGoodsExtra> extra;
}
\ No newline at end of file
......@@ -91,6 +91,9 @@ public class CouponPromotionService implements IPromotionService {
cartGoods.setQty(1);
cartGoods.setCouponCode(checkSpqInfoResponseDto.getCouponCode());
cartGoods.setSpuName(checkSpqInfoResponseDto.getSpuName());
cartGoods.setSpecProductId(checkSpqInfoResponseDto.getDefaultSpecId());
cartGoods.setSpuName(checkSpqInfoResponseDto.getDefaultSpecName());
cartGoods.setExtra(checkSpqInfoResponseDto.getExtras());
if (GoodsTypeEnum.HG_COUPON_GOODS.getGoodsType().equals(cartGoods.getGoodsType())) {
ActivityCalculationDiscountResponseDto.CalculationDiscountResult.Goods discountGoods = calculationDiscountResult.getGoods()
.stream()
......
......@@ -757,6 +757,9 @@ public class CouponServiceImpl implements CouponService {
dto.setSkuId(productsVo.getSkuId());
dto.setSkuName(StringUtils.isNotBlank(productsVo.getSkuName()) ? productsVo.getSkuName() : productsVo.getSpuName());
dto.setPicture(productsVo.getSpuPicture());
dto.setDefaultSpecName(productsVo.getDefaultSpecName());
dto.setDefaultSpecId(productsVo.getDefaultSpecId());
dto.setExtras(productsVo.getExtra());
log.info("dto***" + dto);
return dto;
}
......
......@@ -18,6 +18,7 @@ import cn.freemud.base.entity.BaseResponse;
import cn.freemud.constant.ResponseCodeConstant;
import cn.freemud.entities.dto.*;
import cn.freemud.entities.dto.GetMenuResponseDto.DataBean.RootNodeBean.ChildrenBeanFirst.ChildrenBeanSecond.ProductBean;
import cn.freemud.entities.vo.CartGoods;
import cn.freemud.entities.vo.GetProductsVo;
import cn.freemud.enums.ProductInfoType;
import cn.freemud.enums.ResponseResult;
......@@ -32,6 +33,7 @@ import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.gson.Gson;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -202,6 +204,24 @@ public class ItemServiceImpl implements ItemService {
? product.getProductPictureList().get(0).getUrl() : product.getPicture();
getProductsVo.setSpuPicture(picture);
//getProductsVo.setStatus(product.getStatus());
if (CollectionUtils.isNotEmpty(product.getProductPictureList())
&& CollectionUtils.isNotEmpty(product.getProductAttributeGroupList().get(0).getAttributeValues())) {
List<CartGoods.CartGoodsExtra> extras = new ArrayList<>();
List<String> specId = new ArrayList<>();
List<String> specName = new ArrayList<>();
for (ProductListDto.DataBean.ProductAttributeGroupListBean bean : product.getProductAttributeGroupList()) {
for (ProductListDto.DataBean.ProductAttributeGroupListBean.AttributeValueBean attr : bean.getAttributeValues()) {
CartGoods.CartGoodsExtra extra = new CartGoods.CartGoodsExtra();
extra.setAttributeId(attr.getAttributeId());
extra.setAttributeName(attr.getAttributeValue());
specName.add(attr.getAttributeValue());
specId.add(attr.getAttributeId());
}
}
getProductsVo.setExtra(extras);
getProductsVo.setDefaultSpecName(StringUtils.join(specName, "/"));
getProductsVo.setDefaultSpecId(StringUtils.join(specId, "/"));
}
resultMap.put(skuProductBean.getSkuId(), getProductsVo);
}
});
......
......@@ -765,7 +765,12 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
if (checkSpqInfoResponseDto == null) {
cartGoodsList.remove(i);
assortmentSdkService.setShoppingCart(partnerId, storeId, userId, cartGoodsList, null, null, this.shoppingCartBaseService);
throw new ServiceException(ResponseResult.SHOPPING_CART_COUPON_NOT_EXIST);
if (GoodsTypeEnum.HG_COUPON_GOODS.getGoodsType().equals(cartGoods.getGoodsType())) {
throw new ServiceException(ResponseResult.SHOPPING_CART_HG_COUPON_NOT_EXIST);
} else {
throw new ServiceException(ResponseResult.SHOPPING_CART_COUPON_NOT_EXIST);
}
}
validCouponMap.put(spqId, checkSpqInfoResponseDto);
cartGoods.setName(checkSpqInfoResponseDto.getCouponName());
......
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