diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/config/RuoYiConfig.java b/ruoyi-common/src/main/java/com/ruoyi/common/config/RuoYiConfig.java index eeb224c..935b8eb 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/config/RuoYiConfig.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/config/RuoYiConfig.java @@ -134,10 +134,18 @@ public class RuoYiConfig } /** - * 获取上传路径 + * 获取应用信息路径 */ public static String getAppInfoPath() { return getProfile() + "/appInfo"; } + + /** + * 获取二维码路径 + */ + public static String getQRCodePath() + { + return getProfile() + "/qrCode"; + } } diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUploadUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUploadUtils.java index 7676b19..cf27e96 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUploadUtils.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUploadUtils.java @@ -282,7 +282,7 @@ public class FileUploadUtils try { String codeName = UUID.randomUUID().toString();// 二维码的图片名 String imageType = "jpg";// 图片类型 - picPath = codeName + "." + imageType; + picPath = DateUtils.datePath() + "/" + codeName + "." + imageType; MultiFormatWriter multiFormatWriter = new MultiFormatWriter(); Map hints = new HashMap(); hints.put(EncodeHintType.CHARACTER_SET, "UTF-8"); diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java index 3787df0..74b1cde 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java @@ -3,11 +3,11 @@ package com.ruoyi.framework.web.service; import javax.annotation.Resource; import com.alibaba.fastjson.JSONObject; +import com.ruoyi.common.config.RuoYiConfig; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.enums.UserStatus; import com.ruoyi.common.utils.*; import com.ruoyi.common.utils.file.FileUploadUtils; -import com.ruoyi.common.utils.file.FileUtils; import com.ruoyi.system.domain.TDoctor; import com.ruoyi.system.domain.req.AppRegisterReq; import com.ruoyi.system.mapper.TDoctorMapper; @@ -15,7 +15,6 @@ import com.ruoyi.system.service.impl.UserTokenService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; import org.springframework.security.authentication.AuthenticationManager; import org.springframework.security.authentication.BadCredentialsException; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; @@ -50,8 +49,6 @@ public class SysLoginService { private static final Logger log = LoggerFactory.getLogger(SysLoginService.class); - @Value("${ruoyi.profile}") - private String uploadFilePath; @Autowired private TokenService tokenService; @@ -208,7 +205,7 @@ public class SysLoginService map.put("id", tDoctor.getId()); map.put("from", "yinuo"); String content = JSONObject.toJSONString(map); - String qrCode = FileUploadUtils.code(content, uploadFilePath); + String qrCode = FileUploadUtils.code(content, RuoYiConfig.getQRCodePath()); tDoctor.setQrCode(qrCode); log.info("update doctor :{}", tDoctor); tDoctorMapper.updateTDoctor(tDoctor); diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/WechatServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/WechatServiceImpl.java index fc0d4c0..624fb93 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/WechatServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/WechatServiceImpl.java @@ -1,13 +1,13 @@ package com.ruoyi.system.service.impl; import com.alibaba.fastjson.JSONObject; +import com.ruoyi.common.config.RuoYiConfig; import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.core.domain.model.LoginUser; import com.ruoyi.common.exception.ServiceException; import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.file.FileUploadUtils; -import com.ruoyi.common.utils.file.FileUtils; import com.ruoyi.common.utils.http.HttpUtils; import com.ruoyi.common.utils.ip.IpUtils; import com.ruoyi.common.utils.wechat.WechatKeys; @@ -59,9 +59,6 @@ public class WechatServiceImpl implements IWechatService { @Value("${wx.wechatSecret}") private String wechatSecret; - @Value("${ruoyi.profile}") - private String uploadFilePath; - @Resource private TWechatUserMapper tWechatUserMapper; @@ -190,7 +187,7 @@ public class WechatServiceImpl implements IWechatService { map.put("id", tDoctor.getId()); map.put("from", "yinuo"); String content = JSONObject.toJSONString(map); - String qrCode = FileUploadUtils.code(content, uploadFilePath); + String qrCode = FileUploadUtils.code(content, RuoYiConfig.getQRCodePath()); tDoctor.setQrCode(qrCode); logger.info("update doctor :{}", tDoctor); tDoctorMapper.updateTDoctor(tDoctor);