提交 a700654c 作者: zhenjie

删除用户添加事务

上级 21d39ed4
...@@ -145,6 +145,7 @@ public class BackUserAccountServiceImpl implements BackUserAccountService { ...@@ -145,6 +145,7 @@ public class BackUserAccountServiceImpl implements BackUserAccountService {
return ResultBody.success(); return ResultBody.success();
} }
@Transactional
@Override @Override
public ResultBody disableBAccount(Integer accountId, LoginSuccessDTO loginSuccessDTO) { public ResultBody disableBAccount(Integer accountId, LoginSuccessDTO loginSuccessDTO) {
CompanyInfoVO companyInfoVO = companyService.getCompanyInfoByBackUserAccountId(accountId); CompanyInfoVO companyInfoVO = companyService.getCompanyInfoByBackUserAccountId(accountId);
......
...@@ -33,6 +33,7 @@ import org.apache.commons.lang.StringUtils; ...@@ -33,6 +33,7 @@ import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import java.util.List; import java.util.List;
...@@ -376,9 +377,9 @@ public class UserAccountServiceImpl implements UserAccountService { ...@@ -376,9 +377,9 @@ public class UserAccountServiceImpl implements UserAccountService {
@Autowired @Autowired
private CompanyDao companyDao; private CompanyDao companyDao;
@Transactional
@Override @Override
public ResultBody disableAppAccount(Integer userAccountId) { public ResultBody disableAppAccount(Integer userAccountId) {
userServiceDao.disableUserAccount(CodeUtil.removeUserAccount(), userAccountId);
UserAccountVO userAccountVO = new UserAccountVO(); UserAccountVO userAccountVO = new UserAccountVO();
userAccountVO.setId(userAccountId); userAccountVO.setId(userAccountId);
userAccountVO.setDeleted(1); userAccountVO.setDeleted(1);
...@@ -389,10 +390,12 @@ public class UserAccountServiceImpl implements UserAccountService { ...@@ -389,10 +390,12 @@ public class UserAccountServiceImpl implements UserAccountService {
if (companyInfoDO != null) { if (companyInfoDO != null) {
int members = companyDao.countCompanyMembers(companyInfoDO.getId()); int members = companyDao.countCompanyMembers(companyInfoDO.getId());
if (members > 1 && companyInfoDO.getLeader().equals(1)) { if (members > 1 && companyInfoDO.getLeader().equals(1)) {
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return ResultBody.error("该用户是单位管理员,暂时不能删除"); return ResultBody.error("该用户是单位管理员,暂时不能删除");
} }
companyDao.unbindCompanyMember(userAccountId, companyInfoDO.getId()); companyDao.unbindCompanyMember(userAccountId, companyInfoDO.getId());
} }
userServiceDao.disableUserAccount(CodeUtil.removeUserAccount(), userAccountId);
mqProducer.sentUserInfoChangedMsg(userAccountVO); mqProducer.sentUserInfoChangedMsg(userAccountVO);
return ResultBody.success(); return ResultBody.success();
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论