|
|
@@ -1079,7 +1079,7 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
|
|
|
}
|
|
|
String json = configService.selectConfigByKey("store.config");
|
|
|
StoreConfig config= JSONUtil.toBean(json, StoreConfig.class);
|
|
|
-
|
|
|
+
|
|
|
//卓美商城正常下单
|
|
|
if(hisStoreConfig != null && Boolean.TRUE.equals(hisStoreConfig.getEnableOrderSalesBinding())){
|
|
|
//绑定销售
|
|
|
@@ -1366,7 +1366,7 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
|
|
|
Integer orderType = param.getOrderType();
|
|
|
int activityDeductNum = 1; // Redis库存扣减数量(仅秒杀/限时折扣使用,异常时用于回滚)
|
|
|
Long reservedGroupBuyId = null; // 团购下单阶段预占到的团ID,异常时用于释放名额
|
|
|
-
|
|
|
+
|
|
|
//活动参数校验(6=秒杀 7=限时折扣 8=限时团购)
|
|
|
if (orderType == null || (orderType != 6 && orderType != 7 && orderType != 8)) {
|
|
|
return R.error("无效的活动类型");
|
|
|
@@ -1451,13 +1451,13 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
|
|
|
param.setCompanyId(fsUserCompanyUser.getCompanyId());
|
|
|
param.setCompanyUserId(fsUserCompanyUser.getCompanyUserId());
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
if (!CloudHostUtils.hasCloudHostName("鹤颜堂")){
|
|
|
if (ObjectUtil.isEmpty(param.getAddressId())){
|
|
|
return R.error("地址不能为空!");
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
FsStoreOrderComputedParam computedParam = new FsStoreOrderComputedParam();
|
|
|
BeanUtils.copyProperties(param, computedParam);
|
|
|
//计算金额
|
|
|
@@ -1504,7 +1504,7 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
|
|
|
}
|
|
|
String json = configService.selectConfigByKey("store.config");
|
|
|
StoreConfig config= JSONUtil.toBean(json, StoreConfig.class);
|
|
|
-
|
|
|
+
|
|
|
//绑定销售
|
|
|
if(hisStoreConfig != null && Boolean.TRUE.equals(hisStoreConfig.getEnableOrderSalesBinding())){
|
|
|
FsUserScrm fsuser= userService.selectFsUserById(userId);
|
|
|
@@ -1527,7 +1527,7 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
CompanyUserUser map=new CompanyUserUser();
|
|
|
map.setCompanyUserId(param.getCompanyUserId());
|
|
|
map.setUserId(userId);
|
|
|
@@ -1539,7 +1539,7 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
|
|
|
companyUserUserMapper.insertCompanyUserUser(map);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
storeOrder.setUserId(userId);
|
|
|
storeOrder.setOrderCode(orderSn);
|
|
|
if (ObjectUtil.isNotEmpty(address)){
|
|
|
@@ -1552,7 +1552,7 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
|
|
|
storeOrder.setTotalNum(Long.parseLong(String.valueOf(carts.size())));
|
|
|
storeOrder.setTotalPrice(dto.getTotalPrice());
|
|
|
storeOrder.setTotalPostage(dto.getPayPostage());
|
|
|
-
|
|
|
+
|
|
|
//优惠券处理
|
|
|
if (param.getCouponUserId() != null) {
|
|
|
FsStoreCouponUserScrm couponUser = couponUserService.selectFsStoreCouponUserById(param.getCouponUserId());
|
|
|
@@ -1593,11 +1593,11 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
|
|
|
storeOrder.setIsChannel(1);
|
|
|
storeOrder.setShippingType(1);
|
|
|
storeOrder.setCreateTime(new Date());
|
|
|
-
|
|
|
+
|
|
|
if (config.getServiceFee() != null) {
|
|
|
storeOrder.setServiceFee(config.getServiceFee());
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
//后台制单处理
|
|
|
if (param.getPayPrice() != null && param.getPayPrice().compareTo(BigDecimal.ZERO) > 0) {
|
|
|
if (param.getPayPrice().compareTo(dto.getTotalPrice()) > 0) {
|
|
|
@@ -1607,7 +1607,7 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
|
|
|
} else {
|
|
|
storeOrder.setPayPrice(dto.getPayPrice());
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
//付款方式
|
|
|
if (param.getPayType().equals("1") || param.getPayType().equals("99")) {
|
|
|
storeOrder.setStatus(0);
|
|
|
@@ -1658,7 +1658,7 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
|
|
|
storeOrder.setOrderType(param.getOrderType());
|
|
|
storeOrder.setOrderMedium(param.getOrderMedium());
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
//活动商品只扣Redis(已在上文扣减),DB延后扣减
|
|
|
// storeOrder.setAssociatedId
|
|
|
storeOrder.setAssociatedId(associatedId);
|
|
|
@@ -1670,10 +1670,10 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
|
|
|
if (flag == 0) {
|
|
|
return R.error("订单创建失败");
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
// 活动商品:订单创建成功后,同步扣减DB中的商品规格库存和销量(与普通下单一致)
|
|
|
this.deStockIncSale(carts);
|
|
|
-
|
|
|
+
|
|
|
if (!isPay && storeOrder.getCompanyId() != null) {
|
|
|
addOrderAudit(storeOrder);
|
|
|
}
|
|
|
@@ -1681,7 +1681,7 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
|
|
|
if (dto.getUsedIntegral() > 0) {
|
|
|
this.decIntegral(userId, dto.getUsedIntegral(), dto.getDeductionPrice(), storeOrder.getId().toString());
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
//保存OrderItem
|
|
|
List<FsStoreOrderItemScrm> listOrderItem = new ArrayList<>();
|
|
|
for (FsStoreCartQueryVO vo : carts) {
|
|
|
@@ -1723,17 +1723,17 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
|
|
|
}
|
|
|
//购物车状态修改
|
|
|
cartMapper.updateIsPay(cartIds);
|
|
|
-
|
|
|
+
|
|
|
//删除缓存
|
|
|
redisCache.deleteObject("orderKey:" + param.getOrderKey());
|
|
|
if (config.getIsBrushOrders() == null || !(config.getIsBrushOrders() && param.getCompanyUserId() != null)) {
|
|
|
redisCache.deleteObject("orderCarts:" + param.getOrderKey());
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
//添加记录
|
|
|
orderStatusService.create(storeOrder.getId(), OrderLogEnum.CREATE_ORDER.getValue(),
|
|
|
OrderLogEnum.CREATE_ORDER.getDesc());
|
|
|
-
|
|
|
+
|
|
|
//加入redis,24小时自动取消
|
|
|
String redisKey = String.valueOf(StrUtil.format("{}{}",
|
|
|
StoreConstants.REDIS_ORDER_OUTTIME_UNPAY, storeOrder.getId()));
|
|
|
@@ -7048,25 +7048,37 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
|
|
|
* @return
|
|
|
*/
|
|
|
public FsStoreOrderScrm buildPayment(FsIntegralOrderDoPayParam param){
|
|
|
- if(param.getType().equals("live")){
|
|
|
- LiveOrder liveOrder = liveOrderMapper.selectLiveOrderByOrderId(String.valueOf(param.getOrderId()));
|
|
|
- if (ObjectUtil.isNotEmpty(liveOrder)){
|
|
|
- FsStoreOrderScrm orderScrm = new FsStoreOrderScrm();
|
|
|
- BeanUtils.copyProperties(liveOrder,orderScrm);
|
|
|
- orderScrm.setId(liveOrder.getOrderId());
|
|
|
- orderScrm.setUserId(Long.valueOf(liveOrder.getUserId()));
|
|
|
- orderScrm.setIsLive(true);
|
|
|
- return orderScrm;
|
|
|
- }
|
|
|
+// if(param.getType().equals("live")){
|
|
|
+// LiveOrder liveOrder = liveOrderMapper.selectLiveOrderByOrderId(String.valueOf(param.getOrderId()));
|
|
|
+// if (ObjectUtil.isNotEmpty(liveOrder)){
|
|
|
+// FsStoreOrderScrm orderScrm = new FsStoreOrderScrm();
|
|
|
+// BeanUtils.copyProperties(liveOrder,orderScrm);
|
|
|
+// orderScrm.setId(liveOrder.getOrderId());
|
|
|
+// orderScrm.setUserId(Long.valueOf(liveOrder.getUserId()));
|
|
|
+// orderScrm.setIsLive(true);
|
|
|
+// return orderScrm;
|
|
|
+// }
|
|
|
+// }
|
|
|
+// if (param.getType().equals("store")){
|
|
|
+// FsStoreOrderScrm order = fsStoreOrderMapper.selectFsStoreOrderById(param.getOrderId());
|
|
|
+// if (ObjectUtil.isNotEmpty(order)){
|
|
|
+// return order;
|
|
|
+// }
|
|
|
+// }
|
|
|
+
|
|
|
+ FsStoreOrderScrm order = fsStoreOrderMapper.selectFsStoreOrderById(param.getOrderId());
|
|
|
+
|
|
|
+ if (ObjectUtil.isEmpty(order)){
|
|
|
+ log.error("订单不存在,orderId: {}, type: {}", param.getOrderId(), param.getType());
|
|
|
+ return null;
|
|
|
}
|
|
|
- if (param.getType().equals("store")){
|
|
|
- FsStoreOrderScrm order = fsStoreOrderMapper.selectFsStoreOrderById(param.getOrderId());
|
|
|
- if (ObjectUtil.isNotEmpty(order)){
|
|
|
- return order;
|
|
|
- }
|
|
|
+
|
|
|
+ if ("live".equals(param.getType())){
|
|
|
+ order.setIsLive(true);
|
|
|
+ return order;
|
|
|
}
|
|
|
|
|
|
- return null;
|
|
|
+ return order;
|
|
|
}
|
|
|
|
|
|
|