mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-05-03 09:29:59 +08:00
删除运营商时,删除对应部门
This commit is contained in:
@@ -6,7 +6,10 @@ import com.jsowell.common.core.domain.entity.SysDept;
|
|||||||
import com.jsowell.common.core.domain.entity.SysUser;
|
import com.jsowell.common.core.domain.entity.SysUser;
|
||||||
import com.jsowell.common.core.domain.vo.AuthorizedDeptVO;
|
import com.jsowell.common.core.domain.vo.AuthorizedDeptVO;
|
||||||
import com.jsowell.common.exception.BusinessException;
|
import com.jsowell.common.exception.BusinessException;
|
||||||
import com.jsowell.common.util.*;
|
import com.jsowell.common.util.DateUtils;
|
||||||
|
import com.jsowell.common.util.DictUtils;
|
||||||
|
import com.jsowell.common.util.SecurityUtils;
|
||||||
|
import com.jsowell.common.util.StringUtils;
|
||||||
import com.jsowell.pile.domain.PileMerchantInfo;
|
import com.jsowell.pile.domain.PileMerchantInfo;
|
||||||
import com.jsowell.pile.dto.CreateMerchantDTO;
|
import com.jsowell.pile.dto.CreateMerchantDTO;
|
||||||
import com.jsowell.pile.mapper.PileMerchantInfoMapper;
|
import com.jsowell.pile.mapper.PileMerchantInfoMapper;
|
||||||
@@ -192,7 +195,9 @@ public class PileMerchantInfoServiceImpl implements IPileMerchantInfoService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int deletePileMerchantInfoByIds(Long[] ids) {
|
public int deletePileMerchantInfoByIds(Long[] ids) {
|
||||||
return pileMerchantInfoMapper.deletePileMerchantInfoByIds(ids);
|
int i = pileMerchantInfoMapper.deletePileMerchantInfoByIds(ids);
|
||||||
|
deleteMerchantDept(Lists.newArrayList(ids));
|
||||||
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -203,7 +208,38 @@ public class PileMerchantInfoServiceImpl implements IPileMerchantInfoService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int deletePileMerchantInfoById(Long id) {
|
public int deletePileMerchantInfoById(Long id) {
|
||||||
return pileMerchantInfoMapper.deletePileMerchantInfoById(id);
|
int i = pileMerchantInfoMapper.deletePileMerchantInfoById(id);
|
||||||
|
// 删除对应部门
|
||||||
|
deleteMerchantDept(Lists.newArrayList(id));
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void deleteMerchantDept(List<Long> merchantIds) {
|
||||||
|
if (CollectionUtils.isEmpty(merchantIds)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for (Long merchantId : merchantIds) {
|
||||||
|
// 查询出来运营商信息
|
||||||
|
PileMerchantInfo pileMerchantInfo = selectPileMerchantInfoById(merchantId);
|
||||||
|
if (pileMerchantInfo == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// 部门id
|
||||||
|
String deptId = pileMerchantInfo.getDeptId();
|
||||||
|
|
||||||
|
// 逻辑删除部门的用户
|
||||||
|
SysUser user = new SysUser();
|
||||||
|
user.setDeptId(Long.parseLong(deptId));
|
||||||
|
List<SysUser> userList = userService.selectUserList(user);
|
||||||
|
if (CollectionUtils.isNotEmpty(userList)) {
|
||||||
|
Long[] array = userList.stream().map(SysUser::getUserId).toArray(Long[]::new);
|
||||||
|
userService.deleteUserByIds(array);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 逻辑删除部门
|
||||||
|
sysDeptService.deleteDeptById(Long.parseLong(deptId));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user