|
|
@@ -8,6 +8,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
+import thyyxxk.webserver.config.envionment.ArchiveConfig;
|
|
|
import thyyxxk.webserver.config.exception.ExceptionEnum;
|
|
|
import thyyxxk.webserver.dao.his.technologyArchives.TechnologyArchives10Dao;
|
|
|
import thyyxxk.webserver.dao.his.technologyArchives.TechnologyArchives11Dao;
|
|
|
@@ -110,13 +111,16 @@ public class TechnologyArchivesService {
|
|
|
|
|
|
private final TechnologyArchives15Dao fifteenthDao;
|
|
|
|
|
|
+ private final ArchiveConfig archiveData;
|
|
|
+
|
|
|
@Autowired
|
|
|
public TechnologyArchivesService(TechnologyArchivesDao dao, TechnologyArchivesMainDao mainDao, RedisLikeService redisLikeService,
|
|
|
TechnologyArchives1Dao firstDao, TechnologyArchives2Dao secondDao, TechnologyArchives3Dao thirdDao,
|
|
|
TechnologyArchives4Dao fourthDao, TechnologyArchives5Dao fifthDao, TechnologyArchives6Dao sixthDao,
|
|
|
TechnologyArchives7Dao seventhDao, TechnologyArchives9Dao ninthDao, TechnologyArchives10Dao tenthDao,
|
|
|
TechnologyArchives12Dao twelfthDao, TechnologyArchives13Dao thirteenthDao, TechnologyArchives14Dao fourteenthDao,
|
|
|
- TechnologyArchives8Dao eighthDao, TechnologyArchives11Dao eleventhDao, TechnologyArchives15Dao fifteenthDao) {
|
|
|
+ TechnologyArchives8Dao eighthDao, TechnologyArchives11Dao eleventhDao, TechnologyArchives15Dao fifteenthDao
|
|
|
+ ,ArchiveConfig archive) {
|
|
|
this.dao = dao;
|
|
|
this.mainDao = mainDao;
|
|
|
this.redisLikeService = redisLikeService;
|
|
|
@@ -135,6 +139,7 @@ public class TechnologyArchivesService {
|
|
|
this.eighthDao = eighthDao;
|
|
|
this.eleventhDao = eleventhDao;
|
|
|
this.fifteenthDao = fifteenthDao;
|
|
|
+ this.archiveData = archive;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -319,9 +324,11 @@ public class TechnologyArchivesService {
|
|
|
|
|
|
String uploadDir;
|
|
|
if (isProd) {
|
|
|
- uploadDir = "/mnt/uploadiamge/certificateImage";
|
|
|
+// uploadDir = "/mnt/uploadimage/certificateImage";
|
|
|
+ uploadDir = archiveData.getUploadImageCertificateImage();
|
|
|
} else {
|
|
|
//Z为网络映射盘(172.16.32.197\ uploadimage)
|
|
|
+// uploadDir = archiveData.getUploadImageCertificateImage();
|
|
|
uploadDir = "Z:\\certificateImage";
|
|
|
}
|
|
|
JSONObject js = new JSONObject();
|
|
|
@@ -337,6 +344,8 @@ public class TechnologyArchivesService {
|
|
|
//
|
|
|
Files.copy(file.getInputStream(), filePath, StandardCopyOption.REPLACE_EXISTING);
|
|
|
log.info("文件:{}", fileName);
|
|
|
+// url1 = "http://172.16.30.8:8077/certificateImage/" + fileName;
|
|
|
+// url1 = "http://172.16.32.167:8077/certificateImage/" + fileName;
|
|
|
url1 = "http://172.16.32.197:8077/certificateImage/" + fileName;
|
|
|
// firstDao.updateCertificateImage(url, socialNo, getTime);
|
|
|
js.put("url", url1);
|
|
|
@@ -444,29 +453,24 @@ public class TechnologyArchivesService {
|
|
|
|
|
|
String uploadDir;
|
|
|
if (isProd) {
|
|
|
- uploadDir = "/mnt/uploadimage/proImage";
|
|
|
+ uploadDir = archiveData.getUploadImageCertificateImage();
|
|
|
} else {
|
|
|
uploadDir = "Z:\\proImage";
|
|
|
}
|
|
|
JSONObject js = new JSONObject();
|
|
|
|
|
|
String name = file.getOriginalFilename();
|
|
|
- String fileName = null;
|
|
|
- if (name != null) {
|
|
|
- String newName = UUID.randomUUID().toString().replaceAll("-", "");
|
|
|
- fileName = newName.substring(0,5)+name.substring(name.lastIndexOf("."));
|
|
|
- }
|
|
|
+ String newName = UUID.randomUUID().toString().replaceAll("-", "");
|
|
|
+ String fileName = newName.substring(0,5)+name.substring(name.lastIndexOf("."));
|
|
|
Path uploadPath = Paths.get(uploadDir);
|
|
|
|
|
|
try {
|
|
|
Files.createDirectories(uploadPath);
|
|
|
- Path filePath = null;
|
|
|
- if (fileName != null) {
|
|
|
- filePath = uploadPath.resolve(fileName);
|
|
|
- }
|
|
|
+ Path filePath = uploadPath.resolve(fileName);
|
|
|
//
|
|
|
Files.copy(file.getInputStream(), filePath, StandardCopyOption.REPLACE_EXISTING);
|
|
|
log.info("文件:{}", fileName);
|
|
|
+// url2 = "http://172.16.32.167:8077/proImage/" + fileName;
|
|
|
url2 = "http://172.16.32.197:8077/proImage/" + fileName;
|
|
|
// firstDao.updateCertificateImage(url, socialNo, getTime);
|
|
|
js.put("url", url2);
|