|
|
|
@ -7,7 +7,6 @@
|
|
|
|
|
* 一经发现盗用、分享等行为,将追究法律责任,后果自负 |
|
|
|
|
*/ |
|
|
|
|
package co.yixiang.modules.order.service.impl; |
|
|
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil; |
|
|
|
|
import cn.hutool.core.date.DateUtil; |
|
|
|
|
import cn.hutool.core.util.IdUtil; |
|
|
|
@ -35,6 +34,7 @@ import co.yixiang.modules.activity.service.YxStoreBargainUserService;
|
|
|
|
|
import co.yixiang.modules.activity.service.YxStoreCouponUserService; |
|
|
|
|
import co.yixiang.modules.activity.service.YxStorePinkService; |
|
|
|
|
import co.yixiang.modules.activity.vo.StoreCouponUserVo; |
|
|
|
|
import co.yixiang.modules.cart.domain.YxStoreBrandCart; |
|
|
|
|
import co.yixiang.modules.cart.domain.YxStoreCart; |
|
|
|
|
import co.yixiang.modules.cart.service.YxStoreCartService; |
|
|
|
|
import co.yixiang.modules.cart.service.mapper.StoreCartMapper; |
|
|
|
@ -100,6 +100,8 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
|
import java.io.IOException; |
|
|
|
|
import java.lang.reflect.Array; |
|
|
|
|
import java.lang.reflect.Field; |
|
|
|
|
import java.math.BigDecimal; |
|
|
|
|
import java.util.*; |
|
|
|
|
import java.util.concurrent.TimeUnit; |
|
|
|
@ -199,15 +201,34 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
|
|
|
|
@Override |
|
|
|
|
public ConfirmOrderVo confirmOrder(YxUser yxUser, String cartIds) { |
|
|
|
|
Long uid = yxUser.getUid(); |
|
|
|
|
Map<String, Object> cartGroup = yxStoreCartService.getUserProductCartList(uid, |
|
|
|
|
Map<String, ArrayList> cartGroup = yxStoreCartService.getUserProductCartList(uid, |
|
|
|
|
cartIds, ShopConstants.ZSW_ONE_NUM); |
|
|
|
|
if (ObjectUtil.isNotEmpty(cartGroup.get("invalid"))) { |
|
|
|
|
throw new YshopException("有失效的商品请重新提交"); |
|
|
|
|
} |
|
|
|
|
if (ObjectUtil.isEmpty(cartGroup.get("valid"))) { |
|
|
|
|
throw new YshopException("请提交购买的商品"); |
|
|
|
|
} |
|
|
|
|
List<YxStoreCartQueryVo> list = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
cartGroup.get("cartList").forEach(item->{ |
|
|
|
|
YxStoreBrandCart yxStoreBrandCart=(YxStoreBrandCart)item; |
|
|
|
|
if (ObjectUtil.isNotEmpty(yxStoreBrandCart.getInvalidProductList())) { |
|
|
|
|
throw new YshopException("有失效的商品请重新提交"); |
|
|
|
|
} |
|
|
|
|
if (ObjectUtil.isEmpty(yxStoreBrandCart.getValidProductList())) { |
|
|
|
|
throw new YshopException("请提交购买的商品"); |
|
|
|
|
} |
|
|
|
|
list.addAll(yxStoreBrandCart.getValidProductList()); |
|
|
|
|
// Class jsonClass = item.getClass();//通过item,获取运行时类的对象
|
|
|
|
|
// Field invalidProductList = null;
|
|
|
|
|
// Field validProductList = null;
|
|
|
|
|
// try {
|
|
|
|
|
// //获取item中的invalidProductList属性
|
|
|
|
|
// if (ObjectUtil.isNotEmpty(item.getClass().getDeclaredField("invalidProductList"))) {
|
|
|
|
|
// throw new YshopException("有失效的商品请重新提交");
|
|
|
|
|
// }
|
|
|
|
|
// if (ObjectUtil.isEmpty(item.getClass().getDeclaredField("validProductList"))) {
|
|
|
|
|
// throw new YshopException("请提交购买的商品");
|
|
|
|
|
// }
|
|
|
|
|
// } catch (NoSuchFieldException e) {
|
|
|
|
|
// e.printStackTrace();
|
|
|
|
|
// }
|
|
|
|
|
}); |
|
|
|
|
OtherDto other = new OtherDto(); |
|
|
|
|
other.setIntegralRatio(systemConfigService.getData(SystemConfigConstants.INTERGRAL_RATIO)); |
|
|
|
|
other.setIntegralFull(systemConfigService.getData(SystemConfigConstants.INTERGRAL_FULL)); |
|
|
|
@ -238,7 +259,8 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
|
|
|
|
.eq(YxUserAddress::getUid, uid) |
|
|
|
|
.eq(YxUserAddress::getIsDefault, ShopCommonEnum.DEFAULT_1.getValue()), false); |
|
|
|
|
|
|
|
|
|
List<YxStoreCartQueryVo> cartInfo = (List<YxStoreCartQueryVo>) cartGroup.get("valid"); |
|
|
|
|
// List<YxStoreCartQueryVo> cartInfo = (List<YxStoreCartQueryVo>) cartGroup.get("valid");
|
|
|
|
|
List<YxStoreCartQueryVo> cartInfo=list; |
|
|
|
|
PriceGroupDto priceGroup = this.getOrderPriceGroup(cartInfo, userAddress); |
|
|
|
|
|
|
|
|
|
//判断积分是否满足订单额度
|
|
|
|
@ -247,8 +269,6 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
String cacheKey = this.cacheOrderInfo(uid, cartInfo, priceGroup, other); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//获取可用优惠券
|
|
|
|
|
List<String> productIds = cartInfo.stream() |
|
|
|
|
.map(YxStoreCartQueryVo::getProductId) |
|
|
|
|