提交 03c0ef4e 作者: zhenjie

后台账号删除修改

上级 2cb1b1a0
...@@ -27,12 +27,25 @@ public class PmsClient { ...@@ -27,12 +27,25 @@ public class PmsClient {
HttpHeaders headers = new HttpHeaders(); HttpHeaders headers = new HttpHeaders();
headers.add("token", token); headers.add("token", token);
HttpEntity<String> entity = new HttpEntity<>(null, headers); HttpEntity<String> entity = new HttpEntity<>(null, headers);
ResponseEntity<ResultBody> responseEntity = restTemplate.exchange(pmsAppUri+"/pms/backstage/work/queryWorkServiceCount" + "?companyId=" + id, HttpMethod.GET, entity, ResultBody.class); ResponseEntity<ResultBody> responseEntity = restTemplate.exchange(pmsAppUri + "/pms/backstage/work/queryWorkServiceCount" + "?companyId=" + id, HttpMethod.GET, entity, ResultBody.class);
ResultBody body = responseEntity.getBody(); ResultBody body = responseEntity.getBody();
if (body.getCode().equals(ResultEnum.SUCCESS.getResultCode())){ if (body.getCode().equals(ResultEnum.SUCCESS.getResultCode())) {
Integer count = (Integer) body.getResult(); Integer count = (Integer) body.getResult();
return count; return count;
} }
return null; return null;
} }
public Integer removeMallGoods(Integer id, String token) {
HttpHeaders headers = new HttpHeaders();
headers.add("token", token);
HttpEntity<String> entity = new HttpEntity<>(null, headers);
ResponseEntity<ResultBody> responseEntity = restTemplate.exchange(pmsAppUri + "/pms/mall/goods/feignRemoveGoodsByBackUserAccountId" + "?id=" + id, HttpMethod.GET, entity, ResultBody.class);
ResultBody body = responseEntity.getBody();
if (body.getCode().equals(ResultEnum.SUCCESS.getResultCode())) {
return 1;
}
return null;
}
} }
...@@ -5,6 +5,7 @@ import com.mmc.iuav.page.PageResult; ...@@ -5,6 +5,7 @@ import com.mmc.iuav.page.PageResult;
import com.mmc.iuav.response.ResultBody; import com.mmc.iuav.response.ResultBody;
import com.mmc.iuav.response.ResultEnum; import com.mmc.iuav.response.ResultEnum;
import com.mmc.iuav.user.auth.PwdUtil; import com.mmc.iuav.user.auth.PwdUtil;
import com.mmc.iuav.user.client.PmsClient;
import com.mmc.iuav.user.dao.BackUserAccountDao; import com.mmc.iuav.user.dao.BackUserAccountDao;
import com.mmc.iuav.user.dao.RoleDao; import com.mmc.iuav.user.dao.RoleDao;
import com.mmc.iuav.user.entity.BackUserAccountDO; import com.mmc.iuav.user.entity.BackUserAccountDO;
...@@ -21,6 +22,7 @@ import com.mmc.iuav.user.model.vo.CompanyInfoVO; ...@@ -21,6 +22,7 @@ import com.mmc.iuav.user.model.vo.CompanyInfoVO;
import com.mmc.iuav.user.service.BackUserAccountService; import com.mmc.iuav.user.service.BackUserAccountService;
import com.mmc.iuav.user.service.CompanyService; import com.mmc.iuav.user.service.CompanyService;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.RandomStringUtils;
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;
...@@ -45,6 +47,9 @@ public class BackUserAccountServiceImpl implements BackUserAccountService { ...@@ -45,6 +47,9 @@ public class BackUserAccountServiceImpl implements BackUserAccountService {
@Autowired @Autowired
private RoleDao roleDao; private RoleDao roleDao;
@Autowired
private PmsClient pmsClient;
@Transactional @Transactional
@Override @Override
public ResultBody insertBAccount(BUserAccountVO bUserAccountVO) { public ResultBody insertBAccount(BUserAccountVO bUserAccountVO) {
...@@ -137,7 +142,7 @@ public class BackUserAccountServiceImpl implements BackUserAccountService { ...@@ -137,7 +142,7 @@ public class BackUserAccountServiceImpl implements BackUserAccountService {
@Override @Override
public ResultBody disableBAccount(Integer accountId, Integer backUserAccountId) { public ResultBody disableBAccount(Integer accountId, Integer backUserAccountId) {
BackUserAccountDO backUserAccountDO = backUserAccountDao.getBackUserAccountDO(backUserAccountId); BackUserAccountDO backUserAccountDO = backUserAccountDao.getBackUserAccountDO(accountId);
RoleInfoDO roleInfoDO = roleDao.getRoleInfoByUserId(accountId); RoleInfoDO roleInfoDO = roleDao.getRoleInfoByUserId(accountId);
if (roleInfoDO.getSuperAdmin().equals(RoleEnums.ADMIN.getId())) { if (roleInfoDO.getSuperAdmin().equals(RoleEnums.ADMIN.getId())) {
return ResultBody.error(ResultEnum.DELETE_ADMIN_ERROR); return ResultBody.error(ResultEnum.DELETE_ADMIN_ERROR);
...@@ -145,13 +150,14 @@ public class BackUserAccountServiceImpl implements BackUserAccountService { ...@@ -145,13 +150,14 @@ public class BackUserAccountServiceImpl implements BackUserAccountService {
if (accountId.toString().equals(backUserAccountId.toString())) { if (accountId.toString().equals(backUserAccountId.toString())) {
return ResultBody.error(ResultEnum.DELETE_YOURSELF_ERROR); return ResultBody.error(ResultEnum.DELETE_YOURSELF_ERROR);
} }
CompanyInfoVO companyInfoVO = companyService.getCompanyInfoByBackUserAccountId(backUserAccountId); CompanyInfoVO companyInfoVO = companyService.getCompanyInfoByBackUserAccountId(accountId);
if (companyInfoVO != null && companyInfoVO.getCompanyType().equals(CompanyTypeEnums.FRANCHISEE.getType())) { if (companyInfoVO != null && companyInfoVO.getCompanyType().equals(CompanyTypeEnums.FRANCHISEE.getType())) {
// 加盟企业的账号,需要把对应的成员和后台账号解绑 // 加盟企业的账号,需要把对应的成员和后台账号解绑
companyService.unbindingAllUsers(companyInfoVO.getId()); companyService.unbindingAllUsers(companyInfoVO.getId());
} }
String accountNo = "DISABLE_" + backUserAccountDO.getAccountNo(); String accountNo = "DISABLE_" + backUserAccountDO.getAccountNo() + RandomStringUtils.randomAlphanumeric(3);
backUserAccountDao.disableBackUserAccountDO(accountId, accountNo); backUserAccountDao.disableBackUserAccountDO(accountId, accountNo);
pmsClient.removeMallGoods(accountId, null);
return ResultBody.success(); return ResultBody.success();
} }
......
...@@ -193,13 +193,6 @@ public class CooperationServiceImpl implements CooperationService { ...@@ -193,13 +193,6 @@ public class CooperationServiceImpl implements CooperationService {
ResultBody resultBody = backUserAccountService.insertBAccount(bUserAccountVO); ResultBody resultBody = backUserAccountService.insertBAccount(bUserAccountVO);
if (!resultBody.getCode().equals(ResultEnum.SUCCESS.getResultCode())) { if (!resultBody.getCode().equals(ResultEnum.SUCCESS.getResultCode())) {
// 生成账号失败处理 // 生成账号失败处理
if (resultBody.getCode().equals(ResultEnum.ADD_USER_ACCOUNT_NAME_EXISTS.getResultCode())) {
bUserAccountVO.setAccountNo(bUserAccountVO.getPhoneNum() + "X");
ResultBody retryResultBody = backUserAccountService.insertBAccount(bUserAccountVO);
if (retryResultBody.getCode().equals(ResultEnum.SUCCESS.getResultCode())) {
throw new BizException(ResultEnum.COOPERATION_CHECK_NOT_PASS_ERROR);
}
}
throw new BizException(ResultEnum.COOPERATION_CHECK_NOT_PASS_ERROR); throw new BizException(ResultEnum.COOPERATION_CHECK_NOT_PASS_ERROR);
} }
Map<String, String> param = new HashMap<String, String>(); Map<String, String> param = new HashMap<String, String>();
......
...@@ -153,7 +153,7 @@ ...@@ -153,7 +153,7 @@
select count(*) from company_info ci select count(*) from company_info ci
INNER JOIN company_back_user cbu ON ci.id = cbu.company_info_id INNER JOIN company_back_user cbu ON ci.id = cbu.company_info_id
INNER JOIN back_user_account bua ON cbu.back_user_account_id = bua.id INNER JOIN back_user_account bua ON cbu.back_user_account_id = bua.id
where ci.id = #{id} and ci.is_deleted = 0 and bua.is_deleted = 0 where ci.id = #{id} and ci.is_deleted = 0 and bua.`disable` = 0
</select> </select>
<select id="listCompanyInfoByUID" resultType="com.mmc.iuav.user.entity.CompanyInfoDO"> <select id="listCompanyInfoByUID" resultType="com.mmc.iuav.user.entity.CompanyInfoDO">
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论