|
|
|
@ -17,6 +17,7 @@ import cc.hiver.core.service.*; |
|
|
|
import cc.hiver.core.service.mybatis.IUserRoleService; |
|
|
|
import cc.hiver.core.vo.RoleDTO; |
|
|
|
import cc.hiver.mall.entity.ShopUser; |
|
|
|
import cc.hiver.mall.service.ShopService; |
|
|
|
import cc.hiver.mall.service.ShopUserService; |
|
|
|
import cn.hutool.core.util.StrUtil; |
|
|
|
import io.swagger.annotations.Api; |
|
|
|
@ -88,6 +89,9 @@ public class UserController { |
|
|
|
@Autowired |
|
|
|
private ShopUserService shopUserService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private ShopService shopService; |
|
|
|
|
|
|
|
@PersistenceContext |
|
|
|
private EntityManager entityManager; |
|
|
|
|
|
|
|
@ -127,6 +131,37 @@ public class UserController { |
|
|
|
return ResultUtil.success("修改成功"); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 线上demo不允许测试账号改密码 |
|
|
|
* |
|
|
|
* @param password |
|
|
|
* @param newPass |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@RequestMapping(value = "/modifyPassAndMobile", method = RequestMethod.POST) |
|
|
|
@ApiOperation(value = "修改密码和手机号") |
|
|
|
public Result modifyPassAndMobile( |
|
|
|
@ApiParam("用户id") @RequestParam String userId, |
|
|
|
@ApiParam("手机号") @RequestParam String mobile, |
|
|
|
@ApiParam("旧密码") @RequestParam String password, |
|
|
|
@ApiParam("新密码") @RequestParam String newPass) { |
|
|
|
User user = userService.findById(userId); |
|
|
|
if (!new BCryptPasswordEncoder().matches(password, user.getPassword())) { |
|
|
|
return ResultUtil.error("旧密码不正确"); |
|
|
|
} |
|
|
|
String newEncryptPass = new BCryptPasswordEncoder().encode(newPass); |
|
|
|
user.setPassword(newEncryptPass); |
|
|
|
//user.setPassStrength(passStrength);
|
|
|
|
user.setMobile(mobile); |
|
|
|
userService.update(user); |
|
|
|
// 手动更新缓存
|
|
|
|
redisTemplate.delete(USER + user.getUsername()); |
|
|
|
// 删除缓存
|
|
|
|
redisTemplate.delete(USER + user.getUsername()); |
|
|
|
|
|
|
|
return ResultUtil.success("修改密码和手机号成功"); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 线上demo不允许测试账号改密码 |
|
|
|
* |
|
|
|
@ -272,6 +307,11 @@ public class UserController { |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
userRoleService.saveOrUpdateAll(userRoles); |
|
|
|
} |
|
|
|
//注册店主和默认店铺
|
|
|
|
|
|
|
|
|
|
|
|
//店主添加店员
|
|
|
|
|
|
|
|
//添加店铺和用户信息
|
|
|
|
ShopUser shopUser = shopUserService.selectByUserIdAndShopId(u.getId(), shopId); |
|
|
|
if (shopUser != null) { |
|
|
|
|