diff --git a/web-app/src/main/java/com/zcloud/basic/info/command/ImgFilesAddExe.java b/web-app/src/main/java/com/zcloud/basic/info/command/ImgFilesAddExe.java index 4a8a4372..13628e1a 100644 --- a/web-app/src/main/java/com/zcloud/basic/info/command/ImgFilesAddExe.java +++ b/web-app/src/main/java/com/zcloud/basic/info/command/ImgFilesAddExe.java @@ -14,6 +14,7 @@ import com.zcloud.basic.info.dto.clientobject.ImgFilesInfoCO; import com.zcloud.basic.info.persistence.dataobject.ImgFilesDO; import com.zcloud.basic.info.persistence.repository.ImgFilesRepository; import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; import org.apache.commons.math3.analysis.function.Sin; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Component; @@ -31,15 +32,18 @@ import java.util.List; */ @Component @AllArgsConstructor +@Slf4j public class ImgFilesAddExe { private final ImgFilesGateway imgFilesGateway; private final ImgFilesCoConvertor imgFilesCoConvertor; private final ImgFilesRepository imgFilesRepository; - @Transactional(rollbackFor = Exception.class) public SingleResponse execute(ImgFilesAddCmd cmd) { SSOUser ssoUser = AuthContext.getCurrentUser(); - Long tenantId = ssoUser.getTenantId(); + Long tenantId = 1L; + if (ssoUser != null && ssoUser.getTenantId() != null){ + tenantId = ssoUser.getTenantId(); + } ImgFilesE imgFilesE = new ImgFilesE(); BeanUtils.copyProperties(cmd, imgFilesE); boolean res = false; @@ -49,6 +53,7 @@ public class ImgFilesAddExe { imgFilesCO.setFilePath(filePath); res = true; } catch (Exception e) { + log.error("保存失败", e); throw new RuntimeException(e); } if (!res) { @@ -60,7 +65,10 @@ public class ImgFilesAddExe { @Transactional(rollbackFor = Exception.class) public SingleResponse batchExecute(ImgFilesAddCmd cmd) { SSOUser ssoUser = AuthContext.getCurrentUser(); - Long tenantId = ssoUser.getTenantId(); + Long tenantId = 1L; + if (ssoUser != null && ssoUser.getTenantId() != null){ + tenantId = ssoUser.getTenantId(); + } ImgFilesE imgFilesE = new ImgFilesE(); BeanUtils.copyProperties(cmd, imgFilesE); boolean res = false; @@ -74,6 +82,7 @@ public class ImgFilesAddExe { imgFilesCO.setForeignKey(imgFilesE.getForeignKey()); res = true; } catch (Exception e) { + log.error("保存失败", e); throw new RuntimeException(e); } if (!res) {