|
@@ -195,27 +195,30 @@ public class AuthInfoServiceImpl implements AuthInfoService {
|
|
int count = basicSchoolService.count(basicSchoolQueryWrapper);
|
|
int count = basicSchoolService.count(basicSchoolQueryWrapper);
|
|
if (count == 0) {//不存在则创建学校
|
|
if (count == 0) {//不存在则创建学校
|
|
BasicSchool basicSchool = new BasicSchool(o.getCode(), o.getName(), o.getAccessKey(), o.getAccessSecret());
|
|
BasicSchool basicSchool = new BasicSchool(o.getCode(), o.getName(), o.getAccessKey(), o.getAccessSecret());
|
|
- String filePath = SystemConstant.TEMP_FILES_DIR + File.separator + SystemConstant.getUuid() + ".jpg";
|
|
|
|
- File logoFile = new File(filePath);
|
|
|
|
- if (!logoFile.getParentFile().exists()) {
|
|
|
|
- // 不存在则创建父目录及子文件
|
|
|
|
- logoFile.getParentFile().mkdirs();
|
|
|
|
- logoFile.createNewFile();
|
|
|
|
- }
|
|
|
|
- SystemConstant.base64ToImage(o.getLogo(), filePath);
|
|
|
|
- if (oss) {
|
|
|
|
- LocalDateTime nowTime = LocalDateTime.now();
|
|
|
|
- StringJoiner stringJoiner = new StringJoiner("");
|
|
|
|
- stringJoiner.add(UploadFileEnum.FILE.name().toLowerCase()).add(File.separator)
|
|
|
|
- .add(String.valueOf(nowTime.getYear())).add(File.separator)
|
|
|
|
- .add(String.format("%02d", nowTime.getMonthValue())).add(File.separator)
|
|
|
|
- .add(String.format("%02d", nowTime.getDayOfMonth())).add(File.separator)
|
|
|
|
- .add(SystemConstant.getUuid()).add(".jpg");
|
|
|
|
- fileStoreUtil.ossUpload(stringJoiner.toString(), logoFile, DigestUtils.md5Hex(new FileInputStream(logoFile)), UploadFileEnum.FILE.getFssType());
|
|
|
|
- logoFile.delete();
|
|
|
|
- basicSchool.setLogo(fileStoreUtil.getPrivateUrl(stringJoiner.toString(), UploadFileEnum.FILE.getFssType()));
|
|
|
|
- } else {
|
|
|
|
- basicSchool.setLogo(filePath);
|
|
|
|
|
|
+ if (Objects.nonNull(o.getLogo())) {
|
|
|
|
+ String filePath = SystemConstant.TEMP_FILES_DIR + File.separator + SystemConstant.getUuid() + ".jpg";
|
|
|
|
+ File logoFile = new File(filePath);
|
|
|
|
+ if (!logoFile.getParentFile().exists()) {
|
|
|
|
+ // 不存在则创建父目录及子文件
|
|
|
|
+ logoFile.getParentFile().mkdirs();
|
|
|
|
+ logoFile.createNewFile();
|
|
|
|
+ }
|
|
|
|
+ SystemConstant.base64ToImage(o.getLogo(), filePath);
|
|
|
|
+
|
|
|
|
+ if (oss) {
|
|
|
|
+ LocalDateTime nowTime = LocalDateTime.now();
|
|
|
|
+ StringJoiner stringJoiner = new StringJoiner("");
|
|
|
|
+ stringJoiner.add(UploadFileEnum.FILE.name().toLowerCase()).add(File.separator)
|
|
|
|
+ .add(String.valueOf(nowTime.getYear())).add(File.separator)
|
|
|
|
+ .add(String.format("%02d", nowTime.getMonthValue())).add(File.separator)
|
|
|
|
+ .add(String.format("%02d", nowTime.getDayOfMonth())).add(File.separator)
|
|
|
|
+ .add(SystemConstant.getUuid()).add(".jpg");
|
|
|
|
+ fileStoreUtil.ossUpload(stringJoiner.toString(), logoFile, DigestUtils.md5Hex(new FileInputStream(logoFile)), UploadFileEnum.FILE.getFssType());
|
|
|
|
+ logoFile.delete();
|
|
|
|
+ basicSchool.setLogo(fileStoreUtil.getPrivateUrl(stringJoiner.toString(), UploadFileEnum.FILE.getFssType()));
|
|
|
|
+ } else {
|
|
|
|
+ basicSchool.setLogo(filePath);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
basicSchoolSet.add(basicSchool);
|
|
basicSchoolSet.add(basicSchool);
|
|
}
|
|
}
|