Răsfoiți Sursa

fix:完善图片上传

qingwudarao 6 luni în urmă
părinte
comite
efa6a49e0d

+ 5 - 0
ruoyi-modules/ruoyi-bulkOrder/pom.xml

@@ -33,6 +33,11 @@
             <artifactId>ruoyi-common-sms</artifactId>
         </dependency>
 
+        <dependency>
+            <groupId>org.dromara</groupId>
+            <artifactId>ruoyi-system</artifactId>
+        </dependency>
+
         <dependency>
             <groupId>org.dromara</groupId>
             <artifactId>ruoyi-common-mail</artifactId>

+ 109 - 0
ruoyi-modules/ruoyi-bulkOrder/src/main/java/org/dromara/bulk/domain/Attachment.java

@@ -0,0 +1,109 @@
+package org.dromara.bulk.domain;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * 附件表基类
+ */
+@Data
+@TableName("fa_attachment")
+public class Attachment {
+
+    /**
+     * 主键
+     */
+    private Long id;
+
+    /**
+     * 类别
+     */
+    private String category;
+
+    /**
+     * 管理员ID
+     */
+    private Long adminId;
+
+    /**
+     * 用户ID
+     */
+    private Long userId;
+
+    /**
+     * 物理路径
+     */
+    private String url;
+
+    /**
+     * 宽度
+     */
+    @TableField("imagewidth")
+    private String imageWidth;
+
+    /**
+     * 高度
+     */
+    @TableField("imageheight")
+    private String imageHeight;
+
+    /**
+     * 图片类型
+     */
+    @TableField("imagetype")
+    private String imageType;
+
+    /**
+     * 图片帧数
+     */
+    @TableField("imageframes")
+    private int imageFrames;
+
+    /**
+     * 文件名
+     */
+    @TableField("filename")
+    private String fileName;
+
+    /**
+     * 文件大小
+     */
+    @TableField("filesize")
+    private int fileSize;
+
+    /**
+     * mime类型
+     */
+    private String mimetype;
+
+    /**
+     * 创建时间
+     */
+    @TableField("createtime")
+    private Date createTime;
+
+    /**
+     * 更新时间
+     */
+    @TableField("updatetime")
+    private Date updateTime;
+
+    /**
+     * 上传时间
+     */
+    @TableField("uploadtime")
+    private Date uploadTime;
+
+    /**
+     * 存储位置
+     */
+    private String storage;
+
+    /**
+     * sha1值
+     */
+    private String sha1;
+}

+ 47 - 0
ruoyi-modules/ruoyi-bulkOrder/src/main/java/org/dromara/bulk/domain/FlowerPattern.java

@@ -0,0 +1,47 @@
+package org.dromara.bulk.domain;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * 图片关联表基类
+ */
+@Data
+@TableName("fa_kuyou_flower_pattern")
+public class FlowerPattern {
+
+    /**
+     * 主键
+     */
+    private Long id;
+
+    /**
+     * 图片地址
+     */
+    @TableField("image")
+    private String imageUrl;
+
+    /**
+     * 花型号id
+     */
+    @TableField("code")
+    private String OemId;
+
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+
+    /**
+     * 用户订单id
+     */
+    private Long userOrderId;
+
+    /**
+     * 用户id
+     */
+    private Long userId;
+}

+ 100 - 0
ruoyi-modules/ruoyi-bulkOrder/src/main/java/org/dromara/bulk/domain/bo/AttachmentBo.java

