Преглед изворни кода

fix(入库): 如果为个人采购入库时,保存个人的信息

yuj пре 7 година
родитељ
комит
1e834166c3

+ 10 - 4
src/main/java/com/uas/platform/b2c/prod/commodity/model/CommodityInOutbound.java

@@ -1,6 +1,7 @@
 package com.uas.platform.b2c.prod.commodity.model;
 
 import com.uas.platform.b2c.common.account.model.Enterprise;
+import com.uas.platform.b2c.common.account.model.User;
 import com.uas.platform.b2c.core.support.SystemSession;
 import com.uas.platform.b2c.logistics.model.Logistics;
 import com.uas.platform.b2c.prod.commodity.type.InOutBoundType;
@@ -38,12 +39,14 @@ public class CommodityInOutbound implements Serializable {
 
     /**
      * 所属企业
+     * 如果是个人,就保存个人的uu
      */
     @Column(name = "cio_enuu")
     private Long enuu;
 
     /**
      * 所属企业的名称
+     * 如果是个人,就保存个人的名称
      */
     @Column(name = "cio_enname")
     private String enName;
@@ -315,10 +318,13 @@ public class CommodityInOutbound implements Serializable {
                 this.type = InOutBoundType.OUTBOUND;
             }
         }
-        Enterprise enterprise = SystemSession.getUser().getEnterprise();
-        if (enterprise != null) {
-            this.enuu = enterprise.getUu();
-            this.enName = enterprise.getEnName();
+        User user = SystemSession.getUser();
+        if (user.getEnterprise() != null) {
+            this.enuu = user.getEnterprise().getUu();
+            this.enName = user.getEnterprise().getEnName();
+        } else {
+            this.enuu = user.getUserUU();
+            this.enName = user.getUserName();
         }
         this.createTime = new Date();
         this.operaterUseruu = SystemSession.getUser().getUserUU();