Merge branch 'company_server' of https://gitee.com/doc_wei01/skyeye into company_server

This commit is contained in:
lqy 2024-11-24 10:50:55 +08:00
commit 2e2bae3e1f
5 changed files with 34 additions and 13 deletions

View file

@ -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<String, Object> 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<String, Object> params = new HashMap<>();
params.put("data", JSONUtil.toJsonStr(data));
params.put("channelCode", channelCode);

View file

@ -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)

View file

@ -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<OrderItem> {
void deleteByPerentIds(List<String> ids);
// List<OrderItem> selectByParentId(String id);
List<OrderItem> queryListByStateAndOrderId(String orderId, Integer state);
Map<String, List<OrderItem>> queryListByParentId(List<String> idList);
void setValueAndCreateEntity(Order order, String userId);
}

View file

@ -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<OrderItemDao
Map<String, List<OrderItem>> result = mapList.stream().collect(Collectors.groupingBy(OrderItem::getParentId));
return result;
}
@Override
public void setValueAndCreateEntity(Order order, String userId) {
List<String> materialStoreIds = order.getOrderItemList().stream().map(OrderItem::getMaterialStoreId).distinct().collect(Collectors.toList());
// shopMaterial -> shopMaterialStore -> storeId
List<Map<String, Object>> materialByIds = iShopMaterialNormsService.queryShopMaterialByIds(materialStoreIds);// erp-shop-material
Map<String, String> materialStoreMap = materialByIds.stream()
.distinct().collect(Collectors.toMap(map -> {
Map<String, Object> shopMaterialStore = JSONUtil.toBean(map.get("shopMaterialStore").toString(), null);
return shopMaterialStore.get("id").toString();
}, map -> {
Map<String, Object> 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);
}
}

View file

@ -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<OrderDao, Order>
@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<OrderDao, Order>
public void changeOrderAdjustPrice(InputObject inputObject, OutputObject outputObject) {
Map<String, Object> 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<Order> updateWrapper = new UpdateWrapper<>();