您的验证码:" + code + "
如非本人操作,请忽略本条消息。
"; + try { + MailSender.sendMail(email, EMAIL_TITLE, content); + return code; + } catch (Exception e) { + logger.error(e.getMessage()); + return 0; + } + } + + @Override + public String uploadAvatar(MultipartFile multipartFile) { + if (!multipartFile.isEmpty()) { + String name = RandomUtils.getRandomStringOnlyLowerCase(ValueConsts.SIXTEEN_INT) + ValueConsts.DOT_SIGN + + FileExecutor.getFileSuffix(multipartFile.getOriginalFilename()); + if (Checker.isImage(name) && multipartFile.getSize() < ValueConsts.MB * DefaultValues.TWO_INT) { + String path = SettingConfig.getAvatarStoragePath() + ValueConsts.SEPARATOR + name; + try { + FileExecutor.writeByteArrayToFile(new File(path), multipartFile.getBytes()); + return name; + } catch (IOException e) { + logger.error("upload avatar error: " + e.getMessage()); + } + } + } + return ""; + } +} diff --git a/src/main/java/com/mesasoft/cn/service/impl/ConfigServiceImpl.java b/src/main/java/com/mesasoft/cn/service/impl/ConfigServiceImpl.java new file mode 100644 index 0000000..1de92b2 --- /dev/null +++ b/src/main/java/com/mesasoft/cn/service/impl/ConfigServiceImpl.java @@ -0,0 +1,33 @@ +package com.mesasoft.cn.service.impl; + +import com.alibaba.fastjson.JSONObject; +import com.mesasoft.cn.SketchApplication; +import com.mesasoft.cn.modules.constant.ConfigConsts; +import com.mesasoft.cn.service.IConfigService; +import org.springframework.stereotype.Service; + +/** + * @author pantao + * @since 2018/1/22 + */ +@Service +public class ConfigServiceImpl implements IConfigService { + + @Override + public String getGlobalConfig() { + JSONObject jsonObject = (JSONObject) SketchApplication.settings.getObjectUseEval(ConfigConsts + .GLOBAL_OF_SETTINGS).clone(); + jsonObject.remove(ConfigConsts.UPLOAD_PATH_OF_GLOBAL); + jsonObject.remove(ConfigConsts.TOKEN_PATH_OF_GLOBAL); + jsonObject.remove(ConfigConsts.UPLOAD_FORM_OF_SETTING); + return jsonObject.toString(); + } + + @Override + public String getUserConfig() { + JSONObject jsonObject = (JSONObject) SketchApplication.settings.getObjectUseEval(ConfigConsts.USER_OF_SETTINGS) + .clone(); + jsonObject.remove(ConfigConsts.EMAIL_CONFIG_OF_USER); + return jsonObject.toString(); + } +} diff --git a/src/main/java/com/mesasoft/cn/service/impl/DownloadedServiceImpl.java b/src/main/java/com/mesasoft/cn/service/impl/DownloadedServiceImpl.java new file mode 100644 index 0000000..3c2b546 --- /dev/null +++ b/src/main/java/com/mesasoft/cn/service/impl/DownloadedServiceImpl.java @@ -0,0 +1,42 @@ +package com.mesasoft.cn.service.impl; + +import com.mesasoft.cn.dao.DownloadedDAO; +import com.mesasoft.cn.model.DownloadRecord; +import com.mesasoft.cn.service.IDownloadedService; +import com.mesasoft.cn.util.ServiceUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * @author pantao + * @since 2018/2/1 + */ +@Service +public class DownloadedServiceImpl implements IDownloadedService { + + private final DownloadedDAO downloadDAO; + + @Autowired + public DownloadedServiceImpl(DownloadedDAO downloadDAO) { + this.downloadDAO = downloadDAO; + } + + @Override + public void insertDownload(int userId, long fileId) { + downloadDAO.insertDownload(userId, fileId); + } + + @Override + public void removeByFileId(long fileId) { + downloadDAO.removeByFileId(fileId); + } + + @SuppressWarnings("unchecked") + @Override + public List| \r\n \r\n {{"name" | translate}}\r\n \r\n \r\n | \r\n\r\n |
|---|---|
| \r\n \r\n | \r\n|
| \r\n {{"no_folders_in_folder" | translate}}...\r\n | \r\n\r\n \r\n | \r\n
| \r\n {{ fileNavigator.error }}\r\n | \r\n|
| \r\n \r\n \r\n {{item.model.name | strLimit : 32}}\r\n \r\n | \r\n\r\n \r\n | \r\n
| \r\n \r\n {{"name" | translate}}\r\n \r\n \r\n | \r\n\r\n \r\n {{"size" | translate}}\r\n \r\n \r\n | \r\n \r\n \r\n|||
|---|---|---|---|---|
| \r\n \r\n | \r\n||||
| \r\n {{"no_files_in_folder" | translate}}...\r\n | \r\n||||
| \r\n {{ fileNavigator.error }}\r\n | \r\n||||
| \r\n \r\n \r\n \r\n {{item.model.name | strLimit : 64}}\r\n \r\n | \r\n\r\n \r\n {{item.model.size | humanReadableFileSize}}\r\n \r\n | \r\n \r\n \r\n|||