|
@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
@@ -294,13 +295,16 @@ public class StoreUserServiceImpl extends ServiceImpl<StoreUserMapper, StoreUser
|
|
|
* @return boolean
|
|
|
*/
|
|
|
@Override
|
|
|
- public boolean setUserInfo(Integer id, String name, String idCard, String nickName, String accountBlurb) {
|
|
|
+ public boolean setUserInfo(Integer id, String name, String idCard, String nickName, String accountBlurb, String headImg) {
|
|
|
StoreUser storeUser = new StoreUser();
|
|
|
storeUser.setId(id);
|
|
|
storeUser.setName(name);
|
|
|
storeUser.setIdCard(idCard);
|
|
|
storeUser.setNickName(nickName);
|
|
|
storeUser.setAccountBlurb(accountBlurb);
|
|
|
+ if (StringUtils.isNotEmpty(headImg)) {
|
|
|
+ storeUser.setHeadImg(headImg);
|
|
|
+ }
|
|
|
return this.updateById(storeUser);
|
|
|
}
|
|
|
|
|
@@ -373,10 +377,19 @@ public class StoreUserServiceImpl extends ServiceImpl<StoreUserMapper, StoreUser
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public void deleteStoreUser(String id) {
|
|
|
+ public R<StoreUserVo> deleteStoreUser(String id) {
|
|
|
StoreUser storeUser = storeUserMapper.selectById(id);
|
|
|
String phone = storeUser.getPhone();
|
|
|
Integer storeId = storeUser.getStoreId();
|
|
|
+
|
|
|
+ // 判断该账号是否关联店铺
|
|
|
+ if (ObjectUtils.isNotEmpty(storeId)) {
|
|
|
+ List<StoreInfo> storeInfos = storeInfoMapper.selectList(new LambdaQueryWrapper<StoreInfo>().eq(StoreInfo::getId, storeId).eq(StoreInfo::getDeleteFlag, 0).eq(StoreInfo::getLogoutFlag, 0));
|
|
|
+ if (ObjectUtils.isNotEmpty(storeInfos)) {
|
|
|
+ return R.fail("请删除店铺后再删除账号");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
storeUserMapper.deleteById(id);
|
|
|
//删除用户redis中的token
|
|
|
baseRedisService.delete("store_" + storeUser.getPhone());
|
|
@@ -394,6 +407,8 @@ public class StoreUserServiceImpl extends ServiceImpl<StoreUserMapper, StoreUser
|
|
|
lifeMessageMapper.delete(new LambdaQueryWrapper<LifeMessage>().eq(LifeMessage::getSenderId, "store_" + phone));
|
|
|
//删除该账号的接受消息信息
|
|
|
lifeMessageMapper.delete(new LambdaQueryWrapper<LifeMessage>().eq(LifeMessage::getReceiverId, "store_" + phone));
|
|
|
+
|
|
|
+ return R.success("删除成功");
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -554,6 +569,8 @@ public class StoreUserServiceImpl extends ServiceImpl<StoreUserMapper, StoreUser
|
|
|
storeUser.setLogoutReason(storeUserVo.getLogoutReason());
|
|
|
// 添加注销申请时间
|
|
|
storeUser.setLogoutTime(new Date());
|
|
|
+ // 注销中状态
|
|
|
+ storeUser.setStatus(-1);
|
|
|
storeUserMapper.updateById(storeUser);
|
|
|
}
|
|
|
}
|