|
|
@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.core.metadata.OrderItem;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.BeanUtils;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
|
|
@@ -23,7 +24,9 @@ import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import io.swagger.annotations.ApiParam;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
+import lombok.val;
|
|
|
import org.springblade.client.entity.CorpsDesc;
|
|
|
+import org.springblade.client.entity.GoodsDesc;
|
|
|
import org.springblade.client.feign.ICorpsDescClient;
|
|
|
import org.springblade.client.feign.IGoodsDescClient;
|
|
|
import org.springblade.client.vo.GoodsDescVO;
|
|
|
@@ -38,6 +41,7 @@ import org.springblade.core.tool.utils.BeanUtil;
|
|
|
import org.springblade.core.tool.utils.CollectionUtil;
|
|
|
import org.springblade.core.tool.utils.Func;
|
|
|
import org.springblade.core.tool.utils.ObjectUtil;
|
|
|
+import org.springblade.system.feign.IDictBizClient;
|
|
|
import org.springblade.system.user.entity.User;
|
|
|
import org.springblade.system.user.feign.IUserClient;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
@@ -78,6 +82,8 @@ public class PurchaseOrderController extends BladeController {
|
|
|
|
|
|
private IUserClient userClient;
|
|
|
|
|
|
+ private IDictBizClient dictBizClient;
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 详情
|
|
|
@@ -517,6 +523,17 @@ public class PurchaseOrderController extends BladeController {
|
|
|
@ApiOperationSupport(order = 7)
|
|
|
@ApiOperation(value = "删除", notes = "传入ids")
|
|
|
public R<String> remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
|
|
|
+ if (ObjectUtils.isNotNull(ids)){
|
|
|
+ List<Long> arrs = Arrays.stream(ids.split(",")).map(Long::parseLong).collect(Collectors.toList());
|
|
|
+ for (Long arr:arrs) {
|
|
|
+ LambdaQueryWrapper<OrderItems> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ lambdaQueryWrapper.eq(OrderItems::getPid,arr);
|
|
|
+ List<OrderItems> orderItemsList = orderItemsService.list(lambdaQueryWrapper);
|
|
|
+ if (ObjectUtils.isNotNull(orderItemsList)){
|
|
|
+ return R.fail("该采购订单存在明细,无法删除订单");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
return R.status(orderService.removeByIds(Func.toLongList(ids)));
|
|
|
}
|
|
|
|
|
|
@@ -691,6 +708,12 @@ public class PurchaseOrderController extends BladeController {
|
|
|
if (CollectionUtils.isEmpty(excelList)) {
|
|
|
throw new SecurityException("数据不能为空");
|
|
|
}
|
|
|
+ for (OrderItemsExecl orderItemsExecl:excelList) {
|
|
|
+ GoodsDesc goodsDesc = goodsDescClient.getGoodsDescByCname(orderItemsExecl.getPriceCategoryNames());
|
|
|
+ if (ObjectUtils.isNotNull(goodsDesc)){
|
|
|
+ orderItemsExecl.setPriceCategory(goodsDesc.getId());
|
|
|
+ }
|
|
|
+ }
|
|
|
return R.data(excelList);
|
|
|
}
|
|
|
|