@@ -0,0 +1,100 @@
+package org.dromara.bulk.domain.bo;
+
+import io.github.linpeilie.annotations.AutoMapper;
+import lombok.Data;
+import org.dromara.bulk.domain.Attachment;
+
+import java.util.Date;
+
+/**
+ * 附件表Bo类
+ */
+@Data
+@AutoMapper(target = Attachment.class, reverseConvertGenerate = false)
+public class AttachmentBo {
+
+    /**
+     * 主键
+     */
+    private Long id;
+
+    /**
+     * 类别
+     */
+    private String category;
+
+    /**
+     * 管理员ID
+     */
+    private Long adminId;
+
+    /**
+     * 用户ID
+     */
+    private Long userId;
+
+    /**
+     * 物理路径
+     */
+    private String url;
+
+    /**
+     * 宽度
+     */
+    private String imageWidth;
+
+    /**
+     * 高度
+     */
+    private String imageHeight;
+
+    /**
+     * 图片类型
+     */
+    private String imageType;
+
+    /**
+     * 图片帧数
+     */
+    private int imageFrames;
+
+    /**
+     * 文件名
+     */
+    private String fileName;
+
+    /**
+     * 文件大小
+     */
+    private int fileSize;
+
+    /**
+     * mime类型
+     */
+    private String mimetype;
+
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+
+    /**
+     * 更新时间
+     */
+    private Date updateTime;
+
+    /**
+     * 上传时间
+     */
+    private Date uploadTime;
+
+    /**
+     * 存储位置
+     */
+    private String storage;
+
+    /**
+     * sha1值
+     */
+    private String sha1;
+}

+ 100 - 101
ruoyi-modules/ruoyi-bulkOrder/src/main/java/org/dromara/bulk/domain/bo/BulkOrderListBo.java

