|
@@ -1,5 +1,6 @@
|
|
package com.caimei.service.impl;
|
|
package com.caimei.service.impl;
|
|
|
|
|
|
|
|
+import com.caimei.components.RedisService;
|
|
import com.caimei.mapper.ShopMapper;
|
|
import com.caimei.mapper.ShopMapper;
|
|
import com.caimei.mapper.UserMapper;
|
|
import com.caimei.mapper.UserMapper;
|
|
import com.caimei.model.ResponseJson;
|
|
import com.caimei.model.ResponseJson;
|
|
@@ -12,18 +13,17 @@ import com.caimei.model.vo.CountryVo;
|
|
import com.caimei.model.vo.ShopFormVo;
|
|
import com.caimei.model.vo.ShopFormVo;
|
|
import com.caimei.model.vo.ShopListVo;
|
|
import com.caimei.model.vo.ShopListVo;
|
|
import com.caimei.service.ShopService;
|
|
import com.caimei.service.ShopService;
|
|
-import com.caimei.utils.AliyunSmsUtil;
|
|
|
|
-import com.caimei.utils.CodeUtil;
|
|
|
|
-import com.caimei.utils.Md5Util;
|
|
|
|
-import com.caimei.utils.OSSUtils;
|
|
|
|
|
|
+import com.caimei.utils.*;
|
|
import com.github.pagehelper.PageHelper;
|
|
import com.github.pagehelper.PageHelper;
|
|
import com.github.pagehelper.PageInfo;
|
|
import com.github.pagehelper.PageInfo;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.apache.commons.codec.digest.DigestUtils;
|
|
import org.apache.commons.codec.digest.DigestUtils;
|
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
import java.io.File;
|
|
import java.io.File;
|
|
import java.io.FileInputStream;
|
|
import java.io.FileInputStream;
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
@@ -80,10 +80,10 @@ public class ShopServiceImpl implements ShopService {
|
|
String md5Password = Md5Util.md5(newPassword);
|
|
String md5Password = Md5Util.md5(newPassword);
|
|
userMapper.updatePasswordByUserId(authUserId, md5Password);
|
|
userMapper.updatePasswordByUserId(authUserId, md5Password);
|
|
String mobile = shopMapper.getShopMobileByUserId(authUserId);
|
|
String mobile = shopMapper.getShopMobileByUserId(authUserId);
|
|
- boolean smsFlag = AliyunSmsUtil.sendSms(mobile, 14, "{code:" + newPassword + "}");
|
|
|
|
|
|
+ boolean smsFlag = AliyunSmsUtil.sendSms(mobile, 14, "{password:\"" + newPassword + "\"}");
|
|
if (!smsFlag) {
|
|
if (!smsFlag) {
|
|
// 短信发送失败重试一次
|
|
// 短信发送失败重试一次
|
|
- AliyunSmsUtil.sendSms(mobile, 14, "{code:" + newPassword + "}");
|
|
|
|
|
|
+ AliyunSmsUtil.sendSms(mobile, 14, "{password:\"" + newPassword + "\"}");
|
|
}
|
|
}
|
|
log.info("正品联盟后台供应商重置密码,用户id:" + authUserId + ",新密码:" + newPassword);
|
|
log.info("正品联盟后台供应商重置密码,用户id:" + authUserId + ",新密码:" + newPassword);
|
|
return ResponseJson.success("密码重置成功");
|
|
return ResponseJson.success("密码重置成功");
|
|
@@ -157,6 +157,18 @@ public class ShopServiceImpl implements ShopService {
|
|
}
|
|
}
|
|
// 是否为添加操作
|
|
// 是否为添加操作
|
|
boolean insertFlag = null == shopSaveDto.getAuthUserId();
|
|
boolean insertFlag = null == shopSaveDto.getAuthUserId();
|
|
|
|
+ // 手机号
|
|
|
|
+ String mobile = shopSaveDto.getMobile();
|
|
|
|
+ if (StringUtils.isBlank(mobile)) {
|
|
|
|
+ return ResponseJson.error("参数异常,请输入手机号");
|
|
|
|
+ }
|
|
|
|
+ if (insertFlag) {
|
|
|
|
+ // 添加时验证手机号是否已被使用
|
|
|
|
+ Integer userIdByMobile = shopMapper.getUserIdByMobile(mobile);
|
|
|
|
+ if (null != userIdByMobile) {
|
|
|
|
+ return ResponseJson.error("该手机号已被使用,请重新输入", null);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
// 更新品牌授权logo
|
|
// 更新品牌授权logo
|
|
shopMapper.updateBrandAuthLogo(shopSaveDto.getBrandId(),shopSaveDto.getBrandAuthLogo());
|
|
shopMapper.updateBrandAuthLogo(shopSaveDto.getBrandId(),shopSaveDto.getBrandAuthLogo());
|
|
/*
|
|
/*
|
|
@@ -179,13 +191,14 @@ public class ShopServiceImpl implements ShopService {
|
|
// 创建时间
|
|
// 创建时间
|
|
shop.setCreateTime(new Date());
|
|
shop.setCreateTime(new Date());
|
|
// 设置随机8位密码
|
|
// 设置随机8位密码
|
|
- String password = Md5Util.md5(CodeUtil.generateCode(8));
|
|
|
|
- shop.setPassword(password);
|
|
|
|
|
|
+ String password = CodeUtil.generateCode(8);
|
|
|
|
+ String md5Pwd = Md5Util.md5(password);
|
|
|
|
+ shop.setPassword(md5Pwd);
|
|
// 发送短信
|
|
// 发送短信
|
|
- boolean smsFlag = AliyunSmsUtil.sendSms(shopSaveDto.getMobile(), 14, "{code:" + password + "}");
|
|
|
|
|
|
+ boolean smsFlag = AliyunSmsUtil.sendSms(shopSaveDto.getMobile(), 14, "{password:\"" + password + "\"}");
|
|
if (!smsFlag) {
|
|
if (!smsFlag) {
|
|
// 短信发送失败重试一次
|
|
// 短信发送失败重试一次
|
|
- AliyunSmsUtil.sendSms(shopSaveDto.getMobile(), 14, "{code:" + password + "}");
|
|
|
|
|
|
+ AliyunSmsUtil.sendSms(shopSaveDto.getMobile(), 14, "{password:\"" + password + "\"}");
|
|
}
|
|
}
|
|
// 插入供应商用户
|
|
// 插入供应商用户
|
|
shopMapper.insertShop(shop);
|
|
shopMapper.insertShop(shop);
|