|
|
|
@ -35,6 +35,7 @@ import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
|
import java.math.BigDecimal; |
|
|
|
|
import java.math.RoundingMode; |
|
|
|
|
import java.util.*; |
|
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
@ -203,8 +204,6 @@ public class BsOrderServiceImpl implements BsOrderService { |
|
|
|
|
} |
|
|
|
|
return orderModels; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -264,13 +263,15 @@ public class BsOrderServiceImpl implements BsOrderService { |
|
|
|
|
// 根据订单号获取BsOrder对象
|
|
|
|
|
BsOrder bsOrder = list.stream().filter(s->s.getOrderNo().equals(orderListItem.getOrderSn())).findFirst().orElse(null); |
|
|
|
|
// 根据uid获取BsUser对象
|
|
|
|
|
BsUser user = userService.getUser(uid); |
|
|
|
|
BsUser user = userService.getUser(Long.valueOf(uid)); |
|
|
|
|
if (bsOrder == null) { |
|
|
|
|
// 如果BsOrder对象为空,则创建新的BsOrder对象
|
|
|
|
|
bsOrder = new BsOrder(); |
|
|
|
|
bsOrder.setOrderNo(orderListItem.getOrderSn()); |
|
|
|
|
bsOrder.setUserId(Long.valueOf(uid)); |
|
|
|
|
bsOrder.setUserPhone(user.getPhone()); |
|
|
|
|
if (user != null) { |
|
|
|
|
bsOrder.setUserPhone(user.getPhone() == null ? "" : user.getPhone()); |
|
|
|
|
} |
|
|
|
|
bsOrder.setCreateTime(new Date()); |
|
|
|
|
bsOrder.setUpdateTime(new Date()); |
|
|
|
|
bsOrder.setStatus(orderListItem.getOrderStatus()); |
|
|
|
@ -279,13 +280,26 @@ public class BsOrderServiceImpl implements BsOrderService { |
|
|
|
|
bsOrder.setGoodsName(orderListItem.getGoodsName()); |
|
|
|
|
bsOrder.setGoodsCount(Math.toIntExact(orderListItem.getGoodsQuantity())); |
|
|
|
|
bsOrder.setCustomparameters(orderListItem.getCustomParameters()); |
|
|
|
|
bsOrder.setTotalPrice(BigDecimal.valueOf(orderListItem.getOrderAmount())); |
|
|
|
|
bsOrder.setPromotionAmount(BigDecimal.valueOf(orderListItem.getPromotionAmount())); |
|
|
|
|
bsOrder.setPayTime(DateUtil.long2Date(orderListItem.getOrderPayTime())); |
|
|
|
|
bsOrder.setCreateTime(DateUtil.long2Date(orderListItem.getOrderCreateTime())); |
|
|
|
|
bsOrder.setFinishTime(DateUtil.long2Date(orderListItem.getOrderSettleTime())); |
|
|
|
|
bsOrder.setRefundTime(DateUtil.long2Date(orderListItem.getOrderModifyAt())); |
|
|
|
|
bsOrder.setCancelTime(DateUtil.long2Date(orderListItem.getOrderModifyAt())); |
|
|
|
|
bsOrder.setTotalPrice(BigDecimal.valueOf(orderListItem.getOrderAmount()).divide(new BigDecimal(100), 2, RoundingMode.HALF_UP)); |
|
|
|
|
bsOrder.setPromotionAmount(BigDecimal.valueOf(orderListItem.getPromotionAmount()).divide(new BigDecimal(100), 2, RoundingMode.HALF_UP)); |
|
|
|
|
if (orderListItem.getOrderPayTime() != null) { |
|
|
|
|
bsOrder.setPayTime(DateUtil.long2Date(orderListItem.getOrderPayTime()*1000)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (orderListItem.getOrderCreateTime() != null) { |
|
|
|
|
bsOrder.setCreateTime(DateUtil.long2Date(orderListItem.getOrderCreateTime()*1000)); |
|
|
|
|
} |
|
|
|
|
if (orderListItem.getOrderSettleTime() != null) { |
|
|
|
|
bsOrder.setFinishTime(DateUtil.long2Date(orderListItem.getOrderSettleTime()*1000)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (orderListItem.getOrderModifyAt() != null) { |
|
|
|
|
bsOrder.setRefundTime(DateUtil.long2Date(orderListItem.getOrderModifyAt()*1000)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (orderListItem.getOrderModifyAt() != null) { |
|
|
|
|
bsOrder.setCancelTime(DateUtil.long2Date(orderListItem.getOrderModifyAt()*1000)); |
|
|
|
|
} |
|
|
|
|
create(bsOrder); |
|
|
|
|
}else { |
|
|
|
|
// 如果BsOrder对象不为空,则更新BsOrder对象
|
|
|
|
@ -296,13 +310,27 @@ public class BsOrderServiceImpl implements BsOrderService { |
|
|
|
|
bsOrder.setGoodsName(orderListItem.getGoodsName()); |
|
|
|
|
bsOrder.setGoodsCount(Math.toIntExact(orderListItem.getGoodsQuantity())); |
|
|
|
|
bsOrder.setCustomparameters(orderListItem.getCustomParameters()); |
|
|
|
|
bsOrder.setTotalPrice(BigDecimal.valueOf(orderListItem.getOrderAmount())); |
|
|
|
|
bsOrder.setPromotionAmount(BigDecimal.valueOf(orderListItem.getPromotionAmount())); |
|
|
|
|
bsOrder.setPayTime(DateUtil.long2Date(orderListItem.getOrderPayTime())); |
|
|
|
|
bsOrder.setCreateTime(DateUtil.long2Date(orderListItem.getOrderCreateTime())); |
|
|
|
|
bsOrder.setFinishTime(DateUtil.long2Date(orderListItem.getOrderSettleTime())); |
|
|
|
|
bsOrder.setRefundTime(DateUtil.long2Date(orderListItem.getOrderModifyAt())); |
|
|
|
|
bsOrder.setCancelTime(DateUtil.long2Date(orderListItem.getOrderModifyAt())); |
|
|
|
|
bsOrder.setTotalPrice(BigDecimal.valueOf(orderListItem.getOrderAmount()).divide(new BigDecimal(100), 6, RoundingMode.HALF_UP)); |
|
|
|
|
bsOrder.setPromotionAmount(BigDecimal.valueOf(orderListItem.getPromotionAmount()).divide(new BigDecimal(100), 6, RoundingMode.HALF_UP)); |
|
|
|
|
if (orderListItem.getOrderPayTime() != null) { |
|
|
|
|
bsOrder.setPayTime(DateUtil.long2Date(orderListItem.getOrderPayTime()*1000)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (orderListItem.getOrderCreateTime() != null) { |
|
|
|
|
bsOrder.setCreateTime(DateUtil.long2Date(orderListItem.getOrderCreateTime()*1000)); |
|
|
|
|
} |
|
|
|
|
if (orderListItem.getOrderSettleTime() != null) { |
|
|
|
|
bsOrder.setFinishTime(DateUtil.long2Date(orderListItem.getOrderSettleTime()*1000)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (orderListItem.getOrderModifyAt() != null) { |
|
|
|
|
bsOrder.setRefundTime(DateUtil.long2Date(orderListItem.getOrderModifyAt()*1000)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (orderListItem.getOrderModifyAt() != null) { |
|
|
|
|
bsOrder.setCancelTime(DateUtil.long2Date(orderListItem.getOrderModifyAt()*1000)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 如果订单状态为5,则调用orderRebate方法
|
|
|
|
|
if (bsOrder.getStatus() == 5){ |
|
|
|
|
orderRebate(bsOrder); |
|
|
|
|