Merge branch 'master' of https://gitee.com/beijing_hongye_huicheng/lilishop
This commit is contained in:
commit
9fa54109b8
@ -63,7 +63,7 @@ public class UploadController {
|
|||||||
if (authUser == null) {
|
if (authUser == null) {
|
||||||
throw new ServiceException(ResultCode.USER_AUTHORITY_ERROR);
|
throw new ServiceException(ResultCode.USER_AUTHORITY_ERROR);
|
||||||
}
|
}
|
||||||
Setting setting = settingService.getById(SettingEnum.OSS_SETTING.name());
|
Setting setting = settingService.get(SettingEnum.OSS_SETTING.name());
|
||||||
if (setting == null || StrUtil.isBlank(setting.getSettingValue())) {
|
if (setting == null || StrUtil.isBlank(setting.getSettingValue())) {
|
||||||
throw new ServiceException(ResultCode.OSS_NOT_EXIST);
|
throw new ServiceException(ResultCode.OSS_NOT_EXIST);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -53,44 +53,61 @@ public class SmsUtilAliImplService implements SmsUtil, AliSmsUtil {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void sendSmsCode(String mobile, VerificationEnums verificationEnums, String uuid) {
|
public void sendSmsCode(String mobile, VerificationEnums verificationEnums, String uuid) {
|
||||||
|
//获取短信配置
|
||||||
|
Setting setting = settingService.get(SettingEnum.SMS_SETTING.name());
|
||||||
|
if (StrUtil.isBlank(setting.getSettingValue())) {
|
||||||
|
throw new ServiceException("您还未配置阿里云短信");
|
||||||
|
}
|
||||||
|
SmsSetting smsSetting = new Gson().fromJson(setting.getSettingValue(), SmsSetting.class);
|
||||||
|
|
||||||
|
//验证码
|
||||||
String code = CommonUtil.getRandomNum();
|
String code = CommonUtil.getRandomNum();
|
||||||
|
|
||||||
switch (verificationEnums) {
|
//准备发送短信参数
|
||||||
//如果某个模版需要自定义,则在此处进行调整
|
Map<String, String> params = new HashMap<>();
|
||||||
case LOGIN:
|
// 验证码内容
|
||||||
case REGISTER:
|
params.put("code", code);
|
||||||
case FIND_USER: {
|
|
||||||
|
|
||||||
//准备发送短信参数
|
//模版 默认为登录验证
|
||||||
Map<String, String> params = new HashMap<>();
|
String templateCode;
|
||||||
params.put("code", code);
|
|
||||||
cache.put(cacheKey(verificationEnums, mobile, uuid), code, 300L);
|
//如果某个模版需要自定义,则在此处进行调整
|
||||||
Setting setting = settingService.getById(SettingEnum.SMS_SETTING.name());
|
switch (verificationEnums) {
|
||||||
if (StrUtil.isBlank(setting.getSettingValue())) {
|
//登录
|
||||||
throw new ServiceException("您还未配置阿里云短信");
|
case LOGIN: {
|
||||||
}
|
templateCode = "SMS_205755300";
|
||||||
SmsSetting smsSetting = new Gson().fromJson(setting.getSettingValue(), SmsSetting.class);
|
|
||||||
this.sendSmsCode(smsSetting.getSignName(), mobile, params, "SMS_205755300");
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
//注册
|
||||||
|
case REGISTER: {
|
||||||
|
templateCode = "SMS_205755298";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
//找回密码
|
||||||
|
case FIND_USER: {
|
||||||
|
templateCode = "SMS_205755301";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
//修改密码
|
||||||
case UPDATE_PASSWORD: {
|
case UPDATE_PASSWORD: {
|
||||||
Member member = memberService.getById(UserContext.getCurrentUser().getId());
|
Member member = memberService.getById(UserContext.getCurrentUser().getId());
|
||||||
if (member == null || StringUtil.isEmpty(member.getMobile())) {
|
if (member == null || StringUtil.isEmpty(member.getMobile())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
String memberMobile = member.getMobile();
|
//更新为用户最新手机号
|
||||||
//准备发送短信参数
|
mobile = member.getMobile();
|
||||||
Map<String, String> params = new HashMap<>();
|
templateCode = "SMS_205755297";
|
||||||
params.put("code", code);
|
|
||||||
cache.put(cacheKey(verificationEnums, memberMobile, uuid), code, 300L);
|
|
||||||
this.sendSmsCode("北京宏业汇成科技有限公司", mobile, params, "SMS_205755297");
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
//如果不是有效的验证码手段,则此处不进行短信操作
|
//如果不是有效的验证码手段,则此处不进行短信操作
|
||||||
default:
|
default:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
//缓存中写入要验证的信息
|
||||||
|
cache.put(cacheKey(verificationEnums, mobile, uuid), code, 300L);
|
||||||
|
//发送短信
|
||||||
|
this.sendSmsCode(smsSetting.getSignName(), mobile, params, templateCode);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -314,7 +331,7 @@ public class SmsUtilAliImplService implements SmsUtil, AliSmsUtil {
|
|||||||
*/
|
*/
|
||||||
public com.aliyun.dysmsapi20170525.Client createClient() {
|
public com.aliyun.dysmsapi20170525.Client createClient() {
|
||||||
try {
|
try {
|
||||||
Setting setting = settingService.getById(SettingEnum.SMS_SETTING.name());
|
Setting setting = settingService.get(SettingEnum.SMS_SETTING.name());
|
||||||
if (StrUtil.isBlank(setting.getSettingValue())) {
|
if (StrUtil.isBlank(setting.getSettingValue())) {
|
||||||
throw new ServiceException("您还未配置阿里云短信");
|
throw new ServiceException("您还未配置阿里云短信");
|
||||||
}
|
}
|
||||||
|
|||||||
@ -74,7 +74,7 @@ public class AliFileManagerPlugin implements FileManagerPlugin {
|
|||||||
private OssSetting getSetting() {
|
private OssSetting getSetting() {
|
||||||
//如果没有配置,或者没有下次刷新时间,或者下次刷新时间小于当前时间,则从redis 更新一次
|
//如果没有配置,或者没有下次刷新时间,或者下次刷新时间小于当前时间,则从redis 更新一次
|
||||||
if (ossSetting == null || nextInitSetting == null || nextInitSetting < System.currentTimeMillis()) {
|
if (ossSetting == null || nextInitSetting == null || nextInitSetting < System.currentTimeMillis()) {
|
||||||
Setting setting = settingService.getById(SettingEnum.OSS_SETTING.name());
|
Setting setting = settingService.get(SettingEnum.OSS_SETTING.name());
|
||||||
if (setting == null || StrUtil.isBlank(setting.getSettingValue())) {
|
if (setting == null || StrUtil.isBlank(setting.getSettingValue())) {
|
||||||
throw new ServiceException("您还未配置阿里云OSS存储");
|
throw new ServiceException("您还未配置阿里云OSS存储");
|
||||||
}
|
}
|
||||||
|
|||||||
@ -12,7 +12,6 @@ import cn.lili.modules.system.service.SettingService;
|
|||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
@ -62,7 +61,7 @@ public class GoodsGalleryServiceImpl extends ServiceImpl<GoodsGalleryMapper, Goo
|
|||||||
public GoodsGallery getGoodsGallery(String origin) {
|
public GoodsGallery getGoodsGallery(String origin) {
|
||||||
GoodsGallery goodsGallery = new GoodsGallery();
|
GoodsGallery goodsGallery = new GoodsGallery();
|
||||||
//获取商品系统配置决定是否审核
|
//获取商品系统配置决定是否审核
|
||||||
Setting setting = settingService.getById(SettingEnum.GOODS_SETTING.name());
|
Setting setting = settingService.get(SettingEnum.GOODS_SETTING.name());
|
||||||
GoodsSetting goodsSetting = JSONUtil.toBean(setting.getSettingValue(), GoodsSetting.class);
|
GoodsSetting goodsSetting = JSONUtil.toBean(setting.getSettingValue(), GoodsSetting.class);
|
||||||
//缩略图
|
//缩略图
|
||||||
String thumbnail = fileManagerPlugin.getUrl(origin, goodsSetting.getAbbreviationPictureWidth(), goodsSetting.getAbbreviationPictureHeight());
|
String thumbnail = fileManagerPlugin.getUrl(origin, goodsSetting.getAbbreviationPictureWidth(), goodsSetting.getAbbreviationPictureHeight());
|
||||||
|
|||||||
@ -68,7 +68,7 @@ public class LogisticsServiceImpl extends ServiceImpl<LogisticsMapper, Logistics
|
|||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
private Traces getOrderTracesByJson(String logisticsId, String expNo) throws Exception {
|
private Traces getOrderTracesByJson(String logisticsId, String expNo) throws Exception {
|
||||||
Setting setting = settingService.getById(SettingEnum.KUAIDI_SETTING.name());
|
Setting setting = settingService.get(SettingEnum.KUAIDI_SETTING.name());
|
||||||
if (StrUtil.isBlank(setting.getSettingValue())) {
|
if (StrUtil.isBlank(setting.getSettingValue())) {
|
||||||
throw new ServiceException("您还未配置快递查询");
|
throw new ServiceException("您还未配置快递查询");
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user