@@ -11,254 +11,254 @@ import org.dromara.common.mybatis.core.domain.BaseEntity;
 import java.util.Date;
 
 /**
-* 大货订单列表BO类
-*/
+ * 大货订单列表BO类
+ */
 @Data
 @EqualsAndHashCode(callSuper = true)
 @AutoMapper(target = BulkOrderList.class, reverseConvertGenerate = false)
 public class BulkOrderListBo extends BaseEntity {
 
     /**
-    * id
-    */
+     * id
+     */
     private Long id;
 
     /**
-    * 系统单号
-    */
+     * 系统单号
+     */
     private String sysNo;
 
     /**
-    * 生产单号
-    */
+     * 生产单号
+     */
     private String scNo;
 
     /**
-    * 用户id
-    */
+     * 用户id
+     */
     @NotNull(message = "用户id不能为空")
     private Long userId;
 
     /**
-    * 计划ID
-    */
+     * 计划ID
+     */
     @NotNull(message = "计划ID不能为空")
     private Long planId;
 
     /**
-    * 商品ID
-    */
+     * 商品ID
+     */
     private Long goodsId;
 
     /**
-    * 商品编号
-    */
+     * 商品编号
+     */
     private String goodsCode;
 
     /**
-    * 商品名称
-    */
+     * 商品名称
+     */
     private String goodsName;
 
     /**
-    * 商品规格型号
-    */
+     * 商品规格型号
+     */
     private String goodsNote;
 
     /**
-    * 单位ID
-    */
+     * 单位ID
+     */
     private int unitId;
 
     /**
-    * 默认单位
-    */
+     * 默认单位
+     */
     private int defaultUnit;
 
     /**
-    * 进价
-    */
+     * 进价
+     */
     @NotNull(message = "进价不能为空")
     private double purchase;
 
     /**
-    * 数量
-    */
+     * 数量
+     */
     @NotNull(message = "数量不能为空")
     private double number;
 
     /**
-    * 份数
-    */
+     * 份数
+     */
     private double fenNumber;
 
     /**
-    * 基本数量
-    */
+     * 基本数量
+     */
     private double basicNmber;
 
     /**
-    * 基本份数
-    */
+     * 基本份数
+     */
     private double basicFenNmber;
 
     /**
-    * 金额
-    */
+     * 金额
+     */
     private double money;
 
     /**
-    * 备注
-    */
+     * 备注
+     */
     private String remark;
 
     /**
-    * 面料id(大货编号)
-    */
+     * 面料id(大货编号)
+     */
     private String goodsTypeExtend1Id;
 
     /**
-    * 面料的扩展信息
-    */
+     * 面料的扩展信息
+     */
     private String goodsTypeExtend1Attr;
 
     /**
-    * 物料id
-    */
+     * 物料id
+     */
     private String goodsTypeExtend2Id;
 
     /**
-    * 物料的扩展信息
-    */
+     * 物料的扩展信息
+     */
     private String goodsTypeExtend2Attr;
 
     /**
-    * 工艺类型id
-    */
+     * 工艺类型id
+     */
     private String goodsTypeExtend3Id;
 
     /**
-    * 工艺类型的扩展信息
-    */
+     * 工艺类型的扩展信息
+     */
     private String goodsTypeExtend3Attr;
 
     /**
-    * 花型号id
-    */
+     * 花型号id
+     */
     private String goodsTypeExtend4Id;
 
     /**
-    * 花型号的扩展信息
-    */
+     * 花型号的扩展信息
+     */
     private String goodsTypeExtend4Attr;
 
     /**
-    * 底布名称
-    */
+     * 底布名称
+     */
     private String baseCloth;
 
     /**
-    * 底布单价
-    */
+     * 底布单价
+     */
     private double baseClothPrice;
 
     /**
-    * 工艺单价
-    */
+     * 工艺单价
+     */
     private double gongyiPrice;
 
     /**
-    * 款号
-    */
+     * 款号
+     */
     private String itemNumber;
 
     /**
-    * 克重
-    */
+     * 克重
+     */
     private String weight;
 
     /**
-    * 门幅
-    */
+     * 门幅
+     */
     private String menfu;
 
     /**
-    * 机器
-    */
+     * 机器
+     */
     private String machine;
 
     /**
-    * 品牌组
-    */
+     * 品牌组
+     */
     private String brandGroup;
 
     /**
-    * 成衣厂
-    */
+     * 成衣厂
+     */
     private String garmentFactory;
 
     /**
-    * 成衣厂联系人
-    */
+     * 成衣厂联系人
+     */
     private String garmentFactoryPeople;
 
     /**
-    * 成衣厂电话
-    */
+     * 成衣厂电话
+     */
     private String garmentFactoryTel;
 
     /**
-    * 收货地址
-    */
+     * 收货地址
+     */
     private String receivingAddress;
 
     /**
-    * 当前消耗
-    */
+     * 当前消耗
+     */
     private String currentTimeConsumption;
 
     /**
-    * 下单码数
-    */
+     * 下单码数
+     */
     @NotBlank(message = "下单码数不能为空")
     private String numberOrdersPlaced;
 
     /**
-    * 下单时间
-    */
+     * 下单时间
+     */
     private Date orderTime;
 
     /**
-    * 交货日期
-    */
+     * 交货日期
+     */
     private Date deliveryDate;
     /**
-    * 目标日期
-    */
+     * 目标日期
+     */
     private Date targetDate;
     /**
-    * 订单id
-    */
+     * 订单id
+     */
     private Long userOrderId;
     /**
-    * 销货单id
-    */
+     * 销货单id
+     */
     private Long goodsSalesInfoId;
     /**
-    * 下单码数类型
-    */
+     * 下单码数类型
+     */
     private String numberOrdersPlacedType;
     /**
-    * 发货数量
-    */
+     * 发货数量
+     */
     private int shipNum;
     /**
-    * 账单备注
-    */
+     * 账单备注
+     */
     private String billRemark;
     /**
-    * 账单状态
-    */
+     * 账单状态
+     */
     private int duizhangStatus;
 
     /**
@@ -285,5 +285,4 @@ public class BulkOrderListBo extends BaseEntity {
      * 商品图片
      */
     private String image;
-
 }

+ 45 - 0
ruoyi-modules/ruoyi-bulkOrder/src/main/java/org/dromara/bulk/domain/bo/FlowerPatternBo.java

