mirror of
https://github.com/weizhiqiang1995/erp-pro.git
synced 2024-12-27 01:52:13 +08:00
feat: 订单查询规格信息改为从商城拿取
This commit is contained in:
parent
1ea56a2f68
commit
0ddc86f819
4 changed files with 18 additions and 16 deletions
|
@ -74,7 +74,7 @@ public class OrderItem extends OperatorUserInfo {
|
|||
private Integer count;
|
||||
|
||||
@TableField("comment_state")
|
||||
@Property(value = "是否评价",enumClass = WhetherEnum.class)
|
||||
@Property(value = "是否评价", enumClass = WhetherEnum.class)
|
||||
private Integer commentState;
|
||||
|
||||
@TableField("price")
|
||||
|
|
|
@ -118,7 +118,7 @@ public class OrderItemServiceImpl extends SkyeyeBusinessServiceImpl<OrderItemDao
|
|||
}
|
||||
|
||||
@Override
|
||||
public void updateCommentStateById(String id){
|
||||
public void updateCommentStateById(String id) {
|
||||
UpdateWrapper<OrderItem> updateWrapper = new UpdateWrapper<>();
|
||||
updateWrapper.eq(CommonConstants.ID, id)
|
||||
.set(MybatisPlusUtil.toColumns(OrderItem::getCommentState), WhetherEnum.ENABLE_USING.getKey());
|
||||
|
@ -135,7 +135,7 @@ public class OrderItemServiceImpl extends SkyeyeBusinessServiceImpl<OrderItemDao
|
|||
@Override
|
||||
public void UpdateOrderItemState(String orderItemId) {
|
||||
OrderItem orderItem = selectById(orderItemId);
|
||||
if (orderItem.getOrderItemState().equals(CommonNumConstants.NUM_TWO)){
|
||||
if (orderItem.getOrderItemState().equals(CommonNumConstants.NUM_TWO)) {
|
||||
throw new CustomException("该订单已收货");
|
||||
}
|
||||
UpdateWrapper<OrderItem> updateWrapper = new UpdateWrapper<>();
|
||||
|
|
|
@ -13,8 +13,10 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.google.common.base.Joiner;
|
||||
import com.skyeye.annotation.service.SkyeyeService;
|
||||
import com.skyeye.base.business.service.impl.SkyeyeBusinessServiceImpl;
|
||||
import com.skyeye.common.constans.CommonCharConstants;
|
||||
import com.skyeye.common.constans.CommonConstants;
|
||||
import com.skyeye.common.constans.CommonNumConstants;
|
||||
import com.skyeye.common.constans.QuartzConstants;
|
||||
|
@ -31,8 +33,6 @@ import com.skyeye.coupon.enums.PromotionDiscountType;
|
|||
import com.skyeye.coupon.enums.PromotionMaterialScope;
|
||||
import com.skyeye.coupon.service.CouponUseMaterialService;
|
||||
import com.skyeye.coupon.service.CouponUseService;
|
||||
import com.skyeye.erp.service.IMaterialNormsService;
|
||||
import com.skyeye.erp.service.IMaterialService;
|
||||
import com.skyeye.eve.rest.quartz.SysQuartzMation;
|
||||
import com.skyeye.eve.service.IAreaService;
|
||||
import com.skyeye.eve.service.IQuartzService;
|
||||
|
@ -47,6 +47,7 @@ import com.skyeye.order.enums.ShopOrderState;
|
|||
import com.skyeye.order.service.OrderItemService;
|
||||
import com.skyeye.order.service.OrderService;
|
||||
import com.skyeye.rest.pay.service.IPayService;
|
||||
import com.skyeye.rest.shopmaterialnorms.sevice.IShopMaterialNormsService;
|
||||
import com.skyeye.store.entity.ShopAddress;
|
||||
import com.skyeye.store.service.ShopAddressService;
|
||||
import com.skyeye.store.service.ShopTradeCartService;
|
||||
|
@ -79,10 +80,7 @@ public class OrderServiceImpl extends SkyeyeBusinessServiceImpl<OrderDao, Order>
|
|||
private IAreaService iAreaService;
|
||||
|
||||
@Autowired
|
||||
private IMaterialService iMaterialService;
|
||||
|
||||
@Autowired
|
||||
private IMaterialNormsService iMaterialNormsService;
|
||||
private IShopMaterialNormsService iShopMaterialNormsService;
|
||||
|
||||
@Autowired
|
||||
private CouponUseService couponUseService;
|
||||
|
@ -134,17 +132,21 @@ public class OrderServiceImpl extends SkyeyeBusinessServiceImpl<OrderDao, Order>
|
|||
checkAndSetVariable(order);
|
||||
// 活动信息及积分操作方法
|
||||
checkAndSetActive(order);
|
||||
refreshCache(order.getId());
|
||||
}
|
||||
|
||||
private void checkAndSetItemCouponUse(Order order) {// 子单的优惠券操作
|
||||
List<OrderItem> orderItemList = order.getOrderItemList();
|
||||
// 设置商品信息、商品规格信息和优惠券信息
|
||||
iMaterialNormsService.setDataMation(orderItemList, OrderItem::getNormsId);
|
||||
iMaterialService.setDataMation(orderItemList, OrderItem::getMaterialId);
|
||||
List<String> normsIdList = orderItemList.stream().map(OrderItem::getNormsId).collect(Collectors.toList());
|
||||
List<Map<String, Object>> normsListMap = iShopMaterialNormsService.queryShopMaterialByNormsIdList(Joiner.on(CommonCharConstants.COMMA_MARK).join(normsIdList));
|
||||
Map<String, String> normsPriceMap = normsListMap.stream()
|
||||
.collect(Collectors.toMap(map -> map.get("normsId").toString(), map -> map.get("salePrice").toString()));
|
||||
for (OrderItem orderItem : orderItemList) {// 计算每一个子单的总价
|
||||
if (!normsPriceMap.containsKey(orderItem.getNormsId())) {
|
||||
throw new CustomException("商城不存在normsId: " + orderItem.getNormsId());
|
||||
}
|
||||
// 获取子单单价 元 -> 分
|
||||
String salePrice = CalculationUtil.multiply(orderItem.getNormsMation().get("salePrice").toString(), "100");
|
||||
String salePrice = CalculationUtil.multiply(normsPriceMap.get(orderItem.getNormsId()), "100");
|
||||
// 设置子单总价
|
||||
String price = CalculationUtil.multiply(String.valueOf(orderItem.getCount()), salePrice, CommonNumConstants.NUM_SIX);
|
||||
orderItem.setPrice(price);
|
||||
|
@ -354,7 +356,7 @@ public class OrderServiceImpl extends SkyeyeBusinessServiceImpl<OrderDao, Order>
|
|||
ShopOrderState.COMPLETED.getKey(), // 已完成
|
||||
ShopOrderState.UNEVALUATE.getKey(), // 待评价
|
||||
ShopOrderState.EVALUATED.getKey()});// 已评价
|
||||
ShopOrderState.PARTIALLYDONE.getKey();//部分完成
|
||||
ShopOrderState.PARTIALLYDONE.getKey();//部分完成
|
||||
break;
|
||||
case "4":// 已取消
|
||||
stateList = Arrays.asList(new Integer[]{ShopOrderState.CANCELED.getKey()});
|
||||
|
@ -605,7 +607,7 @@ public class OrderServiceImpl extends SkyeyeBusinessServiceImpl<OrderDao, Order>
|
|||
orderItemService.UpdateOrderItemState(orderItemId);
|
||||
List<OrderItem> orderItemList = orderItemService.queryOrderItemByParentId(orderId);
|
||||
boolean allTwo = orderItemList.stream().map(OrderItem::getOrderItemState)
|
||||
.allMatch(orderItemState -> orderItemState == CommonNumConstants.NUM_TWO);
|
||||
.allMatch(orderItemState -> orderItemState == CommonNumConstants.NUM_TWO);
|
||||
if (allTwo) {
|
||||
Integer partiallydoneKey = ShopOrderState.COMPLETED.getKey();
|
||||
updateOrderState(orderId, partiallydoneKey);
|
||||
|
|
|
@ -65,6 +65,6 @@ public class ShopTradeCart extends OperatorUserInfo {
|
|||
private Integer count;
|
||||
|
||||
@TableField("selected")
|
||||
@ApiModelProperty(value = "是否选中", required = "required,num",enumClass = WhetherEnum.class)
|
||||
@ApiModelProperty(value = "是否选中", required = "required,num", enumClass = WhetherEnum.class)
|
||||
private Integer selected;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue