diff --git a/skyeye-shop/shop-common/src/main/java/com/skyeye/rest/pay/service/impl/IPayServiceImpl.java b/skyeye-shop/shop-common/src/main/java/com/skyeye/rest/pay/service/impl/IPayServiceImpl.java index 5d40c120..523869c9 100644 --- a/skyeye-shop/shop-common/src/main/java/com/skyeye/rest/pay/service/impl/IPayServiceImpl.java +++ b/skyeye-shop/shop-common/src/main/java/com/skyeye/rest/pay/service/impl/IPayServiceImpl.java @@ -8,6 +8,7 @@ import cn.hutool.json.JSONUtil; import com.skyeye.base.rest.service.impl.IServiceImpl; import com.skyeye.common.client.ExecuteFeignClient; import com.skyeye.common.object.ResultEntity; +import com.skyeye.common.util.CalculationUtil; import com.skyeye.rest.pay.rest.IPayRest; import com.skyeye.rest.pay.service.IPayService; import org.springframework.beans.factory.annotation.Autowired; @@ -32,6 +33,10 @@ public class IPayServiceImpl extends IServiceImpl implements IPayService { @Override public ResultEntity payment(Map data, String channelCode, String returnUrl, String channelExtras, String notifyUrl) { + // 支付金额单位转换为分 + String payPrice = data.get("payPrice").toString(); + payPrice = CalculationUtil.multiply(payPrice, "100"); + data.put("payPrice", payPrice); Map params = new HashMap<>(); params.put("data", JSONUtil.toJsonStr(data)); params.put("channelCode", channelCode); diff --git a/skyeye-shop/shop-store/src/main/java/com/skyeye/order/entity/OrderItem.java b/skyeye-shop/shop-store/src/main/java/com/skyeye/order/entity/OrderItem.java index ad0b0ec8..0e61b912 100644 --- a/skyeye-shop/shop-store/src/main/java/com/skyeye/order/entity/OrderItem.java +++ b/skyeye-shop/shop-store/src/main/java/com/skyeye/order/entity/OrderItem.java @@ -26,7 +26,7 @@ public class OrderItem extends OperatorUserInfo { private String parentId; @TableField("store_id") - @ApiModelProperty(value = "门店id") + @Property(value = "门店id") private String storeId; @TableField(exist = false) diff --git a/skyeye-shop/shop-store/src/main/java/com/skyeye/order/service/OrderItemService.java b/skyeye-shop/shop-store/src/main/java/com/skyeye/order/service/OrderItemService.java index 4221ffb0..c14244aa 100644 --- a/skyeye-shop/shop-store/src/main/java/com/skyeye/order/service/OrderItemService.java +++ b/skyeye-shop/shop-store/src/main/java/com/skyeye/order/service/OrderItemService.java @@ -1,9 +1,8 @@ package com.skyeye.order.service; import com.skyeye.base.business.service.SkyeyeBusinessService; -import com.skyeye.common.enumeration.WhetherEnum; +import com.skyeye.order.entity.Order; import com.skyeye.order.entity.OrderItem; -import org.aspectj.weaver.ast.Or; import java.util.List; import java.util.Map; @@ -13,9 +12,9 @@ public interface OrderItemService extends SkyeyeBusinessService { void deleteByPerentIds(List ids); -// List selectByParentId(String id); - List queryListByStateAndOrderId(String orderId, Integer state); Map> queryListByParentId(List idList); + + void setValueAndCreateEntity(Order order, String userId); } diff --git a/skyeye-shop/shop-store/src/main/java/com/skyeye/order/service/impl/OrderItemServiceImpl.java b/skyeye-shop/shop-store/src/main/java/com/skyeye/order/service/impl/OrderItemServiceImpl.java index 9df2103a..144078f3 100644 --- a/skyeye-shop/shop-store/src/main/java/com/skyeye/order/service/impl/OrderItemServiceImpl.java +++ b/skyeye-shop/shop-store/src/main/java/com/skyeye/order/service/impl/OrderItemServiceImpl.java @@ -5,10 +5,12 @@ import cn.hutool.json.JSONUtil; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.skyeye.annotation.service.SkyeyeService; import com.skyeye.base.business.service.impl.SkyeyeBusinessServiceImpl; +import com.skyeye.common.enumeration.WhetherEnum; import com.skyeye.common.util.mybatisplus.MybatisPlusUtil; import com.skyeye.erp.service.IMaterialNormsService; import com.skyeye.erp.service.IMaterialService; import com.skyeye.order.dao.OrderItemDao; +import com.skyeye.order.entity.Order; import com.skyeye.order.entity.OrderItem; import com.skyeye.order.service.OrderItemService; import com.skyeye.rest.shopmaterialnorms.sevice.IShopMaterialNormsService; @@ -77,4 +79,25 @@ public class OrderItemServiceImpl extends SkyeyeBusinessServiceImpl> result = mapList.stream().collect(Collectors.groupingBy(OrderItem::getParentId)); return result; } + + @Override + public void setValueAndCreateEntity(Order order, String userId) { + List materialStoreIds = order.getOrderItemList().stream().map(OrderItem::getMaterialStoreId).distinct().collect(Collectors.toList()); + // shopMaterial -> shopMaterialStore -> storeId + List> materialByIds = iShopMaterialNormsService.queryShopMaterialByIds(materialStoreIds);// erp-shop-material + Map materialStoreMap = materialByIds.stream() + .distinct().collect(Collectors.toMap(map -> { + Map shopMaterialStore = JSONUtil.toBean(map.get("shopMaterialStore").toString(), null); + return shopMaterialStore.get("id").toString(); + }, map -> { + Map shopMaterialStore = JSONUtil.toBean(map.get("shopMaterialStore").toString(), null); + return shopMaterialStore.get("storeId").toString(); + })); + for (OrderItem orderItem : order.getOrderItemList()) { + orderItem.setCommentState(WhetherEnum.DISABLE_USING.getKey()); + orderItem.setParentId(order.getId()); + orderItem.setStoreId(materialStoreMap.containsKey(orderItem.getMaterialStoreId()) ? materialStoreMap.get(orderItem.getMaterialStoreId()) : ""); + } + super.createEntity(order.getOrderItemList(), userId); + } } \ No newline at end of file diff --git a/skyeye-shop/shop-store/src/main/java/com/skyeye/order/service/impl/OrderServiceImpl.java b/skyeye-shop/shop-store/src/main/java/com/skyeye/order/service/impl/OrderServiceImpl.java index f28743eb..8f4cba03 100644 --- a/skyeye-shop/shop-store/src/main/java/com/skyeye/order/service/impl/OrderServiceImpl.java +++ b/skyeye-shop/shop-store/src/main/java/com/skyeye/order/service/impl/OrderServiceImpl.java @@ -9,13 +9,11 @@ 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.protobuf.ServiceException; import com.skyeye.annotation.service.SkyeyeService; import com.skyeye.base.business.service.impl.SkyeyeBusinessServiceImpl; import com.skyeye.common.constans.CommonConstants; import com.skyeye.common.constans.CommonNumConstants; import com.skyeye.common.entity.search.CommonPageInfo; -import com.skyeye.common.enumeration.WhetherEnum; import com.skyeye.common.object.InputObject; import com.skyeye.common.object.OutputObject; import com.skyeye.common.util.CalculationUtil; @@ -242,11 +240,7 @@ public class OrderServiceImpl extends SkyeyeBusinessServiceImpl @Override public void createPostpose(Order order, String userId) { - for (OrderItem orderItem : order.getOrderItemList()) { - orderItem.setCommentState(WhetherEnum.DISABLE_USING.getKey()); - orderItem.setParentId(order.getId()); - } - orderItemService.createEntity(order.getOrderItemList(), userId); + orderItemService.setValueAndCreateEntity(order, userId); } @Override @@ -378,7 +372,7 @@ public class OrderServiceImpl extends SkyeyeBusinessServiceImpl public void changeOrderAdjustPrice(InputObject inputObject, OutputObject outputObject) { Map params = inputObject.getParams(); int adjustPrice = Integer.parseInt(params.get("adjustPrice").toString()); - if( adjustPrice< CommonNumConstants.NUM_ZERO){ + if (adjustPrice < CommonNumConstants.NUM_ZERO) { throw new CustomException("所调价格不可为负数"); } UpdateWrapper updateWrapper = new UpdateWrapper<>();