@@ -0,0 +1,45 @@
+package org.dromara.bulk.domain.bo;
+
+import io.github.linpeilie.annotations.AutoMapper;
+import lombok.Data;
+import org.dromara.bulk.domain.FlowerPattern;
+
+import java.util.Date;
+
+/**
+ * 图片关联表Bo类
+ */
+@Data
+@AutoMapper(target = FlowerPattern.class, reverseConvertGenerate = false)
+public class FlowerPatternBo {
+
+    /**
+     * 主键
+     */
+    private Long id;
+
+    /**
+     * 图片地址
+     */
+    private String imageUrl;
+
+    /**
+     * 花型号id
+     */
+    private String OemId;
+
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+
+    /**
+     * 用户订单id
+     */
+    private Long userOrderId;
+
+    /**
+     * 用户id
+     */
+    private Long userId;
+}

+ 13 - 0
ruoyi-modules/ruoyi-bulkOrder/src/main/java/org/dromara/bulk/domain/bo/NewBulkOrderBo.java

@@ -38,4 +38,17 @@ public class NewBulkOrderBo extends BaseEntity {
      * 订单信息列表
      */
     private List<OrderListBo> orderLists;
+
+    /**
+     * userName:“123123”,
+     * userPhone:12312312315,
+     * orderList:[
+     * {
+     *     images:1
+     * },{
+     *     images:2
+     * }
+     * ]
+     *
+     */
 }

+ 4 - 2
ruoyi-modules/ruoyi-bulkOrder/src/main/java/org/dromara/bulk/domain/bo/OrderListBo.java

@@ -2,6 +2,7 @@ package org.dromara.bulk.domain.bo;
 
 import lombok.Data;
 import org.dromara.commodityManagement.domain.bo.TemplateBo;
+import org.dromara.system.domain.vo.SysOssVo;
 
 import java.util.Date;
 import java.util.List;
@@ -138,9 +139,10 @@ public class OrderListBo {
     private String oemId;
 
     /**
-     * 款式图
+     * 款式图的ossId
      */
-    private String styleImage;
+    private Long imageId;
 
+    private SysOssVo ossVo;
 
 }

+ 100 - 0
ruoyi-modules/ruoyi-bulkOrder/src/main/java/org/dromara/bulk/domain/vo/AttachmentVo.java

@@ -0,0 +1,100 @@
+package org.dromara.bulk.domain.vo;
+
+import io.github.linpeilie.annotations.AutoMapper;
+import lombok.Data;
+import org.dromara.bulk.domain.Attachment;
+
+import java.util.Date;
+
+/**
+ * 附件表Vo类
+ */
+@Data
+@AutoMapper(target = Attachment.class)
+public class AttachmentVo {
+
+    /**
+     * 主键
+     */
+    private Long id;
+
+    /**
+     * 类别
+     */
+    private String category;
+
+    /**
+     * 管理员ID
+     */
+    private Long adminId;
+
+    /**
+     * 用户ID
+     */
+    private Long userId;
+
+    /**
+     * 物理路径
+     */
+    private String url;
+
+    /**
+     * 宽度
+     */
+    private String imageWidth;
+
+    /**
+     * 高度
+     */
+    private String imageHeight;
+
+    /**
+     * 图片类型
+     */
+    private String imageType;
+
+    /**
+     * 图片帧数
+     */
+    private int imageFrames;
+
+    /**
+     * 文件名
+     */
+    private String fileName;
+
+    /**
+     * 文件大小
+     */
+    private int fileSize;
+
+    /**
+     * mime类型
+     */
+    private String mimetype;
+
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+
+    /**
+     * 更新时间
+     */
+    private Date updateTime;
+
+    /**
+     * 上传时间
+     */
+    private Date uploadTime;
+
+    /**
+     * 存储位置
+     */
+    private String storage;
+
+    /**
+     * sha1值
+     */
+    private String sha1;
+}

+ 45 - 0
ruoyi-modules/ruoyi-bulkOrder/src/main/java/org/dromara/bulk/domain/vo/FlowerPatternVo.java

