|
|
@@ -403,7 +403,6 @@ public class StoreUserServiceImpl extends ServiceImpl<StoreUserMapper, StoreUser
|
|
|
return R.data(vo);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
@Override
|
|
|
public R<IPage<StoreUserVo>> getStoreUserList(int pageNum, int pageSize, String id, String phone, Integer status, Integer accountType, String mainAccountId, String mainAccountPhone) {
|
|
|
IPage<StoreUser> page = new Page<>(pageNum, pageSize);
|
|
|
@@ -562,6 +561,7 @@ public class StoreUserServiceImpl extends ServiceImpl<StoreUserMapper, StoreUser
|
|
|
return list == null ? Collections.emptyList() : list.stream().map(StorePlatformUserRole::getUserId).distinct().collect(Collectors.toList());
|
|
|
}
|
|
|
|
|
|
+
|
|
|
@Override
|
|
|
public R<StoreUserVo> editStoreUser(StoreUser storeUser) {
|
|
|
storeUserMapper.updateById(storeUser);
|
|
|
@@ -580,6 +580,7 @@ public class StoreUserServiceImpl extends ServiceImpl<StoreUserMapper, StoreUser
|
|
|
}
|
|
|
|
|
|
|
|
|
+
|
|
|
/**
|
|
|
* web端切换商家端用户状态(主账号底下有子账号时禁止禁用;子账号无限制)
|
|
|
* @param storeUserParam
|
|
|
@@ -604,6 +605,20 @@ public class StoreUserServiceImpl extends ServiceImpl<StoreUserMapper, StoreUser
|
|
|
}
|
|
|
// 根据当前状态切另一个状态
|
|
|
int newStatus = storeUser.getStatus() == 0 ? 1 : 0;
|
|
|
+ if(storeUser.getAccountType() != null && storeUser.getAccountType() == 1){
|
|
|
+ LambdaUpdateWrapper<StoreUser> queryWrapper = new LambdaUpdateWrapper<>();
|
|
|
+ queryWrapper.eq(StoreUser::getId, storeUser.getId())
|
|
|
+ .set(StoreUser::getStatus, newStatus);
|
|
|
+ int updateCount = storeUserMapper.update(null, queryWrapper);
|
|
|
+ if (updateCount <= 0) {
|
|
|
+ throw new RuntimeException("更新失败");
|
|
|
+ }
|
|
|
+ StoreUserVo vo = new StoreUserVo();
|
|
|
+ vo.setId(storeUser.getId());
|
|
|
+ vo.setStatus(newStatus);
|
|
|
+ vo.setSwitchStatus(newStatus == 0);
|
|
|
+ return R.data(vo);
|
|
|
+ }
|
|
|
LambdaUpdateWrapper<StoreUser> queryWrapper = new LambdaUpdateWrapper<>();
|
|
|
queryWrapper.eq(StoreUser::getId, storeUser.getId())
|
|
|
.set(StoreUser::getStatus, newStatus);
|
|
|
@@ -611,6 +626,15 @@ public class StoreUserServiceImpl extends ServiceImpl<StoreUserMapper, StoreUser
|
|
|
if (updateCount <= 0) {
|
|
|
throw new RuntimeException("更新失败");
|
|
|
}
|
|
|
+// StoreUserVo vo = new StoreUserVo();
|
|
|
+// vo.setId(storeUser.getId());
|
|
|
+// vo.setStatus(newStatus);
|
|
|
+// vo.setSwitchStatus(newStatus == 0);
|
|
|
+ // 子账号启用/禁用时同步更新 store_platform_user_role 的 status(0 启用,1 禁用)
|
|
|
+ LambdaUpdateWrapper<StorePlatformUserRole> roleUpdateWrapper = new LambdaUpdateWrapper<>();
|
|
|
+ roleUpdateWrapper.eq(StorePlatformUserRole::getUserId, storeUser.getId())
|
|
|
+ .set(StorePlatformUserRole::getStatus, newStatus);
|
|
|
+ storePlatformUserRoleMapper.update(null, roleUpdateWrapper);
|
|
|
// 返回更新后的状态,供前端及时展示
|
|
|
StoreUserVo vo = new StoreUserVo();
|
|
|
vo.setId(storeUser.getId());
|
|
|
@@ -619,16 +643,6 @@ public class StoreUserServiceImpl extends ServiceImpl<StoreUserMapper, StoreUser
|
|
|
return R.data(vo);
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 分页查询
|
|
|
- * @param pageNum
|
|
|
- * @param pageSize
|
|
|
- * @param id
|
|
|
- * @param phone
|
|
|
- * @param status
|
|
|
- * @param accountType
|
|
|
- * @return
|
|
|
- */
|
|
|
@Override
|
|
|
public String exportExcel(String id, String phone, String status, Integer accountType) throws IOException {
|
|
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|