Min 11 hónapja
szülő
commit
01744dfff6

+ 5 - 1
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/controller/ProductController.java

@@ -144,7 +144,11 @@ public class ProductController {
             List<Integer> idList = splitList.stream().map(i -> Integer.valueOf(i)).collect(Collectors.toList());
             int count = taskService.count(new LambdaQueryWrapper<Task>().in(Task::getProductId, idList));
             if(count>0){
-                msg.setError("当前产品已绑定到相关任务,删除失败");
+                msg.setError("存在已绑定到相关任务的产品,删除失败");
+                return msg;
+            }
+            if(orderProductDetailService.count(new LambdaQueryWrapper<OrderProductDetail>().in(OrderProductDetail::getOrderId,idList))>0){
+                msg.setError("存在关联订单的产品,删除失败");
                 return msg;
             }
             if(idList.size()>0){

+ 25 - 0
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/controller/SalesOrderController.java

@@ -12,6 +12,7 @@ import com.management.platform.util.HttpRespMsg;
 import org.springframework.util.StringUtils;
 import org.springframework.web.bind.annotation.RequestMapping;
 
+import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.multipart.MultipartFile;
 
@@ -160,6 +161,10 @@ public class SalesOrderController {
             List<String> splitList = Arrays.asList(idSplit);
             List<Integer> idList = splitList.stream().map(s -> Integer.valueOf(s)).collect(Collectors.toList());
             List<SalesOrder> orderList = salesOrderService.list(new LambdaQueryWrapper<SalesOrder>().in(SalesOrder::getId, idList));
+            if(orderProductDetailService.count(new LambdaQueryWrapper<OrderProductDetail>().in(OrderProductDetail::getOrderId,idList))>0){
+                msg.setError("存在关联产品的订单,删除失败");
+                return msg;
+            }
             orderList.forEach(o->{
                 o.setIsDelete(1);
             });
@@ -187,6 +192,26 @@ public class SalesOrderController {
         return msg;
     }
 
+    /**
+     * @Description:批量删除产品数据
+     * @Param: [ids]
+     * @return: com.management.platform.util.HttpRespMsg
+     * @Author: yurk
+     * @Date: 2024/5/21
+     */
+    @RequestMapping("/batchDeleteOrder")
+    public HttpRespMsg batchDeleteProduct(String ids){
+        HttpRespMsg msg=new HttpRespMsg();
+        if(!StringUtils.isEmpty(ids)){
+            String[] idsSplit = ids.split(",");
+            List<String> splitList = Arrays.asList(idsSplit);
+            List<Integer> idList = splitList.stream().map(i -> Integer.valueOf(i)).collect(Collectors.toList());
+            idList.add(-1);
+            salesOrderService.removeByIds(idList);
+        }
+        return msg;
+    }
+
 
     /**
      * 恢复订单(假删除 isDelete标记 1-->0)