@@ -0,0 +1,45 @@
+package org.dromara.bulk.domain.vo;
+
+import io.github.linpeilie.annotations.AutoMapper;
+import lombok.Data;
+import org.dromara.bulk.domain.FlowerPattern;
+
+import java.util.Date;
+
+/**
+ * 图片关联表Vo类
+ */
+@Data
+@AutoMapper(target = FlowerPattern.class)
+public class FlowerPatternVo {
+
+    /**
+     * 主键
+     */
+    private Long id;
+
+    /**
+     * 图片地址
+     */
+    private String imageUrl;
+
+    /**
+     * 花型号id
+     */
+    private String OemId;
+
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+
+    /**
+     * 用户订单id
+     */
+    private Long userOrderId;
+
+    /**
+     * 用户id
+     */
+    private Long userId;
+}

+ 1 - 0
ruoyi-modules/ruoyi-bulkOrder/src/main/java/org/dromara/bulk/mapstruct/NewBulkOrderMapstruct.java

@@ -20,6 +20,7 @@ public interface NewBulkOrderMapstruct {
     @Mapping(target = "scNo", source = "purchaseCode")
     @Mapping(target = "goodsCode", constant = "SP001")
     @Mapping(target = "goodsName", constant = "图片下单")
+    @Mapping(target = "goodsId", constant = "9")
     @Mapping(target = "unitId", constant = "5")
     @Mapping(target = "defaultUnit", constant = "5")
     @Mapping(target = "goodsTypeExtend1Id", source = "orderList.daHuoNumberName")

+ 12 - 6
ruoyi-modules/ruoyi-bulkOrder/src/main/java/org/dromara/bulk/service/impl/BulkOrderManagementServiceImpl.java

@@ -15,6 +15,8 @@ import org.dromara.bulk.service.BulkOrderManagementService;
 import org.dromara.common.core.utils.OrderNumberGenerator;
 import org.dromara.productionManagement.domain.ProductionPlan;
 import org.dromara.productionManagement.mapper.ProductionPlanMapper;
+import org.dromara.system.domain.vo.SysOssVo;
+import org.dromara.system.service.impl.SysOssServiceImpl;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
@@ -33,6 +35,7 @@ public class BulkOrderManagementServiceImpl implements BulkOrderManagementServic
     private final UserOrderMapper userOrderMapper;
     private final UserOrderTemplateMapper userOrderTemplateMapper;
     private final NewBulkOrderMapstruct newBulkOrderMapstruct;
+    private final SysOssServiceImpl sysOssService;
 
     /**
      * 新增生产订单
@@ -73,14 +76,14 @@ public class BulkOrderManagementServiceImpl implements BulkOrderManagementServic
                 productionPlanMapper.insert(productionPlan);
 
                 // 订单列表映射
-                BulkOrderList bulkOrderList = newBulkOrderMapstruct.toBulkOrderList(newBulkOrderBo, orderList, sysNo, purchaseCode, userOrder.getId(), productionPlan.getId());
-                bulkOrderList.setGoodsId(9L);
+                BulkOrderList bulkOrderList = newBulkOrderMapstruct.toBulkOrderList(
+                    newBulkOrderBo,
+                    orderList, sysNo,
+                    purchaseCode,
+                    userOrder.getId(),
+                    productionPlan.getId());
                 bulkOrderListMapper.insert(bulkOrderList);
 
-
-
-
-
                 // 处理模板
                 if (orderList.getTemplateList() != null) {
                     List<UserOrderTemplate> templates = newBulkOrderMapstruct.toTemplateList(
@@ -92,6 +95,9 @@ public class BulkOrderManagementServiceImpl implements BulkOrderManagementServic
                     );
                     userOrderTemplateMapper.insert(templates);
                 }
+
+                //处理款式图
+                SysOssVo styleImageVo = sysOssService.upload(orderList.getStyleImage());
             }
             return 1;
         } catch (Exception e) {